diff --git a/main_vm/.gitignore b/main_vm/.gitignore new file mode 100644 index 0000000..7814793 --- /dev/null +++ b/main_vm/.gitignore @@ -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/ diff --git a/main_vm/.gradle/7.5.1/checksums/checksums.lock b/main_vm/.gradle/7.5.1/checksums/checksums.lock index d90ea80..6b18317 100644 Binary files a/main_vm/.gradle/7.5.1/checksums/checksums.lock and b/main_vm/.gradle/7.5.1/checksums/checksums.lock differ diff --git a/main_vm/.gradle/7.5.1/dependencies-accessors/dependencies-accessors.lock b/main_vm/.gradle/7.5.1/dependencies-accessors/dependencies-accessors.lock index 967e1ae..3680f4e 100644 Binary files a/main_vm/.gradle/7.5.1/dependencies-accessors/dependencies-accessors.lock and b/main_vm/.gradle/7.5.1/dependencies-accessors/dependencies-accessors.lock differ diff --git a/main_vm/.gradle/7.5.1/executionHistory/executionHistory.lock b/main_vm/.gradle/7.5.1/executionHistory/executionHistory.lock index 2ab0ff2..8a054e4 100644 Binary files a/main_vm/.gradle/7.5.1/executionHistory/executionHistory.lock and b/main_vm/.gradle/7.5.1/executionHistory/executionHistory.lock differ diff --git a/main_vm/.gradle/7.5.1/fileHashes/fileHashes.lock b/main_vm/.gradle/7.5.1/fileHashes/fileHashes.lock index 4e8e072..5e37d14 100644 Binary files a/main_vm/.gradle/7.5.1/fileHashes/fileHashes.lock and b/main_vm/.gradle/7.5.1/fileHashes/fileHashes.lock differ diff --git a/main_vm/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/main_vm/.gradle/buildOutputCleanup/buildOutputCleanup.lock index 42daddb..3c95fdd 100644 Binary files a/main_vm/.gradle/buildOutputCleanup/buildOutputCleanup.lock and b/main_vm/.gradle/buildOutputCleanup/buildOutputCleanup.lock differ diff --git a/main_vm/.gradle/buildOutputCleanup/cache.properties b/main_vm/.gradle/buildOutputCleanup/cache.properties index 29447a6..61a3eab 100644 --- a/main_vm/.gradle/buildOutputCleanup/cache.properties +++ b/main_vm/.gradle/buildOutputCleanup/cache.properties @@ -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 diff --git a/main_vm/.idea/gradle.xml b/main_vm/.idea/gradle.xml index 611e7c8..77e9972 100644 --- a/main_vm/.idea/gradle.xml +++ b/main_vm/.idea/gradle.xml @@ -1,11 +1,11 @@ - \ No newline at end of file diff --git a/main_vm/.idea/vcs.xml b/main_vm/.idea/vcs.xml index 6c0b863..b2bdec2 100644 --- a/main_vm/.idea/vcs.xml +++ b/main_vm/.idea/vcs.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/main_vm/build.gradle b/main_vm/build.gradle new file mode 100644 index 0000000..2d57736 --- /dev/null +++ b/main_vm/build.gradle @@ -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 추가 끝 diff --git a/main_vm/gradle/wrapper/gradle-wrapper.jar b/main_vm/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..249e583 Binary files /dev/null and b/main_vm/gradle/wrapper/gradle-wrapper.jar differ diff --git a/main_vm/gradle/wrapper/gradle-wrapper.properties b/main_vm/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..ae04661 --- /dev/null +++ b/main_vm/gradle/wrapper/gradle-wrapper.properties @@ -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 diff --git a/main_vm/gradlew b/main_vm/gradlew new file mode 100644 index 0000000..a69d9cb --- /dev/null +++ b/main_vm/gradlew @@ -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" "$@" diff --git a/main_vm/gradlew.bat b/main_vm/gradlew.bat new file mode 100644 index 0000000..f127cfd --- /dev/null +++ b/main_vm/gradlew.bat @@ -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 diff --git a/main_vm/lib/ASRLIB-2.4.0.2.jar b/main_vm/lib/ASRLIB-2.4.0.2.jar new file mode 100644 index 0000000..55951d4 Binary files /dev/null and b/main_vm/lib/ASRLIB-2.4.0.2.jar differ diff --git a/main_vm/lib/pttsnet_class.jar b/main_vm/lib/pttsnet_class.jar new file mode 100644 index 0000000..5c32852 Binary files /dev/null and b/main_vm/lib/pttsnet_class.jar differ diff --git a/main_vm/settings.gradle b/main_vm/settings.gradle new file mode 100644 index 0000000..7a88422 --- /dev/null +++ b/main_vm/settings.gradle @@ -0,0 +1 @@ +rootProject.name = 'main_vm' diff --git a/main_vm/src/main/java/com/icomsys/main_vm/MainVmApplication.java b/main_vm/src/main/java/com/icomsys/main_vm/MainVmApplication.java new file mode 100644 index 0000000..e0a20ee --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/MainVmApplication.java @@ -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); + }} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/ServletInitializer.java b/main_vm/src/main/java/com/icomsys/main_vm/ServletInitializer.java new file mode 100644 index 0000000..d97bbaa --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/ServletInitializer.java @@ -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); + } + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/advice/AdviceHandler.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/advice/AdviceHandler.java new file mode 100644 index 0000000..7046934 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/advice/AdviceHandler.java @@ -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 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(); + } + + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/advice/ErrorResult.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/advice/ErrorResult.java new file mode 100644 index 0000000..beb5f1d --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/advice/ErrorResult.java @@ -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; + + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/advice/README.md b/main_vm/src/main/java/com/icomsys/main_vm/biz/advice/README.md new file mode 100644 index 0000000..7674e71 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/advice/README.md @@ -0,0 +1,2 @@ +전자정부의 경우 익셉션을 종류별로 잡기가 힘들어 +스프링부분으로 커스터마이징 diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/advice/excep/CustomBadRequestException.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/advice/excep/CustomBadRequestException.java new file mode 100644 index 0000000..b0ebe13 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/advice/excep/CustomBadRequestException.java @@ -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); + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/advice/excep/CustomNoSuchFieldException.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/advice/excep/CustomNoSuchFieldException.java new file mode 100644 index 0000000..89b3a2d --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/advice/excep/CustomNoSuchFieldException.java @@ -0,0 +1,4 @@ +package com.icomsys.main_vm.biz.advice.excep; + +public class CustomNoSuchFieldException extends Exception{ +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/advice/excep/CustomNotFoundException.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/advice/excep/CustomNotFoundException.java new file mode 100644 index 0000000..e72729d --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/advice/excep/CustomNotFoundException.java @@ -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); + } + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/advice/excep/CustomRuntimeException.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/advice/excep/CustomRuntimeException.java new file mode 100644 index 0000000..1e9674f --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/advice/excep/CustomRuntimeException.java @@ -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); + } + + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/common/common/service/ExcelService.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/common/service/ExcelService.java new file mode 100644 index 0000000..90de2e0 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/common/service/ExcelService.java @@ -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 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 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 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로 컨버팅해줌 + public List ExcelUploadConvert(MultipartFile excel, Class base) throws IOException { + List baseVarName = new ArrayList<>(); + List 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) (json, typeOfT, context) + -> LocalDateTime.parse(json.getAsString(), DateTimeFormatter.ISO_LOCAL_DATE_TIME)) + .registerTypeAdapter(LocalDate.class, (JsonDeserializer) (json, typeOfT, context) + -> LocalDate.parse(json.getAsString(), DateTimeFormatter.ofPattern("yyyy-MM-dd"))) + .registerTypeAdapter(LocalTime.class, (JsonDeserializer) (json, typeOfT, context) + -> LocalTime.parse(json.getAsString(), DateTimeFormatter.ofPattern("HH:mm:ss"))) + .create() + .fromJson(String.valueOf(e), base)) + .collect(Collectors.toList()); + } + + + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/common/common/service/FileService.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/common/service/FileService.java new file mode 100644 index 0000000..94625a3 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/common/service/FileService.java @@ -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 FileSaveService(MultipartFile[] uploadfile) throws IllegalStateException, IOException { + List 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 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(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(recorce, header, HttpStatus.OK); + } + + + public ResponseEntity 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); + } + + +} + + + + + + + diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/common/common/service/LogService.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/common/service/LogService.java new file mode 100644 index 0000000..698f5f2 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/common/service/LogService.java @@ -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); + + + } + + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/common/common/service/LogVO.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/common/service/LogVO.java new file mode 100644 index 0000000..2f79b87 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/common/service/LogVO.java @@ -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; + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/common/common/service/RestTemplateService.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/common/service/RestTemplateService.java new file mode 100644 index 0000000..392eecb --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/common/service/RestTemplateService.java @@ -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 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 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 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 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 ConvertParam(List dto) { + Map 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 dto, Map apiReqParam, Map 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 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; + } + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/common/common/service/SequenceService.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/common/service/SequenceService.java new file mode 100644 index 0000000..0b9d79a --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/common/service/SequenceService.java @@ -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(); +// } + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/common/common/service/functionnode/FunctionVo.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/common/service/functionnode/FunctionVo.java new file mode 100644 index 0000000..5d582dc --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/common/service/functionnode/FunctionVo.java @@ -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 varList; + private HashMap callData; + private String initSctipt; + private int timeOut; + + @Builder + public FunctionVo(List varList, HashMap callData, String initSctipt, int timeOut) { + this.varList = varList; + this.callData = callData; + this.initSctipt = initSctipt; + this.timeOut = timeOut; + } + + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/common/common/service/functionnode/FunctionWsNashorn.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/common/service/functionnode/FunctionWsNashorn.java new file mode 100644 index 0000000..da5b88b --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/common/service/functionnode/FunctionWsNashorn.java @@ -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 varList; + private HashMap callData = new HashMap<>(); + private String initSctipt; + private List 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; + } + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/common/common/service/functionnode/ex/WsNotAvailableException.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/common/service/functionnode/ex/WsNotAvailableException.java new file mode 100644 index 0000000..2a60f45 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/common/service/functionnode/ex/WsNotAvailableException.java @@ -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); + } + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/common/dashboard/controller/DashboardController.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/dashboard/controller/DashboardController.java new file mode 100644 index 0000000..2eaf4ba --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/dashboard/controller/DashboardController.java @@ -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 selectStatCallInfoList(@RequestBody StatisticsDashboardVO vo) { + List result = statisticsDashboardService.selectStatCallInfo(vo); + + return result; + } + + @RequestMapping(value = "/intentlist.do", method = {RequestMethod.GET, RequestMethod.POST}) + @ResponseBody + public List selectStatIntentList(@RequestBody StatisticsDashboardVO vo) { + List result = statisticsDashboardService.selectStatIntent(vo); + + return result; + } + + @RequestMapping(value = "/scenariolist.do", method = {RequestMethod.GET, RequestMethod.POST}) + @ResponseBody + public List selectStatScenarioList(@RequestBody StatisticsDashboardVO vo) { + List result = statisticsDashboardService.selectStatScenario(vo); + + return result; + } + + @RequestMapping(value = "/callcntlist.do", method = {RequestMethod.GET, RequestMethod.POST}) + @ResponseBody + public List selectTodayCallCntList(@RequestBody StatisticsDashboardVO vo) { + List 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; + } + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/common/errorpage/controller/ErrorPageController.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/errorpage/controller/ErrorPageController.java new file mode 100644 index 0000000..e05de1e --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/errorpage/controller/ErrorPageController.java @@ -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"; + } +} + + + + + + + diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/common/login/controller/LoginController.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/login/controller/LoginController.java new file mode 100644 index 0000000..645f34e --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/login/controller/LoginController.java @@ -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 menuVoList = loginService.selectMainMenuLeft(); + model.addAttribute("list_menulist", menuVoList); + return "adm/include/getLnbMenu"; + } + + @GetMapping("/adm/menu/serviceGroup") + public List 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 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 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 + + 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 jstreeParentConvertToPolicy() { + return loginService.jstreeParentConvertToPolicy(); + } + + @GetMapping("/adm/menu/role") + @ResponseBody + public String getRole() { + return loginService.getUserVo().getRoleVal(); + } + + + @GetMapping("/adm/main/pdfdownload") + @ResponseBody + public ResponseEntity 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(); + } + } + +} + + diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/common/login/req/LoginReq.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/login/req/LoginReq.java new file mode 100644 index 0000000..0ed2d0b --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/login/req/LoginReq.java @@ -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); + } +} + diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/common/login/req/MainOprReq.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/login/req/MainOprReq.java new file mode 100644 index 0000000..b9b88f2 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/login/req/MainOprReq.java @@ -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; + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/common/login/req/PwdUpdateReq.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/login/req/PwdUpdateReq.java new file mode 100644 index 0000000..21eb8df --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/login/req/PwdUpdateReq.java @@ -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; + } +} + diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/common/login/res/LoginCheckReq.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/login/res/LoginCheckReq.java new file mode 100644 index 0000000..bcd1e5e --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/login/res/LoginCheckReq.java @@ -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; + } + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/common/login/res/OprmngCodeRes.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/login/res/OprmngCodeRes.java new file mode 100644 index 0000000..3129a0b --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/login/res/OprmngCodeRes.java @@ -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; + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/common/login/res/SelectMainMenuHeadVo.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/login/res/SelectMainMenuHeadVo.java new file mode 100644 index 0000000..0e19568 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/login/res/SelectMainMenuHeadVo.java @@ -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; + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/common/login/res/ServiceGroupRes.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/login/res/ServiceGroupRes.java new file mode 100644 index 0000000..6870622 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/login/res/ServiceGroupRes.java @@ -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; + } + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/common/login/res/UserPolicyListRes.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/login/res/UserPolicyListRes.java new file mode 100644 index 0000000..27f3dc1 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/login/res/UserPolicyListRes.java @@ -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; + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/common/login/res/UserVo.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/login/res/UserVo.java new file mode 100644 index 0000000..9919495 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/login/res/UserVo.java @@ -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; + } + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/common/login/service/CustomUserDetailsService.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/login/service/CustomUserDetailsService.java new file mode 100644 index 0000000..f15a3b4 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/login/service/CustomUserDetailsService.java @@ -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 authList = new ArrayList<>(); + authList.add(dto.getRoleVal()); + log.info("authList - {}", new Gson().toJson(authList)); + List permission = authList.stream() + .map(SimpleGrantedAuthority::new) + .collect(Collectors.toList()); + return new User(String.valueOf(dto.getUserId()), dto.getPassword(), permission) + ; + } + + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/common/login/service/LoginService.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/login/service/LoginService.java new file mode 100644 index 0000000..b203596 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/login/service/LoginService.java @@ -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 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 getSessionPolicy() { + return (ArrayList) httpServletRequest.getSession().getAttribute(SessionResource.PolicyList.getName()); + } + + @Transactional + public List 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 authToAuthList(List 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 authToMenuList(List authList, int roleValSeq) { + Map 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 result = new ArrayList<>(); + List 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 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 selectMainMenuLeft(Long seq, String lastService, String role) { + return authToMenuList(getUserPolicyList(seq, lastService), RoleResource.valueOf(role).getRoleValSeq().intValue()); + } + + @Transactional + public List getServiceGroup() { + UserVo uv = getUserVo(); + List 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 getOprmngCode(String serviceType, String menuval) { + List result = tbServiceGrouopRepo.getOprmngCode(getUserVo(), serviceType, menuval); + log.info("result - {}", new Gson().toJson(result)); + return result; + } + + @Transactional + public List getMainOprmngCode() { +// List result = tbServiceGrouopRepo.getMainOprmngCode(getUserVo()); + + List 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 serviceResult = tbUserCustRepo.findByUserSeq(getUserVo().getUserSeq()) + .stream().map(e -> e.getServiceGroup()).collect(Collectors.toList()); + + List 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 jstreeParentConvertToPolicy() { + return EnumToMap.PolicyToParentMap; + } + + public List getOprmngCodeAdmin(String serviceType) { + + List 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(); + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/controller/SystemCommoncodeController.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/controller/SystemCommoncodeController.java new file mode 100644 index 0000000..807420d --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/controller/SystemCommoncodeController.java @@ -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 SystemCommoncodeList(@RequestBody SystemCommoncodeReq dto) { + QueryResults result = systemOprmngcodeService.SystemCommoncodeList(dto); + return new DslDataTableRes(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); + } + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/controller/SystemCustController.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/controller/SystemCustController.java new file mode 100644 index 0000000..1934f53 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/controller/SystemCustController.java @@ -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 CustList(@RequestBody SystemIcsCustInfoReq dto) { + log.info("list dto = {}", new Gson().toJson(dto)); + QueryResults result = custService.CustList(dto); + return new DslDataTableRes(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 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); + } + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/controller/SystemGroupAuthController.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/controller/SystemGroupAuthController.java new file mode 100644 index 0000000..e0457e8 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/controller/SystemGroupAuthController.java @@ -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 GroupAuthList(@RequestBody SystemServiceAuthGroupReq dto) { + log.info("list dto = {}", new Gson().toJson(dto)); + QueryResults result = groupAuthService.GroupAuthList(dto); + return new DslDataTableRes(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 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 GroupInsertOpr() { + return groupAuthService.GroupInsertOpr(); + } + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/controller/SystemPolicyMenuController.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/controller/SystemPolicyMenuController.java new file mode 100644 index 0000000..473274a --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/controller/SystemPolicyMenuController.java @@ -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 PolicyMenuList(@RequestBody SystemPolicyMenuReq dto) { + DslDataTableRes result = systemPolicyMenuService.PolicyMenuList(dto); + log.info("PolicyMenuList result = {}", new Gson().toJson(result)); + return result; + } + + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/controller/SystemServiceGroupController.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/controller/SystemServiceGroupController.java new file mode 100644 index 0000000..f1cad13 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/controller/SystemServiceGroupController.java @@ -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 ServiceGroupList(@RequestBody SystemServiceGroupReq dto) { + QueryResults result = systemServiceGroupService.ServiceGroupList(dto); + return new DslDataTableRes(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 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); + } + + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/controller/SystemUserAdminController.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/controller/SystemUserAdminController.java new file mode 100644 index 0000000..c7b6fb7 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/controller/SystemUserAdminController.java @@ -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 userAdminList(@RequestBody SystemBotUserReq dto) { + log.info("list dto = {}", new Gson().toJson(dto)); + DslDataTableRes 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 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 UserAdminCustList() throws CustomNotFoundException { + + return systemUserAdminService.UserAdminCustList(); + } + + @GetMapping("/userAdmin/service/select") + @ResponseBody + public List UserAdminServiceList(@RequestParam(name = "custCode", required = true)String cust) throws CustomNotFoundException { + return systemUserAdminService.UserAdminServiceList(cust); + } + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/controller/SystemUserController.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/controller/SystemUserController.java new file mode 100644 index 0000000..50cad82 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/controller/SystemUserController.java @@ -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 userList(@RequestBody SystemBotUserReq dto) { + log.info("list dto = {}", new Gson().toJson(dto)); + QueryResults result = systemUserService.SystemUserList(dto); + return new DslDataTableRes(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 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 UserCustList() throws CustomNotFoundException { + return systemUserService.UserCustList(); + } + + /** + * @Name 해당 서비스그룹 검색 + * @Description 해당유저를 생성할때 사용할 수 있는 서비스 그룹 검색 + * @Author JangWonSeok + * @CreateDate 2023. 03. 09. + */ + @GetMapping("/user/service/select") + @ResponseBody + public List 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(); + } + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/service/SystemCommoncodeService.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/service/SystemCommoncodeService.java new file mode 100644 index 0000000..de87775 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/service/SystemCommoncodeService.java @@ -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 SystemCommoncodeList(SystemCommoncodeReq dto) { + QueryResults 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()); + } + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/service/SystemCustService.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/service/SystemCustService.java new file mode 100644 index 0000000..a0769a4 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/service/SystemCustService.java @@ -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 CustList(SystemIcsCustInfoReq dto) { +// return tbIcsCustInfoRepo.findAll().stream().map(e -> new SystemIcsCustInfoRes().toIcsCustInfoRes(e)).collect(Collectors.toList()); + return tbIcsCustInfoRepo.SelectCustInfo(dto); + } + + public List CustPolicyBase() { + List 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 WisenutInsert(List dto) throws CustomNotFoundException { + HttpHeaders headers = new HttpHeaders(); + headers.setContentType(MediaType.APPLICATION_JSON); + List 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> polMap = new HashMap<>(); + List 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 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> custPolBase = tbCustPolicyRepo.findByServiceGroupIn(tbServiceGrouopRepo + .findByCustCodeAndServiceType(dto.getCustCode(), "M") + .stream() + .map(e -> e.getServiceGroup()) + .collect(Collectors.toList())) + .stream() + .collect(Collectors.groupingBy(TbCustPolicy::getServiceGroup)); + + List saveService = new ArrayList<>(); + List saveOpr = new ArrayList<>(); + + List insertPol = new ArrayList<>(); + Map, List> delUpperVal = new HashMap<>(); + for (SystemCustSaveSubReq e : dto.getAddServiceAuthList()) { + List delVal = new ArrayList<>(); + String serviceGroup = e.getAddServiceGroup(); + List beforPol = custPolBase.get(serviceGroup); + List 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 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 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)); + } + + } + + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/service/SystemGroupAuthService.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/service/SystemGroupAuthService.java new file mode 100644 index 0000000..519a566 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/service/SystemGroupAuthService.java @@ -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 GroupAuthList(SystemServiceAuthGroupReq dto) { + return tbServiceAuthGroupRepo.ServiceAuthGroupListView(dto.ofUserVo(loginService.getUserVo())); + } + + @Transactional + public SystemServiceGroupTreeRes GroupAuthNewTree(String serviceGroup) { + +// UserVo uv = loginService.getUserVo(); + + List 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 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 pol = tbCustPolicyRepo.findByServiceGroup(tsag.getServiceGroup()).stream() + .map(f -> f.getPolicyVal()).collect(Collectors.toList()); + List userRes = new ArrayList<>(); + if (tbUserAuthGroupRepo.existsByAuthGroupSeq(authGroupSeq)) { + userRes = tbBotUserRepo.AuthGroupUserList(authGroupSeq); + } + List 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 GroupAuthUpdateDataUserSearch(Long authGroupSeq, SystemServiceAuthGroupUserSearchReq dto) throws CustomNotFoundException { + List 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 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 befor = tbServiceGroupPolicyRepo.findByAuthGroupSeq(dto.getAuthGroupSeq()).stream().map(e -> e.getPolicyVal()).collect(Collectors.toList()); + List base = new ArrayList<>(); + List insertVal = new ArrayList<>(); + List deleteId = new ArrayList<>(); + List deleteVal = new ArrayList<>(); + List 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 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()); + } + } + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/service/SystemPolicyMenuService.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/service/SystemPolicyMenuService.java new file mode 100644 index 0000000..5a0b21b --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/service/SystemPolicyMenuService.java @@ -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 PolicyMenuList(SystemPolicyMenuReq dto) { + List result = tbCustPolicyRepo.PolicyMenuListQueryList(dto.ofUserVo(loginService.getUserVo())); + + List 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( + 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()))); + } + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/service/SystemServiceGroupService.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/service/SystemServiceGroupService.java new file mode 100644 index 0000000..86a3e93 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/service/SystemServiceGroupService.java @@ -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 ServiceGroupList(SystemServiceGroupReq dto) { + QueryResults 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 sub = new ArrayList<>(); + List selectService = tbServiceGrouopRepo.getServiceGroupView(serviceGroup); + + for (SystemServiceGroupViewVo e : selectService) { + if (e.getServiceType().equals("M")) { + List 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 SelectPolicy(String serviceGroup) { + return tbCustPolicyRepo.findByServiceGroup(serviceGroup).stream().map(e -> e.getPolicyVal()).collect(Collectors.toList()); + } + + @Transactional + public void ServiceGroupUpdate(SystemServiceGroupUpdateReq dto) throws CustomNotFoundException { + List modifySubVal = new ArrayList<>(); + List insertSubVal = new ArrayList<>(); + List delVal = new ArrayList<>(); + List deleId = new ArrayList<>(); + List 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 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 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(); + } + } + + +} + diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/service/SystemUserAdminService.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/service/SystemUserAdminService.java new file mode 100644 index 0000000..d0eddda --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/service/SystemUserAdminService.java @@ -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 SystemUserAdminList(SystemBotUserReq dto) { + DslDataTableRes result = new DslDataTableRes(tbBotUserRepo.SystemUserList(dto.ofUserVo(loginService.getUserVo()), RoleResource.USERADMIN.getName())); + return result; + } + + public List 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 authList = new ArrayList<>(); + List 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 resultSub = new ArrayList<>(); + List baseAuth = new ArrayList<>(); + List 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 base = tbUserAuthGroupRepo.userUseAuthGroup(userSeq); + List 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 baseData = tbServiceAuthGroupRepo.findByServiceGroup(e) + .stream() + .map(f -> SystemBotUserAuthGroupListRes.builder() + .authGroupSeq(f.getAuthGroupSeq()) + .policyGroupName(f.getPolicyGroupName()) + .build()) + .distinct() + .collect(Collectors.toList()); + List 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 beforService = new ArrayList<>(); + List baseService = new ArrayList<>(); + List insertService = new ArrayList<>(); + List delService = new ArrayList<>(); + List delCust = new ArrayList<>(); + List insertCust = new ArrayList<>(); + List insertAuth = new ArrayList<>(); + List authSave = new ArrayList<>(); + Map> 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 authBase = new ArrayList<>(); + List authInsert = new ArrayList<>(); + authInsert = ServiceAuthSeqMap.get(e); + authBase = ServiceAuthSeqMap.get(e); + //해당 서비스의 그룹권한의 시퀀스가 변했는지 확인한다. + List 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 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 delCustList = tbUserCustRepo.findByUserSeq(dto.getUserSeq()).stream() + .map(e -> TbUserCustId.builder() + .custCode(e.getCustCode()) + .serviceGroup(e.getServiceGroup()) + .userSeq(e.getUserSeq()) + .build()) + .collect(Collectors.toList()); + + List 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 insertCustList = new ArrayList<>(); + List 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 UserAdminCustList() throws CustomNotFoundException { + UserVo uv = loginService.getUserVo(); + List 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 UserAdminServiceList(String cust) { + return tbServiceGrouopRepo.findByCustCodeAndServiceType(cust, "M").stream().map(e -> OprmngCodeRes.builder() + .serviceGroup(e.getServiceGroup()) + .serviceGroupName(e.getServiceGroupName()) + .build()).collect(Collectors.toList()); + } + + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/service/SystemUserService.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/service/SystemUserService.java new file mode 100644 index 0000000..2e48be1 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/service/SystemUserService.java @@ -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 SystemUserList(SystemBotUserReq dto) { + log.info("SystemUserList uv - {}", new Gson().toJson(loginService.getUserVo())); + QueryResults result = tbBotUserRepo.SystemUserList(dto.ofUserVo(loginService.getUserVo()), RoleResource.USER.getName()); + return result; + } + + @Transactional(readOnly = true) + public List 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 authList = new ArrayList<>(); + List 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 resultSub = new ArrayList<>(); + List baseAuth = new ArrayList<>(); + List 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 base = tbUserAuthGroupRepo.userUseAuthGroup(userSeq); + List 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 baseData = tbServiceAuthGroupRepo.findByServiceGroup(e) + .stream() + .map(f -> SystemBotUserAuthGroupListRes.builder() + .authGroupSeq(f.getAuthGroupSeq()) + .policyGroupName(f.getPolicyGroupName()) + .build()) + .distinct() + .collect(Collectors.toList()); + List 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 beforService = new ArrayList<>(); + List baseService = new ArrayList<>(); + List insertService = new ArrayList<>(); + List delService = new ArrayList<>(); + List delCust = new ArrayList<>(); + List insertCust = new ArrayList<>(); + List insertAuth = new ArrayList<>(); + List authSave = new ArrayList<>(); + Map> 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 authBase = new ArrayList<>(); + List authInsert = new ArrayList<>(); + authInsert = ServiceAuthSeqMap.get(e); + authBase = ServiceAuthSeqMap.get(e); + //해당 서비스의 그룹권한의 시퀀스가 변했는지 확인한다. + List 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 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 delCustList = tbUserCustRepo.findByUserSeq(dto.getUserSeq()).stream() + .map(e -> TbUserCustId.builder() + .custCode(e.getCustCode()) + .serviceGroup(e.getServiceGroup()) + .userSeq(e.getUserSeq()) + .build()) + .collect(Collectors.toList()); + + List 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 insertCustList = new ArrayList<>(); + List 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 UserCustList() throws CustomNotFoundException { + UserVo uv = loginService.getUserVo(); + List 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 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(); + + } + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/DslDataTableRes.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/DslDataTableRes.java new file mode 100644 index 0000000..3d53201 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/DslDataTableRes.java @@ -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 { + + private List getList; + private Long getTotal; + private Long getLimit; + private Long getOffset; + + public DslDataTableRes(QueryResults dslResult) { +// this.dslResult = dslResult; + this.getList = dslResult.getResults(); + this.getTotal = dslResult.getTotal(); + this.getLimit = dslResult.getLimit(); + this.getOffset = dslResult.getOffset(); + } + + public DslDataTableRes(QueryResults dslResult, List data) { + this.getList = data; + this.getTotal = dslResult.getTotal(); + this.getLimit = dslResult.getLimit(); + this.getOffset = dslResult.getOffset(); + } + + public DslDataTableRes(List data, Long total, Long limit, Long offset ) { + this.getList = data; + this.getTotal = total; + this.getLimit = limit; + this.getOffset = offset; + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemBotTtsTagRes.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemBotTtsTagRes.java new file mode 100644 index 0000000..0547cb1 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemBotTtsTagRes.java @@ -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; + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemBotTtsTagVo.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemBotTtsTagVo.java new file mode 100644 index 0000000..1f2513c --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemBotTtsTagVo.java @@ -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; + + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemBotUserAuthGroupListRes.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemBotUserAuthGroupListRes.java new file mode 100644 index 0000000..494a765 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemBotUserAuthGroupListRes.java @@ -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; + } + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemBotUserCustRes.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemBotUserCustRes.java new file mode 100644 index 0000000..fadc29d --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemBotUserCustRes.java @@ -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; + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemBotUserDoubleCheckReq.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemBotUserDoubleCheckReq.java new file mode 100644 index 0000000..b87cb72 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemBotUserDoubleCheckReq.java @@ -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; + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemBotUserReq.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemBotUserReq.java new file mode 100644 index 0000000..7a81a81 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemBotUserReq.java @@ -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; + } + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemBotUserRes.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemBotUserRes.java new file mode 100644 index 0000000..5ef4f20 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemBotUserRes.java @@ -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; + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemBotUserSaveReq.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemBotUserSaveReq.java new file mode 100644 index 0000000..cb1a677 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemBotUserSaveReq.java @@ -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; + + @Builder + public SystemBotUserSaveReq(String lastUseServiceGroup, String userId, String pass, String userName, String useYn, String userMail, String userMobile, String roleVal, List 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(); + + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemBotUserUpdateReq.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemBotUserUpdateReq.java new file mode 100644 index 0000000..6dcb176 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemBotUserUpdateReq.java @@ -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; + + @Builder + public SystemBotUserUpdateReq(Long userSeq, String userId, String userName, String mobileNo, String useYn, int loginCheck, String email, String roleVal, List 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; + } + + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemBotUserViewRes.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemBotUserViewRes.java new file mode 100644 index 0000000..1cef6ed --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemBotUserViewRes.java @@ -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 useServiceGroup; + private List useAuthSeq; + + + + @Builder + public SystemBotUserViewRes(Long userSeq, String userId, String userName, String eMail, String mobileNo, String useYn, int loginCheck, String lastUseServiceGroup, String roleVal, List 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; + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemBotUserViewSubRes.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemBotUserViewSubRes.java new file mode 100644 index 0000000..499586d --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemBotUserViewSubRes.java @@ -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 baseAuthGroup; + private List baseSeq; + + + @Builder + public SystemBotUserViewSubRes(String serviceGroup, String serviceName, List baseAuthGroup, List baseSeq) { + this.serviceGroup = serviceGroup; + this.serviceName = serviceName; + this.baseAuthGroup = baseAuthGroup; + this.baseSeq = baseSeq; + } + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemCommonCodeDeleteReq.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemCommonCodeDeleteReq.java new file mode 100644 index 0000000..a570e69 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemCommonCodeDeleteReq.java @@ -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(); + } + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemCommoncodeInsertReq.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemCommoncodeInsertReq.java new file mode 100644 index 0000000..5c926d0 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemCommoncodeInsertReq.java @@ -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 ofSaveAll(UserVo userVo, List services) { + List 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; + } + +} + diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemCommoncodeReq.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemCommoncodeReq.java new file mode 100644 index 0000000..5bafac1 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemCommoncodeReq.java @@ -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; + } +} + diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemCommoncodeRes.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemCommoncodeRes.java new file mode 100644 index 0000000..3b55258 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemCommoncodeRes.java @@ -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; + } +} + diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemCommoncodeUpdateReq.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemCommoncodeUpdateReq.java new file mode 100644 index 0000000..a184861 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemCommoncodeUpdateReq.java @@ -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(); + } + +} + diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemCustSaveReq.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemCustSaveReq.java new file mode 100644 index 0000000..e2c9310 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemCustSaveReq.java @@ -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 addServiceAuthList; + + @Builder + public SystemCustSaveReq(String custName, String custCode, String custCodeDoubleCheck, String custUseYn, List 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 toServiceGroup(UserVo uv) { + List 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 toWisenutInsert(){ + List 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 toOpr(UserVo uv) { + List 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 toPolicy() { + List 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 toSystemAdmin(UserVo uv) { + List 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 ModiServiceGroup(UserVo uv) { + List 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 ModiOpr(UserVo uv) { + List 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; + } + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemCustSaveSubReq.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemCustSaveSubReq.java new file mode 100644 index 0000000..9c8db33 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemCustSaveSubReq.java @@ -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 authList; + + @Builder + public SystemCustSaveSubReq(String addServiceGroupName, String addServiceGroup, String addOprMngCode, String addServiceGroupDesc, String addUseYn, List 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(); + } + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemCustSelectRes.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemCustSelectRes.java new file mode 100644 index 0000000..c216151 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemCustSelectRes.java @@ -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 addServiceAuthList; + private Map> servicePol; + private List mainMenu; + private Map policyParent; + + @Builder + public SystemCustSelectRes(String custName, String custCode, String custUseYn, List addServiceAuthList, Map> servicePol, List mainMenu, Map policyParent) { + this.custName = custName; + this.custCode = custCode; + this.custUseYn = custUseYn; + this.addServiceAuthList = addServiceAuthList; + this.servicePol = servicePol; + this.mainMenu = mainMenu; + this.policyParent = policyParent; + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemIcsCustInfoReq.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemIcsCustInfoReq.java new file mode 100644 index 0000000..d6e3d83 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemIcsCustInfoReq.java @@ -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; + } +} + diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemIcsCustInfoRes.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemIcsCustInfoRes.java new file mode 100644 index 0000000..9b650ab --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemIcsCustInfoRes.java @@ -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; + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemPolicyMenuReq.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemPolicyMenuReq.java new file mode 100644 index 0000000..6f722a9 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemPolicyMenuReq.java @@ -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; + } + +} + diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemPolicyMenuRes.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemPolicyMenuRes.java new file mode 100644 index 0000000..e6e8ae7 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemPolicyMenuRes.java @@ -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; + } +} + diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemServiceAuthGroupModifyReq.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemServiceAuthGroupModifyReq.java new file mode 100644 index 0000000..e3fafaf --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemServiceAuthGroupModifyReq.java @@ -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 theUser; + private List delUser; + private List thePolicy; + + @Builder + public SystemServiceAuthGroupModifyReq(String custCode, Long authGroupSeq, String policyGroupName, String policyGroupDesc, List theUser, List delUser, List thePolicy) { + this.custCode = custCode; + this.authGroupSeq = authGroupSeq; + this.policyGroupName = policyGroupName; + this.policyGroupDesc = policyGroupDesc; + this.theUser = theUser; + this.delUser = delUser; + this.thePolicy = thePolicy; + } + + +} + diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemServiceAuthGroupReq.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemServiceAuthGroupReq.java new file mode 100644 index 0000000..d0ad67b --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemServiceAuthGroupReq.java @@ -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; + } + +} + diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemServiceAuthGroupRes.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemServiceAuthGroupRes.java new file mode 100644 index 0000000..0f80ea1 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemServiceAuthGroupRes.java @@ -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; + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemServiceAuthGroupUpdateRes.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemServiceAuthGroupUpdateRes.java new file mode 100644 index 0000000..90431e1 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemServiceAuthGroupUpdateRes.java @@ -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 userList; + private List mainMenu; + private List policyVal; + private List authPolicyVal; + private Map policyParent; + + @Builder + + public SystemServiceAuthGroupUpdateRes(Long authGroupSeq, String serviceGroup, String custCode, String policyGroupName, String policyGroupDesc, List userList, List mainMenu, List policyVal, List authPolicyVal, Map 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; + } +} + diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemServiceAuthGroupUserSearchReq.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemServiceAuthGroupUserSearchReq.java new file mode 100644 index 0000000..89da153 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemServiceAuthGroupUserSearchReq.java @@ -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; + } + + +} + diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemServiceAuthGroupUserSearchRes.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemServiceAuthGroupUserSearchRes.java new file mode 100644 index 0000000..08db5ea --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemServiceAuthGroupUserSearchRes.java @@ -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; + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemServiceGroupInsertReq.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemServiceGroupInsertReq.java new file mode 100644 index 0000000..f4a9156 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemServiceGroupInsertReq.java @@ -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 subPolicyVal; + + @Builder + public SystemServiceGroupInsertReq(String insertServiceGroup, String insertGroupName, String insertGroupDesc, String subUseYn, List subPolicyVal) { + this.insertServiceGroup = insertServiceGroup; + this.insertGroupName = insertGroupName; + this.insertGroupDesc = insertGroupDesc; + this.subUseYn = subUseYn; + this.subPolicyVal = subPolicyVal; + } +} + diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemServiceGroupReq.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemServiceGroupReq.java new file mode 100644 index 0000000..9449b68 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemServiceGroupReq.java @@ -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; + } + +} + diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemServiceGroupRes.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemServiceGroupRes.java new file mode 100644 index 0000000..86149f5 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemServiceGroupRes.java @@ -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; + } +} + diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemServiceGroupTreeRes.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemServiceGroupTreeRes.java new file mode 100644 index 0000000..c49ed8d --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemServiceGroupTreeRes.java @@ -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 mainMenu; + private List mainPolicyVal; + private Map policyParent; + + @Builder + public SystemServiceGroupTreeRes(String custCode, List mainMenu, List mainPolicyVal, Map policyParent) { + this.custCode = custCode; + this.mainMenu = mainMenu; + this.mainPolicyVal = mainPolicyVal; + this.policyParent = policyParent; + } +} + diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemServiceGroupUpdateReq.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemServiceGroupUpdateReq.java new file mode 100644 index 0000000..2c2e0e6 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemServiceGroupUpdateReq.java @@ -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 subPolicyVal; + + @Builder + public SystemServiceGroupUpdateReq(String custCode, String mainServiceGroup, String subServiceGroup, String subServiceGroupName, String subServiceGroupDesc, String subUseYn, List subPolicyVal) { + this.custCode = custCode; + this.mainServiceGroup = mainServiceGroup; + this.subServiceGroup = subServiceGroup; + this.subServiceGroupName = subServiceGroupName; + this.subServiceGroupDesc = subServiceGroupDesc; + this.subUseYn = subUseYn; + this.subPolicyVal = subPolicyVal; + } +} + diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemServiceGroupViewRes.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemServiceGroupViewRes.java new file mode 100644 index 0000000..6bd1235 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemServiceGroupViewRes.java @@ -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 mainMenu; + private List mainPolicyVal; + private Map policyParent; + private List subService; + + @Builder + public SystemServiceGroupViewRes(String custCode, String mainServiceGroup, String mainServiceGroupName, String mainServiceGroupDesc, String mainUseYn, String mainOprMngCode, List mainMenu, List mainPolicyVal, Map policyParent, List 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; + } + + + +} + diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemServiceGroupViewSubListRes.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemServiceGroupViewSubListRes.java new file mode 100644 index 0000000..95d2af2 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemServiceGroupViewSubListRes.java @@ -0,0 +1,34 @@ + +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; + +@Getter +@Setter +@NoArgsConstructor +public class SystemServiceGroupViewSubListRes { + + private String subServiceGroup; + private String subServiceGroupName; + private String subServiceGroupDesc; + private String subUseYn; + private String subOprMngCode; + private List subPolicyVal; + + @Builder + public SystemServiceGroupViewSubListRes(String subServiceGroup, String subServiceGroupName, String subServiceGroupDesc, String subUseYn, String subOprMngCode, List subPolicyVal) { + this.subServiceGroup = subServiceGroup; + this.subServiceGroupName = subServiceGroupName; + this.subServiceGroupDesc = subServiceGroupDesc; + this.subUseYn = subUseYn; + this.subOprMngCode = subOprMngCode; + this.subPolicyVal = subPolicyVal; + } +} + diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemServiceGroupViewVo.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemServiceGroupViewVo.java new file mode 100644 index 0000000..40172dd --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/SystemServiceGroupViewVo.java @@ -0,0 +1,40 @@ + +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.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 SystemServiceGroupViewVo { + private String custCode; + private String serviceGroup; + private String serviceGroupName; + private String serviceGroupDesc; + private String useYn; + private String serviceType; + private String oprMngCode; + private List policyVal; + + @Builder + public SystemServiceGroupViewVo(String custCode, String serviceGroup, String serviceGroupName, String serviceGroupDesc, String useYn, String serviceType, String oprMngCode, List policyVal) { + this.custCode = custCode; + this.serviceGroup = serviceGroup; + this.serviceGroupName = serviceGroupName; + this.serviceGroupDesc = serviceGroupDesc; + this.useYn = useYn; + this.serviceType = serviceType; + this.oprMngCode = oprMngCode; + this.policyVal = policyVal; + } +} + diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/WisenutInsertReqVo.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/WisenutInsertReqVo.java new file mode 100644 index 0000000..9903805 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/WisenutInsertReqVo.java @@ -0,0 +1,34 @@ +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 WisenutInsertReqVo { + + private String name; + private String summary; + private double simThreshold; + private double confidentThreshold; + private double confidentThresholdGap; + private List fallbackMessages; + private List greetingMessages; + private String channelCode; + private String messages; + + @Builder + public WisenutInsertReqVo(String oprMngCode, String serviceGroupDesc) { + this.name = oprMngCode; + this.summary = serviceGroupDesc; + this.simThreshold = 0.85; + this.confidentThreshold = 0.2; + this.confidentThresholdGap = 0.05; + } + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/WisenutInsertResVo.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/WisenutInsertResVo.java new file mode 100644 index 0000000..7ad1155 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/WisenutInsertResVo.java @@ -0,0 +1,26 @@ +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 WisenutInsertResVo { + + private String returnCode; + private String returnMsg; + private Long projectId; + + @Builder + public WisenutInsertResVo(String returnCode, String returnMsg, Long projectId) { + this.returnCode = returnCode; + this.returnMsg = returnMsg; + this.projectId = projectId; + } + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/addServiceAuthList.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/addServiceAuthList.java new file mode 100644 index 0000000..d494ae7 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/common/system/vo/addServiceAuthList.java @@ -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.util.List; + +@Getter +@Setter +@NoArgsConstructor +public class addServiceAuthList { + + private String addService; + private List authList; + + @Builder + public addServiceAuthList(String addService, List authList) { + this.addService = addService; + this.authList = authList; + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/controller/ConversationApiNodeController.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/controller/ConversationApiNodeController.java new file mode 100644 index 0000000..20ac4fa --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/controller/ConversationApiNodeController.java @@ -0,0 +1,43 @@ +package com.icomsys.main_vm.biz.rcp.conversation.controller; + +import com.google.gson.Gson; +import com.icomsys.main_vm.biz.advice.excep.CustomNotFoundException; +import com.icomsys.main_vm.biz.common.system.vo.DslDataTableRes; +import com.icomsys.main_vm.biz.rcp.conversation.service.ConversationApiNodeService; +import com.icomsys.main_vm.biz.rcp.conversation.vo.ConversationApiNodeInfoReq; +import com.icomsys.main_vm.biz.rcp.conversation.vo.ConversationApiNodeInfoRes; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.*; + +import java.util.HashMap; + +@Controller +@Slf4j +@RequiredArgsConstructor +@RequestMapping("/admin/rcp/conversation") +public class ConversationApiNodeController { + + private final ConversationApiNodeService conversationApiNodeService; + + @GetMapping("/apiNode/manage.do") + public String ApiNodeView(){ + return "/adm/rcp/conversation/apiNode"; + } + + @PostMapping(value="/selectApiNodeList") + @ResponseBody + public DslDataTableRes searchApiNodeList(@RequestBody ConversationApiNodeInfoReq dto) throws CustomNotFoundException { + log.info("dto -> {} ", new Gson().toJson(dto)); + return conversationApiNodeService.searchApiNodeList(dto); + } + + @PostMapping("/deleteApiNode") + @ResponseBody + public int deleteApiNode(@RequestBody HashMap map){ + log.info("deleteApiNode -> {} " , new Gson().toJson(map)); + return conversationApiNodeService.deleteApiNode(map); + } + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/controller/ConversationApiNodeEditController.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/controller/ConversationApiNodeEditController.java new file mode 100644 index 0000000..20178a1 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/controller/ConversationApiNodeEditController.java @@ -0,0 +1,68 @@ +package com.icomsys.main_vm.biz.rcp.conversation.controller; + +import com.google.gson.Gson; +import com.icomsys.main_vm.biz.advice.excep.CustomBadRequestException; +import com.icomsys.main_vm.biz.rcp.conversation.service.ConversationApiNodeEditService; +import com.icomsys.main_vm.biz.rcp.conversation.vo.ConversationApiNodeEditReq; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Controller; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.servlet.ModelAndView; + +import java.util.HashMap; + +/** + * Name : ConversationApiNodeEdit + * date : 2023-02-02 + * author : Mong + * description : + * =========================================================== + * DATE AUTHOR NOTE + * ----------------------------------------------------------- + * 2023-02-02 Mong 최초 생성 + */ + +@Controller +@Slf4j +@RequiredArgsConstructor +@RequestMapping("/admin/rcp/conversation") +public class ConversationApiNodeEditController { + + private final ConversationApiNodeEditService conversationApiNodeEditService; + @GetMapping("/apiNodeEdit/manage.do") + public ModelAndView apiNodeEditManage(@RequestParam(required = false) String url, @RequestParam(required = false) String seq, @RequestParam(required = false) String serviceGroup){ + log.info("url -> {} ", url); + log.info("seq -> {} ", seq); + log.info("serviceGroup -> {} ", serviceGroup); + ModelAndView mv = new ModelAndView(); + mv.setViewName("/adm/rcp/conversation/apiNodeEdit"); + mv.addObject("url", url); + mv.addObject("serviceGroup", serviceGroup); + mv.addObject("seq", seq); + return mv; + } + + @PostMapping("/insertApiNode") + @ResponseBody + public int insertApiNode(@RequestBody ConversationApiNodeEditReq dto) throws CustomBadRequestException{ + log.info("data -> {} " , new Gson().toJson(dto)); +// return 0; + return conversationApiNodeEditService.insertApiNode(dto); + } + + @PostMapping("/updateApiNode") + @ResponseBody + public int updateApiNode(@RequestBody ConversationApiNodeEditReq dto) throws CustomBadRequestException { + log.info("updateData -> {} " , new Gson().toJson(dto)); + return conversationApiNodeEditService.updateApiNode(dto); + } + + @PostMapping("/selectApiNode") + @ResponseBody + public HashMap selectApiNode(@RequestBody HashMap map){ + log.info("selectApiNode -> {} " , map); + return conversationApiNodeEditService.selectApiNode(map); + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/controller/ConversationCmmNodeController.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/controller/ConversationCmmNodeController.java new file mode 100644 index 0000000..070a3b8 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/controller/ConversationCmmNodeController.java @@ -0,0 +1,80 @@ +package com.icomsys.main_vm.biz.rcp.conversation.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.system.vo.DslDataTableRes; +import com.icomsys.main_vm.biz.rcp.conversation.service.ConversationCmmNodeService; +import com.icomsys.main_vm.biz.rcp.conversation.vo.*; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.servlet.ModelAndView; + +import java.util.HashMap; + +@Controller +@Slf4j +@RequiredArgsConstructor +@RequestMapping("/admin/rcp/conversation") +public class ConversationCmmNodeController { + + private final ConversationCmmNodeService conversationCmmNodeService; + + @GetMapping("/cmmNode/manage.do") + public String CmmNodeView(){ + return "/adm/rcp/conversation/cmmNode"; + } + + @GetMapping("/cmmNode/cmmNodeEdit.do") + public ModelAndView cmmNodeEdit(@RequestParam(required = false) String url + , @RequestParam(required = false) String seq + , @RequestParam(required = false) String serviceGroup){ + log.info("url -> {} ", url); + log.info("seq -> {} ", seq); + log.info("serviceGroup -> {} ", serviceGroup); + ModelAndView mv = new ModelAndView(); + mv.setViewName("/adm/rcp/conversation/cmmNodeEdit"); + mv.addObject("url", url); + mv.addObject("serviceGroup", serviceGroup); + mv.addObject("seq", seq); + return mv; + } + + @PostMapping(value="/selectCmmNodeList") + @ResponseBody + public DslDataTableRes selectCmmNodeList(@RequestBody ConversationCmmNodeInfoReq dto) throws CustomNotFoundException { + log.info("dto -> {} ", new Gson().toJson(dto)); + return conversationCmmNodeService.selectCmmNodeList(dto); + } + + @PostMapping(value = "/selectCmmNode") + @ResponseBody + public ConversationCmmNodeDiagramVO selectCmmNode(@RequestBody ConversationCmmNodeEditReq dto) throws CustomNotFoundException { + log.info("dto -> {} ", new Gson().toJson(dto)); + return conversationCmmNodeService.selectCmmNode(dto); + } + + @PostMapping(value = "/saveCmmNode") + @ResponseBody + public int saveCmmNode(@RequestBody ConversationCmmNodeEditReq dto) throws CustomBadRequestException { + log.info("dto -> {} ", new Gson().toJson(dto)); + return conversationCmmNodeService.saveCmmNode(dto); + } + + @PostMapping(value = "/updateCmmNode") + @ResponseBody + public int updateCmmNode(@RequestBody ConversationCmmNodeEditReq dto) throws CustomBadRequestException, CustomNotFoundException { + log.info("dto -> {} ", new Gson().toJson(dto)); + return conversationCmmNodeService.updateCmmNode(dto); + } + + @PostMapping("/deleteCmmNode") + @ResponseBody + public int deleteApiNode(@RequestBody HashMap map){ + log.info("deleteCmmNode -> {} " , new Gson().toJson(map)); + return conversationCmmNodeService.deleteCmmNode(map); + } + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/controller/ConversationDictionaryController.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/controller/ConversationDictionaryController.java new file mode 100644 index 0000000..7d94f1a --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/controller/ConversationDictionaryController.java @@ -0,0 +1,20 @@ +package com.icomsys.main_vm.biz.rcp.conversation.controller; + +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; + +@Controller +@Slf4j +@RequiredArgsConstructor +@RequestMapping("/admin/rcp/conversation") +public class ConversationDictionaryController { + + @GetMapping("/dictionary/manage.do") + public String DictionaryView(){ + return "/adm/rcp/conversation/dictionary"; + } + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/controller/ConversationIntentController.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/controller/ConversationIntentController.java new file mode 100644 index 0000000..4be1223 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/controller/ConversationIntentController.java @@ -0,0 +1,276 @@ +package com.icomsys.main_vm.biz.rcp.conversation.controller; + +import com.google.gson.Gson; +import com.icomsys.main_vm.biz.advice.excep.CustomNotFoundException; +import com.icomsys.main_vm.biz.advice.excep.CustomRuntimeException; +import com.icomsys.main_vm.biz.common.common.service.ExcelService; +import com.icomsys.main_vm.biz.rcp.conversation.dto.IntentRequestDTO; +import com.icomsys.main_vm.biz.rcp.conversation.service.IntentManageService; +import com.icomsys.main_vm.biz.rcp.conversation.vo.SelectIntentListVo; +import com.icomsys.main_vm.biz.rcp.conversation.vo.intent.ExcelIntentListVo; +import com.icomsys.main_vm.biz.rcp.conversation.vo.intent.IntentSearchVo; +import com.icomsys.main_vm.biz.rcp.conversation.vo.synonym.SelectSynonymListVo; +import com.icomsys.main_vm.common.code.enumresource.ActionResource; +import com.icomsys.main_vm.common.code.enumresource.MenuResource; +import com.icomsys.main_vm.db.jpa.repo.system.TbIntentMasterRepo; +import com.icomsys.main_vm.db.mybatis.alias.LoginVO; +import com.querydsl.core.QueryResults; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.apache.poi.hssf.usermodel.HSSFWorkbook; +import org.apache.poi.ss.usermodel.*; +import org.springframework.dao.DuplicateKeyException; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartHttpServletRequest; +import org.springframework.web.servlet.ModelAndView; +import org.springframework.web.servlet.mvc.support.RedirectAttributes; +import org.springframework.web.servlet.view.json.MappingJackson2JsonView; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@Controller +@Slf4j +@RequiredArgsConstructor +@RequestMapping("/admin/rcp/conversation") +public class ConversationIntentController { + + private final TbIntentMasterRepo tbIntentMasterRepo; + @Resource + MappingJackson2JsonView ajaxMainView; + //private final HttpServletRequest request; + + private final IntentManageService intentManageService; + + private final ExcelService excelService; + + @GetMapping("/intent/manage.do") + public String ScenarioView(){ + return "/adm/rcp/conversation/intent"; + } + + @RequestMapping(value = "/intent/search.do", method = RequestMethod.POST) + @ResponseBody + public ModelAndView searchIntent(IntentSearchVo dto) throws CustomNotFoundException { + return intentManageService.searchIntent(dto); + } + + /** + * @Name serviceNameList + * @Description 인텐트관리 카테고리 목록 조회 + * @Author 문다운 + * v * @CreateDate 2022. 5. 26. + */ + @RequestMapping(value = "/intent/category.do", method = RequestMethod.GET) + @ResponseBody + public ModelAndView searchIntentCategoryList(@RequestParam Map dataMap) throws CustomNotFoundException { + return intentManageService.searchIntentCategoryList(dataMap); + } + + /** + * @Name serviceNameList + * @Description 인텐트 예문 목록 조회 + * @Author 문다운 + * @CreateDate 2022. 5. 26. + */ + @RequestMapping(value = "/intent/examples.do", method = RequestMethod.GET) + @ResponseBody + public ModelAndView selectIntentExampleList(HttpServletRequest request, @RequestParam Map dataMap) { + return intentManageService.selectIntentExampleList(dataMap); + } + + /** + * @Name serviceNameList + * @Description 인텐트 예문 목록 조회 + * @Author 문다운 + * @CreateDate 2022. 5. 26. + */ + @RequestMapping(value = "/intent/check.do", method = RequestMethod.GET) + @ResponseBody + public ModelAndView selectIntentCnt(HttpServletRequest request, @RequestParam Map dataMap) { + log.debug("selectIntentCnt init "); + ModelAndView mv = new ModelAndView(ajaxMainView); + HashMap eMap = new HashMap(); + eMap.putAll(dataMap); + int cnt = intentManageService.selectIntentCnt(eMap); + mv.addObject("result", (cnt > 0 ? false : true)); + return mv; + } + + /** + * @Name serviceNameList + * @Description 인텐트 수정 + * @Author 문다운 + * @CreateDate 2022. 5. 26. + */ + @RequestMapping(value = "/intent/update.do", method = RequestMethod.POST) + @ResponseBody + @Transactional + public ModelAndView updateIntent(@RequestBody IntentRequestDTO dto) { + return intentManageService.updateIntent(dto); + } + + /** + * @Name serviceNameList + * @Description 인텐트 등록 + * @Author 문다운 + * @CreateDate 2022. 6. 03. + */ + @RequestMapping(value = "/intent/insert.do", method = RequestMethod.POST) + @ResponseBody + public ModelAndView insertIntent(HttpServletRequest request, @RequestBody IntentRequestDTO dto) { + ModelAndView mv = new ModelAndView(ajaxMainView); + boolean result = true; + String message = "저장되었습니다."; + String seq = ""; + try { + LoginVO resultVO = (LoginVO) request.getSession().getAttribute("LoginVO"); + dto.setRegistId(resultVO.getUserId()); + dto.setUpdateId(resultVO.getUserId()); + + HashMap paramMap = dto.toMap(); + intentManageService.insertIntentMaster(paramMap); // 2022.06.28 마스터만 먼저 등록 + seq = (String) paramMap.get("seq"); // 2022.06.28 추가 + + } catch (DuplicateKeyException e) { + result = false; + message = e.getMessage(); + } catch (Exception e) { + result = false; + message = "처리도중 오류가 발생했습니다."; + log.error("error", e); + } + mv.addObject("result", result); + mv.addObject("message", message); + mv.addObject("seq", seq); // 2022.06.28 추가 + return mv; + } + + // 예문 단건 등록으로 변경 2022.06.28 추가 + @RequestMapping(value = "/intent/insertExample.do", method = RequestMethod.POST) + @ResponseBody + public ModelAndView insertIntent_example(HttpServletRequest request, @RequestBody IntentRequestDTO dto) { + ModelAndView mv = new ModelAndView(ajaxMainView); + boolean result = true; + String message = "저장되었습니다."; + + String seq = ""; + try { + LoginVO resultVO = (LoginVO) request.getSession().getAttribute("LoginVO"); + dto.setRegistId(resultVO.getUserId()); + dto.setUpdateId(resultVO.getUserId()); + + String saveType = dto.getSaveType(); + if("D".equals(saveType)) { + intentManageService.deleteIntentExample_one(dto.toMap()); // 예문 삭제 + message = "정상적으로 삭제되었습니다."; + }else if("I".equals(saveType)) { + + HashMap paramMap = dto.toMap(); + intentManageService.insertIntentExample(paramMap); // 예문 등록 + seq = (String) paramMap.get("seq"); + mv.addObject("seq", seq); + } + + } catch (DuplicateKeyException e) { + result = false; + message = e.getMessage(); + } catch (Exception e) { + result = false; + message = "처리도중 오류가 발생했습니다."; + log.error("error", e); + } + mv.addObject("result", result); + mv.addObject("message", message); + return mv; + } + + /** + * @Name serviceNameList + * @Description 인텐트 삭제 + * @Author 문다운 + * @CreateDate 2022. 5. 26. + */ + @RequestMapping(value = "/intent/delete.do", method = RequestMethod.POST) + @ResponseBody + public ModelAndView deleteIntent(HttpServletRequest request, @RequestParam Map dataMap) { + ModelAndView mv = new ModelAndView(ajaxMainView); + boolean result = true; + String message = "삭제되었습니다."; + try { + if (StringUtils.isBlank(dataMap.get("seq"))) { + result = false; + message = "삭제할 인텐트를 선택해주세요."; + } else { + HashMap eMap = new HashMap(); + eMap.putAll(dataMap); + + LoginVO resultVO = (LoginVO) request.getSession().getAttribute("LoginVO"); + eMap.put("updateId", resultVO.getUserId()); + intentManageService.deleteIntent(eMap); + } + } catch (Exception e) { + result = false; + message = "저장도중 오류가 발생했습니다."; + log.error("error", e); + } + mv.addObject("result", result); + mv.addObject("message", message); + return mv; + } + + /** + * @Name uploadExcel + * @Description 엑셀 업로드 + * @author 문다운 + * @CreateDate 2022.06.04 + */ + @RequestMapping(value = "/intent/upload.do", method = RequestMethod.POST) + public String uploadExcel(MultipartHttpServletRequest request, @RequestParam Map dataMap, RedirectAttributes redirectAttr) { + boolean result = true; + String message = "정상적으로 저장되었습니다."; + try { + HashMap eMap = new HashMap(); + LoginVO resultVO = (LoginVO) request.getSession().getAttribute("LoginVO"); + eMap.putAll(dataMap); + eMap.put("registId", resultVO.getUserId()); + eMap.put("updateId", resultVO.getUserId()); + message = intentManageService.insertIntentExcel(request, eMap); + intentManageService.workLogSave(MenuResource.rcpconversationintentmanage, ActionResource.upload, dataMap.get("serviceGroup"), "엑셀 업로드"); + } catch (CustomRuntimeException e) { + result = false; + message = e.getMessage(); + } catch (DuplicateKeyException e) { + result = false; + message = e.getMessage(); + } + catch (Exception e) { + result = false; + message = "처리도중 오류가 발생했습니다."; + log.error("error upload excel", e); + } + redirectAttr.addFlashAttribute("result", result); + redirectAttr.addFlashAttribute("message", message); + return "redirect:/admin/rcp/conversation/intent/manage.do"; + } + + @RequestMapping(value = "/intent/download.do", method = RequestMethod.POST) + @ResponseBody + @Transactional + public void downloadExcel(IntentSearchVo dto) throws IOException, CustomNotFoundException { + log.info("excel intent"); + intentManageService.downloadExcel(dto); + } + +} + diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/controller/ConversationScenarioGUIController.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/controller/ConversationScenarioGUIController.java new file mode 100644 index 0000000..a365cc2 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/controller/ConversationScenarioGUIController.java @@ -0,0 +1,126 @@ +package com.icomsys.main_vm.biz.rcp.conversation.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.system.vo.DslDataTableRes; +import com.icomsys.main_vm.biz.rcp.conversation.service.ConversationScenarioGUIService; +import com.icomsys.main_vm.biz.rcp.conversation.vo.*; +import com.querydsl.core.QueryResults; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.*; + +@Controller +@Slf4j +@RequiredArgsConstructor +@RequestMapping("/admin/rcp/conversation") +public class ConversationScenarioGUIController { + + private final ConversationScenarioGUIService conversationScenarioGUIService; + + @GetMapping("/scenario/manage.do") + public String ScenarioView(@RequestParam(value = "scenarioSeq", required = false, defaultValue = "-1")Long scenarioSeq, Model model){ + log.info("scenarioSeq", scenarioSeq); + model.addAttribute("scenarioSeq", scenarioSeq); + + return "/adm/rcp/conversation/scenarioGUI"; + } + + @PostMapping("/scenario/list/search") + @ResponseBody + public DslDataTableRes searchScenarioList(@RequestBody ConversationScenarioManagerSearchReq dto ) { + log.info("list search dto -> {}", new Gson().toJson(dto)); + + return conversationScenarioGUIService.searchScenarioList(dto); + } + + @PostMapping("/scenario/release/list/search") + @ResponseBody + public DslDataTableRes searchScenarioReleaseList(@RequestBody ConversationScenarioManagerSearchReq dto) { + log.info("list search dto -> {}", new Gson().toJson(dto)); + + return conversationScenarioGUIService.searchScenarioReleaseList(dto); + } + + @PostMapping("/scenario/register") + @ResponseBody + public int scenarioRegister(@RequestBody ConversationScenarioMasterVO dto)throws CustomNotFoundException, CustomBadRequestException { + log.info("register dto -> {}", new Gson().toJson(dto)); + + return conversationScenarioGUIService.scenarioRegister(dto); + } + + @PostMapping("/scenario/name/update") + @ResponseBody + public int scenarioNameUpdate(@RequestBody ConversationScenarioMasterVO dto)throws CustomNotFoundException, CustomBadRequestException { + log.info("update dto -> {}", new Gson().toJson(dto)); + + return conversationScenarioGUIService.scenarioNameUpdate(dto); + } + + @PostMapping("/scenario/release") + @ResponseBody + public int scenarioRelease(@RequestBody ConversationScenarioMasterVO dto)throws CustomNotFoundException, CustomBadRequestException { + log.info("register dto -> {}", new Gson().toJson(dto)); + + return conversationScenarioGUIService.scenarioRelease(dto); + } + + @PostMapping("/scenario/rollback") + @ResponseBody + public int scenarioRollback(@RequestBody ConversationScenarioMasterVO dto)throws CustomNotFoundException, CustomBadRequestException { + log.info("register dto -> {}", new Gson().toJson(dto)); + + return conversationScenarioGUIService.scenarioRollback(dto); + } + + @PostMapping("/scenario/reload") + @ResponseBody + public int scenarioReload(@RequestBody ConversationScenarioMasterVO dto)throws CustomNotFoundException, CustomBadRequestException { + log.info("register dto -> {}", new Gson().toJson(dto)); + + return conversationScenarioGUIService.scenarioReload(dto); + } + + @PostMapping("/scenario/delete") + @ResponseBody + public int scenarioDelete(@RequestBody ConversationScenarioMasterVO dto)throws CustomNotFoundException, CustomBadRequestException { + log.info("register dto -> {}", new Gson().toJson(dto)); + + return conversationScenarioGUIService.scenarioDelete(dto); + } + + @GetMapping("/scenario/manager/info") + @ResponseBody + public ConversationScenarioManagerInfoRes scenarioManagerInfo(@RequestParam(name = "scenarioSeq", required = true)Long scenarioSeq) throws CustomNotFoundException{ + log.info("view Controller - {}", scenarioSeq); + + return conversationScenarioGUIService.scenarioManagerInfo(scenarioSeq); + } + + @PostMapping("/scenario/history/log") + @ResponseBody + public QueryResults scenarioHistoryLog(@RequestBody ConversationScenarioMasterVO dto) throws CustomBadRequestException{ + log.info("view dto - {}", dto); + + return conversationScenarioGUIService.scenarioHistoryLog(dto); + } + + @PostMapping("/scenario/related/intent") + @ResponseBody + public QueryResults scenarioRelatedIntent(@RequestBody ConversationScenarioMasterVO dto) throws CustomBadRequestException { + log.info("dto - {}", dto); + return conversationScenarioGUIService.scenarioRelatedIntent(dto); + } + + @PostMapping("/scenario/related/intent/save") + @ResponseBody + public int scenarioRelatedIntentSave(@RequestBody ConversationScenarioRelatedIntentSaveReq dto) throws CustomBadRequestException, CustomNotFoundException { + log.info("dto - {}", dto); + + return conversationScenarioGUIService.scenarioRelatedIntentSave(dto); + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/controller/ConversationScenarioGUINodeEditController.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/controller/ConversationScenarioGUINodeEditController.java new file mode 100644 index 0000000..c401f92 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/controller/ConversationScenarioGUINodeEditController.java @@ -0,0 +1,96 @@ +package com.icomsys.main_vm.biz.rcp.conversation.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.rcp.conversation.service.ConversationScenarioGUIService; +import com.icomsys.main_vm.biz.rcp.conversation.vo.ConversationScenarioDiagramRes; +import com.icomsys.main_vm.biz.rcp.conversation.vo.ConversationScenarioDiagramVO; +import com.icomsys.main_vm.biz.rcp.conversation.vo.ConversationScenarioMasterVO; +import com.icomsys.main_vm.biz.rcp.conversation.vo.LongtextManagerVO; +import com.icomsys.main_vm.db.jpa.entity.scenario.id.TbLongtextManagerId; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.servlet.ModelAndView; + +/** + * Name : ConversationScenarioGUINodeEditController + * date : 2023-02-03 + * author : Mong + * description : + * =========================================================== + * DATE AUTHOR NOTE + * ----------------------------------------------------------- + * 2023-02-03 Mong 최초 생성 + */ +@Controller +@Slf4j +@RequiredArgsConstructor +@RequestMapping("/admin/rcp/conversation") +public class ConversationScenarioGUINodeEditController { + + private final ConversationScenarioGUIService conversationScenarioGUIService; + + @GetMapping("/scenarioGUINodeEdit.do") + public ModelAndView scenarioGUINodeEdit(@RequestParam String flag, @RequestParam Long seq, @RequestParam String custCode, @RequestParam String serviceGroup){ + log.info("flag, seq, custCode, serviceGroup -> {} ", flag, seq); + ModelAndView mv = new ModelAndView(); + mv.setViewName("/adm/rcp/conversation/scenarioGUINodeEdit"); + mv.addObject("flag", flag); + mv.addObject("seq", seq); + mv.addObject("custCode", custCode); + mv.addObject("serviceGroup", serviceGroup); + return mv; + } + + @GetMapping("/cmmNodeEdit.do") + public ModelAndView cmmNodeEdit(@RequestParam String flag){ + log.info("flag-> {} ", flag); + ModelAndView mv = new ModelAndView(); + mv.setViewName("/adm/rcp/conversation/cmmNodeEdit"); + mv.addObject("flag", flag); + return mv; + } + + @PostMapping(value = "/insertScenario") + @ResponseBody + public int insertDev(@RequestBody LongtextManagerVO dto) { + log.info("dto -> {} ", new Gson().toJson(dto)); + return conversationScenarioGUIService.insertDev(dto); + } + + @PostMapping(value = "/selectScenario") + @ResponseBody + public LongtextManagerVO selectDev(@RequestBody TbLongtextManagerId dto) throws CustomNotFoundException { + log.info("dto -> {} ", new Gson().toJson(dto)); + if (dto.getRfSeq() == null) { + dto.setRfSeq(0L); + } + return conversationScenarioGUIService.selectDev(dto); + } + + + @PostMapping(value = "/scenario/select/diagram") + @ResponseBody + public ConversationScenarioDiagramRes selectDiagram(@RequestBody ConversationScenarioMasterVO dto) throws CustomNotFoundException, CustomBadRequestException { + log.info("dto -> {} ", new Gson().toJson(dto)); + return conversationScenarioGUIService.selectScenarioDiagram(dto); + } + + @PostMapping(value = "/scenario/save/diagram") + @ResponseBody + public int saveScenarioDiagram(@RequestBody ConversationScenarioDiagramVO dto) throws CustomBadRequestException, CustomNotFoundException { + log.info("dto -> {} ", new Gson().toJson(dto)); + + return conversationScenarioGUIService.saveScenarioDiagram(dto); + } + + @GetMapping(value = "/scenario/test/contents") + @ResponseBody + public LongtextManagerVO selectTestContents(@RequestParam String masterSeq) throws CustomBadRequestException, CustomNotFoundException { + return conversationScenarioGUIService.selectTestContents(masterSeq); + } +} + diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/controller/ConversationSynonymController.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/controller/ConversationSynonymController.java new file mode 100644 index 0000000..e2164c3 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/controller/ConversationSynonymController.java @@ -0,0 +1,286 @@ +package com.icomsys.main_vm.biz.rcp.conversation.controller; + +import com.google.gson.Gson; +import com.icomsys.main_vm.biz.advice.excep.CustomRuntimeException; +import com.icomsys.main_vm.biz.common.common.service.ExcelService; +import com.icomsys.main_vm.biz.rcp.conversation.service.SynonymManageService; +import com.icomsys.main_vm.biz.rcp.conversation.vo.synonym.ExcelSynonymListVo; +import com.icomsys.main_vm.biz.rcp.conversation.vo.synonym.SelectSynonymList2Vo; +import com.icomsys.main_vm.common.code.enumresource.ActionResource; +import com.icomsys.main_vm.common.code.enumresource.MenuResource; +import com.icomsys.main_vm.db.jpa.entity.conversation.TbSynonymMaster; +import com.icomsys.main_vm.db.jpa.entity.system.TbIcsCustInfo; +import com.icomsys.main_vm.db.jpa.repo.system.TbSynonymMasterRepo; +import com.icomsys.main_vm.db.mybatis.alias.LoginVO; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.apache.poi.hssf.usermodel.HSSFCell; +import org.apache.poi.hssf.usermodel.HSSFRow; +import org.apache.poi.hssf.usermodel.HSSFSheet; +import org.apache.poi.hssf.usermodel.HSSFWorkbook; +import org.apache.poi.ss.usermodel.CellType; +import org.apache.poi.xssf.usermodel.XSSFCell; +import org.apache.poi.xssf.usermodel.XSSFRow; +import org.apache.poi.xssf.usermodel.XSSFSheet; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; +import org.json.simple.parser.JSONParser; +import org.json.simple.parser.ParseException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.dao.DuplicateKeyException; +import org.springframework.stereotype.Controller; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.servlet.ModelAndView; +import org.springframework.web.servlet.mvc.support.RedirectAttributes; +import org.springframework.web.servlet.view.json.MappingJackson2JsonView; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +@Controller +@Slf4j +@RequiredArgsConstructor +@RequestMapping("/admin/rcp/conversation") +public class ConversationSynonymController { + + private final HttpServletRequest request; + private final SynonymManageService synonymManageService; + private final MappingJackson2JsonView ajaxMainView; + @Autowired + private TbSynonymMasterRepo tbSynonymMasterRepo; + private final ExcelService excelService; + + @GetMapping("/synonym/manage.do") + public String SynonymView() { + return "/adm/rcp/conversation/synonym"; + } + + @RequestMapping("/synonym/synonymList.do") + public ModelAndView synonymList(@RequestParam Map dataMap){ + return synonymManageService.synonymList(dataMap); + } + + @Transactional + @RequestMapping("/synonym/deleteSynonym.do") + public ModelAndView deleteSynonym(@RequestParam int seq, String serviceGroup, String custCode) { + ModelAndView mv = new ModelAndView(ajaxMainView); + LoginVO resultVO = (LoginVO) request.getSession().getAttribute("LoginVO"); + + String oprMngCode = custCode + "_RCP_" + serviceGroup; + + HashMap eMap = new HashMap(); + eMap.put("seq", seq); + eMap.put("oprMngCode", oprMngCode); + eMap.put("userId", resultVO.getUserId()); + eMap.put("serviceGroup", serviceGroup); + + boolean result = true; + try { + synonymManageService.deleteSynonym(eMap); + } catch (Exception e) { + result = false; + } + + mv.addObject("result", result); + + return mv; +// return synonymManageService.deleteSynonym(eMap); + } + + @RequestMapping("/synonym/dupCheck.do") + public ModelAndView dupCheck(HttpServletRequest request, @RequestParam Map dataMap) { + String oprMngCode = dataMap.get("custCode") + "_RCP_" + dataMap.get("serviceGroup") == null ? null : dataMap.get("custCode") + "_RCP_" + dataMap.get("serviceGroup"); + + ModelAndView mv = new ModelAndView(ajaxMainView); + + LoginVO resultVO = (LoginVO) request.getSession().getAttribute("LoginVO"); + + HashMap eMap = new HashMap(); + eMap.putAll(dataMap); + eMap.put("userId", resultVO.getUserId()); + eMap.put("serviceCode", oprMngCode); + + boolean result = true; + String msg = ""; + int returnSeq = -1; + + try { + String data = dataMap.get("synonymWords").toString(); + JSONParser parser = new JSONParser(); + Object obj = parser.parse(data); + eMap.put("list", obj); + + returnSeq = synonymManageService.dupCheck(eMap); + } catch (DuplicateKeyException e) { + result = false; + msg = e.getMessage(); + } catch (Exception e) { + result = false; + msg = "처리도중 오류가 발생하였습니다."; + } + + mv.addObject("result", result); + mv.addObject("msg", msg); + mv.addObject("seq", returnSeq); + + return mv; + } + + @ResponseBody + @Transactional + @RequestMapping("/synonym/saveSynonymList.do") + public ModelAndView saveSynonymList(HttpServletRequest request, @RequestParam Map paramMap) { + + boolean result = true; + ModelAndView mv = new ModelAndView(ajaxMainView); + LoginVO resultVO = (LoginVO) request.getSession().getAttribute("LoginVO"); + String oprMngCode = paramMap.get("custCode") + "_RCP_" + paramMap.get("serviceGroup"); + + HashMap eMap = new HashMap(); + eMap.put("userId", resultVO.getUserId()); + eMap.put("serviceCode", oprMngCode); + eMap.putAll(paramMap); + + String data = paramMap.get("synonymWords").toString(); + JSONParser parser = new JSONParser(); + try { + Object obj = parser.parse(data); + eMap.put("list", obj); + synonymManageService.saveSynonymList(eMap); + + if (synonymManageService.countSynonymWord(eMap) < 1) { + synonymManageService.deleteSynonym(eMap); + } + + //synonymManageService.saveSynonymList(eMap); + } catch (ParseException e) { + e.printStackTrace(); + } catch (Exception e) { + result = false; + } + + mv.addObject("result", result); + + return mv; +// return synonymManageService.saveSynonymList(request, paramMap); + } + + @ResponseBody + @RequestMapping("/synonym/download.do") + public void downloadExcel(@RequestParam Map dataMap) throws IOException { + synonymManageService.downloadExcel(dataMap); + } + + @RequestMapping("/synonym/uploadSynonym.do") + public String uploadSynonym(HttpServletRequest request, @RequestParam("csvFile") MultipartFile[] csvFile, + @RequestParam Map dataMap, RedirectAttributes redirectAttr) throws CustomRuntimeException { + boolean result = true; + String message = "저장되었습니다."; + String oprMngCode = dataMap.get("custCode") + "_RCP_" + dataMap.get("serviceGroup"); + + log.info("dataMap -> {}", dataMap); + + HashMap eMap = new HashMap(); + LoginVO resultVO = (LoginVO) request.getSession().getAttribute("LoginVO"); + eMap.put("userId", resultVO.getUserId()); + eMap.put("serviceCode", oprMngCode); + eMap.putAll(dataMap); + + List synonymList = new ArrayList<>(); + + for (MultipartFile m : csvFile) { + + try { + HSSFWorkbook wb = new HSSFWorkbook(m.getInputStream()); + HSSFSheet sheet = wb.getSheetAt(0); + + String sheetName = sheet.getSheetName(); + if (!(sheetName.equals("data"))) { + throw new CustomRuntimeException("엑셀 양식이 잘못되었습니다."); + } + + for (int i = 1; i < sheet.getPhysicalNumberOfRows(); i++) { + HashMap fMap = new HashMap(); + + HSSFRow row = sheet.getRow(i); + if (row == null) continue; + int cells = row.getPhysicalNumberOfCells(); + + // 숫자인 경우, Numeric으로 들어와서 String형으로 받을 때 에러 발생 + row.getCell(0).setCellType(CellType.STRING); + row.getCell(1).setCellType(CellType.STRING); + row.getCell(2).setCellType(CellType.STRING); + + HSSFCell cell1 = row.getCell(0); + HSSFCell cell2 = row.getCell(1); + HSSFCell cell3 = row.getCell(2); + + String idivWord = cell1.getStringCellValue(); + String repWord = cell2.getStringCellValue(); + String synonymWords = cell3.getStringCellValue(); + + if (cell1 == null || cell1.getStringCellValue().equals("")) { + continue; + } + + fMap.putAll(eMap); + fMap.put("idivWord", idivWord); + fMap.put("repWord", repWord); + fMap.put("synonymWords", synonymWords.replaceAll("\"", "")); + + String[] list = synonymWords.replaceAll(", ", ",").split(","); + + if (list.length > 200) { + throw new CustomRuntimeException("동의어 제한을 초과했습니다."); + } + fMap.put("list", list); + + synonymList.add(fMap); + } + + if (synonymList.size() > 50) { + throw new CustomRuntimeException("개체어 제한을 초과했습니다."); + } + + for (HashMap hMap : synonymList) { + try { + synonymManageService.uploadDupCheck(hMap); + } catch (DuplicateKeyException e) { + result = false; + message = e.getMessage(); + } + } + + synonymManageService.workLogSave(MenuResource.rcpconversationsynonymmanage, ActionResource.upload, eMap.get("serviceGroup").toString(), "엑셀 업로드"); + + } catch (CustomRuntimeException e) { + result = false; + message = e.getMessage(); + } catch (IOException e) { + result = false; + message = "IO 오류가 발생하였습니다."; + } catch (Exception e) { + result = false; + message = "처리도중 오류가 발생했습니다."; + } + } + + redirectAttr.addFlashAttribute("result", result); + redirectAttr.addFlashAttribute("message", message); + return "redirect:/admin/rcp/conversation/synonym/manage.do"; + } + + +} + diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/controller/ConversationSynonymController.java.rej b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/controller/ConversationSynonymController.java.rej new file mode 100644 index 0000000..57b4ddc --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/controller/ConversationSynonymController.java.rej @@ -0,0 +1,9 @@ +diff a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/controller/ConversationSynonymController.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/controller/ConversationSynonymController.java (rejected hunks) +@@ -90,6 +90,7 @@ + + @RequestMapping("/synonym/dupCheck.do") + public ModelAndView dupCheck(HttpServletRequest request, @RequestParam Map dataMap) { ++ String serviceCode = dataMap.get("serviceCode") == null ? null : dataMap.get("serviceCode"); + + ModelAndView mv = new ModelAndView(ajaxMainView); + diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/controller/ConversationSystemEntityController.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/controller/ConversationSystemEntityController.java new file mode 100644 index 0000000..70e1a40 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/controller/ConversationSystemEntityController.java @@ -0,0 +1,71 @@ +package com.icomsys.main_vm.biz.rcp.conversation.controller; + +import com.google.gson.Gson; +import com.google.gson.JsonObject; +import com.icomsys.main_vm.biz.advice.excep.CustomBadRequestException; +import com.icomsys.main_vm.biz.rcp.conversation.service.ConversationSystemEntityService; +import com.icomsys.main_vm.biz.rcp.conversation.vo.SystemEntityRes; +import com.icomsys.main_vm.db.jpa.entity.conversation.TbEntityMaster; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.http.HttpMethod; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.servlet.ModelAndView; +import org.springframework.web.servlet.view.json.MappingJackson2JsonView; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import static com.icomsys.main_vm.biz.rcp.conversation.nlp.wisenut.util.RestTemplateUtil.callNlpApi; + +@Controller +@Slf4j +@RequiredArgsConstructor +@RequestMapping("/admin/rcp/conversation") +public class ConversationSystemEntityController { + + private final ConversationSystemEntityService conversationSystemEntityService; + + @Resource + MappingJackson2JsonView ajaxMainView; + + @GetMapping("/systemEntity/manage.do") + public String SystemEntityView(){ + return "/adm/rcp/conversation/systemEntity"; + } + + + /** + * @Name synchronizeEntity + * @Description 시스템 엔티티 동기화 + * @Author 장동희 + * @CreateDate 2023. 3. 17. + */ + @RequestMapping(value = "/systemEntity/synchronize.do", method = RequestMethod.POST) + @ResponseBody + public ModelAndView synchronizeEntity(HttpServletRequest request) { + + return conversationSystemEntityService.synchronizeEntityList(request); + } + + @GetMapping("/scenario/systemEntity/list") + @ResponseBody + public List SystemEntityList() { + + return conversationSystemEntityService.SystemEntityList(); + } + + @PostMapping("/scenario/systemEntity/search") + @ResponseBody + public ModelAndView selectSystemEntityList() { + ModelAndView mv = new ModelAndView(ajaxMainView); + mv.addObject("list", conversationSystemEntityService.SystemEntityList()); + return mv; + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/dto/IntentRequestDTO.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/dto/IntentRequestDTO.java new file mode 100644 index 0000000..bfdffe9 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/dto/IntentRequestDTO.java @@ -0,0 +1,190 @@ +package com.icomsys.main_vm.biz.rcp.conversation.dto; + +import com.icomsys.main_vm.db.jpa.entity.conversation.TbIntentMaster; + +import java.io.Serializable; +import java.time.LocalDateTime; +import java.util.HashMap; +import java.util.List; + +/** + * 인텐트 요청 DTO + * 22.05.26 + * + * @author downingmoon + */ + +public class IntentRequestDTO implements Serializable { + private static final long serialVersionUID = 1L; + + private String seq; + private String custCode; + private String serviceGroup; + private String intentSeq; + private String intentName; + private String category; + private String exampleText; + private String registId; + private String updateId; + private String saveType; + private String useYn; + private String menuVal; + private String oprMngCode; + + private List intentList; + private List exampleList; + + public String getSeq() { + return seq; + } + + public void setSeq(String seq) { + this.seq = seq; + } + + public String getCustCode() { + return custCode; + } + + public void setCustCode(String custCode) { + this.custCode = custCode; + } + + public String getServiceGroup() { + return serviceGroup; + } + + public void setServiceGroup(String serviceGroup) { + this.serviceGroup = serviceGroup; + } + + public String getIntentSeq() { + return intentSeq; + } + + public void setIntentSeq(String intentSeq) { + this.intentSeq = intentSeq; + } + + public String getIntentName() { + return intentName; + } + + public void setIntentName(String intentName) { + this.intentName = intentName; + } + + public String getCategory() { + return category; + } + + public void setCategory(String category) { + this.category = category; + } + + public String getExampleText() { + return exampleText; + } + + public void setExampleText(String exampleText) { + this.exampleText = exampleText; + } + + public String getRegistId() { + return registId; + } + + public void setRegistId(String registId) { + this.registId = registId; + } + + public String getUpdateId() { + return updateId; + } + + public void setUpdateId(String updateId) { + this.updateId = updateId; + } + + public List getIntentList() { + return intentList; + } + + public void setIntentList(List intentList) { + this.intentList = intentList; + } + + public List getExampleList() { + return exampleList; + } + + public void setExampleList(List exampleList) { + this.exampleList = exampleList; + } + + public String getSaveType() { + return saveType; + } + + public void setSaveType(String saveType) { + this.saveType = saveType; + } + + public String getUseYn() { + return useYn; + } + + public void setUseYn(String useYn) { + this.useYn = useYn; + } + + public String getMenuVal() { + return menuVal; + } + + public void setMenuVal(String menuVal) { + this.menuVal = menuVal; + } + /* public TbIntentMaster toIntentMasterUpdate(String userId) { + TbIntentMaster tim = new TbIntentMaster(); + tim.setSeq(Long.valueOf(this.seq)); + tim.setOprMngCode(this.oprMngCode); + tim.setIntentName(this.intentName); + tim.setCategory(this.category); + tim.setUseYn(this.useYn); + tim.setRegistId(userId); + tim.setUpdateId(userId); + return tim; + } + public TbIntentMaster toIntentMasterSave(String userId) { + TbIntentMaster tim = new TbIntentMaster(); + tim.setOprMngCode(this.oprMngCode); + tim.setIntentName(this.intentName); + tim.setCategory(this.category); + tim.setRegistId(userId); + tim.setRegistDate(LocalDateTime.now()); + tim.setUpdateId(userId); + tim.setUpdateDate(LocalDateTime.now()); + tim.setUseYn("Y"); + return tim; + }*/ + + public HashMap toMap() { + HashMap m = new HashMap(); + m.put("seq", this.seq); + m.put("serviceGroup", this.serviceGroup); + m.put("custCode", this.custCode); + m.put("intentSeq", this.intentSeq); + m.put("intentName", this.intentName); + m.put("category", this.category); + m.put("registId", this.registId); + m.put("updateId", this.updateId); + m.put("intentList", this.intentList); + m.put("exampleList", this.exampleList); + m.put("saveType", this.saveType); + m.put("menuVal", this.menuVal); + m.put("oprMngCode", this.custCode + "_RCP_" + this.serviceGroup); + return m; + } + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/dto/TbIntentExampleDto.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/dto/TbIntentExampleDto.java new file mode 100644 index 0000000..ac3a3ea --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/dto/TbIntentExampleDto.java @@ -0,0 +1,21 @@ +package com.icomsys.main_vm.biz.rcp.conversation.dto; + +import lombok.Data; + +import java.time.LocalDateTime; + +@Data +public class TbIntentExampleDto { + + private Long seq; + private Long intentSeq; + private String exampleText; + private Long ifMappingId; + private String useYn; + private String registId; + private LocalDateTime registDate; + private String updateId; + private LocalDateTime updateDate; + + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/nlp/wisenut/service/NlpWisenutEntityService.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/nlp/wisenut/service/NlpWisenutEntityService.java new file mode 100644 index 0000000..6cbdbc8 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/nlp/wisenut/service/NlpWisenutEntityService.java @@ -0,0 +1,12 @@ +package com.icomsys.main_vm.biz.rcp.conversation.nlp.wisenut.service; + +import com.icomsys.main_vm.biz.rcp.conversation.nlp.wisenut.vo.NlpWisenutResult; + +import java.util.HashMap; + +public interface NlpWisenutEntityService { + + NlpWisenutResult entityInsertApi(HashMap eMap); + NlpWisenutResult entityUpdateApi(HashMap eMap); + NlpWisenutResult entityDeleteApi(HashMap eMap); +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/nlp/wisenut/service/NlpWisenutIntentService.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/nlp/wisenut/service/NlpWisenutIntentService.java new file mode 100644 index 0000000..fc6c56d --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/nlp/wisenut/service/NlpWisenutIntentService.java @@ -0,0 +1,23 @@ +package com.icomsys.main_vm.biz.rcp.conversation.nlp.wisenut.service; + +import com.icomsys.main_vm.biz.rcp.conversation.nlp.wisenut.vo.NlpWisenutResult; + +import java.util.HashMap; + +public interface NlpWisenutIntentService { + + NlpWisenutResult intentInsertApi(HashMap eMap); + + NlpWisenutResult intentUpdateApi(HashMap eMap); + + NlpWisenutResult intentDeleteApi(HashMap eMap); + + NlpWisenutResult intentSentenceInsertApi(HashMap eMap); + + NlpWisenutResult intentSentenceUpdateApi(HashMap eMap); + + NlpWisenutResult intentSentenceDeleteApi(HashMap eMap); + + NlpWisenutResult intentSentenceInsertAllApi(HashMap eMap); + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/nlp/wisenut/service/NlpWisenutProjectService.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/nlp/wisenut/service/NlpWisenutProjectService.java new file mode 100644 index 0000000..b88fb4f --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/nlp/wisenut/service/NlpWisenutProjectService.java @@ -0,0 +1,10 @@ +package com.icomsys.main_vm.biz.rcp.conversation.nlp.wisenut.service; + +import com.icomsys.main_vm.biz.rcp.conversation.nlp.wisenut.vo.NlpWisenutResult; + +import java.util.HashMap; + +public interface NlpWisenutProjectService { + + NlpWisenutResult projectUpdateApi(HashMap eMap); +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/nlp/wisenut/service/NlpWisenutService.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/nlp/wisenut/service/NlpWisenutService.java new file mode 100644 index 0000000..78ebdbb --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/nlp/wisenut/service/NlpWisenutService.java @@ -0,0 +1,23 @@ +package com.icomsys.main_vm.biz.rcp.conversation.nlp.wisenut.service; + +import com.icomsys.main_vm.biz.rcp.conversation.nlp.wisenut.vo.InferenceAPIResponseDTO; +import com.icomsys.main_vm.biz.rcp.conversation.nlp.wisenut.vo.NlpSimulationResult; +import com.icomsys.main_vm.biz.rcp.conversation.nlp.wisenut.vo.NlpWisenutResult; + + +public interface NlpWisenutService { + + public NlpWisenutResult projectSettingApi() ; + + public InferenceAPIResponseDTO multiQueryApi(int projectId, String[] query) ; + + public NlpSimulationResult simulationApi(String oprMngCode, String callId, String token, String userTalk, String methodType, String dnis) ; + + // 학습 시작 api + public NlpWisenutResult trainingStartApi(String oprMngCode) ; + + // 모델 반영 api + public NlpWisenutResult trainingApplyApi(String oprMngCode) ; + + public NlpWisenutResult defaultResult() ; +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/nlp/wisenut/service/impl/NlpWisenutEntityServiceImpl.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/nlp/wisenut/service/impl/NlpWisenutEntityServiceImpl.java new file mode 100644 index 0000000..c2c4bfa --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/nlp/wisenut/service/impl/NlpWisenutEntityServiceImpl.java @@ -0,0 +1,250 @@ +package com.icomsys.main_vm.biz.rcp.conversation.nlp.wisenut.service.impl; + +import com.google.gson.Gson; +import com.icomsys.main_vm.biz.rcp.conversation.nlp.wisenut.service.NlpWisenutEntityService; +import com.icomsys.main_vm.biz.rcp.conversation.nlp.wisenut.service.NlpWisenutService; +import com.icomsys.main_vm.biz.rcp.conversation.nlp.wisenut.util.RestTemplateUtil; +import com.icomsys.main_vm.biz.rcp.conversation.nlp.wisenut.vo.NlpWisenutResult; +import com.icomsys.main_vm.db.mybatis.mapper.NlpWisenutApiMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.http.HttpMethod; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import static com.icomsys.main_vm.biz.rcp.conversation.nlp.wisenut.util.RestTemplateUtil.callNlpApi; + +/** + * @Name NlpWisenutEntityServiceImpl + * @Description Entity API + * @Author dongheejang + * @CreateDate 2022. 06. 20. + */ + +@Service("nlpWisenutEntityService") +public class NlpWisenutEntityServiceImpl implements NlpWisenutEntityService { + + @Autowired + NlpWisenutApiMapper nlpWisenutApiMapper; + + @Autowired + NlpWisenutService nlpWisenutService; + +// @Autowired +// private ActiveTypeUtil activeTypeUtil; + + + @Value("${feign.url.nlp}") + private String nlpApi; + + @Value("${feign.url.cinnamon}") + private String cinnamonApi; + + @Value("${nlpapi}") + private boolean nlp; + + /** + * @Name entityInsertApi + * @Description 엔티티 추가 API + * @Author dongheejang + * @CreateDate 2022. 06. 20. + * + * @param eMap + * @return NlpWisenutResult + * + * @ChangeDescription + */ + @Override + public NlpWisenutResult entityInsertApi(HashMap eMap) { + + if (nlp) { + Gson gson = new Gson(); + Map nMap = new HashMap<>(); + + NlpWisenutResult nlpWisenutResult = new NlpWisenutResult(); + + boolean result = true; + long mappingId = 0; + String returnMsg = ""; + String returnCode = ""; + + try { + long projectId = nlpWisenutApiMapper.selectProjectId(eMap); // projectId DB에서 가져오기 + + nMap.put("projectId",projectId); + nMap.put("titleWord",eMap.get("repWord")); + nMap.put("tag",""); + nMap.put("synonyms",eMap.get("list")); + + // request param setting + String path = nlpApi + "/entity/insert"; + String body = gson.toJson(nMap).toString(); + HttpMethod method = HttpMethod.POST; + + // api request + String responseBody = RestTemplateUtil.callNlpApi(path, body, method); + + Map responseMap = new HashMap(); + responseMap = gson.fromJson(responseBody, responseMap.getClass()); + returnCode = responseMap.get("returnCode").toString(); + returnMsg = responseMap.get("returnMsg").toString(); + + if (!returnCode.equals("000")) { + result = false; + } else { + double id = (double) responseMap.get("id"); + mappingId = (long) id; + } + + } catch (Exception ex) { + returnMsg = ex.getMessage(); + result = false; + } + + nlpWisenutResult.setResult(result); + nlpWisenutResult.setReturnCode(returnCode); + nlpWisenutResult.setReturnMsg(returnMsg); + nlpWisenutResult.setMappingId(mappingId); + + return nlpWisenutResult; + } else { + return nlpWisenutService.defaultResult(); + } + } + + /** + * @Name entityUpdateApi + * @Description 엔티티 수정 API + * @Author dongheejang + * @CreateDate 2022. 06. 20. + * + * @param eMap + * @return NlpWisenutResult + * + * @ChangeDescription + */ + @Override + public NlpWisenutResult entityUpdateApi(HashMap eMap) { + + if (nlp) { + Gson gson = new Gson(); + Map nMap = new HashMap(); + + NlpWisenutResult nlpWisenutResult = new NlpWisenutResult(); + + boolean result = true; + String returnMsg = ""; + String returnCode = ""; + + try { + long projectId = nlpWisenutApiMapper.selectProjectId(eMap); // projectId DB에서 가져오기 + long entityId = nlpWisenutApiMapper.selectEntityId(eMap); + + List sList = new ArrayList<>(); + //sList에 synonyms들 추가 + + nMap.put("projectId",projectId); + nMap.put("id",entityId); + nMap.put("titleWord",eMap.get("repWord")); + nMap.put("tag",""); + nMap.put("synonyms",eMap.get("list")); + + // request param setting + String path = nlpApi + "/entity/update"; + String body = gson.toJson(nMap).toString(); + HttpMethod method = HttpMethod.POST; + + // api request + String responseBody = RestTemplateUtil.callNlpApi(path, body, method); + + Map responseMap = new HashMap(); + responseMap = gson.fromJson(responseBody, responseMap.getClass()); + returnCode = responseMap.get("returnCode").toString(); + returnMsg = responseMap.get("returnMsg").toString(); + + if (!returnCode.equals("000")) { + result = false; + } + + } catch (Exception ex) { + returnMsg = ex.getMessage(); + result = false; + } + + nlpWisenutResult.setResult(result); + nlpWisenutResult.setReturnCode(returnCode); + nlpWisenutResult.setReturnMsg(returnMsg); + + return nlpWisenutResult; + } else { + return nlpWisenutService.defaultResult(); + } + } + + /** + * @Name entityDeleteApi + * @Description 엔티티 삭제 API + * @Author dongheejang + * @CreateDate 2022. 06. 20. + * + * @param eMap + * @return NlpWisenutResult + * + * @ChangeDescription + */ + @Override + public NlpWisenutResult entityDeleteApi(HashMap eMap) { + + if (nlp) { + Gson gson = new Gson(); + Map nMap = new HashMap(); + + NlpWisenutResult nlpWisenutResult = new NlpWisenutResult(); + + boolean result = true; + String returnMsg = ""; + String returnCode = ""; + + try { + Map pMap = nlpWisenutApiMapper.selectEntityIdForDelete(eMap); + + nMap.put("projectId",pMap.get("projectId")); + nMap.put("id",pMap.get("entityId")); + + // request param setting + String path = nlpApi + "/entity/delete"; + String body = gson.toJson(nMap).toString(); + HttpMethod method = HttpMethod.POST; + + // api request + String responseBody = RestTemplateUtil.callNlpApi(path, body, method); + + Map responseMap = new HashMap(); + responseMap = gson.fromJson(responseBody, responseMap.getClass()); + returnCode = responseMap.get("returnCode").toString(); + returnMsg = responseMap.get("returnMsg").toString(); + + if (!returnCode.equals("000")) { + result = false; + } + + } catch (Exception ex) { + returnMsg = ex.getMessage(); + result = false; + } + + nlpWisenutResult.setResult(result); + nlpWisenutResult.setReturnCode(returnCode); + nlpWisenutResult.setReturnMsg(returnMsg); + + return nlpWisenutResult; + } else { + return nlpWisenutService.defaultResult(); + } + } + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/nlp/wisenut/service/impl/NlpWisenutIntentServiceImpl.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/nlp/wisenut/service/impl/NlpWisenutIntentServiceImpl.java new file mode 100644 index 0000000..928d23a --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/nlp/wisenut/service/impl/NlpWisenutIntentServiceImpl.java @@ -0,0 +1,545 @@ +package com.icomsys.main_vm.biz.rcp.conversation.nlp.wisenut.service.impl; + +import com.google.gson.Gson; +import com.icomsys.main_vm.biz.rcp.conversation.dto.IntentRequestDTO; +import com.icomsys.main_vm.biz.rcp.conversation.nlp.wisenut.service.NlpWisenutIntentService; +import com.icomsys.main_vm.biz.rcp.conversation.nlp.wisenut.service.NlpWisenutService; +import com.icomsys.main_vm.biz.rcp.conversation.nlp.wisenut.vo.NlpWisenutResult; +import com.icomsys.main_vm.biz.rcp.conversation.nlp.wisenut.vo.SentenceListVO; +import com.icomsys.main_vm.db.mybatis.mapper.NlpWisenutApiMapper; +import org.apache.commons.lang3.StringUtils; +import org.junit.Assert; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.http.HttpMethod; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import static com.icomsys.main_vm.biz.rcp.conversation.nlp.wisenut.util.RestTemplateUtil.callNlpApi; + +/** + * @Name NlpWisenutIntentServiceImpl + * @Description Intent API + * @Author dongheejang + * @CreateDate 2022. 06. 17. + */ + +@Service("nlpWisenutIntentService") +public class NlpWisenutIntentServiceImpl implements NlpWisenutIntentService { + + @Autowired + NlpWisenutApiMapper nlpWisenutApiMapper; + + @Autowired + NlpWisenutService nlpWisenutService; + + @Value("${feign.url.nlp}") + private String nlpApi; + + @Value("${feign.url.cinnamon}") + private String cinnamonApi; + + @Value("${nlpapi}") + private boolean nlp; + + /** + * @Name intentInsertApi + * @Description 인텐트 추가 API + * @Author dongheejang + * @CreateDate 2022. 06. 17. + * + * @param eMap + * @return NlpWisenutResult + * + * @ChangeDescription + */ + @Override + public NlpWisenutResult intentInsertApi(HashMap eMap) { + + if (nlp) { + Gson gson = new Gson(); + HashMap nMap = new HashMap(); + + NlpWisenutResult nlpWisenutResult = new NlpWisenutResult(); + + boolean result = true; + long mappingId = 0; + String returnMsg = ""; + String returnCode = ""; + + try { + long projectId = nlpWisenutApiMapper.selectProjectIdforOprMngCode(eMap); // projectId DB에서 가져오기 + + nMap.put("projectId",projectId); + nMap.put("name",eMap.get("intentName")); + nMap.put("taskBody",""); + nMap.put("taskType","DirectAnswer"); // TOBE - taskType에 대한 정리 필요 + nMap.put("mainSentence",""); + + + // request param setting + String path = nlpApi + "/intent/insert"; + String body = gson.toJson(nMap).toString(); + HttpMethod method = HttpMethod.POST; + + // api request + String responseBody = callNlpApi(path, body, method); + + Map responseMap = new HashMap(); + responseMap = gson.fromJson(responseBody, responseMap.getClass()); + returnCode = responseMap.get("returnCode").toString(); + returnMsg = responseMap.get("returnMsg").toString(); + + if (!returnCode.equals("000")) { + result = false; + } else { + double id = (double) responseMap.get("intentId"); + mappingId = (long) id; + } + + } catch (Exception ex) { + returnMsg = ex.getMessage(); + result = false; + } + + nlpWisenutResult.setResult(result); + nlpWisenutResult.setReturnCode(returnCode); + nlpWisenutResult.setReturnMsg(returnMsg); + nlpWisenutResult.setMappingId(mappingId); + + return nlpWisenutResult; + } else { + return nlpWisenutService.defaultResult(); + } + } + + /** + * @Name intentUpdateApi + * @Description 인텐트 수정 API + * @Author dongheejang + * @CreateDate 2022. 06. 17. + * + * @param eMap + * @return NlpWisenutResult + * + * @ChangeDescription + */ + @Override + public NlpWisenutResult intentUpdateApi(HashMap eMap) { + + if (nlp) { + Gson gson = new Gson(); + HashMap nMap = new HashMap(); + + NlpWisenutResult nlpWisenutResult = new NlpWisenutResult(); + + boolean result = true; + String returnMsg = ""; + String returnCode = ""; + + try { + long projectId = nlpWisenutApiMapper.selectProjectIdforOprMngCode(eMap); // projectId DB에서 가져오기 + long intentId = nlpWisenutApiMapper.selectIntentId(eMap); // intentId DB에서 가져오기 + + nMap.put("projectId",projectId); + nMap.put("id",intentId); + nMap.put("name",eMap.get("intentName")); + nMap.put("taskType","DirectAnswer"); + nMap.put("mainSentence",""); + nMap.put("taskBody",""); + + // request param setting + String path = nlpApi + "/intent/update"; + String body = gson.toJson(nMap).toString(); + HttpMethod method = HttpMethod.POST; + + // api request + String responseBody = callNlpApi(path, body, method); + + Map responseMap = new HashMap(); + responseMap = gson.fromJson(responseBody, responseMap.getClass()); + returnCode = responseMap.get("returnCode").toString(); + returnMsg = responseMap.get("returnMsg").toString(); + + if (!returnCode.equals("000")) { + result = false; + } + + } catch (Exception ex) { + returnMsg = ex.getMessage(); + result = false; + } + + nlpWisenutResult.setResult(result); + nlpWisenutResult.setReturnCode(returnCode); + nlpWisenutResult.setReturnMsg(returnMsg); + + return nlpWisenutResult; + } else { + return nlpWisenutService.defaultResult(); + } + } + + /** + * @Name intentDeleteApi + * @Description 인텐트 삭제 API + * @Author dongheejang + * @CreateDate 2022. 06. 17. + * + * @param eMap + * @return NlpWisenutResult + * + * @ChangeDescription + */ + @Override + public NlpWisenutResult intentDeleteApi(HashMap eMap) { + + if (nlp) { + Gson gson = new Gson(); + HashMap nMap = new HashMap(); + + NlpWisenutResult nlpWisenutResult = new NlpWisenutResult(); + + boolean result = true; + String returnMsg = ""; + String returnCode = ""; + + try { + HashMap pmap = nlpWisenutApiMapper.selectIntentIdForDelete(eMap); // intentId DB에서 가져오기 + + nMap.put("projectId",pmap.get("projectId")); + nMap.put("id",pmap.get("intentId")); + + // request param setting + String path = nlpApi + "/intent/delete"; + String body = gson.toJson(nMap).toString(); + HttpMethod method = HttpMethod.POST; + + // api request + String responseBody = callNlpApi(path, body, method); + + Map responseMap = new HashMap(); + responseMap = gson.fromJson(responseBody, responseMap.getClass()); + returnMsg = responseMap.get("returnMsg").toString(); + returnCode = responseMap.get("returnCode").toString(); + + if (!responseMap.get("returnCode").equals("000")) { + result = false; + } + + } catch (Exception ex) { + returnMsg = ex.getMessage(); + result = false; + } + + nlpWisenutResult.setResult(result); + nlpWisenutResult.setReturnCode(returnCode); + nlpWisenutResult.setReturnMsg(returnMsg); + + return nlpWisenutResult; + } else { + return nlpWisenutService.defaultResult(); + } + } + + /** + * @Name intentSentenceInsertApi + * @Description 사용자 질의 추가 API + * @Author dongheejang + * @CreateDate 2022. 06. 17. + * + * @param eMap + * @return NlpWisenutResult + * + * @ChangeDescription + */ + @Override + public NlpWisenutResult intentSentenceInsertApi(HashMap eMap) { + + if (nlp) { + Gson gson = new Gson(); + HashMap nMap = new HashMap(); + + NlpWisenutResult nlpWisenutResult = new NlpWisenutResult(); + + boolean result = true; + long mappingId = 0; + String returnMsg = ""; + String returnCode = ""; + + List eList = (List) eMap.get("exampleList"); + + + try { + long projectId; // projectId DB에서 가져오기 + long intentId; // intentId DB에서 가져오기 + + if (StringUtils.isEmpty((String)eMap.get("intentSeq"))) { + HashMap pMap = nlpWisenutApiMapper.selectIntentIdForDelete(eMap); + projectId = (long) pMap.get("projectId"); + intentId = (long) pMap.get("intentId"); + } else { + projectId = nlpWisenutApiMapper.selectProjectIdforOprMngCode(eMap); + intentId = nlpWisenutApiMapper.selectIntentId(eMap); + } + long soeId = 12345678; // soeID + + nMap.put("projectId",projectId); + nMap.put("intentId",intentId); + nMap.put("soeId",soeId); + + if (eList.size() > 0) { + nMap.put("sentence",eList.get(0).getExampleText()); + } + + // request param setting + String path = nlpApi + "/intent/sentenceInsert"; + String body = gson.toJson(nMap).toString(); + HttpMethod method = HttpMethod.POST; + + // api request + String responseBody = callNlpApi(path, body, method); + + Map responseMap = new HashMap(); + responseMap = gson.fromJson(responseBody, responseMap.getClass()); + returnCode = responseMap.get("returnCode").toString(); + returnMsg = responseMap.get("returnMsg").toString(); + + if (!returnCode.equals("000")) { + result = false; + } else { + double id = (double) responseMap.get("sentenceId"); + mappingId = (long) id; + } + + } catch (Exception ex) { + returnMsg = ex.getMessage(); + result = false; + } + + nlpWisenutResult.setResult(result); + nlpWisenutResult.setReturnCode(returnCode); + nlpWisenutResult.setReturnMsg(returnMsg); + nlpWisenutResult.setMappingId(mappingId); + + return nlpWisenutResult; + } else { + return nlpWisenutService.defaultResult(); + } + } + + /** + * @Name intentSentenceUpdateApi + * @Description 사용자 질의 수정 API + * @Author dongheejang + * @CreateDate 2022. 06. 17. + * + * @param eMap + * @return NlpWisenutResult + * + * @ChangeDescription + */ + @Override + public NlpWisenutResult intentSentenceUpdateApi(HashMap eMap) { + + if (nlp) { + Gson gson = new Gson(); + HashMap nMap = new HashMap(); + + NlpWisenutResult nlpWisenutResult = new NlpWisenutResult(); + + boolean result = true; + String returnMsg = ""; + String returnCode = ""; + + try { + long projectId = nlpWisenutApiMapper.selectProjectIdforOprMngCode(eMap); // projectId DB에서 가져오기 + long intentId = nlpWisenutApiMapper.selectIntentId(eMap); // intentId DB에서 가져오기 + long sentenceId = nlpWisenutApiMapper.selectIntentSentenctId(eMap); // sentectId DB에서 가져오기 + + nMap.put("projectId",projectId); + nMap.put("intentId",intentId); + nMap.put("id",sentenceId); + nMap.put("sentence",eMap.get("exampleList")); + + // request param setting + String path = nlpApi + "/intent/sentenceInsert"; + String body = gson.toJson(nMap).toString(); + HttpMethod method = HttpMethod.POST; + + // api request + String responseBody = callNlpApi(path, body, method); + + Map responseMap = new HashMap(); + responseMap = gson.fromJson(responseBody, responseMap.getClass()); + returnCode = responseMap.get("returnCode").toString(); + returnMsg = responseMap.get("returnMsg").toString(); + + if (!returnCode.equals("000")) { + result = false; + } + } catch (Exception ex) { + returnMsg = ex.getMessage(); + result = false; + } + + nlpWisenutResult.setResult(result); + nlpWisenutResult.setReturnCode(returnCode); + nlpWisenutResult.setReturnMsg(returnMsg); + + return nlpWisenutResult; + } else { + return nlpWisenutService.defaultResult(); + } + } + + /** + * @Name intentSentenceDeleteApi + * @Description 사용자 질의 삭제 API + * @Author dongheejang + * @CreateDate 2022. 06. 17. + * + * @param eMap + * @return NlpWisenutResult + * + * @ChangeDescription + */ + @Override + public NlpWisenutResult intentSentenceDeleteApi(HashMap eMap) { + + if (nlp) { + Gson gson = new Gson(); + HashMap nMap = new HashMap(); + + NlpWisenutResult nlpWisenutResult = new NlpWisenutResult(); + + boolean result = true; + String returnMsg = ""; + String returnCode = ""; + + try { + HashMap pMap = nlpWisenutApiMapper.selectIntentSentenctIdforDelete(eMap); // projectId DB에서 가져오기 // sentectId DB에서 가져오기 + + nMap.put("projectId",pMap.get("projectId")); + nMap.put("id",pMap.get("sentenceId")); + + // request param setting + String path = nlpApi + "/intent/sentenceDelete"; + String body = gson.toJson(nMap).toString(); + HttpMethod method = HttpMethod.POST; + + // api request + String responseBody = callNlpApi(path, body, method); + + Map responseMap = new HashMap(); + responseMap = gson.fromJson(responseBody, responseMap.getClass()); + returnCode = responseMap.get("returnCode").toString(); + returnMsg = responseMap.get("returnMsg").toString(); + + if (!returnCode.equals("000")) { + result = false; + } + } catch (Exception ex) { + returnMsg = ex.getMessage(); + result = false; + } + + nlpWisenutResult.setResult(result); + nlpWisenutResult.setReturnCode(returnCode); + nlpWisenutResult.setReturnMsg(returnMsg); + + return nlpWisenutResult; + } else { + return nlpWisenutService.defaultResult(); + } + } + + /** + * @Name intentSentenceInsertAllApi + * @Description 사용자 질의 다중 추가 + * @Author dongheejang + * @CreateDate 2023. 04. 21. + * + * @param eMap + * @return NlpWisenutResult + * + * @ChangeDescription + */ + @Override + public NlpWisenutResult intentSentenceInsertAllApi(HashMap eMap) { + + if (nlp) { + Gson gson = new Gson(); + HashMap nMap = new HashMap(); + + NlpWisenutResult nlpWisenutResult = new NlpWisenutResult(); + + boolean result = true; + String returnMsg = ""; + String returnCode = ""; +// ArrayList sentenceList = new ArrayList(); + + try { + long projectId = nlpWisenutApiMapper.selectProjectIdforOprMngCode(eMap); // projectId DB에서 가져오기 + + nMap.put("projectId",projectId); + nMap.put("sentenceList",eMap.get("sentenceList")); + + // request param setting + String path = nlpApi + "/intent/sentenceInsertAll"; + String body = gson.toJson(nMap).toString(); + HttpMethod method = HttpMethod.POST; + + // api request + String responseBody = callNlpApi(path, body, method); +// String responseBody = "{\"sentenceList\":[{\"intentId\": 114651124, \"soeId\": 12345678, \"sentence\": \"ACB\", \"intentName\": \"1\", \"sentenceId\" : 114651208,\"returnCode\":\"000\"}], \"returnCode\": \"000\", \"returnMsg\": \"Success\"}"; + Map responseMap = new HashMap(); + responseMap = gson.fromJson(responseBody, responseMap.getClass()); + returnCode = responseMap.get("returnCode").toString(); + returnMsg = responseMap.get("returnMsg").toString(); + + List tempList = (List) responseMap.get("sentenceList"); + List sentenceList = new ArrayList<>(); + + for (Object object : tempList) { + Map tempMap = (Map) object; + + SentenceListVO sentenceListVO = new SentenceListVO(); + sentenceListVO.setSentence((String) tempMap.get("sentence")); + sentenceListVO.setIntentName((String) tempMap.get("intentName")); + sentenceListVO.setReturnCode((String) tempMap.get("returnCode")); + double iIdd = (double) tempMap.get("intentId"); + long iIdl = (long) iIdd; + sentenceListVO.setIntentId(iIdl); + double sIdd = (double) tempMap.get("intentId"); + long sIdl = (long) sIdd; + sentenceListVO.setSentenceId(sIdl); + + sentenceList.add(sentenceListVO); + } + + if (!sentenceList.isEmpty()) { + nlpWisenutResult.setSentenceList(sentenceList); + } + if (!returnCode.equals("000")) { + result = false; + } + } catch (Exception ex) { + returnMsg = ex.getMessage(); + result = false; + } + + nlpWisenutResult.setResult(result); + nlpWisenutResult.setReturnCode(returnCode); + nlpWisenutResult.setReturnMsg(returnMsg); + + return nlpWisenutResult; + } else { + return nlpWisenutService.defaultResult(); + } + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/nlp/wisenut/service/impl/NlpWisenutProjectServiceImpl.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/nlp/wisenut/service/impl/NlpWisenutProjectServiceImpl.java new file mode 100644 index 0000000..5e192b4 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/nlp/wisenut/service/impl/NlpWisenutProjectServiceImpl.java @@ -0,0 +1,128 @@ +package com.icomsys.main_vm.biz.rcp.conversation.nlp.wisenut.service.impl; + +import com.google.gson.Gson; +import com.icomsys.main_vm.biz.rcp.conversation.nlp.wisenut.service.NlpWisenutProjectService; +import com.icomsys.main_vm.biz.rcp.conversation.nlp.wisenut.service.NlpWisenutService; +import com.icomsys.main_vm.biz.rcp.conversation.nlp.wisenut.vo.NlpWisenutResult; +import com.icomsys.main_vm.db.jpa.entity.system.TbServiceGrouop; +import com.icomsys.main_vm.db.jpa.repo.system.TbServiceGrouopRepo; +import com.icomsys.main_vm.db.mybatis.mapper.NlpWisenutApiMapper; +import lombok.RequiredArgsConstructor; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.http.HttpMethod; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import static com.icomsys.main_vm.biz.rcp.conversation.nlp.wisenut.util.RestTemplateUtil.callNlpApi; + +@Service("nlpWisenutProjectService") +@RequiredArgsConstructor +public class NlpWisenutProjectServiceImpl implements NlpWisenutProjectService { + + @Autowired + NlpWisenutApiMapper nlpWisenutApiMapper; + + @Autowired + NlpWisenutService nlpWisenutService; + + private final TbServiceGrouopRepo tbServiceGrouopRepo; + + @Value("${feign.url.nlp}") + private String nlpApi; + + @Value("${nlpapi}") + private boolean nlp; + + /** + * @Name projectUpdateApi + * @Description 프로젝트 수정 API + * @Author dongheejang + * @CreateDate 2022. 06. 20. + * + * @param eMap + * @return NlpWisenutResult + * + * @ChangeDescription + */ + @Override + public NlpWisenutResult projectUpdateApi(HashMap eMap) { + + if (nlp) { + Gson gson = new Gson(); + HashMap nMap = new HashMap(); + + NlpWisenutResult nlpWisenutResult = new NlpWisenutResult(); + + boolean result = true; + String returnMsg = ""; + String returnCode = ""; + + try { + long projectId = nlpWisenutApiMapper.selectProjectIdforOprMngCode(eMap); // projectId DB에서 가져오기 +// HashMap pMap = nlpWisenutApiMapper.selectProjectName(eMap); + TbServiceGrouop tbServiceGrouop = tbServiceGrouopRepo.findByCustCodeAndServiceGroup((String) eMap.get("custCode"), (String) eMap.get("serviceCode")); + + HashMap fMap = new HashMap(); + HashMap gMap = new HashMap(); + + List fList = new ArrayList<>(); + List gList = new ArrayList<>(); + List fmList = new ArrayList<>(); + List gmList = new ArrayList<>(); + + // 필요시 DB에서 data 가져오기 + nMap.put("id",projectId); + nMap.put("name",tbServiceGrouop.getServiceGroupName()); + nMap.put("summary",tbServiceGrouop.getServiceGroupName()); + nMap.put("simThreshold",Double.parseDouble(eMap.get("similarityCriteria").toString())); + nMap.put("confidentThreshold",Double.parseDouble(eMap.get("classCriteria").toString())); + nMap.put("confidentThresholdGap",Double.parseDouble(eMap.get("classResultCriteria").toString())); + + fmList.add(eMap.get("fallbackMsg").toString()); + gmList.add(eMap.get("greetingMsg").toString()); + fMap.put("channelCode","default"); + fMap.put("messages",fmList); + fList.add(fMap); + gMap.put("channelCode","default"); + gMap.put("messages",gmList); + gList.add(gMap); + + nMap.put("fallbackMessages",fList); + nMap.put("greetingMessages",gList); + + // request param setting + String path = nlpApi + "/proj/update"; + String body = gson.toJson(nMap); + HttpMethod method = HttpMethod.POST; + + // api request + String responseBody = callNlpApi(path, body, method); + + Map responseMap = new HashMap(); + responseMap = gson.fromJson(responseBody, responseMap.getClass()); + returnCode = responseMap.get("returnCode").toString(); + returnMsg = responseMap.get("returnMsg").toString(); + + if (!returnCode.equals("000")) { + result = false; + } + } catch (Exception ex) { + returnMsg = ex.getMessage(); + result = false; + } + + nlpWisenutResult.setResult(result); + nlpWisenutResult.setReturnCode(returnCode); + nlpWisenutResult.setReturnMsg(returnMsg); + + return nlpWisenutResult; + } else { + return nlpWisenutService.defaultResult(); + } + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/nlp/wisenut/service/impl/NlpWisenutServiceImpl.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/nlp/wisenut/service/impl/NlpWisenutServiceImpl.java new file mode 100644 index 0000000..84be13a --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/nlp/wisenut/service/impl/NlpWisenutServiceImpl.java @@ -0,0 +1,290 @@ +package com.icomsys.main_vm.biz.rcp.conversation.nlp.wisenut.service.impl; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.LongSerializationPolicy; +import com.icomsys.main_vm.biz.rcp.conversation.nlp.wisenut.service.NlpWisenutService; +import com.icomsys.main_vm.biz.rcp.conversation.nlp.wisenut.util.RestTemplateUtil; +import com.icomsys.main_vm.biz.rcp.conversation.nlp.wisenut.vo.InferenceAPIResponseDTO; +import com.icomsys.main_vm.biz.rcp.conversation.nlp.wisenut.vo.NlpWisenutResult; +import com.icomsys.main_vm.biz.rcp.conversation.nlp.wisenut.vo.NlpSimulationResult; +import com.icomsys.main_vm.db.mybatis.mapper.NlpWisenutApiMapper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.http.HttpMethod; +import org.springframework.stereotype.Service; + +import java.util.HashMap; +import java.util.Map; + +import static com.icomsys.main_vm.biz.rcp.conversation.nlp.wisenut.util.RestTemplateUtil.callNlpApi; + +@Service("nlpWisenutService") +public class NlpWisenutServiceImpl implements NlpWisenutService { + + private static final Logger LOGGER = LoggerFactory.getLogger(NlpWisenutServiceImpl.class); + + @Autowired + NlpWisenutApiMapper nlpWisenutApiMapper; + + @Value("${spring.config.activate.on-profile}") + private String serviceActive; + + @Value("${feign.url.nlp}") + private String nlpApi; + + @Value("${feign.url.cinnamon}") + private String cinnamonApi; + + // 필요시 DAO 추가 +// @Resource(name = "xxxDAO") +// private XxxDAO xxxDAO; + + @Override + public NlpWisenutResult projectSettingApi() { + Gson gson = new Gson(); + NlpWisenutResult nlpWisenutResult = new NlpWisenutResult(); + boolean result = true; + long mappingId = 0; + + try { + // 필요시 DB에서 data 가져오기 + + // request param setting + String path = nlpApi + "/path"; + String body = gson.toJson(""); + HttpMethod method = HttpMethod.POST; + + // api request + String responseBody = RestTemplateUtil.callNlpApi(path, body, method); + Map responseMap = new HashMap(); + responseMap = gson.fromJson(responseBody, responseMap.getClass()); + + double id = (double) responseMap.get("id"); + mappingId = (long) id; + } catch (Exception ex) { + LOGGER.error(ex.getMessage()); + result = false; + } + + nlpWisenutResult.setResult(result); + nlpWisenutResult.setMappingId(mappingId); + // api에서 여러 데이터를 한번에 처리해서 return 받는 id가 여러개인 경우 +// nlpWisenutResult.setMappingIds(List); + + return nlpWisenutResult; + } + + // 의도추론 테스트 API 연동 + @Override + public InferenceAPIResponseDTO multiQueryApi(int projectId, String[] query) { + GsonBuilder gb = new GsonBuilder(); + gb.setLongSerializationPolicy(LongSerializationPolicy.STRING); + Gson gson = gb.create(); + InferenceAPIResponseDTO responseDTO = new InferenceAPIResponseDTO(); + try { + // request param setting + String path = nlpApi + "/intent/multiQuery"; + Map params = new HashMap(); + params.put("projectId", projectId); + params.put("query", query); + String body = gson.toJson(params); + HttpMethod method = HttpMethod.POST; + + // api request + String responseBody = RestTemplateUtil.callNlpApi(path, body, method); + responseDTO = gson.fromJson(responseBody, InferenceAPIResponseDTO.class); + } catch (Exception ex) { + responseDTO.setReturnCode("-999"); + responseDTO.setReturnMsg("API 호출 오류"); + LOGGER.error(ex.getMessage()); + } + return responseDTO; + } + + // 시뮬레이터 API 호출 + @Override + public NlpSimulationResult simulationApi(String oprMngCode, String callId, String token, String userTalk, String methodType, String dnis) { + Gson gson = new Gson(); + NlpSimulationResult nlpSimulationResult = new NlpSimulationResult(); + +// String dnis = ""; +// +// if ("local".equals(serviceActive) || "dev".equals(serviceActive)) { +// if (oprMngCode.equals("UPLUS_RCP_AISTORE")) { +// // 요식업 +// dnis = "07075999946"; +// } else { +// // 유통업 +// dnis = "07075999943"; +// } +// } else if ("stg".equals(serviceActive)) { +// if (oprMngCode.equals("UPLUS_RCP_AISTORE")) { +// // 요식업 +// dnis = "07075999956"; +// } else { +// // 유통업 +// dnis = "07075999955"; +// } +// } else if ("pro".equals(serviceActive)) { +// if (oprMngCode.equals("UPLUS_RCP_AISTORE")) { +// // 요식업 +// dnis = "07040066981"; +// } else { +// // 유통업 +// dnis = "07040066982"; +// } +// } + + try { + // request param setting + Map bodyMap = new HashMap(); + bodyMap.put("talkText", userTalk); + bodyMap.put("mentType", "CHAT"); + bodyMap.put("oprMngCode", oprMngCode); + bodyMap.put("method", methodType); + bodyMap.put("callId", callId); + bodyMap.put("telNo", "01012341234"); + bodyMap.put("dnis", dnis); + bodyMap.put("downtownNum ", dnis); + bodyMap.put("token", token); + bodyMap.put("transactionId", "0"); + bodyMap.put("sttRecordFilePath", ""); + bodyMap.put("ttsRecordFilePath", ""); + + String path = cinnamonApi + "/platform/api/simulation"; + String body = gson.toJson(bodyMap); + System.out.println(body); + HttpMethod method = HttpMethod.POST; + + // api request + String responseBody = RestTemplateUtil.callNlpApi(path, body, method); + + Map responseMap = new HashMap(); + responseMap = gson.fromJson(responseBody, responseMap.getClass()); + Map vbParam = (Map) responseMap.get("data"); + Map paramMap = (Map) vbParam.get("vbData"); + + String returnCode = String.valueOf(Double.valueOf(String.valueOf(responseMap.get("resultCode"))).intValue()); + + nlpSimulationResult.setToken(String.valueOf(responseMap.get("token"))); + nlpSimulationResult.setReturnCode(returnCode); + nlpSimulationResult.setReturnMsg("성공"); + nlpSimulationResult.setBotTalk(responseMap.get("announceMents") == null ? "" : responseMap.get("announceMents").toString()); + nlpSimulationResult.setIntentId(vbParam.get("intentId") == null ? "" : vbParam.get("intentId").toString()); + nlpSimulationResult.setIntentName(vbParam.get("intentName") == null ? "" : vbParam.get("intentName").toString()); + nlpSimulationResult.setIntentScore(vbParam.get("score") == null ? "" : vbParam.get("score").toString() + " %"); + nlpSimulationResult.setParameter(paramMap); + + } catch (Exception ex) { + LOGGER.error(ex.getMessage()); + } + + return nlpSimulationResult; + } + + // 학습 시작 api + @Override + public NlpWisenutResult trainingStartApi(String oprMngCode) { + Gson gson = new Gson(); + HashMap nMap = new HashMap(); + + NlpWisenutResult nlpWisenutResult = new NlpWisenutResult(); + boolean result = true; + String returnMsg = ""; + String returnCode = ""; + + HashMap eMap = new HashMap(); + + try { + eMap.put("serviceCode",oprMngCode); + long projectId = nlpWisenutApiMapper.selectProjectId(eMap); // projectId DB에서 가져오기 + + nMap.put("projectId", projectId); + + // request param setting + String path = nlpApi + "/training/start"; + String body = gson.toJson(nMap); + HttpMethod method = HttpMethod.POST; + + // api request + String responseBody = RestTemplateUtil.callNlpApi(path, body, method); + Map responseMap = new HashMap(); + responseMap = gson.fromJson(responseBody, responseMap.getClass()); + returnCode = responseMap.get("returnCode").toString(); + returnMsg = responseMap.get("returnMsg").toString(); + + if (!returnCode.equals("000")) { + result = false; + } + + } catch (Exception ex) { + LOGGER.error(ex.getMessage()); + result = false; + } + + nlpWisenutResult.setResult(result); + nlpWisenutResult.setReturnCode(returnCode); + nlpWisenutResult.setReturnMsg(returnMsg); + + return nlpWisenutResult; + } + + // 모델 반영 api + @Override + public NlpWisenutResult trainingApplyApi(String oprMngCode) { + Gson gson = new Gson(); + HashMap nMap = new HashMap(); + + NlpWisenutResult nlpWisenutResult = new NlpWisenutResult(); + boolean result = true; + String returnMsg = ""; + String returnCode = ""; + + HashMap eMap = new HashMap(); + + try { + eMap.put("serviceCode",oprMngCode); + long projectId = nlpWisenutApiMapper.selectProjectId(eMap); // projectId DB에서 가져오기 + + nMap.put("projectId", projectId); + + // request param setting + String path = nlpApi + "/training/apply"; + String body = gson.toJson(nMap); + HttpMethod method = HttpMethod.POST; + + // api request + String responseBody = RestTemplateUtil.callNlpApi(path, body, method); + Map responseMap = new HashMap(); + responseMap = gson.fromJson(responseBody, responseMap.getClass()); + returnCode = responseMap.get("returnCode").toString(); + returnMsg = responseMap.get("returnMsg").toString(); + + if (!returnCode.equals("000")) { + result = false; + } + + } catch (Exception ex) { + LOGGER.error(ex.getMessage()); + result = false; + } + + nlpWisenutResult.setResult(result); + nlpWisenutResult.setReturnCode(returnCode); + nlpWisenutResult.setReturnMsg(returnMsg); + + return nlpWisenutResult; + } + + @Override + public NlpWisenutResult defaultResult() { + long id = 0; + NlpWisenutResult nlpWisenutResult = new NlpWisenutResult(); + nlpWisenutResult.setResult(true); + nlpWisenutResult.setMappingId(id); + return nlpWisenutResult; + } +} \ No newline at end of file diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/nlp/wisenut/util/RestTemplateUtil.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/nlp/wisenut/util/RestTemplateUtil.java new file mode 100644 index 0000000..5643a00 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/nlp/wisenut/util/RestTemplateUtil.java @@ -0,0 +1,60 @@ +package com.icomsys.main_vm.biz.rcp.conversation.nlp.wisenut.util; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.http.*; +import org.springframework.http.converter.StringHttpMessageConverter; +import org.springframework.stereotype.Component; +import org.springframework.util.MultiValueMap; +import org.springframework.web.client.RestClientException; +import org.springframework.web.client.RestTemplate; + +import java.nio.charset.StandardCharsets; + +@Component +public class RestTemplateUtil { + + private static final Logger LOGGER = LoggerFactory.getLogger(RestTemplateUtil.class); + private static final RestTemplate restTemplate; + + static { + restTemplate = new RestTemplate(); + // UTF-8 인코딩 설정 + restTemplate.getMessageConverters().add(0, new StringHttpMessageConverter(StandardCharsets.UTF_8)); + } + + public static String callNlpApi(String path, String body, HttpMethod method) { + return callNlpApi(path, null, body, method); + } + + public static String callNlpApi(String path, String query, String body, HttpMethod method) { + if (path == null || "null".equalsIgnoreCase(path)) path = ""; + if (query == null) { + query = ""; + } else if (!"".equals(query) && !query.startsWith("?")) { + query = "?" + query; + } + + // header set + MultiValueMap header = new HttpHeaders(); + header.set("Content-Type", MediaType.APPLICATION_JSON_UTF8_VALUE); + + String url = ""; + if (!path.startsWith("http")) { + url = path + query; + } else { + url = path + query; + } + + try { + LOGGER.info("CALLBOT >>> NLP : " + body); + LOGGER.info("CALL NLP API: " + url); + ResponseEntity response = restTemplate.exchange(url + query, method, new HttpEntity<>(body, header), String.class); + LOGGER.info(response.getBody()); + return response.getBody(); + } catch (RestClientException e) { + LOGGER.info(e.getMessage()); + return e.getMessage(); + } + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/nlp/wisenut/vo/InferenceAPIResponseDTO.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/nlp/wisenut/vo/InferenceAPIResponseDTO.java new file mode 100644 index 0000000..11d7954 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/nlp/wisenut/vo/InferenceAPIResponseDTO.java @@ -0,0 +1,60 @@ +package com.icomsys.main_vm.biz.rcp.conversation.nlp.wisenut.vo; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +import java.util.List; + +public class InferenceAPIResponseDTO { + + private String returnCode; + private String returnMsg; + private List data; + + /* child */ + private String query; + private String dialogTaskName; + private String dialogTaskId; + + public String getReturnCode() { + return returnCode; + } + public void setReturnCode(String returnCode) { + this.returnCode = returnCode; + } + public String getReturnMsg() { + return returnMsg; + } + public void setReturnMsg(String returnMsg) { + this.returnMsg = returnMsg; + } + public List getData() { + return data; + } + public void setData(List data) { + this.data = data; + } + public String getQuery() { + return query; + } + public void setQuery(String query) { + this.query = query; + } + public String getDialogTaskName() { + return dialogTaskName; + } + public void setDialogTaskName(String dialogTaskName) { + this.dialogTaskName = dialogTaskName; + } + public String getDialogTaskId() { + return dialogTaskId; + } + public void setDialogTaskId(String dialogTaskId) { + this.dialogTaskId = dialogTaskId; + } + + @Override + public String toString() { + return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE); + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/nlp/wisenut/vo/NlpSimulationResult.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/nlp/wisenut/vo/NlpSimulationResult.java new file mode 100644 index 0000000..4c2179d --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/nlp/wisenut/vo/NlpSimulationResult.java @@ -0,0 +1,74 @@ +package com.icomsys.main_vm.biz.rcp.conversation.nlp.wisenut.vo; + +import java.util.Map; + +public class NlpSimulationResult { + String token; + String returnCode; + String returnMsg; + String botTalk; + String intentId; + String intentName; + String intentScore; + Map parameter; + + public String getToken() { return token; } + + public void setToken(String token) { this.token = token; } + + public String getReturnCode() { + return returnCode; + } + + public void setReturnCode(String returnCode) { + this.returnCode = returnCode; + } + + public String getReturnMsg() { + return returnMsg; + } + + public void setReturnMsg(String returnMsg) { + this.returnMsg = returnMsg; + } + + public String getBotTalk() { + return botTalk; + } + + public void setBotTalk(String botTalk) { + this.botTalk = botTalk; + } + + public String getIntentId() { + return intentId; + } + + public void setIntentId(String intentId) { + this.intentId = intentId; + } + + public String getIntentName() { + return intentName; + } + + public void setIntentName(String intentName) { + this.intentName = intentName; + } + + public String getIntentScore() { + return intentScore; + } + + public void setIntentScore(String intentScore) { + this.intentScore = intentScore; + } + + public Map getParameter() { + return parameter; + } + + public void setParameter(Map parameter) { + this.parameter = parameter; + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/nlp/wisenut/vo/NlpWisenutResult.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/nlp/wisenut/vo/NlpWisenutResult.java new file mode 100644 index 0000000..b844526 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/nlp/wisenut/vo/NlpWisenutResult.java @@ -0,0 +1,58 @@ +package com.icomsys.main_vm.biz.rcp.conversation.nlp.wisenut.vo; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +public class NlpWisenutResult { + boolean result; // I/F 성공 : true, 실패 : false + Long mappingId; + String returnCode; + String returnMsg; + List mappingIds; + List sentenceList; + + public boolean getResult() { + return result; + } + + public void setResult(boolean result) { + this.result = result; + } + + public Long getMappingId() { + return mappingId; + } + + public void setMappingId(Long mappingId) { + this.mappingId = mappingId; + } + + public String getReturnCode() { + return returnCode; + } + + public void setReturnCode(String returnCode) { + this.returnCode = returnCode; + } + + public String getReturnMsg() { + return returnMsg; + } + + public void setReturnMsg(String returnMsg) { + this.returnMsg = returnMsg; + } + + public List getMappingIds() { + return mappingIds; + } + + public void setMappingIds(List mappingIds) { + this.mappingIds = mappingIds; + } + + public List getSentenceList() { return sentenceList; } + + public void setSentenceList(List sentenceList) { this.sentenceList = sentenceList; } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/nlp/wisenut/vo/SentenceListVO.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/nlp/wisenut/vo/SentenceListVO.java new file mode 100644 index 0000000..2fb8b5b --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/nlp/wisenut/vo/SentenceListVO.java @@ -0,0 +1,24 @@ +package com.icomsys.main_vm.biz.rcp.conversation.nlp.wisenut.vo; + +public class SentenceListVO { + + private Long intentId; + private String intentName; + private Long soeId; + private String sentence; + private Long sentenceId; + private String returnCode; + + public Long getIntentId() { return intentId; } + public void setIntentId(Long intentId) { this.intentId = intentId; } + public String getIntentName() { return intentName; } + public void setIntentName(String intentName) { this.intentName = intentName; } + public Long getSoeId() { return soeId; } + public void setSoeId(Long soeId) { this.soeId = soeId; } + public String getSentence() { return sentence; } + public void setSentence(String sentence) { this.sentence = sentence; } + public Long getSentenceId() { return sentenceId; } + public void setSentenceId(Long sentenceId) { this.sentenceId = sentenceId; } + public String getReturnCode() { return returnCode; } + public void setReturnCode(String returnCode) { this.returnCode = returnCode; } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/service/ConversationApiNodeEditService.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/service/ConversationApiNodeEditService.java new file mode 100644 index 0000000..7a82281 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/service/ConversationApiNodeEditService.java @@ -0,0 +1,145 @@ +package com.icomsys.main_vm.biz.rcp.conversation.service; + +import com.icomsys.main_vm.biz.advice.excep.CustomBadRequestException; +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.service.LoginService; +import com.icomsys.main_vm.biz.rcp.conversation.vo.ConversationApiNodeEditReq; +import com.icomsys.main_vm.biz.rcp.conversation.vo.ConversationApiNodeInfoRes; +import com.icomsys.main_vm.biz.rcp.conversation.vo.LongtextManagerVO; +import com.icomsys.main_vm.common.code.code.LongTextManagerColumnCode; +import com.icomsys.main_vm.common.code.code.LongTextManagerTableCode; +import com.icomsys.main_vm.common.code.enumresource.ActionResource; +import com.icomsys.main_vm.common.code.enumresource.MenuResource; +import com.icomsys.main_vm.common.util.HashUtil; +import com.icomsys.main_vm.db.jpa.entity.scenario.TbApiNode; +import com.icomsys.main_vm.db.jpa.entity.scenario.TbLongtextManager; +import com.icomsys.main_vm.db.jpa.repo.scenario.TbApiNodeRepo; +import com.icomsys.main_vm.db.jpa.repo.scenario.TbLongtextManagerRepo; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.RequestBody; + +import java.security.NoSuchAlgorithmException; +import java.time.LocalDateTime; +import java.util.HashMap; +import java.util.List; + +/** + * Name : ConversationApiNodeEditService + * date : 2023-02-07 + * author : Mong + * description : + * =========================================================== + * DATE AUTHOR NOTE + * ----------------------------------------------------------- + * 2023-02-07 Mong 최초 생성 + */ + +@Service +@RequiredArgsConstructor +@Slf4j +public class ConversationApiNodeEditService { + + private final LoginService loginService; + private final LogService logService; + + private final TbLongtextManagerRepo tbLongtextManagerRepo; + + private final TbApiNodeRepo tbApiNodeRepo; + + + @Transactional + public int insertApiNode(ConversationApiNodeEditReq dto) throws CustomBadRequestException{ + + String userId = loginService.getUserVo().getUserId(); + LocalDateTime currentDateTime = LocalDateTime.now(); + String oprMngCode = dto.getCustCode() + "_RCP_" + dto.getServiceGroup(); + + TbApiNode vo = new TbApiNode(); + vo.setNodeName(dto.getNodeName()); + vo.setUseYn("Y"); + vo.setRegistId(userId); + vo.setRegistDate(currentDateTime); + vo.setUpdateId(userId); + vo.setUpdateDate(currentDateTime); + vo.setOprMngCode(oprMngCode); + + TbApiNode result = tbApiNodeRepo.save(vo); + + TbLongtextManager vo1 = new TbLongtextManager(); + String checkSum; + + try { + checkSum = HashUtil.getStringToChecksum(dto.getTextContents()); + } catch (NoSuchAlgorithmException e) { + throw new CustomBadRequestException("API node 해시값 생성에 실패하였습니다."); + } + + vo1.setRfSeq(result.getSeq()); + vo1.setTableCode(LongTextManagerTableCode.TB_API_NODE.getCode()); + vo1.setColumnCode(LongTextManagerColumnCode.CONTENT.getCode()); + vo1.setChecksum(checkSum); + vo1.setTextContents(dto.getTextContents()); + tbLongtextManagerRepo.save(vo1); + + logService.LogSave(LogVO.builder() + .menuAuth(MenuResource.rcpconversationapiNodemanage) + .serviceGroup(dto.getServiceGroup()) + .actionCode(ActionResource.insert.getName()) + .build()); + + return Math.toIntExact(result.getSeq()); + } + + @Transactional + public int updateApiNode(ConversationApiNodeEditReq dto) throws CustomBadRequestException { + if (dto.getNodeName() == null || dto.getNodeName().isEmpty()) { + throw new CustomBadRequestException("API Node명을 입력해주세요"); + } + + String checkSum; + try { + checkSum = HashUtil.getStringToChecksum(dto.getTextContents()); + } catch (NoSuchAlgorithmException e) { + throw new CustomBadRequestException("API node 해시값 생성에 실패하였습니다."); + } + + LongtextManagerVO vo = new LongtextManagerVO(); + vo.setTextContents(dto.getTextContents()); + vo.setTableCode(LongTextManagerTableCode.TB_API_NODE.getCode()); + vo.setColumnCode(LongTextManagerColumnCode.CONTENT.getCode()); + vo.setChecksum(checkSum); + vo.setRfSeq(dto.getSeq()); + + tbLongtextManagerRepo.updateApiLongTextManager(vo); + tbApiNodeRepo.updateApiNode(dto); + + logService.LogSave(LogVO.builder() + .menuAuth(MenuResource.rcpconversationapiNodemanage) + .serviceGroup(dto.getServiceGroup()) + .actionCode(ActionResource.update.getName()) + .build()); + + return 0; + } + + public HashMap selectApiNode(HashMap map) { + Long seq = Long.parseLong(String.valueOf(map.get("seq"))); + LongtextManagerVO vo = new LongtextManagerVO(); + vo.setRfSeq(seq); + vo.setColumnCode(LongTextManagerColumnCode.CONTENT.getCode()); + vo.setTableCode(LongTextManagerTableCode.TB_API_NODE.getCode()); + List list = tbLongtextManagerRepo.selectLongTextManager(vo); + List list1 = tbApiNodeRepo.selectApiNode(seq); + + HashMap map1 = new HashMap(); + map1.put("apiData", list); + map1.put("apiDataInfo", list1); + + return map1; + } + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/service/ConversationApiNodeService.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/service/ConversationApiNodeService.java new file mode 100644 index 0000000..4347a6b --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/service/ConversationApiNodeService.java @@ -0,0 +1,69 @@ +package com.icomsys.main_vm.biz.rcp.conversation.service; + +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.system.vo.DslDataTableRes; +import com.icomsys.main_vm.biz.rcp.conversation.vo.ConversationApiNodeInfoReq; +import com.icomsys.main_vm.biz.rcp.conversation.vo.ConversationApiNodeInfoRes; +import com.icomsys.main_vm.common.code.enumresource.ActionResource; +import com.icomsys.main_vm.common.code.enumresource.MenuResource; +import com.icomsys.main_vm.db.jpa.entity.system.TbServiceGrouop; +import com.icomsys.main_vm.db.jpa.repo.scenario.TbApiNodeRepo; +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.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.HashMap; + +/** + * Name : ConversationApiNodeService + * date : 2023-02-07 + * author : Mong + * description : + * =========================================================== + * DATE AUTHOR NOTE + * ----------------------------------------------------------- + * 2023-02-07 Mong 최초 생성 + */ + +@Service +@RequiredArgsConstructor +@Slf4j +public class ConversationApiNodeService { + + private final TbApiNodeRepo tbApiNodeRepo; + private final TbServiceGrouopRepo tbServiceGrouopRepo; + private final LogService logService; + + public DslDataTableRes searchApiNodeList(ConversationApiNodeInfoReq dto) throws CustomNotFoundException { + if (dto.isContainUpper()) { // 상위 그룹포함 검색일 경우 + TbServiceGrouop serviceGrouop = tbServiceGrouopRepo.findByServiceGroup(dto.getServiceGroup()) + .orElseThrow(() -> new CustomNotFoundException("서비스 그룹 정보가 없습니다.")); + + dto.setServiceGroupUpper(serviceGrouop.getServiceGroupUpper()); + } + + QueryResults result = tbApiNodeRepo.searchApiNodeList(dto); + return new DslDataTableRes(result); + } + + @Transactional + public int deleteApiNode(HashMap map){ + Long seq = Long.parseLong(String.valueOf(map.get("seq"))); + String serviceGroup = String.valueOf(map.get("serviceGroup")); + tbApiNodeRepo.deleteApiNode(seq); + + logService.LogSave(LogVO.builder() + .menuAuth(MenuResource.rcpconversationapiNodemanage) + .actionCode(ActionResource.delete.getName()) + .serviceGroup(serviceGroup) + .build()); + + return 0; + } + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/service/ConversationCmmNodeService.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/service/ConversationCmmNodeService.java new file mode 100644 index 0000000..3d745a9 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/service/ConversationCmmNodeService.java @@ -0,0 +1,242 @@ +package com.icomsys.main_vm.biz.rcp.conversation.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.service.LoginService; +import com.icomsys.main_vm.biz.common.system.vo.DslDataTableRes; +import com.icomsys.main_vm.biz.rcp.conversation.vo.*; +import com.icomsys.main_vm.biz.rcp.util.ScenarioConverter; +import com.icomsys.main_vm.common.code.code.LongTextManagerColumnCode; +import com.icomsys.main_vm.common.code.code.LongTextManagerTableCode; +import com.icomsys.main_vm.common.code.enumresource.ActionResource; +import com.icomsys.main_vm.common.code.enumresource.MenuResource; +import com.icomsys.main_vm.db.jpa.entity.scenario.TbCommonNode; +import com.icomsys.main_vm.db.jpa.entity.scenario.TbLongtextManager; +import com.icomsys.main_vm.db.jpa.entity.scenario.id.TbLongtextManagerId; +import com.icomsys.main_vm.db.jpa.entity.system.TbServiceGrouop; +import com.icomsys.main_vm.db.jpa.repo.scenario.TbCommonNodeRepo; +import com.icomsys.main_vm.db.jpa.repo.scenario.TbLongtextManagerRepo; +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.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.security.NoSuchAlgorithmException; +import java.time.LocalDateTime; +import java.util.HashMap; +import java.util.List; +import java.util.Optional; + +/** + * Name : ConversationCmmNodeService + * date : 2023-02-13 + * author : Mong + * description : + * =========================================================== + * DATE AUTHOR NOTE + * ----------------------------------------------------------- + * 2023-02-13 Mong 최초 생성 + */ +@Service +@RequiredArgsConstructor +@Slf4j +public class ConversationCmmNodeService { + + private final TbCommonNodeRepo tbCommonNodeRepo; + private final TbLongtextManagerRepo tbLongtextManagerRepo; + private final TbServiceGrouopRepo tbServiceGrouopRepo; + private final LoginService loginService; + private final LogService logService; + + public DslDataTableRes selectCmmNodeList(ConversationCmmNodeInfoReq dto) throws CustomNotFoundException { + if (dto.isContainUpper()) { // 상위 그룹포함 검색일 경우 + TbServiceGrouop serviceGrouop = tbServiceGrouopRepo.findByServiceGroup(dto.getServiceGroup()) + .orElseThrow(() -> new CustomNotFoundException("서비스 그룹 정보가 없습니다.")); + + dto.setServiceGroupUpper(serviceGrouop.getServiceGroupUpper()); + } + + QueryResults result = tbCommonNodeRepo.serachCmmNodeList(dto); + return new DslDataTableRes(result); + } + + @Transactional(readOnly = true) + public ConversationCmmNodeDiagramVO selectCmmNode(ConversationCmmNodeEditReq dto) throws CustomNotFoundException { + ConversationCmmNodeDiagramVO vo = new ConversationCmmNodeDiagramVO(); + TbLongtextManagerId tlm = new TbLongtextManagerId(); + Long seq = dto.getSeq(); + + if (seq == null) { // 시나리오 초기 생성 + return vo; + } + + tlm.setRfSeq(seq); + tlm.setTableCode(LongTextManagerTableCode.TB_COMMON_NODE.getCode()); + tlm.setColumnCode(LongTextManagerColumnCode.DIAGRAM.getCode()); + log.info("tlm -> {} ", new Gson().toJson(tlm)); + + TbCommonNode result1 = tbCommonNodeRepo.findBySeqAndUseYn(seq, "Y"). + orElseThrow(() -> new CustomNotFoundException("Common Node를 찾지 못하였습니다.")); + + TbLongtextManager result = tbLongtextManagerRepo.findById(tlm). + orElseThrow(() -> new CustomNotFoundException("다이어그램 정보를 찾지 못하였습니다.")); + + vo.setSeq(result.getRfSeq()); + vo.setTextContents(result.getTextContents()); + vo.setNodeName(result1.getNodeName()); + vo.setOprMngCode(result1.getOprMngCode()); + + return vo; + + } + + @Transactional + public int saveCmmNode(ConversationCmmNodeEditReq dto) throws CustomBadRequestException { + + String userId = loginService.getUserVo().getUserId(); + LocalDateTime currentDateTime = LocalDateTime.now(); + String oprMngCode = dto.getCustCode() + "_RCP_" + dto.getServiceGroup(); + + ScenarioConverter scenarioConverter = new ScenarioConverter(dto.getTextContents()); + scenarioConverter.convertDiagramToCallScenario(); + try { + scenarioConverter.createChecksum(); + } catch (NoSuchAlgorithmException e) { + throw new CustomBadRequestException("Common Node 해시값 생성에 실패하였습니다."); + } + + TbCommonNode vo = new TbCommonNode(); + vo.setNodeName(dto.getNodeName()); + vo.setUseYn("Y"); + vo.setRegistId(userId); + vo.setRegistDate(currentDateTime); + vo.setUpdateId(userId); + vo.setUpdateDate(currentDateTime); + vo.setOprMngCode(oprMngCode); + + TbCommonNode result = tbCommonNodeRepo.save(vo); + + // Diagram 저장 + tbLongtextManagerRepo.save(new TbLongtextManager( + result.getSeq(), + LongTextManagerTableCode.TB_COMMON_NODE.getCode(), + LongTextManagerColumnCode.DIAGRAM.getCode(), + scenarioConverter.getDiagramString(), + scenarioConverter.getDiagramChecksum())); + + // Call Scenario 저장 + tbLongtextManagerRepo.save(new TbLongtextManager( + result.getSeq(), + LongTextManagerTableCode.TB_COMMON_NODE.getCode(), + LongTextManagerColumnCode.SCENARIO.getCode(), + scenarioConverter.getCallScenarioString(), + scenarioConverter.getCallScenarioChecksum())); + + logService.LogSave(LogVO.builder() + .menuAuth(MenuResource.rcpconversationcmmNodemanage) + .serviceGroup(dto.getServiceGroup()) + .actionCode(ActionResource.insert.getName()) + .build()); + + return Math.toIntExact(result.getSeq()); + } + + @Transactional + public int updateCmmNode(ConversationCmmNodeEditReq dto) throws CustomBadRequestException, CustomNotFoundException { + Long seq = dto.getSeq(); + LocalDateTime currentDateTime = LocalDateTime.now(); + String userId = loginService.getUserVo().getUserId(); + + if (dto.getNodeName() == null || dto.getNodeName().isEmpty()) { + throw new CustomBadRequestException("Common Node명을 입력해주세요"); + } + + // diagram checksum 확인 + TbCommonNode commonNode = tbCommonNodeRepo.findBySeqAndUseYn(seq, "Y"). + orElseThrow(() -> new CustomNotFoundException("Common Node를 찾지 못하였습니다.")); + + ScenarioConverter scenarioConverter = new ScenarioConverter(dto.getTextContents()); + scenarioConverter.convertDiagramToCallScenario(); + try { + scenarioConverter.createChecksum(); + } catch (NoSuchAlgorithmException e) { + throw new CustomBadRequestException("Common Node 해시값 생성에 실패하였습니다."); + } + + TbLongtextManager diagram = tbLongtextManagerRepo.findById( + new TbLongtextManagerId(seq, + LongTextManagerTableCode.TB_COMMON_NODE.getCode(), + LongTextManagerColumnCode.DIAGRAM.getCode())) + .orElseThrow(() -> new CustomNotFoundException("다이어그램을 찾지 못하였습니다.")); + + TbLongtextManager scenario = tbLongtextManagerRepo.findById( + new TbLongtextManagerId(seq, + LongTextManagerTableCode.TB_COMMON_NODE.getCode(), + LongTextManagerColumnCode.SCENARIO.getCode())) + .orElseThrow(() -> new CustomNotFoundException("시나리오를 찾지 못하였습니다.")); + + boolean isUpdate = false; + String nodeName = dto.getNodeName(); + String oprMngCode = dto.getCustCode() + "_RCP_" + dto.getServiceGroup(); + + if (!commonNode.getNodeName().equals(nodeName) || !commonNode.getOprMngCode().equals(oprMngCode)) { + // 이름, oprMngCode 변경값이 있는 경우 업데이트 + commonNode.setNodeName(nodeName); + commonNode.setOprMngCode(oprMngCode); + commonNode.setUpdateId(userId); + commonNode.setUpdateDate(currentDateTime); + tbCommonNodeRepo.save(commonNode); + isUpdate = true; + } + + if (diagram.getChecksum().equals(scenarioConverter.getDiagramChecksum()) ) { // 다이어그램 변경 값이 없음 + if (!isUpdate) { + throw new CustomBadRequestException("시나리오 변경 값이 없습니다."); + } + } else { + // 다이어그램, 콜 시나리오 업데이트 + diagram.setChecksum(scenarioConverter.getDiagramChecksum()); + diagram.setTextContents(scenarioConverter.getDiagramString()); + + scenario.setChecksum(scenarioConverter.getCallScenarioChecksum()); + scenario.setTextContents(scenarioConverter.getCallScenarioString()); + + tbLongtextManagerRepo.save(diagram); + tbLongtextManagerRepo.save(scenario); + + // 업데이트 날짜 변경 + commonNode.setUpdateId(userId); + commonNode.setUpdateDate(currentDateTime); + tbCommonNodeRepo.save(commonNode); + } + + logService.LogSave(LogVO.builder() + .menuAuth(MenuResource.rcpconversationcmmNodemanage) + .serviceGroup(dto.getServiceGroup()) + .actionCode(ActionResource.update.getName()) + .build()); + + return 0; + } + + @Transactional + public int deleteCmmNode(HashMap map){ + Long seq = Long.parseLong(String.valueOf(map.get("seq"))); + String serviceGroup = String.valueOf(map.get("serviceGroup")); + log.info("seq -> {} " , seq); + tbCommonNodeRepo.deleteCmmNode(seq); + + logService.LogSave(LogVO.builder() + .menuAuth(MenuResource.rcpconversationcmmNodemanage) + .actionCode(ActionResource.delete.getName()) + .serviceGroup(serviceGroup) + .build()); + return 0; + } + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/service/ConversationScenarioGUINodeEditService.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/service/ConversationScenarioGUINodeEditService.java new file mode 100644 index 0000000..e31d294 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/service/ConversationScenarioGUINodeEditService.java @@ -0,0 +1,53 @@ +package com.icomsys.main_vm.biz.rcp.conversation.service; + +import com.icomsys.main_vm.biz.advice.excep.CustomNotFoundException; +import com.icomsys.main_vm.biz.rcp.conversation.vo.LongtextManagerVO; +import com.icomsys.main_vm.db.jpa.entity.scenario.TbLongtextManager; +import com.icomsys.main_vm.db.jpa.entity.scenario.id.TbLongtextManagerId; +import com.icomsys.main_vm.db.jpa.repo.scenario.TbLongtextManagerRepo; +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; + +/** + * Name : ConversationScenarioGUINodeEditService + * date : 2023-02-03 + * author : Mong + * description : + * =========================================================== + * DATE AUTHOR NOTE + * ----------------------------------------------------------- + * 2023-02-03 Mong 최초 생성 + */ +@Service +@RequiredArgsConstructor +@Slf4j +public class ConversationScenarioGUINodeEditService { + + private final TbLongtextManagerRepo tbLongtextManagerRepo; + + public int insertDev(LongtextManagerVO dto) { + + TbLongtextManager vo = new TbLongtextManager(); + vo.setColumnCode(dto.getColumnCode()); + vo.setRfSeq(dto.getRfSeq()); + vo.setTableCode(dto.getTableCode()); + vo.setTextContents(dto.getTextContents()); + vo.setChecksum("Y"); + tbLongtextManagerRepo.save(vo); + + return 0; + } + + @Transactional(readOnly = true) + public LongtextManagerVO selectDev(TbLongtextManagerId dto) throws CustomNotFoundException { + TbLongtextManager result = tbLongtextManagerRepo.findById(dto) + .orElseThrow(() -> new CustomNotFoundException("불러올 다이어그램 정보를 찾지 못하였습니다.")); + return new LongtextManagerVO().ofTbLongtextManager(result); + } + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/service/ConversationScenarioGUIService.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/service/ConversationScenarioGUIService.java new file mode 100644 index 0000000..ec6432b --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/service/ConversationScenarioGUIService.java @@ -0,0 +1,756 @@ +package com.icomsys.main_vm.biz.rcp.conversation.service; + +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.advice.excep.CustomRuntimeException; +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.service.LoginService; +import com.icomsys.main_vm.biz.common.system.vo.DslDataTableRes; +import com.icomsys.main_vm.biz.rcp.conversation.vo.*; +import com.icomsys.main_vm.biz.rcp.util.ScenarioConverter; +import com.icomsys.main_vm.common.code.code.LongTextManagerColumnCode; +import com.icomsys.main_vm.common.code.code.LongTextManagerTableCode; +import com.icomsys.main_vm.common.code.enumresource.ActionResource; +import com.icomsys.main_vm.common.code.enumresource.MenuResource; +import com.icomsys.main_vm.db.jpa.entity.scenario.*; +import com.icomsys.main_vm.db.jpa.entity.scenario.id.TbLongtextManagerId; +import com.icomsys.main_vm.db.jpa.entity.system.TbBotUser; +import com.icomsys.main_vm.db.jpa.entity.system.TbServiceGrouop; +import com.icomsys.main_vm.db.jpa.repo.scenario.*; +import com.icomsys.main_vm.db.jpa.repo.system.TbBotUserRepo; +import com.icomsys.main_vm.db.jpa.repo.system.TbIcsLogRepo; +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.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + + +import java.security.NoSuchAlgorithmException; +import java.time.LocalDateTime; + +import java.util.Collections; +import java.util.List; + +/** + * Name : ConversationScenarioGUIService date : 2023-01-27 author : Mong description : =========================================================== DATE AUTHOR NOTE + * ----------------------------------------------------------- 2023-01-27 Mong 최초 생성 + */ +@Service +@RequiredArgsConstructor +@Slf4j +public class ConversationScenarioGUIService { + + private final TbLongtextManagerRepo tbLongtextManagerRepo; + private final TbScenarioMasterRepo tbScenarioMasterRepo; + private final TbScenarioReleaseRepo tbScenarioReleaseRepo; + private final TbScenarioHistoryRepo tbScenarioHistoryRepo; + private final TbServiceGrouopRepo tbServiceGrouopRepo; + private final TbBotUserRepo tbBotUserRepo; + private final TbIcsLogRepo tbIcsLogRepo; + private final TbScenarioRelatedIntentRepo tbScenarioRelatedIntentRepo; + + private final LoginService loginService; + private final LogService logService; + + + public int insertDev(LongtextManagerVO dto) { + log.info("dto -> {}", dto); + + TbLongtextManager vo = new TbLongtextManager(); + vo.setColumnCode(dto.getColumnCode()); + vo.setRfSeq(dto.getRfSeq()); + vo.setTableCode(dto.getTableCode()); + vo.setTextContents(dto.getTextContents()); + vo.setChecksum("Y"); + tbLongtextManagerRepo.save(vo); + int result = 1; + return result; + } + + @Transactional(readOnly = true) + public LongtextManagerVO selectDev(TbLongtextManagerId dto) throws CustomNotFoundException { + TbLongtextManager result = tbLongtextManagerRepo.findById(dto) + .orElseThrow(() -> new CustomNotFoundException()); + return new LongtextManagerVO().ofTbLongtextManager(result); + } + + public DslDataTableRes searchScenarioList(ConversationScenarioManagerSearchReq dto){ + QueryResults result = tbScenarioMasterRepo.searchScenarioList(dto); + return new DslDataTableRes(result); + } + + public DslDataTableRes searchScenarioReleaseList(ConversationScenarioManagerSearchReq dto) { + QueryResults result = tbScenarioMasterRepo.searchScenarioReleaseList(dto); + return new DslDataTableRes(result); + } + + @Transactional + public int scenarioRegister(ConversationScenarioMasterVO dto) throws CustomNotFoundException, CustomBadRequestException { + String userId = loginService.getUserVo().getUserId(); + LocalDateTime currentDateTime = LocalDateTime.now(); + String oprMngCode = dto.getCustCode() + "_RCP_" + dto.getServiceGroup(); + + TbServiceGrouop sg = tbServiceGrouopRepo.findByServiceGroupAndCustCode(dto.getServiceGroup(), dto.getCustCode()) + .orElseThrow(() -> new CustomNotFoundException("시나리오 그룹이 없습니다.")); + +// 시나리오 공통을 M 타입으로 등록 관리하도록 정책 변경 +// if(sg.getServiceType().equals("M")){ +// throw new CustomBadRequestException("Master 시나리오 그룹에는 시나리오를 등록할 수 없습니다."); +// } + + if(dto.getCustCode() == null || dto.getCustCode().equals("")){ + throw new CustomBadRequestException("custCode 값이 비었습니다."); + } + + TbScenarioMaster vo = new TbScenarioMaster(); + vo.setOprMngCode(oprMngCode); + vo.setScenarioName(dto.getScenarioName()); + vo.setUseYn("Y"); + vo.setRegistId(userId); + vo.setRegistDate(currentDateTime); + vo.setUpdateId(userId); + vo.setUpdateDate(currentDateTime); + + tbScenarioMasterRepo.save(vo); + + logService.LogSave(LogVO.builder() + .menuAuth(MenuResource.rcpconversationscenariomanage) + .actionCode(ActionResource.insert.getName()) + .registDate(currentDateTime) + .attribute1(Long.toString(vo.getSeq())) + .remark( vo.getScenarioName() + " 시나리오를 등록하였습니다.") + .serviceGroup(dto.getServiceGroup()) + .build()); + return 0; + } + + @Transactional + public int scenarioNameUpdate(ConversationScenarioMasterVO dto) throws CustomNotFoundException, CustomBadRequestException { + String userId = loginService.getUserVo().getUserId(); + LocalDateTime currentDateTime = LocalDateTime.now(); + + if (dto.getScenarioName() == null || dto.getScenarioName().isEmpty()) { + throw new CustomBadRequestException("시나리오 이름이 비었습니다"); + } + + TbScenarioMaster scMaster = tbScenarioMasterRepo.findBySeqAndUseYn(dto.getSeq(), "Y") + .orElseThrow(() -> new CustomNotFoundException("시나리오 정보가 없습니다")); + + scMaster.setScenarioName(dto.getScenarioName()); + scMaster.setUpdateId(userId); + scMaster.setUpdateDate(currentDateTime); + + tbScenarioMasterRepo.save(scMaster); + + logService.LogSave(LogVO.builder() + .menuAuth(MenuResource.rcpconversationscenariomanage) + .actionCode(ActionResource.update.getName()) + .registDate(currentDateTime) + .attribute1(Long.toString(scMaster.getSeq())) + .remark( scMaster.getScenarioName() + " 시나리오명으로 수정하였습니다.") + .serviceGroup(dto.getServiceGroup()) + .build()); + + return 0; + } + + @Transactional + public int scenarioRelease(ConversationScenarioMasterVO dto) throws CustomNotFoundException, CustomBadRequestException { + String userId = loginService.getUserVo().getUserId(); + LocalDateTime currentDateTime = LocalDateTime.now(); + Integer result = 0; + + if(dto.getSeq() == null || dto.getSeq() == -1) { + throw new CustomBadRequestException("시나리오 시퀀스가 잘못 되었습니다."); + } + + TbScenarioMaster scMaster = tbScenarioMasterRepo.findBySeqAndUseYn(dto.getSeq(), "Y") + .orElseThrow(() -> new CustomNotFoundException("시나리오 정보가 없습니다")); + + // 마지막 시나리오 저장값 가져오기 + List scHistory = tbScenarioHistoryRepo.findByMasterSeqAndLastYn(scMaster.getSeq(), "Y"); + if (scHistory.size() == 0 ) { + throw new CustomNotFoundException("마지막 시나리오 저장 버전을 찾을수 없습니다."); + } + + TbLongtextManager lastSaveDiagram = tbLongtextManagerRepo.findById( + new TbLongtextManagerId(scHistory.get(0).getSeq(), + LongTextManagerTableCode.TB_SCENARIO_HISTORY.getCode(), + LongTextManagerColumnCode.DIAGRAM.getCode())) + .orElseThrow(() -> new CustomNotFoundException("마지막 저장 다이어그램 정보를 찾지 못하였습니다.")); + + + ScenarioConverter scenarioConverter = new ScenarioConverter(lastSaveDiagram.getTextContents()); + Long intentSeq = scenarioConverter.getIntentSeq(); + if (intentSeq == -1L) { + throw new CustomBadRequestException("인텐트 노드 설정이 잘못되었습니다."); + } + + // 중복 체크 중복될 경우 Error 처리 + List duplicationIntent = tbScenarioReleaseRepo.findByIntentSeqAndReleaseYn(intentSeq, "Y"); + if (duplicationIntent.size() != 0 && + (duplicationIntent.size() != 1 || !duplicationIntent.get(0).getMasterSeq().equals(scMaster.getSeq()) )) { + + throw new CustomBadRequestException("중복된 인텐트로 시나리오를 배포할 수 없습니다."); + } + + TbLongtextManager lastSaveScenario = tbLongtextManagerRepo.findById( + new TbLongtextManagerId(scHistory.get(0).getSeq(), + LongTextManagerTableCode.TB_SCENARIO_HISTORY.getCode(), + LongTextManagerColumnCode.SCENARIO.getCode())) + .orElseThrow(() -> new CustomNotFoundException("마지막 저장 시나리오 정보를 찾지 못하였습니다.")); + + // 마지막 저장 시나리오 유효성 검사 + scenarioConverter.validationCheckScenario(lastSaveScenario.getTextContents()); + + // Master 릴리즈 정보 있는지 확인 + TbScenarioRelease maxRelease = tbScenarioReleaseRepo.findTopByMasterSeqOrderByVersionDesc(scMaster.getSeq()); + int releaseVersion = 0; + if (maxRelease == null) { + releaseVersion = 1; + } else { + releaseVersion = maxRelease.getVersion() + 1; + } + + // 이전 release N 업데이트 + TbScenarioRelease prevRelease = tbScenarioReleaseRepo.findByMasterSeqAndReleaseYn(scMaster.getSeq(), "Y"); + if (prevRelease != null) { + prevRelease.setReleaseYn("N"); + tbScenarioReleaseRepo.save(prevRelease); + } + + // Release 테이블 저장 + TbScenarioRelease releaseVo = TbScenarioRelease.builder() + .masterSeq(scHistory.get(0).getMasterSeq()) + .releaseYn("Y") + .version(releaseVersion) + .registId(userId) + .registDate(currentDateTime) + .intentSeq(intentSeq).build(); + + tbScenarioReleaseRepo.save(releaseVo); + + // Diagram 입력 + TbLongtextManager releaseDiagramVo = new TbLongtextManager( releaseVo.getSeq(), + LongTextManagerTableCode.TB_SCENARIO_RELEASE.getCode(), + LongTextManagerColumnCode.DIAGRAM.getCode(), + lastSaveDiagram.getTextContents(), + lastSaveDiagram.getChecksum()); + tbLongtextManagerRepo.save(releaseDiagramVo); + + // 콜 시나리오 저장 + TbLongtextManager releaseScenarioVo = new TbLongtextManager( releaseVo.getSeq(), + LongTextManagerTableCode.TB_SCENARIO_RELEASE.getCode(), + LongTextManagerColumnCode.SCENARIO.getCode(), + lastSaveScenario.getTextContents(), + lastSaveScenario.getChecksum()); + tbLongtextManagerRepo.save(releaseScenarioVo); + + // LastYn 모두 N 업데이트 + for (TbScenarioHistory history: scHistory) { + history.setLastYn("N"); + tbScenarioHistoryRepo.save(history); + } + scMaster.setUpdateId(userId); + scMaster.setUpdateDate(currentDateTime); + tbScenarioMasterRepo.save(scMaster); + + // 연관 인텐트에 배포 인텐트가 동일 할 경우 연관인텐트 제거 + List relatedIntents = tbScenarioRelatedIntentRepo.findByScenarioSeqOrderByIntentSeq(scMaster.getSeq()); + for (TbScenarioRelatedIntent intent : relatedIntents) { + if (intent.getIntentSeq().equals(intentSeq)) { + tbScenarioRelatedIntentRepo.delete(intent); + result = 1; // 배포 인텐트에 연관 인텐트가 있을 경우 return 1; + } + } + + logService.LogSave(LogVO.builder() + .menuAuth(MenuResource.rcpconversationscenariomanage) + .actionCode(ActionResource.release.getName()) + .registDate(currentDateTime) + .attribute1(Long.toString(scMaster.getSeq())) // 시나리오 마스터 seq + .attribute2(Long.toString(releaseVo.getSeq())) // 시나리오 release seq + .remark( scMaster.getScenarioName() + " " + String.format("V%03d", releaseVo.getVersion()) + " 버전을 배포하였습니다.") + .serviceGroup(dto.getServiceGroup()) + .build()); + + return result; + } + + @Transactional + public int scenarioRollback(ConversationScenarioMasterVO dto) throws CustomNotFoundException, CustomBadRequestException { + String userId = loginService.getUserVo().getUserId(); + LocalDateTime currentDateTime = LocalDateTime.now(); + Integer result = 0; + + if(dto.getSeq() == null || dto.getSeq() == -1) { + throw new CustomBadRequestException("시나리오 시퀀스가 잘못 되었습니다."); + } + + if(dto.getReleaseSeq() == null || dto.getReleaseSeq() == -1) { + throw new CustomBadRequestException("배포 시나리오 시퀀스가 잘못 되었습니다."); + } + + // 시나리오 마스터 검색 + TbScenarioMaster scMaster = tbScenarioMasterRepo.findBySeqAndUseYn(dto.getSeq(), "Y") + .orElseThrow(() -> new CustomNotFoundException("시나리오 정보가 없습니다")); + + // 시나리오 Release 버전 확인 + TbScenarioRelease prevRelease = tbScenarioReleaseRepo.findByMasterSeqAndReleaseYn(scMaster.getSeq(), "Y"); + if (prevRelease != null) { + prevRelease.setReleaseYn("N"); + tbScenarioReleaseRepo.save(prevRelease); + } + + // 시나리오 롤 백 버전 확인 + TbScenarioRelease rollbackRelease = tbScenarioReleaseRepo.findById(dto.getReleaseSeq()) + .orElseThrow(() -> new CustomNotFoundException("롤백 버전 정보가 없습니다.")); + + rollbackRelease.setReleaseYn("Y"); + rollbackRelease.setRegistDate(currentDateTime); + rollbackRelease.setRegistId(userId); + tbScenarioReleaseRepo.save(rollbackRelease); + + // 시나리오 저장 히스토리 버전 N으로 수정 + List scHistory = tbScenarioHistoryRepo.findByMasterSeqAndLastYn(dto.getSeq(), "Y"); + for (TbScenarioHistory history: scHistory) { + history.setLastYn("N"); + tbScenarioHistoryRepo.save(history); + } + + scMaster.setUpdateId(userId); + scMaster.setUpdateDate(currentDateTime); + tbScenarioMasterRepo.save(scMaster); + + // 연관 인텐트에 롤백 인텐트가 동일 할 경우 연관인텐트 제거 + List relatedIntents = tbScenarioRelatedIntentRepo.findByScenarioSeqOrderByIntentSeq(scMaster.getSeq()); + for (TbScenarioRelatedIntent intent : relatedIntents) { + if (intent.getIntentSeq().equals(rollbackRelease.getIntentSeq())) { + tbScenarioRelatedIntentRepo.delete(intent); + result = 1; // 롤백 인텐트에 연관인텐트가 있을경우 return 1 + } + } + + logService.LogSave(LogVO.builder() + .menuAuth(MenuResource.rcpconversationscenariomanage) + .actionCode(ActionResource.rollback.getName()) + .registDate(currentDateTime) + .attribute1(Long.toString(scMaster.getSeq())) // 시나리오 마스터 seq + .attribute2(Long.toString(rollbackRelease.getSeq())) // 시나리오 release seq + .remark( scMaster.getScenarioName() + " " +String.format("V%03d", rollbackRelease.getVersion()) + " 버전으로 롤백 하였습니다.") + .serviceGroup(dto.getServiceGroup()) + .build()); + + return result; + } + + @Transactional + public int scenarioReload(ConversationScenarioMasterVO dto) throws CustomNotFoundException, CustomBadRequestException { + String userId = loginService.getUserVo().getUserId(); + LocalDateTime currentDateTime = LocalDateTime.now(); + + if(dto.getSeq() == null || dto.getSeq() == -1) { + throw new CustomBadRequestException("시나리오 시퀀스가 잘못 되었습니다."); + } + + if(dto.getReleaseSeq() == null || dto.getReleaseSeq() == -1) { + throw new CustomBadRequestException("배포 시나리오 시퀀스가 잘못 되었습니다."); + } + + // 시나리오 마스터 검색 + TbScenarioMaster scMaster = tbScenarioMasterRepo.findBySeqAndUseYn(dto.getSeq(), "Y") + .orElseThrow(() -> new CustomNotFoundException("시나리오 정보가 없습니다")); + + // 시나리오 마지막 저장 있는지 확인 후 N 변경 + List scHistory = tbScenarioHistoryRepo.findByMasterSeqAndLastYn(scMaster.getSeq(), "Y"); + for (TbScenarioHistory history: scHistory) { + history.setLastYn("N"); + tbScenarioHistoryRepo.save(history); + } + // release 버전 Longtext 읽어오기 + TbScenarioRelease reloadRelease = tbScenarioReleaseRepo.findById(dto.getReleaseSeq()) + .orElseThrow(() -> new CustomNotFoundException("불러올 버전 정보가 없습니다.")); + + // Longtext 마지막 저장 버전 release 버전으로 읽어온 시나리오 불러오기 + TbLongtextManager loadDiagram = tbLongtextManagerRepo.findById( + new TbLongtextManagerId( reloadRelease.getSeq(), + LongTextManagerTableCode.TB_SCENARIO_RELEASE.getCode(), + LongTextManagerColumnCode.DIAGRAM.getCode())) + .orElseThrow(() -> new CustomNotFoundException("불러올 다이어그램 정보를 찾지 못하였습니다.")); + + TbLongtextManager loadScenario = tbLongtextManagerRepo.findById( + new TbLongtextManagerId( reloadRelease.getSeq(), + LongTextManagerTableCode.TB_SCENARIO_RELEASE.getCode(), + LongTextManagerColumnCode.SCENARIO.getCode())) + .orElseThrow(() -> new CustomNotFoundException("불러올 시나리오 정보를 찾지 못하였습니다.")); + + + // 시나리오 관리 불러오기 버전 저장 + TbScenarioHistory history = new TbScenarioHistory(scMaster.getSeq(), "Y", userId, currentDateTime); + tbScenarioHistoryRepo.save(history); + + // 다이어그램 저장 + tbLongtextManagerRepo.save(new TbLongtextManager( + history.getSeq(), + LongTextManagerTableCode.TB_SCENARIO_HISTORY.getCode(), + LongTextManagerColumnCode.DIAGRAM.getCode(), + loadDiagram.getTextContents(), + loadDiagram.getChecksum())); + + // Call 시나리오 저장 + tbLongtextManagerRepo.save(new TbLongtextManager( + history.getSeq(), + LongTextManagerTableCode.TB_SCENARIO_HISTORY.getCode(), + LongTextManagerColumnCode.SCENARIO.getCode(), + loadScenario.getTextContents(), + loadScenario.getChecksum())); + + scMaster.setUpdateId(userId); + scMaster.setUpdateDate(currentDateTime); + tbScenarioMasterRepo.save(scMaster); + + logService.LogSave(LogVO.builder() + .menuAuth(MenuResource.rcpconversationscenariomanage) + .actionCode(ActionResource.update.getName()) + .registDate(currentDateTime) + .attribute1(Long.toString(scMaster.getSeq())) // 시나리오 마스터 seq + .attribute2(Long.toString(history.getSeq())) // 시나리오 history seq + .remark( scMaster.getScenarioName() + " " + String.format("V%03d", reloadRelease.getVersion()) + " 버전을 불러오기 하였습니다.") + .serviceGroup(dto.getServiceGroup()) + .build()); + + return 0; + } + + @Transactional + public int scenarioDelete(ConversationScenarioMasterVO dto) throws CustomNotFoundException, CustomBadRequestException { + String userId = loginService.getUserVo().getUserId(); + LocalDateTime currentDateTime = LocalDateTime.now(); + + if (dto.getSeq() == null || dto.getSeq() == -1) { + throw new CustomBadRequestException("시나리오 시퀀스가 잘못 되었습니다."); + } + + // 시나리오 마스터 검색 + TbScenarioMaster scMaster = tbScenarioMasterRepo.findBySeqAndUseYn(dto.getSeq(), "Y") + .orElseThrow(() -> new CustomNotFoundException("시나리오 정보가 없습니다")); + + scMaster.setUseYn("N"); + scMaster.setUpdateId(userId); + scMaster.setUpdateDate(currentDateTime); + tbScenarioMasterRepo.save(scMaster); + + // 시나리오 릴리즈 Y -> N + TbScenarioRelease scRelease = tbScenarioReleaseRepo.findByMasterSeqAndReleaseYn(scMaster.getSeq(), "Y"); + if (scRelease != null ) { + scRelease.setReleaseYn("N"); + tbScenarioReleaseRepo.save(scRelease); + } + + logService.LogSave(LogVO.builder() + .menuAuth(MenuResource.rcpconversationscenariomanage) + .actionCode(ActionResource.delete.getName()) + .registDate(currentDateTime) + .attribute1(Long.toString(scMaster.getSeq())) // 시나리오 마스터 seq + .remark( scMaster.getScenarioName() + "를 삭제하였습니다.") + .serviceGroup(dto.getServiceGroup()) + .build()); + + return 0; + } + + public ConversationScenarioManagerInfoRes scenarioManagerInfo(Long scenarioSeq) throws CustomNotFoundException { + ConversationScenarioManagerInfoRes result = new ConversationScenarioManagerInfoRes(); + + TbScenarioMaster scMaster = tbScenarioMasterRepo.findBySeqAndUseYn(scenarioSeq, "Y"). + orElseThrow(() -> new CustomNotFoundException("시나리오 정보가 없습니다")); + + result.setSeq(scMaster.getSeq()); + result.setScenarioName(scMaster.getScenarioName()); + + TbScenarioRelease scRelease = tbScenarioReleaseRepo.findByMasterSeqAndReleaseYn(scenarioSeq, "Y"); + if (scRelease != null) { + result.setReleaseVersion(scRelease.getVersion()); + } else { + result.setReleaseVersion(0); + } + + List scHistory = tbScenarioHistoryRepo.findByMasterSeqAndLastYn(scenarioSeq, "Y"); + String userId; + if (scHistory.size() == 0) { + if (scRelease == null) { + result.setModifyType(0); // 생성 + } else { + result.setModifyType(1); // 배포중 + } + result.setLastSaveDateTime(scMaster.getUpdateDate()); + userId = scMaster.getUpdateId(); + } else { + result.setModifyType(2); // 수정중 + result.setLastSaveDateTime(scHistory.get(0).getRegistDate()); + userId = scHistory.get(0).getRegistId(); + } + + TbBotUser updateUser = tbBotUserRepo.findByUserId(userId) + .orElseThrow(() -> new CustomNotFoundException("사용자 정보가 없습니다")); + result.setUpdateName(updateUser.getUserName()); + + return result; + } + + public ConversationScenarioDiagramRes selectScenarioDiagram(ConversationScenarioMasterVO dto) throws CustomNotFoundException, CustomBadRequestException { + if (dto.getSeq() == null || dto.getSeq() == -1) { + throw new CustomBadRequestException("시나리오 시퀀스 번호가 비었습니다."); + } + + Long masterSeq = dto.getSeq(); + ConversationScenarioDiagramRes result = new ConversationScenarioDiagramRes(); + TbScenarioMaster scMaster = tbScenarioMasterRepo.findBySeqAndUseYn(masterSeq, "Y"). + orElseThrow(() -> new CustomNotFoundException("시나리오 정보가 없습니다")); + + result.setMasterSeq(scMaster.getSeq()); + result.setScenarioName(scMaster.getScenarioName()); + + List scHistory = tbScenarioHistoryRepo.findByMasterSeqAndLastYn(masterSeq, "Y"); + // 마지막 저장 다이어그램이 있는지 확인 + if (scHistory.size() != 0) { + TbLongtextManager diagram = tbLongtextManagerRepo.findById( + new TbLongtextManagerId(scHistory.get(0).getSeq(), + LongTextManagerTableCode.TB_SCENARIO_HISTORY.getCode(), + LongTextManagerColumnCode.DIAGRAM.getCode())) + .orElseThrow(() -> new CustomNotFoundException("시나리오 다이어그램 정보를 찾지 못하였습니다.")); + + result.setTextContents(diagram.getTextContents()); + result.setChecksum(diagram.getChecksum()); + } else { // 배포중인 다이어그램 확인 + TbScenarioRelease scRelease = tbScenarioReleaseRepo.findByMasterSeqAndReleaseYn(masterSeq, "Y"); + if(scRelease == null) { // 시나리오 생성 후 처음으로 편집하는 경우 + result.setTextContents(""); + } else { + TbLongtextManager diagram = tbLongtextManagerRepo.findById( + new TbLongtextManagerId(scRelease.getSeq(), + LongTextManagerTableCode.TB_SCENARIO_RELEASE.getCode(), + LongTextManagerColumnCode.DIAGRAM.getCode())) + .orElseThrow(() -> new CustomNotFoundException("시나리오 다이어그램 정보를 찾지 못하였습니다.")); + + result.setTextContents(diagram.getTextContents()); + result.setChecksum(diagram.getChecksum()); + } + } + + return result; + } + + @Transactional + public int saveScenarioDiagram(ConversationScenarioDiagramVO dto) throws CustomBadRequestException, CustomNotFoundException { + String userId = loginService.getUserVo().getUserId(); + LocalDateTime currentDateTime = LocalDateTime.now(); + + if (dto.getMasterSeq() == null || dto.getMasterSeq() == -1) { + throw new CustomBadRequestException("scenario master seq 값이 없습니다"); + } + + TbScenarioMaster scMaster = tbScenarioMasterRepo.findBySeqAndUseYn(dto.getMasterSeq(), "Y"). + orElseThrow(() -> new CustomNotFoundException("시나리오 정보가 없습니다")); + + Long masterSeq = dto.getMasterSeq(); + List lastSave = tbScenarioHistoryRepo.findByMasterSeqAndLastYn(masterSeq, "Y"); + + // 시나리오 변환기 생성 + ScenarioConverter scenarioConverter = new ScenarioConverter(dto.getTextContents()); + try { + scenarioConverter.createDiagramChecksum(); + } catch (NoSuchAlgorithmException e) { + throw new CustomBadRequestException("시나리오 다이어그램 해시값 생성에 실패하였습니다."); + } + + if (lastSave.size() != 0) { // 이전 기록이 있는 경우 저장 + // 체크썸 확인, last N 수정 후 신규 저장 + TbLongtextManager lastDiagram =tbLongtextManagerRepo.findById( + new TbLongtextManagerId(lastSave.get(0).getSeq(), + LongTextManagerTableCode.TB_SCENARIO_HISTORY.getCode(), + LongTextManagerColumnCode.DIAGRAM.getCode())) + .orElseThrow(() -> new CustomNotFoundException("시나리오 다이어그램 정보를 찾지 못하였습니다.")); + + if (lastDiagram.getChecksum().equals(scenarioConverter.getDiagramChecksum())) { // 변경된 값이 없음 + return 1; + } + + // 이전 히스토리 없데이트 + for (TbScenarioHistory element: lastSave) { + element.setLastYn("N"); + tbScenarioHistoryRepo.save(element); + } + } + + scenarioConverter.convertDiagramToCallScenario(); + try { + scenarioConverter.createScenarioChecksum(); + } catch (NoSuchAlgorithmException e) { + throw new CustomBadRequestException("콜 시나리오 해시값 생성에 실패하였습니다."); + } + + TbScenarioHistory history = new TbScenarioHistory(masterSeq, "Y", userId, currentDateTime); + tbScenarioHistoryRepo.save(history); + + // Diagram 저장 + tbLongtextManagerRepo.save(new TbLongtextManager( + history.getSeq(), + LongTextManagerTableCode.TB_SCENARIO_HISTORY.getCode(), + LongTextManagerColumnCode.DIAGRAM.getCode(), + scenarioConverter.getDiagramString(), + scenarioConverter.getDiagramChecksum())); + + // Call Scenario 저장 + tbLongtextManagerRepo.save(new TbLongtextManager( + history.getSeq(), + LongTextManagerTableCode.TB_SCENARIO_HISTORY.getCode(), + LongTextManagerColumnCode.SCENARIO.getCode(), + scenarioConverter.getCallScenarioString(), + scenarioConverter.getCallScenarioChecksum())); + + scMaster.setUpdateId(userId); + scMaster.setUpdateDate(currentDateTime); + tbScenarioMasterRepo.save(scMaster); + + logService.LogSave(LogVO.builder() + .menuAuth(MenuResource.rcpconversationscenariomanage) + .actionCode(ActionResource.update.getName()) + .registDate(currentDateTime) + .attribute1(Long.toString(scMaster.getSeq())) // 시나리오 마스터 seq + .attribute2(Long.toString(history.getSeq())) // 사나리오 history seq + .remark( scMaster.getScenarioName() + " 시나리오를 저장하였습니다.") + .serviceGroup(dto.getServiceGroup()) + .build()); + + return 0; + } + + public LongtextManagerVO selectTestContents( String scenarioMaster) throws CustomBadRequestException, CustomNotFoundException { + Long masterSeq = Long.valueOf(scenarioMaster); + if( masterSeq == null ) { + throw new CustomBadRequestException("시나리오 시퀀스가 잘못되었습니다."); + } + + tbScenarioMasterRepo.findBySeqAndUseYn(masterSeq, "Y"). + orElseThrow(() -> new CustomNotFoundException("시나리오 정보가 없습니다")); + + TbLongtextManager scenario = null; + List scHistory = tbScenarioHistoryRepo.findByMasterSeqAndLastYn(masterSeq, "Y"); + if (scHistory.size() != 0) { + scenario = tbLongtextManagerRepo.findById(new TbLongtextManagerId( scHistory.get(0).getSeq(), + LongTextManagerTableCode.TB_SCENARIO_HISTORY.getCode(), + LongTextManagerColumnCode.SCENARIO.getCode())) + .orElseThrow(() -> new CustomNotFoundException("시나리오 컨텐츠 정보를 찾지 못하였습니다.")); + + // scenario 요효성 검사 + ScenarioConverter scenarioConverter = new ScenarioConverter(); + scenarioConverter.validationCheckScenario(scenario.getTextContents()); + + } else { + TbScenarioRelease scRelease = tbScenarioReleaseRepo.findByMasterSeqAndReleaseYn(masterSeq, "Y"); + if(scRelease == null) { // 시나리오 생성 후 처음으로 편집하는 경우 + throw new CustomBadRequestException("테스트를 진행할 시나리오 정보가 없습니다."); + } else { + scenario = tbLongtextManagerRepo.findById( + new TbLongtextManagerId(scRelease.getSeq(), + LongTextManagerTableCode.TB_SCENARIO_RELEASE.getCode(), + LongTextManagerColumnCode.SCENARIO.getCode())) + .orElseThrow(() -> new CustomNotFoundException("시나리오 컨텐츠 정보를 찾지 못하였습니다.")); + } + } + + return new LongtextManagerVO().ofTbLongtextManager(scenario); + } + + public QueryResults scenarioHistoryLog(ConversationScenarioMasterVO dto) throws CustomBadRequestException { + if (dto.getSeq() == null || dto.getSeq() == -1) { + throw new CustomBadRequestException("scenario seq 값이 없습니다"); + } + + QueryResults logHistory = tbIcsLogRepo.scenarioWorkHistory( + MenuResource.rcpconversationscenariomanage.getName(), + Long.toString(dto.getSeq())); + + // return new DslDataTableRes(logHistory); + return logHistory; + } + + public QueryResults scenarioRelatedIntent( ConversationScenarioMasterVO dto) throws CustomBadRequestException { + if (dto.getSeq() == null || dto.getSeq() == -1) { + throw new CustomBadRequestException("scenario seq 값이 없습니다"); + } + + return tbScenarioRelatedIntentRepo.findRelatedIntentList(dto); + } + + @Transactional + public int scenarioRelatedIntentSave( ConversationScenarioRelatedIntentSaveReq dto) throws CustomBadRequestException, CustomNotFoundException { + String userId = loginService.getUserVo().getUserId(); + LocalDateTime currentDateTime = LocalDateTime.now(); + Integer result = 0; + + if (dto.getScenarioSeq() == null || dto.getScenarioSeq() == -1) { + throw new CustomBadRequestException("scenario seq 값이 없습니다"); + } + + List saveIntents = dto.getCheckIntents(); + List prevIntent = tbScenarioRelatedIntentRepo.findByScenarioSeqOrderByIntentSeq(dto.getScenarioSeq()); + + // 배포된 자기 자신의 Intent는 연관 인텐트로 저장 X + TbScenarioRelease scRelease = tbScenarioReleaseRepo.findByMasterSeqAndReleaseYn(dto.getScenarioSeq(), "Y"); + if(scRelease != null) { + if (saveIntents.contains(Long.valueOf(scRelease.getIntentSeq()))) { + saveIntents.remove(Long.valueOf(scRelease.getIntentSeq())); + result = 1; // 자기자신 연관 인텐트 + } + } + + Collections.sort(saveIntents); + + int i =0, j=0; + while ( i < prevIntent.size() && j < saveIntents.size() ) { + if (prevIntent.get(i).getIntentSeq() == saveIntents.get(j) ) { + i++; j++; + } else if (prevIntent.get(i).getIntentSeq() > saveIntents.get(j) ) { + tbScenarioRelatedIntentRepo.save(new TbScenarioRelatedIntent(dto.getScenarioSeq(), saveIntents.get(j))); + j++; + } else { + tbScenarioRelatedIntentRepo.delete(new TbScenarioRelatedIntent(dto.getScenarioSeq(), prevIntent.get(i).getIntentSeq())); + i++; + } + } + + while (i < prevIntent.size()) { + tbScenarioRelatedIntentRepo.delete(new TbScenarioRelatedIntent(dto.getScenarioSeq(), prevIntent.get(i).getIntentSeq())); + i++; + } + + while (j < saveIntents.size()) { + tbScenarioRelatedIntentRepo.save(new TbScenarioRelatedIntent(dto.getScenarioSeq(),saveIntents.get(j))); + j++; + } + + TbScenarioMaster scMaster = tbScenarioMasterRepo.findBySeqAndUseYn(dto.getScenarioSeq(), "Y"). + orElseThrow(() -> new CustomNotFoundException("시나리오 정보가 없습니다")); + + scMaster.setUpdateId(userId); + scMaster.setUpdateDate(currentDateTime); + tbScenarioMasterRepo.save(scMaster); + + logService.LogSave(LogVO.builder() + .menuAuth(MenuResource.rcpconversationscenariomanage) + .actionCode(ActionResource.update.getName()) + .registDate(currentDateTime) + .attribute1(Long.toString(dto.getScenarioSeq())) // 시나리오 마스터 seq + .remark( scMaster.getScenarioName() + " 시나리오를 저장하였습니다.") + .serviceGroup(dto.getServiceGroup()) + .build()); + + return result; + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/service/ConversationSystemEntityService.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/service/ConversationSystemEntityService.java new file mode 100644 index 0000000..a88b965 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/service/ConversationSystemEntityService.java @@ -0,0 +1,117 @@ +package com.icomsys.main_vm.biz.rcp.conversation.service; + +import com.google.gson.Gson; +import com.google.gson.JsonObject; +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.rcp.conversation.vo.SystemEntityRes; +import com.icomsys.main_vm.common.code.enumresource.ActionResource; +import com.icomsys.main_vm.common.code.enumresource.MenuResource; +import com.icomsys.main_vm.db.jpa.entity.conversation.TbEntityMaster; +import com.icomsys.main_vm.db.jpa.repo.scenario.TbEntityMasterRepo; +import com.icomsys.main_vm.db.mybatis.alias.LoginVO; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.http.HttpMethod; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.servlet.ModelAndView; +import org.springframework.web.servlet.view.json.MappingJackson2JsonView; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +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; + +import static com.icomsys.main_vm.biz.rcp.conversation.nlp.wisenut.util.RestTemplateUtil.callNlpApi; + +@Service +@RequiredArgsConstructor +@Slf4j +public class ConversationSystemEntityService { + private final TbEntityMasterRepo tbEntityMasterRepo; + private final LogService logService; + @Resource + MappingJackson2JsonView ajaxMainView; + + @Value("${feign.url.nlp}") + private String nlpApi; + + @Transactional(readOnly = true) + public List SystemEntityList() { + + return tbEntityMasterRepo.findAll().stream().map(e-> + SystemEntityRes.builder().entityName(e.getEntityName()).build() + ).collect(Collectors.toList()); + } + + public ModelAndView synchronizeEntityList(HttpServletRequest request) { + ModelAndView mv = new ModelAndView(ajaxMainView); + + LoginVO resultVO = (LoginVO) request.getSession().getAttribute("LoginVO"); + String userId = resultVO.getUserId(); + + Gson gson = new Gson(); + List list = null; + List returnList = new ArrayList(); + try { + String path = nlpApi + "/system/entityList"; + JsonObject jsonObject = new JsonObject(); + jsonObject.addProperty("projectId", "0"); + + String body = gson.toJson(jsonObject); + HttpMethod method = HttpMethod.POST; + + // api request + String responseBody = callNlpApi(path, body, method); + responseBody = responseBody.replaceAll("\"", "\\\""); + HashMap eMap = new HashMap(); + eMap = gson.fromJson(responseBody, eMap.getClass()); + Map map = (Map) eMap.get("data"); + list = (List) map.get("systemEntityNameList"); + log.info("list", list); + if (list.size() > 0) { + if (!this.updateEntityList(list, userId)) { + mv.addObject("result", false); + mv.addObject("message", "데이터오류로 실패하였습니다."); + mv.addObject("list", this.SystemEntityList()); + return mv; + } + } + mv.addObject("result", true); + mv.addObject("message", "동기화하였습니다."); + } catch (Exception ex) { + log.error(ex.getMessage()); + mv.addObject("result",false); + mv.addObject("message","연동오류로 실패하였습니다."); + mv.addObject("list", this.SystemEntityList()); + return mv; + } + + mv.addObject("list", this.SystemEntityList()); + return mv; + } + + public boolean updateEntityList(List list, String userId) { + + try { + tbEntityMasterRepo.truncateEntityMaster(); + for (String entity : list) { + TbEntityMaster save = TbEntityMaster.builder() + .entityName(entity) + .registDate(LocalDateTime.now()) + .registId(userId) + .build(); + tbEntityMasterRepo.save(save); + } + } catch (Exception e) { + return false; + } + return true; + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/service/IntentManageService.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/service/IntentManageService.java new file mode 100644 index 0000000..79d339e --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/service/IntentManageService.java @@ -0,0 +1,522 @@ +package com.icomsys.main_vm.biz.rcp.conversation.service; + +import com.google.gson.Gson; +import com.icomsys.main_vm.biz.advice.excep.CustomNotFoundException; +import com.icomsys.main_vm.biz.advice.excep.CustomRuntimeException; +import com.icomsys.main_vm.biz.common.common.service.ExcelService; +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.rcp.conversation.dto.IntentRequestDTO; +import com.icomsys.main_vm.biz.rcp.conversation.dto.TbIntentExampleDto; +import com.icomsys.main_vm.biz.rcp.conversation.nlp.wisenut.service.NlpWisenutIntentService; +import com.icomsys.main_vm.biz.rcp.conversation.nlp.wisenut.vo.NlpWisenutResult; +import com.icomsys.main_vm.biz.rcp.conversation.nlp.wisenut.vo.SentenceListVO; +import com.icomsys.main_vm.biz.rcp.conversation.vo.TbBotCommonCodeVo; +import com.icomsys.main_vm.biz.rcp.conversation.vo.intent.ExcelIntentListVo; +import com.icomsys.main_vm.biz.rcp.conversation.vo.intent.ExcelIntentListVoEx; +import com.icomsys.main_vm.biz.rcp.conversation.vo.intent.IntentSearchVo; +import com.icomsys.main_vm.common.code.enumresource.ActionResource; +import com.icomsys.main_vm.common.code.enumresource.MenuResource; +import com.icomsys.main_vm.db.jpa.repo.system.TbBotCommonCodeRepo; +import com.icomsys.main_vm.db.jpa.repo.system.TbIntentExampleRepo; +import com.icomsys.main_vm.db.jpa.repo.system.TbIntentMasterRepo; +import com.icomsys.main_vm.db.jpa.repo.system.TbServiceGrouopRepo; +import com.icomsys.main_vm.db.mybatis.alias.LoginVO; +import com.icomsys.main_vm.db.mybatis.mapper.IntentManageMapper; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.apache.poi.hssf.usermodel.HSSFRow; +import org.apache.poi.hssf.usermodel.HSSFSheet; +import org.apache.poi.hssf.usermodel.HSSFWorkbook; +import org.apache.poi.ss.usermodel.CellType; +import org.springframework.dao.DuplicateKeyException; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.multipart.MultipartHttpServletRequest; +import org.springframework.web.servlet.ModelAndView; +import org.springframework.web.servlet.view.json.MappingJackson2JsonView; + +import javax.servlet.http.HttpServletRequest; +import java.io.IOException; +import java.util.*; +import java.util.stream.Collectors; + + +@Service +@Slf4j +@RequiredArgsConstructor +public class IntentManageService { + + private final NlpWisenutIntentService nlpWisenutIntentService; + private final HttpServletRequest request; + private final MappingJackson2JsonView ajaxMainView; + private final TbIntentMasterRepo tbIntentMasterRepo; + private final TbBotCommonCodeRepo tbBotCommonCodeRepo; + private final TbIntentExampleRepo tbIntentExampleRepo; + private final IntentManageMapper intentManageMapper; + private final LogService logService; + private final TbServiceGrouopRepo tbServiceGrouopRepo; + private final ExcelService excelService; + + public ModelAndView searchIntent(IntentSearchVo dto) throws CustomNotFoundException { + ModelAndView mv = new ModelAndView(ajaxMainView); + dto.setServiceGroupUpper(tbServiceGrouopRepo.findByServiceGroup(dto.getServiceGroup()).orElseThrow(() -> new CustomNotFoundException()).getServiceGroupUpper()); + mv.addObject("list", tbIntentMasterRepo.selectIntentList(dto)); + return mv; + } + + public ModelAndView searchIntentCategoryList(Map dataMap) throws CustomNotFoundException { + ModelAndView mv = new ModelAndView(ajaxMainView); + HashMap eMap = new HashMap(); + eMap.putAll(dataMap); + +// String oprMngCode = eMap.get("custCode") + "_RCP_" + eMap.get("serviceGroup"); + String oprMngCode = eMap.get("custCode") + "_RCP_" + tbServiceGrouopRepo + .findByServiceGroup(eMap.get("serviceGroup").toString()) + .orElseThrow(() -> new CustomNotFoundException()).getServiceGroupUpper(); + log.info("oprMngCode -> {}", oprMngCode); + List cate = tbBotCommonCodeRepo.findByCustCodeAndMajorCodeAndOprMngCodeOrderByCodeNameAsc + (String.valueOf(eMap.get("custCode")), "INTENT_GROUP", oprMngCode) + .stream().map(e -> e.toDecs()) + .collect(Collectors.toList()); + + mv.addObject("categoryList", cate); + return mv; + } + + public ModelAndView selectIntentExampleList(Map dataMap) { + + ModelAndView mv = new ModelAndView(ajaxMainView); + List list = tbIntentExampleRepo.findByIntentSeqAndUseYn( + Long.parseLong(dataMap.get("intentSeq").toString()), "Y") + .stream().map(e -> e.toTbIntentExampleDto()) + .collect(Collectors.toList()); + + mv.addObject("list", list); + return mv; + } + + public int selectIntentCnt(HashMap eMap) { + return intentManageMapper.selectIntentCnt(eMap); + } + + @Transactional + public ModelAndView updateIntent(IntentRequestDTO dto) { + ModelAndView mv = new ModelAndView(ajaxMainView); + boolean result = true; + String message = "저장되었습니다."; + + try { + LoginVO resultVO = (LoginVO) request.getSession().getAttribute("LoginVO"); + dto.setRegistId(resultVO.getUserId()); + dto.setUpdateId(resultVO.getUserId()); + //tbIntentMasterRepo.updateIntentMaster(dto); + HashMap eMap = dto.toMap(); + + log.info("eMap -> {}", new Gson().toJson(eMap)); + // NLP API + NlpWisenutResult nlpWisenutResult = nlpWisenutIntentService.intentUpdateApi(eMap); + + //String oprMngCode = eMap.get("custCode") + "_RCP_" + eMap.get("serviceGroup"); + if (nlpWisenutResult.getResult()) { + this.updateIntentMaster(eMap); + this.workLogSave(MenuResource.rcpconversationintentmanage, ActionResource.update, String.valueOf(eMap.get("serviceGroup")), "인텐트 수정"); + } else { + log.error(nlpWisenutResult.getReturnMsg() + " : " + nlpWisenutResult.getReturnCode()); + throw new DuplicateKeyException(nlpWisenutResult.getReturnMsg()); + } + } catch (DuplicateKeyException e) { + result = false; + message = e.getMessage(); + } catch (Exception e) { + result = false; + message = "처리도중 오류가 발생했습니다."; + log.error("error", e); + } + mv.addObject("result", result); + mv.addObject("message", message); + return mv; + } + + public void insertIntentMaster(HashMap eMap) { + int cnt = this.selectIntentCnt(eMap); + if (cnt > 0) { + throw new DuplicateKeyException("중복된 인텐트명 입니다."); + } + + // NLP API + String oprMngCode = eMap.get("custCode") + "_RCP_" + eMap.get("serviceGroup"); + eMap.put("oprMngCode", oprMngCode); + NlpWisenutResult nlpWisenutResult = nlpWisenutIntentService.intentInsertApi(eMap); + if (nlpWisenutResult.getResult()) { + eMap.put("mappingId", nlpWisenutResult.getMappingId()); + intentManageMapper.insertIntentMaster(eMap); + this.workLogSave(MenuResource.rcpconversationintentmanage, ActionResource.insert, String.valueOf(eMap.get("serviceGroup")), "인텐트 등록"); + } else { + log.error(nlpWisenutResult.getReturnCode() + " : " + nlpWisenutResult.getReturnMsg()); + throw new DuplicateKeyException(nlpWisenutResult.getReturnMsg()); + } + } + + public void deleteIntentExample_one(HashMap eMap) { + // NLP API + NlpWisenutResult nlpWisenutResult = nlpWisenutIntentService.intentSentenceDeleteApi(eMap); + if (nlpWisenutResult.getResult()) { +// TbIntentExample tbIntentExample = tbIntentExampleRepo.findBySeq(eMap.get("seq")).get(); +// tbIntentExampleRepo.delete(tbIntentExample); + intentManageMapper.deleteIntentExample_one(eMap); + //this.workLogSave(MenuResource.rcpconversationintentmanage, ActionResource.delete, String.valueOf(eMap.get("oprMngCode"))); + logService.LogSave(LogVO.builder() + .menuAuth(MenuResource.valueOf(String.valueOf(eMap.get("menuVal")))) + .actionCode(String.valueOf((ActionResource.delete))) + .serviceGroup(String.valueOf(eMap.get("serviceGroup"))) + .remark("예문 삭제") + .build()); + } else { + log.error(nlpWisenutResult.getReturnMsg() + " : " + nlpWisenutResult.getReturnCode()); + throw new DuplicateKeyException(nlpWisenutResult.getReturnMsg()); + } + } + + public void insertIntentExample(HashMap eMap) { + // NLP API + NlpWisenutResult nlpWisenutResult = nlpWisenutIntentService.intentSentenceInsertApi(eMap); + if (nlpWisenutResult.getResult()) { + eMap.put("mappingId", nlpWisenutResult.getMappingId()); + intentManageMapper.insertIntentExample(eMap); + logService.LogSave(LogVO.builder() + .menuAuth(MenuResource.valueOf(String.valueOf(eMap.get("menuVal")))) + .actionCode(String.valueOf((ActionResource.insert))) + .serviceGroup(String.valueOf(eMap.get("serviceGroup"))) + .remark("예문 등록") + .build()); + } else { + log.error(nlpWisenutResult.getReturnCode() + " : " + nlpWisenutResult.getReturnMsg()); + throw new DuplicateKeyException(nlpWisenutResult.getReturnMsg()); + } + } + + public void updateIntentMaster(HashMap eMap) { + intentManageMapper.updateIntentMaster(eMap); + } + + public void updateDeleteIntentExample(HashMap eMap) { + intentManageMapper.updateDeleteIntentExample(eMap); + } + + public void deleteIntent(HashMap eMap) { + eMap.put("useYn", "N"); + // NLP API + NlpWisenutResult nlpWisenutResult = nlpWisenutIntentService.intentDeleteApi(eMap); + if (nlpWisenutResult.getResult()) { + this.updateIntentMaster(eMap); + this.updateDeleteIntentExample(eMap); + this.workLogSave(MenuResource.rcpconversationintentmanage, ActionResource.delete, String.valueOf(eMap.get("servicegroup")), "인텐트 삭제"); + } else { + log.error(nlpWisenutResult.getReturnMsg() + " : " + nlpWisenutResult.getReturnCode()); + throw new DuplicateKeyException(nlpWisenutResult.getReturnMsg()); + } + } + + public void insertIntent(HashMap eMap) throws DuplicateKeyException { + + this.insertIntentMaster(eMap); + this.insertIntentExample(eMap); + } + + public String insertIntentExcel(MultipartHttpServletRequest request, HashMap eMap) throws Exception { + List list = new ArrayList(); + List exList = new ArrayList(); + MultipartFile file = request.getFile("upFile"); + HSSFWorkbook wb = new HSSFWorkbook(file.getInputStream()); + HSSFSheet sheet = wb.getSheetAt(0); + + // 시트 확인 + String sheetName = sheet.getSheetName(); + if (!StringUtils.equals("data", sheetName)) { + throw new CustomRuntimeException("엑셀 양식이 잘못되었습니다."); + } + + + String oprMngCode = (String) eMap.get("oprMngCode"); + String custCode = (String) eMap.get("custCode"); + String registId = (String) eMap.get("registId"); + String updateId = (String) eMap.get("updateId"); + String serviceGroup = (String) eMap.get("serviceGroup"); + + /** + * - 인텐트 1 : N 인텐트 예문 관계라 똑같은 목록을 두번 반복(중첩)해서 리스트를 읽음. + * - 첫번째 반복은 인텐트 명, 인텐트 분류 데이터를 얻기 위함. + * - 두번째 반복은 해당 인텐트의 예문 목록을 얻기 위함. + * + * 1. 인텐트가 중복이 아닌 경우 + * - 인텐트 명, 인텐트 분류, 인텐트 예문 목록 저장 + * - 해당 인텐트의 예문 목록을 두번째 반복문으로 구한 후 목록 저장 + * + * 2. 인텐트가 중복인 경우 + * - 로직 없음. + * - 기존 인텐트와의 중복성 검사 등록 시 처리. + * + * 현재 최종 데이터의 형태 + * [ + * { + * intentName: "인텐트 명", + * category: "인텐트 분류", + * exampleList: [ + * {exampleText: "예문1"}, {exampleText: "예문2"} + * ] + * }, + * { + * intentName: "인텐트 명2", + * category: "인텐트 분류2", + * exampleList: [ + * {exampleText: "예문1"}, {exampleText: "예문2"} + * ] + * }, + * ] + * + * 데이터 가공 후 각각의 Map으로 인텐트 저장. + * 엑셀 입력 시 분류는CODE_DESC 값을 입력, 저장시엔 MINOR_CODE 값을 입력해야 하기에 category code를 가져오는 코드 추가. + */ + + String beforeIntentName = new String(); + for (int i = 1; i < sheet.getPhysicalNumberOfRows(); i++) { + HSSFRow row = sheet.getRow(i); + if (row == null) continue; + + // 인서트용 데이터 + HashMap tmp = new HashMap(); + + List exampleList = new ArrayList<>(); + + + String cellVal; + // 인텐트 명 + if (row.getCell(0) != null) { + row.getCell(0).setCellType(CellType.STRING); + cellVal = row.getCell(0).getStringCellValue(); + + if (!StringUtils.equals(beforeIntentName, cellVal)) { + tmp.put("intentName", cellVal); + + // 고정데이터 + tmp.put("oprMngCode", oprMngCode); + tmp.put("custCode", custCode); + tmp.put("registId", registId); + tmp.put("updateId", updateId); + tmp.put("serviceGroup", serviceGroup); + + // 예문 목록 추출 + for (int j = 1; j < sheet.getPhysicalNumberOfRows(); j++) { + HSSFRow exRow = sheet.getRow(j); + String exCellVal; + + // 해당되는 인텐트의 예문을 찾기 위함. + if (exRow.getCell(0) == null || row.getCell(0).getStringCellValue().equals("")) { + continue; + } + exRow.getCell(0).setCellType(CellType.STRING); + String exIntentName = exRow.getCell(0).getStringCellValue(); + if (StringUtils.equals(cellVal, exIntentName)) + // 예문 + if (exRow.getCell(1) != null) { + exRow.getCell(1).setCellType(CellType.STRING); + exCellVal = exRow.getCell(1).getStringCellValue(); + + Iterator iter = Arrays.stream(exCellVal.split(",")).iterator(); + + while (iter.hasNext()) { + IntentRequestDTO dto = new IntentRequestDTO(); + dto.setExampleText(iter.next()); + exampleList.add(dto); + } + +// IntentRequestDTO dto = new IntentRequestDTO(); +// dto.setExampleText(exCellVal); +// exampleList.add(dto); + +// IntentRequestDTO dto = new IntentRequestDTO(); +// dto.setExampleText(exCellVal); +// exampleList.add(dto); + + +// XSSFCell cell = row.getCell(1); +// String exampleList = cell.getStringCellValue(); +// +// eMap.put("exampleList", exampleList.replaceAll("\"", "")); +// String[] list = exampleList.replaceAll(", ", ",").split(","); + } + } + + if (exampleList.size() > 200) { + throw new CustomRuntimeException("예문 제한을 초과했습니다."); + } + + // 예문 목록 저장 + tmp.put("exampleList", exampleList); + + // 인텐트 명 구분용 + beforeIntentName = cellVal; + + log.info(String.valueOf(row.getCell(2))); + // 분류 저장 + if (row.getCell(2) == null || row.getCell(2).getStringCellValue().equals("")) { + continue; + } + + row.getCell(2).setCellType(CellType.STRING); + cellVal = row.getCell(2).getStringCellValue(); + tmp.put("category", cellVal); + + list.add(tmp); + } + } + } + + if (list.size() > 50) { + throw new CustomRuntimeException("인텐트 제한을 초과했습니다."); + } + + // 인텐트 등록 + for (HashMap em : list) { + HashMap categoryMap = intentManageMapper.selectIntentCategoryCode(em); + if (categoryMap == null || StringUtils.isBlank((String) categoryMap.get("minorCode"))) { + throw new CustomRuntimeException(StringUtils.join("[", em.get("category"), "]", "항목은 없는 인텐트 분류입니다.")); + } + try { + em.put("oprMngCode", oprMngCode); + em.put("category", categoryMap.get("minorCode")); + em.put("menuVal", "rcpconversationintentmanage"); +// this.insertIntent(em); + Long id = this.insertIntentMasterExcel(em); + ArrayList exampleList = (ArrayList) em.get("exampleList"); + if (!exampleList.isEmpty()) { + for (IntentRequestDTO intentRequestDTO : exampleList) { + HashMap example = new HashMap<>(); + long soeId = 12345678; // soeID + example.put("intentName",em.get("intentName")); + example.put("intentId", id); + example.put("soeId", soeId); + example.put("sentence", intentRequestDTO.getExampleText()); + exList.add(example); + } + } + } catch (DuplicateKeyException e) { + throw new CustomRuntimeException(StringUtils.join("[", em.get("intentName"), "]", "는 중복된 인텐트 명입니다.")); + } + } + eMap.put("sentenceList",exList); + return this.insertIntentExampleAll(eMap); + } + + private Long insertIntentMasterExcel(HashMap eMap) { + int cnt = this.selectIntentCnt(eMap); + if (cnt > 0) { + long id = intentManageMapper.selectIntentMappingId(eMap); + return id; + } else { + // NLP API + String oprMngCode = eMap.get("custCode") + "_RCP_" + eMap.get("serviceGroup"); + eMap.put("oprMngCode", oprMngCode); + NlpWisenutResult nlpWisenutResult = nlpWisenutIntentService.intentInsertApi(eMap); + if (nlpWisenutResult.getResult()) { + eMap.put("mappingId",nlpWisenutResult.getMappingId()); + intentManageMapper.insertIntentMaster(eMap); +// this.workLogSave(MenuResource.rcpconversationintentmanage, ActionResource.insert, String.valueOf(eMap.get("serviceGroup")), "인텐트 등록"); + return nlpWisenutResult.getMappingId(); + } else if (nlpWisenutResult.getReturnCode().equals("002")) { + log.error(nlpWisenutResult.getReturnCode() + " : " + nlpWisenutResult.getReturnMsg()); + throw new DuplicateKeyException(StringUtils.join("[", eMap.get("intentName"), "]", "는 중복된 인텐트 명입니다.")); + } else { + log.error(nlpWisenutResult.getReturnCode() + " : " + nlpWisenutResult.getReturnMsg()); + throw new DuplicateKeyException(StringUtils.join("[", eMap.get("intentName"), "]", "인텐트 : ", nlpWisenutResult.getReturnMsg())); + } + } + } + + + public String insertIntentExampleAll(HashMap eMap) { + + int successCount = 0; + int dupCount = 0; + int failCount = 0; + // NLP API + NlpWisenutResult nlpWisenutResult = nlpWisenutIntentService.intentSentenceInsertAllApi(eMap); + if (nlpWisenutResult.getResult()) { + for (SentenceListVO sentenceList : nlpWisenutResult.getSentenceList()) { + if (sentenceList.getReturnCode().equals("000")) { + HashMap iMap = new HashMap<>(); + String intentName = sentenceList.getIntentName(); + iMap.put("intentName", intentName); + iMap.put("oprMngCode", eMap.get("oprMngCode")); + int seq = intentManageMapper.selectIntentSeq(iMap); + + iMap.put("intentSeq", seq); + iMap.put("mappingId", sentenceList.getSentenceId()); + iMap.put("registId",eMap.get("registId")); + + List exampleList = new ArrayList<>(); + HashMap tMap = new HashMap<>(); + tMap.put("exampleText",sentenceList.getSentence()); + exampleList.add(tMap); + iMap.put("exampleList",exampleList); + + intentManageMapper.insertIntentExample(iMap); + successCount++; + } else if (sentenceList.getReturnCode().equals("002")) { + dupCount++; + } else { + failCount++; + } + } +// logService.LogSave(LogVO.builder() +// .menuAuth(MenuResource.valueOf(String.valueOf(eMap.get("menuVal")))) +// .actionCode(String.valueOf((ActionResource.insert))) +// .serviceGroup(String.valueOf(eMap.get("serviceGroup"))) +// .remark("예문 등록") +// .build()); + } else { + log.error(nlpWisenutResult.getReturnCode() + " : " + nlpWisenutResult.getReturnMsg()); + throw new DuplicateKeyException(nlpWisenutResult.getReturnMsg()); + } + + if (successCount == 0) { + throw new CustomRuntimeException(StringUtils.join("업로드에 실패했습니다.(중복 : " + dupCount + "건 실패 : " + failCount + "건)")); + } + + return "저장되었습니다. (성공 : " + successCount + "건 중복 : " + dupCount +"건 실패 : " + failCount + "건)"; + } + + public void downloadExcel(IntentSearchVo dto) throws IOException, CustomNotFoundException { + + + dto.setServiceGroupUpper(tbServiceGrouopRepo.findByServiceGroup(dto.getServiceGroup()).orElseThrow(() -> new CustomNotFoundException()).getServiceGroupUpper()); +// List list = tbIntentMasterRepo.excelIntentList(dto); + + List exceldata = tbIntentMasterRepo.excelIntentList(dto).stream().map(e -> + e.toEx(tbIntentExampleRepo.findByIntentSeqAndUseYn(e.getSeq(), "Y") + .stream().map(f -> f.getExampleText()) + .collect(Collectors.joining(",")) + )) + .collect(Collectors.toList()); + List colName = new ArrayList<>(); + + colName.add("인텐트 명"); + colName.add("예문"); + colName.add("분류"); + excelService.ExcelDownload("excel_intent", exceldata, colName); + workLogSave(MenuResource.rcpconversationintentmanage, ActionResource.download, dto.getServiceGroup(), "엑셀 다운로드"); + } + + public void workLogSave(MenuResource menuAuth, ActionResource actionCode, String serviceCode, String remark) { + logService.LogSave(LogVO.builder() + .menuAuth(menuAuth) + .actionCode(String.valueOf((actionCode))) + .serviceGroup(serviceCode) + .remark(remark) + .build()); + } + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/service/NlpSettingService.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/service/NlpSettingService.java new file mode 100644 index 0000000..c83c7e4 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/service/NlpSettingService.java @@ -0,0 +1,157 @@ +package com.icomsys.main_vm.biz.rcp.conversation.service; + +import com.google.gson.Gson; +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.rcp.conversation.nlp.wisenut.service.NlpWisenutProjectService; +import com.icomsys.main_vm.biz.rcp.conversation.nlp.wisenut.service.NlpWisenutService; +import com.icomsys.main_vm.biz.rcp.conversation.nlp.wisenut.vo.NlpWisenutResult; +import com.icomsys.main_vm.biz.rcp.conversation.vo.ProjectSettingVO; +import com.icomsys.main_vm.biz.rcp.conversation.vo.SelectSimilarityCriteriaVO; +import com.icomsys.main_vm.common.code.enumresource.ActionResource; +import com.icomsys.main_vm.common.code.enumresource.MenuResource; +import com.icomsys.main_vm.db.jpa.repo.conversation.TbProjectSettingRepo; +import com.icomsys.main_vm.db.mybatis.alias.LoginVO; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import org.springframework.web.servlet.ModelAndView; +import org.springframework.web.servlet.view.json.MappingJackson2JsonView; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.time.LocalDateTime; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@Service +@RequiredArgsConstructor +@Slf4j +public class NlpSettingService { + + @Resource(name = "nlpWisenutService") + private NlpWisenutService nlpAPIService; + + private final LogService logService; + private final HttpServletRequest request; + private final HttpServletResponse response; + private final MappingJackson2JsonView ajaxMainView; + private final TbProjectSettingRepo tbProjectSettingRepo; + private final NlpWisenutProjectService nlpWisenutProjectService; + + public ModelAndView similarityCriteria(Map dataMap) { + log.info("similarityCriteria param - {}", new Gson().toJson(dataMap)); + ModelAndView mv = new ModelAndView(ajaxMainView); + String oprMngCode = dataMap.get("custCode") + "_RCP_" + dataMap.get("serviceGroup") == null ? null : dataMap.get("custCode") + "_RCP_" + dataMap.get("serviceGroup"); + List nList = tbProjectSettingRepo.selectSimilarityCriteria(oprMngCode); + + mv.addObject("nMap", nList); + + return mv; + } + + public ModelAndView updateUser(Map dataMap) { + LoginVO resultVO = (LoginVO) request.getSession().getAttribute("LoginVO"); + + ProjectSettingVO vo = new ProjectSettingVO(); + + String similarityCriteria = dataMap.get("similarityCriteria") == null ? null : dataMap.get("similarityCriteria"); + String classCriteria = dataMap.get("classCriteria") == null ? null : dataMap.get("classCriteria"); + String classResultCriteria = dataMap.get("classResultCriteria") == null ? null : dataMap.get("classResultCriteria"); + String fallbackMsg = dataMap.get("fallbackMsg") == null ? null : dataMap.get("fallbackMsg"); + String greetingMsg = dataMap.get("greetingMsg") == null ? null : dataMap.get("greetingMsg"); + String oprMngCode = dataMap.get("custCode") + "_RCP_" + dataMap.get("serviceCode") == null ? null : dataMap.get("custCode") + "_RCP_" + dataMap.get("serviceCode"); + String updateId = resultVO.getUserId(); + + vo.setOprMngCode(oprMngCode); + vo.setSimilarityCriteria(Double.parseDouble(similarityCriteria));; + vo.setClassCriteria(Double.parseDouble(classCriteria)); + vo.setClassResultCriteria(Double.parseDouble(classResultCriteria)); + vo.setFallbackMsg(fallbackMsg); + vo.setGreetingMsg(greetingMsg); + vo.setUpdateId(updateId); + vo.setUpdateDate(LocalDateTime.now()); + +// tbProjectSettingRepo.updateServiceInfo(vo); +// +// HashMap map = new HashMap<>(); +// map.put("resultCode", "success.common.update"); +// map.put("resultMsg", "정상적으로 저장되었습니다."); +// +// ModelAndView mv = new ModelAndView(ajaxMainView); +// mv.addObject("nMap", map); +// +// return mv; + ModelAndView mv = new ModelAndView(ajaxMainView); + HashMap eMap = new HashMap(); + eMap.putAll(dataMap); + eMap.put("oprMngCode",oprMngCode); + + NlpWisenutResult nlpWisenutResult = nlpWisenutProjectService.projectUpdateApi(eMap); + HashMap map = new HashMap<>(); + + if (nlpWisenutResult.getResult()) { + tbProjectSettingRepo.updateServiceInfo(vo); + + map.put("resultCode", "success.common.update"); + map.put("resultMsg", "정상적으로 저장되었습니다."); + } else { + log.error(nlpWisenutResult.getReturnCode() + " : " + nlpWisenutResult.getReturnMsg()); + map.put("resultCode", "fail.common.update"); + map.put("resultMsg", "실패하였습니다."); + } + mv.addObject("nMap", map); + return mv; + } + + public ModelAndView trainingStart(String oprMngCode) { + ModelAndView mv = new ModelAndView(ajaxMainView); + NlpWisenutResult nlpWisenutResult = new NlpWisenutResult(); + try { + nlpWisenutResult = nlpAPIService.trainingStartApi(oprMngCode); + this.workLogSave(MenuResource.rcpoprmanagenlpSettingmanage, ActionResource.learn, oprMngCode.split("_")[2]); + if (nlpWisenutResult.getResult()) { + + } else { + log.error(nlpWisenutResult.getReturnCode() + " : " + nlpWisenutResult.getReturnMsg()); + } + + } catch(Exception e) { + log.error("error", e); + nlpWisenutResult.setReturnCode("-999"); + nlpWisenutResult.setReturnMsg("API 호출 오류"); + } + mv.addObject("result", nlpWisenutResult); + return mv; + } + + public ModelAndView trainingApply(String oprMngCode) { + ModelAndView mv = new ModelAndView(ajaxMainView); + NlpWisenutResult nlpWisenutResult = new NlpWisenutResult(); + try { + nlpWisenutResult = nlpAPIService.trainingApplyApi(oprMngCode); + this.workLogSave(MenuResource.rcpoprmanagenlpSettingmanage, ActionResource.reflect, oprMngCode.split("_")[2]); + if (nlpWisenutResult.getResult()) { + + } else { + log.error(nlpWisenutResult.getReturnCode() + " : " + nlpWisenutResult.getReturnMsg()); + } + } catch(Exception e) { + log.error("error", e); + nlpWisenutResult.setReturnCode("-999"); + nlpWisenutResult.setReturnMsg("API 호출 오류"); + } + mv.addObject("result", nlpWisenutResult); + return mv; + } + + public void workLogSave(MenuResource menuAuth, ActionResource actionCode, String serviceCode) { + logService.LogSave(LogVO.builder() + .menuAuth(menuAuth) + .actionCode(String.valueOf((actionCode))) + .serviceGroup(serviceCode) + .build()); + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/service/SynonymManageService.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/service/SynonymManageService.java new file mode 100644 index 0000000..dbfd356 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/service/SynonymManageService.java @@ -0,0 +1,350 @@ + +package com.icomsys.main_vm.biz.rcp.conversation.service; + + +import com.icomsys.main_vm.biz.common.common.service.ExcelService; +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.rcp.conversation.nlp.wisenut.service.NlpWisenutEntityService; +import com.icomsys.main_vm.biz.rcp.conversation.nlp.wisenut.vo.NlpWisenutResult; +import com.icomsys.main_vm.biz.rcp.conversation.vo.SynonymWordListVo; +import com.icomsys.main_vm.biz.rcp.conversation.vo.synonym.SelectSynonymList2Vo; +import com.icomsys.main_vm.biz.rcp.conversation.vo.synonym.SelectSynonymListVo; +import com.icomsys.main_vm.common.code.enumresource.ActionResource; +import com.icomsys.main_vm.common.code.enumresource.MenuResource; +import com.icomsys.main_vm.db.jpa.entity.conversation.TbSynonymMaster; +import com.icomsys.main_vm.db.jpa.entity.conversation.TbSynonymWord; +import com.icomsys.main_vm.db.jpa.repo.system.TbSynonymMasterRepo; +import com.icomsys.main_vm.db.jpa.repo.system.TbSynonymWordRepo; +import com.icomsys.main_vm.db.mybatis.alias.LoginVO; +import com.icomsys.main_vm.db.mybatis.mapper.SynonymManageMapper; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.json.simple.JSONArray; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.dao.DuplicateKeyException; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.servlet.ModelAndView; +import org.springframework.web.servlet.view.json.MappingJackson2JsonView; + +import javax.servlet.http.HttpServletRequest; +import java.io.IOException; +import java.math.BigDecimal; +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 +@Slf4j +@RequiredArgsConstructor +public class SynonymManageService { + + private final HttpServletRequest request; + + private final MappingJackson2JsonView ajaxMainView; + private final NlpWisenutEntityService nlpWisenutEntityService; + @Autowired + private SynonymManageMapper synonymManageMapper; + @Autowired + private TbSynonymMasterRepo tbSynonymMasterRepo; + @Autowired + private TbSynonymWordRepo tbSynonymWordRepo; + private final LogService logService; + private final ExcelService excelService; + public ModelAndView synonymList(Map dataMap) { + ModelAndView mv = new ModelAndView(ajaxMainView); + String oprMngCode = dataMap.get("custCode") + "_RCP_" + dataMap.get("serviceGroup") == null ? null : dataMap.get("custCode") + "_RCP_" + dataMap.get("serviceGroup"); + String repWord = dataMap.get("repWord") == null ? null : dataMap.get("repWord"); + + List list = tbSynonymMasterRepo.selectSynonymList(oprMngCode, repWord).stream().map(e -> + e.toSelect(tbSynonymWordRepo.findByMasterSeqAndUseYn(e.getSeq(), "Y") + .stream().map(f -> f.getSynonymWord()) + .collect(Collectors.joining(",")), + tbSynonymWordRepo.findByMasterSeqAndUseYn(e.getSeq(), "Y") + .stream().map(f -> f.getSeq().toString()) + .collect(Collectors.joining(",")) + )) + .collect(Collectors.toList()); + mv.addObject("list", list); + + return mv; + } + + public int deleteSynonym(HashMap eMap) { + + NlpWisenutResult nlpWisenutResult = nlpWisenutEntityService.entityDeleteApi(eMap); + if (nlpWisenutResult.getResult()) { + tbSynonymWordRepo.deleteSynonymWord(eMap); + // 작업이력 저장 + this.workLogSave(MenuResource.rcpconversationsynonymmanage, ActionResource.delete, String.valueOf(eMap.get("serviceGroup")), "리스트 삭제"); +// synonymManageMapper.deleteSynonymWord(eMap); + return tbSynonymMasterRepo.deleteSynonyms(eMap); +// return synonymManageMapper.deleteSynonym(eMap); + } else { + log.error(nlpWisenutResult.getReturnCode() + " : " + nlpWisenutResult.getReturnMsg()); + return 0; + } + } + + @Transactional + public int dupCheck(HashMap eMap) { + + LoginVO resultVO = (LoginVO) request.getSession().getAttribute("LoginVO"); + + boolean nlpApiInsert; + int returnSeq = -1; + + NlpWisenutResult nlpWisenutResult = new NlpWisenutResult(); + +// int dupIndivWord = synonymManageMapper.dupIndivWord(eMap); + Long dupIndivWord = tbSynonymMasterRepo.dupIndivWord(eMap); + if (dupIndivWord > 0) { + throw new DuplicateKeyException("중복된 개체어입니다."); + } + + //int dupRepWord = synonymManageMapper.dupRepWord(eMap); + Long dupRepWord = tbSynonymMasterRepo.dupRepWord(eMap); + if (dupRepWord > 0) { + throw new DuplicateKeyException("중복된 대표어입니다."); + } + + //Integer seq = synonymManageMapper.selectSynonymMaster(eMap); + Long seq = tbSynonymMasterRepo.selectSynonymMaster(eMap); + if (seq == null) { + eMap.put("seq", ""); + } else { + eMap.put("seq", seq); + } + + nlpApiInsert = StringUtils.isEmpty(eMap.get("seq").toString()); + if (nlpApiInsert) { + // NLP API + nlpWisenutResult = nlpWisenutEntityService.entityInsertApi(eMap); + } else { + // NLP API + if (tbSynonymMasterRepo.dupRepWordN(eMap) > 0) { + nlpWisenutResult = nlpWisenutEntityService.entityInsertApi(eMap); + } else { + nlpWisenutResult = nlpWisenutEntityService.entityUpdateApi(eMap); + } + } + + // NLP API + if (nlpWisenutResult.getResult()) { + if (nlpApiInsert) { + eMap.put("mappingId", nlpWisenutResult.getMappingId()); + } + //this.insertSynonymMaster(eMap); + if (tbSynonymMasterRepo.existsBySeq(seq)){ + + tbSynonymMasterRepo.updateSynonymMaster(eMap); + /*findBySeq(seq).get() + .UpdateSynonymMaster(eMap);*/ + + /*save(new TbSynonymMaster().builder() + .idivWord(eMap.get("idivWord").toString()) + .repWord(eMap.get("repWord").toString()) + .useYn("Y") + .updateId(resultVO.getUserId()) + .updateDate(LocalDateTime.now()) + .build());*/ + } + else { + BigDecimal decimalId = new BigDecimal(nlpWisenutResult.getMappingId()); + + tbSynonymMasterRepo.save(TbSynonymMaster.builder() + .oprMngCode(eMap.get("custCode") + "_RCP_" + eMap.get("serviceGroup")) + .idivWord(eMap.get("idivWord").toString()) + .repWord(eMap.get("repWord").toString()) + .ifMappingId(decimalId.longValue()) + .useYn("Y") + .registId(resultVO.getUserId()) + .registDate(LocalDateTime.now()) + .updateId(resultVO.getUserId()) + .updateDate(LocalDateTime.now()) + .build()); + this.workLogSave(MenuResource.rcpconversationsynonymmanage, ActionResource.insert, String.valueOf(eMap.get("serviceGroup")), "리스트 등록"); + } + //returnSeq = synonymManageMapper.selectSynonymMaster(eMap); + returnSeq = Math.toIntExact(tbSynonymMasterRepo.selectSynonymMaster(eMap)); + JSONArray arr = (JSONArray) eMap.get("list"); + for (int i = 0; i < arr.size(); i++) { + + eMap.put("synonymWord", arr.get(i)); + + //int dupSynonymY = synonymManageMapper.dupSynonymY(eMap); + Long dupSynonymY = tbSynonymMasterRepo.dupSynonymY(eMap); + + if (dupSynonymY > 0) { + throw new DuplicateKeyException("중복된 동의어입니다."); + } + + //int dupSynonymN = synonymManageMapper.dupSynonymN(eMap); + Long dupSynonymN = tbSynonymMasterRepo.dupSynonymN(eMap); + if (dupSynonymN > 0) { + this.updateSynonymWord(eMap); + //tbSynonymWordRepo.updateSynonymWord(eMap); + } else { + //this.insertSynonymWord(eMap); + List SynonymWordInsert = new ArrayList<>(); + for (SynonymWordListVo e : tbSynonymWordRepo.insertSynonymWord(eMap)) { + + SynonymWordInsert.add(TbSynonymWord.builder() + .masterSeq(e.getSeq()) + .oprMngCode(eMap.get("custCode") + "_RCP_" + eMap.get("serviceGroup")) + .synonymWord(eMap.get("synonymWord").toString()) + .useYn("Y") + .registId(resultVO.getUserId()) + .registDate(LocalDateTime.now()) + .updateId(resultVO.getUserId()) + .updateDate(LocalDateTime.now()) + .build()); + tbSynonymWordRepo.saveAll(SynonymWordInsert); + + logService.LogSave(LogVO.builder() + .menuAuth(MenuResource.rcpconversationsynonymmanage) + .actionCode(String.valueOf((ActionResource.insert))) + .serviceGroup(String.valueOf(eMap.get("serviceGroup"))) + .remark("동의어 단일 등록") + .build()); + } + } + } + + // NLP API + } else { + log.error(nlpWisenutResult.getReturnCode() + " : " + nlpWisenutResult.getReturnMsg()); + throw new DuplicateKeyException(nlpWisenutResult.getReturnMsg()); + } + return returnSeq; + } + + public void uploadDupCheck (HashMap eMap) { + + boolean nlpApiInsert = true; + NlpWisenutResult nlpWisenutResult = new NlpWisenutResult(); + + int dupIndivWord = synonymManageMapper.dupIndivWord(eMap); + if (dupIndivWord > 0) { + throw new DuplicateKeyException("중복된 개체어입니다."); + } + int dupRepWord = synonymManageMapper.dupRepWord(eMap); + if (dupRepWord > 0) { + throw new DuplicateKeyException("중복된 대표어입니다."); + } + + Integer seq = synonymManageMapper.selectSynonymMaster(eMap); + + if (eMap.get("seq") != null) { + nlpApiInsert = StringUtils.isEmpty(eMap.get("seq").toString()); + } + + if (seq == null) { + eMap.put("seq", ""); + } else { + eMap.put("seq", seq); + } + + if (nlpApiInsert) { + // NLP API + nlpWisenutResult = nlpWisenutEntityService.entityInsertApi(eMap); + } else { + // NLP API + nlpWisenutResult = nlpWisenutEntityService.entityUpdateApi(eMap); + } + if (nlpWisenutResult.getResult()) { + if (dupRepWord <= 1 && dupIndivWord <= 1) { + if (nlpApiInsert) { + eMap.put("mappingId", nlpWisenutResult.getMappingId()); + } + this.insertSynonymMaster(eMap); + } + + + System.out.println("***************************************"); + String[] list = (String[]) eMap.get("list"); + for (String s : list) { + eMap.put("synonymWord", s); + + int dupSynonymY = synonymManageMapper.dupSynonymY(eMap); + + if (dupSynonymY > 0) { + throw new DuplicateKeyException("중복된 동의어입니다."); + } + if (dupSynonymY <= 1) { + int dupSynonymN = synonymManageMapper.dupSynonymN(eMap); + if (dupSynonymN > 0) { + this.updateSynonymWord(eMap); + } else { + this.insertSynonymWord(eMap); + } + } + } + } else { + log.error(nlpWisenutResult.getReturnCode() + " : " + nlpWisenutResult.getReturnMsg()); + throw new DuplicateKeyException(nlpWisenutResult.getReturnMsg()); + } + } + + private int insertSynonymMaster(HashMap eMap) { + return synonymManageMapper.insertSynonymMaster(eMap); + } + + private void insertSynonymWord(HashMap eMap) { + synonymManageMapper.insertSynonymWord(eMap); + } + + private void updateSynonymWord(HashMap eMap) { + synonymManageMapper.updateSynonymWord(eMap); + } + + public int saveSynonymList(HashMap eMap) { + + logService.LogSave(LogVO.builder() + .menuAuth(MenuResource.rcpconversationsynonymmanage) + .actionCode(String.valueOf((ActionResource.delete))) + .serviceGroup(String.valueOf(eMap.get("serviceGroup"))) + .remark("동의어 단일 삭제") + .build()); + return synonymManageMapper.saveSynonymList(eMap); + } + + public int countSynonymWord(HashMap eMap) { + return synonymManageMapper.countSynonymWord(eMap); + } + + public void workLogSave(MenuResource menuAuth, ActionResource actionCode, String serviceGroup, String remark) { + logService.LogSave(LogVO.builder() + .menuAuth(menuAuth) + .actionCode(String.valueOf((actionCode))) + .serviceGroup(serviceGroup) + .remark(remark) + .build()); + } + + public void downloadExcel(Map dataMap) throws IOException { + + String oprMngCode = dataMap.get("custCode") + "_RCP_" + dataMap.get("serviceGroup") == null ? null : dataMap.get("custCode") + "_RCP_" + dataMap.get("serviceGroup"); + String repWord = dataMap.get("repWord") == null ? null : dataMap.get("repWord"); + + List list = tbSynonymMasterRepo.selectSynonymList(oprMngCode, repWord).stream().map(e -> + e.toExcel(tbSynonymWordRepo.findByMasterSeqAndUseYn(e.getSeq(), "Y") + .stream().map(f -> f.getSynonymWord()) + .collect(Collectors.joining(",")) + )) + .collect(Collectors.toList()); + List colName = new ArrayList<>(); + + colName.add("개체어"); + colName.add("대표어"); + colName.add("동의어"); + excelService.ExcelDownload("excel_synonym", list, colName); + this.workLogSave(MenuResource.rcpconversationsynonymmanage, ActionResource.download, dataMap.get("serviceGroup"), "엑셀 다운로드"); + + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/CallInfoVO.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/CallInfoVO.java new file mode 100644 index 0000000..76ffef2 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/CallInfoVO.java @@ -0,0 +1,38 @@ +package com.icomsys.main_vm.biz.rcp.conversation.vo; + +import lombok.Data; + +import java.time.LocalDateTime; + +@Data +public class CallInfoVO { + + private String token; + private String oprMngCode; + private String inChannelType; + private String callId; + private String telNo; + private String dnisNo; + private LocalDateTime callInitDate; + private LocalDateTime callEndDate; + private int callTime; + private String callEndType; + + public CallInfoVO ofCallInfoVO(CallInfoVO vo) { + CallInfoVO result = new CallInfoVO(); + + result.setToken(vo.getToken()); + result.setOprMngCode((vo.getOprMngCode())); + result.setInChannelType(vo.getInChannelType()); + result.setCallId(vo.getCallId()); + result.setTelNo(vo.getTelNo()); + result.setDnisNo(vo.getDnisNo()); + result.setCallInitDate(vo.getCallInitDate()); + result.setCallEndDate(vo.getCallEndDate()); + result.setCallTime(vo.getCallTime()); + result.setCallEndType(vo.getCallEndType()); + + return result; + } + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/ConversationApiNodeEditReq.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/ConversationApiNodeEditReq.java new file mode 100644 index 0000000..d7175a3 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/ConversationApiNodeEditReq.java @@ -0,0 +1,29 @@ +package com.icomsys.main_vm.biz.rcp.conversation.vo; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +/** + * Name : ConversationApiNodeEditReq + * date : 2023-02-15 + * author : Mong + * description : + * =========================================================== + * DATE AUTHOR NOTE + * ----------------------------------------------------------- + * 2023-02-15 Mong 최초 생성 + */ + +@Getter +@Setter +@NoArgsConstructor +public class ConversationApiNodeEditReq { + + private String textContents; + private Long seq; + private String custCode; + private String serviceGroup; + private String nodeName; + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/ConversationApiNodeInfoReq.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/ConversationApiNodeInfoReq.java new file mode 100644 index 0000000..96fed71 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/ConversationApiNodeInfoReq.java @@ -0,0 +1,18 @@ +package com.icomsys.main_vm.biz.rcp.conversation.vo; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +@Getter +@Setter +@NoArgsConstructor +public class ConversationApiNodeInfoReq { + private int size; + private int page; + private String serviceGroup; + private String custCode; + private String nodeName; + private boolean containUpper; // false: 기본 검색, ture: serviceGroupUpper 값을 채워서 상위 서비스 그룹 항목까지 검색 + private String serviceGroupUpper; +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/ConversationApiNodeInfoRes.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/ConversationApiNodeInfoRes.java new file mode 100644 index 0000000..4c45ce7 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/ConversationApiNodeInfoRes.java @@ -0,0 +1,44 @@ +package com.icomsys.main_vm.biz.rcp.conversation.vo; + +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; + +/** + * Name : ConversationApiNodeEditRes date : 2023-02-07 author : Mong description : =========================================================== DATE AUTHOR NOTE + * ----------------------------------------------------------- 2023-02-07 Mong 최초 생성 + */ + +@Getter +@Setter +@NoArgsConstructor +public class ConversationApiNodeInfoRes { + + private Long seq; + private String nodeName; + private String updateId; + private LocalDateTime updateDate; + private String oprMngCode; + private String serviceGroupName; + + @Builder + public ConversationApiNodeInfoRes(Long seq, String nodeName, String updateId, LocalDateTime updateDate, String oprMngCode, String serviceGroupName) { + this.seq = seq; + this.nodeName = nodeName; + this.updateId = updateId; + this.updateDate = updateDate; + this.oprMngCode = oprMngCode; + this.serviceGroupName = serviceGroupName; + } + + public String getUpdateDate() { + return updateDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm")); + } + public void setUpdateDate(LocalDateTime updateDate) { + this.updateDate = updateDate; + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/ConversationCmmNodeDiagramRes.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/ConversationCmmNodeDiagramRes.java new file mode 100644 index 0000000..4161b7a --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/ConversationCmmNodeDiagramRes.java @@ -0,0 +1,65 @@ +package com.icomsys.main_vm.biz.rcp.conversation.vo; + +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +/** + * Name : ConversationCmmNodeDiagramRes + * date : 2023-02-16 + * author : Mong + * description : + * =========================================================== + * DATE AUTHOR NOTE + * ----------------------------------------------------------- + * 2023-02-16 Mong 최초 생성 + */ + +@NoArgsConstructor +public class ConversationCmmNodeDiagramRes { + private Long seq; + private String cmmNodeName; + private String textContents; + private String checksum; + + @Builder + public ConversationCmmNodeDiagramRes(Long seq, String cmmNodeName, String textContents, String checksum) { + this.seq = seq; + this.cmmNodeName = cmmNodeName; + this.textContents = textContents; + this.checksum = checksum; + } + + public Long getSeq() { + return seq; + } + + public void setSeq(Long seq) { + this.seq = seq; + } + + public String getCmmNodeName() { + return cmmNodeName; + } + + public void setCmmNodeName(String cmmNodeName) { + this.cmmNodeName = cmmNodeName; + } + + public String getTextContents() { + return textContents; + } + + public void setTextContents(String textContents) { + this.textContents = textContents; + } + + public String getChecksum() { + return checksum; + } + + public void setChecksum(String checksum) { + this.checksum = checksum; + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/ConversationCmmNodeDiagramVO.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/ConversationCmmNodeDiagramVO.java new file mode 100644 index 0000000..751c23f --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/ConversationCmmNodeDiagramVO.java @@ -0,0 +1,64 @@ +package com.icomsys.main_vm.biz.rcp.conversation.vo; + +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +/** + * Name : ConversationCmmNodeDiagramVO + * date : 2023-02-16 + * author : Mong + * description : + * =========================================================== + * DATE AUTHOR NOTE + * ----------------------------------------------------------- + * 2023-02-16 Mong 최초 생성 + */ +@NoArgsConstructor +public class ConversationCmmNodeDiagramVO { + private Long seq; + private String textContents; + private String nodeName; + private String oprMngCode; + + @Builder + public ConversationCmmNodeDiagramVO(Long seq, String textContents, String nodeName, String oprMngCode) { + this.seq = seq; + this.textContents = textContents; + this.nodeName = nodeName; + this.oprMngCode = oprMngCode; + } + + public Long getSeq() { + return seq; + } + + public void setSeq(Long seq) { + this.seq = seq; + } + + public String getTextContents() { + return textContents; + } + + public void setTextContents(String textContents) { + this.textContents = textContents; + } + + public String getNodeName() { + return nodeName; + } + + public void setNodeName(String nodeName) { + this.nodeName = nodeName; + } + + public String getOprMngCode() { + return oprMngCode; + } + + public void setOprMngCode(String oprMngCode) { + this.oprMngCode = oprMngCode; + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/ConversationCmmNodeEditReq.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/ConversationCmmNodeEditReq.java new file mode 100644 index 0000000..ae2b7df --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/ConversationCmmNodeEditReq.java @@ -0,0 +1,29 @@ +package com.icomsys.main_vm.biz.rcp.conversation.vo; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import org.springframework.stereotype.Service; + +/** + * Name : ConversationCmmNodeEditReq + * date : 2023-02-16 + * author : Mong + * description : + * =========================================================== + * DATE AUTHOR NOTE + * ----------------------------------------------------------- + * 2023-02-16 Mong 최초 생성 + */ + +@Getter +@Service +@NoArgsConstructor +public class ConversationCmmNodeEditReq { + + private String textContents; + private Long seq; + private String custCode; + private String serviceGroup; + private String nodeName; + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/ConversationCmmNodeInfoReq.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/ConversationCmmNodeInfoReq.java new file mode 100644 index 0000000..403d2d6 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/ConversationCmmNodeInfoReq.java @@ -0,0 +1,28 @@ +package com.icomsys.main_vm.biz.rcp.conversation.vo; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +/** + * Name : ConversationCmmNodeInfoReq + * date : 2023-02-13 + * author : Mong + * description : + * =========================================================== + * DATE AUTHOR NOTE + * ----------------------------------------------------------- + * 2023-02-13 Mong 최초 생성 + */ +@Getter +@Setter +@NoArgsConstructor +public class ConversationCmmNodeInfoReq { + private int size; + private int page; + private String serviceGroup; + private String custCode; + private String nodeName; + private boolean containUpper; // false: 기본 검색, ture: serviceGroupUpper 값을 채워서 상위 서비스 그룹 항목까지 검색 + private String serviceGroupUpper; +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/ConversationCmmNodeInfoRes.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/ConversationCmmNodeInfoRes.java new file mode 100644 index 0000000..85a8d3d --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/ConversationCmmNodeInfoRes.java @@ -0,0 +1,66 @@ +package com.icomsys.main_vm.biz.rcp.conversation.vo; + +import lombok.Builder; +import lombok.NoArgsConstructor; + +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; + +/** + * Name : ConversationCmmNodeInfoRes + * date : 2023-02-13 + * author : Mong + * description : + * =========================================================== + * DATE AUTHOR NOTE + * ----------------------------------------------------------- + * 2023-02-13 Mong 최초 생성 + */ +@NoArgsConstructor +public class ConversationCmmNodeInfoRes { + + private Long seq; + private String nodeName; + private String updateId; + private LocalDateTime updateDate; + + @Builder + public ConversationCmmNodeInfoRes(Long seq, String nodeName, String updateId, LocalDateTime updateDate) { + this.seq = seq; + this.nodeName = nodeName; + this.updateId = updateId; + this.updateDate = updateDate; + } + + public Long getSeq() { + return seq; + } + + public void setSeq(Long seq) { + this.seq = seq; + } + + public String getNodeName() { + return nodeName; + } + + public void setNodeName(String nodeName) { + this.nodeName = nodeName; + } + + public String getUpdateId() { + return updateId; + } + + public void setUpdateId(String updateId) { + this.updateId = updateId; + } + + public String getUpdateDate() { + return updateDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm")); + } + + public void setUpdateDate(LocalDateTime updateDate) { + this.updateDate = updateDate; + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/ConversationScenarioDiagramRes.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/ConversationScenarioDiagramRes.java new file mode 100644 index 0000000..6a1cde9 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/ConversationScenarioDiagramRes.java @@ -0,0 +1,15 @@ +package com.icomsys.main_vm.biz.rcp.conversation.vo; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +@Getter +@Setter +@NoArgsConstructor +public class ConversationScenarioDiagramRes { + private Long masterSeq; + private String scenarioName; + private String textContents; + private String checksum; +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/ConversationScenarioDiagramVO.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/ConversationScenarioDiagramVO.java new file mode 100644 index 0000000..2c02e04 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/ConversationScenarioDiagramVO.java @@ -0,0 +1,15 @@ +package com.icomsys.main_vm.biz.rcp.conversation.vo; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +@Getter +@Setter +@NoArgsConstructor +public class ConversationScenarioDiagramVO { + private Long masterSeq; + private String textContents; + private String custCode; + private String serviceGroup; +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/ConversationScenarioManagerInfoRes.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/ConversationScenarioManagerInfoRes.java new file mode 100644 index 0000000..f106580 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/ConversationScenarioManagerInfoRes.java @@ -0,0 +1,19 @@ +package com.icomsys.main_vm.biz.rcp.conversation.vo; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +import java.time.LocalDateTime; + +@Getter +@Setter +@NoArgsConstructor +public class ConversationScenarioManagerInfoRes { + private Long seq; + private String scenarioName; + private int releaseVersion; + private int modifyType; // 0: 생성, 1: 배포중, 2: 수정중 + private LocalDateTime lastSaveDateTime; + private String updateName; +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/ConversationScenarioManagerRes.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/ConversationScenarioManagerRes.java new file mode 100644 index 0000000..f0eec32 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/ConversationScenarioManagerRes.java @@ -0,0 +1,19 @@ +package com.icomsys.main_vm.biz.rcp.conversation.vo; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +import java.time.LocalDateTime; + +@Getter +@Setter +@NoArgsConstructor +public class ConversationScenarioManagerRes { + private Long seq; + private String scenarioName; + private String relatedIntents; + private String updateName; + private LocalDateTime updateDate; + private int version; +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/ConversationScenarioManagerSearchReq.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/ConversationScenarioManagerSearchReq.java new file mode 100644 index 0000000..af24949 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/ConversationScenarioManagerSearchReq.java @@ -0,0 +1,17 @@ +package com.icomsys.main_vm.biz.rcp.conversation.vo; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +@Getter +@Setter +@NoArgsConstructor +public class ConversationScenarioManagerSearchReq { + private int size; + private int page; + private String serviceGroup; + private String scenarioName; + private String custCode; + private Long scenarioMasterSeq; +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/ConversationScenarioMasterVO.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/ConversationScenarioMasterVO.java new file mode 100644 index 0000000..38608e7 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/ConversationScenarioMasterVO.java @@ -0,0 +1,16 @@ +package com.icomsys.main_vm.biz.rcp.conversation.vo; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +@Getter +@Setter +@NoArgsConstructor +public class ConversationScenarioMasterVO { + private Long seq; + private Long releaseSeq; + private String custCode; + private String serviceGroup; + private String scenarioName; +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/ConversationScenarioRelatedIntentSaveReq.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/ConversationScenarioRelatedIntentSaveReq.java new file mode 100644 index 0000000..38433a0 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/ConversationScenarioRelatedIntentSaveReq.java @@ -0,0 +1,17 @@ +package com.icomsys.main_vm.biz.rcp.conversation.vo; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +import java.util.List; + +@Getter +@Setter +@NoArgsConstructor +public class ConversationScenarioRelatedIntentSaveReq { + private Long scenarioSeq; + private String custCode; + private String serviceGroup; + private List checkIntents; +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/ConversationScenarioRelatedIntentVO.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/ConversationScenarioRelatedIntentVO.java new file mode 100644 index 0000000..676c7b6 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/ConversationScenarioRelatedIntentVO.java @@ -0,0 +1,14 @@ +package com.icomsys.main_vm.biz.rcp.conversation.vo; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +@Getter +@Setter +@NoArgsConstructor +public class ConversationScenarioRelatedIntentVO { + private Long scenarioSeq; + private Long intentSeq; + private String intentName; +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/ConversationScenarioReleaseRes.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/ConversationScenarioReleaseRes.java new file mode 100644 index 0000000..e0f0e92 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/ConversationScenarioReleaseRes.java @@ -0,0 +1,18 @@ +package com.icomsys.main_vm.biz.rcp.conversation.vo; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +import java.time.LocalDateTime; + +@Getter +@Setter +@NoArgsConstructor +public class ConversationScenarioReleaseRes { + private Long seq; + private int version; + private String releaseYn; + private String registName; + private LocalDateTime registDate; +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/ConversationScenarioWorkHistoryRes.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/ConversationScenarioWorkHistoryRes.java new file mode 100644 index 0000000..a488bcc --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/ConversationScenarioWorkHistoryRes.java @@ -0,0 +1,27 @@ +package com.icomsys.main_vm.biz.rcp.conversation.vo; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +import java.time.LocalDateTime; + +@Getter +@Setter +@NoArgsConstructor +public class ConversationScenarioWorkHistoryRes { + private Long seq; + private LocalDateTime registDate; + private String menuAuth; + private String actionCode; + private String action; + private String userId; + private String userName; + private String ip; + private String remark; + private String attribute1; + private String attribute2; + private String attribute3; + private String attribute4; + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/LongtextManagerVO.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/LongtextManagerVO.java new file mode 100644 index 0000000..d85e118 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/LongtextManagerVO.java @@ -0,0 +1,33 @@ +package com.icomsys.main_vm.biz.rcp.conversation.vo; + +import com.icomsys.main_vm.db.jpa.entity.scenario.TbLongtextManager; +import lombok.Data; + +import javax.persistence.Column; +import javax.persistence.Id; + +/** + * Name : LongtextManagerVO date : 2023-01-27 author : Mong description : =========================================================== DATE AUTHOR NOTE + * ----------------------------------------------------------- 2023-01-27 Mong 최초 생성 + */ +@Data +public class LongtextManagerVO { + + private Long rfSeq; + private int tableCode; + private int columnCode; + private String textContents; + private String checksum; + + public LongtextManagerVO ofTbLongtextManager(TbLongtextManager dto){ + LongtextManagerVO result = new LongtextManagerVO(); + + result.setRfSeq(dto.getRfSeq()); + result.setTableCode(dto.getTableCode()); + result.setColumnCode(dto.getColumnCode()); + result.setTextContents(dto.getTextContents()); + result.setChecksum(dto.getChecksum()); + return result; + } + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/NlpSearchListVo.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/NlpSearchListVo.java new file mode 100644 index 0000000..63ee22f --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/NlpSearchListVo.java @@ -0,0 +1,8 @@ +package com.icomsys.main_vm.biz.rcp.conversation.vo; + +import lombok.Data; + +@Data +public class NlpSearchListVo { + private String serviceGroup; +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/ProjectSettingVO.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/ProjectSettingVO.java new file mode 100644 index 0000000..6a6735b --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/ProjectSettingVO.java @@ -0,0 +1,81 @@ +package com.icomsys.main_vm.biz.rcp.conversation.vo; + +import lombok.NoArgsConstructor; + +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; + +@NoArgsConstructor +public class ProjectSettingVO { + + private double similarityCriteria; + private double classCriteria; + private double classResultCriteria; + private String fallbackMsg; + private String greetingMsg; + private String updateId; + private LocalDateTime updateDate; + private String oprMngCode; + + public double getSimilarityCriteria() { + return similarityCriteria; + } + + public void setSimilarityCriteria(double similarityCriteria) { + this.similarityCriteria = similarityCriteria; + } + + public double getClassCriteria() { + return classCriteria; + } + + public void setClassCriteria(double classCriteria) { + this.classCriteria = classCriteria; + } + + public double getClassResultCriteria() { + return classResultCriteria; + } + + public void setClassResultCriteria(double classResultCriteria) { + this.classResultCriteria = classResultCriteria; + } + + public String getFallbackMsg() { + return fallbackMsg; + } + + public void setFallbackMsg(String fallbackMsg) { + this.fallbackMsg = fallbackMsg; + } + + public String getGreetingMsg() { + return greetingMsg; + } + + public void setGreetingMsg(String greetingMsg) { + this.greetingMsg = greetingMsg; + } + + public String getUpdateId() { return updateId; } + + public void setUpdateId(String updateId) { + this.updateId = updateId; + } + + public String getUpdateDate() { + return updateDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm")); + } + + public void setUpdateDate(LocalDateTime updateDate) { + this.updateDate = updateDate; + } + + public String getOprMngCode() { + return oprMngCode; + } + + public void setOprMngCode(String oprMngCode) { + this.oprMngCode = oprMngCode; + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/RetrieveCustNameVo.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/RetrieveCustNameVo.java new file mode 100644 index 0000000..e6a74ad --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/RetrieveCustNameVo.java @@ -0,0 +1,9 @@ +package com.icomsys.main_vm.biz.rcp.conversation.vo; + +import lombok.Data; + +@Data +public class RetrieveCustNameVo { + private String minorCode; + private String codeName; +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/SearchIntentListVo.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/SearchIntentListVo.java new file mode 100644 index 0000000..71bdebc --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/SearchIntentListVo.java @@ -0,0 +1,10 @@ +package com.icomsys.main_vm.biz.rcp.conversation.vo; + +import lombok.Data; + +@Data +public class SearchIntentListVo { + private String oprMngCode; + private String category; + private String intentName; +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/SelectIntentListVo.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/SelectIntentListVo.java new file mode 100644 index 0000000..6f66360 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/SelectIntentListVo.java @@ -0,0 +1,21 @@ +package com.icomsys.main_vm.biz.rcp.conversation.vo; + +import lombok.Data; + +import java.time.LocalDateTime; + +@Data +public class SelectIntentListVo { + + private Long seq; + private String oprMngCode; + private String intentName; + private String category; + private String registId; + private LocalDateTime registDate; + private String updateId; + private LocalDateTime updateDate; + private String codeName; + private Long exampleCnt; + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/SelectSimilarityCriteriaVO.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/SelectSimilarityCriteriaVO.java new file mode 100644 index 0000000..c666cef --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/SelectSimilarityCriteriaVO.java @@ -0,0 +1,17 @@ +package com.icomsys.main_vm.biz.rcp.conversation.vo; + +import lombok.Data; + +@Data +public class SelectSimilarityCriteriaVO { + + private String oprMngCode; + private double similarityCriteria; + private double classCriteria; + private double classResultCriteria; + private String fallbackMsg; + private String greetingMsg; + + + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/SelectSlotIntentListVo.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/SelectSlotIntentListVo.java new file mode 100644 index 0000000..f1868aa --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/SelectSlotIntentListVo.java @@ -0,0 +1,13 @@ +package com.icomsys.main_vm.biz.rcp.conversation.vo; + +import lombok.Data; + +@Data +public class SelectSlotIntentListVo { + + private String oprMngCode; + private String intentName; + private String groupName; + private Long intentSeq; + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/SynonymWordListVo.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/SynonymWordListVo.java new file mode 100644 index 0000000..b295633 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/SynonymWordListVo.java @@ -0,0 +1,8 @@ +package com.icomsys.main_vm.biz.rcp.conversation.vo; + +import lombok.Data; + +@Data +public class SynonymWordListVo { + private Long seq; +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/SystemEntityRes.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/SystemEntityRes.java new file mode 100644 index 0000000..a845c15 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/SystemEntityRes.java @@ -0,0 +1,18 @@ +package com.icomsys.main_vm.biz.rcp.conversation.vo; + +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +@Getter +@Setter +@NoArgsConstructor +public class SystemEntityRes { + private String entityName; + + @Builder + public SystemEntityRes(String entityName) { + this.entityName = entityName; + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/TbBotCommonCodeVo.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/TbBotCommonCodeVo.java new file mode 100644 index 0000000..c0fd69d --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/TbBotCommonCodeVo.java @@ -0,0 +1,22 @@ +package com.icomsys.main_vm.biz.rcp.conversation.vo; + +import lombok.Data; + +import java.time.LocalDateTime; + +@Data +public class TbBotCommonCodeVo { + private String custCode; + private String majorCode; + private String minorCode; + private String codeType; + private String oprMngCode; + private String codeName; + private String attribute1; + private String attribute2; + private String attribute3; + private String registId; + private LocalDateTime registDate; + private String updateId; + private LocalDateTime updateDate; +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/intent/ExcelIntentListVo.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/intent/ExcelIntentListVo.java new file mode 100644 index 0000000..0593dbc --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/intent/ExcelIntentListVo.java @@ -0,0 +1,32 @@ +package com.icomsys.main_vm.biz.rcp.conversation.vo.intent; + +import lombok.*; + +@Getter +@Setter +@NoArgsConstructor +public class ExcelIntentListVo { + + + private Long seq; + private String intentName; + private String codeName; + private String exampleText; + + @Builder + public ExcelIntentListVo(Long seq, String intentName, String exampleText, String codeName) { + this.seq = seq; + this.intentName = intentName; + this.exampleText = exampleText; + this.codeName = codeName; + } + + public ExcelIntentListVoEx toEx(String et) { + return ExcelIntentListVoEx.builder() + .intentName(this.intentName) + .codeName(this.codeName) + .exampleText(et) + .build(); + } + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/intent/ExcelIntentListVoEx.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/intent/ExcelIntentListVoEx.java new file mode 100644 index 0000000..f938858 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/intent/ExcelIntentListVoEx.java @@ -0,0 +1,19 @@ +package com.icomsys.main_vm.biz.rcp.conversation.vo.intent; + +import lombok.Builder; +import lombok.Data; + +@Data +public class ExcelIntentListVoEx { + + private String intentName; + private String exampleText; + private String codeName; + + @Builder + public ExcelIntentListVoEx(String intentName, String exampleText, String codeName) { + this.intentName = intentName; + this.exampleText = exampleText; + this.codeName = codeName; + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/intent/IntentSearchVo.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/intent/IntentSearchVo.java new file mode 100644 index 0000000..09d6e86 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/intent/IntentSearchVo.java @@ -0,0 +1,75 @@ +package com.icomsys.main_vm.biz.rcp.conversation.vo.intent; + +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +public class IntentSearchVo { + + private String custCode; + private String serviceGroup; + private String category; + private String intentName; + private String serviceGroupUpper; + private String oprMngCode; + private String oprMngCodeUpper; + + public IntentSearchVo(){}; + @Builder + public IntentSearchVo(String custCode, String serviceGroup, String category, String intentName, String serviceGroupUpper) { + this.custCode = custCode; + this.serviceGroup = serviceGroup; + this.category = category; + this.intentName = intentName; + this.serviceGroupUpper = serviceGroupUpper; + } + + public String getCustCode() { + return custCode; + } + + public void setCustCode(String custCode) { + this.custCode = custCode; + } + + public String getServiceGroup() { + return serviceGroup; + } + + public void setServiceGroup(String serviceGroup) { + this.serviceGroup = serviceGroup; + } + + public String getCategory() { + return category; + } + + public void setCategory(String category) { + this.category = category; + } + + public String getIntentName() { + return intentName; + } + + public void setIntentName(String intentName) { + this.intentName = intentName; + } + + public String getServiceGroupUpper() { + return serviceGroupUpper; + } + + public void setServiceGroupUpper(String serviceGroupUpper) { + this.serviceGroupUpper = serviceGroupUpper; + } + + public String getOprMngCode() { + return this.oprMngCode = this.custCode + "_RCP_" + this.serviceGroup; + } + + public String getOprMngCodeUpper() { + return this.oprMngCodeUpper = this.custCode + "_RCP_" + this.serviceGroupUpper; + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/selectIntentEntityNameListVo.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/selectIntentEntityNameListVo.java new file mode 100644 index 0000000..1742a77 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/selectIntentEntityNameListVo.java @@ -0,0 +1,9 @@ +package com.icomsys.main_vm.biz.rcp.conversation.vo; + +import lombok.Data; + +@Data +public class selectIntentEntityNameListVo { + private Long seq; + private String entityName; +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/synonym/ExcelSynonymListVo.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/synonym/ExcelSynonymListVo.java new file mode 100644 index 0000000..6ebd9a2 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/synonym/ExcelSynonymListVo.java @@ -0,0 +1,11 @@ +package com.icomsys.main_vm.biz.rcp.conversation.vo.synonym; + +import lombok.Data; + +@Data +public class ExcelSynonymListVo { + + private String idivWord; + private String repWord; + private String synonymWords; +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/synonym/SelectSynonymList2Vo.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/synonym/SelectSynonymList2Vo.java new file mode 100644 index 0000000..0f082b3 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/synonym/SelectSynonymList2Vo.java @@ -0,0 +1,22 @@ +package com.icomsys.main_vm.biz.rcp.conversation.vo.synonym; + +import com.icomsys.main_vm.db.jpa.entity.conversation.TbSynonymWord; +import lombok.Builder; +import lombok.Data; + +import java.util.List; + +@Data +public class SelectSynonymList2Vo { + + private String idivWord; + private String repWord; + private String synonymWords; + + @Builder + public SelectSynonymList2Vo(String idivWord, String repWord, String synonymWords) { + this.idivWord = idivWord; + this.repWord = repWord; + this.synonymWords = synonymWords; + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/synonym/SelectSynonymListVo.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/synonym/SelectSynonymListVo.java new file mode 100644 index 0000000..75fe07b --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/synonym/SelectSynonymListVo.java @@ -0,0 +1,44 @@ +package com.icomsys.main_vm.biz.rcp.conversation.vo.synonym; + +import lombok.*; + +@Getter +@Setter +@NoArgsConstructor +public class SelectSynonymListVo { + + private Long seq; + private String idivWord; + private String repWord; + private String synonymSeqs; + private String synonymWords; + + @Builder + public SelectSynonymListVo(Long seq, String idivWord, String repWord, String synonymSeqs, String synonymWords) { + this.seq = seq; + this.idivWord = idivWord; + this.repWord = repWord; + this.synonymSeqs = synonymSeqs; + this.synonymWords = synonymWords; + } + + public SelectSynonymListVo toSelect(String synonymWords, String synonymSeqs) { + return SelectSynonymListVo.builder() + .seq(this.seq) + .idivWord(this.idivWord) + .repWord(this.repWord) + .synonymWords(synonymWords) + .synonymSeqs(synonymSeqs) + .build(); + } + + public SelectSynonymList2Vo toExcel(String synonymWords) { + return SelectSynonymList2Vo.builder() + .idivWord(this.idivWord) + .repWord(this.repWord) + .synonymWords(synonymWords) + .build(); + } + + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/synonym/SynonymProcess.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/synonym/SynonymProcess.java new file mode 100644 index 0000000..6dec591 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/conversation/vo/synonym/SynonymProcess.java @@ -0,0 +1,61 @@ +package com.icomsys.main_vm.biz.rcp.conversation.vo.synonym; + +import com.icomsys.main_vm.db.jpa.repo.system.TbSynonymMasterRepo; +import com.icomsys.main_vm.db.jpa.entity.conversation.TbSynonymWord; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.modelmapper.ModelMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +@Service +@RequiredArgsConstructor +@Slf4j +public class SynonymProcess { + + private final ModelMapper modelMapper; + @Autowired + private TbSynonymMasterRepo tbSynonymMasterRepo; + + //JPA 연관관계 방식 + public List selectSynonymList2(String opr, String repWord) { + Long startSec = System.currentTimeMillis(); + List resulttest = tbSynonymMasterRepo.findByUseYnAndOprMngCode("Y", opr) + .stream() + .map(e -> modelMapper.map(e, SelectSynonymList2Vo.class)) + .collect(Collectors.toList()); + Long endtSec = System.currentTimeMillis(); +// log.info("resultd test = {}", new Gson().toJson(resulttest)); + + log.info("time jpa = {}", endtSec-startSec); + return resulttest; + } + + //굳이 조이닝을 쓰겠다면. + /*public List selectSynonymList3(String opr, String repWord) { + Long startSec = System.currentTimeMillis(); + List result = new ArrayList<>(); + selectSynonymList2(opr, repWord).stream().filter(e -> e.getTbSynonymWords() != null).forEach(e -> { + for (TbSynonymWord f : e.getTbSynonymWords()) { + if (f.getUseYn().equals("Y")) { + SelectSynonymListVo add = new SelectSynonymListVo(); + add.setSeq(e.getSeq()); + add.setRepWord(e.getRepWord()); + add.setIdivWord(e.getIdivWord()); + add.setSynonymSeqs(e.getTbSynonymWords().stream().filter(g -> g.getUseYn().equals("Y")).map(h -> h.getSeq().toString()).collect(Collectors.joining(","))); + add.setSynonymWords(e.getTbSynonymWords().stream().filter(g -> g.getUseYn().equals("Y")).map(h -> h.getSynonymWord()).collect(Collectors.joining(","))); + result.add(add); + } + } + }); + Long endtSec = System.currentTimeMillis(); + + log.info("time = {}", endtSec-startSec); + return result.stream().distinct().collect(Collectors.toList()); + }*/ + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/intentAnalysis/service/IntentAnalysisService.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/intentAnalysis/service/IntentAnalysisService.java new file mode 100644 index 0000000..1852363 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/intentAnalysis/service/IntentAnalysisService.java @@ -0,0 +1,16 @@ +package com.icomsys.main_vm.biz.rcp.intentAnalysis.service; + +import com.icomsys.main_vm.db.mybatis.alias.MonitoringIntentAnalysisVO; +import org.springframework.stereotype.Service; + +import java.util.HashMap; +import java.util.List; + +@Service +public interface IntentAnalysisService { + List selectIntentNameList(MonitoringIntentAnalysisVO vo); + String selectServiceGroupUpper(MonitoringIntentAnalysisVO vo); + String selectOprByServiceCode(MonitoringIntentAnalysisVO vo); + List selectIntentAnalysisList(MonitoringIntentAnalysisVO vo); + int selectIntentAnalysisListCnt(MonitoringIntentAnalysisVO vo); +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/intentAnalysis/service/impl/IntentAnalysisServiceImpl.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/intentAnalysis/service/impl/IntentAnalysisServiceImpl.java new file mode 100644 index 0000000..c06c2d7 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/intentAnalysis/service/impl/IntentAnalysisServiceImpl.java @@ -0,0 +1,42 @@ +package com.icomsys.main_vm.biz.rcp.intentAnalysis.service.impl; + +import com.icomsys.main_vm.biz.rcp.intentAnalysis.service.IntentAnalysisService; +import com.icomsys.main_vm.db.mybatis.alias.MonitoringIntentAnalysisVO; +import com.icomsys.main_vm.db.mybatis.mapper.IntentAnalysisMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.HashMap; +import java.util.List; + +@Service +public class IntentAnalysisServiceImpl implements IntentAnalysisService { + + @Autowired + private IntentAnalysisMapper intentAnalysisMapper; + + @Override + public List selectIntentNameList(MonitoringIntentAnalysisVO vo) { + return intentAnalysisMapper.selectIntentNameList(vo); + } + + @Override + public String selectServiceGroupUpper(MonitoringIntentAnalysisVO vo) { + return intentAnalysisMapper.selectServiceGroupUpper(vo); + } + + @Override + public String selectOprByServiceCode(MonitoringIntentAnalysisVO vo) { + return intentAnalysisMapper.selectOprByServiceCode(vo); + } + + @Override + public List selectIntentAnalysisList(MonitoringIntentAnalysisVO vo) { + return intentAnalysisMapper.selectIntentAnalysisList(vo); + } + + @Override + public int selectIntentAnalysisListCnt(MonitoringIntentAnalysisVO vo) { + return intentAnalysisMapper.selectIntentAnalysisListCnt(vo); + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/learningTest/SttCode.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/learningTest/SttCode.java new file mode 100644 index 0000000..a9e689e --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/learningTest/SttCode.java @@ -0,0 +1,27 @@ +package com.icomsys.main_vm.biz.rcp.learningTest; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +@Getter +@AllArgsConstructor +public enum SttCode { + SUCCESS(200, "SUCCESS", "성공"), + FAIL_OPEN(400, "ASR_SVC_OPEN ERROR","STT 연결에 실패하였습니다."), + FAIL_AUTH(401, "ASR_SVC_AUTH ERROR","STT 권한설정 실패하였습니다."), + FAIL_SET_TRANS(402, "ASR_SVC_SET_TRANS ERROR","STT 트랜젝션 설정에 실패하였습니다."), + FAIL_SET_SOCKTIME(403, "ASR_SVC_SET_SOCKTIME ERROR","STT 소켓 타임에 실패하였습니다."), + FAIL_RECG_OPEN(404, "ASR_SVC_RECG_OPEN ERROR","STT RECG 연결에 실패하였습니다."), + FAIL_RECG_LIST_VIEW(405, "ASR_SVC_RECG_LIST_VIEW ERROR","STT_LIST_VIEW 실패하였습니다."), + FAIL_RECG_SET_LIST(406, "ASR_SVC_RECG_SET_LIST ERROR","STT_LIST 설정에 실패하였습니다."), + FAIL_RECG_SET_EPD_TIMEOUT(407, "ASR_SVC_RECG_SET_EPD_TIMEOUT ERROR","STT EPD TIMEOUT 설정에 실패하였습니다."), + FAIL_RECG_SET_EPD_MARGIN(408, "ASR_SVC_RECG_SET_EPD_MARGIN ERROR","STT EPD MARGIN 설정에 실패하였습니다."), + FAIL_EPD_NOT_FOUND(409, "ASR_SVC_EPD_NOT_FOUND ERROR","STT 인식결과 EPD를 찾지 못하였습니다."); + + + + + private int resultCode; + private String errorCode; + private String resultMessage; +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/learningTest/UploadUtil.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/learningTest/UploadUtil.java new file mode 100644 index 0000000..496cc91 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/learningTest/UploadUtil.java @@ -0,0 +1,80 @@ +package com.icomsys.main_vm.biz.rcp.learningTest; + +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Value; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; + +import javax.servlet.ServletContext; +import javax.servlet.http.Part; + +@Slf4j +public class UploadUtil { + + //@Value("${file.uploadpath}") + private String uploadPath; + private ServletContext app; + + /* 생성 메서드 */ + public static UploadUtil create(ServletContext app) { + UploadUtil uploadUtil = new UploadUtil(); + uploadUtil.setApp(app); + uploadUtil.setUploadPath("/logs/was/aicb/cinnamon_ui/files/stttest/"); + + return uploadUtil; + } + + private void setApp(ServletContext app) { + this.app = app; + } + private void setUploadPath(String realPath) { + this.uploadPath = realPath; + } + + /* 파일 저장 */ + public void saveFiles(Part filePart, String folderPath) { + + String realPath = uploadPath + File.separator + folderPath; + String filePath = realPath + File.separator + filePart.getSubmittedFileName(); + log.info("realPath : " + realPath); + try( + InputStream fis = filePart.getInputStream(); + OutputStream fos = new FileOutputStream(filePath);) + { + byte[] buf = new byte[1024]; + int len = 0; + + while((len = fis.read(buf, 0, 1024)) != -1) + fos.write(buf, 0, len); + + } catch (IOException e) { + e.printStackTrace(); + } + + } + + /*/upload 하위 폴더 경로 생성 */ + public String createFilePath() { + LocalDateTime date = LocalDateTime.now(); + + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd"); + + createFolders(formatter.format(date)); + + return formatter.format(date); + } + + private void createFolders(String paths) { + + File folders = new File(uploadPath, paths); + + if(!folders.exists()) + folders.mkdirs(); + } +} \ No newline at end of file diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/learningTest/controller/LearningTestInSttController.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/learningTest/controller/LearningTestInSttController.java new file mode 100644 index 0000000..9174908 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/learningTest/controller/LearningTestInSttController.java @@ -0,0 +1,112 @@ +package com.icomsys.main_vm.biz.rcp.learningTest.controller; + +import com.icomsys.main_vm.biz.common.login.res.UserVo; +import com.icomsys.main_vm.biz.common.system.vo.DslDataTableRes; +import com.icomsys.main_vm.biz.common.system.vo.SystemCommoncodeReq; +import com.icomsys.main_vm.biz.common.system.vo.SystemCommoncodeRes; +import com.icomsys.main_vm.biz.rcp.learningTest.SttCode; +import com.icomsys.main_vm.biz.rcp.learningTest.UploadUtil; +import com.icomsys.main_vm.biz.rcp.learningTest.service.LearningTestInSttService; +import com.icomsys.main_vm.db.jpa.entity.system.TbBotCommonCode; +import com.icomsys.main_vm.db.jpa.repo.oprManage.TbBotTtsTagRepo; +import com.icomsys.main_vm.db.jpa.repo.system.TbBotCommonCodeRepo; +import com.icomsys.main_vm.db.mybatis.alias.LoginVO; +import com.querydsl.core.QueryResults; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.servlet.ModelAndView; +import org.springframework.web.servlet.view.json.MappingJackson2JsonView; + +import javax.annotation.Resource; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.Part; +import java.io.IOException; +import java.util.List; + + +@Controller +@Slf4j +@RequiredArgsConstructor +@RequestMapping("/admin/rcp/learningTest") +public class LearningTestInSttController { + + @Value("${feign.url.selvas}") + private String sttServer; + + @Value("${feign.url.sttport}") + private int sttPort; + + @Resource + MappingJackson2JsonView ajaxMainView; + + private final LearningTestInSttService learningTestInSttService; + private final TbBotTtsTagRepo tbBotTtsTagRepo; + private final TbBotCommonCodeRepo tbBotCommonCodeRepo; + + @GetMapping("/stttest/manage.do") + public String stttest(){ + return "/adm/rcp/learningTest/stttest"; + } + + @ResponseBody + @RequestMapping(value = "/stttest/sttproduct.do",method = RequestMethod.GET) + public DslDataTableRes sttProduct(HttpServletRequest request, @RequestParam String custCode, String serviceGroup) { + + LoginVO resultVO = (LoginVO) request.getSession().getAttribute("LoginVO"); + UserVo userVo = new UserVo(); + userVo.setRoleVal(resultVO.getAuthCode()); + SystemCommoncodeReq dto = new SystemCommoncodeReq(); + dto.setUserVo(userVo); + dto.setServiceGroup(serviceGroup); + dto.setOprmngCode(custCode + "_RCP_" + serviceGroup); + dto.setCodeType("STT_PRODUCT"); + QueryResults result = tbBotCommonCodeRepo.SystemCommoncodeProductList(dto); + + return new DslDataTableRes(result); + } + + @RequestMapping(value = "/stttest/call-stt.do", method = RequestMethod.POST) + //@ResponseBody + public ModelAndView callSttapi(HttpServletRequest request) throws ServletException, IOException { + ModelAndView mv = new ModelAndView(ajaxMainView); + + request.setCharacterEncoding("UTF-8"); + + UploadUtil uploadUtil = UploadUtil.create(request.getServletContext()); + + List parts = (List) request.getParts(); + + String fileName = null; + + for(Part part : parts) { + + if(!part.getName().equals("upFile")) continue; //f로 들어온 Part가 아니면 스킵 + if(part.getSubmittedFileName().equals("")) continue; //업로드 된 파일 이름이 없으면 스킵 + + fileName = part.getSubmittedFileName(); + + uploadUtil.saveFiles(part, uploadUtil.createFilePath()); + + } + +// String result = learningTestInSttService.doTestSvc("172.31.34.52",9999,fileName, 0 ); + String result = learningTestInSttService.doTestSvc(sttServer,sttPort,fileName, 0 ); + SttCode stt = learningTestInSttService.sttCode; + mv.addObject("code", stt.getResultCode()); + + if(stt == SttCode.SUCCESS){ + mv.addObject("result", result); + }else{ + mv.addObject("result", stt.getResultMessage()); + } + + log.info(String.valueOf(stt.getResultCode())); + log.info(String.valueOf(stt.getResultMessage())); + + return mv; + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/learningTest/controller/LearningTestInTtsController.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/learningTest/controller/LearningTestInTtsController.java new file mode 100644 index 0000000..c86d7a2 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/learningTest/controller/LearningTestInTtsController.java @@ -0,0 +1,66 @@ + +package com.icomsys.main_vm.biz.rcp.learningTest.controller; + +import com.icomsys.main_vm.biz.common.login.res.UserVo; +import com.icomsys.main_vm.biz.common.system.vo.DslDataTableRes; +import com.icomsys.main_vm.biz.common.system.vo.SystemCommoncodeReq; +import com.icomsys.main_vm.biz.common.system.vo.SystemCommoncodeRes; +import com.icomsys.main_vm.biz.rcp.learningTest.service.LearningTestInTtsService; +import com.icomsys.main_vm.db.jpa.entity.system.TbBotCommonCode; +import com.icomsys.main_vm.db.jpa.repo.system.TbBotCommonCodeRepo; +import com.icomsys.main_vm.db.mybatis.alias.LoginVO; +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 org.springframework.web.servlet.ModelAndView; +import org.springframework.web.servlet.view.json.MappingJackson2JsonView; + +import javax.servlet.http.HttpServletRequest; +import java.util.List; +import java.util.Map; + +@Controller +@Slf4j +@RequiredArgsConstructor +@RequestMapping("/admin/rcp/learningTest") +public class LearningTestInTtsController { + + private final TbBotCommonCodeRepo tbBotCommonCodeRepo; + private final MappingJackson2JsonView ajaxMainView; + private final LearningTestInTtsService learningTestInTtsService; + + @GetMapping("/ttstest/manage.do") + public String ttstest(){ + return "/adm/rcp/learningTest/ttstest"; + } + + + @ResponseBody + @RequestMapping(value = "/ttstest/ttsproduct.do",method = RequestMethod.GET) + public DslDataTableRes ttsProduct(HttpServletRequest request, @RequestParam String custCode, String serviceGroup) { + + LoginVO resultVO = (LoginVO) request.getSession().getAttribute("LoginVO"); + UserVo userVo = new UserVo(); + userVo.setRoleVal(resultVO.getAuthCode()); + SystemCommoncodeReq dto = new SystemCommoncodeReq(); + dto.setUserVo(userVo); + dto.setServiceGroup(serviceGroup); + dto.setOprmngCode(custCode + "_RCP_" + serviceGroup); + dto.setCodeType("TTS_PRODUCT"); + QueryResults result = tbBotCommonCodeRepo.SystemCommoncodeProductList(dto); + + return new DslDataTableRes(result); + } + + @RequestMapping(value = "/ttstest/play.do",method = RequestMethod.POST) + @ResponseBody + public ModelAndView ttsTest(@RequestBody Map tMap) { + ModelAndView mv = new ModelAndView(ajaxMainView); + String path = learningTestInTtsService.ttsTestApi(tMap); + mv.addObject("path",path); + return mv; + } + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/learningTest/controller/LearningTestInferenceController.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/learningTest/controller/LearningTestInferenceController.java new file mode 100644 index 0000000..01bd907 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/learningTest/controller/LearningTestInferenceController.java @@ -0,0 +1,60 @@ +package com.icomsys.main_vm.biz.rcp.learningTest.controller; + +import com.icomsys.main_vm.biz.rcp.learningTest.service.LearningTestInferenceService; +import com.icomsys.main_vm.db.mybatis.alias.LoginVO; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.io.ClassPathResource; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartHttpServletRequest; +import org.springframework.web.servlet.ModelAndView; +import org.springframework.web.servlet.mvc.support.RedirectAttributes; +import org.springframework.web.servlet.view.json.MappingJackson2JsonView; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@Controller +@Slf4j +@RequiredArgsConstructor +@RequestMapping("/admin/rcp/learningTest") +public class LearningTestInferenceController { + + @Resource + MappingJackson2JsonView ajaxMainView; + + private final LearningTestInferenceService learningTestInferenceService; + + @GetMapping("/inference/manage.do") + public String inference(){ + return "/adm/rcp/learningTest/inference"; + } + + /** + * @Name inferenceTest + * @Description 의도추론테스트 업로드, 다운로드 + * @Author 장동희 + * @CreateDate 2023. 3. 6. + */ + @RequestMapping(value ="/inference/inferenceTest.do",method = RequestMethod.POST) + public void inferenceTest(MultipartHttpServletRequest request, HttpServletResponse response, @RequestParam Map dataMap) throws Exception { + HashMap eMap = new HashMap(); + eMap.putAll(dataMap); + try { + learningTestInferenceService.testInferenceExcel(request, response, eMap); + } catch (Exception e) { + log.error("error download excel", e); + } + } + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/learningTest/controller/LearningTestSimulatorController.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/learningTest/controller/LearningTestSimulatorController.java new file mode 100644 index 0000000..8f6bb9f --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/learningTest/controller/LearningTestSimulatorController.java @@ -0,0 +1,75 @@ +package com.icomsys.main_vm.biz.rcp.learningTest.controller; + +import com.icomsys.main_vm.biz.advice.excep.CustomNotFoundException; +import com.icomsys.main_vm.biz.advice.excep.CustomBadRequestException; +import com.icomsys.main_vm.biz.common.system.vo.DslDataTableRes; +import com.icomsys.main_vm.biz.common.system.vo.SystemCommoncodeRes; +import com.icomsys.main_vm.biz.rcp.learningTest.service.LearningTestSimulatorService; +import com.icomsys.main_vm.biz.rcp.learningTest.vo.LearningTestDummyApiVO; +import com.icomsys.main_vm.db.mybatis.alias.LoginVO; +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 org.springframework.web.servlet.ModelAndView; + +import javax.servlet.http.HttpServletRequest; +import java.util.Map; + +@Controller +@Slf4j +@RequiredArgsConstructor +@RequestMapping("/admin/rcp/learningTest") +public class LearningTestSimulatorController { + + private final LearningTestSimulatorService learningTestSimulatorService; + + @GetMapping("/simulator/manage.do") + public String SimulatorView(){ + return "/adm/rcp/learningTest/simulator"; + } + + /** + * @Name callSimapi + * @Description 시뮬레이터 API 호출 + * @Author 문다운 + * @CreateDate 2022. 6. 20. + */ + @RequestMapping(value = "/simulator/call-api.do", method = RequestMethod.GET) + @ResponseBody + public ModelAndView callSimapi(HttpServletRequest request, @RequestParam String oprMngCode, String callId, String token, String userTalk, String methodType, String dnis) { + + return learningTestSimulatorService.callSimulator(oprMngCode, callId, token, userTalk, methodType, dnis); + } + + + /** + * @Name custCallNumList + * @Description 전화 목록 가져오기 + * @Author dongheejang + * @CreateDate 2023. 3. 14. + */ + @RequestMapping(value = "/simulator/custCallNumlist.do", method = RequestMethod.POST) + @ResponseBody + public DslDataTableRes custCallNumList (HttpServletRequest request, @RequestBody Map dataMap) { + + LoginVO resultVO = (LoginVO) request.getSession().getAttribute("LoginVO"); + QueryResults result = learningTestSimulatorService.selectCustCallNum(resultVO, dataMap); + return new DslDataTableRes(result); + } + + @GetMapping("/simulator/select/dummy") + @ResponseBody + public LearningTestDummyApiVO selectDummyApi(@RequestParam(name = "seq", required = true)Long apiSeq) throws CustomNotFoundException { + + return learningTestSimulatorService.selectDummyApi(apiSeq); + } + + @PostMapping("/simulator/save/dummy") + @ResponseBody + public int saveDummyApi(@RequestBody LearningTestDummyApiVO dto) throws CustomNotFoundException, CustomBadRequestException { + + return learningTestSimulatorService.saveDummyApi(dto); + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/learningTest/service/LearningTestInSttService.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/learningTest/service/LearningTestInSttService.java new file mode 100644 index 0000000..c313c02 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/learningTest/service/LearningTestInSttService.java @@ -0,0 +1,316 @@ +package com.icomsys.main_vm.biz.rcp.learningTest.service; + +import com.icomsys.main_vm.biz.common.common.service.LogService; +import com.icomsys.main_vm.biz.rcp.conversation.nlp.wisenut.service.NlpWisenutService; +import com.icomsys.main_vm.biz.rcp.conversation.nlp.wisenut.vo.NlpSimulationResult; +import com.icomsys.main_vm.biz.rcp.learningTest.SttCode; +import com.selvasai.selvystt.Lvcsr_Lib; +//import com.selvasai.selvystt.model.LVCSR_CHANNEL_STAT; +import com.selvasai.selvystt.model.*; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.apache.poi.sl.draw.geom.Guide; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.data.domain.Page; +import org.springframework.stereotype.Service; +import org.springframework.web.servlet.ModelAndView; +import org.springframework.web.servlet.view.json.MappingJackson2JsonView; + +import javax.annotation.Resource; +import java.io.DataInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.UUID; + +@Service +@Slf4j +@RequiredArgsConstructor +public class LearningTestInSttService { + public SttCode sttCode; + public String doTestSvc(String cHost, int uPort, String fileName, int ModelID) { + Lvcsr_Lib lib = new Lvcsr_Lib(); + LVCSR_RESULT ret = null; + + LocalDateTime date = LocalDateTime.now(); + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd"); + + String pcmPath = "/logs/was/aicb/cinnamon_ui/files/stttest/" + formatter.format(date) + File.separator; + + try { + ret = lib.ASR_SVC_OPEN(cHost, uPort); + if (ret == LVCSR_RESULT.LVCSR_FAIL) { + log.info("[ASR_SVC_OPEN ERROR] : " + ret); + sttCode = SttCode.FAIL_OPEN; + return "ASR_SVC_OPEN ERROR"; + } else if (ret == LVCSR_RESULT.LVCSR_SUCCESS) { + log.info("[ASR_SVC_OPEN RETURN] : " + ret); + } + + LVCSR_DATA_AUTHENTICATION authInfo = new LVCSR_DATA_AUTHENTICATION(); + String pAuthentication = "ModelUpdate"; + authInfo.setAuthentication(pAuthentication); + ret = lib.ASR_SVC_SET_AUTH(authInfo); + if (ret == LVCSR_RESULT.LVCSR_FAIL) { + log.info("[ASR_SVC_AUTH RETURN] : " + ret); + sttCode = SttCode.FAIL_AUTH; + return "ASR_SVC_AUTH RETURN"; + } else if (ret == LVCSR_RESULT.LVCSR_SUCCESS) { + log.info("[ASR_SVC_AUTH RETURN] : " + ret + " ID: " + pAuthentication); + } + + LVCSR_DATA_TRANSACTION transInfo = new LVCSR_DATA_TRANSACTION(); + UUID TransactionId = UUID.randomUUID(); + String pTransaction = pAuthentication + "_" + TransactionId.toString(); + transInfo.setTransactionId(pTransaction); + ret = lib.ASR_SVC_SET_TRANS(transInfo); + if (ret == LVCSR_RESULT.LVCSR_FAIL) { + log.info("[ASR_SVC_SET_TRANS RETURN] : " + ret); + sttCode = SttCode.FAIL_SET_TRANS; + return "ASR_SVC_SET_TRANS RETURN"; + } else if (ret == LVCSR_RESULT.LVCSR_SUCCESS) { + log.info("[ASR_SVC_SET_TRANS RETURN] : " + ret); + } + + LVCSR_DATA_SOCKTIMEOUT socktimeinfo = new LVCSR_DATA_SOCKTIMEOUT(); + socktimeinfo.setConnTimeOut(10); + socktimeinfo.setReadTimeOut(240); + ret = lib.ASR_SVC_SET_SOCKTIME(socktimeinfo); + if (ret == LVCSR_RESULT.LVCSR_FAIL) { + log.info("[ASR_SVC_SET_SOCKTIME ERROR] : " + ret); + sttCode = SttCode.FAIL_SET_SOCKTIME; + return "ASR_SVC_SET_SOCKTIME ERROR"; + } else if (ret == LVCSR_RESULT.LVCSR_SUCCESS) { + log.info("[ASR_SVC_SET_SOCKTIME RETURN] : " + ret); + } + + ret = lib.ASR_SVC_RECG_OPEN(); + if (ret == LVCSR_RESULT.LVCSR_FAIL) { + log.info("[ASR_SVC_RECG_OPEN ERROR] : " + ret); + sttCode = SttCode.FAIL_RECG_OPEN; + return "ASR_SVC_RECG_OPEN ERROR"; + } else if (ret == LVCSR_RESULT.LVCSR_SUCCESS) { + log.info("[ASR_SVC_RECG_OPEN RETURN] : " + ret); + } + + LVCSR_DATA_MODEL modelinfo = new LVCSR_DATA_MODEL(); + ret = lib.ASR_SVC_RECG_LIST_VIEW(modelinfo); + if (ret == LVCSR_RESULT.LVCSR_FAIL) { + log.info("[ASR_SVC_RECG_LIST_VIEW ERROR] : " + ret); + sttCode = SttCode.FAIL_RECG_LIST_VIEW; + return "ASR_SVC_RECG_LIST_VIEW ERROR"; + } else if (ret == LVCSR_RESULT.LVCSR_SUCCESS) { + log.info("[ASR_SVC_RECG_LIST_VIEW RETURN] : " + ret); + } + if(modelinfo.getModelCnt() > 0) { + long rsltCnt = modelinfo.getModelCnt(); + for(int i=0 ; i < rsltCnt ; i++) { + long nModelID = modelinfo.getModelInfo()[i].getModelID(); + String pModelName = modelinfo.getModelInfo()[i].getModelName(); + long nModelType = modelinfo.getModelInfo()[i].getModelType(); + long nSamplingRate = modelinfo.getModelInfo()[i].getSamplingRate(); + long nKwdCnt = modelinfo.getModelInfo()[i].getKwdCnt(); + log.info(String.format("MODEL 결과 #%d[%d, %s, %d, %d]", i+1, nModelID, pModelName, nModelType, nSamplingRate)); + + for(int j=0 ; j < nKwdCnt ; j++) { + long nKwdID = modelinfo.getModelInfo()[i].getKwdInfo()[j].getKwdID(); + String pKwdName = modelinfo.getModelInfo()[i].getKwdInfo()[j].getKwdName(); + log.info(String.format("KWD 결과 #%d:#%d[%d, %s]", i+1, j+1, nKwdID, pKwdName)); + } + } + } + + + + LVCSR_DATA_INFO datainfo = new LVCSR_DATA_INFO(); + datainfo.setModelId(ModelID); + datainfo.setKwdId(-1); + datainfo.setCodecType(LVCSR_TYPE_CODEC.CODEC_RAW_8K); + datainfo.setCharSet(LVCSR_SET_CHARSET.CHAR_SET_EUCKR); + datainfo.setEpdUsed(LVCSR_USED_EPD.SERVER_EPD_USED_ON); + datainfo.setScoreUsed(LVCSR_USED_SCORE.SCORE_USED_ON); + datainfo.setAsyncMidRstUsed(LVCSR_USED_ASYNC_MID_RESULT.ASYNC_MIDRST_USED_ON); + ret = lib.ASR_SVC_RECG_SET_LIST(datainfo); + if (ret == LVCSR_RESULT.LVCSR_FAIL) { + log.info("[ASR_SVC_RECG_SET_LIST ERROR] : " + ret); + sttCode = SttCode.FAIL_RECG_SET_LIST; + return "ASR_SVC_RECG_SET_LIST ERROR"; + } else if (ret == LVCSR_RESULT.LVCSR_SUCCESS) { + log.info("[ASR_SVC_RECG_SET_LIST RETURN] : " + ret); + } + + LVCSR_DATA_TIMEOUT datatimeout = new LVCSR_DATA_TIMEOUT(); + datatimeout.setStartTimeout(6); + datatimeout.setDurationTimeout(300); + ret = lib.ASR_SVC_RECG_SET_EPD_TIMEOUT(datatimeout); + if (ret == LVCSR_RESULT.LVCSR_FAIL) { + log.info("[ASR_SVC_RECG_SET_EPD_TIMEOUT ERROR] : " + ret); + sttCode = SttCode.FAIL_RECG_SET_EPD_TIMEOUT; + return "ASR_SVC_RECG_SET_EPD_TIMEOUT ERROR"; + } else if (ret == LVCSR_RESULT.LVCSR_SUCCESS) { + log.info("[ASR_SVC_RECG_SET_EPD_TIMEOUT RETURN] : " + ret); + } + + LVCSR_DATA_MARGIN datamargin = new LVCSR_DATA_MARGIN(); + datamargin.setEpdMargin(0.7f); + ret = lib.ASR_SVC_RECG_SET_EPD_MARGIN(datamargin); + if (ret == LVCSR_RESULT.LVCSR_FAIL) { + log.info("[ASR_SVC_RECG_SET_EPD_MARGIN ERROR] : " + ret); + sttCode = SttCode.FAIL_RECG_SET_EPD_MARGIN; + return "ASR_SVC_RECG_SET_EPD_MARGIN ERROR"; + } else if (ret == LVCSR_RESULT.LVCSR_SUCCESS) { + log.info("[ASR_SVC_RECG_SET_EPD_MARGIN RETURN] : " + ret); + } + + FileInputStream fileInputStream = null; + DataInputStream dataInputStream = null; + try { + File file = new File(pcmPath + fileName); + fileInputStream = new FileInputStream(file); + dataInputStream = new DataInputStream(fileInputStream); + + byte[] buff = new byte[1600]; //버퍼 크기는 생성되는 크기에 따라 설정 가능 + + LVCSR_EPD_INFO epdinfo = new LVCSR_EPD_INFO(); + int nLen = 0; + int bButtonComplete = 0; + + while ( (nLen = dataInputStream.read(buff)) != -1 ) { + ret = lib.ASR_SVC_RECG_DATA(buff, nLen, bButtonComplete, epdinfo); + if (ret == LVCSR_RESULT.LVCSR_SUCCESS) { + if (LVCSR_EPD_STAT.DURATION_TIME_OVER == epdinfo.getOutput() || LVCSR_EPD_STAT.EPD_FOUND == epdinfo.getOutput()) { + log.info("[ASR_SVC_RECG_DATA RECV] : " + epdinfo.getOutput()); + break; + } + if (LVCSR_EPD_STAT.RECEIV_OK == epdinfo.getOutput() || LVCSR_EPD_STAT.RECEIV_OK_SPEECH == epdinfo.getOutput() || LVCSR_EPD_STAT.SECTION_FOUND == epdinfo.getOutput()) { + LVCSR_RECOG_MID_RESULT resultmidinfo = new LVCSR_RECOG_MID_RESULT(); + ret = lib.ASR_SVC_RECG_MID_PROC(resultmidinfo); + if (ret == LVCSR_RESULT.LVCSR_FAIL) { + log.info(String.format("인식 결과 REJCT2 [%s]", ret)); + } else if (ret == LVCSR_RESULT.LVCSR_SUCCESS) { + log.info("[ASR_SVC_RECG_MID_PROC RETURN] : " + ret + " 문장길이:" + resultmidinfo.getResultLen() + " 개수:" + resultmidinfo.getCount()); + if(resultmidinfo.getResultLen() > 0) { + log.info(String.format("인식 중간 결과 문장 [%s]", resultmidinfo.getStrResult())); + } + long rsltCnt = resultmidinfo.getCount(); + if(rsltCnt > 0) { + for(int i=0 ; i < rsltCnt ; i++) { + log.info(String.format("인식 중간 결과 #%d[%s, %s, %d, %d]", i+1, fileName, resultmidinfo.getDataResult()[i].getStrToken(), resultmidinfo.getDataResult()[i].getStart(), resultmidinfo.getDataResult()[i].getEnd())); + + long phCnt = resultmidinfo.getDataResult()[i].getResultPhCnt(); + for(int j=0 ; j < phCnt ; j++) { + String phonemeResultStr = resultmidinfo.getDataResult()[i].getResultPhoneme()[j].getStrPhToken(); + if (phonemeResultStr != null) { + log.info(String.format("인식 중간 결과[#%d]#%d[%s, %d]", i+1, j+1, resultmidinfo.getDataResult()[i].getResultPhoneme()[j].getStrPhToken(), resultmidinfo.getDataResult()[i].getResultPhoneme()[j].getDuration())); + } else { + break; + } + } + } + } + } + log.info("[ASR_SVC_RECG_DATA RECV] : " + epdinfo.getOutput()); + continue; + } + } + } + dataInputStream.close(); + fileInputStream.close(); + + if (-1 == nLen || 0 == nLen) { + bButtonComplete = 1; + lib.ASR_SVC_RECG_DATA(buff, 0, bButtonComplete, epdinfo); + if (LVCSR_EPD_STAT.EPD_FOUND != epdinfo.getOutput()) { + log.info(String.format("인식 결과 EPD Not Found [%s]", fileName)); + sttCode = SttCode.FAIL_EPD_NOT_FOUND; + return "인식 결과 EPD Not Found"; + } else { + log.info("[ASR_SVC_RECG_DATA RECV] : " + epdinfo.getOutput()); + } + } + + } catch ( IOException e ) { + throw e; + } finally { + if ( dataInputStream != null ) try { dataInputStream.close(); } catch (Exception e) { } + if ( fileInputStream != null ) try { fileInputStream.close(); } catch (Exception e) { } + } + + LVCSR_RECOG_RESULT resultinfo = new LVCSR_RECOG_RESULT(); + LVCSR_RESULT proc_ret = lib.ASR_SVC_RECG_STR_PROC(resultinfo); + if (proc_ret == LVCSR_RESULT.LVCSR_FAIL) { + log.info(String.format("인식 결과 REJCT2 [%s]", fileName)); + return "인식 결과 REJCT2 [%s]" + fileName; + } else if (proc_ret == LVCSR_RESULT.LVCSR_SUCCESS) { + log.info("[ASR_SVC_RECG_PROC RETURN] : " + ret + " 문장길이:" + resultinfo.getResultLen() + " 개수:" + resultinfo.getCount() + " ADDR 사용여부:" + resultinfo.getADDRUsed() + " KWD 개수:" + resultinfo.getKWDCount()); + long rsltLen = resultinfo.getResultLen(); + if (rsltLen > 0) { + log.info(String.format("인식 결과 [%s] 스코어[%4.3f] 시작ms[%d] 끝ms[%d]", resultinfo.getStrResult(), resultinfo.getConfidScore(), resultinfo.getResultEPD().getStart(), resultinfo.getResultEPD().getEnd())); + sttCode = SttCode.SUCCESS; + return resultinfo.getStrResult(); + } + long rsltCnt = resultinfo.getCount(); + if(rsltCnt > 0) { + for(int i=0 ; i < rsltCnt ; i++) { + log.info(String.format("인식 단어 결과 #%d[%s, %s, %d, %d]", i+1, fileName, resultinfo.getDataResult()[i].getStrToken(), resultinfo.getDataResult()[i].getStart(), resultinfo.getDataResult()[i].getEnd())); + + long phCnt = resultinfo.getDataResult()[i].getResultPhCnt(); + for(int j=0 ; j < phCnt ; j++) { + String phonemeResultStr = resultinfo.getDataResult()[i].getResultPhoneme()[j].getStrPhToken(); + if (phonemeResultStr != null) { + log.info(String.format("인식 음소 결과[#%d]#%d[%s, %d]", i+1, j+1, resultinfo.getDataResult()[i].getResultPhoneme()[j].getStrPhToken(), resultinfo.getDataResult()[i].getResultPhoneme()[j].getDuration())); + } else { + break; + } + } + } + } + + long rsltSentCnt = resultinfo.getSentCount(); + if(rsltSentCnt > 0) { + for(int i=0 ; i < rsltSentCnt ; i++) { + log.info(String.format("문장 결과 #%d[%s, %s, %d, %d]", i+1, fileName, resultinfo.getDataSentResult()[i].getStrToken(), resultinfo.getDataSentResult()[i].getStart(), resultinfo.getDataSentResult()[i].getEnd())); + + long phCnt = resultinfo.getDataSentResult()[i].getResultPhCnt(); + for(int j=0 ; j < phCnt ; j++) { + String phonemeResultStr = resultinfo.getDataSentResult()[i].getResultPhoneme()[j].getStrPhToken(); + if (phonemeResultStr != null) { + log.info(String.format("문장 결과[#%d]#%d[%s, %d]", i+1, j+1, resultinfo.getDataSentResult()[i].getResultPhoneme()[j].getStrPhToken(), resultinfo.getDataSentResult()[i].getResultPhoneme()[j].getDuration())); + } else { + break; + } + } + } + } + + long addrUsed = resultinfo.getADDRUsed(); + if (addrUsed > 0) { + log.info(String.format("주소 결과 보정 유형 [%d] 보정 주소[%s] 기본주소[%s] 상세주소[%s]", resultinfo.getResultADDR().getCorrectType(), resultinfo.getResultADDR().getZipcode(), resultinfo.getResultADDR().getStrMainAddress(), resultinfo.getResultADDR().getStrAuxAddress())); + log.info(String.format("주소 결과 시/도 [%s] 시/군/구 main[%s] 시/군/구 sub[%s] 읍/면/동[%s] 리[%s] 지번[%s] 도로명[%s] 건물번호[%s] POI명[%s]", resultinfo.getResultADDR().getSepAddr().getStrSido(), resultinfo.getResultADDR().getSepAddr().getStrSigunguMain(), resultinfo.getResultADDR().getSepAddr().getStrSigunguSub(), resultinfo.getResultADDR().getSepAddr().getStrDong(), resultinfo.getResultADDR().getSepAddr().getStrLi(), resultinfo.getResultADDR().getSepAddr().getStrJibun(), resultinfo.getResultADDR().getSepAddr().getStrRoadName(), resultinfo.getResultADDR().getSepAddr().getStrBldgNo(), resultinfo.getResultADDR().getSepAddr().getStrPoiName())); + } + + long kwdCnt = resultinfo.getKWDCount(); + if(kwdCnt > 0) { + for(int x=0 ; x < kwdCnt ; x++) { + String kwdToken = resultinfo.getResultKWD()[x].getStrToken().toString(); + log.info(String.format("KWD 결과 #%d[%s, %s, %d, %d, %4.3f]", x+1, kwdToken, resultinfo.getResultKWD()[x].getStrSymbol(), resultinfo.getResultKWD()[x].getStart(), resultinfo.getResultKWD()[x].getEnd(), resultinfo.getResultKWD()[x].getScore())); + } + } + } + + } catch(Exception e) { + System.out.println(e); + } finally { + try { + lib.ASR_SVC_RECG_CLOS(); + } catch(Exception e) { } + try { + lib.ASR_SVC_CLOS(); + } catch(Exception e) { } + } + return ""; + } + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/learningTest/service/LearningTestInTtsService.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/learningTest/service/LearningTestInTtsService.java new file mode 100644 index 0000000..96e948e --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/learningTest/service/LearningTestInTtsService.java @@ -0,0 +1,113 @@ +package com.icomsys.main_vm.biz.rcp.learningTest.service; + +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; + +import selvytts.Pttsnet; + +import java.io.File; +import java.io.IOException; +import java.net.InetAddress; +import java.net.UnknownHostException; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Map; +import java.util.UUID; + +@Service +@Slf4j +public class LearningTestInTtsService { + + @Value("${feign.url.selvas}") + private String ttsServer; + + @Value("${feign.url.ttsport}") + private String ttsPort; + + @Value("${file.path}") + private String filePath; + + /** + * @Name speechSynthesis + * @Description + * @Author jun + * @CreateDate 2023. 3. 10. + * + * @return + * + * @ChangeDescription + */ + public String ttsTestApi(Map tMap) { + + SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd"); + Calendar c1 = Calendar.getInstance(); + + int result = -1; // 0 : 성공, 0 미만 : 실패 + String localFileFolderName = ttsFilepath(sdf.format(c1.getTime())); + String localFilePathName = ttsFileName(); + + String hostIP = ttsServer; + String hostPort = ttsPort; + int connection_timeout = 60; + int read_timeout = 60; + String talkText = (String) tMap.get("talkText"); + String resultFilePath = localFileFolderName + "/" + localFilePathName; + String pHighlight = null; + String pLipsync = null; + int nLanguage = 0; + int nSpeakerid = 8; + int sformat = Pttsnet.PTTSNET_FMT8K_16BIT_WAVE; // 16bit Linear PCM + int pitch = Integer.parseInt((String) tMap.get("pitch")); + int speed = Integer.parseInt((String) tMap.get("speed")); + int volume = Integer.parseInt((String) tMap.get("volume")); + int nFlag = 0x00; + int content_type = Pttsnet.PTTSNET_CONTENT_PLAIN; + int charset = Pttsnet.PTTSNET_CHARSET_UTF8; + int vc_type = -1; + String audioFile = null; + int audio_offset = Pttsnet.PTTSNET_AUDIO_MIX; + + + File Folder = new File(localFileFolderName); + if (!Folder.exists()) { + try { + Folder.mkdirs(); + } catch (Exception e) { + log.debug("error_mkdir"); + e.getStackTrace(); + } + } + + try { + result = new Pttsnet().PTTSNET_FILE_A_EX(hostIP, hostPort, connection_timeout, read_timeout, talkText + , resultFilePath, pHighlight, pLipsync, nLanguage, nSpeakerid, sformat, pitch + , speed, volume, nFlag, content_type, charset, vc_type, audioFile, audio_offset); + } catch (IOException ex) { + ex.printStackTrace(); + } + + return result == 0 ? serverFilepath(localFilePathName, sdf.format(c1.getTime())) : ""; + } + + private String ttsFilepath(String date) { + return filePath + "ttstest/" + date; + } + + private String ttsFileName() { + return UUID.randomUUID().toString().replaceAll("-", "") + ".wav"; + } + + private String serverFilepath(String fileName, String date) { + InetAddress local; + String ip = ""; + try { + local = InetAddress.getLocalHost(); + ip = local.getHostAddress(); + } catch (UnknownHostException e1) { + e1.printStackTrace(); + } + + return "http://" + ip + ":8050/files/ttstest/" + date +"/" + fileName; + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/learningTest/service/LearningTestInferenceService.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/learningTest/service/LearningTestInferenceService.java new file mode 100644 index 0000000..fea7c5d --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/learningTest/service/LearningTestInferenceService.java @@ -0,0 +1,246 @@ +package com.icomsys.main_vm.biz.rcp.learningTest.service; + +import com.icomsys.main_vm.biz.advice.excep.CustomRuntimeException; +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.rcp.conversation.nlp.wisenut.service.NlpWisenutService; +import com.icomsys.main_vm.biz.rcp.conversation.nlp.wisenut.vo.InferenceAPIResponseDTO; +import com.icomsys.main_vm.biz.rcp.learningTest.vo.SelectProjectSettingInfoVO; +import com.icomsys.main_vm.common.code.enumresource.ActionResource; +import com.icomsys.main_vm.common.code.enumresource.MenuResource; +import com.icomsys.main_vm.common.util.ExcelUtils; +import com.icomsys.main_vm.db.jpa.repo.conversation.TbProjectSettingRepo; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.RegExUtils; +import org.apache.commons.lang3.StringUtils; +import org.apache.poi.ss.usermodel.CellType; +import org.apache.poi.xssf.usermodel.XSSFFont; +import org.apache.poi.xssf.usermodel.XSSFRow; +import org.apache.poi.xssf.usermodel.XSSFSheet; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; +import org.springframework.stereotype.Service; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.multipart.MultipartHttpServletRequest; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.net.URLEncoder; +import java.text.SimpleDateFormat; +import java.util.*; + +@Service +@Slf4j +@RequiredArgsConstructor +public class LearningTestInferenceService { + + private final TbProjectSettingRepo tbProjectSettingRepo; + private final LogService logService; + + @Resource(name = "nlpWisenutService") + private NlpWisenutService nlpAPIService; + + + /** + * 유저가 업로드한 엑셀 파일 Read + */ + private List readExcelFile(MultipartFile file) throws Exception { + try { + XSSFWorkbook wb = new XSSFWorkbook(file.getInputStream()); + XSSFSheet sheet = wb.getSheetAt(1); + + List testList = new ArrayList(); + for (int i = 1; i < sheet.getPhysicalNumberOfRows(); i++) { + XSSFRow row = sheet.getRow(i); + if(row == null) continue; + if(row.getCell(0) == null) continue; + + row.getCell(0).setCellType(CellType.STRING); + String v = row.getCell(0).getStringCellValue(); + + // 한글/영문/공백 제외 삭제처리 + // v = StringUtils.replacePattern(v, "[^\\uAC00-\\uD7A30-9a-zA-Z\\s]", ""); + v = RegExUtils.replacePattern(v, "[^\\uAC00-\\uD7A30-9a-zA-Z\\s]", ""); + testList.add(v); + } + + return testList; + } catch (Exception e) { +// throw new Exception("올바른 엑셀 형식이 아닙니다."); + throw new CustomRuntimeException("올바른 엑셀 형식이 아닙니다."); + } + } + + /** + * 의도추론 테스트 API 호출 + */ + private InferenceAPIResponseDTO callInferenceAPI(List testList, HashMap eMap) { + String oprMngCode = eMap.get("oprMngCode") == null ? null : eMap.get("oprMngCode"); + + // NLP API 호출 + SelectProjectSettingInfoVO projectSettingInfo = tbProjectSettingRepo.selectProjectSettingInfo(oprMngCode); + Long projectId = projectSettingInfo.getIfMappingId(); + if (projectId == null) { + return new InferenceAPIResponseDTO(); + } + + // API 관련 데이터 + // FIXME: 고객사(UPLUS) 셀렉트 값 문제 해결 후 아래 코드로 변경 필요. + InferenceAPIResponseDTO responseDTO = nlpAPIService.multiQueryApi(projectId.intValue(), testList.toArray(new String[testList.size()])); + log.info("# API RESULT MAP : {}", responseDTO.toString()); + return responseDTO; + } + + /** + * 의도추론 테스트 API 호출 + */ + private InferenceAPIResponseDTO testCallInferenceAPI() { + + InferenceAPIResponseDTO responseDTO = new InferenceAPIResponseDTO(); + + responseDTO.setReturnCode("000"); + responseDTO.setReturnMsg("Success"); + List rlist = new ArrayList<>(); + + InferenceAPIResponseDTO responseDTO1 = new InferenceAPIResponseDTO(); + responseDTO1.setDialogTaskId("90922661"); + responseDTO1.setDialogTaskName("영업시간 안내"); + responseDTO1.setQuery("오늘 영업하나요?"); + + InferenceAPIResponseDTO responseDTO2 = new InferenceAPIResponseDTO(); + responseDTO2.setDialogTaskId("90923772"); + responseDTO2.setDialogTaskName("주차위치 안내"); + responseDTO2.setQuery("주차장 있나요"); + + rlist.add(responseDTO1); + rlist.add(responseDTO2); + + responseDTO.setData(rlist); + return responseDTO; + } + + /** + * API 응답 결과 엑셀파일 생성 + */ + private XSSFWorkbook createResultExcel(InferenceAPIResponseDTO responseDTO) { + // Excel 파일 생성 + XSSFWorkbook wbResult = new XSSFWorkbook(); + XSSFFont font = wbResult.createFont(); + XSSFSheet resultSheet = wbResult.createSheet("data"); + XSSFRow row = resultSheet.createRow(0); + + // 셀 헤더 + ExcelUtils.createDefaultHeaderCellStyle(row, 0, font, "의도추론 대상 문장"); + ExcelUtils.createDefaultHeaderCellStyle(row, 1, font, "인텐트"); + ExcelUtils.createDefaultHeaderCellStyle(row, 2, font, "인텐트ID"); + + List dataList = responseDTO.getData(); + int rowNum = 1; + for(InferenceAPIResponseDTO data : dataList) { + row = resultSheet.createRow(rowNum++); + ExcelUtils.createDefaultValueCellStyle(row, 0, font, data.getQuery()); + ExcelUtils.createDefaultValueCellStyle(row, 1, font, data.getDialogTaskName()); + ExcelUtils.createDefaultValueCellStyle(row, 2, font, data.getDialogTaskId()); + } + + // 열너비 조정 + resultSheet.autoSizeColumn(0); + resultSheet.setColumnWidth(0, (resultSheet.getColumnWidth(0))+(short)8192); + resultSheet.autoSizeColumn(1); + resultSheet.setColumnWidth(1, (resultSheet.getColumnWidth(1))+(short)4096); + resultSheet.autoSizeColumn(2); + resultSheet.setColumnWidth(2, (resultSheet.getColumnWidth(2))+(short)1024); + + return wbResult; + } + + + public void testInferenceExcel(MultipartHttpServletRequest request, HttpServletResponse response, HashMap eMap) throws Exception { + // excel 관련 + MultipartFile file = request.getFile("upFile"); + + try { + List testList = new ArrayList<>(); + try { + testList = this.readExcelFile(file); + + } catch (CustomRuntimeException e) { + response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); // xlsx + response.setHeader("Content-disposition", "attachment; filename=" + "notexcel"); + response.setHeader("Content-Transfer-Encoding", "binary"); + response.setHeader("Connection", "close"); + throw new CustomRuntimeException("올바른 엑셀 형식이 아닙니다."); + } + if (CollectionUtils.isEmpty(testList)) { + response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); // xlsx + response.setHeader("Content-disposition", "attachment; filename=" + "noexapmle"); + response.setHeader("Content-Transfer-Encoding", "binary"); + response.setHeader("Connection", "close"); + throw new CustomRuntimeException("입력된 문장이 없습니다."); + } + if (testList.size() > 200) { + response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); // xlsx + response.setHeader("Content-disposition", "attachment; filename=" + "sizeover"); + response.setHeader("Content-Transfer-Encoding", "binary"); + response.setHeader("Connection", "close"); + throw new CustomRuntimeException("의도추론 예문 제한을 초과했습니다."); + } + + // file 관련 + Calendar c = Calendar.getInstance(); + c.clear(); + c.setTime(new Date()); + SimpleDateFormat sdfForPath = new SimpleDateFormat("yyyy/MM/"); + + // API 관련 데이터 + InferenceAPIResponseDTO responseDTO = this.callInferenceAPI(testList, eMap); + + // API 관련 데이터 로컬용 +// InferenceAPIResponseDTO responseDTO = this.testCallInferenceAPI(); + + String returnCode = responseDTO.getReturnCode(); + String testResult = StringUtils.equals(returnCode, "000") ? "SUCCESS" : "FAIL"; + + + // 성공 + if (StringUtils.equals(returnCode, "000")) { + eMap.put("testResult", testResult); + + XSSFWorkbook wbResult = this.createResultExcel(responseDTO); + SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd_HHmmss"); + String now = sdf.format(new Date()); + String resultFileName = URLEncoder.encode("test_inference_result_" + now + ".xlsx", "UTF-8"); + + + resultFileName = resultFileName.replaceAll("/", "").replaceAll("&", "").replaceAll("\\\\", "").replaceAll("/[.]{1,2}", "").replaceAll("\\[.]{1,2}", ""); // Path Manipulation + + String filename = URLEncoder.encode(resultFileName, "UTF-8"); + response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); // xlsx + response.setHeader("Content-disposition", "attachment; filename=" + filename); + response.setHeader("Content-Transfer-Encoding", "binary"); + response.setHeader("Connection", "close"); + +// XSSFWorkbook wb = new XSSFWorkbook(mf.getInputStream()); + wbResult.write(response.getOutputStream()); + wbResult.close(); + + logService.LogSave(LogVO.builder() + .menuAuth(MenuResource.rcplearningTestinferencemanage) + .actionCode(String.valueOf((ActionResource.download))) + .serviceGroup(eMap.get("oprMngCode").split("_")[2]) + .build()); + } + // 실패 + else { + eMap.put("testResult", "false"); + } + } catch (CustomRuntimeException e) { + + throw e; + } catch (Exception e) { + throw e; + } +// this.insertInference(eMap); + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/learningTest/service/LearningTestSimulatorService.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/learningTest/service/LearningTestSimulatorService.java new file mode 100644 index 0000000..c0eaa09 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/learningTest/service/LearningTestSimulatorService.java @@ -0,0 +1,141 @@ +package com.icomsys.main_vm.biz.rcp.learningTest.service; + + +import com.google.gson.JsonElement; +import com.google.gson.JsonParser; +import com.google.gson.JsonSyntaxException; +import com.icomsys.main_vm.biz.advice.excep.CustomNotFoundException; +import com.icomsys.main_vm.biz.advice.excep.CustomBadRequestException; +import com.icomsys.main_vm.biz.common.common.service.LogService; +import com.icomsys.main_vm.biz.common.login.res.UserVo; +import com.icomsys.main_vm.biz.common.system.vo.SystemCommoncodeReq; +import com.icomsys.main_vm.biz.common.system.vo.SystemCommoncodeRes; +import com.icomsys.main_vm.biz.rcp.conversation.nlp.wisenut.service.NlpWisenutService; +import com.icomsys.main_vm.biz.rcp.conversation.nlp.wisenut.vo.NlpSimulationResult; +import com.icomsys.main_vm.biz.rcp.learningTest.vo.LearningTestDummyApiVO; +import com.icomsys.main_vm.common.code.code.LongTextManagerColumnCode; +import com.icomsys.main_vm.common.code.code.LongTextManagerTableCode; +import com.icomsys.main_vm.common.util.HashUtil; +import com.icomsys.main_vm.db.jpa.entity.scenario.TbApiNode; +import com.icomsys.main_vm.db.jpa.entity.scenario.TbLongtextManager; +import com.icomsys.main_vm.db.jpa.entity.scenario.id.TbLongtextManagerId; +import com.icomsys.main_vm.db.jpa.repo.scenario.TbApiNodeRepo; +import com.icomsys.main_vm.db.jpa.repo.scenario.TbLongtextManagerRepo; +import com.icomsys.main_vm.db.jpa.repo.system.TbBotCommonCodeRepo; +import com.icomsys.main_vm.db.mybatis.alias.LoginVO; +import com.querydsl.core.QueryResults; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import org.springframework.web.servlet.ModelAndView; +import org.springframework.web.servlet.view.json.MappingJackson2JsonView; + +import javax.annotation.Resource; +import java.security.NoSuchAlgorithmException; +import java.util.Map; + +@Service +@Slf4j +@RequiredArgsConstructor +public class LearningTestSimulatorService { + + @Resource + MappingJackson2JsonView ajaxMainView; + @Resource(name = "nlpWisenutService") + private NlpWisenutService nlpAPIService; + private final LogService logService; + private final TbBotCommonCodeRepo tbBotCommonCodeRepo; + + private final TbLongtextManagerRepo tbLongtextManagerRepo; + private final TbApiNodeRepo tbApiNodeRepo; + +// public ModelAndView callSimulator(String oprMngCode, String callId, String token, String userTalk, String methodType) { + public ModelAndView callSimulator(String oprMngCode, String callId, String token, String userTalk, String methodType, String dnis) { + ModelAndView mv = new ModelAndView(ajaxMainView); + NlpSimulationResult result = new NlpSimulationResult(); + try { +// result = nlpAPIService.simulationApi(oprMngCode, callId, token, userTalk, methodType); + result = nlpAPIService.simulationApi(oprMngCode, callId, token, userTalk, methodType, dnis); + } catch(Exception e) { + log.error("error", e); + result.setReturnCode("-999"); + result.setReturnMsg("API 호출 오류"); + } + mv.addObject("result", result); + return mv; + } + + + public QueryResults selectCustCallNum (LoginVO resultVO, Map eMap) { + + UserVo userVo = new UserVo(); + userVo.setRoleVal(resultVO.getAuthCode()); + SystemCommoncodeReq dto = new SystemCommoncodeReq(); + dto.setUserVo(userVo); + dto.setServiceGroup(eMap.get("serviceGroup")); + dto.setOprmngCode(resultVO.getSiteCode() + "_RCP_" + eMap.get("serviceGroup")); + return tbBotCommonCodeRepo.SystemCommoncodeCallNumList(dto); + + } + + public LearningTestDummyApiVO selectDummyApi(Long apiSeq) throws CustomNotFoundException { + + TbApiNode apiNode = tbApiNodeRepo.findBySeqAndUseYn(apiSeq, "Y") + .orElseThrow(() -> new CustomNotFoundException("API 시퀀스 번호가 잘못 되었습니다.")); + + LearningTestDummyApiVO result = new LearningTestDummyApiVO(); + + TbLongtextManager dummyApi = tbLongtextManagerRepo.findById( + new TbLongtextManagerId(apiNode.getSeq(), + LongTextManagerTableCode.TB_API_NODE.getCode(), + LongTextManagerColumnCode.DUMMY_TEST.getCode())) + .orElseGet(() -> new TbLongtextManager(apiNode.getSeq(), + LongTextManagerTableCode.TB_API_NODE.getCode(), + LongTextManagerColumnCode.DUMMY_TEST.getCode(), + "","")); + + result.setApiSeq(apiNode.getSeq()); + result.setApiTitle(apiNode.getNodeName()); + result.setJsonContents(dummyApi.getTextContents()); + result.setChecksum(dummyApi.getChecksum()); + + return result; + } + + public int saveDummyApi(LearningTestDummyApiVO dto) throws CustomNotFoundException, CustomBadRequestException { + String dummyChecksum; + TbApiNode apiNode = tbApiNodeRepo.findBySeqAndUseYn(dto.getApiSeq(), "Y") + .orElseThrow(() -> new CustomNotFoundException("API 시퀀스 번호가 잘못 되었습니다.")); + + try { + dummyChecksum = HashUtil.getStringToChecksum(dto.getJsonContents()); + } catch (NoSuchAlgorithmException e) { + throw new CustomBadRequestException("Dummy API 데이터 해시값 생성에 실패하였습니다."); + } + + try { + JsonElement jsonElement = JsonParser.parseString(dto.getJsonContents()); + } catch (JsonSyntaxException e) { + throw new CustomBadRequestException("Dummy API Json 문법에 오류가 있습니다."); + } + + TbLongtextManager dummyApi = tbLongtextManagerRepo.findById( + new TbLongtextManagerId(apiNode.getSeq(), + LongTextManagerTableCode.TB_API_NODE.getCode(), + LongTextManagerColumnCode.DUMMY_TEST.getCode())) + .orElseGet(() -> new TbLongtextManager(apiNode.getSeq(), + LongTextManagerTableCode.TB_API_NODE.getCode(), + LongTextManagerColumnCode.DUMMY_TEST.getCode(), + "","")); + + if (dummyChecksum.equals(dummyApi.getChecksum())) { // 변경된 값이 없음 + return 1; + } + + dummyApi.setTextContents(dto.getJsonContents()); + dummyApi.setChecksum(dummyChecksum); + + tbLongtextManagerRepo.save(dummyApi); + return 0; + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/learningTest/vo/LearningTestDummyApiVO.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/learningTest/vo/LearningTestDummyApiVO.java new file mode 100644 index 0000000..fdbb7ec --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/learningTest/vo/LearningTestDummyApiVO.java @@ -0,0 +1,15 @@ +package com.icomsys.main_vm.biz.rcp.learningTest.vo; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +@Getter +@Setter +@NoArgsConstructor +public class LearningTestDummyApiVO { + private Long apiSeq; + private String apiTitle; + private String jsonContents; + private String checksum; +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/learningTest/vo/SelectIntentTestVO.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/learningTest/vo/SelectIntentTestVO.java new file mode 100644 index 0000000..a145ded --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/learningTest/vo/SelectIntentTestVO.java @@ -0,0 +1,17 @@ +package com.icomsys.main_vm.biz.rcp.learningTest.vo; + +import lombok.Data; + +import java.time.LocalDateTime; + +@Data +public class SelectIntentTestVO { + private Long seq; + private Long rowNum; + private String uploadFileName; + private Long testCnt; + private String testId; + private LocalDateTime testDate; + private String testResult; + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/learningTest/vo/SelectProjectSettingInfoVO.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/learningTest/vo/SelectProjectSettingInfoVO.java new file mode 100644 index 0000000..6ba12e8 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/learningTest/vo/SelectProjectSettingInfoVO.java @@ -0,0 +1,22 @@ +package com.icomsys.main_vm.biz.rcp.learningTest.vo; + +import lombok.Data; + +import java.time.LocalDateTime; + +@Data +public class SelectProjectSettingInfoVO { + + private String serviceGroup; + private double similarityCriteria; + private double classCriteria; + private double classResultCriteria; + private String fallbackMsg; + private String greetingMsg; + private Long ifMappingId; + private String registId; + private LocalDateTime registDate; + private String updateId; + private LocalDateTime updateDate; + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/monitoring/controller/MonitoringAiengineController.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/monitoring/controller/MonitoringAiengineController.java new file mode 100644 index 0000000..456abbd --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/monitoring/controller/MonitoringAiengineController.java @@ -0,0 +1,20 @@ +package com.icomsys.main_vm.biz.rcp.monitoring.controller; + +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; + +@Controller +@Slf4j +@RequiredArgsConstructor +@RequestMapping("/admin/rcp/statistics/monitoring") +public class MonitoringAiengineController { + + @GetMapping("/aiengine/manage.do") + public String AiengineView(){ + return "/adm/rcp/monitoring/aiengine"; + } + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/monitoring/controller/MonitoringConsultingController.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/monitoring/controller/MonitoringConsultingController.java new file mode 100644 index 0000000..f3c9ac2 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/monitoring/controller/MonitoringConsultingController.java @@ -0,0 +1,246 @@ +package com.icomsys.main_vm.biz.rcp.monitoring.controller; + +import com.google.gson.Gson; +import com.icomsys.main_vm.biz.common.common.service.ExcelService; +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.system.vo.DslDataTableRes; +import com.icomsys.main_vm.biz.rcp.monitoring.req.ConsultingListVoReq; +import com.icomsys.main_vm.biz.rcp.monitoring.service.MonitoringConsultingService; +import com.icomsys.main_vm.biz.rcp.monitoring.vo.ConsultingVO; +import com.icomsys.main_vm.biz.rcp.monitoring.vo.RecordDownloadVO; +import com.icomsys.main_vm.common.code.enumresource.ActionResource; +import com.icomsys.main_vm.common.code.enumresource.MenuResource; +import com.icomsys.main_vm.db.jpa.entity.conversation.TbSynonymMaster; +import com.icomsys.main_vm.db.mybatis.alias.MonitoringConsultingVO; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.apache.poi.hssf.usermodel.HSSFWorkbook; +import org.apache.poi.ss.usermodel.*; +import org.springframework.stereotype.Controller; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.ui.Model; +import org.springframework.util.FileCopyUtils; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.*; +import java.net.MalformedURLException; +import java.net.URI; +import java.net.URL; +import java.net.URLEncoder; +import java.nio.channels.Channels; +import java.nio.channels.ReadableByteChannel; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.text.DecimalFormat; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@Controller +@Slf4j +@RequiredArgsConstructor +@RequestMapping("/admin/rcp/statistics/monitoring") +public class MonitoringConsultingController { + + private final MonitoringConsultingService monitoringConsultingService; + private final ExcelService excelService; + private final LogService logService; + + @GetMapping("/consulting/manage.do") + public String ConsultingView(Model model){ + return "/adm/rcp/monitoring/consulting"; + } + + @RequestMapping(value = "/consulting/list.do", method = {RequestMethod.GET, RequestMethod.POST}) + @ResponseBody + public DslDataTableRes consultingList(@RequestBody MonitoringConsultingVO vo) { + vo.setLimit(vo.getPage() * vo.getPageSize()); + vo.setOffset(vo.getPageSize() * 10); + + List result = monitoringConsultingService.consultingList(vo); + log.info("dataVo -> {}", new Gson().toJson(vo)); + + // int resultCnt = monitoringConsultingService.selectConsultingListCnt(vo); + return new DslDataTableRes(result, Long.valueOf(vo.getPage() * vo.getPageSize() + result.size()), Long.valueOf(vo.getPageSize()), Long.valueOf(vo.getPage() * vo.getPageSize())); + } + + @RequestMapping(value = "/consulting/recordCallList.do", method = {RequestMethod.GET, RequestMethod.POST}) + @ResponseBody + public List selectRecordCallList(@RequestBody MonitoringConsultingVO vo) { + List result = monitoringConsultingService.selectRecordCallList(vo); + + return result; + } + + @RequestMapping(value = "/consulting/sceneSelectList.do", method = {RequestMethod.GET, RequestMethod.POST}) + @ResponseBody + public List sceneSelectList(@RequestBody MonitoringConsultingVO vo) { + List result = monitoringConsultingService.selectScenarioSeqAndName(vo); + + return result; + } + + @RequestMapping(value = "/consulting/commonCodeSelectList.do", method = {RequestMethod.GET, RequestMethod.POST}) + @ResponseBody + public List commonCodeSelectList(@RequestBody MonitoringConsultingVO vo) { + List result = monitoringConsultingService.selectCommonCodeAndDesc(vo); + + return result; + } + + @RequestMapping(value = "/consulting/userCallCnt.do", method = {RequestMethod.GET, RequestMethod.POST}) + @ResponseBody + public int selectUserCallCnt(@RequestBody MonitoringConsultingVO vo) { + return monitoringConsultingService.selectUserCallCnt(vo); + } + + @RequestMapping(value = "/consulting/play.do", method = {RequestMethod.GET, RequestMethod.POST}) + @ResponseBody + public String playRecordFile(@RequestBody RecordDownloadVO vo) { + logService.LogSave(LogVO.builder() + .menuAuth(MenuResource.valueOf(vo.getMenuVal())) + .actionCode(String.valueOf((ActionResource.listen))) + .serviceGroup(vo.getOprMngCode()) + .remark("녹취 듣기") + .build()); + + return monitoringConsultingService.playRecordFileFromS3(vo.getFileName()); + } + + @ResponseBody + @Transactional + @PostMapping("/consulting/downloadRecordFile.do") + public void downloadRecordFile(HttpServletRequest request, HttpServletResponse response, @ModelAttribute RecordDownloadVO vo) throws IOException { + + String recordFile = monitoringConsultingService.playRecordFileFromS3(vo.getFileName()); + // String recordFile = "https://ccrma.stanford.edu/~jos/mp3/harpsi-cs.mp3"; + + String resultFileName = recordFile.substring(recordFile.lastIndexOf('/') + 1); + String filePath = recordFile.substring(0, recordFile.lastIndexOf('/') + 1); + + URL url; + InputStream in = null; + OutputStream out = null; + + try { + String header = request.getHeader("User-Agent"); + if (!header.contains("MSIE") && !header.contains("Trident")) { + resultFileName = new String(resultFileName.getBytes("UTF-8"), "iso-8859-1"); + response.setHeader("Content-Disposition", "attachment; filename=\"" + resultFileName + "\""); + } else { + resultFileName = URLEncoder.encode(recordFile, "UTF-8").replaceAll("\\+", "%20"); + response.setHeader("Content-Disposition", "attachment; filename=" + resultFileName + ";"); + } + + response.setHeader("Pragma", "no-cache;"); + response.setContentType("application/octet-stream"); + response.setHeader("Content-Transfer-Encoding", "binary"); + out = response.getOutputStream(); + String fileUrl = filePath + resultFileName; + url = new URL(fileUrl); + in = url.openStream(); + + while(true) { + int data = in.read(); + if (data == -1) { + in.close(); + out.close(); + break; + } + + out.write(data); + } + + logService.LogSave(LogVO.builder() + .menuAuth(MenuResource.valueOf(vo.getMenuVal())) + .actionCode(String.valueOf((ActionResource.download))) + .serviceGroup(vo.getOprMngCode()) + .remark("녹취 파일 다운로드") + .build()); + } catch (Exception var13) { + log.info("@@@@@@@@@@@@@@@ERROR@@@@@@@@@@@@@@@"); + response.setStatus(500); + } finally { + log.info("###########finally###########"); + if (in != null) { + in.close(); + } + + if (out != null) { + out.close(); + } + } + } + + @RequestMapping(value = "/consulting/chklistcnt.do", method = {RequestMethod.GET, RequestMethod.POST}) + @ResponseBody + public int chkListCnt(@RequestBody MonitoringConsultingVO vo) { + return monitoringConsultingService.selectConsultingListCnt(vo); + } + + @ResponseBody + @Transactional + @PostMapping("/consulting/exceldownload.do") + public void downloadExcel(HttpServletResponse response, @ModelAttribute ConsultingListVoReq req) throws IOException { + + SimpleDateFormat sdf = new SimpleDateFormat("yy-MM-dd/HH:mm:ss"); + + String nowTime = sdf.format(System.currentTimeMillis()); + + req.getMonitoringConsultingVO().setPage(-1); + + List result = monitoringConsultingService.consultingList(req.getMonitoringConsultingVO()); + + List consultingVOList = new ArrayList<>(); + + if (result.size() > 0) { + for (Map e : result) { + ConsultingVO vo = new ConsultingVO(); + vo.setSeq(String.valueOf(new DecimalFormat("#").format(e.get("rownum")))); + vo.setOprMngCodeName(String.valueOf(e.get("oprMngCodeName"))); + vo.setScenario(String.valueOf(e.get("scenarioName"))); + vo.setCallTime(String.valueOf(e.get("callTime"))); + vo.setCallInitDate(String.valueOf(e.get("callInitDate"))); + vo.setCallEndName(String.valueOf(e.get("callEndName"))); + vo.setTelNo(String.valueOf(e.get("telNo"))); + vo.setDnisNo(String.valueOf(e.get("dnisNo"))); + vo.setUserTalkCnt(String.valueOf(e.get("userTalkCnt"))); + vo.setBotTalkCnt(String.valueOf(e.get("botTalkCnt"))); + + consultingVOList.add(vo); + } + } else { + ConsultingVO vo = new ConsultingVO(); + vo.setSeq(""); + vo.setOprMngCodeName(""); + vo.setScenario(""); + vo.setCallTime(""); + vo.setCallInitDate(""); + vo.setCallEndName(""); + vo.setTelNo(""); + vo.setDnisNo(""); + vo.setUserTalkCnt(""); + vo.setBotTalkCnt(""); + + consultingVOList.add(vo); + } + + monitoringConsultingService.ExcelDownload("응대이력" + nowTime, consultingVOList, req.getTitleList()); + // excelService.ExcelDownload("상담이력" + nowTime, consultingVOList, req.getTitleList()); + + logService.LogSave(LogVO.builder() + .menuAuth(MenuResource.valueOf(req.getMenuVal())) + .actionCode(String.valueOf((ActionResource.download))) + .serviceGroup(req.getOprMngCode()) + .remark("엑셀 다운로드") + .build()); + } + +} + diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/monitoring/controller/MonitoringConversationMarkController.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/monitoring/controller/MonitoringConversationMarkController.java new file mode 100644 index 0000000..a82918d --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/monitoring/controller/MonitoringConversationMarkController.java @@ -0,0 +1,149 @@ +package com.icomsys.main_vm.biz.rcp.monitoring.controller; + +import com.icomsys.main_vm.biz.common.common.service.ExcelService; +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.service.LoginService; +import com.icomsys.main_vm.biz.common.system.vo.DslDataTableRes; +import com.icomsys.main_vm.biz.rcp.monitoring.req.ConversationMarkListVoReq; +import com.icomsys.main_vm.biz.rcp.monitoring.service.MonitoringConsultingService; +import com.icomsys.main_vm.biz.rcp.monitoring.service.MonitoringConversationMarkService; +import com.icomsys.main_vm.biz.rcp.monitoring.vo.ConversationMarkVO; +import com.icomsys.main_vm.common.code.enumresource.ActionResource; +import com.icomsys.main_vm.common.code.enumresource.MenuResource; +import com.icomsys.main_vm.db.mybatis.alias.MonitoringConversationMarkVO; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Controller; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.text.DecimalFormat; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@Controller +@Slf4j +@RequiredArgsConstructor +@RequestMapping("/admin/rcp/statistics/monitoring") +public class MonitoringConversationMarkController { + + private final LoginService loginService; + + private final LogService logService; + + private final MonitoringConsultingService monitoringConsultingService; + private final ExcelService excelService; + + private final MonitoringConversationMarkService monitoringConversationMarkService; + + @GetMapping("/conversationMark/manage.do") + public String ConversationMarkView(){ + return "/adm/rcp/monitoring/conversationMark"; + } + + @RequestMapping(value = "/conversationMark/list.do", method = {RequestMethod.GET, RequestMethod.POST}) + @ResponseBody + public DslDataTableRes conversationMarkList(@RequestBody MonitoringConversationMarkVO vo) { + vo.setLimit(vo.getPage() * vo.getPageSize()); + vo.setOffset(vo.getPageSize() * 10); + + List result = monitoringConversationMarkService.selectBookmarkList(vo); + +// int resultCnt = monitoringConversationMarkService.selectBookmarkListCnt(vo); + + return new DslDataTableRes(result, Long.valueOf(vo.getPage() * vo.getPageSize() + result.size()), Long.valueOf(vo.getPageSize()), Long.valueOf(vo.getPage() * vo.getPageSize())); + } + + @RequestMapping(value = "/conversationMark/insert.do", method = {RequestMethod.GET, RequestMethod.POST}) + @ResponseBody + public int insertConversationMark(@RequestBody MonitoringConversationMarkVO vo) { + int result = monitoringConversationMarkService.insertBookmark(vo); + + return result; + } + + @RequestMapping(value = "/conversationMark/update.do", method = {RequestMethod.GET, RequestMethod.POST}) + @ResponseBody + public int updateConversationMark(@RequestBody MonitoringConversationMarkVO vo) { + vo.setUpdateId(loginService.getUserVo().getUserId()); + + int result = monitoringConversationMarkService.updateBookmark(vo); + + return result; + } + + @RequestMapping(value = "/conversationMark/checkbookmark.do", method = {RequestMethod.GET, RequestMethod.POST}) + @ResponseBody + public HashMap checkBookmark(@RequestBody MonitoringConversationMarkVO vo) { + HashMap result = monitoringConversationMarkService.checkBookmarkCnt(vo); + + return result; + } + + @RequestMapping(value = "/conversationMark/chklistcnt.do", method = {RequestMethod.GET, RequestMethod.POST}) + @ResponseBody + public int chkListCnt(@RequestBody MonitoringConversationMarkVO vo) { + return monitoringConversationMarkService.selectBookmarkListCnt(vo); + } + + @ResponseBody + @Transactional + @PostMapping("/conversationMark/exceldownload.do") + public void downloadExcel(HttpServletResponse response, @ModelAttribute ConversationMarkListVoReq req) throws IOException { + + SimpleDateFormat sdf = new SimpleDateFormat("yy-MM-dd/HH:mm:ss"); + + String nowTime = sdf.format(System.currentTimeMillis()); + + req.getMonitoringConversationMarkVO().setPage(-1); + + List result = monitoringConversationMarkService.selectBookmarkList(req.getMonitoringConversationMarkVO()); + + List conversationMarkVOList = new ArrayList<>(); + + if (result.size() > 0) { + for (Map e : result) { + ConversationMarkVO vo = new ConversationMarkVO(); + vo.setSeq(String.valueOf(new DecimalFormat("#").format(e.get("rownum")))); + vo.setCallInitDate(String.valueOf(e.get("callInitDate"))); + vo.setErrCodeType(String.valueOf(e.get("bookmarkErrCodeName"))); + vo.setMeasureType(String.valueOf(e.get("measureTypeName"))); + vo.setTalkText(String.valueOf(e.get("talkText"))); + + conversationMarkVOList.add(vo); + } + } else { + ConversationMarkVO vo = new ConversationMarkVO(); + vo.setSeq(""); + vo.setCallInitDate(""); + vo.setErrCodeType(""); + vo.setMeasureType(""); + vo.setTalkText(""); + + conversationMarkVOList.add(vo); + } + + monitoringConsultingService.ExcelDownload("대화책갈피" + nowTime, conversationMarkVOList, req.getTitleList()); +// excelService.ExcelDownload("대화책갈피" + nowTime, conversationMarkVOList, req.getTitleList()); + + logService.LogSave(LogVO.builder() + .menuAuth(MenuResource.valueOf(req.getMenuVal())) + .actionCode(String.valueOf((ActionResource.download))) + .serviceGroup(req.getOprMngCode()) + .remark("엑셀 다운로드") + .build()); + } + + //인텐트 예문 추가 팝업////////////////////////////////////////////////////// + @GetMapping(value = "/intent/addexamplepopup.do") + public String addIntentExamplePopup() { + return "adm/include/addIntentExample"; + } + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/monitoring/controller/MonitoringIntentAnalysisController.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/monitoring/controller/MonitoringIntentAnalysisController.java new file mode 100644 index 0000000..c9ba758 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/monitoring/controller/MonitoringIntentAnalysisController.java @@ -0,0 +1,157 @@ +package com.icomsys.main_vm.biz.rcp.monitoring.controller; + +import com.icomsys.main_vm.biz.common.common.service.ExcelService; +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.system.vo.DslDataTableRes; +import com.icomsys.main_vm.biz.rcp.intentAnalysis.service.IntentAnalysisService; +import com.icomsys.main_vm.biz.rcp.monitoring.req.IntentAnalysisListVoReq; +import com.icomsys.main_vm.biz.rcp.monitoring.service.MonitoringConsultingService; +import com.icomsys.main_vm.biz.rcp.monitoring.vo.IntentAnalysisVO; +import com.icomsys.main_vm.common.code.enumresource.ActionResource; +import com.icomsys.main_vm.common.code.enumresource.MenuResource; +import com.icomsys.main_vm.db.mybatis.alias.MonitoringIntentAnalysisVO; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Controller; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.text.DecimalFormat; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@Controller +@Slf4j +@RequiredArgsConstructor +@RequestMapping("/admin/rcp/statistics/monitoring") +public class MonitoringIntentAnalysisController { + + private final IntentAnalysisService intentAnalysisService; + + private final MonitoringConsultingService monitoringConsultingService; + private final ExcelService excelService; + + private final LogService logService; + + @GetMapping("/intentAnalysis/manage.do") + public String intentAnalysis(@RequestParam(value = "oprMngCode", required = false, defaultValue = "")String oprMngCode, + @RequestParam(value = "callInitDateFrom", required = false, defaultValue = "")String callInitDateFrom, + @RequestParam(value = "callInitDateTo", required = false, defaultValue = "")String callInitDateTo, + @RequestParam(value = "intentId", required = false, defaultValue = "")String intentId, Model model){ + + model.addAttribute("oprMngCode", oprMngCode); + model.addAttribute("callInitDateFrom", callInitDateFrom); + model.addAttribute("callInitDateTo", callInitDateTo); + model.addAttribute("intentId", intentId); + + return "/adm/rcp/monitoring/intentAnalysis"; + } + + @RequestMapping(value = "/intentAnalysis/intentnamelist.do", method = {RequestMethod.GET, RequestMethod.POST}) + @ResponseBody + public List selectIntentNameList(@RequestBody MonitoringIntentAnalysisVO vo) { + if (vo.getServiceGroup() != null) { + if (!"all".equals(vo.getOprMngCode())) { + String serviceGroupUpper = intentAnalysisService.selectServiceGroupUpper(vo); + + if (!serviceGroupUpper.equals(vo.getServiceGroup())) { + List oprList = new ArrayList<>(); + + vo.setServiceGroup(serviceGroupUpper); + String commonOpr = intentAnalysisService.selectOprByServiceCode(vo); + + oprList.add(vo.getOprMngCode()); + oprList.add(commonOpr); + + vo.setOprMngCodeList(oprList); + vo.setOprMngCode("all"); + } + } + } + + List result = intentAnalysisService.selectIntentNameList(vo); + + return result; + } + + @RequestMapping(value = "/intentAnalysis/list.do", method = {RequestMethod.GET, RequestMethod.POST}) + @ResponseBody + public DslDataTableRes intentAnalysisList(@RequestBody MonitoringIntentAnalysisVO vo) { + vo.setLimit(vo.getPage() * vo.getPageSize()); + vo.setOffset(vo.getPageSize() * 10); + List result = intentAnalysisService.selectIntentAnalysisList(vo); + // int resultCnt = intentAnalysisService.selectIntentAnalysisListCnt(vo); + + return new DslDataTableRes(result, Long.valueOf(vo.getPage() * vo.getPageSize() + result.size()), Long.valueOf(vo.getPageSize()), Long.valueOf(vo.getPage() * vo.getPageSize())); + } + + @RequestMapping(value = "/intentAnalysis/chklistcnt.do", method = {RequestMethod.GET, RequestMethod.POST}) + @ResponseBody + public int chkListCnt(@RequestBody MonitoringIntentAnalysisVO vo) { + return intentAnalysisService.selectIntentAnalysisListCnt(vo); + } + + @ResponseBody + @Transactional + @PostMapping("/intentAnalysis/exceldownload.do") + public void downloadExcel(HttpServletResponse response, @ModelAttribute IntentAnalysisListVoReq req) throws IOException { + + SimpleDateFormat sdf = new SimpleDateFormat("yy-MM-dd/HH:mm:ss"); + + String nowTime = sdf.format(System.currentTimeMillis()); + + req.getMonitoringIntentAnalysisVO().setPage(-1); + + List result = intentAnalysisService.selectIntentAnalysisList(req.getMonitoringIntentAnalysisVO()); + + List intentAnalysisVOList = new ArrayList<>(); + + if (result.size() > 0) { + for (Map e : result) { + IntentAnalysisVO vo = new IntentAnalysisVO(); + vo.setSeq(String.valueOf(new DecimalFormat("#").format(e.get("rownum")))); + vo.setTalkText(String.valueOf(e.get("userText"))); + vo.setIntentName(String.valueOf(e.get("intentName"))); + + if ("-".equals(e.get("score"))) { + vo.setScore(String.valueOf(e.get("score"))); + } else { + vo.setScore(e.get("score") + "%"); + } + + vo.setIntentResult(String.valueOf(e.get("intentResultCodeName"))); + vo.setCallInitDate(String.valueOf(e.get("callInitDate"))); + + intentAnalysisVOList.add(vo); + } + } else { + IntentAnalysisVO vo = new IntentAnalysisVO(); + vo.setSeq(""); + vo.setTalkText(""); + vo.setIntentName(""); + vo.setScore(""); + vo.setIntentResult(""); + vo.setCallInitDate(""); + + intentAnalysisVOList.add(vo); + } + + monitoringConsultingService.ExcelDownload("인텐트_분석_관리" + nowTime, intentAnalysisVOList, req.getTitleList()); +// excelService.ExcelDownload("인텐트_분석_관리" + nowTime, intentAnalysisVOList, req.getTitleList()); + + logService.LogSave(LogVO.builder() + .menuAuth(MenuResource.valueOf(req.getMenuVal())) + .actionCode(String.valueOf((ActionResource.download))) + .serviceGroup(req.getOprMngCode()) + .remark("엑셀 다운로드") + .build()); + } + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/monitoring/controller/MonitoringOutscenarioController.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/monitoring/controller/MonitoringOutscenarioController.java new file mode 100644 index 0000000..24772f7 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/monitoring/controller/MonitoringOutscenarioController.java @@ -0,0 +1,135 @@ +package com.icomsys.main_vm.biz.rcp.monitoring.controller; + +import com.icomsys.main_vm.biz.common.common.service.ExcelService; +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.system.vo.DslDataTableRes; +import com.icomsys.main_vm.biz.rcp.monitoring.req.OutScenarioListVoReq; +import com.icomsys.main_vm.biz.rcp.monitoring.service.MonitoringConsultingService; +import com.icomsys.main_vm.biz.rcp.monitoring.service.MonitoringOutscenarioService; +import com.icomsys.main_vm.biz.rcp.monitoring.vo.OutScenarioVO; +import com.icomsys.main_vm.biz.rcp.statistics.intent.req.IntentAnalysisItemListReq; +import com.icomsys.main_vm.common.code.enumresource.ActionResource; +import com.icomsys.main_vm.common.code.enumresource.MenuResource; +import com.icomsys.main_vm.db.mybatis.alias.MonitoringOutscenarioVO; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Controller; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@Controller +@Slf4j +@RequiredArgsConstructor +@RequestMapping("/admin/rcp/statistics/monitoring") +public class MonitoringOutscenarioController { + + private final MonitoringOutscenarioService monitoringOutscenarioService; + + private final MonitoringConsultingService monitoringConsultingService; + private final ExcelService excelService; + + private final LogService logService; + + @GetMapping("/outscenario/manage.do") + public String outscenario(){ + return "/adm/rcp/monitoring/outscenario"; + } + + @RequestMapping(value = "/outscenario/outscenariolist.do", method = {RequestMethod.GET, RequestMethod.POST}) + @ResponseBody + public DslDataTableRes outscenarioList(@RequestBody MonitoringOutscenarioVO vo) { + vo.setLimit(vo.getPage() * vo.getPageSize()); + vo.setOffset(vo.getPageSize() * 10); + List result = monitoringOutscenarioService.selectOutscenarioList(vo); + + // int resultCnt = monitoringOutscenarioService.selectOutscenarioListCnt(vo); + + return new DslDataTableRes(result, Long.valueOf(vo.getPage() * vo.getPageSize() + result.size()), Long.valueOf(vo.getPageSize()), Long.valueOf(vo.getPage() * vo.getPageSize())); + } + + @RequestMapping(value = "/outscenario/scenarionamelist.do", method = {RequestMethod.GET, RequestMethod.POST}) + @ResponseBody + public List scenarioNameList(@RequestBody MonitoringOutscenarioVO vo) { + List result = monitoringOutscenarioService.selectScenarioNameList(vo); + + return result; + } + + @RequestMapping(value = "/outscenario/tokenlist.do", method = {RequestMethod.GET, RequestMethod.POST}) + @ResponseBody + public List tokenlist(@RequestBody MonitoringOutscenarioVO vo) { + List result = monitoringOutscenarioService.selectTokenListByScenario(vo); + + return result; + } + + @RequestMapping(value = "/outscenario/calllist.do", method = {RequestMethod.GET, RequestMethod.POST}) + @ResponseBody + public List calllist(@RequestBody MonitoringOutscenarioVO vo) { + List result = monitoringOutscenarioService.selectCallListByScenario(vo); + + return result; + } + + @RequestMapping(value = "/outscenario/chklistcnt.do", method = {RequestMethod.GET, RequestMethod.POST}) + @ResponseBody + public int chkListCnt(@RequestBody MonitoringOutscenarioVO vo) { + return monitoringOutscenarioService.selectOutscenarioListCnt(vo); + } + + @ResponseBody + @Transactional + @RequestMapping(value = "/outscenario/exceldownload.do") + public void outscenarioExcelDownload(HttpServletResponse response, @ModelAttribute OutScenarioListVoReq req) throws IOException { + + SimpleDateFormat sdf = new SimpleDateFormat("yy-MM-dd/HH:mm:ss"); + + String nowTime = sdf.format(System.currentTimeMillis()); + + req.getMonitoringOutscenarioVO().setPage(-1); + + List result = monitoringOutscenarioService.selectOutscenarioList(req.getMonitoringOutscenarioVO()); + + List outScenarioVOList = new ArrayList<>(); + + if (result.size() > 0) { + for (Map e : result) { + OutScenarioVO vo = new OutScenarioVO(); + vo.setOprMngCodeName(String.valueOf(e.get("oprMngCodeName"))); + vo.setScenarioName(e.get("scenarioName") + " (" + e.get("scenarioCnt") + "건)"); + vo.setNodeName(e.get("nodeName") + " (" + e.get("nodeType") + ") (" + e.get("nodeCnt") + "건)"); + vo.setNodePercent(Math.round(Double.valueOf(String.valueOf(e.get("nodeCnt")))/Double.valueOf(String.valueOf(e.get("scenarioCnt")))*1000)/10.0 + "%"); + + outScenarioVOList.add(vo); + } + } else { + OutScenarioVO vo = new OutScenarioVO(); + vo.setOprMngCodeName(""); + vo.setScenarioName(""); + vo.setNodeName(""); + vo.setNodePercent(""); + + outScenarioVOList.add(vo); + } + + monitoringConsultingService.ExcelDownload("시나리오_이탈_노드_관리" + nowTime, outScenarioVOList, req.getTitleList()); +// excelService.ExcelDownload("시나리오_이탈_노드_관리" + nowTime, outScenarioVOList, req.getTitleList()); + + logService.LogSave(LogVO.builder() + .menuAuth(MenuResource.valueOf(req.getMenuVal())) + .actionCode(String.valueOf((ActionResource.download))) + .serviceGroup(req.getOprMngCode()) + .remark("엑셀 다운로드") + .build()); + } + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/monitoring/controller/MonitoringWorkHistoryController.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/monitoring/controller/MonitoringWorkHistoryController.java new file mode 100644 index 0000000..e2d6386 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/monitoring/controller/MonitoringWorkHistoryController.java @@ -0,0 +1,66 @@ +package com.icomsys.main_vm.biz.rcp.monitoring.controller; + +import com.icomsys.main_vm.biz.common.system.vo.DslDataTableRes; +import com.icomsys.main_vm.biz.rcp.monitoring.service.MonitoringWorkHistoryService; +import com.icomsys.main_vm.biz.rcp.monitoring.vo.InsertWorkHstListVo; +import com.icomsys.main_vm.biz.rcp.monitoring.vo.RetrieveWorkHstListVo; +import com.icomsys.main_vm.biz.rcp.monitoring.vo.SearchWorkHstVo; +import com.icomsys.main_vm.common.code.MenuCategoryVo; +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 org.springframework.web.servlet.ModelAndView; +import org.springframework.web.servlet.view.json.MappingJackson2JsonView; + +import javax.annotation.Resource; +import java.util.List; + +@Controller +@Slf4j +@RequiredArgsConstructor +@RequestMapping("/admin/rcp/statistics/monitoring") +public class MonitoringWorkHistoryController { + + @Resource + MappingJackson2JsonView ajaxMainView; + private final MonitoringWorkHistoryService monitoringWorkHistoryService; + + @GetMapping("/workhistory/manage.do") + public String ConversationMarkView(){ + return "/adm/rcp/monitoring/workhistory"; + } + + @PostMapping(value = "/retrieveWorkHst.do") + @ResponseBody + public DslDataTableRes retrieveWorkHst(@RequestBody SearchWorkHstVo searchWorkHstVo) { + + QueryResults result = monitoringWorkHistoryService.retrieveWorkHst(searchWorkHstVo); + + return new DslDataTableRes(result); + } + + @GetMapping("/workhistory/menuList") + @ResponseBody + public List workhistoryMenuList(){ + return monitoringWorkHistoryService.workhistoryMenuList(); + } + + @GetMapping("/workhistory/menuCategoryList") + @ResponseBody + public List workhistoryMenuCategoryList(){ + return monitoringWorkHistoryService.workhistoryMenuCategoryList(); + } + + @PostMapping (value ="/insert/workHst.do") + @ResponseBody + public ModelAndView CreateWorkHst(@RequestBody InsertWorkHstListVo insertWorkHstListVo) { + + monitoringWorkHistoryService.createWorkHst(insertWorkHstListVo); + + return new ModelAndView(ajaxMainView); + } + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/monitoring/req/ConsultingListVoReq.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/monitoring/req/ConsultingListVoReq.java new file mode 100644 index 0000000..4690ec7 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/monitoring/req/ConsultingListVoReq.java @@ -0,0 +1,16 @@ +package com.icomsys.main_vm.biz.rcp.monitoring.req; + +import com.icomsys.main_vm.db.mybatis.alias.MonitoringConsultingVO; +import lombok.Getter; +import lombok.Setter; + +import java.util.List; + +@Getter +@Setter +public class ConsultingListVoReq { + MonitoringConsultingVO monitoringConsultingVO; + List titleList; + String menuVal; + String oprMngCode; +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/monitoring/req/ConversationMarkListVoReq.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/monitoring/req/ConversationMarkListVoReq.java new file mode 100644 index 0000000..60cfa84 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/monitoring/req/ConversationMarkListVoReq.java @@ -0,0 +1,17 @@ +package com.icomsys.main_vm.biz.rcp.monitoring.req; + +import com.icomsys.main_vm.biz.rcp.monitoring.vo.ConversationMarkVO; +import com.icomsys.main_vm.db.mybatis.alias.MonitoringConversationMarkVO; +import lombok.Getter; +import lombok.Setter; + +import java.util.List; + +@Getter +@Setter +public class ConversationMarkListVoReq { + MonitoringConversationMarkVO monitoringConversationMarkVO; + List titleList; + String menuVal; + String oprMngCode; +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/monitoring/req/IntentAnalysisListVoReq.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/monitoring/req/IntentAnalysisListVoReq.java new file mode 100644 index 0000000..3289416 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/monitoring/req/IntentAnalysisListVoReq.java @@ -0,0 +1,17 @@ +package com.icomsys.main_vm.biz.rcp.monitoring.req; + +import com.icomsys.main_vm.biz.rcp.monitoring.vo.IntentAnalysisVO; +import com.icomsys.main_vm.db.mybatis.alias.MonitoringIntentAnalysisVO; +import lombok.Getter; +import lombok.Setter; + +import java.util.List; + +@Getter +@Setter +public class IntentAnalysisListVoReq { + MonitoringIntentAnalysisVO monitoringIntentAnalysisVO; + List titleList; + String menuVal; + String oprMngCode; +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/monitoring/req/OutScenarioListVoReq.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/monitoring/req/OutScenarioListVoReq.java new file mode 100644 index 0000000..d6e3130 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/monitoring/req/OutScenarioListVoReq.java @@ -0,0 +1,17 @@ +package com.icomsys.main_vm.biz.rcp.monitoring.req; + +import com.icomsys.main_vm.biz.rcp.monitoring.vo.OutScenarioVO; +import com.icomsys.main_vm.db.mybatis.alias.MonitoringOutscenarioVO; +import lombok.Getter; +import lombok.Setter; + +import java.util.List; + +@Getter +@Setter +public class OutScenarioListVoReq { + MonitoringOutscenarioVO monitoringOutscenarioVO; + List titleList; + String menuVal; + String oprMngCode; +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/monitoring/service/MonitoringConsultingService.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/monitoring/service/MonitoringConsultingService.java new file mode 100644 index 0000000..0a35232 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/monitoring/service/MonitoringConsultingService.java @@ -0,0 +1,27 @@ +package com.icomsys.main_vm.biz.rcp.monitoring.service; + +import com.icomsys.main_vm.db.mybatis.alias.MonitoringConsultingVO; +import org.springframework.stereotype.Service; + +import java.io.IOException; +import java.util.HashMap; +import java.util.List; + +@Service +public interface MonitoringConsultingService { + List consultingList(MonitoringConsultingVO vo); + + int selectConsultingListCnt(MonitoringConsultingVO vo); + + List selectRecordCallList(MonitoringConsultingVO vo); + + List selectScenarioSeqAndName(MonitoringConsultingVO vo); + + List selectCommonCodeAndDesc(MonitoringConsultingVO vo); + + int selectUserCallCnt(MonitoringConsultingVO vo); + + String playRecordFileFromS3(String path); + + void ExcelDownload(String fileName, List data, List title) throws IOException; +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/monitoring/service/MonitoringConversationMarkService.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/monitoring/service/MonitoringConversationMarkService.java new file mode 100644 index 0000000..abe1f89 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/monitoring/service/MonitoringConversationMarkService.java @@ -0,0 +1,21 @@ +package com.icomsys.main_vm.biz.rcp.monitoring.service; + +import com.icomsys.main_vm.db.mybatis.alias.MonitoringConversationMarkVO; +import org.springframework.stereotype.Service; + +import java.util.HashMap; +import java.util.List; + +@Service +public interface MonitoringConversationMarkService { + List selectBookmarkList(MonitoringConversationMarkVO vo); + + int selectBookmarkListCnt(MonitoringConversationMarkVO vo); + + int insertBookmark(MonitoringConversationMarkVO vo); + + int updateBookmark(MonitoringConversationMarkVO vo); + + HashMap checkBookmarkCnt(MonitoringConversationMarkVO vo); + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/monitoring/service/MonitoringOutscenarioService.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/monitoring/service/MonitoringOutscenarioService.java new file mode 100644 index 0000000..79899f2 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/monitoring/service/MonitoringOutscenarioService.java @@ -0,0 +1,16 @@ +package com.icomsys.main_vm.biz.rcp.monitoring.service; + +import com.icomsys.main_vm.db.mybatis.alias.MonitoringOutscenarioVO; +import org.springframework.stereotype.Service; + +import java.util.HashMap; +import java.util.List; + +@Service +public interface MonitoringOutscenarioService { + List selectOutscenarioList(MonitoringOutscenarioVO vo); + int selectOutscenarioListCnt(MonitoringOutscenarioVO vo); + List selectScenarioNameList(MonitoringOutscenarioVO vo); + List selectTokenListByScenario(MonitoringOutscenarioVO vo); + List selectCallListByScenario(MonitoringOutscenarioVO vo); +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/monitoring/service/MonitoringWorkHistoryService.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/monitoring/service/MonitoringWorkHistoryService.java new file mode 100644 index 0000000..65ce1df --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/monitoring/service/MonitoringWorkHistoryService.java @@ -0,0 +1,104 @@ +package com.icomsys.main_vm.biz.rcp.monitoring.service; + +import com.icomsys.main_vm.biz.rcp.monitoring.vo.InsertWorkHstListVo; +import com.icomsys.main_vm.biz.rcp.monitoring.vo.RetrieveWorkHstListVo; +import com.icomsys.main_vm.biz.rcp.monitoring.vo.SearchWorkHstVo; +import com.icomsys.main_vm.common.code.MenuCategoryVo; +import com.icomsys.main_vm.common.code.MenuVo; +import com.icomsys.main_vm.common.code.enumresource.ActionResource; +import com.icomsys.main_vm.common.code.enumresource.MenuResource; +import com.icomsys.main_vm.db.jpa.entity.conversation.TbIcsLog; +import com.icomsys.main_vm.db.jpa.repo.system.TbIcsLogRepo; +import com.icomsys.main_vm.db.mybatis.alias.LoginVO; +import com.querydsl.core.QueryResults; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import org.springframework.web.servlet.view.json.MappingJackson2JsonView; + +import javax.servlet.http.HttpServletRequest; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; + +@Service +@Slf4j +@RequiredArgsConstructor +public class MonitoringWorkHistoryService { + + private final MappingJackson2JsonView ajaxMainView; + + private final TbIcsLogRepo tbIcsLogRepo; + + private final HttpServletRequest request; + + //작업이력 조회 + public QueryResults retrieveWorkHst(SearchWorkHstVo searchWorkHstVo) { + +// ModelAndView mv = new ModelAndView(ajaxMainView); +// +// List nList = tbIcsLogRepo.retrieveWorkHst(searchWorkHstVo); +// +// mv.addObject("nMap", nList); + + return tbIcsLogRepo.retrieveWorkHst(searchWorkHstVo); + } + + public List workhistoryMenuList() { + List result = new ArrayList<>(); + for (MenuResource e : MenuResource.LOGLIST) { + result.add(MenuVo.builder() + .authName(e.getName()) + .menuName(MenuResource.valueOf(e.getName()).getMenuDesc()) + .build()); + } + return result; + } + + public List workhistoryMenuCategoryList() { + List result = new ArrayList<>(); + for (ActionResource e : ActionResource.ALL) { + result.add(MenuCategoryVo.builder() + .categoryValue(e.getName()) + .typeName(e.getTypeName()) + .build()); + } + return result; + } + + public void createWorkHst(InsertWorkHstListVo insertWorkHstListVo) { + LoginVO resultVO = (LoginVO) request.getSession().getAttribute("LoginVO"); + + tbIcsLogRepo.save(TbIcsLog.builder() + .registDate(LocalDateTime.now()) + .userId(resultVO.getUserId()) + .actionCode(insertWorkHstListVo.getActionCode()) + .menuAuth(insertWorkHstListVo.getMenuAuth()) + .ip(getIP()) + .serviceGroup(insertWorkHstListVo.getServiceGroup()) + .remark(insertWorkHstListVo.getRemark()) + .build()); + } + + // ip 가져오기 + // IPv6로 가져오기 때문에 설정 필요함 + // https://gaemi606.tistory.com/entry/IntelliJ-IPv4-%EC%84%A4%EC%A0%95 + public String getIP() { + + String ip = request.getHeader("X-FORWARDED-FOR"); + + if (ip == null || ip.length() == 0) { + ip = request.getHeader("Proxy-Client-IP"); + } + if (ip == null || ip.length() == 0) { + ip = request.getHeader("WL-Proxy-Client-IP"); + } + if (ip == null || ip.length() == 0) { + ip = request.getRemoteAddr(); + } + + return ip; + } + + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/monitoring/service/impl/MonitoringConsultingServiceImpl.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/monitoring/service/impl/MonitoringConsultingServiceImpl.java new file mode 100644 index 0000000..e9af082 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/monitoring/service/impl/MonitoringConsultingServiceImpl.java @@ -0,0 +1,373 @@ +package com.icomsys.main_vm.biz.rcp.monitoring.service.impl; + +import com.icomsys.main_vm.biz.common.common.service.ExcelService; +import com.icomsys.main_vm.biz.common.login.service.LoginService; +import com.icomsys.main_vm.biz.rcp.monitoring.service.MonitoringConsultingService; +import com.icomsys.main_vm.common.code.enumresource.PolicyResource; +import com.icomsys.main_vm.db.mybatis.alias.MonitoringConsultingVO; +import com.icomsys.main_vm.db.mybatis.mapper.MonitoringConsultingMapper; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.apache.poi.ss.usermodel.*; +import org.apache.poi.xssf.usermodel.XSSFCell; +import org.apache.poi.xssf.usermodel.XSSFCellStyle; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; +import org.apache.poi.xssf.usermodel.XSSFSheet; +import org.apache.poi.xssf.usermodel.XSSFRow; +import org.json.JSONObject; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; +import software.amazon.awssdk.auth.credentials.InstanceProfileCredentialsProvider; +import software.amazon.awssdk.core.ResponseBytes; +import software.amazon.awssdk.regions.Region; +import software.amazon.awssdk.services.s3.S3Client; +import software.amazon.awssdk.services.s3.model.*; + +import javax.servlet.ServletOutputStream; +import javax.servlet.http.HttpServletResponse; +import java.io.*; +import java.lang.reflect.Field; +import java.net.InetAddress; +import java.net.UnknownHostException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.HashMap; +import java.util.List; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +@Slf4j +@Service +@RequiredArgsConstructor +public class MonitoringConsultingServiceImpl implements MonitoringConsultingService { + + private final HttpServletResponse httpServletResponse; + + private final LoginService loginService; + + @Value("${file.path}") + private String filePath; + + @Value("${feign.url.s3Bucket}") + private String s3Bucket; + + @Autowired + private MonitoringConsultingMapper monitoringConsultingMapper; + + @Override + public List consultingList(MonitoringConsultingVO vo) { + if (vo.getTelNo() != null && !"".equals(vo.getTelNo())) { + String telNo = ""; + telNo = vo.getTelNo().replace("-", ""); + vo.setTelNo(telNo.trim()); + } + + List result = monitoringConsultingMapper.selectConsultingList(vo); + + String telNo = ""; + + for (HashMap map : result) { + if (telNo.length() == 10) { + if (loginService.getSessionPolicy().contains(PolicyResource.privacymasking.getName())) { + telNo = String.valueOf(map.get("telNo")); + telNo = telNo.substring(0, 3) + "-" + telNo.substring(3, 6) + "-" + telNo.substring(6, telNo.length()); + map.put("originTelNo", telNo); + } + + telNo = String.valueOf(map.get("telNo")); + // telNo = telNo.substring(0, 3) + "-***-" + telNo.substring(6, telNo.length()); + telNo = telNo.substring(0, 3) + "-**" + telNo.substring(5, 6) + "-**" + telNo.substring(8, telNo.length()); + map.put("telNo", telNo); + } + else { + if (loginService.getSessionPolicy().contains(PolicyResource.privacymasking.getName())) { + telNo = String.valueOf(map.get("telNo")); + telNo = telNo.substring(0, 3) + "-" + telNo.substring(3, 7) + "-" + telNo.substring(7, telNo.length()); + map.put("originTelNo", telNo); + } + + telNo = String.valueOf(map.get("telNo")); + // telNo = telNo.substring(0, 3) + "-****-" + telNo.substring(7, telNo.length()); + telNo = telNo.substring(0, 3) + "-**" + telNo.substring(5, 7) + "-**" + telNo.substring(9, telNo.length()); + map.put("telNo", telNo); + } + } + + return result; + } + + @Override + public int selectConsultingListCnt(MonitoringConsultingVO vo) { + return monitoringConsultingMapper.selectConsultingListCnt(vo); + } + + @Override + public List selectRecordCallList(MonitoringConsultingVO vo) { + List hList = monitoringConsultingMapper.selectRecordCallList(vo); + this.checkRecordFileFromS3(hList); + return hList; + } + + @Override + public List selectScenarioSeqAndName(MonitoringConsultingVO vo) { + return monitoringConsultingMapper.selectScenarioSeqAndName(vo); + } + + @Override + public List selectCommonCodeAndDesc(MonitoringConsultingVO vo) { + return monitoringConsultingMapper.selectCommonCodeAndDesc(vo); + } + + @Override + public int selectUserCallCnt(MonitoringConsultingVO vo) { + return monitoringConsultingMapper.selectUserCallCnt(vo); + } + + private void checkRecordFileFromS3(List list) { + if ("local".equals(s3Bucket)) { + for (HashMap fMap : list) { // 대화 내용 리스트 + if (fMap.containsKey("recFilePath")) { + fMap.put("recFilePath", ""); + } + } + return; + } + + String bucketName = s3Bucket; // 버킷명 + + // 1. s3 client 생성 + S3Client s3 = S3Client.builder() + .region(Region.AP_NORTHEAST_2) + .credentialsProvider(InstanceProfileCredentialsProvider.create()) + .build(); + log.debug("s3Client create"); + + // 2. 버킷 내에 각 파일 확인 + for (HashMap fMap : list) { // 대화 내용 리스트 + if (fMap.containsKey("recFilePath")) { + String recFilePath = fMap.get("recFilePath").toString(); + + boolean isS3Object = false; + if (!"".equals(recFilePath)) { + recFilePath = recFilePath.substring(1); + List sList = listBucketObjects(s3,bucketName,recFilePath); // 버킷에 파일 찾기 + + for (S3Object myValue : sList) { + if (myValue.key().equals(recFilePath)) { + isS3Object = true; + log.info("name of the key " + myValue.key() + " exist"); + } + } + + if (!isS3Object) { + recFilePath = ""; + } + } + fMap.put("recFilePath",recFilePath); + } + } + } + + @Override + public String playRecordFileFromS3(String path) { + String bucketName = s3Bucket; // 버킷명 + path = path.replaceAll("%2F","/"); + + // 1. s3 client 생성 + S3Client s3 = S3Client.builder() + .region(Region.AP_NORTHEAST_2) + .credentialsProvider(InstanceProfileCredentialsProvider.create()) + .build(); + + // 2. 다운로드 된 파일인지 확인 + String fullPath = filePath + "recordfile/" + recordDownloadFileName(path); + + File file = new File(fullPath); + if (file.exists()) { + if (!file.isDirectory()) { + return recordServerFilePath(recordDownloadFileName(path)); + } + } + + // 3. 다운로드 되지 않은 경우 다운로드 진행 + return recordServerFilePath(downloadFileFromS3(path, s3, bucketName)); + + } + + private List listBucketObjects(S3Client s3, String bucketName, String path) { + + ListObjectsRequest listObjects = ListObjectsRequest + .builder() + .prefix(path) + .bucket(bucketName) + .build(); + + ListObjectsResponse res = s3.listObjects(listObjects); + + return res.contents(); + } + + private String downloadFileFromS3(String keyName, S3Client s3, String bucketName) { + SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd"); + Calendar c1 = Calendar.getInstance(); + + String fileFormat = filePath + "recordfile/"; + String fileName = recordDownloadFileName(keyName); + try { + + log.info("Downloading " + keyName + " from " + bucketName + "S3 bucket ..."); + + GetObjectRequest objectRequest = GetObjectRequest + .builder() + .key(keyName) + .bucket(bucketName) + .build(); + + ResponseBytes objectBytes = s3.getObjectAsBytes(objectRequest); + byte[] data = objectBytes.asByteArray(); + + File Folder = new File(fileFormat + sdf.format(c1.getTime())); + if (!Folder.exists()) { + try { + Folder.mkdirs(); + } catch (Exception e) { + log.debug("error_mkdir"); + e.getStackTrace(); + } + } + + File myFile = new File(fileFormat + fileName); + OutputStream os = new FileOutputStream(myFile); + + os.write(data); + log.debug("Successfully obtained " + keyName + " from an S3 object"); + os.close(); + + } catch (IOException ex) { + fileName = ""; + log.error(ex.getMessage()); + } catch (S3Exception e) { + fileName = ""; + log.error(e.awsErrorDetails().errorMessage()); + System.exit(1); + } + return fileName; + } + + private String recordDownloadFileName(String keyName) { + + SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd"); + Calendar c1 = Calendar.getInstance(); + String fileName = sdf.format(c1.getTime()) + "/"; + + String filePattern = "recordfile/[0-9]{8}/"; + Pattern pattern = Pattern.compile(filePattern); + Matcher match = pattern.matcher(keyName); + log.debug("pattern check" + keyName); + + if (match.find()) { + log.debug("record file Name :" + keyName.replaceAll(filePattern,"").trim()); + fileName = fileName + keyName.replaceAll(filePattern,"").trim(); + } + + return fileName; + } + + private String recordServerFilePath(String keyName) { + + InetAddress local; + String ip = ""; + try { + local = InetAddress.getLocalHost(); + ip = local.getHostAddress(); + } catch (UnknownHostException e1) { + e1.printStackTrace(); + } + + return "http://" + ip + ":8050/files/recordfile/" + keyName; + } + + @Override + public void ExcelDownload(String fileName, List data, List title) throws IOException { + XSSFWorkbook wb = new XSSFWorkbook(); + XSSFSheet sheet = wb.createSheet("Data"); + CreationHelper createHelper = wb.getCreationHelper(); + XSSFRow row = sheet.createRow(0); + XSSFCellStyle cellStyle1 = wb.createCellStyle(); + cellStyle1.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex()); + applyCellStyle(cellStyle1); + XSSFCellStyle cellStyle2 = wb.createCellStyle(); + cellStyle2.setFillForegroundColor(IndexedColors.WHITE.getIndex()); + applyCellStyle(cellStyle2); + AtomicInteger ai = new AtomicInteger(); + List keySet = new ArrayList<>(); + for (String e : title) { + XSSFCell c = row.createCell(ai.getAndIncrement()); + c.setCellValue(e); + c.setCellStyle(cellStyle1); + } + + // 컬럼 수 만큼 컬럼 width 기본 값으로 세팅 + for (int i=0; i selectBookmarkList(MonitoringConversationMarkVO vo) { + return conversationMarkMapper.selectBookmarkList(vo); + } + + @Override + public int selectBookmarkListCnt(MonitoringConversationMarkVO vo) { + return conversationMarkMapper.selectBookmarkListCnt(vo); + } + + @Override + public int insertBookmark(MonitoringConversationMarkVO vo) { + int result = 0; + + HashMap resultMap; + resultMap = conversationMarkMapper.checkBookmarkCnt(vo); + + String checkCnt = String.valueOf(resultMap.get("CNT")); + + if (!"0".equals(checkCnt)) { + vo.setMeasureType(""); + vo.setSeq((Long) resultMap.get("SEQ")); + vo.setUpdateId(loginService.getUserVo().getUserId()); + result = conversationMarkMapper.updateBookmark(vo); + } + else { + vo.setRegistId(loginService.getUserVo().getUserId()); + vo.setUpdateId(loginService.getUserVo().getUserId()); + + result = conversationMarkMapper.insertBookmark(vo); + } + + if (result > 0) { + logService.LogSave(LogVO.builder() + .menuAuth(MenuResource.valueOf(vo.getMenuVal())) + .actionCode(String.valueOf((ActionResource.insert))) + .serviceGroup(vo.getOprMngCode()) + .remark("대화책갈피 등록") + .build()); + } + + return result; + } + + @Override + public int updateBookmark(MonitoringConversationMarkVO vo) { + int result = 0; + + result = conversationMarkMapper.updateBookmark(vo); + + if (result > 0) { + logService.LogSave(LogVO.builder() + .menuAuth(MenuResource.valueOf(vo.getMenuVal())) + .actionCode(String.valueOf((ActionResource.delete))) + .serviceGroup(vo.getOprMngCode()) + .remark("[대화책갈피 삭제] - " + vo.getMeasureInfo()) + .build()); + } + + return result; + } + + @Override + public HashMap checkBookmarkCnt(MonitoringConversationMarkVO vo) { + vo.setChkMeasure("Y"); + + return conversationMarkMapper.checkBookmarkCnt(vo); + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/monitoring/service/impl/MonitoringOutscenarioServiceImpl.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/monitoring/service/impl/MonitoringOutscenarioServiceImpl.java new file mode 100644 index 0000000..ecc296b --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/monitoring/service/impl/MonitoringOutscenarioServiceImpl.java @@ -0,0 +1,53 @@ +package com.icomsys.main_vm.biz.rcp.monitoring.service.impl; + +import com.icomsys.main_vm.biz.rcp.monitoring.service.MonitoringOutscenarioService; +import com.icomsys.main_vm.db.mybatis.alias.MonitoringOutscenarioVO; +import com.icomsys.main_vm.db.mybatis.mapper.MonitoringOutscenarioMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +@Service +public class MonitoringOutscenarioServiceImpl implements MonitoringOutscenarioService { + + @Autowired + private MonitoringOutscenarioMapper monitoringOutscenarioMapper; + + @Override + public List selectOutscenarioList(MonitoringOutscenarioVO vo) { + List resultList = monitoringOutscenarioMapper.selectOutscenarioList(vo); + + int cnt = 0; + for (HashMap data: resultList) { + if (cnt == vo.getPageSize() && vo.getPage() != -1) { break; } // page -1 엑셀 다운로드일경우 전체 count + + vo.setScenarioSeq((Long)data.get("scenarioSeq")); + data.put("scenarioCnt", monitoringOutscenarioMapper.selectOutscenarioCnt(vo)); + cnt++; + } + return resultList; + } + + @Override + public int selectOutscenarioListCnt(MonitoringOutscenarioVO vo) { + return monitoringOutscenarioMapper.selectOutscenarioListCnt(vo); + } + + @Override + public List selectScenarioNameList(MonitoringOutscenarioVO vo) { + return monitoringOutscenarioMapper.selectScenarioNameList(vo); + } + + @Override + public List selectTokenListByScenario(MonitoringOutscenarioVO vo) { + return monitoringOutscenarioMapper.selectTokenListByScenario(vo); + } + + @Override + public List selectCallListByScenario(MonitoringOutscenarioVO vo) { + return monitoringOutscenarioMapper.selectCallListByScenario(vo); + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/monitoring/vo/ConsultingVO.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/monitoring/vo/ConsultingVO.java new file mode 100644 index 0000000..7bc6e11 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/monitoring/vo/ConsultingVO.java @@ -0,0 +1,95 @@ +package com.icomsys.main_vm.biz.rcp.monitoring.vo; + +public class ConsultingVO { + private String seq; + private String oprMngCodeName; + private String scenario; + private String callTime; + private String callInitDate; + private String callEndName; + private String telNo; + private String dnisNo; + private String userTalkCnt; + private String botTalkCnt; + + public String getSeq() { + return seq; + } + + public void setSeq(String seq) { + this.seq = seq; + } + + public String getOprMngCodeName() { + return oprMngCodeName; + } + + public void setOprMngCodeName(String oprMngCodeName) { + this.oprMngCodeName = oprMngCodeName; + } + + public String getScenario() { + return scenario; + } + + public void setScenario(String scenario) { + this.scenario = scenario; + } + + public String getCallTime() { + return callTime; + } + + public void setCallTime(String callTime) { + this.callTime = callTime; + } + + public String getCallInitDate() { + return callInitDate; + } + + public void setCallInitDate(String callInitDate) { + this.callInitDate = callInitDate; + } + + public String getCallEndName() { + return callEndName; + } + + public void setCallEndName(String callEndName) { + this.callEndName = callEndName; + } + + public String getTelNo() { + return telNo; + } + + public void setTelNo(String telNo) { + this.telNo = telNo; + } + + public String getDnisNo() { + return dnisNo; + } + + public void setDnisNo(String dnisNo) { + this.dnisNo = dnisNo; + } + + public String getUserTalkCnt() { + return userTalkCnt; + } + + public void setUserTalkCnt(String userTalkCnt) { + this.userTalkCnt = userTalkCnt; + } + + public String getBotTalkCnt() { + return botTalkCnt; + } + + public void setBotTalkCnt(String botTalkCnt) { + this.botTalkCnt = botTalkCnt; + } + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/monitoring/vo/ConversationMarkVO.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/monitoring/vo/ConversationMarkVO.java new file mode 100644 index 0000000..59c3eb2 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/monitoring/vo/ConversationMarkVO.java @@ -0,0 +1,49 @@ +package com.icomsys.main_vm.biz.rcp.monitoring.vo; + +public class ConversationMarkVO { + private String seq; + private String callInitDate; + private String errCodeType; + private String measureType; + private String talkText; + + public String getSeq() { + return seq; + } + + public void setSeq(String seq) { + this.seq = seq; + } + + public String getCallInitDate() { + return callInitDate; + } + + public void setCallInitDate(String callInitDate) { + this.callInitDate = callInitDate; + } + + public String getErrCodeType() { + return errCodeType; + } + + public void setErrCodeType(String errCodeType) { + this.errCodeType = errCodeType; + } + + public String getMeasureType() { + return measureType; + } + + public void setMeasureType(String measureType) { + this.measureType = measureType; + } + + public String getTalkText() { + return talkText; + } + + public void setTalkText(String talkText) { + this.talkText = talkText; + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/monitoring/vo/InsertWorkHstListVo.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/monitoring/vo/InsertWorkHstListVo.java new file mode 100644 index 0000000..ce7591a --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/monitoring/vo/InsertWorkHstListVo.java @@ -0,0 +1,14 @@ +package com.icomsys.main_vm.biz.rcp.monitoring.vo; + +import lombok.Data; + +@Data +public class InsertWorkHstListVo { + private String registDate; + private String serviceGroup; + private String userId; + private String menuAuth; + private String actionCode; + private String ip; + private String remark; +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/monitoring/vo/IntentAnalysisVO.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/monitoring/vo/IntentAnalysisVO.java new file mode 100644 index 0000000..f1fad79 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/monitoring/vo/IntentAnalysisVO.java @@ -0,0 +1,58 @@ +package com.icomsys.main_vm.biz.rcp.monitoring.vo; + +public class IntentAnalysisVO { + private String seq; + private String talkText; + private String intentName; + private String score; + private String intentResult; + private String callInitDate; + + public String getSeq() { + return seq; + } + + public void setSeq(String seq) { + this.seq = seq; + } + + public String getTalkText() { + return talkText; + } + + public void setTalkText(String talkText) { + this.talkText = talkText; + } + + public String getIntentName() { + return intentName; + } + + public void setIntentName(String intentName) { + this.intentName = intentName; + } + + public String getScore() { + return score; + } + + public void setScore(String score) { + this.score = score; + } + + public String getIntentResult() { + return intentResult; + } + + public void setIntentResult(String intentResult) { + this.intentResult = intentResult; + } + + public String getCallInitDate() { + return callInitDate; + } + + public void setCallInitDate(String callInitDate) { + this.callInitDate = callInitDate; + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/monitoring/vo/OutScenarioVO.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/monitoring/vo/OutScenarioVO.java new file mode 100644 index 0000000..053c1db --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/monitoring/vo/OutScenarioVO.java @@ -0,0 +1,40 @@ +package com.icomsys.main_vm.biz.rcp.monitoring.vo; + +public class OutScenarioVO { + private String oprMngCodeName; + private String scenarioName; + private String nodeName; + private String nodePercent; + + public String getOprMngCodeName() { + return oprMngCodeName; + } + + public void setOprMngCodeName(String oprMngCodeName) { + this.oprMngCodeName = oprMngCodeName; + } + + public String getScenarioName() { + return scenarioName; + } + + public void setScenarioName(String scenarioName) { + this.scenarioName = scenarioName; + } + + public String getNodeName() { + return nodeName; + } + + public void setNodeName(String nodeName) { + this.nodeName = nodeName; + } + + public String getNodePercent() { + return nodePercent; + } + + public void setNodePercent(String nodePercent) { + this.nodePercent = nodePercent; + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/monitoring/vo/RecordDownloadVO.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/monitoring/vo/RecordDownloadVO.java new file mode 100644 index 0000000..5ad39e3 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/monitoring/vo/RecordDownloadVO.java @@ -0,0 +1,31 @@ +package com.icomsys.main_vm.biz.rcp.monitoring.vo; + +public class RecordDownloadVO { + private String fileName; + private String menuVal; + private String oprMngCode; + + public String getFileName() { + return fileName; + } + + public void setFileName(String fileName) { + this.fileName = fileName; + } + + public String getMenuVal() { + return menuVal; + } + + public void setMenuVal(String menuVal) { + this.menuVal = menuVal; + } + + public String getOprMngCode() { + return oprMngCode; + } + + public void setOprMngCode(String oprMngCode) { + this.oprMngCode = oprMngCode; + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/monitoring/vo/RetrieveWorkHstListVo.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/monitoring/vo/RetrieveWorkHstListVo.java new file mode 100644 index 0000000..215df00 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/monitoring/vo/RetrieveWorkHstListVo.java @@ -0,0 +1,72 @@ +package com.icomsys.main_vm.biz.rcp.monitoring.vo; + +import com.icomsys.main_vm.common.code.enumresource.ActionResource; +import com.icomsys.main_vm.common.code.enumresource.MenuResource; +import lombok.*; + +import java.time.LocalDate; +import java.time.LocalDateTime; + + +@Setter +@NoArgsConstructor +public class RetrieveWorkHstListVo { + private Long seq; + private String registDate; + private String menuAuth; + private String actionCode; + private String userId; + private String userName; + private String ip; + private String remark; + private String serviceGroup; + + @Builder + public RetrieveWorkHstListVo(Long seq, String registDate, String menuAuth, String actionCode, String userId, String userName, String ip, String remark, String serviceGroup) { + this.seq = seq; + this.registDate = registDate; + this.menuAuth = menuAuth; + this.actionCode = actionCode; + this.userId = userId; + this.userName = userName; + this.ip = ip; + this.remark = remark; + this.serviceGroup = serviceGroup; + } + + public Long getSeq() { + return seq; + } + + public String getRegistDate() { + return registDate; + } + + public String getMenuName() { + return MenuResource.valueOf(this.menuAuth).getMenuDesc(); + } + + public String getActionCode() { + return ActionResource.valueOf(this.actionCode).getTypeName(); + } + + public String getUserId() { + return userId; + } + + public String getUserName() { + return userName; + } + + public String getIp() { + return ip; + } + + public String getRemark() { + return remark; + } + + public String getServiceGroup() { + return serviceGroup; + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/monitoring/vo/SearchWorkHstVo.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/monitoring/vo/SearchWorkHstVo.java new file mode 100644 index 0000000..86b9867 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/monitoring/vo/SearchWorkHstVo.java @@ -0,0 +1,21 @@ +package com.icomsys.main_vm.biz.rcp.monitoring.vo; + +import lombok.Data; + +@Data +public class SearchWorkHstVo { + + private String userId; + private String userName; + private String ip; + private String remark; + private String menuName; + private String menuCategory; + private String serviceGroup; + private String startDate; + private String endDate; + private String searchKey1; + private String codeText; + private int size; + private int page; +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/oprManage/OprManageBgmController.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/oprManage/OprManageBgmController.java new file mode 100644 index 0000000..e8c3369 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/oprManage/OprManageBgmController.java @@ -0,0 +1,178 @@ +package com.icomsys.main_vm.biz.rcp.oprManage; + + +import com.icomsys.main_vm.biz.rcp.oprManage.service.OprManageBgmService; +import com.icomsys.main_vm.biz.common.login.service.LoginService; +import com.icomsys.main_vm.db.jpa.entity.oprManage.TbBgmMng; +import com.icomsys.main_vm.biz.rcp.oprManage.vo.OprManageBgmVO; +import com.icomsys.main_vm.db.jpa.repo.oprManage.TbBgmMngRepo; +import com.icomsys.main_vm.db.mybatis.alias.OprManageBgmListVo; +import com.querydsl.core.QueryResults; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.multipart.MultipartHttpServletRequest; +import org.springframework.web.servlet.ModelAndView; +import org.springframework.web.servlet.view.json.MappingJackson2JsonView; + +import javax.servlet.http.HttpServletRequest; +import java.io.*; +import java.text.SimpleDateFormat; +import java.time.LocalDateTime; +import java.util.*; +import java.util.concurrent.atomic.AtomicInteger; + +@Controller +@Slf4j +@RequiredArgsConstructor +@RequestMapping("/admin/rcp/oprmanage") +public class OprManageBgmController { + + private final LoginService loginService; + + @Autowired + private final OprManageBgmService oprManageBgmService; + private final TbBgmMngRepo tbBgmMngRepo; + private final Logger logger = LoggerFactory.getLogger(this.getClass()); + + @Value("${feign.url.bgmpath}") + private String bgmPath; + + @GetMapping("/bgm/manage.do") + public String bgmManageView(){ + return "/adm/rcp/oprmanage/bgm"; + } + + @GetMapping("/bgm/manage2.do") + public String bgmManageView2(){ + return "/adm/rcp/oprmanage/bgm2"; + } + + + + + @PostMapping("/bgm/upload-local") + @ResponseBody + public ResponseEntity uploadFile(@RequestParam("file") MultipartFile file) { + try { + File path = new File("C:\\Users\\hyunj\\Downloads\\target_wav\\" + file.getOriginalFilename()); + path.createNewFile(); + FileOutputStream output = new FileOutputStream(path); + output.write(file.getBytes()); + output.close(); + return new ResponseEntity<>("file Upload", HttpStatus.OK); + //return ResponseHandler.generateResponse("File is uploaded successfully!", HttpStatus.OK, path); + } catch (Exception e) { + e.printStackTrace(); + return new ResponseEntity<>("Invalid file format.", HttpStatus.BAD_REQUEST); + //return ResponseHandler.generateResponse(e.getMessage(), HttpStatus.MULTI_STATUS, null); + } + } + + public int insertBGM(OprManageBgmVO vo,String fileName) { + //if (!tbBgmMngRepo.existsByUserId("sysadmin")) { + + TbBgmMng save1 = TbBgmMng.builder() + .registId(vo.getRegistId()) + .custCode(vo.getCustCode()) + .fileName(fileName) + .filePath("files/" + bgmPath) + .registDate(LocalDateTime.now().toString()) + .build(); + tbBgmMngRepo.save(save1); + //} + + int result = 1; + return result; + } + + + @GetMapping("/bgm/list.do") + @ResponseBody + public QueryResults selectBgmList(HttpServletRequest req, OprManageBgmVO vo) { + String searchKeyword = req.getParameter("searchKeyword"); + vo.setSearchKeyword(searchKeyword); + + QueryResults result = tbBgmMngRepo.selectBgmList(vo); + + return result; + } + + /* + @GetMapping("/bgm/list.do") + @ResponseBody + public List bgmList(@RequestBody OprManageBgmListVo vo) { + List result = oprManageBgmService.selectBgmList(vo); + + return result; + } + */ + + @RequestMapping(value = "/bgm/play.do", method = {RequestMethod.GET, RequestMethod.POST}) + @ResponseBody + public String playRecordFile(@RequestBody String fileName) { + + return oprManageBgmService.playRecordFileFromS3(fileName); + } + + @javax.annotation.Resource + MappingJackson2JsonView ajaxMainView; + @PostMapping(value ="/bgm/upload.do") + @ResponseBody + public ModelAndView uploadWav(MultipartHttpServletRequest request, OprManageBgmVO vo) { + + vo.setCustCode(loginService.getUserVo().getCustCode()); + vo.setRegistId(loginService.getUserVo().getUserId()); + ModelAndView mv = new ModelAndView(ajaxMainView); + + List files = request.getFiles("fileList"); + boolean result = true; + String message = "저장되었습니다."; + + try { + Map mfiles = request.getFileMap(); + + Iterator> itr = mfiles.entrySet().iterator(); + + MultipartFile mFile; + + List fileNameList = oprManageBgmService.uploadBgm(files); + //로컬테스트시 파일리스트 임의추가 +// List fileNameList = new ArrayList<>(); +// fileNameList.add("filaName4"); +// fileNameList.add("filaName5"); +// fileNameList.add("filaName6"); + log.info(fileNameList.toString()); + + boolean finalResult = result; + String finalMessage = message; + AtomicInteger idx = new AtomicInteger(); + fileNameList.forEach(filename -> { + log.info("filename123 : " + filename); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + Date now = new Date(); + String nowTime = sdf.format(now); + + insertBGM(vo, filename); + + }); + + } catch(Exception e) { + result = false; + message = "처리도중 오류가 발생했습니다."; + log.error("error upload excel", e); + } + + + return mv; + } + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/oprManage/OprManageNlpSettingController.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/oprManage/OprManageNlpSettingController.java new file mode 100644 index 0000000..5d5f452 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/oprManage/OprManageNlpSettingController.java @@ -0,0 +1,80 @@ +package com.icomsys.main_vm.biz.rcp.oprManage; + +import com.icomsys.main_vm.biz.rcp.conversation.service.NlpSettingService; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Controller; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.servlet.ModelAndView; + +import javax.servlet.http.HttpServletRequest; +import java.util.Map; + +@Controller +@Transactional +@Slf4j +@RequiredArgsConstructor +@RequestMapping("/admin/rcp/oprmanage") +public class OprManageNlpSettingController { + + + private final NlpSettingService nlpSettingService; + + @GetMapping("/nlpSetting/manage.do") + public String NlpSettingView(){ + return "adm/rcp/oprmanage/nlpSetting"; + } + + /** + * @Name serviceNameList + * @Description 유사도 조회 + * @Author 유관선 + * @CreateDate 2022. 5. 25. + */ + @RequestMapping("/nlpSetting/selectSimilarityCriteria.do") + public ModelAndView similarityCriteria(@RequestParam Map dataMap) { + + log.info("dataMap -> {}", dataMap); + return nlpSettingService.similarityCriteria(dataMap); + } + + /** + * @Name serviceNameList + * @Description 프로젝트 설정 업데이트 + * @Author 유관선 + * @CreateDate 2022. 5. 25. + */ + + @RequestMapping("/nlpSetting/updateSimilarityCriteria.do") + public ModelAndView updateUser(@RequestParam Map dataMap) { + return nlpSettingService.updateUser(dataMap); + } + + /** + * @Name trainingStartApi + * @Description 시뮬레이터 학습 시작 API + * @Author dongheejang + * @CreateDate 2022. 10. 6. + */ + @RequestMapping(value = "/nlpSetting/trainingStart.do", method = RequestMethod.GET) + @ResponseBody + public ModelAndView trainingStartApi(HttpServletRequest request, @RequestParam String serviceGroup, String custCode) { + + return nlpSettingService.trainingStart(custCode + "_RCP_" + serviceGroup); + } + + /** + * @Name trainingApplyApi + * @Description 시뮬레이터 모델 반영 API + * @Author dongheejang + * @CreateDate 2022. 10. 6. + */ + @RequestMapping(value = "/nlpSetting/trainingApply.do", method = RequestMethod.GET) + @ResponseBody + public ModelAndView trainingApplyApi(HttpServletRequest request, @RequestParam String serviceGroup, String custCode) { + + return nlpSettingService.trainingApply(custCode + "_RCP_" + serviceGroup); + } + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/oprManage/OprManageTTSTagController.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/oprManage/OprManageTTSTagController.java new file mode 100644 index 0000000..27b0ae4 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/oprManage/OprManageTTSTagController.java @@ -0,0 +1,71 @@ +package com.icomsys.main_vm.biz.rcp.oprManage; + +import com.icomsys.main_vm.biz.common.login.res.UserVo; +import com.icomsys.main_vm.biz.common.system.vo.DslDataTableRes; +import com.icomsys.main_vm.biz.common.system.vo.SystemBotTtsTagVo; +import com.icomsys.main_vm.biz.common.system.vo.SystemCommoncodeReq; +import com.icomsys.main_vm.biz.common.system.vo.SystemCommoncodeRes; +import com.icomsys.main_vm.biz.rcp.oprManage.service.OprManageTTSTagService; +import com.icomsys.main_vm.db.jpa.entity.system.TbBotCommonCode; +import com.icomsys.main_vm.db.jpa.repo.oprManage.TbBotTtsTagRepo; +import com.icomsys.main_vm.db.jpa.repo.system.TbBotCommonCodeRepo; +import com.icomsys.main_vm.db.mybatis.alias.LoginVO; +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 org.springframework.web.servlet.ModelAndView; +import org.springframework.web.servlet.view.json.MappingJackson2JsonView; + +import javax.servlet.http.HttpServletRequest; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@Controller +@Slf4j +@RequiredArgsConstructor +@RequestMapping("/admin/rcp/oprmanage") +public class OprManageTTSTagController { + + private final TbBotTtsTagRepo tbBotTtsTagRepo; + private final TbBotCommonCodeRepo tbBotCommonCodeRepo; + private final OprManageTTSTagService oprManageTTSTagService; + private final MappingJackson2JsonView ajaxMainView; + + @GetMapping("/ttstag/manage.do") + public String ttsTag() { + return "/adm/rcp/oprmanage/ttstag"; + } + + @ResponseBody + @RequestMapping(value = "/ttstag/ttsproduct.do",method = RequestMethod.GET) + public DslDataTableRes ttsProduct(HttpServletRequest request, @RequestParam String custCode, String serviceGroup) { + LoginVO resultVO = (LoginVO) request.getSession().getAttribute("LoginVO"); + UserVo userVo = new UserVo(); + userVo.setRoleVal(resultVO.getAuthCode()); + SystemCommoncodeReq dto = new SystemCommoncodeReq(); + dto.setUserVo(userVo); + dto.setServiceGroup(serviceGroup); + dto.setOprmngCode(custCode + "_RCP_" + serviceGroup); + dto.setCodeType("TTS_PRODUCT"); + QueryResults result = tbBotCommonCodeRepo.SystemCommoncodeProductList(dto); + + return new DslDataTableRes(result); + } + + @RequestMapping(value = "/ttstag/ttstaglist.do",method = {RequestMethod.GET, RequestMethod.POST}) + public ModelAndView ttsTagList(@RequestParam Map dataMap) { + ModelAndView mv = new ModelAndView(ajaxMainView); + List list = oprManageTTSTagService.selectTtsTagListService(dataMap); + mv.addObject("list", list); + return mv; + } + + @RequestMapping(value = "/ttstag/updatettstag.do",method = {RequestMethod.GET, RequestMethod.POST}) + public ModelAndView updateTtsTag(HttpServletRequest request, @RequestBody SystemBotTtsTagVo vo) { + return oprManageTTSTagService.updateTtsTagListService(request, vo); + } + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/oprManage/dto/BgmDto.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/oprManage/dto/BgmDto.java new file mode 100644 index 0000000..4bcb1d2 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/oprManage/dto/BgmDto.java @@ -0,0 +1,42 @@ +package com.icomsys.main_vm.biz.rcp.oprManage.dto; + +import com.icomsys.main_vm.db.jpa.entity.oprManage.TbBgmMng; +import lombok.Builder; +import lombok.Getter; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +import java.io.Serializable; +import java.util.List; + +@Getter +@Setter +@RequiredArgsConstructor +public class BgmDto implements Serializable { + private String fileName; + private String filePath; + private String custCode; + private String registId; + private String registDate; + + private List bgmDtoList; + + + @Builder + public BgmDto(String fileName, String filePath, String custCode, String registId, String registDate) { + this.fileName = fileName; + this.filePath = filePath; + this.custCode = custCode; + this.registId = registId; + this.registDate = registDate; + } + + public TbBgmMng toEntity() { + return TbBgmMng.builder() + .fileName(fileName) + .filePath(filePath) + .custCode(custCode) + .registId(registId) + .build(); + } +} \ No newline at end of file diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/oprManage/service/OprManageBgmService.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/oprManage/service/OprManageBgmService.java new file mode 100644 index 0000000..bfbb1d9 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/oprManage/service/OprManageBgmService.java @@ -0,0 +1,21 @@ +package com.icomsys.main_vm.biz.rcp.oprManage.service; + +import com.icomsys.main_vm.biz.rcp.oprManage.vo.OprManageBgmVO; +import org.springframework.stereotype.Service; +import org.springframework.web.multipart.MultipartFile; + +import java.util.List; + +@Service +public interface OprManageBgmService { + int insertBgm(OprManageBgmVO vo); + public List uploadBgm(List multipartFile); + String playRecordFileFromS3(String path); + //public String putS3Object(S3Client s3, String objectKey, byte[] bytes /* String objectPath*/); + + //public void upload(File file); + + //List selectBgmList(); + + //QueryResults selectBgmList(OprManageBgmVO vo); +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/oprManage/service/OprManageBgmService2.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/oprManage/service/OprManageBgmService2.java new file mode 100644 index 0000000..6e44ec0 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/oprManage/service/OprManageBgmService2.java @@ -0,0 +1,187 @@ +package com.icomsys.main_vm.biz.rcp.oprManage.service; + +import com.icomsys.main_vm.biz.rcp.oprManage.dto.BgmDto; +import com.icomsys.main_vm.db.jpa.entity.oprManage.TbBgmMng; +import com.icomsys.main_vm.db.jpa.repo.oprManage.TbBgmMngRepo; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.multipart.MultipartHttpServletRequest; +import org.springframework.web.servlet.ModelAndView; +import org.springframework.web.servlet.view.json.MappingJackson2JsonView; + +import javax.annotation.Resource; +import javax.transaction.Transactional; +import java.io.File; +import java.io.IOException; +import java.nio.file.FileAlreadyExistsException; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.text.SimpleDateFormat; +import java.util.*; + +@Service +@Slf4j +@RequiredArgsConstructor +public class OprManageBgmService2 { + + @Autowired + private final TbBgmMngRepo tbBgmMngRepo; + + @Transactional + public String saveFile(MultipartFile file, BgmDto bgmDto) { + //file save logic implement + //if not exist folder, make new directory + File fileFolder = new File(bgmDto.getFilePath()); + + try { + if (!fileFolder.exists()) { + if (fileFolder.mkdir()) { + log.info("[file mkdirs] : Success"); + } else { + log.error("[file mkdirs] : Fail"); + } + } + + String saveFileName = bgmDto.getFileName(); + String saveFilePath = bgmDto.getFilePath() + File.separator + bgmDto.getFileName(); + + File saveFile = new File(saveFilePath); + if (saveFile.isFile()) { + + boolean _exist = true; + + int index = 0; + + // 중복 파일 검사 + while (_exist) { + index++; + + String fileName = file.getOriginalFilename(); + String fileCutName = fileName.substring(0, fileName.lastIndexOf(".")); + String fileExt = fileName.substring(fileName.lastIndexOf(".") + 1); + + saveFileName = fileCutName + "_" + index + "." + fileExt; + String dictFile = bgmDto.getFilePath() + File.separator + saveFileName; + _exist = new File(dictFile).isFile(); + + if (!_exist) { + saveFilePath = dictFile; + } + } + file.transferTo(new File(saveFilePath)); + } else { + file.transferTo(saveFile); + } + } catch (Exception e) { + log.error("save file error", e); + } + + return tbBgmMngRepo.save(bgmDto.toEntity()).getFileName(); + } + + // 전체 조회 + @Transactional + public ModelAndView searchFiles(Map dataMap) { + ModelAndView mv = new ModelAndView(ajaxMainView); + HashMap emap = new HashMap(); + emap.putAll(dataMap); + + var fileList = tbBgmMngRepo.findAll(); + + mv.addObject("fileList", fileList); + return mv; + } + + // 파일명 조회 + @Transactional + public BgmDto searchFile(String filename) { + TbBgmMng file = tbBgmMngRepo.findById(filename).get(); + + BgmDto bgmDto = BgmDto.builder() + .fileName(file.getFileName()) + .filePath(file.getFilePath()) + .custCode(file.getCustCode()) + .registId(file.getRegistId()) +// .registDate(file.getRegistDate()) + .build(); + return bgmDto; + } + + + public Optional findByFilename(String s) { + return tbBgmMngRepo.findById(s); + } + + + + @Resource + MappingJackson2JsonView ajaxMainView; + + public void insertInferenceExcel(MultipartHttpServletRequest request, HashMap eMap) throws Exception { + // excel 관련 + MultipartFile file = request.getFile("upFile"); + List testList = this.readExcelFile(file); + + // file 관련 + Calendar c = Calendar.getInstance(); + c.clear(); + c.setTime(new Date()); + SimpleDateFormat sdfForPath = new SimpleDateFormat("yyyy\\MM\\"); + + // DB저장 데이터 및 파일 데이터 + String uploadfileName = file.getOriginalFilename(); + String uploadFilePath = StringUtils.join(sdfForPath.format(c.getTime())); + String testCnt = Integer.toString(testList.size()); + + // 업로드 파일 저장 + this.createDirs(uploadFilePath); + File uploadFIle = new File(StringUtils.join(uploadFilePath, uploadfileName)); + file.transferTo(uploadFIle); + + eMap.put("uploadFileName", uploadfileName); + eMap.put("uploadFilePath", uploadFilePath); + eMap.put("testCnt", testCnt); + + log.info("# UPLOAD PATH : {}", uploadFilePath); + log.info("# MAP : {}", eMap.toString()); + +// // 성공 +// if(StringUtils.equals(returnCode, "000")) { +// eMap.put("testResult", testResult); +// +// } +// // 실패 +// else { +// eMap.put("testResult", testResult); +// } + } + + + + /** + * 파일 저장 디렉토리 생성 + */ + private void createDirs(String path) throws IOException { + try { + Files.createDirectories(Paths.get(path)); + } catch(FileAlreadyExistsException faee) { + log.info("이미 존재하는 디렉토리 입니다."); + } + } + + /** + * 유저가 업로드한 엑셀 파일 Read + */ + private List readExcelFile(MultipartFile file) throws IOException { + + List testList = new ArrayList(); + + return testList; + } + + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/oprManage/service/OprManageTTSTagService.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/oprManage/service/OprManageTTSTagService.java new file mode 100644 index 0000000..75d7562 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/oprManage/service/OprManageTTSTagService.java @@ -0,0 +1,81 @@ +package com.icomsys.main_vm.biz.rcp.oprManage.service; + +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.system.vo.SystemBotTtsTagVo; +import com.icomsys.main_vm.common.code.enumresource.ActionResource; +import com.icomsys.main_vm.common.code.enumresource.MenuResource; +import com.icomsys.main_vm.db.jpa.entity.oprManage.TbBotTtsTag; +import com.icomsys.main_vm.db.jpa.repo.oprManage.TbBotTtsTagRepo; +import com.icomsys.main_vm.db.mybatis.alias.LoginVO; +import com.icomsys.main_vm.db.mybatis.mapper.BotTTSTagMapper; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import org.springframework.web.servlet.ModelAndView; +import org.springframework.web.servlet.view.json.MappingJackson2JsonView; + +import javax.servlet.http.HttpServletRequest; +import java.time.LocalDateTime; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@Service +@Slf4j +@RequiredArgsConstructor +public class OprManageTTSTagService { + + private final BotTTSTagMapper botTTSTagMapper; + private final MappingJackson2JsonView ajaxMainView; + private final TbBotTtsTagRepo tbBotTtsTagRepo; + private final LogService logService; + + + public List selectTtsTagListService(Map dataMap) { + HashMap eMap = new HashMap(); + eMap.putAll(dataMap); + return botTTSTagMapper.selectTtsTagList(eMap); + } + + public ModelAndView updateTtsTagListService(HttpServletRequest request, SystemBotTtsTagVo vo) { + ModelAndView mv = new ModelAndView(ajaxMainView); + + try { + LoginVO resultVO = (LoginVO) request.getSession().getAttribute("LoginVO"); + vo.setUpdateId(resultVO.getUserId()); + SystemBotTtsTagVo getVo = tbBotTtsTagRepo.existsById(vo); + if (getVo == null) { + vo.setRegistId(resultVO.getUserId()); + vo.setRegistDate(LocalDateTime.now()); + } else { + vo.setRegistId(getVo.getRegistId()); + vo.setRegistDate(getVo.getRegistDate()); + } + tbBotTtsTagRepo.save(TbBotTtsTag.builder() + .ttsProdCode(vo.getTtsProdCode()) + .tagCode(vo.getTagCode()) + .ttsStartTag(vo.getTtsStartTag()) + .ttsEndTag(vo.getTtsEndTag()) + .registId(vo.getRegistId()) + .registDate(vo.getRegistDate()) + .updateId(vo.getUpdateId()) + .updateDate(LocalDateTime.now()) + .build()); + +/* logService.LogSave(LogVO.builder() + .menuAuth(MenuResource.rcpoprmanagettstagmanage) + .actionCode(String.valueOf((ActionResource.update))) + .serviceGroup("-") + .build());*/ + + mv.addObject("result", true); + mv.addObject("message", "정상적으로 저장되었습니다."); + } catch (Exception e) { + mv.addObject("result", false); + mv.addObject("message", "실패하였습니다."); + } + + return mv; + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/oprManage/service/impl/OprManageBgmServiceImpl.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/oprManage/service/impl/OprManageBgmServiceImpl.java new file mode 100644 index 0000000..2f411f9 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/oprManage/service/impl/OprManageBgmServiceImpl.java @@ -0,0 +1,281 @@ +package com.icomsys.main_vm.biz.rcp.oprManage.service.impl; + +import com.icomsys.main_vm.biz.rcp.oprManage.service.OprManageBgmService; +import com.icomsys.main_vm.biz.rcp.oprManage.vo.OprManageBgmVO; +import com.icomsys.main_vm.db.mybatis.mapper.BgmManageMapper; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; +import org.springframework.web.multipart.MultipartFile; +import software.amazon.awssdk.auth.credentials.InstanceProfileCredentialsProvider; +import software.amazon.awssdk.core.ResponseBytes; +import software.amazon.awssdk.core.sync.RequestBody; +import software.amazon.awssdk.regions.Region; +import software.amazon.awssdk.services.s3.S3Client; +import software.amazon.awssdk.services.s3.model.*; + +import java.io.*; +import java.net.InetAddress; +import java.net.URLDecoder; +import java.net.UnknownHostException; +import java.text.SimpleDateFormat; +import java.util.*; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +@Service +@Slf4j +@RequiredArgsConstructor +public class OprManageBgmServiceImpl implements OprManageBgmService { + + @Value("${file.path}") + private String filePath; + + @Value("${feign.url.bgmpath}") + private String bgmPath; + + @Value("${feign.url.s3Bucket}") + private String s3Bucket; + + + @Autowired + private BgmManageMapper bgmManageMapper; + + @Override + public int insertBgm(OprManageBgmVO vo) { + return bgmManageMapper.insertBgm(vo); + + } + + public List uploadBgm(List multipartFile) { + List fileNameList = new ArrayList<>(); + + //s3클라이언트 인스턴스 생성 + S3Client s3 = S3Client.builder() + .region(Region.AP_NORTHEAST_2) + .credentialsProvider(InstanceProfileCredentialsProvider.builder().build()) + .build(); + + multipartFile.forEach(file -> + { + String fileName = file.getOriginalFilename(); + log.info("fileName : " + fileName); + + try (InputStream inputStream = file.getInputStream()) { + + //PutObjectRequest 생성 + PutObjectRequest putObjectRequest = PutObjectRequest.builder() + .bucket(s3Bucket) + .key(bgmPath + fileName) + //.acl(ObjectCannedACL.PUBLIC_READ) + .contentType(file.getContentType()) + .contentLength(file.getSize()) + .build(); + fileNameList.add(fileName); + PutObjectResponse response = s3.putObject(putObjectRequest, RequestBody.fromBytes(file.getBytes())); + + } catch (Exception e) { + e.printStackTrace(); +// throw new ResponseStatusException(HttpStatus.INTERNAL_SERVER_ERROR, "업로드에 실패했습니다."); + } + //fileNameList.add(awsImgUrl+fileName); + //fileNameList.add(s3Bucket + "/filepath"); + }); + + return fileNameList; + } + + /* + + @Override + public List selectBgmList(OprManageBgmListVo vo) { + List oprManageBgmList = bgmManageMapper.selectBgmList(vo); + return oprManageBgmList; + } + + */ + + + + /* + @Override + public List selectBgmList(OprManageBgmListVo vo) { + return bgmManageMapper.selectBgmList(vo); + } + */ + +/* + @Override + public void checkRecordFileFromS3(List list) { + if ("local".equals(s3Bucket)) { + for (HashMap fMap : list) { // 대화 내용 리스트 + if (fMap.containsKey("bgmFilePath")) { + fMap.put("bgmFilePath", ""); + } + } + return; + } + + String bucketName = s3Bucket; // 버킷명 + + // 1. s3 client 생성 + S3Client s3 = S3Client.builder() + .region(Region.AP_NORTHEAST_2) + .credentialsProvider(InstanceProfileCredentialsProvider.create()) + .build(); + log.debug("s3Client create"); + + // 2. 버킷 내에 각 파일 확인 + for (HashMap fMap : list) { // 대화 내용 리스트 + if (fMap.containsKey("bgmFilePath")) { + String recFilePath = fMap.get("bgmFilePath").toString(); + + boolean isS3Object = false; + if (!"".equals(recFilePath)) { + recFilePath = recFilePath.substring(1); + List sList = listBucketObjects(s3,bucketName,recFilePath); // 버킷에 파일 찾기 + + for (S3Object myValue : sList) { + if (myValue.key().equals(recFilePath)) { + isS3Object = true; + log.info("name of the key " + myValue.key() + " exist"); + } + } + + if (!isS3Object) { + recFilePath = ""; + } + } + fMap.put("recFilePath",recFilePath); + } + } + }*/ + + @Override + public String playRecordFileFromS3(String path) { + String bucketName = s3Bucket; // 버킷명 + + // 1. s3 client 생성 + S3Client s3 = S3Client.builder() + .region(Region.AP_NORTHEAST_2) + .credentialsProvider(InstanceProfileCredentialsProvider.create()) + .build(); + + // 2. 다운로드 된 파일인지 확인 + String fullPath = filePath + "bgmfile/" + recordDownloadFileName(path); + log.info("fullPath : " + fullPath); + File file = new File(fullPath); + if (file.exists()) { + if (!file.isDirectory()) { + return recordServerFilePath(recordDownloadFileName(path)); + } + } + + // 3. 다운로드 되지 않은 경우 다운로드 진행 + return recordServerFilePath(downloadFileFromS3(path, s3, bucketName)); + + } + + private List listBucketObjects(S3Client s3, String bucketName, String path) { + + ListObjectsRequest listObjects = ListObjectsRequest + .builder() + .prefix(path) + .bucket(bucketName) + .build(); + + ListObjectsResponse res = s3.listObjects(listObjects); + + return res.contents(); + } + + private String downloadFileFromS3(String keyName, S3Client s3, String bucketName) { + SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd"); + Calendar c1 = Calendar.getInstance(); + + String fileFormat = filePath + "bgmfile/"; + //String fileName = recordDownloadFileName(keyName); + String fileName; + try { + + log.debug("Downloading " + keyName + " from " + bucketName + "S3 bucket ..."); + + int beginIndex = keyName.lastIndexOf("%2F")+3; + int endIndex = keyName.length(); + String result = keyName.substring(beginIndex, endIndex); + String keyName2 = URLDecoder.decode(bgmPath + result, "UTF-8"); + fileName = result; + log.info("keyname : " + keyName); + log.info("keyname2 : " + keyName2); + GetObjectRequest objectRequest = GetObjectRequest + .builder() + .key(keyName2) + .bucket(bucketName) + .build(); + log.info("key fin"); + ResponseBytes objectBytes = s3.getObjectAsBytes(objectRequest); + byte[] data = objectBytes.asByteArray(); + + File Folder = new File(fileFormat + sdf.format(c1.getTime())); + if (!Folder.exists()) { + try { + Folder.mkdirs(); + } catch (Exception e) { + log.debug("error_mkdir"); + e.getStackTrace(); + } + } + + File myFile = new File(fileFormat + fileName); + OutputStream os = new FileOutputStream(myFile); + + os.write(data); + log.debug("Successfully obtained " + keyName + " from an S3 object"); + os.close(); + + } catch (IOException ex) { + fileName = ""; + log.error(ex.getMessage()); + } catch (S3Exception e) { + fileName = ""; + log.error(e.awsErrorDetails().errorMessage()); + System.exit(1); + } + return fileName; + } + + private String recordDownloadFileName(String keyName) { + + SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd"); + Calendar c1 = Calendar.getInstance(); + String fileName = sdf.format(c1.getTime()) + "/"; + + String filePattern = "bgmfile/[0-9]{8}/"; + Pattern pattern = Pattern.compile(filePattern); + Matcher match = pattern.matcher(keyName); + + if (match.find()) { + log.debug("bgm file Name :" + keyName.replaceAll(filePattern,"").trim()); + fileName = fileName + keyName.replaceAll(filePattern,"").trim(); + } + + return fileName; + } + + private String recordServerFilePath(String keyName) { + + InetAddress local; + String ip = ""; + try { + local = InetAddress.getLocalHost(); + ip = local.getHostAddress(); + } catch (UnknownHostException e1) { + e1.printStackTrace(); + } + + return "http://" + ip + ":8050/files/bgmfile/" + keyName; + } + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/oprManage/vo/OprManageBgmVO.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/oprManage/vo/OprManageBgmVO.java new file mode 100644 index 0000000..31f4e56 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/oprManage/vo/OprManageBgmVO.java @@ -0,0 +1,22 @@ +package com.icomsys.main_vm.biz.rcp.oprManage.vo; + + +import lombok.Data; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@Data +@Getter +@Setter +@ToString +public class OprManageBgmVO { + private String filePath; + private String fileName; + //private String fileType; + private String registDate; + private String custCode; + private String registId; + + private String searchKeyword; +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/oprManage/vo/SelectTtsTagInfoVO.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/oprManage/vo/SelectTtsTagInfoVO.java new file mode 100644 index 0000000..fa43bf6 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/oprManage/vo/SelectTtsTagInfoVO.java @@ -0,0 +1,17 @@ +package com.icomsys.main_vm.biz.rcp.oprManage.vo; + +import lombok.Data; + +import java.time.LocalDateTime; + +@Data +public class SelectTtsTagInfoVO { + private String ttsProdCode; + private String tagCode; + private String ttsStartTag; + private String ttsEndTag; + private String registId; + private LocalDateTime registDate; + private String updateId; + private LocalDateTime updateDate; +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/statistics/call/StatisticsAiengineController.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/statistics/call/StatisticsAiengineController.java new file mode 100644 index 0000000..5d0a5f9 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/statistics/call/StatisticsAiengineController.java @@ -0,0 +1,20 @@ +package com.icomsys.main_vm.biz.rcp.statistics.call; + +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; + +@Controller +@Slf4j +@RequiredArgsConstructor +@RequestMapping("/admin/rcp/statistics/call") +public class StatisticsAiengineController { + + @GetMapping("/aiengine/manage.do") + public String day(){ + return "/adm/rcp/statistics/call/aiengine"; + } + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/statistics/call/StatisticsCallInfoController.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/statistics/call/StatisticsCallInfoController.java new file mode 100644 index 0000000..03e5df1 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/statistics/call/StatisticsCallInfoController.java @@ -0,0 +1,67 @@ +package com.icomsys.main_vm.biz.rcp.statistics.call; + +import com.icomsys.main_vm.biz.common.common.service.ExcelService; +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.rcp.statistics.call.req.StatisticsCallInfoListReq; +import com.icomsys.main_vm.biz.rcp.statistics.call.service.StatisticsCallInfoService; +import com.icomsys.main_vm.common.code.enumresource.ActionResource; +import com.icomsys.main_vm.common.code.enumresource.MenuResource; +import com.icomsys.main_vm.db.mybatis.alias.StatisticsCallInfoVO; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Controller; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.text.SimpleDateFormat; +import java.util.HashMap; +import java.util.List; + +@Controller +@Slf4j +@RequiredArgsConstructor +@RequestMapping("/admin/rcp/statistics/call") +public class StatisticsCallInfoController { + + private final StatisticsCallInfoService statisticsCallInfoService; + + private final ExcelService excelService; + + private final LogService logService; + + @GetMapping("/info/manage.do") + public String day(){ + return "/adm/rcp/statistics/call/info"; + } + + @RequestMapping(value = "/list.do", method = {RequestMethod.GET, RequestMethod.POST}) + @ResponseBody + public List statCallInfoList(@RequestBody StatisticsCallInfoVO vo) { + List result = statisticsCallInfoService.selectStatCallInfo(vo); + + return result; + } + + @ResponseBody + @Transactional + @RequestMapping(value = "/exceldownload.do") + public void statCallInfoExcelDownload(HttpServletResponse response, @ModelAttribute StatisticsCallInfoListReq req) throws IOException { + + SimpleDateFormat sdf = new SimpleDateFormat("yy-MM-dd/HH:mm:ss"); + + String nowTime = sdf.format(System.currentTimeMillis()); + + excelService.ExcelDownload("콜통계" + nowTime, req.getStatisticsCallInfoExcelVOList(), req.getTitleList()); + + logService.LogSave(LogVO.builder() + .menuAuth(MenuResource.valueOf(req.getMenuVal())) + .actionCode(String.valueOf((ActionResource.download))) + .serviceGroup(req.getOprMngCode()) + .remark("엑셀 다운로드") + .build()); + } + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/statistics/call/req/StatisticsCallInfoListReq.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/statistics/call/req/StatisticsCallInfoListReq.java new file mode 100644 index 0000000..b8ee8c5 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/statistics/call/req/StatisticsCallInfoListReq.java @@ -0,0 +1,16 @@ +package com.icomsys.main_vm.biz.rcp.statistics.call.req; + +import com.icomsys.main_vm.biz.rcp.statistics.call.vo.StatisticsCallInfoExcelVO; +import lombok.Getter; +import lombok.Setter; + +import java.util.List; + +@Getter +@Setter +public class StatisticsCallInfoListReq { + List statisticsCallInfoExcelVOList; + List titleList; + String menuVal; + String oprMngCode; +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/statistics/call/service/StatisticsCallInfoService.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/statistics/call/service/StatisticsCallInfoService.java new file mode 100644 index 0000000..17e5941 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/statistics/call/service/StatisticsCallInfoService.java @@ -0,0 +1,12 @@ +package com.icomsys.main_vm.biz.rcp.statistics.call.service; + +import com.icomsys.main_vm.db.mybatis.alias.StatisticsCallInfoVO; +import org.springframework.stereotype.Service; + +import java.util.HashMap; +import java.util.List; + +@Service +public interface StatisticsCallInfoService { + List selectStatCallInfo(StatisticsCallInfoVO vo); +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/statistics/call/service/impl/StatisticsCallInfoServiceImpl.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/statistics/call/service/impl/StatisticsCallInfoServiceImpl.java new file mode 100644 index 0000000..58113bb --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/statistics/call/service/impl/StatisticsCallInfoServiceImpl.java @@ -0,0 +1,286 @@ +package com.icomsys.main_vm.biz.rcp.statistics.call.service.impl; + +import com.icomsys.main_vm.biz.rcp.statistics.call.service.StatisticsCallInfoService; +import com.icomsys.main_vm.biz.rcp.statistics.call.vo.StatisticsCallInfoExcelVO; +import com.icomsys.main_vm.db.mybatis.alias.StatisticsCallInfoVO; +import com.icomsys.main_vm.db.mybatis.mapper.StatisticsCallInfoMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@Service +public class StatisticsCallInfoServiceImpl implements StatisticsCallInfoService { + + @Autowired + private StatisticsCallInfoMapper statisticsCallInfoMapper; + + @Override + public List selectStatCallInfo(StatisticsCallInfoVO vo) { + List result = statisticsCallInfoMapper.selectStatCallInfo(vo); + List convert = new ArrayList<>(); + List dateList = new ArrayList<>(); + Map totCntMap = new HashMap<>(); + + Map traUserReqCntMap = new HashMap<>(); + Map traScenarioCntMap = new HashMap<>(); + Map traSilentFbCntMap = new HashMap<>(); + Map traSpeakFbCntMap = new HashMap<>(); + Map traTotCntMap = new HashMap<>(); + + Map endUserReqCntMap = new HashMap<>(); + Map endScenarioCntMap = new HashMap<>(); + Map endSilentFbCntMap = new HashMap<>(); + Map endSpeakFbCntMap = new HashMap<>(); + Map endInitEndCntMap = new HashMap<>(); + Map endUserEndCntMap = new HashMap<>(); + Map endSystemCntMap = new HashMap<>(); + Map endTotCntMap = new HashMap<>(); + + Map talkCntMap = new HashMap<>(); + + for (HashMap e : result) { + if (!dateList.contains(String.valueOf(e.get("callInitDate")))) { + dateList.add(String.valueOf(e.get("callInitDate"))); + } + + if (totCntMap.containsKey(String.valueOf(e.get("callInitDate")))) { + double cnt = totCntMap.get(String.valueOf(e.get("callInitDate"))); + totCntMap.put(String.valueOf(e.get("callInitDate")), cnt += 1); + } else { + totCntMap.put(String.valueOf(e.get("callInitDate")), 1.0); + } + + if ("TRANSFER".equals(e.get("callEndConversion"))) { + if ("USER_REQ".equals(e.get("callEndReason"))) { + if (traUserReqCntMap.containsKey(String.valueOf(e.get("callInitDate")))) { + double cnt = traUserReqCntMap.get(String.valueOf(e.get("callInitDate"))); + traUserReqCntMap.put(String.valueOf(e.get("callInitDate")), cnt += 1); + } else { + traUserReqCntMap.put(String.valueOf(e.get("callInitDate")), 1.0); + } + + if (traTotCntMap.containsKey(String.valueOf(e.get("callInitDate")))) { + double cnt = traTotCntMap.get(String.valueOf(e.get("callInitDate"))); + traTotCntMap.put(String.valueOf(e.get("callInitDate")), cnt += 1); + } else { + traTotCntMap.put(String.valueOf(e.get("callInitDate")), 1.0); + } + } + + if ("SCENARIO".equals(e.get("callEndReason"))) { + if (traScenarioCntMap.containsKey(String.valueOf(e.get("callInitDate")))) { + double cnt = traScenarioCntMap.get(String.valueOf(e.get("callInitDate"))); + traScenarioCntMap.put(String.valueOf(e.get("callInitDate")), cnt += 1); + } else { + traScenarioCntMap.put(String.valueOf(e.get("callInitDate")), 1.0); + } + + if (traTotCntMap.containsKey(String.valueOf(e.get("callInitDate")))) { + double cnt = traTotCntMap.get(String.valueOf(e.get("callInitDate"))); + traTotCntMap.put(String.valueOf(e.get("callInitDate")), cnt += 1); + } else { + traTotCntMap.put(String.valueOf(e.get("callInitDate")), 1.0); + } + } + + if ("SILENT_FB".equals(e.get("callEndReason"))) { + if (traSilentFbCntMap.containsKey(String.valueOf(e.get("callInitDate")))) { + double cnt = traSilentFbCntMap.get(String.valueOf(e.get("callInitDate"))); + traSilentFbCntMap.put(String.valueOf(e.get("callInitDate")), cnt += 1); + } else { + traSilentFbCntMap.put(String.valueOf(e.get("callInitDate")), 1.0); + } + + if (traTotCntMap.containsKey(String.valueOf(e.get("callInitDate")))) { + double cnt = traTotCntMap.get(String.valueOf(e.get("callInitDate"))); + traTotCntMap.put(String.valueOf(e.get("callInitDate")), cnt += 1); + } else { + traTotCntMap.put(String.valueOf(e.get("callInitDate")), 1.0); + } + } + + if ("SPEAK_FB".equals(e.get("callEndReason"))) { + if (traSpeakFbCntMap.containsKey(String.valueOf(e.get("callInitDate")))) { + double cnt = traSpeakFbCntMap.get(String.valueOf(e.get("callInitDate"))); + traSpeakFbCntMap.put(String.valueOf(e.get("callInitDate")), cnt += 1); + } else { + traSpeakFbCntMap.put(String.valueOf(e.get("callInitDate")), 1.0); + } + + if (traTotCntMap.containsKey(String.valueOf(e.get("callInitDate")))) { + double cnt = traTotCntMap.get(String.valueOf(e.get("callInitDate"))); + traTotCntMap.put(String.valueOf(e.get("callInitDate")), cnt += 1); + } else { + traTotCntMap.put(String.valueOf(e.get("callInitDate")), 1.0); + } + } + } + + if ("END".equals(e.get("callEndConversion"))) { + if ("USER_REQ".equals(e.get("callEndReason"))) { + if (endUserReqCntMap.containsKey(String.valueOf(e.get("callInitDate")))) { + double cnt = endUserReqCntMap.get(String.valueOf(e.get("callInitDate"))); + endUserReqCntMap.put(String.valueOf(e.get("callInitDate")), cnt += 1); + } else { + endUserReqCntMap.put(String.valueOf(e.get("callInitDate")), 1.0); + } + + if (endTotCntMap.containsKey(String.valueOf(e.get("callInitDate")))) { + double cnt = endTotCntMap.get(String.valueOf(e.get("callInitDate"))); + endTotCntMap.put(String.valueOf(e.get("callInitDate")), cnt += 1); + } else { + endTotCntMap.put(String.valueOf(e.get("callInitDate")), 1.0); + } + } + + if ("SCENARIO".equals(e.get("callEndReason"))) { + if (endScenarioCntMap.containsKey(String.valueOf(e.get("callInitDate")))) { + double cnt = endScenarioCntMap.get(String.valueOf(e.get("callInitDate"))); + endScenarioCntMap.put(String.valueOf(e.get("callInitDate")), cnt += 1); + } else { + endScenarioCntMap.put(String.valueOf(e.get("callInitDate")), 1.0); + } + + if (endTotCntMap.containsKey(String.valueOf(e.get("callInitDate")))) { + double cnt = endTotCntMap.get(String.valueOf(e.get("callInitDate"))); + endTotCntMap.put(String.valueOf(e.get("callInitDate")), cnt += 1); + } else { + endTotCntMap.put(String.valueOf(e.get("callInitDate")), 1.0); + } + } + + if ("SILENT_FB".equals(e.get("callEndReason"))) { + if (endSilentFbCntMap.containsKey(String.valueOf(e.get("callInitDate")))) { + double cnt = endSilentFbCntMap.get(String.valueOf(e.get("callInitDate"))); + endSilentFbCntMap.put(String.valueOf(e.get("callInitDate")), cnt += 1); + } else { + endSilentFbCntMap.put(String.valueOf(e.get("callInitDate")), 1.0); + } + + if (endTotCntMap.containsKey(String.valueOf(e.get("callInitDate")))) { + double cnt = endTotCntMap.get(String.valueOf(e.get("callInitDate"))); + endTotCntMap.put(String.valueOf(e.get("callInitDate")), cnt += 1); + } else { + endTotCntMap.put(String.valueOf(e.get("callInitDate")), 1.0); + } + } + + if ("SPEAK_FB".equals(e.get("callEndReason"))) { + if (endSpeakFbCntMap.containsKey(String.valueOf(e.get("callInitDate")))) { + double cnt = endSpeakFbCntMap.get(String.valueOf(e.get("callInitDate"))); + endSpeakFbCntMap.put(String.valueOf(e.get("callInitDate")), cnt += 1); + } else { + endSpeakFbCntMap.put(String.valueOf(e.get("callInitDate")), 1.0); + } + + if (endTotCntMap.containsKey(String.valueOf(e.get("callInitDate")))) { + double cnt = endTotCntMap.get(String.valueOf(e.get("callInitDate"))); + endTotCntMap.put(String.valueOf(e.get("callInitDate")), cnt += 1); + } else { + endTotCntMap.put(String.valueOf(e.get("callInitDate")), 1.0); + } + } + + if ("INIT_END".equals(e.get("callEndReason"))) { + if (endInitEndCntMap.containsKey(String.valueOf(e.get("callInitDate")))) { + double cnt = endInitEndCntMap.get(String.valueOf(e.get("callInitDate"))); + endInitEndCntMap.put(String.valueOf(e.get("callInitDate")), cnt += 1); + } else { + endInitEndCntMap.put(String.valueOf(e.get("callInitDate")), 1.0); + } + + if (endTotCntMap.containsKey(String.valueOf(e.get("callInitDate")))) { + double cnt = endTotCntMap.get(String.valueOf(e.get("callInitDate"))); + endTotCntMap.put(String.valueOf(e.get("callInitDate")), cnt += 1); + } else { + endTotCntMap.put(String.valueOf(e.get("callInitDate")), 1.0); + } + } + + if ("USER_END".equals(e.get("callEndReason"))) { + if (endUserEndCntMap.containsKey(String.valueOf(e.get("callInitDate")))) { + double cnt = endUserEndCntMap.get(String.valueOf(e.get("callInitDate"))); + endUserEndCntMap.put(String.valueOf(e.get("callInitDate")), cnt += 1); + } else { + endUserEndCntMap.put(String.valueOf(e.get("callInitDate")), 1.0); + } + + if (endTotCntMap.containsKey(String.valueOf(e.get("callInitDate")))) { + double cnt = endTotCntMap.get(String.valueOf(e.get("callInitDate"))); + endTotCntMap.put(String.valueOf(e.get("callInitDate")), cnt += 1); + } else { + endTotCntMap.put(String.valueOf(e.get("callInitDate")), 1.0); + } + } + + if ("SYSTEM".equals(e.get("callEndReason"))) { + if (endSystemCntMap.containsKey(String.valueOf(e.get("callInitDate")))) { + double cnt = endSystemCntMap.get(String.valueOf(e.get("callInitDate"))); + endSystemCntMap.put(String.valueOf(e.get("callInitDate")), cnt += 1); + } else { + endSystemCntMap.put(String.valueOf(e.get("callInitDate")), 1.0); + } + + if (endTotCntMap.containsKey(String.valueOf(e.get("callInitDate")))) { + double cnt = endTotCntMap.get(String.valueOf(e.get("callInitDate"))); + endTotCntMap.put(String.valueOf(e.get("callInitDate")), cnt += 1); + } else { + endTotCntMap.put(String.valueOf(e.get("callInitDate")), 1.0); + } + } + } + + if (talkCntMap.containsKey(String.valueOf(e.get("callInitDate")))) { + double cnt = talkCntMap.get(String.valueOf(e.get("callInitDate"))); + talkCntMap.put(String.valueOf(e.get("callInitDate")), cnt += Double.valueOf(String.valueOf(e.get("talkSeqCnt")))); + } else { + talkCntMap.put(String.valueOf(e.get("callInitDate")), Double.valueOf(String.valueOf(e.get("talkSeqCnt")))); + } + } + + for (String e : dateList) { + HashMap map = new HashMap(); + map.put("callInitDate", e); + convert.add(map); + } + + double tmpTalkCnt = 0.0; + double tmpTotCnt = 1.0; + + for (HashMap convertMap : convert) { + for (HashMap e : result) { + if (convertMap.size() < 2) { + if (convertMap.get("callInitDate").equals(String.valueOf(e.get("callInitDate")))) { + convertMap.put("totCnt", (totCntMap.get(e.get("callInitDate")) == null) ? 0 : totCntMap.get(e.get("callInitDate"))); + + convertMap.put("ingUserReq", (traUserReqCntMap.get(e.get("callInitDate")) == null) ? 0 : traUserReqCntMap.get(e.get("callInitDate"))); + convertMap.put("ingScenario", (traScenarioCntMap.get(e.get("callInitDate")) == null) ? 0 : traScenarioCntMap.get(e.get("callInitDate"))); + convertMap.put("ingSilentFb", (traSilentFbCntMap.get(e.get("callInitDate")) == null) ? 0 : traSilentFbCntMap.get(e.get("callInitDate"))); + convertMap.put("ingSpeakFb", (traSpeakFbCntMap.get(e.get("callInitDate")) == null) ? 0 : traSpeakFbCntMap.get(e.get("callInitDate"))); + convertMap.put("ingTot", (traTotCntMap.get(e.get("callInitDate")) == null) ? 0 : traTotCntMap.get(e.get("callInitDate"))); + + convertMap.put("endUserReq", (endUserReqCntMap.get(e.get("callInitDate")) == null) ? 0 : endUserReqCntMap.get(e.get("callInitDate"))); + convertMap.put("endScenario", (endScenarioCntMap.get(e.get("callInitDate")) == null) ? 0 : endScenarioCntMap.get(e.get("callInitDate"))); + convertMap.put("endSilentFb", (endSilentFbCntMap.get(e.get("callInitDate")) == null) ? 0 : endSilentFbCntMap.get(e.get("callInitDate"))); + convertMap.put("endSpeakFb", (endSpeakFbCntMap.get(e.get("callInitDate")) == null) ? 0 : endSpeakFbCntMap.get(e.get("callInitDate"))); + convertMap.put("endInitEnd", (endInitEndCntMap.get(e.get("callInitDate")) == null) ? 0 : endInitEndCntMap.get(e.get("callInitDate"))); + convertMap.put("endUserEnd", (endUserEndCntMap.get(e.get("callInitDate")) == null) ? 0 : endUserEndCntMap.get(e.get("callInitDate"))); + convertMap.put("endSystem", (endSystemCntMap.get(e.get("callInitDate")) == null) ? 0 : endSystemCntMap.get(e.get("callInitDate"))); + convertMap.put("endTot", (endTotCntMap.get(e.get("callInitDate")) == null) ? 0 : endTotCntMap.get(e.get("callInitDate"))); + + tmpTalkCnt = (talkCntMap.get(e.get("callInitDate")) == null) ? 0.0 : talkCntMap.get(e.get("callInitDate")); + tmpTotCnt = (totCntMap.get(e.get("callInitDate")) == null) ? 1.0 : totCntMap.get(e.get("callInitDate")); + + convertMap.put("aveTalkCnt", Math.round(tmpTalkCnt/tmpTotCnt*10)/10.0); + } + } + } + } + + return convert; + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/statistics/call/vo/StatisticsCallInfoExcelVO.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/statistics/call/vo/StatisticsCallInfoExcelVO.java new file mode 100644 index 0000000..ca48464 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/statistics/call/vo/StatisticsCallInfoExcelVO.java @@ -0,0 +1,148 @@ +package com.icomsys.main_vm.biz.rcp.statistics.call.vo; + +public class StatisticsCallInfoExcelVO { + private String callInitDate; + private String totCnt; + private String ingUserReq; + private String ingScenario; + private String ingSilentFb; + private String ingSpeakFb; + private String ingTot; + private String endUserReq; + private String endScenario; + private String endSilentFb; + private String endSpeakFb; + private String endInitEnd; + private String endUserEnd; + private String endSystem; + private String endTot; + private String aveTalkCnt; + + public String getCallInitDate() { + return callInitDate; + } + + public void setCallInitDate(String callInitDate) { + this.callInitDate = callInitDate; + } + + public String getTotCnt() { + return totCnt; + } + + public void setTotCnt(String totCnt) { + this.totCnt = totCnt; + } + + public String getIngUserReq() { + return ingUserReq; + } + + public void setIngUserReq(String ingUserReq) { + this.ingUserReq = ingUserReq; + } + + public String getIngScenario() { + return ingScenario; + } + + public void setIngScenario(String ingScenario) { + this.ingScenario = ingScenario; + } + + public String getIngSilentFb() { + return ingSilentFb; + } + + public void setIngSilentFb(String ingSilentFb) { + this.ingSilentFb = ingSilentFb; + } + + public String getIngSpeakFb() { + return ingSpeakFb; + } + + public void setIngSpeakFb(String ingSpeakFb) { + this.ingSpeakFb = ingSpeakFb; + } + + public String getIngTot() { + return ingTot; + } + + public void setIngTot(String ingTot) { + this.ingTot = ingTot; + } + + public String getEndUserReq() { + return endUserReq; + } + + public void setEndUserReq(String endUserReq) { + this.endUserReq = endUserReq; + } + + public String getEndScenario() { + return endScenario; + } + + public void setEndScenario(String endScenario) { + this.endScenario = endScenario; + } + + public String getEndSilentFb() { + return endSilentFb; + } + + public void setEndSilentFb(String endSilentFb) { + this.endSilentFb = endSilentFb; + } + + public String getEndSpeakFb() { + return endSpeakFb; + } + + public void setEndSpeakFb(String endSpeakFb) { + this.endSpeakFb = endSpeakFb; + } + + public String getEndInitEnd() { + return endInitEnd; + } + + public void setEndInitEnd(String endInitEnd) { + this.endInitEnd = endInitEnd; + } + + public String getEndUserEnd() { + return endUserEnd; + } + + public void setEndUserEnd(String endUserEnd) { + this.endUserEnd = endUserEnd; + } + + public String getEndSystem() { + return endSystem; + } + + public void setEndSystem(String endSystem) { + this.endSystem = endSystem; + } + + public String getEndTot() { + return endTot; + } + + public void setEndTot(String endTot) { + this.endTot = endTot; + } + + public String getAveTalkCnt() { + return aveTalkCnt; + } + + public void setAveTalkCnt(String aveTalkCnt) { + this.aveTalkCnt = aveTalkCnt; + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/statistics/dashboard/service/StatisticsDashboardService.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/statistics/dashboard/service/StatisticsDashboardService.java new file mode 100644 index 0000000..ed690a2 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/statistics/dashboard/service/StatisticsDashboardService.java @@ -0,0 +1,16 @@ +package com.icomsys.main_vm.biz.rcp.statistics.dashboard.service; + +import com.icomsys.main_vm.db.mybatis.alias.StatisticsDashboardVO; +import org.springframework.stereotype.Service; + +import java.util.HashMap; +import java.util.List; + +@Service +public interface StatisticsDashboardService { + List selectStatCallInfo(StatisticsDashboardVO vo); + List selectStatIntent(StatisticsDashboardVO vo); + List selectStatScenario(StatisticsDashboardVO vo); + List selectCallCntByToday(StatisticsDashboardVO vo); + int selectCurCallCnt(StatisticsDashboardVO vo); +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/statistics/dashboard/service/impl/StatisticsDashboardServiceImpl.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/statistics/dashboard/service/impl/StatisticsDashboardServiceImpl.java new file mode 100644 index 0000000..c603652 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/statistics/dashboard/service/impl/StatisticsDashboardServiceImpl.java @@ -0,0 +1,251 @@ +package com.icomsys.main_vm.biz.rcp.statistics.dashboard.service.impl; + +import com.icomsys.main_vm.biz.rcp.statistics.dashboard.service.StatisticsDashboardService; +import com.icomsys.main_vm.db.mybatis.alias.StatisticsDashboardVO; +import com.icomsys.main_vm.db.mybatis.mapper.StatisticsDashboardMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@Service +public class StatisticsDashboardServiceImpl implements StatisticsDashboardService { + + @Autowired + private StatisticsDashboardMapper statisticsDashboardMapper; + + @Override + public List selectStatCallInfo(StatisticsDashboardVO vo) { + List result = statisticsDashboardMapper.selectStatCallInfo(vo); + List convert = new ArrayList<>(); + List oprDateList = new ArrayList<>(); + Map totCntMap = new HashMap<>(); + Map ingCntMap = new HashMap<>(); + Map endCntMap = new HashMap<>(); + + for (HashMap e : result) { + if (!oprDateList.contains(e.get("oprMngCode") + "/" + e.get("callInitDateB"))) { + oprDateList.add(e.get("oprMngCode") + "/" + e.get("callInitDateB")); + } + + if (totCntMap.containsKey(e.get("oprMngCode") + "/" + e.get("callInitDateB"))) { + double cnt = totCntMap.get(e.get("oprMngCode") + "/" + e.get("callInitDateB")); + totCntMap.put(e.get("oprMngCode") + "/" + e.get("callInitDateB"), cnt += 1); + } else { + if (e.get("callInitDate") != null) { + totCntMap.put(e.get("oprMngCode") + "/" + e.get("callInitDateB"), 1.0); + } else { + totCntMap.put(e.get("oprMngCode") + "/" + e.get("callInitDateB"), 0.0); + } + } + + if ("TRANSFER".equals(e.get("CALL_END_CONVERSION"))) { + if (ingCntMap.containsKey(e.get("oprMngCode") + "/" + e.get("callInitDateB"))) { + double cnt = ingCntMap.get(e.get("oprMngCode") + "/" + e.get("callInitDateB")); + ingCntMap.put(e.get("oprMngCode") + "/" + e.get("callInitDateB"), cnt += 1); + } else { + if (e.get("callInitDate") != null) { + ingCntMap.put(e.get("oprMngCode") + "/" + e.get("callInitDateB"), 1.0); + } else { + ingCntMap.put(e.get("oprMngCode") + "/" + e.get("callInitDateB"), 0.0); + } + } + } + + if ("END".equals(e.get("CALL_END_CONVERSION"))) { + if (endCntMap.containsKey(e.get("oprMngCode") + "/" + e.get("callInitDateB"))) { + double cnt = endCntMap.get(e.get("oprMngCode") + "/" + e.get("callInitDateB")); + endCntMap.put(e.get("oprMngCode") + "/" + e.get("callInitDateB"), cnt += 1.0); + } else { + if (e.get("callInitDate") != null) { + endCntMap.put(e.get("oprMngCode") + "/" + e.get("callInitDateB"), 1.0); + } else { + endCntMap.put(e.get("oprMngCode") + "/" + e.get("callInitDateB"), 0.0); + } + } + } + } + + for (String e : oprDateList) { + HashMap map = new HashMap(); + map.put("oprMngCode", e.split("/")[0]); + map.put("callInitDate", e.split("/")[1]); + convert.add(map); + } + + for (HashMap convertMap : convert) { + for (HashMap e : result) { + if (convertMap.size() < 3) { + if (convertMap.get("oprMngCode").equals(String.valueOf(e.get("oprMngCode"))) && convertMap.get("callInitDate").equals(String.valueOf(e.get("callInitDateB")))) { + convertMap.put("totCnt", (totCntMap.get(e.get("oprMngCode") + "/" + e.get("callInitDateB")) == null) ? 0 : totCntMap.get(e.get("oprMngCode") + "/" + e.get("callInitDateB"))); + convertMap.put("ingCnt", (ingCntMap.get(e.get("oprMngCode") + "/" + e.get("callInitDateB")) == null) ? 0 : ingCntMap.get(e.get("oprMngCode") + "/" + e.get("callInitDateB"))); + convertMap.put("endCnt", (endCntMap.get(e.get("oprMngCode") + "/" + e.get("callInitDateB")) == null) ? 0 : endCntMap.get(e.get("oprMngCode") + "/" + e.get("callInitDateB"))); + } + } + } + } + + return convert; + } + + @Override + public List selectStatIntent(StatisticsDashboardVO vo) { + List result = statisticsDashboardMapper.selectStatIntent(vo); + List convert = new ArrayList<>(); + List oprDateList = new ArrayList<>(); + Map totCntMap = new HashMap<>(); + Map succCntMap = new HashMap<>(); + Map failCntMap = new HashMap<>(); + + for (HashMap e : result) { + if (!oprDateList.contains(e.get("oprMngCode") + "/" + e.get("callInitDateB"))) { + oprDateList.add(e.get("oprMngCode") + "/" + e.get("callInitDateB")); + } + + if (totCntMap.containsKey(e.get("oprMngCode") + "/" + e.get("callInitDateB"))) { + double cnt = totCntMap.get(e.get("oprMngCode") + "/" + e.get("callInitDateB")); + totCntMap.put(e.get("oprMngCode") + "/" + e.get("callInitDateB"), cnt += 1); + } else { + if (e.get("callInitDate") != null) { + totCntMap.put(e.get("oprMngCode") + "/" + e.get("callInitDateB"), 1.0); + } else { + totCntMap.put(e.get("oprMngCode") + "/" + e.get("callInitDateB"), 0.0); + } + } + + if ("INTENT_SUCCESS".equals(e.get("INTENT_RESULT_CODE"))) { + if (succCntMap.containsKey(e.get("oprMngCode") + "/" + e.get("callInitDateB"))) { + double cnt = succCntMap.get(e.get("oprMngCode") + "/" + e.get("callInitDateB")); + succCntMap.put(e.get("oprMngCode") + "/" + e.get("callInitDateB"), cnt += 1); + } else { + if (e.get("callInitDate") != null) { + succCntMap.put(e.get("oprMngCode") + "/" + e.get("callInitDateB"), 1.0); + } else { + succCntMap.put(e.get("oprMngCode") + "/" + e.get("callInitDateB"), 0.0); + } + } + } + + if (!"INTENT_SUCCESS".equals(e.get("INTENT_RESULT_CODE"))) { + if (failCntMap.containsKey(e.get("oprMngCode") + "/" + e.get("callInitDateB"))) { + double cnt = failCntMap.get(e.get("oprMngCode") + "/" + e.get("callInitDateB")); + failCntMap.put(e.get("oprMngCode") + "/" + e.get("callInitDateB"), cnt += 1.0); + } else { + if (e.get("callInitDate") != null) { + failCntMap.put(e.get("oprMngCode") + "/" + e.get("callInitDateB"), 1.0); + } else { + failCntMap.put(e.get("oprMngCode") + "/" + e.get("callInitDateB"), 0.0); + } + } + } + } + + for (String e : oprDateList) { + HashMap map = new HashMap(); + map.put("oprMngCode", e.split("/")[0]); + map.put("callInitDate", e.split("/")[1]); + convert.add(map); + } + + for (HashMap convertMap : convert) { + for (HashMap e : result) { + if (convertMap.size() < 3) { + if (convertMap.get("oprMngCode").equals(String.valueOf(e.get("oprMngCode"))) && convertMap.get("callInitDate").equals(String.valueOf(e.get("callInitDateB")))) { + convertMap.put("totCnt", (totCntMap.get(e.get("oprMngCode") + "/" + e.get("callInitDateB")) == null) ? 0 : totCntMap.get(e.get("oprMngCode") + "/" + e.get("callInitDateB"))); + convertMap.put("succCnt", (succCntMap.get(e.get("oprMngCode") + "/" + e.get("callInitDateB")) == null) ? 0 : succCntMap.get(e.get("oprMngCode") + "/" + e.get("callInitDateB"))); + convertMap.put("failCnt", (failCntMap.get(e.get("oprMngCode") + "/" + e.get("callInitDateB")) == null) ? 0 : failCntMap.get(e.get("oprMngCode") + "/" + e.get("callInitDateB"))); + } + } + } + } + + return convert; + } + + @Override + public List selectStatScenario(StatisticsDashboardVO vo) { + List result = statisticsDashboardMapper.selectStatScenario(vo); + List convert = new ArrayList<>(); + List oprDateList = new ArrayList<>(); + Map useCntMap = new HashMap<>(); + Map succCntMap = new HashMap<>(); + Map failCntMap = new HashMap<>(); + + for (HashMap e : result) { + if (!oprDateList.contains(e.get("oprMngCode") + "/" + e.get("callInitDateB"))) { + oprDateList.add(e.get("oprMngCode") + "/" + e.get("callInitDateB")); + } + + if (useCntMap.containsKey(e.get("oprMngCode") + "/" + e.get("callInitDateB"))) { + double cnt = useCntMap.get(e.get("oprMngCode") + "/" + e.get("callInitDateB")); + useCntMap.put(e.get("oprMngCode") + "/" + e.get("callInitDateB"), cnt += 1); + } else { + if (e.get("callInitDate") != null) { + useCntMap.put(e.get("oprMngCode") + "/" + e.get("callInitDateB"), 1.0); + } else { + useCntMap.put(e.get("oprMngCode") + "/" + e.get("callInitDateB"), 0.0); + } + } + + if ("S".equals(e.get("SCENARIO_RESULT_CODE"))) { + if (succCntMap.containsKey(e.get("oprMngCode") + "/" + e.get("callInitDateB"))) { + double cnt = succCntMap.get(e.get("oprMngCode") + "/" + e.get("callInitDateB")); + succCntMap.put(e.get("oprMngCode") + "/" + e.get("callInitDateB"), cnt += 1); + } else { + if (e.get("callInitDate") != null) { + succCntMap.put(e.get("oprMngCode") + "/" + e.get("callInitDateB"), 1.0); + } else { + succCntMap.put(e.get("oprMngCode") + "/" + e.get("callInitDateB"), 0.0); + } + } + } + + if ("F".equals(e.get("SCENARIO_RESULT_CODE"))) { + if (failCntMap.containsKey(e.get("oprMngCode") + "/" + e.get("callInitDateB"))) { + double cnt = failCntMap.get(e.get("oprMngCode") + "/" + e.get("callInitDateB")); + failCntMap.put(e.get("oprMngCode") + "/" + e.get("callInitDateB"), cnt += 1.0); + } else { + if (e.get("callInitDate") != null) { + failCntMap.put(e.get("oprMngCode") + "/" + e.get("callInitDateB"), 1.0); + } else { + failCntMap.put(e.get("oprMngCode") + "/" + e.get("callInitDateB"), 0.0); + } + } + } + } + + for (String e : oprDateList) { + HashMap map = new HashMap(); + map.put("oprMngCode", e.split("/")[0]); + map.put("callInitDate", e.split("/")[1]); + convert.add(map); + } + + for (HashMap convertMap : convert) { + for (HashMap e : result) { + if (convertMap.size() < 3) { + if (convertMap.get("oprMngCode").equals(String.valueOf(e.get("oprMngCode"))) && convertMap.get("callInitDate").equals(String.valueOf(e.get("callInitDateB")))) { + convertMap.put("useCnt", (useCntMap.get(e.get("oprMngCode") + "/" + e.get("callInitDateB")) == null) ? 0 : useCntMap.get(e.get("oprMngCode") + "/" + e.get("callInitDateB"))); + convertMap.put("succCnt", (succCntMap.get(e.get("oprMngCode") + "/" + e.get("callInitDateB")) == null) ? 0 : succCntMap.get(e.get("oprMngCode") + "/" + e.get("callInitDateB"))); + convertMap.put("failCnt", (failCntMap.get(e.get("oprMngCode") + "/" + e.get("callInitDateB")) == null) ? 0 : failCntMap.get(e.get("oprMngCode") + "/" + e.get("callInitDateB"))); + } + } + } + } + + return convert; + } + + @Override + public List selectCallCntByToday(StatisticsDashboardVO vo) { + return statisticsDashboardMapper.selectCallCntByToday(vo); + } + + @Override + public int selectCurCallCnt(StatisticsDashboardVO vo) { + return statisticsDashboardMapper.selectCurCallCnt(vo); + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/statistics/intent/StatisticsIntentDayController.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/statistics/intent/StatisticsIntentDayController.java new file mode 100644 index 0000000..09a97c2 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/statistics/intent/StatisticsIntentDayController.java @@ -0,0 +1,67 @@ +package com.icomsys.main_vm.biz.rcp.statistics.intent; + +import com.icomsys.main_vm.biz.common.common.service.ExcelService; +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.rcp.statistics.intent.req.IntentAnalysisDayListReq; +import com.icomsys.main_vm.biz.rcp.statistics.intent.service.StatisticsIntentService; +import com.icomsys.main_vm.common.code.enumresource.ActionResource; +import com.icomsys.main_vm.common.code.enumresource.MenuResource; +import com.icomsys.main_vm.db.mybatis.alias.MonitoringIntentAnalysisVO; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Controller; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.text.SimpleDateFormat; +import java.util.HashMap; +import java.util.List; + +@Controller +@Slf4j +@RequiredArgsConstructor +@RequestMapping("/admin/rcp/statistics/intent") +public class StatisticsIntentDayController { + + private final StatisticsIntentService statisticsIntentService; + + private final ExcelService excelService; + + private final LogService logService; + + @GetMapping("/day/manage.do") + public String day(){ + return "/adm/rcp/statistics/intent/day"; + } + + @RequestMapping(value = "/day/list.do", method = {RequestMethod.GET, RequestMethod.POST}) + @ResponseBody + public List statIntentDayList(@RequestBody MonitoringIntentAnalysisVO vo) { + List result = statisticsIntentService.selectStatIntentDay(vo); + + return result; + } + + @ResponseBody + @Transactional + @RequestMapping(value = "/day/exceldownload.do") + public void statIntentDayExcelDownload(HttpServletResponse response, @ModelAttribute IntentAnalysisDayListReq req) throws IOException { + + SimpleDateFormat sdf = new SimpleDateFormat("yy-MM-dd/HH:mm:ss"); + + String nowTime = sdf.format(System.currentTimeMillis()); + + excelService.ExcelDownload("날짜별_인텐트_통계" + nowTime, req.getIntentAnalysisDayList(), req.getTitleList()); + + logService.LogSave(LogVO.builder() + .menuAuth(MenuResource.valueOf(req.getMenuVal())) + .actionCode(String.valueOf((ActionResource.download))) + .serviceGroup(req.getOprMngCode()) + .remark("엑셀 다운로드") + .build()); + } + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/statistics/intent/StatisticsIntentItemController.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/statistics/intent/StatisticsIntentItemController.java new file mode 100644 index 0000000..5530ded --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/statistics/intent/StatisticsIntentItemController.java @@ -0,0 +1,67 @@ +package com.icomsys.main_vm.biz.rcp.statistics.intent; + +import com.icomsys.main_vm.biz.common.common.service.ExcelService; +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.rcp.statistics.intent.req.IntentAnalysisItemListReq; +import com.icomsys.main_vm.biz.rcp.statistics.intent.service.StatisticsIntentService; +import com.icomsys.main_vm.common.code.enumresource.ActionResource; +import com.icomsys.main_vm.common.code.enumresource.MenuResource; +import com.icomsys.main_vm.db.mybatis.alias.MonitoringIntentAnalysisVO; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Controller; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.text.SimpleDateFormat; +import java.util.HashMap; +import java.util.List; + +@Controller +@Slf4j +@RequiredArgsConstructor +@RequestMapping("/admin/rcp/statistics/intent") +public class StatisticsIntentItemController { + + private final StatisticsIntentService statisticsIntentService; + + private final ExcelService excelService; + + private final LogService logService; + + @GetMapping("/item/manage.do") + public String day(){ + return "/adm/rcp/statistics/intent/item"; + } + + @RequestMapping(value = "/item/list.do", method = {RequestMethod.GET, RequestMethod.POST}) + @ResponseBody + public List statIntentItemList(@RequestBody MonitoringIntentAnalysisVO vo) { + List result = statisticsIntentService.selectStatIntentItem(vo); + + return result; + } + + @ResponseBody + @Transactional + @RequestMapping(value = "/item/exceldownload.do") + public void statIntentItemExcelDownload(HttpServletResponse response, @ModelAttribute IntentAnalysisItemListReq req) throws IOException { + + SimpleDateFormat sdf = new SimpleDateFormat("yy-MM-dd/HH:mm:ss"); + + String nowTime = sdf.format(System.currentTimeMillis()); + + excelService.ExcelDownload("항목별_인텐트_통계" + nowTime, req.getIntentAnalysisItemList(), req.getTitleList()); + + logService.LogSave(LogVO.builder() + .menuAuth(MenuResource.valueOf(req.getMenuVal())) + .actionCode(String.valueOf((ActionResource.download))) + .serviceGroup(req.getOprMngCode()) + .remark("엑셀 다운로드") + .build()); + } + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/statistics/intent/req/IntentAnalysisDayListReq.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/statistics/intent/req/IntentAnalysisDayListReq.java new file mode 100644 index 0000000..06927ff --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/statistics/intent/req/IntentAnalysisDayListReq.java @@ -0,0 +1,16 @@ +package com.icomsys.main_vm.biz.rcp.statistics.intent.req; + +import com.icomsys.main_vm.db.mybatis.alias.IntentAnalysisDayVO; +import lombok.Getter; +import lombok.Setter; + +import java.util.List; + +@Getter +@Setter +public class IntentAnalysisDayListReq { + List intentAnalysisDayList; + List titleList; + String menuVal; + String oprMngCode; +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/statistics/intent/req/IntentAnalysisItemListReq.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/statistics/intent/req/IntentAnalysisItemListReq.java new file mode 100644 index 0000000..e5ef398 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/statistics/intent/req/IntentAnalysisItemListReq.java @@ -0,0 +1,16 @@ +package com.icomsys.main_vm.biz.rcp.statistics.intent.req; + +import com.icomsys.main_vm.db.mybatis.alias.IntentAnalysisItemVO; +import lombok.Getter; +import lombok.Setter; + +import java.util.List; + +@Getter +@Setter +public class IntentAnalysisItemListReq { + List intentAnalysisItemList; + List titleList; + String menuVal; + String oprMngCode; +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/statistics/intent/service/StatisticsIntentService.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/statistics/intent/service/StatisticsIntentService.java new file mode 100644 index 0000000..d97097f --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/statistics/intent/service/StatisticsIntentService.java @@ -0,0 +1,13 @@ +package com.icomsys.main_vm.biz.rcp.statistics.intent.service; + +import com.icomsys.main_vm.db.mybatis.alias.MonitoringIntentAnalysisVO; +import org.springframework.stereotype.Service; + +import java.util.HashMap; +import java.util.List; + +@Service +public interface StatisticsIntentService { + List selectStatIntentDay(MonitoringIntentAnalysisVO vo); + List selectStatIntentItem(MonitoringIntentAnalysisVO vo); +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/statistics/intent/service/impl/StatisticsIntentServiceImpl.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/statistics/intent/service/impl/StatisticsIntentServiceImpl.java new file mode 100644 index 0000000..592dc6d --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/statistics/intent/service/impl/StatisticsIntentServiceImpl.java @@ -0,0 +1,173 @@ +package com.icomsys.main_vm.biz.rcp.statistics.intent.service.impl; + +import com.icomsys.main_vm.biz.rcp.statistics.intent.service.StatisticsIntentService; +import com.icomsys.main_vm.db.mybatis.alias.MonitoringIntentAnalysisVO; +import com.icomsys.main_vm.db.mybatis.mapper.StatisticsIntentMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.util.StringUtils; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@Service +public class StatisticsIntentServiceImpl implements StatisticsIntentService { + + @Autowired + private StatisticsIntentMapper statisticsIntentMapper; + + @Override + public List selectStatIntentDay(MonitoringIntentAnalysisVO vo) { + List result = statisticsIntentMapper.selectStatIntentDay(vo); + List convert = new ArrayList<>(); + List oprDateList = new ArrayList<>(); + Map totCntMap = new HashMap<>(); + Map succCntMap = new HashMap<>(); + Map failCntMap = new HashMap<>(); + Map avgIntentPerMap = new HashMap<>(); + + for (HashMap e : result) { + if (!oprDateList.contains(e.get("oprMngCode") + "/" + e.get("callInitDate"))) { + oprDateList.add(e.get("oprMngCode") + "/" + e.get("callInitDate")); + } + + if (totCntMap.containsKey(e.get("oprMngCode") + "/" + e.get("callInitDate"))) { + double cnt = totCntMap.get(e.get("oprMngCode") + "/" + e.get("callInitDate")); + totCntMap.put(e.get("oprMngCode") + "/" + e.get("callInitDate"), cnt += 1); + } else { + totCntMap.put(e.get("oprMngCode") + "/" + e.get("callInitDate"), 1.0); + } + + if ("INTENT_SUCCESS".equals(e.get("intentResultCode"))) { + if (succCntMap.containsKey(e.get("oprMngCode") + "/" + e.get("callInitDate"))) { + double cnt = succCntMap.get(e.get("oprMngCode") + "/" + e.get("callInitDate")); + succCntMap.put(e.get("oprMngCode") + "/" + e.get("callInitDate"), cnt += 1); + } else { + succCntMap.put(e.get("oprMngCode") + "/" + e.get("callInitDate"), 1.0); + } + } + + if (!"INTENT_SUCCESS".equals(e.get("intentResultCode"))) { + if (failCntMap.containsKey(e.get("oprMngCode") + "/" + e.get("callInitDate"))) { + double cnt = failCntMap.get(e.get("oprMngCode") + "/" + e.get("callInitDate")); + failCntMap.put(e.get("oprMngCode") + "/" + e.get("callInitDate"), cnt += 1.0); + } else { + failCntMap.put(e.get("oprMngCode") + "/" + e.get("callInitDate"), 1.0); + } + } + + double score = e.get("score") == null || !StringUtils.hasText(String.valueOf(e.get("score"))) ? 0 : Double.valueOf(String.valueOf(e.get("score"))); + if (avgIntentPerMap.containsKey(e.get("oprMngCode") + "/" + e.get("callInitDate"))) { + double cnt = avgIntentPerMap.get(e.get("oprMngCode") + "/" + e.get("callInitDate")); + avgIntentPerMap.put(e.get("oprMngCode") + "/" + e.get("callInitDate"), cnt += score); + } else { + avgIntentPerMap.put(e.get("oprMngCode") + "/" + e.get("callInitDate"), score); + } + } + + for (String e : oprDateList) { + HashMap map = new HashMap(); + map.put("oprMngCode", e.split("/")[0]); + map.put("callInitDate", e.split("/")[1]); + convert.add(map); + } + + for (HashMap convertMap : convert) { + for (HashMap e : result) { + if (convertMap.size() < 3) { + if (convertMap.get("oprMngCode").equals(String.valueOf(e.get("oprMngCode"))) && convertMap.get("callInitDate").equals(String.valueOf(e.get("callInitDate")))) { + convertMap.put("oprMngCodeName", e.get("oprMngCodeName")); + convertMap.put("oprMngCode", e.get("oprMngCode")); + convertMap.put("totCnt", totCntMap.get(e.get("oprMngCode") + "/" + e.get("callInitDate"))); + convertMap.put("succCnt", (succCntMap.get(e.get("oprMngCode") + "/" + e.get("callInitDate")) == null) ? 0 : succCntMap.get(e.get("oprMngCode") + "/" + e.get("callInitDate"))); + convertMap.put("failCnt", (failCntMap.get(e.get("oprMngCode") + "/" + e.get("callInitDate")) == null) ? 0 : failCntMap.get(e.get("oprMngCode") + "/" + e.get("callInitDate"))); + convertMap.put("succPer", Math.round((succCntMap.get(e.get("oprMngCode") + "/" + e.get("callInitDate")) == null) ? 0.0 : succCntMap.get(e.get("oprMngCode") + "/" + e.get("callInitDate"))/totCntMap.get(e.get("oprMngCode") + "/" + e.get("callInitDate"))*1000)/10.0); + convertMap.put("avgIntentPer", Math.round(avgIntentPerMap.get(e.get("oprMngCode") + "/" + e.get("callInitDate"))/totCntMap.get(e.get("oprMngCode") + "/" + e.get("callInitDate"))*10)/10.0); + } + } + } + } + + return convert; + } + + @Override + public List selectStatIntentItem(MonitoringIntentAnalysisVO vo) { + List result = statisticsIntentMapper.selectStatIntentItem(vo); + List convert = new ArrayList<>(); + List oprIdList = new ArrayList<>(); + Map totCntMap = new HashMap<>(); + Map succCntMap = new HashMap<>(); + Map failCntMap = new HashMap<>(); + Map avgIntentPerMap = new HashMap<>(); + + for (HashMap e : result) { + if (!oprIdList.contains(e.get("oprMngCode") + "/" + e.get("intentId"))) { + oprIdList.add(e.get("oprMngCode") + "/" + e.get("intentId")); + } + + if (totCntMap.containsKey(e.get("oprMngCode") + "/" + e.get("intentId"))) { + double cnt = totCntMap.get(e.get("oprMngCode") + "/" + e.get("intentId")); + totCntMap.put(e.get("oprMngCode") + "/" + e.get("intentId"), cnt += 1); + } else { + totCntMap.put(e.get("oprMngCode") + "/" + e.get("intentId"), 1.0); + } + + if ("INTENT_SUCCESS".equals(e.get("intentResultCode"))) { + if (succCntMap.containsKey(e.get("oprMngCode") + "/" + e.get("intentId"))) { + double cnt = succCntMap.get(e.get("oprMngCode") + "/" + e.get("intentId")); + succCntMap.put(e.get("oprMngCode") + "/" + e.get("intentId"), cnt += 1); + } else { + succCntMap.put(e.get("oprMngCode") + "/" + e.get("intentId"), 1.0); + } + } + + if (!"INTENT_SUCCESS".equals(e.get("intentResultCode"))) { + if (failCntMap.containsKey(e.get("oprMngCode") + "/" + e.get("intentId"))) { + double cnt = failCntMap.get(e.get("oprMngCode") + "/" + e.get("intentId")); + failCntMap.put(e.get("oprMngCode") + "/" + e.get("intentId"), cnt += 1.0); + } else { + failCntMap.put(e.get("oprMngCode") + "/" + e.get("intentId"), 1.0); + } + } + + double score = e.get("score") == null || !StringUtils.hasText(String.valueOf(e.get("score"))) ? 0 : Double.valueOf(String.valueOf(e.get("score"))); + if (avgIntentPerMap.containsKey(e.get("oprMngCode") + "/" + e.get("intentId"))) { + double cnt = avgIntentPerMap.get(e.get("oprMngCode") + "/" + e.get("intentId")); + avgIntentPerMap.put(e.get("oprMngCode") + "/" + e.get("intentId"), cnt += score); + } else { + avgIntentPerMap.put(e.get("oprMngCode") + "/" + e.get("intentId"), score); + } + } + + for (String e : oprIdList) { + HashMap map = new HashMap(); + map.put("oprMngCode", e.split("/")[0]); + map.put("intentId", e.split("/")[1]); + convert.add(map); + } + + for (HashMap convertMap : convert) { + for (HashMap e : result) { + if (convertMap.size() < 3) { + if (convertMap.get("oprMngCode").equals(String.valueOf(e.get("oprMngCode"))) && convertMap.get("intentId").equals(String.valueOf(e.get("intentId")))) { + convertMap.put("oprMngCodeName", e.get("oprMngCodeName")); + convertMap.put("oprMngCode", e.get("oprMngCode")); + convertMap.put("intentGroup", e.get("intentGroup")); + convertMap.put("intentId", e.get("intentId")); + convertMap.put("intentName", e.get("intentName")); + convertMap.put("totCnt", totCntMap.get(e.get("oprMngCode") + "/" + e.get("intentId"))); + convertMap.put("succCnt", (succCntMap.get(e.get("oprMngCode") + "/" + e.get("intentId")) == null) ? 0 : succCntMap.get(e.get("oprMngCode") + "/" + e.get("intentId"))); + convertMap.put("failCnt", (failCntMap.get(e.get("oprMngCode") + "/" + e.get("intentId")) == null) ? 0 : failCntMap.get(e.get("oprMngCode") + "/" + e.get("intentId"))); + convertMap.put("succPer", Math.round((succCntMap.get(e.get("oprMngCode") + "/" + e.get("intentId")) == null) ? 0.0 : succCntMap.get(e.get("oprMngCode") + "/" + e.get("intentId"))/totCntMap.get(e.get("oprMngCode") + "/" + e.get("intentId"))*1000)/10.0); + convertMap.put("avgIntentPer", Math.round(avgIntentPerMap.get(e.get("oprMngCode") + "/" + e.get("intentId"))/totCntMap.get(e.get("oprMngCode") + "/" + e.get("intentId"))*10)/10.0); + } + } + } + } + + return convert; + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/statistics/scenario/StatisticsScenarioDayController.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/statistics/scenario/StatisticsScenarioDayController.java new file mode 100644 index 0000000..d77b8bf --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/statistics/scenario/StatisticsScenarioDayController.java @@ -0,0 +1,67 @@ +package com.icomsys.main_vm.biz.rcp.statistics.scenario; + +import com.icomsys.main_vm.biz.common.common.service.ExcelService; +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.rcp.statistics.scenario.req.StatisticsScenarioDayListReq; +import com.icomsys.main_vm.biz.rcp.statistics.scenario.service.StatisticsScenarioService; +import com.icomsys.main_vm.common.code.enumresource.ActionResource; +import com.icomsys.main_vm.common.code.enumresource.MenuResource; +import com.icomsys.main_vm.db.mybatis.alias.MonitoringOutscenarioVO; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Controller; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.text.SimpleDateFormat; +import java.util.HashMap; +import java.util.List; + +@Controller +@Slf4j +@RequiredArgsConstructor +@RequestMapping("/admin/rcp/statistics/scenario") +public class StatisticsScenarioDayController { + + private final StatisticsScenarioService statisticsScenarioService; + + private final ExcelService excelService; + + private final LogService logService; + + @GetMapping("/day/manage.do") + public String day(){ + return "/adm/rcp/statistics/scenario/day"; + } + + @RequestMapping(value = "/day/list.do", method = {RequestMethod.GET, RequestMethod.POST}) + @ResponseBody + public List statScenarioDayList(@RequestBody MonitoringOutscenarioVO vo) { + List result = statisticsScenarioService.selectStatScenarioDay(vo); + + return result; + } + + @ResponseBody + @Transactional + @RequestMapping(value = "/day/exceldownload.do") + public void statScenarioDayExcelDownload(HttpServletResponse response, @ModelAttribute StatisticsScenarioDayListReq req) throws IOException { + + SimpleDateFormat sdf = new SimpleDateFormat("yy-MM-dd/HH:mm:ss"); + + String nowTime = sdf.format(System.currentTimeMillis()); + + excelService.ExcelDownload("날짜별_시나리오_통계" + nowTime, req.getStatisticsScenarioDayVoList(), req.getTitleList()); + + logService.LogSave(LogVO.builder() + .menuAuth(MenuResource.valueOf(req.getMenuVal())) + .actionCode(String.valueOf((ActionResource.download))) + .serviceGroup(req.getOprMngCode()) + .remark("엑셀 다운로드") + .build()); + } + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/statistics/scenario/StatisticsScenarioItemController.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/statistics/scenario/StatisticsScenarioItemController.java new file mode 100644 index 0000000..6fda103 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/statistics/scenario/StatisticsScenarioItemController.java @@ -0,0 +1,67 @@ +package com.icomsys.main_vm.biz.rcp.statistics.scenario; + +import com.icomsys.main_vm.biz.common.common.service.ExcelService; +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.rcp.statistics.scenario.req.StatisticsScenarioItemListReq; +import com.icomsys.main_vm.biz.rcp.statistics.scenario.service.StatisticsScenarioService; +import com.icomsys.main_vm.common.code.enumresource.ActionResource; +import com.icomsys.main_vm.common.code.enumresource.MenuResource; +import com.icomsys.main_vm.db.mybatis.alias.MonitoringOutscenarioVO; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Controller; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.text.SimpleDateFormat; +import java.util.HashMap; +import java.util.List; + +@Controller +@Slf4j +@RequiredArgsConstructor +@RequestMapping("/admin/rcp/statistics/scenario") +public class StatisticsScenarioItemController { + + private final StatisticsScenarioService statisticsScenarioService; + + private final ExcelService excelService; + + private final LogService logService; + + @GetMapping("/item/manage.do") + public String day(){ + return "/adm/rcp/statistics/scenario/item"; + } + + @RequestMapping(value = "/item/list.do", method = {RequestMethod.GET, RequestMethod.POST}) + @ResponseBody + public List statScenarioItemList(@RequestBody MonitoringOutscenarioVO vo) { + List result = statisticsScenarioService.selectStatScenarioItem(vo); + + return result; + } + + @ResponseBody + @Transactional + @RequestMapping(value = "/item/exceldownload.do") + public void statScenarioItemExcelDownload(HttpServletResponse response, @ModelAttribute StatisticsScenarioItemListReq req) throws IOException { + + SimpleDateFormat sdf = new SimpleDateFormat("yy-MM-dd/HH:mm:ss"); + + String nowTime = sdf.format(System.currentTimeMillis()); + + excelService.ExcelDownload("항목별_시나리오_통계" + nowTime, req.getStatisticsScenarioItemVoList(), req.getTitleList()); + + logService.LogSave(LogVO.builder() + .menuAuth(MenuResource.valueOf(req.getMenuVal())) + .actionCode(String.valueOf((ActionResource.download))) + .serviceGroup(req.getOprMngCode()) + .remark("엑셀 다운로드") + .build()); + } + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/statistics/scenario/req/StatisticsScenarioDayListReq.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/statistics/scenario/req/StatisticsScenarioDayListReq.java new file mode 100644 index 0000000..46dfb26 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/statistics/scenario/req/StatisticsScenarioDayListReq.java @@ -0,0 +1,16 @@ +package com.icomsys.main_vm.biz.rcp.statistics.scenario.req; + +import com.icomsys.main_vm.biz.rcp.statistics.scenario.vo.StatisticsScenarioDayVO; +import lombok.Getter; +import lombok.Setter; + +import java.util.List; + +@Getter +@Setter +public class StatisticsScenarioDayListReq { + List statisticsScenarioDayVoList; + List titleList; + String menuVal; + String oprMngCode; +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/statistics/scenario/req/StatisticsScenarioItemListReq.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/statistics/scenario/req/StatisticsScenarioItemListReq.java new file mode 100644 index 0000000..156e8ad --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/statistics/scenario/req/StatisticsScenarioItemListReq.java @@ -0,0 +1,16 @@ +package com.icomsys.main_vm.biz.rcp.statistics.scenario.req; + +import com.icomsys.main_vm.biz.rcp.statistics.scenario.vo.StatisticsScenarioItemVO; +import lombok.Getter; +import lombok.Setter; + +import java.util.List; + +@Getter +@Setter +public class StatisticsScenarioItemListReq { + List statisticsScenarioItemVoList; + List titleList; + String menuVal; + String oprMngCode; +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/statistics/scenario/service/StatisticsScenarioService.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/statistics/scenario/service/StatisticsScenarioService.java new file mode 100644 index 0000000..4b3c5cd --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/statistics/scenario/service/StatisticsScenarioService.java @@ -0,0 +1,14 @@ +package com.icomsys.main_vm.biz.rcp.statistics.scenario.service; + +import com.icomsys.main_vm.db.mybatis.alias.MonitoringIntentAnalysisVO; +import com.icomsys.main_vm.db.mybatis.alias.MonitoringOutscenarioVO; +import org.springframework.stereotype.Service; + +import java.util.HashMap; +import java.util.List; + +@Service +public interface StatisticsScenarioService { + List selectStatScenarioDay(MonitoringOutscenarioVO vo); + List selectStatScenarioItem(MonitoringOutscenarioVO vo); +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/statistics/scenario/service/impl/StatisticsScenarioServiceImpl.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/statistics/scenario/service/impl/StatisticsScenarioServiceImpl.java new file mode 100644 index 0000000..3fe962e --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/statistics/scenario/service/impl/StatisticsScenarioServiceImpl.java @@ -0,0 +1,154 @@ +package com.icomsys.main_vm.biz.rcp.statistics.scenario.service.impl; + +import com.icomsys.main_vm.biz.rcp.statistics.scenario.service.StatisticsScenarioService; +import com.icomsys.main_vm.biz.test.controller.FailNodeVO; +import com.icomsys.main_vm.db.mybatis.alias.MonitoringOutscenarioVO; +import com.icomsys.main_vm.db.mybatis.alias.MonitoringScenarioBreakVO; +import com.icomsys.main_vm.db.mybatis.mapper.StatisticsScenarioMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@Service +public class StatisticsScenarioServiceImpl implements StatisticsScenarioService { + + @Autowired + private StatisticsScenarioMapper statisticsScenarioMapper; + + @Override + public List selectStatScenarioDay(MonitoringOutscenarioVO vo) { + List result = statisticsScenarioMapper.selectStatScenarioDay(vo); + List convert = new ArrayList<>(); + List oprDateList = new ArrayList<>(); + Map useCntMap = new HashMap<>(); + Map succCntMap = new HashMap<>(); + Map failCntMap = new HashMap<>(); + + for (HashMap e : result) { + if (!oprDateList.contains(e.get("oprMngCode") + "/" + e.get("callInitDate"))) { + oprDateList.add(e.get("oprMngCode") + "/" + e.get("callInitDate")); + } + + if (useCntMap.containsKey(e.get("oprMngCode") + "/" + e.get("callInitDate"))) { + double cnt = useCntMap.get(e.get("oprMngCode") + "/" + e.get("callInitDate")); + useCntMap.put(e.get("oprMngCode") + "/" + e.get("callInitDate"), cnt += 1); + } else { + useCntMap.put(e.get("oprMngCode") + "/" + e.get("callInitDate"), 1.0); + } + + if ("S".equals(e.get("scenarioResultCode"))) { + if (succCntMap.containsKey(e.get("oprMngCode") + "/" + e.get("callInitDate"))) { + double cnt = succCntMap.get(e.get("oprMngCode") + "/" + e.get("callInitDate")); + succCntMap.put(e.get("oprMngCode") + "/" + e.get("callInitDate"), cnt += 1); + } else { + succCntMap.put(e.get("oprMngCode") + "/" + e.get("callInitDate"), 1.0); + } + } + + if ("F".equals(e.get("scenarioResultCode"))) { + if (failCntMap.containsKey(e.get("oprMngCode") + "/" + e.get("callInitDate"))) { + double cnt = failCntMap.get(e.get("oprMngCode") + "/" + e.get("callInitDate")); + failCntMap.put(e.get("oprMngCode") + "/" + e.get("callInitDate"), cnt += 1.0); + } else { + failCntMap.put(e.get("oprMngCode") + "/" + e.get("callInitDate"), 1.0); + } + } + } + + for (String e : oprDateList) { + HashMap map = new HashMap(); + map.put("oprMngCode", e.split("/")[0]); + map.put("callInitDate", e.split("/")[1]); + convert.add(map); + } + + for (HashMap convertMap : convert) { + for (HashMap e : result) { + if (convertMap.size() < 3) { + if (convertMap.get("oprMngCode").equals(String.valueOf(e.get("oprMngCode"))) && convertMap.get("callInitDate").equals(String.valueOf(e.get("callInitDate")))) { + convertMap.put("oprMngCodeName", e.get("oprMngCodeName")); + convertMap.put("useCnt", useCntMap.get(e.get("oprMngCode") + "/" + e.get("callInitDate"))); + convertMap.put("succCnt", (succCntMap.get(e.get("oprMngCode") + "/" + e.get("callInitDate")) == null) ? 0 : succCntMap.get(e.get("oprMngCode") + "/" + e.get("callInitDate"))); + convertMap.put("failCnt", (failCntMap.get(e.get("oprMngCode") + "/" + e.get("callInitDate")) == null) ? 0 : failCntMap.get(e.get("oprMngCode") + "/" + e.get("callInitDate"))); + convertMap.put("succPer", Math.round((succCntMap.get(e.get("oprMngCode") + "/" + e.get("callInitDate")) == null) ? 0.0 : succCntMap.get(e.get("oprMngCode") + "/" + e.get("callInitDate"))/useCntMap.get(e.get("oprMngCode") + "/" + e.get("callInitDate"))*1000)/10.0); + convertMap.put("failPer", Math.round((failCntMap.get(e.get("oprMngCode") + "/" + e.get("callInitDate")) == null) ? 0.0 : failCntMap.get(e.get("oprMngCode") + "/" + e.get("callInitDate"))/useCntMap.get(e.get("oprMngCode") + "/" + e.get("callInitDate"))*1000)/10.0); + } + } + } + } + + return convert; + } + + @Override + public List selectStatScenarioItem(MonitoringOutscenarioVO vo) { + List result = statisticsScenarioMapper.selectStatScenarioItem(vo); + List convert = new ArrayList<>(); + List oprSeqList = new ArrayList<>(); + Map useCntMap = new HashMap<>(); + Map succCntMap = new HashMap<>(); + Map failCntMap = new HashMap<>(); + double totCnt = result.size(); + + for (HashMap e : result) { + if (!oprSeqList.contains(e.get("oprMngCode") + "/" + e.get("scenarioSeq"))) { + oprSeqList.add(e.get("oprMngCode") + "/" + e.get("scenarioSeq")); + } + + if (useCntMap.containsKey(e.get("oprMngCode") + "/" + e.get("scenarioSeq"))) { + double cnt = useCntMap.get(e.get("oprMngCode") + "/" + e.get("scenarioSeq")); + useCntMap.put(e.get("oprMngCode") + "/" + e.get("scenarioSeq"), cnt += 1); + } else { + useCntMap.put(e.get("oprMngCode") + "/" + e.get("scenarioSeq"), 1.0); + } + + if ("S".equals(e.get("scenarioResultCode"))) { + if (succCntMap.containsKey(e.get("oprMngCode") + "/" + e.get("scenarioSeq"))) { + double cnt = succCntMap.get(e.get("oprMngCode") + "/" + e.get("scenarioSeq")); + succCntMap.put(e.get("oprMngCode") + "/" + e.get("scenarioSeq"), cnt += 1); + } else { + succCntMap.put(e.get("oprMngCode") + "/" + e.get("scenarioSeq"), 1.0); + } + } + + if ("F".equals(e.get("scenarioResultCode"))) { + if (failCntMap.containsKey(e.get("oprMngCode") + "/" + e.get("scenarioSeq"))) { + double cnt = failCntMap.get(e.get("oprMngCode") + "/" + e.get("scenarioSeq")); + failCntMap.put(e.get("oprMngCode") + "/" + e.get("scenarioSeq"), cnt += 1.0); + } else { + failCntMap.put(e.get("oprMngCode") + "/" + e.get("scenarioSeq"), 1.0); + } + } + } + + for (String e : oprSeqList) { + HashMap map = new HashMap(); + map.put("oprMngCode", e.split("/")[0]); + map.put("scenarioSeq", e.split("/")[1]); + convert.add(map); + } + + for (HashMap convertMap : convert) { + for (HashMap e : result) { + if (convertMap.size() < 3) { + if (convertMap.get("oprMngCode").equals(String.valueOf(e.get("oprMngCode"))) && convertMap.get("scenarioSeq").equals(String.valueOf(e.get("scenarioSeq")))) { + convertMap.put("scenarioName", e.get("scenarioName")); + convertMap.put("oprMngCodeName", e.get("oprMngCodeName")); + convertMap.put("useCnt", useCntMap.get(e.get("oprMngCode") + "/" + e.get("scenarioSeq"))); + convertMap.put("succCnt", (succCntMap.get(e.get("oprMngCode") + "/" + e.get("scenarioSeq")) == null) ? 0 : succCntMap.get(e.get("oprMngCode") + "/" + e.get("scenarioSeq"))); + convertMap.put("failCnt", (failCntMap.get(e.get("oprMngCode") + "/" + e.get("scenarioSeq")) == null) ? 0 : failCntMap.get(e.get("oprMngCode") + "/" + e.get("scenarioSeq"))); + convertMap.put("usePer", Math.round(useCntMap.get(e.get("oprMngCode") + "/" + e.get("scenarioSeq"))/totCnt*1000)/10.0); + convertMap.put("succPer", Math.round((succCntMap.get(e.get("oprMngCode") + "/" + e.get("scenarioSeq")) == null) ? 0.0 : succCntMap.get(e.get("oprMngCode") + "/" + e.get("scenarioSeq"))/useCntMap.get(e.get("oprMngCode") + "/" + e.get("scenarioSeq"))*1000)/10.0); + convertMap.put("failPer", Math.round((failCntMap.get(e.get("oprMngCode") + "/" + e.get("scenarioSeq")) == null) ? 0.0 : failCntMap.get(e.get("oprMngCode") + "/" + e.get("scenarioSeq"))/useCntMap.get(e.get("oprMngCode") + "/" + e.get("scenarioSeq"))*1000)/10.0); + } + } + } + } + + return convert; + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/statistics/scenario/vo/StatisticsScenarioDayVO.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/statistics/scenario/vo/StatisticsScenarioDayVO.java new file mode 100644 index 0000000..824b68e --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/statistics/scenario/vo/StatisticsScenarioDayVO.java @@ -0,0 +1,67 @@ +package com.icomsys.main_vm.biz.rcp.statistics.scenario.vo; + +public class StatisticsScenarioDayVO { + private String oprMngCodeName; + private String callInitDate; + private String useCnt; + private String succCnt; + private String failCnt; + private String succPer; + private String failPer; + + public String getOprMngCodeName() { + return oprMngCodeName; + } + + public void setOprMngCodeName(String oprMngCodeName) { + this.oprMngCodeName = oprMngCodeName; + } + + public String getCallInitDate() { + return callInitDate; + } + + public void setCallInitDate(String callInitDate) { + this.callInitDate = callInitDate; + } + + public String getUseCnt() { + return useCnt; + } + + public void setUseCnt(String useCnt) { + this.useCnt = useCnt; + } + + public String getSuccCnt() { + return succCnt; + } + + public void setSuccCnt(String succCnt) { + this.succCnt = succCnt; + } + + public String getFailCnt() { + return failCnt; + } + + public void setFailCnt(String failCnt) { + this.failCnt = failCnt; + } + + public String getSuccPer() { + return succPer; + } + + public void setSuccPer(String succPer) { + this.succPer = succPer; + } + + public String getFailPer() { + return failPer; + } + + public void setFailPer(String failPer) { + this.failPer = failPer; + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/statistics/scenario/vo/StatisticsScenarioItemVO.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/statistics/scenario/vo/StatisticsScenarioItemVO.java new file mode 100644 index 0000000..fc50332 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/statistics/scenario/vo/StatisticsScenarioItemVO.java @@ -0,0 +1,76 @@ +package com.icomsys.main_vm.biz.rcp.statistics.scenario.vo; + +public class StatisticsScenarioItemVO { + private String oprMngCodeName; + private String scenarioName; + private String useCnt; + private String succCnt; + private String failCnt; + private String usePer; + private String succPer; + private String failPer; + + public String getOprMngCodeName() { + return oprMngCodeName; + } + + public void setOprMngCodeName(String oprMngCodeName) { + this.oprMngCodeName = oprMngCodeName; + } + + public String getScenarioName() { + return scenarioName; + } + + public void setScenarioName(String scenarioName) { + this.scenarioName = scenarioName; + } + + public String getUseCnt() { + return useCnt; + } + + public void setUseCnt(String useCnt) { + this.useCnt = useCnt; + } + + public String getSuccCnt() { + return succCnt; + } + + public void setSuccCnt(String succCnt) { + this.succCnt = succCnt; + } + + public String getFailCnt() { + return failCnt; + } + + public void setFailCnt(String failCnt) { + this.failCnt = failCnt; + } + + public String getUsePer() { + return usePer; + } + + public void setUsePer(String usePer) { + this.usePer = usePer; + } + + public String getSuccPer() { + return succPer; + } + + public void setSuccPer(String succPer) { + this.succPer = succPer; + } + + public String getFailPer() { + return failPer; + } + + public void setFailPer(String failPer) { + this.failPer = failPer; + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/statistics/statistics/StatisticsIntentController.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/statistics/statistics/StatisticsIntentController.java new file mode 100644 index 0000000..7247841 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/statistics/statistics/StatisticsIntentController.java @@ -0,0 +1,20 @@ +package com.icomsys.main_vm.biz.rcp.statistics.statistics; + +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; + +@Controller +@Slf4j +@RequiredArgsConstructor +@RequestMapping("/admin/rcp/statistics/statistics") +public class StatisticsIntentController { + + @GetMapping("/intent/manage.do") + public String StatisticsIntentView(){ + return "/adm/rcp/statistics/statistics/intent"; + } + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/statistics/statistics/StatisticsResponseController.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/statistics/statistics/StatisticsResponseController.java new file mode 100644 index 0000000..fadd9f6 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/statistics/statistics/StatisticsResponseController.java @@ -0,0 +1,20 @@ +package com.icomsys.main_vm.biz.rcp.statistics.statistics; + +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; + +@Controller +@Slf4j +@RequiredArgsConstructor +@RequestMapping("/admin/rcp/statistics/statistics") +public class StatisticsResponseController { + + @GetMapping("/response/manage.do") + public String StatisticsResponseView(){ + return "/adm/rcp/statistics/statistics/response"; + } + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/statistics/statistics/StatisticsScenarioController.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/statistics/statistics/StatisticsScenarioController.java new file mode 100644 index 0000000..81f684c --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/statistics/statistics/StatisticsScenarioController.java @@ -0,0 +1,19 @@ +package com.icomsys.main_vm.biz.rcp.statistics.statistics; + +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; + +@Controller +@Slf4j +@RequiredArgsConstructor +@RequestMapping("/admin/rcp/statistics/statistics") +public class StatisticsScenarioController { + + @GetMapping("/scenario/manage.do") + public String StatisticsScenarioView(){ + return "/adm/rcp/statistics/statistics/scenario"; + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/statistics/statistics/StatisticsUsageController.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/statistics/statistics/StatisticsUsageController.java new file mode 100644 index 0000000..bf27626 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/statistics/statistics/StatisticsUsageController.java @@ -0,0 +1,20 @@ +package com.icomsys.main_vm.biz.rcp.statistics.statistics; + +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; + +@Controller +@Slf4j +@RequiredArgsConstructor +@RequestMapping("/admin/rcp/statistics/statistics") +public class StatisticsUsageController { + + @GetMapping("/use/manage.do") + public String StatisticsUsageView(){ + return "/adm/rcp/statistics/statistics/use"; + } + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/statistics/use/RecordController.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/statistics/use/RecordController.java new file mode 100644 index 0000000..d8d9c20 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/statistics/use/RecordController.java @@ -0,0 +1,20 @@ +package com.icomsys.main_vm.biz.rcp.statistics.use; + +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; + +@Controller +@Slf4j +@RequiredArgsConstructor +@RequestMapping("/admin/rcp/statistics/use") +public class RecordController { + + @GetMapping("/record/manage.do") + public String RecordView(){ + return "/adm/rcp/statistics/use/record"; + } + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/util/ScenarioConverter.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/util/ScenarioConverter.java new file mode 100644 index 0000000..bf449d8 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/rcp/util/ScenarioConverter.java @@ -0,0 +1,474 @@ +package com.icomsys.main_vm.biz.rcp.util; + +import com.icomsys.main_vm.biz.advice.excep.CustomBadRequestException; +import com.icomsys.main_vm.biz.advice.excep.CustomNoSuchFieldException; +import com.icomsys.main_vm.common.code.enumresource.ScenarioNodeType; +import com.icomsys.main_vm.common.util.HashUtil; +import com.jayway.jsonpath.DocumentContext; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.extern.slf4j.Slf4j; +import com.jayway.jsonpath.JsonPath; + +import java.security.NoSuchAlgorithmException; +import java.util.*; + +import org.json.JSONArray; +import org.json.JSONObject; + +@Slf4j +@Getter +@Setter +@NoArgsConstructor +public class ScenarioConverter { + private String diagramString; + private String diagramChecksum; + private String callScenarioString; + private String callScenarioChecksum; + private DocumentContext diagramContext; + + private Map diagramShapeKey; + private Map diagramConnector; + + public ScenarioConverter(String diagramString) { + this.diagramString = diagramString; + } + + public void createDiagramChecksum() throws NoSuchAlgorithmException { + diagramChecksum = HashUtil.getStringToChecksum(diagramString); + } + + public void createScenarioChecksum() throws NoSuchAlgorithmException { + callScenarioChecksum = HashUtil.getStringToChecksum(callScenarioString); + } + + public void createChecksum() throws NoSuchAlgorithmException { + diagramChecksum = HashUtil.getStringToChecksum(diagramString); + callScenarioChecksum = HashUtil.getStringToChecksum(callScenarioString); + } + + + + public void convertDiagramToCallScenario() throws CustomBadRequestException { + + JSONObject ojbCallScenario = new JSONObject(); + // JSONObject objCallInfo = new JSONObject(); // 기본변수 삭제됨 + + if (diagramContext == null) { + diagramContext = JsonPath.parse(diagramString); + } + // log.debug(diagramString); + + // 다이어그램 shape, connector 값 초기화 + createDiagramShapeKey(); + createDiagramConnector(); + + // 시나리오 변수 세팅 + ojbCallScenario.put("scenarioParam", convertScenarioParams()); + + JSONArray arrayNode = new JSONArray(); + List> shapes = diagramContext.read("$.shapes.[*].customData"); + + for (Map shape : shapes) { + + JSONObject objNode = new JSONObject(); + Integer nodeCode = (Integer) shape.get("nodeCode"); + objNode.put("nodeType", shape.get("nodeType")); + objNode.put("nodeCode", Integer.toString(nodeCode)); + objNode.put("nodeName", shape.get("nodeName")); + + String nextNode = findNextNodeCode(nodeCode); + objNode.put("nextNode", nextNode); + + String nodeType = (String)shape.get("nodeType"); + switch (ScenarioNodeType.findByName(nodeType)) { + case Intent: + convertIntent(objNode, shape); + break; + case Speak: + convertSpeak(objNode, shape); + break; + case Slot: + convertSlot(objNode, shape); + break; + case Split: + convertSplit(objNode, shape); + break; + case API: + convertAPI(objNode, shape); + break; + case Common: + convertCommon(objNode, shape); + break; + case Function: + convertFunction(objNode, shape); + break; + case Call: + convertCall(objNode, shape); + break; + case IN: + case OUT: + case HORIZONTALCONTAINER: + case VERTICALCONTAINER: + // 기본 세팅 없음 + break; + default: + throw new CustomBadRequestException("Undefined nodeType: " + nodeType); + } + + arrayNode.put(objNode); + } + + ojbCallScenario.put("scenario", arrayNode); + callScenarioString = ojbCallScenario.toString(); + // log.debug(callScenarioString); + } + + + private JSONObject convertScenarioParams(){ + JSONObject params = new JSONObject(); + LinkedHashMap scParams = diagramContext.read("$.scenarioParam"); + for (String paramKey: scParams.keySet()) { + params.put(paramKey, ""); + } + + return params; + } + + private void convertIntent(JSONObject objNode, Map node) { + JSONObject objIntent = new JSONObject(); + String[] keyNames = {"nodeMent", "intentSeq" }; + for (String keyName: keyNames) { + objIntent.put(keyName, node.get(keyName)); + } + + objNode.put("nodeOption", objIntent); + } + + private void convertSpeak(JSONObject objNode, Map node) { + JSONObject objSpeak = new JSONObject(); + String[] keyNames = {"nodeMent", "bargeIn", "endFlag" }; + for (String keyName: keyNames) { + objSpeak.put(keyName, node.get(keyName)); + } + + objNode.put("nodeOption", objSpeak); + } + + private void convertSlot(JSONObject objNode, Map node) { + JSONObject objSlot = new JSONObject(); + + String[] keyNames = {"paramName", "nodeMent", "bargeIn", "reNodeMent", "reBargeIn", "nodeQstCnt", "requiredYn", "actionType", "maxDigit", "entityType" }; + for (String keyName: keyNames) { + objSlot.put(keyName, node.get(keyName)); + } + + objNode.put("nodeOption", objSlot); + } + + private void convertSplit(JSONObject objNode, Map node) { + JSONObject objSplit = new JSONObject(); + + JSONArray arrayConditionList = new JSONArray(); + LinkedHashMap conditionList = (LinkedHashMap)node.get("conditionList"); + if (conditionList != null) { + + Set conditionKeySet = conditionList.keySet(); + + for (String key : conditionKeySet) { + LinkedHashMap condition = (LinkedHashMap)conditionList.get(key); + JSONObject objCondition = new JSONObject(); + objCondition.put("nextNode", String.valueOf(condition.get("nextNode"))); + objCondition.put("condition", (condition.get("condition") == null)? "" : condition.get("condition")); + objCondition.put("nodeMent", (condition.get("nodeMent") == null)? "" : condition.get("nodeMent")); + + arrayConditionList.put(objCondition); + } + } + + objSplit.put("conditionList",arrayConditionList); + objNode.put("nodeOption", objSplit); + } + + private void convertAPI(JSONObject objNode, Map node) { + JSONObject objAPI = new JSONObject(); + objAPI.put("apiNodeSeq", node.get("apiNodeSeq")); + + // 요청 파라메터 변환 + JSONArray arrayReqParamList = new JSONArray(); + LinkedHashMap reqParamList = (LinkedHashMap)node.get("reqParamList"); + if (reqParamList != null) { + for (int i=0; i < reqParamList.size(); i++) { + LinkedHashMap reqParam = (LinkedHashMap)reqParamList.get(Integer.toString(i)); + JSONObject objReqParam = new JSONObject(); + objReqParam.put("reqParamName", reqParam.get("reqParamName")); + objReqParam.put("reqParamMap", reqParam.get("reqParamMap")); + + arrayReqParamList.put(objReqParam); + } + } + + // 응답 파라메터 변환 + JSONArray arrayResParamList = new JSONArray(); + LinkedHashMap resParamList = (LinkedHashMap)node.get("resParamList"); + if (resParamList != null) { + for (int i=0; i < resParamList.size(); i++) { + LinkedHashMap resParam = (LinkedHashMap) resParamList.get(Integer.toString(i)); + JSONObject objResParam = new JSONObject(); + objResParam.put("resParamName", resParam.get("resParamName")); + objResParam.put("resParamMap", resParam.get("resParamMap")); + + arrayResParamList.put(objResParam); + } + } + objAPI.put("reqParamList", arrayReqParamList); + objAPI.put("resParamList", arrayResParamList); + objNode.put("nodeOption", objAPI); + } + + private void convertFunction(JSONObject objNode, Map node) { + JSONObject objFunction = new JSONObject(); + + String[] keyNames = {"javaScript"}; + for (String keyName: keyNames) { + objFunction.put(keyName, node.get(keyName)); + } + + JSONArray arrayFuncParam = new JSONArray(); + LinkedHashMap funcParam = (LinkedHashMap)node.get("funcParam"); + if (funcParam != null) { + Collection paramList = funcParam.values(); + for (Object paramName : paramList) { + arrayFuncParam.put((String)paramName); + } + } + objFunction.put("funcParam", arrayFuncParam); + + objNode.put("nodeOption", objFunction); + } + + private void convertCommon(JSONObject objNode, Map node) { + JSONObject objCommon = new JSONObject(); + + String[] keyNames = {"commonNodeSeq"}; + for (String keyName: keyNames) { + objCommon.put(keyName, node.get(keyName)); + } + + objNode.put("nodeOption", objCommon); + } + + private void convertCall(JSONObject objNode, Map node) { + JSONObject objCall = new JSONObject(); + + String[] keyNames = {"nodeMent", "bargeIn", "callProcess", "shopPhoneNumber"}; + for (String keyName: keyNames) { + objCall.put(keyName, node.get(keyName)); + } + + objNode.put("nodeOption", objCall); + } + + private void createDiagramShapeKey() { + if (diagramShapeKey == null) { + diagramShapeKey = new HashMap(); + } else { + diagramShapeKey.clear(); + } + + if (diagramContext == null) { + diagramContext = JsonPath.parse(diagramString); + } + + List> shapes = diagramContext.read("$.shapes.[*]"); + for (Map shape : shapes) { + String key = (String)shape.get("key"); + LinkedHashMap customData = (LinkedHashMap)shape.get("customData"); + Integer id = (Integer)customData.get("ID"); + + diagramShapeKey.put(id,key); + } + } + + private void createDiagramConnector() { + if (diagramConnector == null) { + diagramConnector = new HashMap(); + } else { + diagramConnector.clear(); + } + + if (diagramContext == null) { + diagramContext = JsonPath.parse(diagramString); + } + + List> connectors = diagramContext.read("$.connectors.[*]"); + for (Map connector : connectors) { + String begin = (String)connector.get("beginItemKey"); + String end = (String)connector.get("endItemKey"); + + diagramConnector.put(begin, end); + } + } + + private String findNextNodeCode(Integer nodeCode) { + String endKey = diagramConnector.get(diagramShapeKey.get(nodeCode)); + if (endKey == null) { + return ""; + } + + for(Map.Entry entry: diagramShapeKey.entrySet()) { + if (endKey.equals(entry.getValue())) { + return String.valueOf(entry.getKey()); + } + } + + return ""; + } + + public Long getIntentSeq() { + if (diagramContext == null) { + diagramContext = JsonPath.parse(diagramString); + } + List intentSeq = diagramContext.read("$.shapes.[?(@.type==\"Intent\")].customData.intentSeq"); + // List intentSeq = diagramContext.read("$.shapes[?(@.nodeType=='INTENT')].customData.intentSeq"); // javascript jsonpath에서는 동작 하지만 java에서 검색이 안됨 + + Long result = -1L; + if (intentSeq.size() != 0) { + result = Long.valueOf((Integer)intentSeq.get(0)); + } + return result; + } + + public void validationCheckScenario(String scenarioJsonString) throws CustomBadRequestException { + Boolean isSuccess = true; + String resultMessage = ""; + + DocumentContext scenarioContext = JsonPath.parse(scenarioJsonString); + List> nodes = scenarioContext.read("$.scenario.[*]"); + + for (Map node : nodes) { + String nodeType = (String)node.get("nodeType"); + String nodeCode = (String)node.get("nodeCode"); + Map nodeOption = (LinkedHashMap)node.get("nodeOption"); + + switch (ScenarioNodeType.findByName(nodeType)) { + case Intent: + if (isNotSettingInteger(nodeOption.get("intentSeq"))) { + resultMessage += String.format("[%s: %s] 인텐트가 설정되지 않았습니다.\n", nodeCode, nodeType); + isSuccess = false; + } + + break; + case Speak: + if (isEmptyString(nodeOption.get("nodeMent"))) { + isSuccess = false; + resultMessage += String.format("[%s: %s] 멘트가 설정되지 않았습니다.\n", nodeCode, nodeType); + } + + break; + case Slot: + if (isEmptyString(nodeOption.get("paramName"))) { + isSuccess = false; + resultMessage += String.format("[%s: %s] 파라메터ID가 설정되지 않았습니다.\n", nodeCode, nodeType); + } + + if (isEmptyString(nodeOption.get("nodeMent"))) { + isSuccess = false; + resultMessage += String.format("[%s: %s] 멘트가 설정되지 않았습니다.\n", nodeCode, nodeType); + } + + switch ((String)nodeOption.get("actionType")) { + case "STT": + case "MEMO": + String entityType = (String)nodeOption.get("entityType"); + if ( entityType.equals("") ){ + isSuccess = false; + resultMessage += String.format("[%s: %s] 엔티티타입이 설정되지 않았습니다.\n", nodeCode, nodeType); + } + break; + default: + } + + break; + case Split: + Object objConditions = nodeOption.get("conditionList"); + JSONArray conditions = new JSONArray(objConditions.toString()); + + if ( conditions.length() == 0) { + isSuccess = false; + resultMessage += String.format("[%s: %s] 연결된 다음 노드가 없습니다.\n", nodeCode, nodeType); + } + + for (int i=0; i < conditions.length() ; i++) { + JSONObject nextNodeInfo = (JSONObject) conditions.get(i); + if (isEmptyString(nextNodeInfo.get("condition"))) { + isSuccess = false; + resultMessage += String.format("[%s: %s] 다음 노드의 조건이 설정되지 않았습니다.\n", nodeCode, nodeType); + } + } + + break; + case API: + if (isNotSettingInteger(nodeOption.get("apiNodeSeq"))) { + resultMessage += String.format("[%s: %s] API노드가 설정되지 않았습니다.\n", nodeCode, nodeType); + isSuccess = false; + } + break; + case Common: + if (isNotSettingInteger(nodeOption.get("commonNodeSeq"))) { + resultMessage += String.format("[%s: %s] Common노드가 설정되지 않았습니다.\n", nodeCode, nodeType); + isSuccess = false; + } + break; + case Call: + String callProcess = String.valueOf(nodeOption.get("callProcess")); + if (callProcess.equals("none")) { + resultMessage += String.format("[%s: %s] 콜처리가 설정되지 않았습니다.\n", nodeCode, nodeType); + isSuccess = false; + } + + if (isEmptyString(nodeOption.get("nodeMent"))) { + isSuccess = false; + resultMessage += String.format("[%s: %s] 멘트가 설정되지 않았습니다.\n", nodeCode, nodeType); + } + break; + case Function: + case IN: + case OUT: + case HORIZONTALCONTAINER: + case VERTICALCONTAINER: + // 기본 세팅 없음 + break; + default: + throw new CustomBadRequestException("Undefined nodeType: " + nodeType); + } + + } + + if (!isSuccess) { + throw new CustomBadRequestException(resultMessage); + } + + } + + + + private boolean isEmptyString(Object checkObject) { + String str = (String) checkObject; + if (str == null || str.isEmpty()) { + return true; + } + return false; + } + + private boolean isNotSettingInteger(Object checkObject){ + Integer i = (Integer) checkObject; + if (i == null || i == -1) { + return true; + } + return false; + } + +} + diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/test/controller/CreateDataController.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/test/controller/CreateDataController.java new file mode 100644 index 0000000..b660067 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/test/controller/CreateDataController.java @@ -0,0 +1,54 @@ +package com.icomsys.main_vm.biz.test.controller; + +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RequestMapping("/data") +@RestController +@RequiredArgsConstructor +@Slf4j +public class CreateDataController { + + private final CreateDataService createDataService; + + @GetMapping("/test9") + public String test9() { +// createDataService.keyCreate(); + createDataService.createCust(); + createDataService.createServiceGroup(); + createDataService.createuserData(); + createDataService.createUserCust(); + createDataService.createCustPolicy(); + createDataService.createServiceAuthGroup(); + createDataService.createUserAuthGroup(); + createDataService.createServuceGroupPolicy(); + createDataService.createOpr(); +// createDataService.createCommon(); + createDataService.scenarioMaster(); + createDataService.scenarioHistory(); + createDataService.longtextManager(); + createDataService.uplususercreate(); + createDataService.commonCodeinsert(); + createDataService.tbProjectSettingdata(); + + + return "test9"; + } + + @GetMapping("/test10") + public String test10() { + createDataService.pagringdatacreate(); + return "test10"; + } + + @GetMapping("/test11") + public String test11() { + createDataService.userDataTest(); + return "test11"; + } + + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/test/controller/CreateDataService.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/test/controller/CreateDataService.java new file mode 100644 index 0000000..ed19388 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/test/controller/CreateDataService.java @@ -0,0 +1,1598 @@ +package com.icomsys.main_vm.biz.test.controller; + +import com.icomsys.main_vm.biz.common.common.service.SequenceService; +import com.icomsys.main_vm.common.code.enumresource.PolicyResource; +import com.icomsys.main_vm.common.code.enumresource.RoleResource; +import com.icomsys.main_vm.common.code.enumresource.SolTypeResource; +import com.icomsys.main_vm.db.jpa.entity.conversation.TbProjectSetting; +import com.icomsys.main_vm.db.jpa.entity.scenario.TbLongtextManager; +import com.icomsys.main_vm.db.jpa.entity.scenario.TbScenarioHistory; +import com.icomsys.main_vm.db.jpa.entity.scenario.TbScenarioMaster; +import com.icomsys.main_vm.db.jpa.entity.system.*; +import com.icomsys.main_vm.db.jpa.repo.conversation.TbProjectSettingRepo; +import com.icomsys.main_vm.db.jpa.repo.scenario.TbLongtextManagerRepo; +import com.icomsys.main_vm.db.jpa.repo.scenario.TbScenarioHistoryRepo; +import com.icomsys.main_vm.db.jpa.repo.scenario.TbScenarioMasterRepo; +import com.icomsys.main_vm.db.jpa.repo.system.*; +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.time.LocalDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.stream.Collectors; + +@Service +@Slf4j +@RequiredArgsConstructor +public class CreateDataService { + + private final TbBotCommonCodeRepo tbBotCommonCodeRepo; + private final TbBotUserRepo tbBotUserRepo; + private final TbCustPolicyRepo tbCustPolicyRepo; + private final TbIcsCustInfoRepo tbIcsCustInfoRepo; + private final TbIcsOprMngInfoRepo tbIcsOprMngInfoRepo; + private final TbServiceAuthGroupRepo tbServiceAuthGroupRepo; + private final TbServiceGrouopRepo tbServiceGrouopRepo; + private final TbServiceGroupPolicyRepo tbServiceGroupPolicyRepo; + private final TbUserAuthGroupRepo tbUserAuthGroupRepo; + private final TbUserCustRepo tbUserCustRepo; + private final SequenceService sequenceService; + private final PasswordEncoder passwordEncoder; + private final TbScenarioMasterRepo tbScenarioMasterRepo; + private final TbScenarioHistoryRepo tbScenarioHistoryRepo; + private final TbLongtextManagerRepo tbLongtextManagerRepo; + private final TbProjectSettingRepo tbProjectSettingRepo; + + +// @Transactional +// public void keyCreate() { +// tbKeyGenerateRepo.save(TbKeyGenerate.builder().tableName("TB_BOT_USER").nextId(500L).build()); +// tbKeyGenerateRepo.save(TbKeyGenerate.builder().tableName("TB_SERVICE_AUTH_GROUP").nextId(500L).build()); +// } + + + @Transactional + public void createuserData() { + if (!tbBotUserRepo.existsByUserId("sysadmin")) { + TbBotUser save1 = TbBotUser.builder() +// .userSeq(sequenceService.UserSeqNext()) + .userSeq(1L) + .custCode("ICS") + .lastUseServiceGroup("GROUP1") + .roleVal(RoleResource.SYSTEMADMIN.getName()) + .userId("sysadmin") + .password(passwordEncoder.encode("a1234")) + .userName("ICOMSYSADMIN") + .eMail("test@test.com") + .mobileNo("010-1234-5678") + .loginCheck(0) + .useYn("Y") + .registId("sysadmin") + .registDate(LocalDateTime.now()) + .updateId("sysadmin") + .updateDate(LocalDateTime.now()) + .build(); + tbBotUserRepo.save(save1); + } + } + + @Transactional + public void userDataTest() { + List aa = new ArrayList<>(); + for (int i = 0; i < 350; i++) { + TbBotUser save1 = TbBotUser.builder() +// .userSeq(sequenceService.UserSeqNext()) + .userSeq(1L + i) + .custCode("ICS") + .lastUseServiceGroup("GROUP1") + .roleVal(RoleResource.SYSTEMADMIN.getName()) + .userId("sysadmin" + i) + .password(passwordEncoder.encode("a1234")) + .userName("testSystemAdmin" + i) + .eMail("test@test.com" + i) + .mobileNo("010-1234-5678") + .loginCheck(0) + .useYn("Y") + .registId("sysadmin") + .registDate(LocalDateTime.now()) + .updateId("sysadmin") + .updateDate(LocalDateTime.now()) + .build(); + aa.add(save1); + } + tbBotUserRepo.saveAll(aa); + } + + @Transactional + public void createCust() { + TbIcsCustInfo save1 = TbIcsCustInfo.builder() + .custCode("ICS") + .custName("ICOMSYS") + .custTel("disable") + .custServiceMent("disable") + .useYn("Y") + .registId("sysadmin") + .registDate(LocalDateTime.now()) + .updateId("sysadmin") + .updateDate(LocalDateTime.now()) + .build(); + tbIcsCustInfoRepo.save(save1); + } + + @Transactional + public void createServiceGroup() { + TbServiceGrouop save1 = TbServiceGrouop.builder() + .serviceGroup("GROUP1") + .serviceGroupUpper("GROUP1") + .custCode("ICS") + .serviceType("M") + .serviceGroupName("서비스그룹테스트1") + .serviceGroupDesc("테스트용서비스그룹입니다.") + .useYn("Y") + .registId("sysadmin") + .registDate(LocalDateTime.now()) + .updateId("sysadmin") + .updateDate(LocalDateTime.now()) + .build(); + tbServiceGrouopRepo.save(save1); + TbServiceGrouop save2 = TbServiceGrouop.builder() + .serviceGroup("GROUP2") + .serviceGroupUpper("GROUP1") + .custCode("ICS") + .serviceType("S") + .serviceGroupName("서비스그룹테스트2") + .serviceGroupDesc("테스트용서비스그룹입니다.") + .useYn("Y") + .registId("sysadmin") + .registDate(LocalDateTime.now()) + .updateId("sysadmin") + .updateDate(LocalDateTime.now()) + .build(); + tbServiceGrouopRepo.save(save2); + + TbServiceGrouop save3 = TbServiceGrouop.builder() + .serviceGroup("GROUP3") + .serviceGroupUpper("GROUP1") + .custCode("ICS") + .serviceType("S") + .serviceGroupName("서비스그룹테스트3") + .serviceGroupDesc("테스트용서비스그룹입니다.") + .useYn("Y") + .registId("sysadmin") + .registDate(LocalDateTime.now()) + .updateId("sysadmin") + .updateDate(LocalDateTime.now()) + .build(); + tbServiceGrouopRepo.save(save3); + + TbServiceGrouop save4 = TbServiceGrouop.builder() + .serviceGroup("OURSTORE") + .serviceGroupUpper("OURSTORE") + .custCode("ICS") + .serviceType("M") + .serviceGroupName("우리가게") + .serviceGroupDesc("우리가게테스트용") + .useYn("Y") + .registId("sysadmin") + .registDate(LocalDateTime.now()) + .updateId("sysadmin") + .updateDate(LocalDateTime.now()) + .build(); + tbServiceGrouopRepo.save(save4); + TbServiceGrouop save5 = TbServiceGrouop.builder() + .serviceGroup("OURUTONG") + .serviceGroupUpper("OURSTORE") + .custCode("ICS") + .serviceType("S") + .serviceGroupName("우리가게-유통업") + .serviceGroupDesc("우리가게-유통업 테스트용") + .useYn("Y") + .registId("sysadmin") + .registDate(LocalDateTime.now()) + .updateId("sysadmin") + .updateDate(LocalDateTime.now()) + .build(); + tbServiceGrouopRepo.save(save5); + TbServiceGrouop save6 = TbServiceGrouop.builder() + .serviceGroup("OURYOSIC") + .serviceGroupUpper("OURSTORE") + .custCode("ICS") + .serviceType("S") + .serviceGroupName("우리가게-요식업") + .serviceGroupDesc("우리가게-요식업 테스트용") + .useYn("Y") + .registId("sysadmin") + .registDate(LocalDateTime.now()) + .updateId("sysadmin") + .updateDate(LocalDateTime.now()) + .build(); + tbServiceGrouopRepo.save(save6); + + TbServiceGrouop save7 = TbServiceGrouop.builder() + .serviceGroup("YOUSTORE") + .serviceGroupUpper("YOUSTORE") + .custCode("ICS") + .serviceType("M") + .serviceGroupName("너네가게") + .serviceGroupDesc("너네가게테스트용") + .useYn("Y") + .registId("sysadmin") + .registDate(LocalDateTime.now()) + .updateId("sysadmin") + .updateDate(LocalDateTime.now()) + .build(); + tbServiceGrouopRepo.save(save7); + TbServiceGrouop save8 = TbServiceGrouop.builder() + .serviceGroup("YOUUTONG") + .serviceGroupUpper("YOUSTORE") + .custCode("ICS") + .serviceType("S") + .serviceGroupName("너네가게-유통업") + .serviceGroupDesc("너네가게-유통업 테스트용") + .useYn("Y") + .registId("sysadmin") + .registDate(LocalDateTime.now()) + .updateId("sysadmin") + .updateDate(LocalDateTime.now()) + .build(); + tbServiceGrouopRepo.save(save8); + TbServiceGrouop save9 = TbServiceGrouop.builder() + .serviceGroup("YOUYOSIC") + .serviceGroupUpper("YOUSTORE") + .custCode("ICS") + .serviceType("S") + .serviceGroupName("너네가게-요식업") + .serviceGroupDesc("너네가게-요식업 테스트용") + .useYn("Y") + .registId("sysadmin") + .registDate(LocalDateTime.now()) + .updateId("sysadmin") + .updateDate(LocalDateTime.now()) + .build(); + tbServiceGrouopRepo.save(save9); + } + + + @Transactional + public void createUserCust() { + + TbUserCust save1 = TbUserCust.builder() + .custCode("ICS") + .serviceGroup("GROUP1") + .userSeq(1L) + .build(); + TbUserCust save2 = TbUserCust.builder() + .custCode("ICS") + .serviceGroup("GROUP2") + .userSeq(1L) + .build(); + TbUserCust save3 = TbUserCust.builder() + .custCode("ICS") + .serviceGroup("GROUP3") + .userSeq(1L) + .build(); + + TbUserCust save4 = TbUserCust.builder() + .custCode("ICS") + .serviceGroup("OURSTORE") + .userSeq(1L) + .build(); + TbUserCust save5 = TbUserCust.builder() + .custCode("ICS") + .serviceGroup("OURUTONG") + .userSeq(1L) + .build(); + TbUserCust save6 = TbUserCust.builder() + .custCode("ICS") + .serviceGroup("OURYOSIC") + .userSeq(1L) + .build(); + + TbUserCust save7 = TbUserCust.builder() + .custCode("ICS") + .serviceGroup("YOUSTORE") + .userSeq(1L) + .build(); + TbUserCust save8 = TbUserCust.builder() + .custCode("ICS") + .serviceGroup("YOUUTONG") + .userSeq(1L) + .build(); + TbUserCust save9 = TbUserCust.builder() + .custCode("ICS") + .serviceGroup("YOUYOSIC") + .userSeq(1L) + .build(); + tbUserCustRepo.save(save1); + tbUserCustRepo.save(save2); + tbUserCustRepo.save(save3); + tbUserCustRepo.save(save4); + tbUserCustRepo.save(save5); + tbUserCustRepo.save(save6); + tbUserCustRepo.save(save7); + tbUserCustRepo.save(save8); + tbUserCustRepo.save(save9); + + } + + @Transactional + public void createCustPolicy() { + List save1 = new ArrayList<>(); + PolicyResource.ALL.stream().forEach(e -> save1.add(TbCustPolicy.builder() + .serviceGroup("GROUP1") + .policyVal(e.getName()) + .custCode("ICS") + .build())); + List save2 = new ArrayList<>(); + PolicyResource.ALL.stream().forEach(e -> save2.add(TbCustPolicy.builder() + .serviceGroup("GROUP2") + .policyVal(e.getName()) + .custCode("ICS") + .build())); + List save3 = new ArrayList<>(); + PolicyResource.ALL.stream().forEach(e -> save3.add(TbCustPolicy.builder() + .serviceGroup("GROUP3") + .policyVal(e.getName()) + .custCode("ICS") + .build())); + + List save4 = new ArrayList<>(); + PolicyResource.ALL.stream().forEach(e -> save4.add(TbCustPolicy.builder() + .serviceGroup("OURSTORE") + .policyVal(e.getName()) + .custCode("ICS") + .build())); + List save5 = new ArrayList<>(); + PolicyResource.ALL.stream().forEach(e -> save5.add(TbCustPolicy.builder() + .serviceGroup("OURUTONG") + .policyVal(e.getName()) + .custCode("ICS") + .build())); + List save6 = new ArrayList<>(); + PolicyResource.ALL.stream().forEach(e -> save6.add(TbCustPolicy.builder() + .serviceGroup("OURYOSIC") + .policyVal(e.getName()) + .custCode("ICS") + .build())); + List save7 = new ArrayList<>(); + PolicyResource.ALL.stream().forEach(e -> save7.add(TbCustPolicy.builder() + .serviceGroup("YOUSTORE") + .policyVal(e.getName()) + .custCode("ICS") + .build())); + List save8 = new ArrayList<>(); + PolicyResource.ALL.stream().forEach(e -> save8.add(TbCustPolicy.builder() + .serviceGroup("YOUUTONG") + .policyVal(e.getName()) + .custCode("ICS") + .build())); + List save9 = new ArrayList<>(); + PolicyResource.ALL.stream().forEach(e -> save9.add(TbCustPolicy.builder() + .serviceGroup("YOUYOSIC") + .policyVal(e.getName()) + .custCode("ICS") + .build())); + + tbCustPolicyRepo.saveAll(save1); + tbCustPolicyRepo.saveAll(save2); + tbCustPolicyRepo.saveAll(save3); + tbCustPolicyRepo.saveAll(save4); + tbCustPolicyRepo.saveAll(save5); + tbCustPolicyRepo.saveAll(save6); + tbCustPolicyRepo.saveAll(save7); + tbCustPolicyRepo.saveAll(save8); + tbCustPolicyRepo.saveAll(save9); + } + + @Transactional + public void createServiceAuthGroup() { + if (!tbServiceAuthGroupRepo.existsById(1L)) { + tbServiceAuthGroupRepo.save(TbServiceAuthGroup.builder() + .authGroupSeq(1L) + .serviceGroup("GROUP1") + .custCode("ICS") + .policyGroupName("그룹1 전체권한") + .policyGroupDesc("저장테스트") + .useYn("Y") + .registId("sysadmin") + .registDate(LocalDateTime.now()) + .updateId("sysadmin") + .updateDate(LocalDateTime.now()) + .build()); + } + if (!tbServiceAuthGroupRepo.existsById(2L)) { + tbServiceAuthGroupRepo.save(TbServiceAuthGroup.builder() + .authGroupSeq(2L) + .serviceGroup("GROUP2") + .custCode("ICS") + .policyGroupName("그룹2 전체권한") + .policyGroupDesc("저장테스트") + .useYn("Y") + .registId("sysadmin") + .registDate(LocalDateTime.now()) + .updateId("sysadmin") + .updateDate(LocalDateTime.now()) + .build()); + } + if (!tbServiceAuthGroupRepo.existsById(3L)) { + tbServiceAuthGroupRepo.save(TbServiceAuthGroup.builder() + .authGroupSeq(3L) + .serviceGroup("GROUP3") + .custCode("ICS") + .policyGroupName("그룹3 전체권한") + .policyGroupDesc("저장테스트") + .useYn("Y") + .registId("sysadmin") + .registDate(LocalDateTime.now()) + .updateId("sysadmin") + .updateDate(LocalDateTime.now()) + .build()); + } + if (!tbServiceAuthGroupRepo.existsById(4L)) { + tbServiceAuthGroupRepo.save(TbServiceAuthGroup.builder() + .authGroupSeq(4L) + .serviceGroup("OURSTORE") + .custCode("ICS") + .policyGroupName("우리가게전체권한") + .policyGroupDesc("저장테스트") + .useYn("Y") + .registId("sysadmin") + .registDate(LocalDateTime.now()) + .updateId("sysadmin") + .updateDate(LocalDateTime.now()) + .build()); + } + if (!tbServiceAuthGroupRepo.existsById(5L)) { + tbServiceAuthGroupRepo.save(TbServiceAuthGroup.builder() + .authGroupSeq(5L) + .serviceGroup("OURUTONG") + .custCode("ICS") + .policyGroupName("우리가게유통업전체권한") + .policyGroupDesc("저장테스트") + .useYn("Y") + .registId("sysadmin") + .registDate(LocalDateTime.now()) + .updateId("sysadmin") + .updateDate(LocalDateTime.now()) + .build()); + } + if (!tbServiceAuthGroupRepo.existsById(6L)) { + tbServiceAuthGroupRepo.save(TbServiceAuthGroup.builder() + .authGroupSeq(6L) + .serviceGroup("OURYOSIC") + .custCode("ICS") + .policyGroupName("우리가게요식업전체권한") + .policyGroupDesc("저장테스트") + .useYn("Y") + .registId("sysadmin") + .registDate(LocalDateTime.now()) + .updateId("sysadmin") + .updateDate(LocalDateTime.now()) + .build()); + } + if (!tbServiceAuthGroupRepo.existsById(7L)) { + tbServiceAuthGroupRepo.save(TbServiceAuthGroup.builder() + .authGroupSeq(7L) + .serviceGroup("YOUSTORE") + .custCode("ICS") + .policyGroupName("너네가게전체권한") + .policyGroupDesc("저장테스트") + .useYn("Y") + .registId("sysadmin") + .registDate(LocalDateTime.now()) + .updateId("sysadmin") + .updateDate(LocalDateTime.now()) + .build()); + } + if (!tbServiceAuthGroupRepo.existsById(8L)) { + tbServiceAuthGroupRepo.save(TbServiceAuthGroup.builder() + .authGroupSeq(8L) + .serviceGroup("YOUUTONG") + .custCode("ICS") + .policyGroupName("너네가게유통업전체권한") + .policyGroupDesc("저장테스트") + .useYn("Y") + .registId("sysadmin") + .registDate(LocalDateTime.now()) + .updateId("sysadmin") + .updateDate(LocalDateTime.now()) + .build()); + } + if (!tbServiceAuthGroupRepo.existsById(9L)) { + tbServiceAuthGroupRepo.save(TbServiceAuthGroup.builder() + .authGroupSeq(9L) + .serviceGroup("YOUYOSIC") + .custCode("ICS") + .policyGroupName("너네가게요식업전체권한") + .policyGroupDesc("저장테스트") + .useYn("Y") + .registId("sysadmin") + .registDate(LocalDateTime.now()) + .updateId("sysadmin") + .updateDate(LocalDateTime.now()) + .build()); + } + } + + @Transactional + public void createUserAuthGroup() { + + tbUserAuthGroupRepo.save(TbUserAuthGroup.builder() + .userSeq(1L) + .authGroupSeq(1L) + .serviceGroup("GROUP1") + .custCode("ICS") + .build()); + tbUserAuthGroupRepo.save(TbUserAuthGroup.builder() + .userSeq(1L) + .authGroupSeq(2L) + .serviceGroup("GROUP2") + .custCode("ICS") + .build()); + tbUserAuthGroupRepo.save(TbUserAuthGroup.builder() + .userSeq(1L) + .authGroupSeq(3L) + .serviceGroup("GROUP3") + .custCode("ICS") + .build()); + + tbUserAuthGroupRepo.save(TbUserAuthGroup.builder() + .userSeq(1L) + .authGroupSeq(4L) + .serviceGroup("OURSTORE") + .custCode("ICS") + .build()); + + tbUserAuthGroupRepo.save(TbUserAuthGroup.builder() + .userSeq(1L) + .authGroupSeq(5L) + .serviceGroup("OURUTONG") + .custCode("ICS") + .build()); + tbUserAuthGroupRepo.save(TbUserAuthGroup.builder() + .userSeq(1L) + .authGroupSeq(6L) + .serviceGroup("OURYOSIC") + .custCode("ICS") + .build()); + tbUserAuthGroupRepo.save(TbUserAuthGroup.builder() + .userSeq(1L) + .authGroupSeq(7L) + .serviceGroup("YOUSTORE") + .custCode("ICS") + .build()); + tbUserAuthGroupRepo.save(TbUserAuthGroup.builder() + .userSeq(1L) + .authGroupSeq(8L) + .serviceGroup("YOUUTONG") + .custCode("ICS") + .build()); + tbUserAuthGroupRepo.save(TbUserAuthGroup.builder() + .userSeq(1L) + .authGroupSeq(9L) + .serviceGroup("YOUYOSIC") + .custCode("ICS") + .build()); + } + + + @Transactional + public void createServuceGroupPolicy() { + List saveList1 = new ArrayList<>(); + PolicyResource.ALL.stream().forEach(e -> + saveList1.add(TbServiceGroupPolicy.builder() + .authGroupSeq(1L) + .serviceGroup("GROUP1") + .policyVal(e.getName()) + .custCode("ICS") + .build()) + ); + + List saveList2 = new ArrayList<>(); + PolicyResource.ALL.stream().forEach(e -> + saveList2.add(TbServiceGroupPolicy.builder() + .authGroupSeq(2L) + .serviceGroup("GROUP2") + .policyVal(e.getName()) + .custCode("ICS") + .build()) + ); + + List saveList3 = new ArrayList<>(); + PolicyResource.ALL.stream().forEach(e -> + saveList3.add(TbServiceGroupPolicy.builder() + .authGroupSeq(3L) + .serviceGroup("GROUP3") + .policyVal(e.getName()) + .custCode("ICS") + .build()) + ); + + List saveList4 = new ArrayList<>(); + PolicyResource.ALL.stream().forEach(e -> + saveList4.add(TbServiceGroupPolicy.builder() + .authGroupSeq(4L) + .serviceGroup("OURSTORE") + .policyVal(e.getName()) + .custCode("ICS") + .build()) + ); + List saveList5 = new ArrayList<>(); + PolicyResource.ALL.stream().forEach(e -> + saveList5.add(TbServiceGroupPolicy.builder() + .authGroupSeq(5L) + .serviceGroup("OURUTONG") + .policyVal(e.getName()) + .custCode("ICS") + .build()) + ); + + List saveList6 = new ArrayList<>(); + PolicyResource.ALL.stream().forEach(e -> + saveList6.add(TbServiceGroupPolicy.builder() + .authGroupSeq(6L) + .serviceGroup("OURYOSIC") + .policyVal(e.getName()) + .custCode("ICS") + .build()) + ); + + List saveList7 = new ArrayList<>(); + PolicyResource.ALL.stream().forEach(e -> + saveList7.add(TbServiceGroupPolicy.builder() + .authGroupSeq(7L) + .serviceGroup("YOUSTORE") + .policyVal(e.getName()) + .custCode("ICS") + .build()) + ); + + List saveList8 = new ArrayList<>(); + PolicyResource.ALL.stream().forEach(e -> + saveList8.add(TbServiceGroupPolicy.builder() + .authGroupSeq(8L) + .serviceGroup("YOUUTONG") + .policyVal(e.getName()) + .custCode("ICS") + .build()) + ); + List saveList9 = new ArrayList<>(); + PolicyResource.ALL.stream().forEach(e -> + saveList9.add(TbServiceGroupPolicy.builder() + .authGroupSeq(9L) + .serviceGroup("YOUYOSIC") + .policyVal(e.getName()) + .custCode("ICS") + .build()) + ); + // OURSTORE +// OURUTONG +// OURYOSIC +// YOUSTORE +// YOUUTONG +// YOUYOSIC + + tbServiceGroupPolicyRepo.saveAll(saveList1); + tbServiceGroupPolicyRepo.saveAll(saveList2); + tbServiceGroupPolicyRepo.saveAll(saveList3); + tbServiceGroupPolicyRepo.saveAll(saveList4); + tbServiceGroupPolicyRepo.saveAll(saveList5); + tbServiceGroupPolicyRepo.saveAll(saveList6); + tbServiceGroupPolicyRepo.saveAll(saveList7); + tbServiceGroupPolicyRepo.saveAll(saveList8); + tbServiceGroupPolicyRepo.saveAll(saveList9); + } + + + @Transactional + public void pagringdatacreate() { + List ticis = new ArrayList<>(); + for (int i = 0; i < 350; i++) { + ticis.add(TbIcsCustInfo.builder() + .custCode("ICS" + i) + .custName("TESTNAME" + i) + .custTel("disable" + i) + .custServiceMent("disable" + i) + .useYn("Y") + .registId("sysadmin") + .registDate(LocalDateTime.now()) + .updateId("sysadmin") + .updateDate(LocalDateTime.now()) + .build()); + } + tbIcsCustInfoRepo.saveAll(ticis); + } + + @Transactional + public void createOpr() { + List oprs = new ArrayList<>(); +// String cust = "ICS"; + String solVal = SolTypeResource.RCP.getName(); +// List group = .stream().map(e -> e.getServiceGroup()) +// .collect(Collectors.toList()); + for (TbServiceGrouop e : tbServiceGrouopRepo.findAll()) { + oprs.add(TbIcsOprMngInfo + .builder() + .custCode(e.getCustCode()) + .serviceGroup(e.getServiceGroup()) + .solVal(SolTypeResource.RCP.getName()) + .oprMngCode(e.getCustCode() + "_" + solVal + "_" + e.getServiceGroup()) + .routeUrl("http://localhost:8092/bot/rcp/standard/process") + .useYn("Y") + .registId("sysadmin") + .registDate(LocalDateTime.now()) + .updateId("sysadmin") + .updateDate(LocalDateTime.now()) + .build()); + } + tbIcsOprMngInfoRepo.saveAll(oprs); + } + + + @Transactional + public void createCommon() { + List oprs = tbIcsOprMngInfoRepo.findAll().stream().map(e -> e.getOprMngCode()) + .collect(Collectors.toList()); + List tbccs = new ArrayList<>(); + AtomicInteger ai = new AtomicInteger(); + for (String e : oprs) { + int seq = ai.getAndIncrement(); + for (int i = 0; i < 90; i++) { + tbccs.add(TbBotCommonCode.builder() + .minorCode(seq + "minorCode" + i) + .majorCode(seq + "majorCode" + i) + .oprMngCode(e) + .codeName(seq + "Test" + i) + .attribute1(seq + "attri1bute" + i) + .attribute2(seq + "attri2bute" + i) + .attribute3(seq + "attri3bute" + i) + .registId("sysadmin") + .registDate(LocalDateTime.now()) + .updateId("sysadmin") + .updateDate(LocalDateTime.now()) + .build()); + } + } + tbBotCommonCodeRepo.saveAll(tbccs); + } + + @Transactional + public void scenarioMaster() { + if (!tbScenarioMasterRepo.existsById(1L)) { + tbScenarioMasterRepo.save(TbScenarioMaster.builder() + .oprMngCode("UPLUS_RCP_AISTORE") + .scenarioName("예약 시나리오 테스트") + .useYn("Y") + .registId("uplus") + .registDate(LocalDateTime.now()) + .updateId("uplus") + .updateDate(LocalDateTime.now()) + .build()); + } + + } + + @Transactional + public void scenarioHistory() { + if (!tbScenarioHistoryRepo.existsById(1L)) { + tbScenarioHistoryRepo.save(TbScenarioHistory.builder() + .masterSeq(1L) + .lastYn("Y") + .registId("uplus") + .registDate(LocalDateTime.now()) + .build()); + } + + } + + @Transactional + public void longtextManager() { + tbLongtextManagerRepo.save(TbLongtextManager.builder() + .rfSeq(2L) + .tableCode(2) + .columnCode(1) + .textContents("{\"page\":{\"width\":16782,\"height\":23812,\"pageColor\":-1,\"pageWidth\":8391,\"pageHeight\":11906,\"pageLandscape\":false},\"connectors\":[{\"key\":\"65\",\"dataKey\":\"c06365bf-ae13-4368-ba2f-aeec1da555db\",\"locked\":false,\"zIndex\":0,\"points\":[{\"x\":3027,\"y\":8846},{\"x\":4071,\"y\":8846}],\"beginItemKey\":\"0\",\"beginConnectionPointIndex\":-1,\"endItemKey\":\"3\",\"endConnectionPointIndex\":-1},{\"key\":\"66\",\"dataKey\":\"052ec6ca-af88-417c-a6ae-58ce8fe414a8\",\"locked\":false,\"zIndex\":0,\"points\":[{\"x\":6807,\"y\":8846},{\"x\":7851,\"y\":8846}],\"beginItemKey\":\"3\",\"beginConnectionPointIndex\":-1,\"endItemKey\":\"6\",\"endConnectionPointIndex\":-1},{\"key\":\"67\",\"dataKey\":\"37234d68-85d7-477a-a38f-30eed58c1d7c\",\"locked\":false,\"zIndex\":0,\"points\":[{\"x\":9219,\"y\":9386},{\"x\":9219,\"y\":10466}],\"beginItemKey\":\"6\",\"beginConnectionPointIndex\":-1,\"endItemKey\":\"10\",\"endConnectionPointIndex\":-1},{\"key\":\"68\",\"dataKey\":\"011b9f4d-2d7d-4115-b29b-8c9210803540\",\"locked\":false,\"zIndex\":0,\"points\":[{\"x\":9219,\"y\":11546},{\"x\":9219,\"y\":12626}],\"beginItemKey\":\"10\",\"beginConnectionPointIndex\":-1,\"endItemKey\":\"15\",\"endConnectionPointIndex\":-1},{\"key\":\"69\",\"dataKey\":\"bbadf868-891f-4c34-b40b-6c65b50239a4\",\"locked\":false,\"zIndex\":0,\"points\":[{\"x\":10587,\"y\":13166},{\"x\":11451,\"y\":13166}],\"beginItemKey\":\"15\",\"beginConnectionPointIndex\":-1,\"endItemKey\":\"17\",\"endConnectionPointIndex\":-1},{\"key\":\"70\",\"dataKey\":\"c8d28e9c-935d-433b-bb46-f054fdab6619\",\"locked\":false,\"zIndex\":0,\"points\":[{\"x\":12819,\"y\":13706},{\"x\":12819,\"y\":15506}],\"beginItemKey\":\"17\",\"beginConnectionPointIndex\":-1,\"endItemKey\":\"2\",\"endConnectionPointIndex\":-1},{\"key\":\"71\",\"dataKey\":\"853d1893-f79d-4861-b581-abf2231d34c3\",\"locked\":false,\"zIndex\":0,\"points\":[{\"x\":7851,\"y\":13166},{\"x\":6807,\"y\":13166}],\"beginItemKey\":\"15\",\"beginConnectionPointIndex\":-1,\"endItemKey\":\"31\",\"endConnectionPointIndex\":-1},{\"key\":\"72\",\"dataKey\":\"368f77f0-a307-49b4-a013-53e002f1b47d\",\"locked\":false,\"zIndex\":0,\"points\":[{\"x\":5439,\"y\":12626},{\"x\":5439,\"y\":11906}],\"beginItemKey\":\"31\",\"beginConnectionPointIndex\":-1,\"endItemKey\":\"40\",\"endConnectionPointIndex\":-1},{\"key\":\"73\",\"dataKey\":\"9c7a716e-0107-43ab-ae12-456a668c5be2\",\"locked\":false,\"zIndex\":0,\"points\":[{\"x\":5439,\"y\":10826},{\"x\":5439,\"y\":9386}],\"beginItemKey\":\"40\",\"beginConnectionPointIndex\":-1,\"endItemKey\":\"3\",\"endConnectionPointIndex\":-1},{\"key\":\"74\",\"dataKey\":\"757bbd79-b934-497c-9743-8a34ebfb734b\",\"locked\":false,\"zIndex\":0,\"points\":[{\"x\":4071,\"y\":11366},{\"x\":3027,\"y\":11366}],\"beginItemKey\":\"40\",\"beginConnectionPointIndex\":-1,\"endItemKey\":\"43\",\"endConnectionPointIndex\":-1},{\"key\":\"75\",\"dataKey\":\"e5219d54-11f8-454e-b282-61f57ba0cf8e\",\"locked\":false,\"zIndex\":0,\"points\":[{\"x\":11451,\"y\":16046},{\"x\":3027,\"y\":11366}],\"beginItemKey\":\"2\",\"beginConnectionPointIndex\":-1,\"endItemKey\":\"43\",\"endConnectionPointIndex\":-1}],\"shapes\":[{\"key\":\"0\",\"dataKey\":1,\"customData\":{\"type\":\"Intent Node\",\"text\":\"\",\"ID\":1,\"nodeCode\":1,\"nodeName\":\"예약시작\",\"intentName\":\"예약\",\"ment\":\"예약을 진행하겠습니다.\"},\"locked\":false,\"zIndex\":0,\"type\":\"Intent Node\",\"text\":\"\",\"x\":291,\"y\":8306,\"width\":2736,\"height\":1080},{\"key\":\"2\",\"dataKey\":3,\"customData\":{\"type\":\"Speak Node\",\"text\":\"\",\"ID\":3,\"nodeCode\":3,\"nodeName\":\"예약완료멘트\",\"ment\":\"예약을 완료하였습니다.\"},\"locked\":false,\"zIndex\":0,\"type\":\"Speak Node\",\"text\":\"\",\"x\":11451,\"y\":15506,\"width\":2736,\"height\":1080},{\"key\":\"3\",\"dataKey\":4,\"customData\":{\"type\":\"Slot Node\",\"text\":\"\",\"ID\":4,\"nodeCode\":4,\"nodeName\":\"예약 시간 받기\",\"parameterId\":\"예약시간\",\"ment\":\"예약 시간을 말씀해주세요\",\"reMent\":\"죄송합니다. 한번더 예약 시간을 말씀해주세요\",\"reMentCnt\":\"3\",\"requiredQuestion\":true},\"locked\":false,\"zIndex\":0,\"type\":\"Slot Node\",\"text\":\"\",\"x\":4071,\"y\":8306,\"width\":2736,\"height\":1080},{\"key\":\"6\",\"dataKey\":5,\"customData\":{\"type\":\"API Node\",\"text\":\"\",\"ID\":5,\"nodeCode\":5,\"nodeName\":\"예약 가능 확인\",\"apiNode\":\"API 노드 테스트\"},\"locked\":false,\"zIndex\":0,\"type\":\"API Node\",\"text\":\"\",\"x\":7851,\"y\":8306,\"width\":2736,\"height\":1080},{\"key\":\"10\",\"dataKey\":6,\"customData\":{\"type\":\"Function Node\",\"text\":\"\",\"ID\":6,\"nodeCode\":6,\"nodeName\":\"예약 가능 여부 확인\",\"fParams\":[\"예약시간\",\"예약가능여부\"]},\"locked\":false,\"zIndex\":0,\"type\":\"Function Node\",\"text\":\"\",\"x\":7851,\"y\":10466,\"width\":2736,\"height\":1080},{\"key\":\"15\",\"dataKey\":7,\"customData\":{\"type\":\"Split Node\",\"text\":\"\",\"ID\":7,\"nodeCode\":7,\"nodeName\":\"예약 가능 여부 확인\",\"condition0\":\"#{예약가능여부} = 1\",\"condition1\":\"#{예약가능여부} = 2\",\"ment1\":\"해당 시간에는 예약이 마감되었습니다.\"},\"locked\":false,\"zIndex\":0,\"type\":\"Split Node\",\"text\":\"\",\"x\":7851,\"y\":12626,\"width\":2736,\"height\":1080},{\"key\":\"17\",\"dataKey\":8,\"customData\":{\"type\":\"API Node\",\"text\":\"\",\"ID\":8,\"nodeCode\":8,\"nodeName\":\"예약진행\"},\"locked\":false,\"zIndex\":0,\"type\":\"API Node\",\"text\":\"\",\"x\":11451,\"y\":12626,\"width\":2736,\"height\":1080},{\"key\":\"31\",\"dataKey\":10,\"customData\":{\"type\":\"Slot Node\",\"text\":\"\",\"ID\":10,\"nodeCode\":10,\"nodeName\":\"예약 실패 다시 예약 확인\",\"parameterId\":\"YESNO\",\"ment\":\"다른 시간에 예약 하시겠습니까?\",\"requiredQuestion\":true},\"locked\":false,\"zIndex\":0,\"type\":\"Slot Node\",\"text\":\"\",\"x\":4071,\"y\":12626,\"width\":2736,\"height\":1080},{\"key\":\"40\",\"dataKey\":11,\"customData\":{\"type\":\"Split Node\",\"text\":\"\",\"ID\":11,\"nodeCode\":11,\"nodeName\":\"예약 다시 받기\",\"condition0\":\"#{YESNO} = 'YES'\",\"condition1\":\"#{YESNO} = 'NO'\"},\"locked\":false,\"zIndex\":0,\"type\":\"Split Node\",\"text\":\"\",\"x\":4071,\"y\":10826,\"width\":2736,\"height\":1080},{\"key\":\"43\",\"dataKey\":12,\"customData\":{\"type\":\"Call Node\",\"text\":\"\",\"ID\":12,\"nodeCode\":12,\"nodeName\":\"호종료\",\"ment\":\"감사합니다. \"},\"locked\":false,\"zIndex\":0,\"type\":\"Call Node\",\"text\":\"\",\"x\":291,\"y\":10826,\"width\":2736,\"height\":1080}],\"scenarioParam\":{\"예약시간\":[4,6],\"예약가능여부\":[6],\"YESNO\":[10]}}") + .checksum("0AiYZYQgCy3B8JAKtlKCgw==") + .build()); + } + + @Transactional + public void uplususercreate() { + if (!tbBotUserRepo.existsById(2L)) { + tbBotUserRepo.save(TbBotUser.builder() + .userSeq(2L) + .custCode("UPLUS") + .lastUseServiceGroup("OURSTOREAI") + .roleVal(RoleResource.USERADMIN.getName()) + .userId("uplus") + .password(passwordEncoder.encode("1")) + .userName("유플러스어드민") + .loginCheck(0) + .useYn("Y") + .registId("sysadmin") + .registDate(LocalDateTime.now()) + .updateId("sysadmin") + .updateDate(LocalDateTime.now()) + .build()); + } + if (!tbBotUserRepo.existsById(3L)) { + tbBotUserRepo.save(TbBotUser.builder() + .userSeq(3L) + .custCode("UPLUS") + .lastUseServiceGroup("OURSTOREAI") + .roleVal(RoleResource.USER.getName()) + .userId("uplususer1") + .password(passwordEncoder.encode("1")) + .userName("유플러스유저1") + .loginCheck(0) + .useYn("Y") + .registId("sysadmin") + .registDate(LocalDateTime.now()) + .updateId("sysadmin") + .updateDate(LocalDateTime.now()) + .build()); + } + if (!tbBotUserRepo.existsById(4L)) { + tbBotUserRepo.save(TbBotUser.builder() + .userSeq(4L) + .custCode("UPLUS") + .lastUseServiceGroup("OURSTOREAI") + .roleVal(RoleResource.USER.getName()) + .userId("uplususer2") + .password(passwordEncoder.encode("1")) + .userName("유플러스유저2") + .loginCheck(0) + .useYn("Y") + .registId("sysadmin") + .registDate(LocalDateTime.now()) + .updateId("sysadmin") + .updateDate(LocalDateTime.now()) + .build()); + } + + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("commonsystemcustmanageFull").serviceGroup("AISTORE").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("commonsystemcustmanageFull").serviceGroup("DAISO").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("commonsystemcustmanageFull").serviceGroup("OURSTOREAI").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("commonsystemcustmanageRead").serviceGroup("AISTORE").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("commonsystemcustmanageRead").serviceGroup("DAISO").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("commonsystemcustmanageRead").serviceGroup("OURSTOREAI").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("commonsystemgroupAuthmanageFull").serviceGroup("AISTORE").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("commonsystemgroupAuthmanageFull").serviceGroup("DAISO").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("commonsystemgroupAuthmanageFull").serviceGroup("OURSTOREAI").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("commonsystemgroupAuthmanageRead").serviceGroup("AISTORE").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("commonsystemgroupAuthmanageRead").serviceGroup("DAISO").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("commonsystemgroupAuthmanageRead").serviceGroup("OURSTOREAI").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("commonsystemoprmngcodemanageFull").serviceGroup("AISTORE").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("commonsystemoprmngcodemanageFull").serviceGroup("DAISO").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("commonsystemoprmngcodemanageFull").serviceGroup("OURSTOREAI").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("commonsystemoprmngcodemanageRead").serviceGroup("AISTORE").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("commonsystemoprmngcodemanageRead").serviceGroup("DAISO").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("commonsystemoprmngcodemanageRead").serviceGroup("OURSTOREAI").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("commonsystemRead").serviceGroup("AISTORE").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("commonsystemRead").serviceGroup("DAISO").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("commonsystemRead").serviceGroup("OURSTOREAI").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("commonsystemserviceGroupmanageFull").serviceGroup("AISTORE").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("commonsystemserviceGroupmanageFull").serviceGroup("DAISO").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("commonsystemserviceGroupmanageFull").serviceGroup("OURSTOREAI").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("commonsystemserviceGroupmanageRead").serviceGroup("AISTORE").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("commonsystemserviceGroupmanageRead").serviceGroup("DAISO").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("commonsystemserviceGroupmanageRead").serviceGroup("OURSTOREAI").build()); +// tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("commonsystemuserAdminmanageFull").serviceGroup("AISTORE").build()); +// tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("commonsystemuserAdminmanageFull").serviceGroup("DAISO").build()); +// tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("commonsystemuserAdminmanageFull").serviceGroup("OURSTOREAI").build()); +// tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("commonsystemuserAdminmanageRead").serviceGroup("AISTORE").build()); +// tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("commonsystemuserAdminmanageRead").serviceGroup("DAISO").build()); +// tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("commonsystemuserAdminmanageRead").serviceGroup("OURSTOREAI").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("commonsystemusermanageFull").serviceGroup("AISTORE").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("commonsystemusermanageFull").serviceGroup("DAISO").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("commonsystemusermanageFull").serviceGroup("OURSTOREAI").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("commonsystemusermanageRead").serviceGroup("AISTORE").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("commonsystemusermanageRead").serviceGroup("DAISO").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("commonsystemusermanageRead").serviceGroup("OURSTOREAI").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("privacymasking").serviceGroup("AISTORE").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("privacymasking").serviceGroup("DAISO").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("privacymasking").serviceGroup("OURSTOREAI").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpconversationapiNodemanageFull").serviceGroup("AISTORE").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpconversationapiNodemanageFull").serviceGroup("DAISO").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpconversationapiNodemanageFull").serviceGroup("OURSTOREAI").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpconversationapiNodemanageRead").serviceGroup("AISTORE").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpconversationapiNodemanageRead").serviceGroup("DAISO").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpconversationapiNodemanageRead").serviceGroup("OURSTOREAI").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpconversationcmmNodemanageFull").serviceGroup("AISTORE").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpconversationcmmNodemanageFull").serviceGroup("DAISO").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpconversationcmmNodemanageFull").serviceGroup("OURSTOREAI").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpconversationcmmNodemanageRead").serviceGroup("AISTORE").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpconversationcmmNodemanageRead").serviceGroup("DAISO").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpconversationcmmNodemanageRead").serviceGroup("OURSTOREAI").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpconversationintentmanageFull").serviceGroup("AISTORE").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpconversationintentmanageFull").serviceGroup("DAISO").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpconversationintentmanageFull").serviceGroup("OURSTOREAI").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpconversationintentmanageRead").serviceGroup("AISTORE").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpconversationintentmanageRead").serviceGroup("DAISO").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpconversationintentmanageRead").serviceGroup("OURSTOREAI").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpconversationRead").serviceGroup("AISTORE").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpconversationRead").serviceGroup("DAISO").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpconversationRead").serviceGroup("OURSTOREAI").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpconversationscenariomanageFull").serviceGroup("AISTORE").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpconversationscenariomanageFull").serviceGroup("DAISO").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpconversationscenariomanageFull").serviceGroup("OURSTOREAI").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpconversationscenariomanageRead").serviceGroup("AISTORE").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpconversationscenariomanageRead").serviceGroup("DAISO").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpconversationscenariomanageRead").serviceGroup("OURSTOREAI").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpconversationscenariomanageRelease").serviceGroup("AISTORE").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpconversationscenariomanageRelease").serviceGroup("DAISO").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpconversationscenariomanageRelease").serviceGroup("OURSTOREAI").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpconversationsynonymmanageFull").serviceGroup("AISTORE").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpconversationsynonymmanageFull").serviceGroup("DAISO").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpconversationsynonymmanageFull").serviceGroup("OURSTOREAI").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpconversationsynonymmanageRead").serviceGroup("AISTORE").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpconversationsynonymmanageRead").serviceGroup("DAISO").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpconversationsynonymmanageRead").serviceGroup("OURSTOREAI").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpconversationsystemEntitymanageRead").serviceGroup("AISTORE").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpconversationsystemEntitymanageRead").serviceGroup("DAISO").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpconversationsystemEntitymanageRead").serviceGroup("OURSTOREAI").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcplearningTestinferencemanageFull").serviceGroup("AISTORE").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcplearningTestinferencemanageFull").serviceGroup("DAISO").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcplearningTestinferencemanageFull").serviceGroup("OURSTOREAI").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcplearningTestinferencemanageRead").serviceGroup("AISTORE").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcplearningTestinferencemanageRead").serviceGroup("DAISO").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcplearningTestinferencemanageRead").serviceGroup("OURSTOREAI").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcplearningTestRead").serviceGroup("AISTORE").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcplearningTestRead").serviceGroup("DAISO").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcplearningTestRead").serviceGroup("OURSTOREAI").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcplearningTestsimulatormanageFull").serviceGroup("AISTORE").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcplearningTestsimulatormanageFull").serviceGroup("DAISO").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcplearningTestsimulatormanageFull").serviceGroup("OURSTOREAI").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcplearningTestsimulatormanageRead").serviceGroup("AISTORE").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcplearningTestsimulatormanageRead").serviceGroup("DAISO").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcplearningTestsimulatormanageRead").serviceGroup("OURSTOREAI").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcplearningTeststttestmanageRead").serviceGroup("AISTORE").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcplearningTeststttestmanageRead").serviceGroup("DAISO").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcplearningTeststttestmanageRead").serviceGroup("OURSTOREAI").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcplearningTestttstestmanageRead").serviceGroup("AISTORE").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcplearningTestttstestmanageRead").serviceGroup("DAISO").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcplearningTestttstestmanageRead").serviceGroup("OURSTOREAI").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpmonitoringconsultingmanageFull").serviceGroup("AISTORE").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpmonitoringconsultingmanageFull").serviceGroup("DAISO").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpmonitoringconsultingmanageFull").serviceGroup("OURSTOREAI").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpmonitoringconsultingmanageRead").serviceGroup("AISTORE").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpmonitoringconsultingmanageRead").serviceGroup("DAISO").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpmonitoringconsultingmanageRead").serviceGroup("OURSTOREAI").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpmonitoringconversationMarkmanageFull").serviceGroup("AISTORE").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpmonitoringconversationMarkmanageFull").serviceGroup("DAISO").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpmonitoringconversationMarkmanageFull").serviceGroup("OURSTOREAI").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpmonitoringconversationMarkmanageRead").serviceGroup("AISTORE").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpmonitoringconversationMarkmanageRead").serviceGroup("DAISO").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpmonitoringconversationMarkmanageRead").serviceGroup("OURSTOREAI").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpmonitoringintentAnalysismanageFull").serviceGroup("AISTORE").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpmonitoringintentAnalysismanageFull").serviceGroup("DAISO").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpmonitoringintentAnalysismanageFull").serviceGroup("OURSTOREAI").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpmonitoringintentAnalysismanageRead").serviceGroup("AISTORE").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpmonitoringintentAnalysismanageRead").serviceGroup("DAISO").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpmonitoringintentAnalysismanageRead").serviceGroup("OURSTOREAI").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpmonitoringoutscenariomanageFull").serviceGroup("AISTORE").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpmonitoringoutscenariomanageFull").serviceGroup("DAISO").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpmonitoringoutscenariomanageFull").serviceGroup("OURSTOREAI").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpmonitoringoutscenariomanageRead").serviceGroup("AISTORE").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpmonitoringoutscenariomanageRead").serviceGroup("DAISO").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpmonitoringoutscenariomanageRead").serviceGroup("OURSTOREAI").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpmonitoringRead").serviceGroup("AISTORE").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpmonitoringRead").serviceGroup("DAISO").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpmonitoringRead").serviceGroup("OURSTOREAI").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpmonitoringworkhistorymanageRead").serviceGroup("AISTORE").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpmonitoringworkhistorymanageRead").serviceGroup("DAISO").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpmonitoringworkhistorymanageRead").serviceGroup("OURSTOREAI").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpoprmanagebgmmanageFull").serviceGroup("AISTORE").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpoprmanagebgmmanageFull").serviceGroup("DAISO").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpoprmanagebgmmanageFull").serviceGroup("OURSTOREAI").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpoprmanagebgmmanageRead").serviceGroup("AISTORE").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpoprmanagebgmmanageRead").serviceGroup("DAISO").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpoprmanagebgmmanageRead").serviceGroup("OURSTOREAI").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpoprmanagenlpSettingmanageFull").serviceGroup("AISTORE").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpoprmanagenlpSettingmanageFull").serviceGroup("DAISO").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpoprmanagenlpSettingmanageFull").serviceGroup("OURSTOREAI").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpoprmanagenlpSettingmanageRead").serviceGroup("AISTORE").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpoprmanagenlpSettingmanageRead").serviceGroup("DAISO").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpoprmanagenlpSettingmanageRead").serviceGroup("OURSTOREAI").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpoprmanageRead").serviceGroup("AISTORE").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpoprmanageRead").serviceGroup("DAISO").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpoprmanageRead").serviceGroup("OURSTOREAI").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpstatisticscallinfomanageRead").serviceGroup("AISTORE").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpstatisticscallinfomanageRead").serviceGroup("DAISO").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpstatisticscallinfomanageRead").serviceGroup("OURSTOREAI").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpstatisticscallRead").serviceGroup("AISTORE").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpstatisticscallRead").serviceGroup("DAISO").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpstatisticscallRead").serviceGroup("OURSTOREAI").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpstatisticsintentdaymanageRead").serviceGroup("AISTORE").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpstatisticsintentdaymanageRead").serviceGroup("DAISO").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpstatisticsintentdaymanageRead").serviceGroup("OURSTOREAI").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpstatisticsintentitemmanageRead").serviceGroup("AISTORE").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpstatisticsintentitemmanageRead").serviceGroup("DAISO").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpstatisticsintentitemmanageRead").serviceGroup("OURSTOREAI").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpstatisticsintentRead").serviceGroup("AISTORE").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpstatisticsintentRead").serviceGroup("DAISO").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpstatisticsintentRead").serviceGroup("OURSTOREAI").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpstatisticsRead").serviceGroup("AISTORE").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpstatisticsRead").serviceGroup("DAISO").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpstatisticsRead").serviceGroup("OURSTOREAI").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpstatisticsscenariodaymanageRead").serviceGroup("AISTORE").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpstatisticsscenariodaymanageRead").serviceGroup("DAISO").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpstatisticsscenariodaymanageRead").serviceGroup("OURSTOREAI").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpstatisticsscenarioitemmanageRead").serviceGroup("AISTORE").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpstatisticsscenarioitemmanageRead").serviceGroup("DAISO").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpstatisticsscenarioitemmanageRead").serviceGroup("OURSTOREAI").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpstatisticsscenarioRead").serviceGroup("AISTORE").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpstatisticsscenarioRead").serviceGroup("DAISO").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpstatisticsscenarioRead").serviceGroup("OURSTOREAI").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rootRead").serviceGroup("AISTORE").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rootRead").serviceGroup("DAISO").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rootRead").serviceGroup("OURSTOREAI").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpoprmanagettstagmanageFull").serviceGroup("AISTORE").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpoprmanagettstagmanageFull").serviceGroup("DAISO").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpoprmanagettstagmanageFull").serviceGroup("OURSTOREAI").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpoprmanagettstagmanageRead").serviceGroup("AISTORE").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpoprmanagettstagmanageRead").serviceGroup("DAISO").build()); + tbCustPolicyRepo.save(TbCustPolicy.builder().custCode("UPLUS").policyVal("rcpoprmanagettstagmanageRead").serviceGroup("OURSTOREAI").build()); + + tbIcsCustInfoRepo.save(TbIcsCustInfo.builder() + .custCode("UPLUS") + .custName("유플러스") + .useYn("Y") + .registId("sysadmin") + .registDate(LocalDateTime.now()) + .updateId("sysadmin") + .updateDate(LocalDateTime.now()) + .build()); + + tbIcsOprMngInfoRepo.save(TbIcsOprMngInfo.builder() + .custCode("UPLUS") + .serviceGroup("AISTORE") + .oprMngCode("UPLUS_RCP_AISTORE") + .solVal("RCP") + .useYn("Y") + .routeUrl("http://localhost:8092/bot/rcp/standard/process") + .registId("sysadmin") + .registDate(LocalDateTime.now()) + .updateId("sysadmin") + .updateDate(LocalDateTime.now()) + .build()); + tbIcsOprMngInfoRepo.save(TbIcsOprMngInfo.builder() + .custCode("UPLUS") + .serviceGroup("DAISO") + .oprMngCode("UPLUS_RCP_DAISO") + .solVal("RCP") + .useYn("Y") + .routeUrl("http://localhost:8092/bot/rcp/standard/process") + .registId("sysadmin") + .registDate(LocalDateTime.now()) + .updateId("sysadmin") + .updateDate(LocalDateTime.now()) + .build()); + tbIcsOprMngInfoRepo.save(TbIcsOprMngInfo.builder() + .custCode("UPLUS") + .serviceGroup("OURSTOREAI") + .oprMngCode("UPLUS_RCP_OURSTOREAI") + .solVal("RCP") + .useYn("Y") + .routeUrl("http://localhost:8092/bot/rcp/standard/process") + .registId("sysadmin") + .registDate(LocalDateTime.now()) + .updateId("sysadmin") + .updateDate(LocalDateTime.now()) + .build()); + +// tbIcsOprMngInfoRepo.save(TbIcsOprMngInfo.builder() +// .custCode("UPLUS") +// .serviceGroup("COMMON") +// .oprMngCode("UPLUS_RCP_COMMON") +// .solVal("RCP") +// .useYn("Y") +// .routeUrl("http://localhost:8092/bot/rcp/standard/process") +// .registId("sysadmin") +// .registDate(LocalDateTime.now()) +// .updateId("sysadmin") +// .updateDate(LocalDateTime.now()) +// .build()); + + + if (!tbServiceAuthGroupRepo.existsById(10L)) { + tbServiceAuthGroupRepo.save(TbServiceAuthGroup.builder() + .authGroupSeq(10L) + .serviceGroup("OURSTOREAI") + .custCode("UPLUS") + .policyGroupName("우리가게AI 전체권한") + .policyGroupDesc("우리가게AI 전체권한") + .useYn("Y") + .registId("sysadmin") + .registDate(LocalDateTime.now()) + .updateId("sysadmin") + .updateDate(LocalDateTime.now()) + .build()); + } + if (!tbServiceAuthGroupRepo.existsById(11L)) { + tbServiceAuthGroupRepo.save(TbServiceAuthGroup.builder() + .authGroupSeq(11L) + .serviceGroup("AISTORE") + .custCode("UPLUS") + .policyGroupName("요식업유저용전체권한") + .policyGroupDesc("요식업유저용전체권한") + .useYn("Y") + .registId("sysadmin") + .registDate(LocalDateTime.now()) + .updateId("sysadmin") + .updateDate(LocalDateTime.now()) + .build()); + } + if (!tbServiceAuthGroupRepo.existsById(12L)) { + tbServiceAuthGroupRepo.save(TbServiceAuthGroup.builder() + .authGroupSeq(12L) + .serviceGroup("DAISO") + .custCode("UPLUS") + .policyGroupName("유통업유저용전체권한") + .policyGroupDesc("유통업유저용전체권한") + .useYn("Y") + .registId("sysadmin") + .registDate(LocalDateTime.now()) + .updateId("sysadmin") + .updateDate(LocalDateTime.now()) + .build()); + } + if (!tbServiceAuthGroupRepo.existsById(13L)) { + tbServiceAuthGroupRepo.save(TbServiceAuthGroup.builder() + .authGroupSeq(13L) + .serviceGroup("AISTORE") + .custCode("UPLUS") + .policyGroupName("시나리오관리읽기권한") + .policyGroupDesc("테스트용 시나리오관리 읽기권한") + .useYn("Y") + .registId("sysadmin") + .registDate(LocalDateTime.now()) + .updateId("sysadmin") + .updateDate(LocalDateTime.now()) + .build()); + } + if (!tbServiceAuthGroupRepo.existsById(14L)) { + tbServiceAuthGroupRepo.save(TbServiceAuthGroup.builder() + .authGroupSeq(14L) + .serviceGroup("AISTORE") + .custCode("UPLUS") + .policyGroupName("시나리오관리수정,배포권한") + .policyGroupDesc("테스트용 시나리오관리수정,배포권한") + .useYn("Y") + .registId("sysadmin") + .registDate(LocalDateTime.now()) + .updateId("sysadmin") + .updateDate(LocalDateTime.now()) + .build()); + } + + tbServiceGrouopRepo.save(TbServiceGrouop.builder() + .serviceGroup("AISTORE") + .serviceGroupUpper("OURSTOREAI") + .custCode("UPLUS") + .serviceType("S") + .serviceGroupName("요식업") + .serviceGroupDesc("유플러스 요식업") + .useYn("Y") + .registId("sysadmin") + .registDate(LocalDateTime.now()) + .updateId("sysadmin") + .build()); + + tbServiceGrouopRepo.save(TbServiceGrouop.builder() + .serviceGroup("DAISO") + .serviceGroupUpper("OURSTOREAI") + .custCode("UPLUS") + .serviceType("S") + .serviceGroupName("유통업") + .serviceGroupDesc("유플러스 유통업") + .useYn("Y") + .registId("sysadmin") + .registDate(LocalDateTime.now()) + .updateId("sysadmin") + .build()); + + tbServiceGrouopRepo.save(TbServiceGrouop.builder() + .serviceGroup("OURSTOREAI") + .serviceGroupUpper("OURSTOREAI") + .custCode("UPLUS") + .serviceType("M") + .serviceGroupName("우리가게AI") + .serviceGroupDesc("우리가게AI루트계정") + .useYn("Y") + .registId("sysadmin") + .registDate(LocalDateTime.now()) + .updateId("sysadmin") + .build()); + +// tbServiceGrouopRepo.save(TbServiceGrouop.builder() +// .serviceGroup("COMMON") +// .serviceGroupUpper("OURSTOREAI") +// .custCode("UPLUS") +// .serviceType("S") +// .serviceGroupName("공통") +// .serviceGroupDesc("우리가게AI공통계정") +// .useYn("Y") +// .registId("sysadmin") +// .registDate(LocalDateTime.now()) +// .updateId("sysadmin") +// .build()); + + if (!tbServiceGroupPolicyRepo.existsByAuthGroupSeq(10L)) { + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(10L).custCode("UPLUS").policyVal("commonsystemcustmanageFull").serviceGroup("OURSTOREAI").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(10L).custCode("UPLUS").policyVal("commonsystemcustmanageRead").serviceGroup("OURSTOREAI").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(10L).custCode("UPLUS").policyVal("commonsystemgroupAuthmanageFull").serviceGroup("OURSTOREAI").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(10L).custCode("UPLUS").policyVal("commonsystemgroupAuthmanageRead").serviceGroup("OURSTOREAI").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(10L).custCode("UPLUS").policyVal("commonsystemoprmngcodemanageFull").serviceGroup("OURSTOREAI").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(10L).custCode("UPLUS").policyVal("commonsystemoprmngcodemanageRead").serviceGroup("OURSTOREAI").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(10L).custCode("UPLUS").policyVal("commonsystemRead").serviceGroup("OURSTOREAI").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(10L).custCode("UPLUS").policyVal("commonsystemserviceGroupmanageFull").serviceGroup("OURSTOREAI").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(10L).custCode("UPLUS").policyVal("commonsystemserviceGroupmanageRead").serviceGroup("OURSTOREAI").build()); +// tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(10L).custCode("UPLUS").policyVal("commonsystemuserAdminmanageFull").serviceGroup("OURSTOREAI").build()); +// tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(10L).custCode("UPLUS").policyVal("commonsystemuserAdminmanageRead").serviceGroup("OURSTOREAI").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(10L).custCode("UPLUS").policyVal("commonsystemusermanageFull").serviceGroup("OURSTOREAI").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(10L).custCode("UPLUS").policyVal("commonsystemusermanageRead").serviceGroup("OURSTOREAI").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(10L).custCode("UPLUS").policyVal("privacymasking").serviceGroup("OURSTOREAI").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(10L).custCode("UPLUS").policyVal("rcpconversationapiNodemanageFull").serviceGroup("OURSTOREAI").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(10L).custCode("UPLUS").policyVal("rcpconversationapiNodemanageRead").serviceGroup("OURSTOREAI").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(10L).custCode("UPLUS").policyVal("rcpconversationcmmNodemanageFull").serviceGroup("OURSTOREAI").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(10L).custCode("UPLUS").policyVal("rcpconversationcmmNodemanageRead").serviceGroup("OURSTOREAI").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(10L).custCode("UPLUS").policyVal("rcpconversationintentmanageFull").serviceGroup("OURSTOREAI").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(10L).custCode("UPLUS").policyVal("rcpconversationintentmanageRead").serviceGroup("OURSTOREAI").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(10L).custCode("UPLUS").policyVal("rcpconversationRead").serviceGroup("OURSTOREAI").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(10L).custCode("UPLUS").policyVal("rcpconversationscenariomanageFull").serviceGroup("OURSTOREAI").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(10L).custCode("UPLUS").policyVal("rcpconversationscenariomanageRead").serviceGroup("OURSTOREAI").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(10L).custCode("UPLUS").policyVal("rcpconversationscenariomanageRelease").serviceGroup("OURSTOREAI").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(10L).custCode("UPLUS").policyVal("rcpconversationsynonymmanageFull").serviceGroup("OURSTOREAI").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(10L).custCode("UPLUS").policyVal("rcpconversationsynonymmanageRead").serviceGroup("OURSTOREAI").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(10L).custCode("UPLUS").policyVal("rcpconversationsystemEntitymanageRead").serviceGroup("OURSTOREAI").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(10L).custCode("UPLUS").policyVal("rcplearningTestinferencemanageFull").serviceGroup("OURSTOREAI").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(10L).custCode("UPLUS").policyVal("rcplearningTestinferencemanageRead").serviceGroup("OURSTOREAI").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(10L).custCode("UPLUS").policyVal("rcplearningTestRead").serviceGroup("OURSTOREAI").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(10L).custCode("UPLUS").policyVal("rcplearningTestsimulatormanageFull").serviceGroup("OURSTOREAI").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(10L).custCode("UPLUS").policyVal("rcplearningTestsimulatormanageRead").serviceGroup("OURSTOREAI").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(10L).custCode("UPLUS").policyVal("rcplearningTeststttestmanageRead").serviceGroup("OURSTOREAI").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(10L).custCode("UPLUS").policyVal("rcplearningTestttstestmanageRead").serviceGroup("OURSTOREAI").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(10L).custCode("UPLUS").policyVal("rcpmonitoringconsultingmanageFull").serviceGroup("OURSTOREAI").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(10L).custCode("UPLUS").policyVal("rcpmonitoringconsultingmanageRead").serviceGroup("OURSTOREAI").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(10L).custCode("UPLUS").policyVal("rcpmonitoringconversationMarkmanageFull").serviceGroup("OURSTOREAI").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(10L).custCode("UPLUS").policyVal("rcpmonitoringconversationMarkmanageRead").serviceGroup("OURSTOREAI").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(10L).custCode("UPLUS").policyVal("rcpmonitoringintentAnalysismanageFull").serviceGroup("OURSTOREAI").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(10L).custCode("UPLUS").policyVal("rcpmonitoringintentAnalysismanageRead").serviceGroup("OURSTOREAI").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(10L).custCode("UPLUS").policyVal("rcpmonitoringoutscenariomanageFull").serviceGroup("OURSTOREAI").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(10L).custCode("UPLUS").policyVal("rcpmonitoringoutscenariomanageRead").serviceGroup("OURSTOREAI").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(10L).custCode("UPLUS").policyVal("rcpmonitoringRead").serviceGroup("OURSTOREAI").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(10L).custCode("UPLUS").policyVal("rcpmonitoringworkhistorymanageRead").serviceGroup("OURSTOREAI").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(10L).custCode("UPLUS").policyVal("rcpstatisticsdashboardmanageFull").serviceGroup("OURSTOREAI").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(10L).custCode("UPLUS").policyVal("rcpoprmanagebgmmanageFull").serviceGroup("OURSTOREAI").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(10L).custCode("UPLUS").policyVal("rcpoprmanagebgmmanageRead").serviceGroup("OURSTOREAI").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(10L).custCode("UPLUS").policyVal("rcpoprmanagenlpSettingmanageFull").serviceGroup("OURSTOREAI").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(10L).custCode("UPLUS").policyVal("rcpoprmanagenlpSettingmanageRead").serviceGroup("OURSTOREAI").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(10L).custCode("UPLUS").policyVal("rcpoprmanageRead").serviceGroup("OURSTOREAI").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(10L).custCode("UPLUS").policyVal("rcpstatisticscallinfomanageRead").serviceGroup("OURSTOREAI").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(10L).custCode("UPLUS").policyVal("rcpstatisticscallRead").serviceGroup("OURSTOREAI").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(10L).custCode("UPLUS").policyVal("rcpstatisticsintentdaymanageRead").serviceGroup("OURSTOREAI").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(10L).custCode("UPLUS").policyVal("rcpstatisticsintentitemmanageRead").serviceGroup("OURSTOREAI").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(10L).custCode("UPLUS").policyVal("rcpstatisticsintentRead").serviceGroup("OURSTOREAI").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(10L).custCode("UPLUS").policyVal("rcpstatisticsRead").serviceGroup("OURSTOREAI").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(10L).custCode("UPLUS").policyVal("rcpstatisticsscenariodaymanageRead").serviceGroup("OURSTOREAI").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(10L).custCode("UPLUS").policyVal("rcpstatisticsscenarioitemmanageRead").serviceGroup("OURSTOREAI").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(10L).custCode("UPLUS").policyVal("rcpstatisticsscenarioRead").serviceGroup("OURSTOREAI").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(10L).custCode("UPLUS").policyVal("rootRead").serviceGroup("OURSTOREAI").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(10L).custCode("UPLUS").policyVal("rcpoprmanagettstagmanageRead").serviceGroup("OURSTOREAI").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(10L).custCode("UPLUS").policyVal("rcpoprmanagettstagmanageFull").serviceGroup("OURSTOREAI").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(10L).custCode("UPLUS").policyVal("rcpconversationsystemEntitymanageFull").serviceGroup("OURSTOREAI").build()); + } + + + if (!tbServiceGroupPolicyRepo.existsByAuthGroupSeq(11L)) { + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(11L).custCode("UPLUS").policyVal("commonsystemcustmanageFull").serviceGroup("AISTORE").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(11L).custCode("UPLUS").policyVal("commonsystemcustmanageRead").serviceGroup("AISTORE").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(11L).custCode("UPLUS").policyVal("commonsystemgroupAuthmanageFull").serviceGroup("AISTORE").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(11L).custCode("UPLUS").policyVal("commonsystemgroupAuthmanageRead").serviceGroup("AISTORE").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(11L).custCode("UPLUS").policyVal("commonsystemoprmngcodemanageFull").serviceGroup("AISTORE").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(11L).custCode("UPLUS").policyVal("commonsystemoprmngcodemanageRead").serviceGroup("AISTORE").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(11L).custCode("UPLUS").policyVal("commonsystemRead").serviceGroup("AISTORE").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(11L).custCode("UPLUS").policyVal("commonsystemserviceGroupmanageFull").serviceGroup("AISTORE").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(11L).custCode("UPLUS").policyVal("commonsystemserviceGroupmanageRead").serviceGroup("AISTORE").build()); +// tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(11L).custCode("UPLUS").policyVal("commonsystemuserAdminmanageFull").serviceGroup("AISTORE").build()); +// tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(11L).custCode("UPLUS").policyVal("commonsystemuserAdminmanageRead").serviceGroup("AISTORE").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(11L).custCode("UPLUS").policyVal("commonsystemusermanageFull").serviceGroup("AISTORE").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(11L).custCode("UPLUS").policyVal("commonsystemusermanageRead").serviceGroup("AISTORE").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(11L).custCode("UPLUS").policyVal("privacymasking").serviceGroup("AISTORE").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(11L).custCode("UPLUS").policyVal("rcpconversationapiNodemanageFull").serviceGroup("AISTORE").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(11L).custCode("UPLUS").policyVal("rcpconversationapiNodemanageRead").serviceGroup("AISTORE").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(11L).custCode("UPLUS").policyVal("rcpconversationcmmNodemanageFull").serviceGroup("AISTORE").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(11L).custCode("UPLUS").policyVal("rcpconversationcmmNodemanageRead").serviceGroup("AISTORE").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(11L).custCode("UPLUS").policyVal("rcpconversationintentmanageFull").serviceGroup("AISTORE").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(11L).custCode("UPLUS").policyVal("rcpconversationintentmanageRead").serviceGroup("AISTORE").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(11L).custCode("UPLUS").policyVal("rcpconversationRead").serviceGroup("AISTORE").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(11L).custCode("UPLUS").policyVal("rcpconversationscenariomanageFull").serviceGroup("AISTORE").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(11L).custCode("UPLUS").policyVal("rcpconversationscenariomanageRead").serviceGroup("AISTORE").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(11L).custCode("UPLUS").policyVal("rcpconversationscenariomanageRelease").serviceGroup("AISTORE").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(11L).custCode("UPLUS").policyVal("rcpconversationsynonymmanageFull").serviceGroup("AISTORE").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(11L).custCode("UPLUS").policyVal("rcpconversationsynonymmanageRead").serviceGroup("AISTORE").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(11L).custCode("UPLUS").policyVal("rcpconversationsystemEntitymanageRead").serviceGroup("AISTORE").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(11L).custCode("UPLUS").policyVal("rcplearningTestinferencemanageFull").serviceGroup("AISTORE").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(11L).custCode("UPLUS").policyVal("rcplearningTestinferencemanageRead").serviceGroup("AISTORE").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(11L).custCode("UPLUS").policyVal("rcplearningTestRead").serviceGroup("AISTORE").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(11L).custCode("UPLUS").policyVal("rcplearningTestsimulatormanageFull").serviceGroup("AISTORE").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(11L).custCode("UPLUS").policyVal("rcplearningTestsimulatormanageRead").serviceGroup("AISTORE").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(11L).custCode("UPLUS").policyVal("rcplearningTeststttestmanageRead").serviceGroup("AISTORE").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(11L).custCode("UPLUS").policyVal("rcplearningTestttstestmanageRead").serviceGroup("AISTORE").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(11L).custCode("UPLUS").policyVal("rcpmonitoringconsultingmanageFull").serviceGroup("AISTORE").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(11L).custCode("UPLUS").policyVal("rcpmonitoringconsultingmanageRead").serviceGroup("AISTORE").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(11L).custCode("UPLUS").policyVal("rcpmonitoringconversationMarkmanageFull").serviceGroup("AISTORE").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(11L).custCode("UPLUS").policyVal("rcpmonitoringconversationMarkmanageRead").serviceGroup("AISTORE").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(11L).custCode("UPLUS").policyVal("rcpmonitoringintentAnalysismanageFull").serviceGroup("AISTORE").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(11L).custCode("UPLUS").policyVal("rcpmonitoringintentAnalysismanageRead").serviceGroup("AISTORE").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(11L).custCode("UPLUS").policyVal("rcpmonitoringoutscenariomanageFull").serviceGroup("AISTORE").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(11L).custCode("UPLUS").policyVal("rcpmonitoringoutscenariomanageRead").serviceGroup("AISTORE").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(11L).custCode("UPLUS").policyVal("rcpstatisticsdashboardmanageFull").serviceGroup("AISTORE").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(11L).custCode("UPLUS").policyVal("rcpmonitoringRead").serviceGroup("AISTORE").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(11L).custCode("UPLUS").policyVal("rcpmonitoringworkhistorymanageRead").serviceGroup("AISTORE").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(11L).custCode("UPLUS").policyVal("rcpoprmanagebgmmanageFull").serviceGroup("AISTORE").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(11L).custCode("UPLUS").policyVal("rcpoprmanagebgmmanageRead").serviceGroup("AISTORE").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(11L).custCode("UPLUS").policyVal("rcpoprmanagenlpSettingmanageFull").serviceGroup("AISTORE").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(11L).custCode("UPLUS").policyVal("rcpoprmanagenlpSettingmanageRead").serviceGroup("AISTORE").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(11L).custCode("UPLUS").policyVal("rcpoprmanageRead").serviceGroup("AISTORE").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(11L).custCode("UPLUS").policyVal("rcpstatisticscallinfomanageRead").serviceGroup("AISTORE").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(11L).custCode("UPLUS").policyVal("rcpstatisticscallRead").serviceGroup("AISTORE").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(11L).custCode("UPLUS").policyVal("rcpstatisticsintentdaymanageRead").serviceGroup("AISTORE").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(11L).custCode("UPLUS").policyVal("rcpstatisticsintentitemmanageRead").serviceGroup("AISTORE").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(11L).custCode("UPLUS").policyVal("rcpstatisticsintentRead").serviceGroup("AISTORE").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(11L).custCode("UPLUS").policyVal("rcpstatisticsRead").serviceGroup("AISTORE").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(11L).custCode("UPLUS").policyVal("rcpstatisticsscenariodaymanageRead").serviceGroup("AISTORE").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(11L).custCode("UPLUS").policyVal("rcpstatisticsscenarioitemmanageRead").serviceGroup("AISTORE").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(11L).custCode("UPLUS").policyVal("rcpstatisticsscenarioRead").serviceGroup("AISTORE").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(11L).custCode("UPLUS").policyVal("rootRead").serviceGroup("AISTORE").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(11L).custCode("UPLUS").policyVal("rcpoprmanagettstagmanageRead").serviceGroup("AISTORE").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(11L).custCode("UPLUS").policyVal("rcpoprmanagettstagmanageFull").serviceGroup("AISTORE").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(11L).custCode("UPLUS").policyVal("rcpconversationsystemEntitymanageFull").serviceGroup("AISTORE").build()); + } + + if (!tbServiceGroupPolicyRepo.existsByAuthGroupSeq(12L)) { + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(12L).custCode("UPLUS").policyVal("commonsystemcustmanageFull").serviceGroup("DAISO").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(12L).custCode("UPLUS").policyVal("commonsystemcustmanageRead").serviceGroup("DAISO").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(12L).custCode("UPLUS").policyVal("commonsystemgroupAuthmanageFull").serviceGroup("DAISO").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(12L).custCode("UPLUS").policyVal("commonsystemgroupAuthmanageRead").serviceGroup("DAISO").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(12L).custCode("UPLUS").policyVal("commonsystemoprmngcodemanageFull").serviceGroup("DAISO").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(12L).custCode("UPLUS").policyVal("commonsystemoprmngcodemanageRead").serviceGroup("DAISO").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(12L).custCode("UPLUS").policyVal("commonsystemRead").serviceGroup("DAISO").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(12L).custCode("UPLUS").policyVal("commonsystemserviceGroupmanageFull").serviceGroup("DAISO").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(12L).custCode("UPLUS").policyVal("commonsystemserviceGroupmanageRead").serviceGroup("DAISO").build()); +// tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(12L).custCode("UPLUS").policyVal("commonsystemuserAdminmanageFull").serviceGroup("DAISO").build()); +// tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(12L).custCode("UPLUS").policyVal("commonsystemuserAdminmanageRead").serviceGroup("DAISO").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(12L).custCode("UPLUS").policyVal("commonsystemusermanageFull").serviceGroup("DAISO").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(12L).custCode("UPLUS").policyVal("commonsystemusermanageRead").serviceGroup("DAISO").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(12L).custCode("UPLUS").policyVal("privacymasking").serviceGroup("DAISO").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(12L).custCode("UPLUS").policyVal("rcpconversationapiNodemanageFull").serviceGroup("DAISO").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(12L).custCode("UPLUS").policyVal("rcpconversationapiNodemanageRead").serviceGroup("DAISO").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(12L).custCode("UPLUS").policyVal("rcpconversationcmmNodemanageFull").serviceGroup("DAISO").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(12L).custCode("UPLUS").policyVal("rcpconversationcmmNodemanageRead").serviceGroup("DAISO").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(12L).custCode("UPLUS").policyVal("rcpconversationintentmanageFull").serviceGroup("DAISO").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(12L).custCode("UPLUS").policyVal("rcpconversationintentmanageRead").serviceGroup("DAISO").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(12L).custCode("UPLUS").policyVal("rcpconversationRead").serviceGroup("DAISO").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(12L).custCode("UPLUS").policyVal("rcpconversationscenariomanageFull").serviceGroup("DAISO").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(12L).custCode("UPLUS").policyVal("rcpconversationscenariomanageRead").serviceGroup("DAISO").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(12L).custCode("UPLUS").policyVal("rcpconversationscenariomanageRelease").serviceGroup("DAISO").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(12L).custCode("UPLUS").policyVal("rcpconversationsynonymmanageFull").serviceGroup("DAISO").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(12L).custCode("UPLUS").policyVal("rcpconversationsynonymmanageRead").serviceGroup("DAISO").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(12L).custCode("UPLUS").policyVal("rcpconversationsystemEntitymanageRead").serviceGroup("DAISO").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(12L).custCode("UPLUS").policyVal("rcplearningTestinferencemanageFull").serviceGroup("DAISO").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(12L).custCode("UPLUS").policyVal("rcplearningTestinferencemanageRead").serviceGroup("DAISO").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(12L).custCode("UPLUS").policyVal("rcplearningTestRead").serviceGroup("DAISO").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(12L).custCode("UPLUS").policyVal("rcplearningTestsimulatormanageFull").serviceGroup("DAISO").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(12L).custCode("UPLUS").policyVal("rcplearningTestsimulatormanageRead").serviceGroup("DAISO").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(12L).custCode("UPLUS").policyVal("rcplearningTeststttestmanageRead").serviceGroup("DAISO").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(12L).custCode("UPLUS").policyVal("rcplearningTestttstestmanageRead").serviceGroup("DAISO").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(12L).custCode("UPLUS").policyVal("rcpmonitoringconsultingmanageFull").serviceGroup("DAISO").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(12L).custCode("UPLUS").policyVal("rcpmonitoringconsultingmanageRead").serviceGroup("DAISO").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(12L).custCode("UPLUS").policyVal("rcpmonitoringconversationMarkmanageFull").serviceGroup("DAISO").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(12L).custCode("UPLUS").policyVal("rcpmonitoringconversationMarkmanageRead").serviceGroup("DAISO").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(12L).custCode("UPLUS").policyVal("rcpmonitoringintentAnalysismanageFull").serviceGroup("DAISO").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(12L).custCode("UPLUS").policyVal("rcpmonitoringintentAnalysismanageRead").serviceGroup("DAISO").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(12L).custCode("UPLUS").policyVal("rcpmonitoringoutscenariomanageFull").serviceGroup("DAISO").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(12L).custCode("UPLUS").policyVal("rcpmonitoringoutscenariomanageRead").serviceGroup("DAISO").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(12L).custCode("UPLUS").policyVal("rcpmonitoringRead").serviceGroup("DAISO").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(12L).custCode("UPLUS").policyVal("rcpmonitoringworkhistorymanageRead").serviceGroup("DAISO").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(12L).custCode("UPLUS").policyVal("rcpstatisticsdashboardmanageFull").serviceGroup("DAISO").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(12L).custCode("UPLUS").policyVal("rcpoprmanagebgmmanageFull").serviceGroup("DAISO").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(12L).custCode("UPLUS").policyVal("rcpoprmanagebgmmanageRead").serviceGroup("DAISO").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(12L).custCode("UPLUS").policyVal("rcpoprmanagenlpSettingmanageFull").serviceGroup("DAISO").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(12L).custCode("UPLUS").policyVal("rcpoprmanagenlpSettingmanageRead").serviceGroup("DAISO").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(12L).custCode("UPLUS").policyVal("rcpoprmanageRead").serviceGroup("DAISO").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(12L).custCode("UPLUS").policyVal("rcpstatisticscallinfomanageRead").serviceGroup("DAISO").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(12L).custCode("UPLUS").policyVal("rcpstatisticscallRead").serviceGroup("DAISO").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(12L).custCode("UPLUS").policyVal("rcpstatisticsintentdaymanageRead").serviceGroup("DAISO").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(12L).custCode("UPLUS").policyVal("rcpstatisticsintentitemmanageRead").serviceGroup("DAISO").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(12L).custCode("UPLUS").policyVal("rcpstatisticsintentRead").serviceGroup("DAISO").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(12L).custCode("UPLUS").policyVal("rcpstatisticsRead").serviceGroup("DAISO").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(12L).custCode("UPLUS").policyVal("rcpstatisticsscenariodaymanageRead").serviceGroup("DAISO").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(12L).custCode("UPLUS").policyVal("rcpstatisticsscenarioitemmanageRead").serviceGroup("DAISO").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(12L).custCode("UPLUS").policyVal("rcpstatisticsscenarioRead").serviceGroup("DAISO").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(12L).custCode("UPLUS").policyVal("rootRead").serviceGroup("DAISO").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(12L).custCode("UPLUS").policyVal("rcpoprmanagettstagmanageRead").serviceGroup("DAISO").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(12L).custCode("UPLUS").policyVal("rcpoprmanagettstagmanageFull").serviceGroup("DAISO").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(12L).custCode("UPLUS").policyVal("rcpconversationsystemEntitymanageFull").serviceGroup("DAISO").build()); + } + + + if (!tbServiceGroupPolicyRepo.existsByAuthGroupSeq(13L)) { + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(13L).custCode("UPLUS").policyVal("rootRead").serviceGroup("AISTORE").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(13L).custCode("UPLUS").policyVal("rcpconversationRead").serviceGroup("AISTORE").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(13L).custCode("UPLUS").policyVal("rcpconversationintentmanageRead").serviceGroup("AISTORE").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(13L).custCode("UPLUS").policyVal("rcpconversationscenariomanageRead").serviceGroup("AISTORE").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(13L).custCode("UPLUS").policyVal("rcpconversationsynonymmanageRead").serviceGroup("AISTORE").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(13L).custCode("UPLUS").policyVal("rcpconversationsystemEntitymanageRead").serviceGroup("AISTORE").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(13L).custCode("UPLUS").policyVal("rcpconversationapiNodemanageRead").serviceGroup("AISTORE").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(13L).custCode("UPLUS").policyVal("rcpconversationcmmNodemanageRead").serviceGroup("AISTORE").build()); + } + if (!tbServiceGroupPolicyRepo.existsByAuthGroupSeq(14L)) { + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(14L).custCode("UPLUS").policyVal("rootRead").serviceGroup("AISTORE").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(14L).custCode("UPLUS").policyVal("rcpconversationRead").serviceGroup("AISTORE").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(14L).custCode("UPLUS").policyVal("rcpconversationscenariomanageRelease").serviceGroup("AISTORE").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(14L).custCode("UPLUS").policyVal("rcpconversationintentmanageFull").serviceGroup("AISTORE").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(14L).custCode("UPLUS").policyVal("rcpconversationscenariomanageFull").serviceGroup("AISTORE").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(14L).custCode("UPLUS").policyVal("rcpconversationsynonymmanageFull").serviceGroup("AISTORE").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(14L).custCode("UPLUS").policyVal("rcpconversationsystemEntitymanageFull").serviceGroup("AISTORE").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(14L).custCode("UPLUS").policyVal("rcpconversationapiNodemanageFull").serviceGroup("AISTORE").build()); + tbServiceGroupPolicyRepo.save(TbServiceGroupPolicy.builder().authGroupSeq(14L).custCode("UPLUS").policyVal("rcpconversationcmmNodemanageFull").serviceGroup("AISTORE").build()); + } + + tbUserAuthGroupRepo.save(TbUserAuthGroup.builder().authGroupSeq(10L).custCode("UPLUS").serviceGroup("OURSTOREAI").userSeq(2L).build()); + tbUserAuthGroupRepo.save(TbUserAuthGroup.builder().authGroupSeq(11L).custCode("UPLUS").serviceGroup("AISTORE").userSeq(2L).build()); + tbUserAuthGroupRepo.save(TbUserAuthGroup.builder().authGroupSeq(12L).custCode("UPLUS").serviceGroup("DAISO").userSeq(2L).build()); +// tbUserAuthGroupRepo.save(TbUserAuthGroup.builder().authGroupSeq(13L).custCode("UPLUS").serviceGroup("COMMON").userSeq(2L).build()); + tbUserAuthGroupRepo.save(TbUserAuthGroup.builder().authGroupSeq(13L).custCode("UPLUS").serviceGroup("AISTORE").userSeq(3L).build()); + tbUserAuthGroupRepo.save(TbUserAuthGroup.builder().authGroupSeq(14L).custCode("UPLUS").serviceGroup("AISTORE").userSeq(4L).build()); + + tbUserCustRepo.save(TbUserCust.builder().custCode("UPLUS").serviceGroup("AISTORE").userSeq(3L).build()); + tbUserCustRepo.save(TbUserCust.builder().custCode("UPLUS").serviceGroup("AISTORE").userSeq(4L).build()); + + tbUserCustRepo.save(TbUserCust.builder().custCode("UPLUS").serviceGroup("OURSTOREAI").userSeq(1L).build()); + tbUserCustRepo.save(TbUserCust.builder().custCode("UPLUS").serviceGroup("AISTORE").userSeq(1L).build()); + tbUserCustRepo.save(TbUserCust.builder().custCode("UPLUS").serviceGroup("DAISO").userSeq(1L).build()); + + tbUserCustRepo.save(TbUserCust.builder().custCode("UPLUS").serviceGroup("OURSTOREAI").userSeq(2L).build()); + tbUserCustRepo.save(TbUserCust.builder().custCode("UPLUS").serviceGroup("AISTORE").userSeq(2L).build()); + tbUserCustRepo.save(TbUserCust.builder().custCode("UPLUS").serviceGroup("DAISO").userSeq(2L).build()); +// tbUserCustRepo.save(TbUserCust.builder().custCode("UPLUS").serviceGroup("COMMON").userSeq(2L).build()); +// tbUserCustRepo.save(TbUserCust.builder().custCode("UPLUS").serviceGroup("COMMON").userSeq(1L).build()); + + } + + public void commonCodeinsert() { + List tbc = new ArrayList<>(); + + List cust = Arrays.asList("ICS","UPLUS"); + + for(String e: cust){ + tbc.add(TbBotCommonCode.builder().custCode(e).majorCode("BOOKMARK_ERR_CODE").minorCode("ETC").oprMngCode(e+"_RCP_OURSTOREAI").codeName("기타").registDate(LocalDateTime.now()).registId("sysadmin").updateDate(LocalDateTime.now()).updateId("sysadmin").build()); + tbc.add(TbBotCommonCode.builder().custCode(e).majorCode("BOOKMARK_ERR_CODE").minorCode("INTENT_ERR").oprMngCode(e+"_RCP_OURSTOREAI").codeName("인텐트 오류").registDate(LocalDateTime.now()).registId("sysadmin").updateDate(LocalDateTime.now()).updateId("sysadmin").build()); + tbc.add(TbBotCommonCode.builder().custCode(e).majorCode("BOOKMARK_ERR_CODE").minorCode("STT_ERR").oprMngCode(e+"_RCP_OURSTOREAI").codeName("STT 오류").registDate(LocalDateTime.now()).registId("sysadmin").updateDate(LocalDateTime.now()).updateId("sysadmin").build()); + tbc.add(TbBotCommonCode.builder().custCode(e).majorCode("BOOKMARK_ERR_CODE").minorCode("TTS_ERR").oprMngCode(e+"_RCP_OURSTOREAI").codeName("TTS 오류").registDate(LocalDateTime.now()).registId("sysadmin").updateDate(LocalDateTime.now()).updateId("sysadmin").build()); + tbc.add(TbBotCommonCode.builder().custCode(e).majorCode("CALL_END_REASON").minorCode("INIT_END").oprMngCode(e+"_RCP_OURSTOREAI").codeName("인입 후 끊음").registDate(LocalDateTime.now()).registId("sysadmin").updateDate(LocalDateTime.now()).updateId("sysadmin").build()); + tbc.add(TbBotCommonCode.builder().custCode(e).majorCode("CALL_END_REASON").minorCode("SCENARIO").oprMngCode(e+"_RCP_OURSTOREAI").codeName("시나리오 흐름").registDate(LocalDateTime.now()).registId("sysadmin").updateDate(LocalDateTime.now()).updateId("sysadmin").build()); + tbc.add(TbBotCommonCode.builder().custCode(e).majorCode("CALL_END_REASON").minorCode("SILENT_FB").oprMngCode(e+"_RCP_OURSTOREAI").codeName("묵음 폴백").registDate(LocalDateTime.now()).registId("sysadmin").updateDate(LocalDateTime.now()).updateId("sysadmin").build()); + tbc.add(TbBotCommonCode.builder().custCode(e).majorCode("CALL_END_REASON").minorCode("SPEAK_FB").oprMngCode(e+"_RCP_OURSTOREAI").codeName("발화 폴백").registDate(LocalDateTime.now()).registId("sysadmin").updateDate(LocalDateTime.now()).updateId("sysadmin").build()); + tbc.add(TbBotCommonCode.builder().custCode(e).majorCode("CALL_END_REASON").minorCode("USER_END").oprMngCode(e+"_RCP_OURSTOREAI").codeName("고객 끊음").registDate(LocalDateTime.now()).registId("sysadmin").updateDate(LocalDateTime.now()).updateId("sysadmin").build()); + tbc.add(TbBotCommonCode.builder().custCode(e).majorCode("CALL_END_REASON").minorCode("USER_REQ").oprMngCode(e+"_RCP_OURSTOREAI").codeName("사용자 요청").registDate(LocalDateTime.now()).registId("sysadmin").updateDate(LocalDateTime.now()).updateId("sysadmin").build()); +// tbc.add(TbBotCommonCode.builder().custCode(e).majorCode("CALL_END_TYPE").minorCode("END").oprMngCode(e+"_RCP_OURSTOREAI").codeType("C_CD").description("호종료").registDate(LocalDateTime.now()).registId("sysadmin").updateDate(LocalDateTime.now()).updateId("sysadmin").build()); +// tbc.add(TbBotCommonCode.builder().custCode(e).majorCode("CALL_END_TYPE").minorCode("ING").oprMngCode(e+"_RCP_OURSTOREAI").codeType("C_CD").description("호전환").registDate(LocalDateTime.now()).registId("sysadmin").updateDate(LocalDateTime.now()).updateId("sysadmin").build()); + tbc.add(TbBotCommonCode.builder().custCode(e).majorCode("CALL_END_CONVERSION").minorCode("TRANSFER").oprMngCode(e+"_RCP_OURSTOREAI").codeName("호전환").registDate(LocalDateTime.now()).registId("sysadmin").updateDate(LocalDateTime.now()).updateId("sysadmin").build()); + tbc.add(TbBotCommonCode.builder().custCode(e).majorCode("CALL_END_CONVERSION").minorCode("END").oprMngCode(e+"_RCP_OURSTOREAI").codeName("호종료").registDate(LocalDateTime.now()).registId("sysadmin").updateDate(LocalDateTime.now()).updateId("sysadmin").build()); + tbc.add(TbBotCommonCode.builder().custCode(e).majorCode("INTENT_RESULT_CODE").minorCode("INTENT_FAIL").oprMngCode(e+"_RCP_OURSTOREAI").codeName("인텐트 실패").registDate(LocalDateTime.now()).registId("sysadmin").updateDate(LocalDateTime.now()).updateId("sysadmin").build()); + tbc.add(TbBotCommonCode.builder().custCode(e).majorCode("INTENT_RESULT_CODE").minorCode("INTENT_SUCCESS").oprMngCode(e+"_RCP_OURSTOREAI").codeName("인텐트 성공").registDate(LocalDateTime.now()).registId("sysadmin").updateDate(LocalDateTime.now()).updateId("sysadmin").build()); + tbc.add(TbBotCommonCode.builder().custCode(e).majorCode("INTENT_RESULT_CODE").minorCode("SCORE_FAIL").oprMngCode(e+"_RCP_OURSTOREAI").codeName("점수 미달").registDate(LocalDateTime.now()).registId("sysadmin").updateDate(LocalDateTime.now()).updateId("sysadmin").build()); + tbc.add(TbBotCommonCode.builder().custCode(e).majorCode("MEASURE_TYPE").minorCode("COMPLETE").oprMngCode(e+"_RCP_OURSTOREAI").codeName("조치 완료").registDate(LocalDateTime.now()).registId("sysadmin").updateDate(LocalDateTime.now()).updateId("sysadmin").build()); + tbc.add(TbBotCommonCode.builder().custCode(e).majorCode("MEASURE_TYPE").minorCode("DEL").oprMngCode(e+"_RCP_OURSTOREAI").codeName("삭제").registDate(LocalDateTime.now()).registId("sysadmin").updateDate(LocalDateTime.now()).updateId("sysadmin").build()); + tbc.add(TbBotCommonCode.builder().custCode(e).majorCode("BOOKMARK_ERR_CODE").minorCode("ETC").oprMngCode(e+"_RCP_OURSTOREAI").codeName("기타").registDate(LocalDateTime.now()).registId("sysadmin").updateDate(LocalDateTime.now()).updateId("sysadmin").build()); + tbc.add(TbBotCommonCode.builder().custCode(e).majorCode("BOOKMARK_ERR_CODE").minorCode("INTENT_ERR").oprMngCode(e+"_RCP_OURSTOREAI").codeName("인텐트 오류").registDate(LocalDateTime.now()).registId("sysadmin").updateDate(LocalDateTime.now()).updateId("sysadmin").build()); + tbc.add(TbBotCommonCode.builder().custCode(e).majorCode("BOOKMARK_ERR_CODE").minorCode("STT_ERR").oprMngCode(e+"_RCP_OURSTOREAI").codeName("STT 오류").registDate(LocalDateTime.now()).registId("sysadmin").updateDate(LocalDateTime.now()).updateId("sysadmin").build()); + tbc.add(TbBotCommonCode.builder().custCode(e).majorCode("BOOKMARK_ERR_CODE").minorCode("TTS_ERR").oprMngCode(e+"_RCP_OURSTOREAI").codeName("TTS 오류").registDate(LocalDateTime.now()).registId("sysadmin").updateDate(LocalDateTime.now()).updateId("sysadmin").build()); + tbc.add(TbBotCommonCode.builder().custCode(e).majorCode("CALL_END_REASON").minorCode("INIT_END").oprMngCode(e+"_RCP_OURSTOREAI").codeName("인입 후 끊음").registDate(LocalDateTime.now()).registId("sysadmin").updateDate(LocalDateTime.now()).updateId("sysadmin").build()); + tbc.add(TbBotCommonCode.builder().custCode(e).majorCode("CALL_END_REASON").minorCode("SCENARIO").oprMngCode(e+"_RCP_OURSTOREAI").codeName("시나리오 흐름").registDate(LocalDateTime.now()).registId("sysadmin").updateDate(LocalDateTime.now()).updateId("sysadmin").build()); + tbc.add(TbBotCommonCode.builder().custCode(e).majorCode("CALL_END_REASON").minorCode("SILENT_FB").oprMngCode(e+"_RCP_OURSTOREAI").codeName("묵음 폴백").registDate(LocalDateTime.now()).registId("sysadmin").updateDate(LocalDateTime.now()).updateId("sysadmin").build()); + tbc.add(TbBotCommonCode.builder().custCode(e).majorCode("CALL_END_REASON").minorCode("SPEAK_FB").oprMngCode(e+"_RCP_OURSTOREAI").codeName("발화 폴백").registDate(LocalDateTime.now()).registId("sysadmin").updateDate(LocalDateTime.now()).updateId("sysadmin").build()); + tbc.add(TbBotCommonCode.builder().custCode(e).majorCode("CALL_END_REASON").minorCode("USER_END").oprMngCode(e+"_RCP_OURSTOREAI").codeName("고객 끊음").registDate(LocalDateTime.now()).registId("sysadmin").updateDate(LocalDateTime.now()).updateId("sysadmin").build()); + tbc.add(TbBotCommonCode.builder().custCode(e).majorCode("CALL_END_REASON").minorCode("USER_REQ").oprMngCode(e+"_RCP_OURSTOREAI").codeName("사용자 요청").registDate(LocalDateTime.now()).registId("sysadmin").updateDate(LocalDateTime.now()).updateId("sysadmin").build()); +// tbc.add(TbBotCommonCode.builder().custCode(e).majorCode("CALL_END_TYPE").minorCode("END").oprMngCode(e+"_RCP_OURSTOREAI").codeType("C_CD").description("호종료").registDate(LocalDateTime.now()).registId("sysadmin").updateDate(LocalDateTime.now()).updateId("sysadmin").build()); +// tbc.add(TbBotCommonCode.builder().custCode(e).majorCode("CALL_END_TYPE").minorCode("ING").oprMngCode(e+"_RCP_OURSTOREAI").codeType("C_CD").description("호전환").registDate(LocalDateTime.now()).registId("sysadmin").updateDate(LocalDateTime.now()).updateId("sysadmin").build()); + tbc.add(TbBotCommonCode.builder().custCode(e).majorCode("INTENT_RESULT_CODE").minorCode("INTENT_FAIL").oprMngCode(e+"_RCP_OURSTOREAI").codeName("인텐트 실패").registDate(LocalDateTime.now()).registId("sysadmin").updateDate(LocalDateTime.now()).updateId("sysadmin").build()); + tbc.add(TbBotCommonCode.builder().custCode(e).majorCode("INTENT_RESULT_CODE").minorCode("INTENT_SUCCESS").oprMngCode(e+"_RCP_OURSTOREAI").codeName("인텐트 성공").registDate(LocalDateTime.now()).registId("sysadmin").updateDate(LocalDateTime.now()).updateId("sysadmin").build()); + tbc.add(TbBotCommonCode.builder().custCode(e).majorCode("INTENT_RESULT_CODE").minorCode("SCORE_FAIL").oprMngCode(e+"_RCP_OURSTOREAI").codeName("점수 미달").registDate(LocalDateTime.now()).registId("sysadmin").updateDate(LocalDateTime.now()).updateId("sysadmin").build()); + tbc.add(TbBotCommonCode.builder().custCode(e).majorCode("MEASURE_TYPE").minorCode("COMPLETE").oprMngCode(e+"_RCP_OURSTOREAI").codeName("조치 완료").registDate(LocalDateTime.now()).registId("sysadmin").updateDate(LocalDateTime.now()).updateId("sysadmin").build()); + tbc.add(TbBotCommonCode.builder().custCode(e).majorCode("MEASURE_TYPE").minorCode("DEL").oprMngCode(e+"_RCP_OURSTOREAI").codeName("삭제").registDate(LocalDateTime.now()).registId("sysadmin").updateDate(LocalDateTime.now()).updateId("sysadmin").build()); + tbc.add(TbBotCommonCode.builder().custCode(e).majorCode("ENTITY_TYPE").minorCode("NORMAL").oprMngCode(e+"_RCP_AISTORE").codeName("일반").registDate(LocalDateTime.now()).registId("sysadmin").updateDate(LocalDateTime.now()).updateId("sysadmin").build()); + tbc.add(TbBotCommonCode.builder().custCode(e).majorCode("ENTITY_TYPE").minorCode("SYNONYM").oprMngCode(e+"_RCP_AISTORE").codeName("동의어").registDate(LocalDateTime.now()).registId("sysadmin").updateDate(LocalDateTime.now()).updateId("sysadmin").build()); + tbc.add(TbBotCommonCode.builder().custCode(e).majorCode("ENTITY_TYPE").minorCode("SYSTEM").oprMngCode(e+"_RCP_AISTORE").codeName("시스템엔티티").registDate(LocalDateTime.now()).registId("sysadmin").updateDate(LocalDateTime.now()).updateId("sysadmin").build()); + tbc.add(TbBotCommonCode.builder().custCode(e).majorCode("INTENT_GROUP").minorCode("AD").oprMngCode(e+"_RCP_AISTORE").codeName("방문").registDate(LocalDateTime.now()).registId("sysadmin").updateDate(LocalDateTime.now()).updateId("sysadmin").build()); + tbc.add(TbBotCommonCode.builder().custCode(e).majorCode("INTENT_GROUP").minorCode("BH").oprMngCode(e+"_RCP_AISTORE").codeName("영업").registDate(LocalDateTime.now()).registId("sysadmin").updateDate(LocalDateTime.now()).updateId("sysadmin").build()); + tbc.add(TbBotCommonCode.builder().custCode(e).majorCode("INTENT_GROUP").minorCode("CL").oprMngCode(e+"_RCP_AISTORE").codeName("호종료").registDate(LocalDateTime.now()).registId("sysadmin").updateDate(LocalDateTime.now()).updateId("sysadmin").build()); + tbc.add(TbBotCommonCode.builder().custCode(e).majorCode("INTENT_GROUP").minorCode("EX").oprMngCode(e+"_RCP_AISTORE").codeName("예외").registDate(LocalDateTime.now()).registId("sysadmin").updateDate(LocalDateTime.now()).updateId("sysadmin").build()); + tbc.add(TbBotCommonCode.builder().custCode(e).majorCode("INTENT_GROUP").minorCode("ME").oprMngCode(e+"_RCP_AISTORE").codeName("메뉴").registDate(LocalDateTime.now()).registId("sysadmin").updateDate(LocalDateTime.now()).updateId("sysadmin").build()); + tbc.add(TbBotCommonCode.builder().custCode(e).majorCode("INTENT_GROUP").minorCode("PK").oprMngCode(e+"_RCP_AISTORE").codeName("주차").registDate(LocalDateTime.now()).registId("sysadmin").updateDate(LocalDateTime.now()).updateId("sysadmin").build()); + tbc.add(TbBotCommonCode.builder().custCode(e).majorCode("INTENT_GROUP").minorCode("RV").oprMngCode(e+"_RCP_AISTORE").codeName("예약").registDate(LocalDateTime.now()).registId("sysadmin").updateDate(LocalDateTime.now()).updateId("sysadmin").build()); + tbc.add(TbBotCommonCode.builder().custCode(e).majorCode("INTENT_GROUP").minorCode("ST").oprMngCode(e+"_RCP_AISTORE").codeName("시설").registDate(LocalDateTime.now()).registId("sysadmin").updateDate(LocalDateTime.now()).updateId("sysadmin").build()); + + } + + tbBotCommonCodeRepo.saveAll(tbc); + + } + + @Transactional + public void tbProjectSettingdata() { + if (!tbProjectSettingRepo.existsById("UPLUS_RCP_AISTORE")) { + tbProjectSettingRepo.save(TbProjectSetting.builder() + .oprMngCode("UPLUS_RCP_AISTORE") + .similarityCriteria(0.81) + .classCriteria(0.81) + .classResultCriteria(0.85) + .fallbackMsg("무슨 말씀이신지 정확하게 이해하지 못했어요. 영업시간, 주소 안내 등 궁금한 내용을 다시 한 번 알려주세요.") + .greetingMsg("서비스 이용 및 품질향상을 위해 고객님의 음성이 활용됩니다. 무엇을 도와드릴까요?") + .ifMappingId(90922651L) + .registId("sysadmin") + .registDate(LocalDateTime.now()) + .updateId("uplus") + .updateDate(LocalDateTime.now()) + .build()); + } + if (!tbProjectSettingRepo.existsById("UPLUS_RCP_DAISO")) { + tbProjectSettingRepo.save(TbProjectSetting.builder() + .oprMngCode("UPLUS_RCP_DAISO") + .similarityCriteria(0.85) + .classCriteria(0.6) + .classResultCriteria(0.4) + .fallbackMsg("무슨 말씀이신지 정확하게 이해하지 못했어요. 영업시간, 주소 안내 등 궁금한 내용을 다시 한 번 알려주세요.") + .greetingMsg("서비스 이용 및 품질향상을 위해 고객님의 음성이 활용됩니다. 무엇을 도와드릴까요?") + .ifMappingId(90925452L) + .registId("sysadmin") + .registDate(LocalDateTime.now()) + .updateId("uplus") + .updateDate(LocalDateTime.now()) + .build()); + } + if (!tbProjectSettingRepo.existsById("UPLUS_RCP_OURSTOREAI")) { + tbProjectSettingRepo.save(TbProjectSetting.builder() + .oprMngCode("UPLUS_RCP_OURSTOREAI") + .similarityCriteria(0.85) + .classCriteria(0.2) + .classResultCriteria(0.05) + .fallbackMsg("") + .greetingMsg("") + .ifMappingId(113903143L) + .registId("sysadmin") + .registDate(LocalDateTime.now()) + .updateId("uplus") + .updateDate(LocalDateTime.now()) + .build()); + } + +// if (!tbProjectSettingRepo.existsById("UPLUS_RCP_COMMON")) { +// tbProjectSettingRepo.save(TbProjectSetting.builder() +// .oprMngCode("UPLUS_RCP_COMMON") +// .similarityCriteria(0.85) +// .classCriteria(0.6) +// .classResultCriteria(0.4) +// .fallbackMsg("무슨 말씀이신지 정확하게 이해하지 못했어요. 영업시간, 주소 안내 등 궁금한 내용을 다시 한 번 알려주세요.") +// .greetingMsg("서비스 이용 및 품질향상을 위해 고객님의 음성이 활용됩니다. 무엇을 도와드릴까요?") +// .ifMappingId(90922651L) +// .registId("sysadmin") +// .registDate(LocalDateTime.now()) +// .updateId("uplus") +// .updateDate(LocalDateTime.now()) +// .build()); +// } + + } + + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/test/controller/FailNodeVO.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/test/controller/FailNodeVO.java new file mode 100644 index 0000000..098fd3f --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/test/controller/FailNodeVO.java @@ -0,0 +1,32 @@ +package com.icomsys.main_vm.biz.test.controller; + + +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +@Getter +@Setter +@NoArgsConstructor +public class FailNodeVO { + + private String oprMngCode; + private Long scenarioSeq; + private String scenarioName; + private int totCnt; + private int useCnt; + private int succCnt; + private int failCnt; + + @Builder + public FailNodeVO(String oprMngCode, Long scenarioSeq, String scenarioName, int totCnt, int useCnt, int succCnt, int failCnt) { + this.oprMngCode = oprMngCode; + this.scenarioSeq = scenarioSeq; + this.scenarioName = scenarioName; + this.totCnt = totCnt; + this.useCnt = useCnt; + this.succCnt = succCnt; + this.failCnt = failCnt; + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/test/controller/TestRestController.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/test/controller/TestRestController.java new file mode 100644 index 0000000..ae11f5d --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/test/controller/TestRestController.java @@ -0,0 +1,335 @@ +package com.icomsys.main_vm.biz.test.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.ExcelService; +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.common.service.SequenceService; +import com.icomsys.main_vm.biz.common.common.service.functionnode.FunctionVo; +import com.icomsys.main_vm.biz.common.common.service.functionnode.FunctionWsNashorn; +import com.icomsys.main_vm.biz.common.login.res.OprmngCodeRes; +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.SystemPolicyMenuRes; +import com.icomsys.main_vm.biz.common.system.vo.SystemServiceGroupViewVo; +import com.icomsys.main_vm.biz.test.controller.testvo.APINodeVo; +import com.icomsys.main_vm.common.code.EnumToMap; +import com.icomsys.main_vm.common.code.enumresource.MenuResource; +import com.icomsys.main_vm.db.jpa.entity.conversation.TbProjectSetting; +import com.icomsys.main_vm.db.jpa.entity.system.TbIcsCustInfo; +import com.icomsys.main_vm.db.jpa.repo.scenario.TbApiNodeRepo; +import com.icomsys.main_vm.db.jpa.repo.system.*; +import com.icomsys.main_vm.db.mybatis.mapper.TestMapper; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.core.io.ClassPathResource; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.script.ScriptException; +import javax.servlet.http.HttpServletRequest; +import java.io.IOException; +import java.time.LocalDateTime; +import java.util.*; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.TimeoutException; + +@RequestMapping("/rest") +@RestController +@RequiredArgsConstructor +@Slf4j +public class TestRestController { + + private final TestRestService testRestService; + + private final TbBotCommonCodeRepo tbBotCommonCodeRepo; + private final TbBotUserRepo tbBotUserRepo; + private final TbCustPolicyRepo tbCustPolicyRepo; + private final TbIcsCustInfoRepo tbIcsCustInfoRepo; + private final TbIcsOprMngInfoRepo tbIcsOprMngInfoRepo; + private final TbServiceAuthGroupRepo tbServiceAuthGroupRepo; + private final TbServiceGrouopRepo tbServiceGrouopRepo; + private final TbServiceGroupPolicyRepo tbServiceGroupPolicyRepo; + private final TbUserAuthGroupRepo tbUserAuthGroupRepo; + private final TbUserCustRepo tbUserCustRepo; + private final SequenceService sequenceService; + private final LoginService loginService; + private final TestMapper testMapper; + private final HttpServletRequest request; + private final LogService logService; + private final ExcelService excelService; + + @GetMapping("/test1") + public String test1() { + log.info("test1 init"); + log.info("test1 = {}", new Gson().toJson(EnumToMap.urlToMap)); + return new Gson().toJson(EnumToMap.urlToMap); + } + + + /** + * 메뉴바인딩 + * + * @return + */ + @GetMapping("/test5") + public Object test5() { + log.info("test5 init"); + return testRestService.authToMenuList(testRestService.initData(), 1000001); + } + + + /** + * 전체매뉴 -> 고객사별메뉴권한, + * 고객사별메뉴권한 -> 그룹별권한 + * + * @return + */ + @GetMapping("/test6") + public Object test6() { + log.info("test6 init"); + return testRestService.authToAuthList(testRestService.initData(), 1000001); + } + + @GetMapping("/test7") + public String test7() { + //Table All Test + log.info(" 1 -{}", tbBotCommonCodeRepo.findAll()); + log.info(" 2 -{}", tbBotUserRepo.findAll()); + log.info(" 3 -{}", tbCustPolicyRepo.findAll()); + log.info(" 4 -{}", tbIcsCustInfoRepo.findAll()); + log.info(" 5 -{}", tbIcsOprMngInfoRepo.findAll()); + log.info(" 6 -{}", tbServiceAuthGroupRepo.findAll()); + log.info(" 7 -{}", tbServiceGrouopRepo.findAll()); + log.info(" 8 -{}", tbServiceGroupPolicyRepo.findAll()); + log.info(" 9 -{}", tbUserAuthGroupRepo.findAll()); + log.info(" 10 -{}", tbUserCustRepo.findAll()); + + return "test7"; + } + + @GetMapping("/test8") + public String test8() { + +// log.info("1 - {}", sequenceService.ServiceAuthGroupSeqNext()); +// log.info("2 - {}", sequenceService.UserSeqNext()); + + return "test8"; + } + + @GetMapping("/test10") + public List test10() { + return testRestService.test10(); + } + + @GetMapping("/test11") + public Object test11() { + return testRestService.authToMenuList(testRestService.test10(), 1000001); + } + + @GetMapping("/test12") + public Object test12() { + return loginService.selectMainMenuLeft(4L, "ourStore", "SYSTEMADMIN"); + } + + @GetMapping("/test13") + public Object test13() { + List aa = new ArrayList<>(); + try { + aa = testMapper.getUserPolicy(4L, "ourStore"); + ; + } catch (Exception e) { + log.info("log - {}", e.getMessage()); + } + return aa; + } + + + @GetMapping("/test14") + public Object test14() { + return testRestService.getServiceGroup(); + } + + @GetMapping("/test15") + public Object test15() { + return testRestService.pagingtest(); + } + + @GetMapping("/test16") + public List test16() throws CustomNoSuchFieldException { + log.info("getOPR INIT"); + return testRestService.test16(); + } + + @GetMapping("/test17") + public DslDataTableRes test17() throws CustomNoSuchFieldException { + log.info("getOPR INIT"); + return testRestService.test17(); + } + + + @GetMapping("/test18") + public List test18( + @RequestParam(name = "page", required = false) int page, + @RequestParam(name = "size", required = false) int size, + @RequestParam(name = "codeText1", required = false) String codeText1, + @RequestParam(name = "codeText2", required = false) String codeText2, + @RequestParam(name = "codeText3", required = false) String codeText3, + @RequestParam(name = "service", required = false) String service + ) throws CustomNoSuchFieldException { + log.info("TEST18"); + return testRestService.test18(page, size, codeText1, codeText2, codeText3, service); + } + + @GetMapping("/test19") + public Map test19() { + + Map pMap = testRestService.jstreeParentConvertToPolicy(); + log.info("test19 - {}", new Gson().toJson(pMap)); + return pMap; + } + + @GetMapping("/test20") + public List test20() { + return testRestService.test20(); + } + + private final TbApiNodeRepo tbApiNodeRepo; +// @GetMapping("/test21") +// public List test21(){ +// return testRestService.test21(); +// } + + @GetMapping("/test21") + public String test21() throws IOException { +// String path = request.getSession().getServletContext().getRealPath(""); + + String path = new ClassPathResource("/document/Ourstore_Ai_Manager_User_Manual_v1.0.pdf").getFile().getAbsolutePath(); + return path; + } + + @GetMapping("/test22") + public String test22() { + testRestService.test22(); + return "a"; + } + + @GetMapping("/test23") + public void test23() { + log.info("reg를 넘김"); + + logService.LogSave(LogVO.builder() + .menuAuth(MenuResource.rcpconversation) + .actionCode("testActionCode") + .registDate(LocalDateTime.now()) + .build()); + + } + + @GetMapping("/test24") + public void test24() { + log.info("reg를안 넘김"); + logService.LogSave(LogVO.builder() + .menuAuth(MenuResource.rcpconversationsystemEntitymanage) + .actionCode("testActionCode") + .build()); + } + + + @PostMapping("/test25") + public void test25(@RequestParam("files") MultipartFile dto) throws IOException { + log.info("test25 - {}", new Gson().toJson(dto.getOriginalFilename())); + log.info("test25 - {}", new Gson().toJson(dto)); +// testRestService.test27(dto); + List result = excelService.ExcelUploadConvert(dto, TbIcsCustInfo.class); + + log.info("result - {}", new Gson().toJson(result)); + + } + + @GetMapping("/test26") + public void test26() throws IOException { +// excelService.ExcelDownload("asd", tbIcsCustInfoRepo.findAll()); + excelService.ExcelDownload("asd", tbIcsCustInfoRepo.findAll()); + } + + @GetMapping("/test27") + public void test27() throws IOException { +// testRestService.ExcelUploadConvert(TbIcsCustInfo.class); + } + + @GetMapping("/test28") + public List test28() { + + return testRestService.test28(); + } + + @GetMapping("/test29") + public void test29() throws IOException { + excelService.ExcelDownload("asdqwe", tbIcsCustInfoRepo.findAll(), Arrays.asList("ㅁㄴㅇㅁㄴㅇ", "ㅁㄴㅇㄴㅁㅇ", "ㅁㄴㅇㅁㄴㅇ")); + } + + @PostMapping("/test30") + public void test30(@RequestBody APINodeVo dto) { + log.info("s - {}", new Gson().toJson(dto)); + + + } + + @GetMapping("/test31") + public Map test31() throws CustomBadRequestException, NoSuchMethodException { + String dbData = "{\"apiNodeName\":\"예약 날짜 확인\",\"urlType\":\"GET\",\"URL\":\"http://15.165.95.232:8080/platform/api/informal/numeral/Date\",\"header\":[{\"key\":\"Content-Type\",\"value\":\"application/json\",\"desc\":\"\"}],\"param\":[{\"key\":\"formatType\",\"value\":\"yyyy-MM-dd\",\"desc\":\"\"},{\"key\":\"talkText\",\"value\":\"#{userMessage}\",\"desc\":\"\"}],\"request\":[{\"value\":\"userMessage\",\"desc\":\"sample \\\"내일모레 예약하려고 합니다 \\\"\"}],\"response\":[{\"key\":\"responseCode\",\"value\":\"$.responseCode\",\"desc\":\"\"},{\"key\":\"processResult\",\"value\":\"$.resultData.processResult\",\"desc\":\"\"},{\"key\":\"findDate\",\"value\":\"$.resultData.findDate\",\"desc\":\"\"},{\"key\":\"weekOfTheDay\",\"value\":\"$.resultData.weekOfTheDay\",\"desc\":\"\"}],\"body\":\"\"}"; + + return testRestService.test31(dbData); + + } + + @GetMapping("/test32") + public void test32() throws ExecutionException, InterruptedException, TimeoutException, ScriptException { + + HashMap calldata = new HashMap(); + calldata.put("abc", "1"); + Map resultMap = FunctionWsNashorn.builder(1000) + .create(FunctionVo.builder() + .varList(Arrays.asList("시나리오변수1", "func변수1", "abc")) + .callData(calldata) + .initSctipt(" if (abc == \"1\") {\n func변수1 = \"시나리오 변수 값이 1 입니다\";\n} else {\n func변수1 = \"시나리오 변수 값이 1이 아닙니다\";\n}\n") + .build()) + .build(); + + log.info("result Map - - {}", new Gson().toJson(resultMap)); + } + + @GetMapping("/test33") + public void test33() throws CustomBadRequestException, NoSuchMethodException { + String s = "{\"apiNodeName\":\"ㅁㄴㅇㄻㄴㅇㄹ\",\"urlType\":\"POST\",\"URL\":\"http://192.168.219.106:8080/platform/api/call/list\",\"header\":[{\"key\":\"Content-Type\",\"value\":\"application/json\",\"desc\":\"\"}],\"param\":[],\"body\":\"{\\r\\n \\\"downtownNum\\\": #{downtownNum},\\r\\n \\\"startDate\\\": #{startDate},\\r\\n \\\"endDate\\\": #{endDate}\\r\\n}\",\"request\":[{\"value\":\"downtownNum\",\"desc\":\"07075999946\"},{\"value\":\"startDate\",\"desc\":\"2021-08-03\"},{\"value\":\"endDate\",\"desc\":\"2023-08-03\"}],\"response\":[{\"key\":\"resultCode\",\"value\":\"$.resultCode\",\"desc\":\"\"},{\"key\":\"resultMessage\",\"value\":\"$.resultMessage\",\"desc\":\"\"},{\"key\":\"callListCnt\",\"value\":\"$.resultData.callListCnt\",\"desc\":\"\"},{\"key\":\"callList\",\"value\":\"$.resultData.callList\",\"desc\":\"\"}]}"; + log.info("s - {}", s); + testRestService.test33(s); + + } + + @GetMapping("/test34") + public Long test34() throws CustomNotFoundException { + log.info("nlp mapping id controller"); + return testRestService.test34(); + } + + @GetMapping("/test35") + public List test35() throws CustomNotFoundException { + log.info("nlp mapping id controller5"); + return testRestService.test35(); + } + + @GetMapping("/test36") + public Long test36() { + log.info("test 36 ==="); + return testRestService.test36(); +// return "res"; + } + +} + + diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/test/controller/TestRestService.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/test/controller/TestRestService.java new file mode 100644 index 0000000..88b1c2f --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/test/controller/TestRestService.java @@ -0,0 +1,822 @@ +package com.icomsys.main_vm.biz.test.controller; + +import aj.org.objectweb.asm.TypeReference; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; +import com.google.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.LogVO; +import com.icomsys.main_vm.biz.common.common.service.RestTemplateService; +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.ServiceGroupRes; +import com.icomsys.main_vm.biz.common.login.res.UserVo; +import com.icomsys.main_vm.biz.common.system.service.SystemServiceGroupService; +import com.icomsys.main_vm.biz.common.system.vo.*; +import com.icomsys.main_vm.biz.test.controller.testvo.APINodeVo; +import com.icomsys.main_vm.common.code.EnumToMap; +import com.icomsys.main_vm.common.code.MenuVo; +import com.icomsys.main_vm.common.code.enumresource.MenuResource; +import com.icomsys.main_vm.common.code.enumresource.PolicyResource; +import com.icomsys.main_vm.common.code.enumresource.RoleResource; +import com.icomsys.main_vm.db.jpa.entity.conversation.TbProjectSetting; +import com.icomsys.main_vm.db.jpa.entity.monitoring.*; +import com.icomsys.main_vm.db.jpa.repo.monitoring.*; +import com.icomsys.main_vm.db.jpa.repo.system.*; +import com.icomsys.main_vm.db.mybatis.alias.MonitoringScenarioBreakVO; +import com.icomsys.main_vm.db.mybatis.mapper.TestMapper; +import com.querydsl.core.QueryResults; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.apache.poi.hssf.usermodel.HSSFWorkbook; +import org.apache.poi.ss.formula.functions.T; +import org.apache.poi.ss.usermodel.*; +import org.json.JSONObject; +import org.modelmapper.ModelMapper; +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.security.crypto.password.PasswordEncoder; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.client.RestTemplate; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.util.UriComponentsBuilder; + +import javax.servlet.http.HttpServletResponse; +import java.io.*; +import java.lang.reflect.Field; +import java.lang.reflect.Type; +import java.net.URI; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.LocalTime; +import java.time.format.DateTimeFormatter; +import java.util.*; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.stream.Collectors; + +@Service +@Slf4j +@RequiredArgsConstructor +public class TestRestService { + + private final TbBotCommonCodeRepo tbBotCommonCodeRepo; + private final TbBotUserRepo tbBotUserRepo; + private final TbCustPolicyRepo tbCustPolicyRepo; + private final TbIcsCustInfoRepo tbIcsCustInfoRepo; + private final TbIcsOprMngInfoRepo tbIcsOprMngInfoRepo; + private final TbServiceAuthGroupRepo tbServiceAuthGroupRepo; + private final TbServiceGrouopRepo tbServiceGrouopRepo; + private final TbServiceGroupPolicyRepo tbServiceGroupPolicyRepo; + private final TbUserAuthGroupRepo tbUserAuthGroupRepo; + private final TbUserCustRepo tbUserCustRepo; + private final SequenceService sequenceService; + private final PasswordEncoder passwordEncoder; + private final SystemServiceGroupService systemServiceGroupService; + private final HttpServletResponse httpServletResponse; + private final ModelMapper modelMapper; + + public List initData() { + List authList = Arrays.asList( + "rootRead", + "rcpconversationintentRead", + "rcpconversationintentmanageRead", + "rcpconversationscenariomanageRead", + "rcpconversationsynonymmanageRead", + "rcpconversationdictionarymanageRead", + "rcpconversationsystemEntitymanageRead", + "rcpconversationapiNodemanageRead", + "rcpconversationcmmNodemanageRead", + "rcpconversationnlpSettingmanageRead", + "rcplearningTestsimulatorRead", + "rcplearningTestsimulatormanageRead", + "rcpstatisticsRead", + "rcpstatisticsuseRead", + "rcpstatisticsuserecordmanageRead", + "rcpstatisticsstatisticsRead", + "rcpstatisticsstatisticsuesmanageRead", + "rcpstatisticsstatisticsresponsemanageRead", + "rcpstatisticsstatisticsintentmanageRead", + "rcpstatisticsstatisticsscenariomanageRead", + "rcpstatisticsmonitoringRead", + "rcpstatisticsmonitoringcallmanageRead", + "rcpstatisticsmonitoringaienginemanageRead", + "rcpstatisticsmonitoringconsultingmanageRead", + "rcpstatisticsmonitoringconversationMarkmanageRead", + "rcpoprmanageRead", + "rcpoprmanagegreetingmanageRead", + "rcpoprmanagebothistorymanageRead", + "rcpoprmanagepreviewmanageRead", + "rcpoprmanagetranscriptmanageRead", + "commonsystemRead", + "commonsystemauthMenumanageRead", + "commonsystemcustmanageRead", + "commonsystemserviceGroupmanageRead", + "commonsystemusermanageRead", + "commonsystemgroupAuthmanageRead", + "commonsystemoprmmgcodemanageRead", + "rcpconversationintentmanageFull", + "rcpconversationscenariomanageFull", + "rcpconversationscenariomanageRelease", + "rcpconversationsynonymmanageFull", + "rcpconversationdictionarymanageFull", + "rcpconversationsystemEntitymanageFull", + "rcpconversationapiNodemanageFull", + "rcpconversationcmmNodemanageFull", + "rcpconversationnlpSettingmanageFull", + "rcplearningTestsimulatormanageFull", + "rcpstatisticsuserecordmanageFull", + "rcpstatisticsstatisticsuesmanageFull", + "rcpstatisticsstatisticsresponsemanageFull", + "rcpstatisticsstatisticsintentmanageFull", + "rcpstatisticsstatisticsscenariomanageFull", + "rcpstatisticsmonitoringcallmanageFull", + "rcpstatisticsmonitoringaienginemanageFull", + "rcpstatisticsmonitoringconsultingmanageFull", + "rcpstatisticsmonitoringconversationMarkmanageFull", + "rcpoprmanagegreetingmanageFull", + "rcpoprmanagebothistorymanageFull", + "rcpoprmanagepreviewmanageFull", + "rcpoprmanagetranscriptmanageFull", + "commonsystemauthMenumanageFull", + "commonsystemcustmanageFull", + "commonsystemserviceGroupmanageFull", + "commonsystemusermanageFull", + "commonsystemgroupAuthmanageFull", + "commonsystemoprmmgcodemanageFull", + "privacymasking" + ); + return authList; + } + + public List authToMenu(List authList) { + return authList.stream().map(e -> PolicyResource.valueOf(e).getMenu()) + .collect(Collectors.toList()); + } + + private static final String space = " "; + + public List authToAuthList(List 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 { + log.info(PolicyResource.valueOf(e).getPolicyName()); + 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)) + .distinct() + .collect(Collectors.toList()) + ; + } + + + public List authToMenuList(List 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).getMenu().getMenuName()) + .authName("") + .level(PolicyResource.valueOf(e).getMenu().getLevel()) + .url(PolicyResource.valueOf(e).getMenu().getMenuUrl()) + .build(); + } + 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(); + } + ) + .sorted(Comparator.comparing(MenuVo::getSeq)) + .distinct() + .collect(Collectors.toList()) + ; + } + + public List test10() { + return tbUserAuthGroupRepo.userPolicyListSelect(4L, "ourStore"); + } + + public List getServiceGroup() { + List result = tbServiceGrouopRepo.findByServiceGroupInAndServiceGroupUpper(tbUserCustRepo.findByUserSeq(4L) + .stream().map(e -> e.getServiceGroup()).collect(Collectors.toList()), "ourStore") + .stream().map(f -> new ServiceGroupRes().toServiceGrouopRes(f)).collect(Collectors.toList()); + log.info("getServiceGroup - {}", new Gson().toJson(result)); + return result; + } + + public QueryResults pagingtest() { + return tbIcsCustInfoRepo.SelectCustInfo(SystemIcsCustInfoReq.builder().page(0).size(10).build()); + } + + public List test16() { + List result = tbServiceGrouopRepo.getMainOprmngCode(UserVo.builder() + .userSeq(4L) + .roleVal(RoleResource.USERADMIN.getName()) + .build()); + log.info("result - {}", new Gson().toJson(result)); + return result; + } + + public DslDataTableRes test17() { + SystemPolicyMenuReq dto = new SystemPolicyMenuReq(); + dto.setPage(0); + dto.setSize(10); + dto.setUserVo(UserVo.builder().userSeq(4L).lastUseServiceGroup("ourStore").roleVal(RoleResource.USERADMIN.getName()).build()); + QueryResults result = tbCustPolicyRepo.PolicyMenuListQueryResult(dto); + + DslDataTableRes dslRes = new DslDataTableRes(result, result.getResults().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()) + .build() + ).collect(Collectors.toList())); + return dslRes; + } + + public List test18(int page, int size, String codeText1, String codeText2, String codeText3, String service) { + SystemPolicyMenuReq dto = new SystemPolicyMenuReq(); + dto.setSize(size); + dto.setPage(page); + dto.setCodeText1(codeText1); + dto.setCodeText2(codeText2); + dto.setCodeText3(codeText3); + dto.setServiceGroup(service); + dto.setUserVo(UserVo.builder().userSeq(4L).lastUseServiceGroup("ourStore").roleVal(RoleResource.USERADMIN.getName()).build()); + log.info("dto - {}", new Gson().toJson(dto)); + List result = tbCustPolicyRepo.PolicyMenuListQueryList(dto) + .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("")) { + 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; + }) + .sorted(Comparator.comparing(SystemPolicyMenuRes::getMenuSeq)) + .skip(dto.getSize() * dto.getPage()).limit(dto.getSize()) + .collect(Collectors.toList()); + + log.info("result size - {}", Long.parseLong(String.valueOf(result.size()))); + log.info("getSize - {}", Long.parseLong(String.valueOf(dto.getSize()))); + log.info("getoffset - {}", Long.parseLong(String.valueOf(dto.getSize() * dto.getPage()))); + log.info("dslresult - {}", new Gson().toJson(new DslDataTableRes(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; + }) + .sorted(Comparator.comparing(SystemPolicyMenuRes::getMenuSeq)) + .skip(dto.getSize() * dto.getPage()).limit(dto.getSize()) + .collect(Collectors.toList()) + , Long.parseLong(String.valueOf(result.size())) + , Long.parseLong(String.valueOf(dto.getSize())) + , Long.parseLong(String.valueOf(dto.getSize() * dto.getPage()))))); + return result; + } + + public Map jstreeParentConvertToPolicy() { + Map pMaps = new HashMap<>(); + log.info("jstreeParentConvertToPolicy"); + PolicyResource.ALL.stream().forEach(e -> { + +// 정책이 메뉴를 가지고있음. +// 메뉴 어퍼가있음 +// 메뉴어퍼에 해당하는 메뉴를 찾음 +// 그메뉴를 가지고있는 오쓰를찾음 + Long seqq = e.getMenu().getMenuSeqUpper(); + log.info(e.getName()); + if (seqq == 0L || seqq == 1L) { + log.info("#"); + pMaps.put(e.getName(), "#"); + } else { + log.info("seq - {}", seqq); + pMaps.put(e.getName(), EnumToMap.MenuSeqToPolicyMap.get(seqq)); + } + }); + log.info("돌아아라라 - {}", new Gson().toJson(EnumToMap.MenuSeqToPolicyMap)); + log.info("돌아아라라 - {}", new Gson().toJson(EnumToMap.PolicyToParentMap)); + return pMaps; + } + + public List test20() { + + List test20 = tbServiceGrouopRepo.getServiceGroupView("ourStore"); + for (SystemServiceGroupViewVo e : test20) { + log.info("eee -{}", new Gson().toJson(e)); + e.setPolicyVal(tbCustPolicyRepo.findByServiceGroup(e.getServiceGroup()).stream() + .map(f -> f.getPolicyVal()).collect(Collectors.toList())); + } + return test20; + } + + public void test22() { + + if (!tbUserAuthGroupRepo.existsByServiceGroupAndUserSeqAndAuthGroupSeqNot("DAISO", 4L, 12L)) { + log.info("seq4"); + } + ; + + + } + + + public void test25Service() { + tbIcsCustInfoRepo.findAll(); + } + +// public List test21() { +// return tbBotUserRepo.testConCat(); +// } + + + public void ExcelService(String fileName, List data) throws IOException { + List title = new ArrayList<>(); + for (Field e : data.get(0).getClass().getDeclaredFields()) { + title.add(e.getName()); + } + ExcelService(fileName, data, title); + } + + public void ExcelService(String fileName, List data, List title) throws IOException { + Workbook wb = new HSSFWorkbook(); + Sheet sheet = wb.createSheet("new sheet"); + 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()); + applyCellStyle(cellStyle2); + AtomicInteger ai = new AtomicInteger(); + List 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) 400); + 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); + row1.setHeight((short) 400); + } + } + try (OutputStream fileOut = 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); + } + + + public ResponseEntity exceldataTest() throws IOException, IllegalAccessException { + +// ExcelService(tbBotCommonCodeRepo.findAll() +// .stream().map(e -> SystemCommoncodeRes.builder() +// .oprMngCode(e.getOprMngCode()) +// .codeType(e.getCodeType()) +// .minorCode(e.getMinorCode()) +// .majorCode(e.getMajorCode()) +// .description(e.getDescription()) +// .attribute1(e.getAttribute1()) +// .attribute2(e.getAttribute2()) +// .attribute3(e.getAttribute3()) +// .build()).collect(Collectors.toList())); + + List asd = new ArrayList<>(); + for (int i = 0; i < 15; i++) { + asd.add(i + "번"); + } + asd.add("시나리오그룹"); + asd.add("공통코드생성일"); + ExcelService("다운로드테스트", tbIcsCustInfoRepo.findAll()); + return ResponseEntity.ok().build(); + } + + public void test27(MultipartFile dto) throws IOException { + Workbook wb = new HSSFWorkbook(dto.getInputStream()); + Sheet a = wb.getSheetAt(0); + + for (int i = 0; i < a.getLastRowNum() + 1; i++) { + log.info("data - {}", a.getLastRowNum()); + int celSize = a.getRow(i).getLastCellNum(); + for (int j = 0; j < celSize; j++) { + log.info("data cel - {}", a.getRow(i).getCell(j)); + } + } + + + log.info(a.getSheetName()); + } + + + private final TestMapper testMapper; + + public List test28() { + List result = testMapper.MonitoringScenarioBreak("2023-02-06", "2023-02-07"); + List convert = new ArrayList<>(); + Map scenarioSeqMap = new HashMap<>(); + int totCnt = result.size(); + int faCnt = 0; + int suCnt = 0; + + for (MonitoringScenarioBreakVO e : result) { + if (scenarioSeqMap.containsKey(e.getScenarioSeq())) { + int cnt = scenarioSeqMap.get(e.getScenarioSeq()); + log.info("cnt - {}", cnt); + scenarioSeqMap.put(e.getScenarioSeq(), cnt += 1); + } else { + scenarioSeqMap.put(e.getScenarioSeq(), 1); + } + log.info(e.getScenarioResultCode()); + if (e.getScenarioResultCode().equals("S")) { + suCnt += 1; + } + if (e.getScenarioResultCode().equals("F")) { + faCnt += 1; + } + } + + for (MonitoringScenarioBreakVO e : result) { + convert.add(FailNodeVO.builder() + .oprMngCode(e.getOprMngCode()) + .scenarioSeq(e.getScenarioSeq()) + .scenarioName(e.getScenarioName()) + .totCnt(totCnt) + .useCnt(scenarioSeqMap.get(e.getScenarioSeq())) + .succCnt(suCnt) + .failCnt(faCnt) + .build()); + } + + return convert; + } + + + private final RestTemplateService restTemplateService; + + public Map test31(String dbData) throws CustomBadRequestException, NoSuchMethodException { + + String sss = ""; + log.info("dbdata - -{}", dbData); + Map somethingMap = new HashMap<>(); + + somethingMap.put("#{userMessage}", "예약 예약 예약"); + somethingMap.put("#{origintest1}", "test1"); + somethingMap.put("#{origintest2}", "test2"); + somethingMap.put("#{origintest3}", "test3"); + + return restTemplateService.APINode(somethingMap, somethingMap, dbData); + + } + + + public void test33(String s) throws CustomBadRequestException, NoSuchMethodException { + Map somethingMap = new HashMap<>(); + + somethingMap.put("#{userMessage}", "예약 예약 예약"); + somethingMap.put("#{origintest1}", "test1"); + somethingMap.put("#{origintest2}", "test2"); + somethingMap.put("#{origintest3}", "test3"); + + restTemplateService.APINode(somethingMap, somethingMap, s); + } + + + @Value("${feign.url.nlp}") + private String wisepath; + + public Long test34() throws CustomNotFoundException { + HttpHeaders headers = new HttpHeaders(); + headers.setContentType(MediaType.APPLICATION_JSON); + ResponseEntity callRes = restTemplateService + .PostCall(UriComponentsBuilder.newInstance().uri(URI.create(wisepath + "/proj/insert")).build() + , headers + , new Gson().toJson(WisenutInsertReqVo.builder() + .oprMngCode("UPLUS_RCO_OURSTOREAI") + .serviceGroupDesc("UPLUS 우리가게 AI 최상위 서비스") + .build()) + ); + if (!callRes.getStatusCode().equals(HttpStatus.OK)) { + throw new CustomNotFoundException("NLP 서버 연결에 실패하였습니다."); + } + log.info("nlp result = {}", callRes.getBody()); + WisenutInsertResVo callVo = new Gson().fromJson(callRes.getBody().toString(), WisenutInsertResVo.class); + return callVo.getProjectId(); + } + + public List test35() throws CustomNotFoundException { + HttpHeaders headers = new HttpHeaders(); + headers.setContentType(MediaType.APPLICATION_JSON); + List projectSettins = new ArrayList<>(); + + List setdata = new ArrayList<>(); + for (int i = 0; i < 2; i++) { + setdata.add(WisenutInsertReqVo.builder() + .oprMngCode("OUR" + i) + .serviceGroupDesc("desc" + i) + .build()); + } + + for (WisenutInsertReqVo e : setdata) { + ResponseEntity callRes = restTemplateService + .PostCall(UriComponentsBuilder.newInstance().uri(URI.create(wisepath + "/proj/insert")) + .build(), headers, new Gson().toJson(e)); + + 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()) + .build()); + + } else { + throw new CustomNotFoundException("Wisenut 연결에 실패하였습니다."); + } + } + + log.info("projectSettins - {}", new Gson().toJson(projectSettins)); + return projectSettins; + } + + private final TbCallInfoRepo tbCallInfoRepo; + private final TbCallUserLogRepo tbCallUserLogRepo; + private final TbScenarioBreakNodeRepo tbScenarioBreakNodeRepo; + private final TbCallBotLogRepo tbCallBotLogRepo; + private final TbCallBotRecRepo tbCallBotRecRepo; + private final TbCallUserRecRepo tbCallUserRecRepo; + + public Long test36() { + //5184000건 + //6개월 + Long sTime = System.currentTimeMillis(); + for (int i = 0; i < 180; i++) { + //24시간 + for (int k = 0; k < 24; k++) { + //60분 + List callInfo = new ArrayList<>(); + List botLog = new ArrayList<>(); + List botRec = new ArrayList<>(); + List userLog = new ArrayList<>(); + List userRec = new ArrayList<>(); + List breakNodes = new ArrayList<>(); + + for (int l = 0; l < 60; l++) { + //1시간에20건 + for (int n = 0; n < 20; n++) { +// String token = UUID.randomUUID().toString().substring(0, 43); + String token = UUID.randomUUID().toString() + l; + LocalDateTime insertTime = LocalDateTime.of(2023, 4, 21, 23, 59) + .minusDays(i) + .minusHours(k) + .minusMinutes(l + 5); + callInfo.add(TbCallInfo.builder() + .token(token) + .oprMngCode("UPLUS_RCP_AISTORE") + .inChannelType("VOICE") + .callId(token) + .telNo("01012341234") + .dnisNo("07012341234") + .callInitDate(insertTime.minusSeconds(n)) + .callEndDate(insertTime.plusSeconds(300)) + .callTime(10) + .callEndType("END") + .callEndConversion("END") + .callEndReason("SCENARIO") + .build()); + int beaknode = n; + //봇로그 복녹음 유저로그 유저녹음 5개배수 + //봇로그 복녹음 유저로그 유저녹음 5개배수 + for (int m = 0; m < 5; m++) { + botLog.add(TbCallBotLog.builder() + .token(token) + .talkSeq(m + 1) + .mentSpeechNo(1) + .botText("text" + m) + .itemName("") + .rcpInfo("RCPINFO") + .registDate(insertTime.minusSeconds(n)) + .build()); + botRec.add(TbCallBotRec.builder() + .token(token) + .talkSeq(m + 1) + .recFilePath(token + m) + .registDate(insertTime.minusSeconds(n)) + .build()); + userLog.add(TbCallUserLog.builder() + .token(token) + .talkSeq(m + 1) + .oprMngCode("UPLUS_RCP_AISTORE") + .userText("userText" + m + 1) + .intentId((long) m) + .intentName("") + .score("") + .intentResultCode("INTENT_SUCCESS") + .ifMappingId((long) m) + .ifReturnCode("000") + .ifReturnMsg("INTENT_SUCCESS") + .registDate(insertTime.minusSeconds(n)) + .scenarioSeq((long) m) + .scenarioName("senarioname" + m) + .build()); + userRec.add(TbCallUserRec.builder() + .token(token) + .talkSeq(m + 1) + .itemCode("") + .recFilePath(token + m) + .registDate(insertTime.minusSeconds(n)) + .build()); + //브레이크노드 저장 + //브레이크노드 20프로 이탈 + if (beaknode % 5 == 0) { + breakNodes.add(TbScenarioBreakNode.builder() + .token(token) + .talkSeq(m) + .oprMngCode("UPLUS_RCP_AISTORE") + .scenatioSeq((long) (l + 1)) + .releaseSeq((long) m + 1) + .scenarioName("names") + .scenarioResultCode("S") + .nodeCode("nc" + m + 1) + .nodeName("nodeName" + m + 1) + .nodeType("type") + .registDate(insertTime.minusSeconds(n)) + .build()); + } + } + } + } + tbCallInfoRepo.saveAllAndFlush(callInfo); + tbCallBotLogRepo.saveAllAndFlush(botLog); + tbCallBotRecRepo.saveAllAndFlush(botRec); + tbCallUserLogRepo.saveAllAndFlush(userLog); + tbCallUserRecRepo.saveAllAndFlush(userRec); + tbScenarioBreakNodeRepo.saveAllAndFlush(breakNodes); +// log.info("chk callInfo - {}", new Gson().toJson(callInfo)); +// log.info("chk botLog - {}", new Gson().toJson(botLog)); +// log.info("chk userLog - {}", new Gson().toJson(userLog)); +// log.info("chk break - {}", new Gson().toJson(breakNodes)); + } + } + Long eTime = System.currentTimeMillis(); + return eTime - sTime; + } + + public String test37(){ + return "a"; + } + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/test/controller/TestVoUser.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/test/controller/TestVoUser.java new file mode 100644 index 0000000..274ae65 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/test/controller/TestVoUser.java @@ -0,0 +1,16 @@ +package com.icomsys.main_vm.biz.test.controller; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +import javax.validation.constraints.NotBlank; + +@Getter +@Setter +@NoArgsConstructor +public class TestVoUser { + + private String serviceGroup; + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/test/controller/testvo/APINodeVo.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/test/controller/testvo/APINodeVo.java new file mode 100644 index 0000000..3634592 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/test/controller/testvo/APINodeVo.java @@ -0,0 +1,23 @@ +package com.icomsys.main_vm.biz.test.controller.testvo; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +import java.util.List; + +@Getter +@Setter +@NoArgsConstructor +public class APINodeVo { + + private String apiNodeName; + private String urlType; + private String URL; + private List header; + private List param; + private List request; + private List response; + private String body; + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/biz/test/controller/testvo/KeyValueVo.java b/main_vm/src/main/java/com/icomsys/main_vm/biz/test/controller/testvo/KeyValueVo.java new file mode 100644 index 0000000..9e0f157 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/biz/test/controller/testvo/KeyValueVo.java @@ -0,0 +1,16 @@ +package com.icomsys.main_vm.biz.test.controller.testvo; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +@Getter +@Setter +@NoArgsConstructor +public class KeyValueVo { + + private String key; + private String value; + private String desc; + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/common/code/EnumToMap.java b/main_vm/src/main/java/com/icomsys/main_vm/common/code/EnumToMap.java new file mode 100644 index 0000000..de6b914 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/common/code/EnumToMap.java @@ -0,0 +1,92 @@ +package com.icomsys.main_vm.common.code; + +import com.google.gson.Gson; +import com.icomsys.main_vm.common.code.enumresource.MenuResource; +import com.icomsys.main_vm.common.code.enumresource.PolicyResource; +import lombok.extern.slf4j.Slf4j; +import org.springframework.core.annotation.Order; +import org.springframework.stereotype.Component; + +import javax.annotation.PostConstruct; +import java.util.*; + +@Component +@Slf4j +public class EnumToMap { + + public static final Map> urlToMap = new HashMap<>(); + public static final Map MenuSeqToMenuMap = new HashMap<>(); + public static final Map MenuSeqUpperToMenuMap = new HashMap<>(); + public static final Map MenuSeqToPolicyMap = new HashMap<>(); + public static final Map PolicyToMenuMap = new HashMap<>(); + public static final Map PolicyToParentMap = new HashMap<>(); + public static final Map> authToMap = new HashMap<>(); + public static final Map spaceMap = new HashMap<>(); + @Order(0) + @PostConstruct + private void MenuSeqToMenuMap() { + MenuResource.ALL.stream().forEach(e ->{ + MenuSeqToMenuMap.put(e.getMenuSeq(), e); + }); + } + + @Order(1) + @PostConstruct + private void MenuSeqUpperToMenuMap() { + MenuResource.ALL.stream().forEach(e ->{ + MenuSeqUpperToMenuMap.put(e.getMenuSeqUpper(), e); + }); + } + + @Order(2) + @PostConstruct + private void MenuSeqToPolicyMap() { + PolicyResource.ALL.stream().forEach(e ->{ + MenuSeqToPolicyMap.put(e.getMenu().getMenuSeq(), e.getName()); + }); + } + + @Order(3) + @PostConstruct + private void PolicyToMenuMap() { + PolicyResource.ALL.stream().forEach(e ->{ + PolicyToMenuMap.put(e.getName(), e.getMenu().getMenuName()); + }); + } + + @Order(4) + @PostConstruct + private void PolicyToParentMap() { + + Map mstpm = new HashMap<>(); + + PolicyResource.ALL.stream().forEach(e ->{ + mstpm.put(e.getMenu().getMenuSeq(), e.getName()); + }); + + PolicyResource.ALL.stream().forEach(e ->{ + Long seqq = e.getMenu().getMenuSeqUpper(); + log.info(e.getName()); + if(seqq == 0L || seqq == 1L ){ + PolicyToParentMap.put(e.getName(), "#"); + } + else { + PolicyToParentMap.put(e.getName(), mstpm.get(seqq)); + } + }); + } + + + @PostConstruct + private void WhiteSpace() { + spaceMap.put(0, ""); + spaceMap.put(1, " "); + spaceMap.put(2, " "); + spaceMap.put(3, " "); + spaceMap.put(4, " "); + spaceMap.put(5, " "); + } + + + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/common/code/MenuCategoryVo.java b/main_vm/src/main/java/com/icomsys/main_vm/common/code/MenuCategoryVo.java new file mode 100644 index 0000000..eee3a09 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/common/code/MenuCategoryVo.java @@ -0,0 +1,21 @@ +package com.icomsys.main_vm.common.code; + +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +@Getter +@Setter +@NoArgsConstructor +public class MenuCategoryVo { + + private String typeName; + private String categoryValue; + + @Builder + public MenuCategoryVo(String typeName, String categoryValue) { + this.typeName = typeName; + this.categoryValue = categoryValue; + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/common/code/MenuVo.java b/main_vm/src/main/java/com/icomsys/main_vm/common/code/MenuVo.java new file mode 100644 index 0000000..b17d9fe --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/common/code/MenuVo.java @@ -0,0 +1,30 @@ +package com.icomsys.main_vm.common.code; + +import lombok.*; + +@Getter +@Setter +@NoArgsConstructor +public class MenuVo { + + private String menuName; + private Long seq; + private Long seqUpper; + private int level; + private int nextLevel; + private String authName; + private String url; + + + @Builder + public MenuVo(String menuName, Long seq, Long seqUpper, int level, int nextLevel, String authName, String url) { + this.menuName = menuName; + this.seq = seq; + this.seqUpper = seqUpper; + this.level = level; + this.nextLevel = nextLevel; + this.authName = authName; + this.url = url; + } + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/common/code/code/LongTextManagerColumnCode.java b/main_vm/src/main/java/com/icomsys/main_vm/common/code/code/LongTextManagerColumnCode.java new file mode 100644 index 0000000..69144a0 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/common/code/code/LongTextManagerColumnCode.java @@ -0,0 +1,16 @@ +package com.icomsys.main_vm.common.code.code; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +@Getter +@AllArgsConstructor +public enum LongTextManagerColumnCode { + DIAGRAM("DIAGRAM", 1), + SCENARIO("SCENARIO", 2), + CONTENT("CONTENT", 3), + DUMMY_TEST("CONTENT", 4); + + private String columnName; + private int code; +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/common/code/code/LongTextManagerTableCode.java b/main_vm/src/main/java/com/icomsys/main_vm/common/code/code/LongTextManagerTableCode.java new file mode 100644 index 0000000..0f3d84e --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/common/code/code/LongTextManagerTableCode.java @@ -0,0 +1,19 @@ +package com.icomsys.main_vm.common.code.code; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +@Getter +@AllArgsConstructor +public enum LongTextManagerTableCode { + TB_SCENARIO_RELEASE("TB_SCENARIO_RELEASE", 1), + TB_SCENARIO_HISTORY("TB_SCENARIO_HISTORY", 2), + TB_SCENARIO_TEMPLATE("TB_SCENARIO_TEMPLATE", 3), + TB_COMMON_NODE("TB_COMMON_NODE", 4), + TB_API_NODE("TB_API_NODE", 5); + + private String tableName; + private int code; +} + + diff --git a/main_vm/src/main/java/com/icomsys/main_vm/common/code/code/ServiceStatusType.java b/main_vm/src/main/java/com/icomsys/main_vm/common/code/code/ServiceStatusType.java new file mode 100644 index 0000000..35972b2 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/common/code/code/ServiceStatusType.java @@ -0,0 +1,24 @@ +package com.icomsys.main_vm.common.code.code; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * @Name ServiceStatusType + * @Description 서비스 상태 유형 (실행 시간 기준 상태정보) + * @Author sungbumoh + * @CreateDate 2020. 8. 6. + */ +@Getter +@AllArgsConstructor +public enum ServiceStatusType { + + CLEAN("CLEAN", 0.5), // OK + WARNING("WARNING", 1.0), // 경고 + BAD("BAD", 2.0), // 나쁨 + CRITICAL("CRITICAL", 5.0); // 이슈 + + private String value; + private double serviceTime; + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/common/code/code/UseYNCode.java b/main_vm/src/main/java/com/icomsys/main_vm/common/code/code/UseYNCode.java new file mode 100644 index 0000000..3ba6a6f --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/common/code/code/UseYNCode.java @@ -0,0 +1,13 @@ +package com.icomsys.main_vm.common.code.code; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +@Getter +@AllArgsConstructor +public enum UseYNCode { + + Y, + N + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/common/code/enumresource/ActionResource.java b/main_vm/src/main/java/com/icomsys/main_vm/common/code/enumresource/ActionResource.java new file mode 100644 index 0000000..1da1416 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/common/code/enumresource/ActionResource.java @@ -0,0 +1,47 @@ +package com.icomsys.main_vm.common.code.enumresource; + +import lombok.Getter; + +import java.util.Arrays; +import java.util.List; + +@Getter +public enum ActionResource { + + insert("등록"), + update("수정"), + delete("삭제"), + upload("업로드"), + download("다운로드"), + release("배포"), + rollback("롤백"), + login("로그인"), + learn("학습"), + reflect("반영"), + listen("듣기"); + private String typeName; + + ActionResource(String typeName) { + this.typeName = typeName; + } + + + public String getName() { + return name(); + } + + public static List ALL = Arrays.asList( + + insert, + update, + delete, + upload, + download, + release, + rollback, + login, + learn, + reflect, + listen + ); +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/common/code/enumresource/MenuResource.java b/main_vm/src/main/java/com/icomsys/main_vm/common/code/enumresource/MenuResource.java new file mode 100644 index 0000000..e12fb82 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/common/code/enumresource/MenuResource.java @@ -0,0 +1,156 @@ +package com.icomsys.main_vm.common.code.enumresource; + +import lombok.Getter; + +import java.util.Arrays; +import java.util.List; + +@Getter +public enum MenuResource { + + root("common", 1L, 0L, 1, "대쉬보드", "대쉬보드", "/admin/common/dashboard/manage.do"), +// root("common", 1L, 0L, 1, "대쉬보드", "대쉬보드", "0"), + rcpconversation("rcp", 1800000L, 1L, 2, "대화관리", "대화관리", "0"), + rcpconversationintentmanage("rcp", 1800001L, 1800000L, 3, "인텐트관리", "인텐트관리", "/admin/rcp/conversation/intent/manage.do"), + rcpconversationscenariomanage("rcp", 1800002L, 1800000L, 3, "시나리오관리", "시나리오관리", "/admin/rcp/conversation/scenario/manage.do"), + rcpconversationsynonymmanage("rcp", 1800003L, 1800000L, 3, "동의어관리", "동의어관리", "/admin/rcp/conversation/synonym/manage.do"), + rcpconversationsystemEntitymanage("rcp", 1800004L, 1800000L, 3, "시스템엔티티", "시스템엔티티", "/admin/rcp/conversation/systemEntity/manage.do"), + rcpconversationapiNodemanage("rcp", 1800005L, 1800000L, 3, "API노드관리", "API노드관리", "/admin/rcp/conversation/apiNode/manage.do"), + rcpconversationcmmNodemanage("rcp", 1800006L, 1800000L, 3, "COMMON노드관리", "COMMON노드관리", "/admin/rcp/conversation/cmmNode/manage.do"), + rcplearningTest("rcp", 1900000L, 1L, 2, "학습및테스트", "학습및테스트", "0"), + rcplearningTestsimulatormanage("rcp", 1900001L, 1900000L, 3, "시뮬레이터", "시뮬레이터", "/admin/rcp/learningTest/simulator/manage.do"), + rcplearningTestinferencemanage("rcp", 1900002L, 1900000L, 3, "의도추론 테스트", "의도추론 테스트", "/admin/rcp/learningTest/inference/manage.do"), + rcplearningTeststttestmanage("rcp", 1900003L, 1900000L, 3, "STT 테스트", "STT 테스트", "/admin/rcp/learningTest/stttest/manage.do"), + rcplearningTestttstestmanage("rcp", 1900004L, 1900000L, 3, "TTS 테스트", "TTS 테스트", "/admin/rcp/learningTest/ttstest/manage.do"), + rcpmonitoring("rcp", 2000000L, 1L, 2, "모니터링", "모니터링", "0"), + rcpmonitoringconsultingmanage("rcp", 2000001L, 2000000L, 3, "응대이력", "응대이력", "/admin/rcp/statistics/monitoring/consulting/manage.do"), + rcpmonitoringconversationMarkmanage("rcp", 2000002L, 2000000L, 3, "대화책갈피", "대화책갈피", "/admin/rcp/statistics/monitoring/conversationMark/manage.do"), + rcpmonitoringintentAnalysismanage("rcp", 2000003L, 2000000L, 3, "인텐트분석관리", "인텐트분석관리", "/admin/rcp/statistics/monitoring/intentAnalysis/manage.do"), + rcpmonitoringoutscenariomanage("rcp", 2000004L, 2000000L, 3, "시나리오이탈노드관리", "시나리오이탈노드관리", "/admin/rcp/statistics/monitoring/outscenario/manage.do"), + rcpmonitoringworkhistorymanage("rcp", 2000005L, 2000000L, 3, "작업이력조회", "작업이력조회", "/admin/rcp/statistics/monitoring/workhistory/manage.do"), + rcpmonitoringaienginemanage("rcp", 2000006L, 2000000L, 3, "AI엔진 트래픽모니터링", "AI엔진 트래픽모니터링", "/admin/rcp/statistics/monitoring/aiengine/manage.do"), + + rcpstatistics("rcp", 2100000L, 1L, 2, "통계", "통계", "0"), + rcpstatisticsintent("rcp", 2100100L, 2100000L, 3, "인텐트통계", "인텐트통계", "0"), + rcpstatisticsintentdaymanage("rcp", 2100101L, 2100100L, 4, "날짜별통계", "인텐트날짜별통계", "/admin/rcp/statistics/intent/day/manage.do"), + rcpstatisticsintentitemmanage("rcp", 2100102L, 2100100L, 4, "항목별통계", "인텐트항목별통계", "/admin/rcp/statistics/intent/item/manage.do"), + rcpstatisticsscenario("rcp", 2100200L, 2100000L, 3, "시나리오통계", "시나리오통계", "0"), + rcpstatisticsscenariodaymanage("rcp", 2100201L, 2100200L, 4, "날짜별통계", "시나리오날짜별통계", "/admin/rcp/statistics/scenario/day/manage.do"), + rcpstatisticsscenarioitemmanage("rcp", 2100202L, 2100200L, 4, "항목별통계", "시나리오항목별통계", "/admin/rcp/statistics/scenario/item/manage.do"), + rcpstatisticscall("rcp", 2100300L, 2100000L, 3, "콜통계", "콜통계", "0"), + rcpstatisticscallinfomanage("rcp", 2100301L, 2100300L, 4, "콜통계", "콜통계", "/admin/rcp/statistics/call/info/manage.do"), + rcpstatisticsaienginemanage("rcp", 2100302L, 2100300L, 4, "AI엔진통계", "AI엔진통계", "/admin/rcp/statistics/call/aiengine/manage.do"), + rcpstatisticsdashboardmanage("rcp", 2100400L, 2100000L, 3, "대쉬보드", "대쉬보드", "/admin/common/dashboard/manage.do"), + + rcpoprmanage("rcp", 2200000L, 1L, 2, "운영관리", "운영관리", "0"), + rcpoprmanagenlpSettingmanage("rcp", 2200001L, 2200000L, 3, "NLP설정", "NLP설정", "/admin/rcp/oprmanage/nlpSetting/manage.do"), + rcpoprmanagebgmmanage("rcp", 2200002L, 2200000L, 3, "배경음관리", "배경음관리", "/admin/rcp/oprmanage/bgm/manage.do"), + rcpoprmanagettstagmanage("rcp",2200003L,2200000L,3,"TTS태그관리","TTS태그관리","/admin/rcp/oprmanage/ttstag/manage.do"), + + + commonsystem("common", 9000000L, 1L, 2, "시스템관리", "시스템관리", "0"), + commonsystempolicyMenumanage("common", 9000001L, 9000000L, 3, "정책별 메뉴 조회", "정책별 메뉴 조회", "/admin/common/system/policyMenu/manage.do"), + commonsystemcustmanage("common", 9000002L, 9000000L, 3, "고객사 관리", "고객사 관리", "/admin/common/system/cust/manage.do"), + commonsystemserviceGroupmanage("common", 9000003L, 9000000L, 3, "서비스그룹 관리", "서비스그룹 관리", "/admin/common/system/serviceGroup/manage.do"), + commonsystemgroupAuthmanage("common", 9000004L, 9000000L, 3, "그룹별 권한관리", "그룹별 권한관리", "/admin/common/system/groupAuth/manage.do"), + commonsystemuserAdminmanage("common", 9000005L, 9000000L, 3, "운영자 관리(사용안함)", "운영자 관리", "/admin/common/system/userAdmin/manage.do"), + commonsystemusermanage("common", 9000006L, 9000000L, 3, "사용자 관리", "사용자 관리", "/admin/common/system/user/manage.do"), + commonsystemoprmngcodemanage("common", 9000007L, 9000000L, 3, "공통코드 관리", "공통코드 관리", "/admin/common/system/oprmngcode/manage.do"); + + + private String solVal; + private Long menuSeq; + private Long menuSeqUpper; + private int level; + private String menuName; + private String menuDesc; + private String menuUrl; + + MenuResource(String solVal, Long menuSeq, Long menuSeqUpper, int level, String menuName, String menuDesc, String menuUrl) { + this.solVal = solVal; + this.menuSeq = menuSeq; + this.menuSeqUpper = menuSeqUpper; + this.level = level; + this.menuName = menuName; + this.menuDesc = menuDesc; + this.menuUrl = menuUrl; + } + + public String getName() { + return name(); + } + + public static List ALL = Arrays.asList( + root, + + rcpconversation, + rcpconversationintentmanage, + rcpconversationscenariomanage, + rcpconversationsynonymmanage, + rcpconversationsystemEntitymanage, + rcpconversationapiNodemanage, + rcpconversationcmmNodemanage, + + rcplearningTest, + rcplearningTestsimulatormanage, + rcplearningTestinferencemanage, + rcplearningTeststttestmanage, + rcplearningTestttstestmanage, + + rcpmonitoring, + rcpmonitoringconsultingmanage, + rcpmonitoringconversationMarkmanage, + rcpmonitoringintentAnalysismanage, + rcpmonitoringoutscenariomanage, + rcpmonitoringworkhistorymanage, + rcpmonitoringaienginemanage, + + rcpstatistics, + rcpstatisticsintent, + rcpstatisticsintentdaymanage, + rcpstatisticsintentitemmanage, + rcpstatisticsscenario, + rcpstatisticsscenariodaymanage, + rcpstatisticsscenarioitemmanage, + rcpstatisticscall, + rcpstatisticscallinfomanage, + rcpstatisticsaienginemanage, + + rcpoprmanage, + rcpoprmanagenlpSettingmanage, + rcpoprmanagebgmmanage, + rcpoprmanagettstagmanage, + + commonsystem, + commonsystemcustmanage, + commonsystemserviceGroupmanage, + commonsystemgroupAuthmanage, + commonsystemuserAdminmanage, + commonsystemusermanage, + commonsystemoprmngcodemanage + + + ); + + + public static List LOGLIST = Arrays.asList( + rcpconversationintentmanage, + rcpconversationscenariomanage, + rcpconversationsynonymmanage, + rcpconversationapiNodemanage, + rcpconversationcmmNodemanage, + rcplearningTestsimulatormanage, + rcplearningTestinferencemanage, + rcpmonitoringconsultingmanage, + rcpmonitoringconversationMarkmanage, + rcpmonitoringintentAnalysismanage, + rcpmonitoringoutscenariomanage, + rcpstatisticsintentdaymanage, + rcpstatisticsintentitemmanage, + rcpstatisticsscenariodaymanage, + rcpstatisticsscenarioitemmanage, + rcpstatisticscallinfomanage + + ); + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/common/code/enumresource/PolicyResource.java b/main_vm/src/main/java/com/icomsys/main_vm/common/code/enumresource/PolicyResource.java new file mode 100644 index 0000000..5dbf7f6 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/common/code/enumresource/PolicyResource.java @@ -0,0 +1,193 @@ +package com.icomsys.main_vm.common.code.enumresource; + +import lombok.Getter; + +import java.util.Arrays; +import java.util.List; + +@Getter +public enum PolicyResource { + rootRead(MenuResource.root, "대쉬보드읽기권한", "Y", 1, Arrays.asList()), + rcpconversationRead(MenuResource.rcpconversation, "대화관리읽기권한", "Y", 1, Arrays.asList()), + rcpconversationintentmanageRead(MenuResource.rcpconversationintentmanage, "인텐트관리읽기권한", "Y", 1, Arrays.asList()), + rcpconversationscenariomanageRead(MenuResource.rcpconversationscenariomanage, "시나리오관리읽기권한", "Y", 1, Arrays.asList()), + rcpconversationsynonymmanageRead(MenuResource.rcpconversationsynonymmanage, "동의어관리읽기권한", "Y", 1, Arrays.asList()), + rcpconversationsystemEntitymanageRead(MenuResource.rcpconversationsystemEntitymanage, "시스템엔티티읽기권한", "Y", 1, Arrays.asList()), + rcpconversationapiNodemanageRead(MenuResource.rcpconversationapiNodemanage, "API노드관리읽기권한", "Y", 1, Arrays.asList()), + rcpconversationcmmNodemanageRead(MenuResource.rcpconversationcmmNodemanage, "COMMON노드관리읽기권한", "Y", 1, Arrays.asList()), + + rcplearningTestRead(MenuResource.rcplearningTest, "학습및테스트읽기권한", "Y", 1, Arrays.asList()), + rcplearningTestsimulatormanageRead(MenuResource.rcplearningTestsimulatormanage, "시뮬레이터읽기권한", "Y", 1, Arrays.asList()), + rcplearningTestinferencemanageRead(MenuResource.rcplearningTestinferencemanage, "의도추론 테스트읽기권한", "Y", 1, Arrays.asList()), + rcplearningTeststttestmanageRead(MenuResource.rcplearningTeststttestmanage, "STT 테스트읽기권한", "Y", 1, Arrays.asList()), + rcplearningTestttstestmanageRead(MenuResource.rcplearningTestttstestmanage, "TTS 테스트읽기권한", "Y", 1, Arrays.asList()), + rcpmonitoringRead(MenuResource.rcpmonitoring, "모니터링읽기권한", "Y", 1, Arrays.asList()), + rcpmonitoringconsultingmanageRead(MenuResource.rcpmonitoringconsultingmanage, "상담이력관리읽기권한", "Y", 1, Arrays.asList()), + rcpmonitoringconversationMarkmanageRead(MenuResource.rcpmonitoringconversationMarkmanage, "대화책갈피관리읽기권한", "Y", 1, Arrays.asList()), + rcpmonitoringintentAnalysismanageRead(MenuResource.rcpmonitoringintentAnalysismanage, "인텐트분석관리읽기권한", "Y", 1, Arrays.asList()), + rcpmonitoringoutscenariomanageRead(MenuResource.rcpmonitoringoutscenariomanage, "시나리오이탈노드관리읽기권한", "Y", 1, Arrays.asList()), + rcpmonitoringworkhistorymanageRead(MenuResource.rcpmonitoringworkhistorymanage, "작업이력조회읽기권한", "Y", 1, Arrays.asList()), + rcpmonitoringaienginemanageRead(MenuResource.rcpmonitoringaienginemanage, "AI엔진 트래픽모니터링읽기권한", "Y", 1, Arrays.asList()), + rcpstatisticsRead(MenuResource.rcpstatistics, "통계읽기권한", "Y", 1, Arrays.asList()), + rcpstatisticsintentRead(MenuResource.rcpstatisticsintent, "인텐트통계읽기권한", "Y", 1, Arrays.asList()), + rcpstatisticsintentdaymanageRead(MenuResource.rcpstatisticsintentdaymanage, "날짜별통계읽기권한", "Y", 1, Arrays.asList()), + rcpstatisticsintentitemmanageRead(MenuResource.rcpstatisticsintentitemmanage, "항목별통계읽기권한", "Y", 1, Arrays.asList()), + rcpstatisticsscenarioRead(MenuResource.rcpstatisticsscenario, "시나리오통계읽기권한", "Y", 1, Arrays.asList()), + rcpstatisticsscenariodaymanageRead(MenuResource.rcpstatisticsscenariodaymanage, "날짜별통계읽기권한", "Y", 1, Arrays.asList()), + rcpstatisticsscenarioitemmanageRead(MenuResource.rcpstatisticsscenarioitemmanage, "항목별통계읽기권한", "Y", 1, Arrays.asList()), + rcpstatisticscallRead(MenuResource.rcpstatisticscall, "콜통계읽기권한", "Y", 1, Arrays.asList()), + rcpstatisticscallinfomanageRead(MenuResource.rcpstatisticscallinfomanage, "콜통계읽기권한", "Y", 1, Arrays.asList()), + rcpstatisticsaienginemanageRead(MenuResource.rcpstatisticsaienginemanage, "AI엔진통계읽기권한", "Y", 1, Arrays.asList()), + rcpoprmanageRead(MenuResource.rcpoprmanage, "운영관리읽기권한", "Y", 1, Arrays.asList()), + rcpoprmanagenlpSettingmanageRead(MenuResource.rcpoprmanagenlpSettingmanage, "NLP설정읽기권한", "Y", 1, Arrays.asList()), + rcpoprmanagebgmmanageRead(MenuResource.rcpoprmanagebgmmanage, "배경음관리읽기권한", "Y", 1, Arrays.asList()), + rcpoprmanagettstagmanageRead(MenuResource.rcpoprmanagettstagmanage, "TTS태그관리읽기권한", "Y", 1, Arrays.asList()), + + + commonsystemRead(MenuResource.commonsystem, "시스템관리읽기권한", "Y", 10000, Arrays.asList()), + + // commonsystempolicyMenumanageRead(MenuResource.commonsystempolicyMenumanage, "정책별 메뉴 조회읽기권한", "Y", 1000000, Arrays.asList()), + commonsystemcustmanageRead(MenuResource.commonsystemcustmanage, "고객사 관리읽기권한", "Y", 1000000, Arrays.asList()), + commonsystemserviceGroupmanageRead(MenuResource.commonsystemserviceGroupmanage, "서비스그룹 관리읽기권한", "Y", 1000000, Arrays.asList()), + commonsystemgroupAuthmanageRead(MenuResource.commonsystemgroupAuthmanage, "그룹별 권한관리읽기권한", "Y", 10000, Arrays.asList()), + commonsystemuserAdminmanageRead(MenuResource.commonsystemuserAdminmanage, "운영자 관리읽기권한", "Y", 1000000, Arrays.asList()), + commonsystemusermanageRead(MenuResource.commonsystemusermanage, "사용자 관리읽기권한", "Y", 10000, Arrays.asList()), + commonsystemoprmngcodemanageRead(MenuResource.commonsystemoprmngcodemanage, "공통코드 관리읽기권한", "Y", 10000, Arrays.asList()), + + + rcpconversationintentmanageFull(MenuResource.rcpconversationintentmanage, "인텐트관리전체권한", "Y", 1, Arrays.asList()), + rcpconversationscenariomanageFull(MenuResource.rcpconversationscenariomanage, "시나리오관리전체권한", "Y", 1, Arrays.asList()), + rcpconversationsynonymmanageFull(MenuResource.rcpconversationsynonymmanage, "동의어관리전체권한", "Y", 1, Arrays.asList()), + rcpconversationsystemEntitymanageFull(MenuResource.rcpconversationsystemEntitymanage, "시스템엔티티전체권한", "Y", 1, Arrays.asList()), + rcpconversationapiNodemanageFull(MenuResource.rcpconversationapiNodemanage, "API노드관리전체권한", "Y", 1, Arrays.asList()), + rcpconversationcmmNodemanageFull(MenuResource.rcpconversationcmmNodemanage, "COMMON노드관리전체권한", "Y", 1, Arrays.asList()), + rcplearningTestsimulatormanageFull(MenuResource.rcplearningTestsimulatormanage, "시뮬레이터전체권한", "Y", 1, Arrays.asList()), + rcplearningTestinferencemanageFull(MenuResource.rcplearningTestinferencemanage, "의도추론 테스트전체권한", "Y", 1, Arrays.asList()), + + rcpmonitoringconsultingmanageFull(MenuResource.rcpmonitoringconsultingmanage, "상담이력관리전체권한", "Y", 1, Arrays.asList()), + rcpmonitoringconversationMarkmanageFull(MenuResource.rcpmonitoringconversationMarkmanage, "대화책갈피관리전체권한", "Y", 1, Arrays.asList()), + rcpmonitoringintentAnalysismanageFull(MenuResource.rcpmonitoringintentAnalysismanage, "인텐트분석관리전체권한", "Y", 1, Arrays.asList()), + rcpmonitoringoutscenariomanageFull(MenuResource.rcpmonitoringoutscenariomanage, "시나리오이탈노드관리전체권한", "Y", 1, Arrays.asList()), + rcpstatisticsdashboardmanageFull(MenuResource.rcpstatisticsdashboardmanage, "대쉬보드전체권한", "Y", 1, Arrays.asList()), + + + rcpoprmanagenlpSettingmanageFull(MenuResource.rcpoprmanagenlpSettingmanage, "NLP설정전체권한", "Y", 1, Arrays.asList()), + rcpoprmanagebgmmanageFull(MenuResource.rcpoprmanagebgmmanage, "배경음관리전체권한", "Y", 1, Arrays.asList()), + rcpoprmanagettstagmanageFull(MenuResource.rcpoprmanagettstagmanage, "TTS태그관리전체권한", "Y", 1, Arrays.asList()), + + + commonsystemcustmanageFull(MenuResource.commonsystemcustmanage, "고객사 관리전체권한", "Y", 1000000, Arrays.asList()), + commonsystemserviceGroupmanageFull(MenuResource.commonsystemserviceGroupmanage, "서비스그룹 관리전체권한", "Y", 1000000, Arrays.asList()), + commonsystemgroupAuthmanageFull(MenuResource.commonsystemgroupAuthmanage, "그룹별 권한관리전체권한", "Y", 10000, Arrays.asList()), + commonsystemuserAdminmanageFull(MenuResource.commonsystemuserAdminmanage, "운영자 관리전체권한", "Y", 1000000, Arrays.asList()), + commonsystemusermanageFull(MenuResource.commonsystemusermanage, "사용자 관리전체권한", "Y", 10000, Arrays.asList()), + commonsystemoprmngcodemanageFull(MenuResource.commonsystemoprmngcodemanage, "공통코드 관리전체권한", "Y", 10000, Arrays.asList()), + + + //기타권한 + privacymasking(MenuResource.root, "마스킹해제", "N", 1, Arrays.asList()), + rcpconversationscenariomanageRelease(MenuResource.root, "시나리오관리배포", "N", 1, Arrays.asList()); + + + private MenuResource menu; + private String policyName; + private String createYn; + private int roleValSeq; + private List urlList; + + PolicyResource(MenuResource menu, String policyName, String createYn, int roleValSeq, List urlList) { + this.menu = menu; + this.policyName = policyName; + this.createYn = createYn; + this.roleValSeq = roleValSeq; + this.urlList = urlList; + } + + public String getName() { + return name(); + } + + public static final List ALL = Arrays.asList( + rootRead, + + rcpconversationRead, + rcpconversationintentmanageRead, + rcpconversationscenariomanageRead, + rcpconversationsynonymmanageRead, + rcpconversationsystemEntitymanageRead, + rcpconversationapiNodemanageRead, + rcpconversationcmmNodemanageRead, + + rcplearningTestRead, + rcplearningTestsimulatormanageRead, + rcplearningTestinferencemanageRead, + rcplearningTeststttestmanageRead, + rcplearningTestttstestmanageRead, + + rcpmonitoringRead, + rcpmonitoringconsultingmanageRead, + rcpmonitoringconversationMarkmanageRead, + rcpmonitoringintentAnalysismanageRead, + rcpmonitoringoutscenariomanageRead, + rcpmonitoringworkhistorymanageRead, + rcpmonitoringaienginemanageRead, + + rcpstatisticsRead, + rcpstatisticsintentRead, + rcpstatisticsintentdaymanageRead, + rcpstatisticsintentitemmanageRead, + rcpstatisticsscenarioRead, + rcpstatisticsscenariodaymanageRead, + rcpstatisticsscenarioitemmanageRead, + rcpstatisticscallRead, + rcpstatisticscallinfomanageRead, + rcpstatisticsaienginemanageRead, + + rcpoprmanageRead, + rcpoprmanagenlpSettingmanageRead, + rcpoprmanagebgmmanageRead, + rcpoprmanagettstagmanageRead, + + commonsystemRead, + commonsystemcustmanageRead, + commonsystemserviceGroupmanageRead, + commonsystemgroupAuthmanageRead, + commonsystemuserAdminmanageRead, + commonsystemusermanageRead, + commonsystemoprmngcodemanageRead, + + rcpconversationintentmanageFull, + rcpconversationscenariomanageFull, + rcpconversationsynonymmanageFull, + rcpconversationsystemEntitymanageFull, + rcpconversationapiNodemanageFull, + rcpconversationcmmNodemanageFull, + + rcplearningTestsimulatormanageFull, + rcplearningTestinferencemanageFull, + + rcpmonitoringconsultingmanageFull, + rcpmonitoringconversationMarkmanageFull, + rcpmonitoringintentAnalysismanageFull, + rcpmonitoringoutscenariomanageFull, + rcpstatisticsdashboardmanageFull, + + rcpoprmanagenlpSettingmanageFull, + rcpoprmanagebgmmanageFull, + rcpoprmanagettstagmanageFull, + + commonsystemcustmanageFull, + commonsystemserviceGroupmanageFull, + commonsystemgroupAuthmanageFull, + commonsystemuserAdminmanageFull, + commonsystemusermanageFull, + commonsystemoprmngcodemanageFull, + + //기타권한 + privacymasking, + rcpconversationscenariomanageRelease + + ); + + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/common/code/enumresource/RoleResource.java b/main_vm/src/main/java/com/icomsys/main_vm/common/code/enumresource/RoleResource.java new file mode 100644 index 0000000..e559a88 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/common/code/enumresource/RoleResource.java @@ -0,0 +1,32 @@ +package com.icomsys.main_vm.common.code.enumresource; + +import lombok.Getter; + +import java.util.Arrays; +import java.util.List; + +@Getter +public enum RoleResource { + + SYSTEMADMIN(1000001L, "시스템어드민", "아이컴시스 시스템관리자"), + USERADMIN(10001L, "운영자","서비스그룹 관리자"), + USER(11L,"사용자","일반 사용자") + ; + + private Long roleValSeq; + private String roleName; + private String roleDesc; + + RoleResource(Long roleValSeq, String roleName, String roleDesc) { + this.roleValSeq = roleValSeq; + this.roleName = roleName; + this.roleDesc = roleDesc; + } + + public String getName(){ + return name(); + } + + public static final List CreatUserRole = Arrays.asList(USERADMIN, USER); + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/common/code/enumresource/ScenarioNodeType.java b/main_vm/src/main/java/com/icomsys/main_vm/common/code/enumresource/ScenarioNodeType.java new file mode 100644 index 0000000..e1ff7e0 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/common/code/enumresource/ScenarioNodeType.java @@ -0,0 +1,34 @@ +package com.icomsys.main_vm.common.code.enumresource; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +@Getter +@AllArgsConstructor +public enum ScenarioNodeType { + Intent("INTENT"), + Speak("SPEAK"), + Slot("SLOT"), + Split("SPLIT"), + API("API"), + Common("COMMON"), + Function("FUNCTION"), + Call("CALL"), + IN("IN"), + OUT("OUT"), + HORIZONTALCONTAINER("HORIZONTALCONTAINER"), + VERTICALCONTAINER("VERTICALCONTAINER"), + NotDefine("NOT_DEFINE"); + + private final String name; + + public static ScenarioNodeType findByName(String nodeName) { + for(ScenarioNodeType nodeType : ScenarioNodeType.values()) { + if(nodeType.name.equals(nodeName)) { + return nodeType; + } + } + + return NotDefine; + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/common/code/enumresource/SessionResource.java b/main_vm/src/main/java/com/icomsys/main_vm/common/code/enumresource/SessionResource.java new file mode 100644 index 0000000..56f725a --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/common/code/enumresource/SessionResource.java @@ -0,0 +1,13 @@ +package com.icomsys.main_vm.common.code.enumresource; + +public enum SessionResource { + + LoginVO, + PolicyList, + UserVO; + + public String getName(){ + return name(); + } + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/common/code/enumresource/SolTypeResource.java b/main_vm/src/main/java/com/icomsys/main_vm/common/code/enumresource/SolTypeResource.java new file mode 100644 index 0000000..9971d26 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/common/code/enumresource/SolTypeResource.java @@ -0,0 +1,34 @@ +package com.icomsys.main_vm.common.code.enumresource; + +import lombok.Getter; + +import java.util.Arrays; +import java.util.List; + +@Getter +public enum SolTypeResource { + + MAIN("MAIN", "상위서비스그룹"), + ADD("주소봇","주소봇"), + BOT("스텐다드봇","STANDARDBOT"), + GUD("상담가이드봇","상담가이드봇"), + RCP("무인접수봇","무인접수봇"), + VDO("영상상담봇","영상상담봇") + ; + + private String solName; + private String solDesc; + + SolTypeResource(String solName, String solDesc) { + this.solName = solName; + this.solDesc = solDesc; + } + + public String getName(){ + return name(); + } + + public static final List ALL = Arrays.asList(ADD, BOT, GUD, RCP, VDO); + + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/common/code/enumresource/URLResource.java b/main_vm/src/main/java/com/icomsys/main_vm/common/code/enumresource/URLResource.java new file mode 100644 index 0000000..e5d78d9 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/common/code/enumresource/URLResource.java @@ -0,0 +1,29 @@ +package com.icomsys.main_vm.common.code.enumresource; + +import lombok.Getter; + +@Getter +public enum URLResource { + + DEFAULT("", "default","기본"), + BOTADD("","address bot view page","주소봇" ), + test1("/test1","test1","test1"), + test2("/test2","test2","test2"), + test3("/test3","test3","test3"), + ; + + private String url; + private String urlName; + private String urlDesc; + + public String getName(){ + return name(); + } + + URLResource(String url, String urlName, String urlDesc) { + this.url = url; + this.urlName = urlName; + this.urlDesc = urlDesc; + } + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/common/config/AWSConfig.java b/main_vm/src/main/java/com/icomsys/main_vm/common/config/AWSConfig.java new file mode 100644 index 0000000..c27e087 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/common/config/AWSConfig.java @@ -0,0 +1,41 @@ +/* +package com.icomsys.main_vm.common.config; + +import com.amazonaws.auth.AWSCredentials; +import com.amazonaws.services.s3.AmazonS3; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import com.amazonaws.auth.AWSStaticCredentialsProvider; +import com.amazonaws.auth.BasicAWSCredentials; +import com.amazonaws.services.s3.AmazonS3Client; +import com.amazonaws.services.s3.AmazonS3ClientBuilder; +import software.amazon.awssdk.auth.credentials.InstanceProfileCredentialsProvider; +import software.amazon.awssdk.regions.Region; +import software.amazon.awssdk.services.s3.S3Client; + +@Configuration +public class AWSConfig { + + */ +/** + * Key는 중요정보이기 때문에 properties 파일에 저장한 뒤 가져와 사용하는 방법이 좋습니다. + *//* + + @Value("${cloud.aws.credentials.accessKey}") + private String accessKey; + + @Value("${cloud.aws.credentials.secretKey}") + private String secretKey; + private String region = "s3-dev-aisb-soe"; // Bucket Region + + @Bean + public AmazonS3 amazonS3() { + AWSCredentials awsCredentials = new BasicAWSCredentials(accessKey, secretKey); + return AmazonS3ClientBuilder.standard() + .withRegion(region) + .withCredentials(new AWSStaticCredentialsProvider(awsCredentials)) + .build(); + } +} +*/ diff --git a/main_vm/src/main/java/com/icomsys/main_vm/common/config/ConfigDatasource.java b/main_vm/src/main/java/com/icomsys/main_vm/common/config/ConfigDatasource.java new file mode 100644 index 0000000..715d93a --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/common/config/ConfigDatasource.java @@ -0,0 +1,203 @@ +package com.icomsys.main_vm.common.config; + +import com.querydsl.sql.MySQLTemplates; +import com.querydsl.sql.OracleTemplates; +import com.querydsl.sql.SQLQueryFactory; +import com.querydsl.sql.SQLTemplates; +import com.querydsl.sql.spring.SpringExceptionTranslator; +import lombok.extern.slf4j.Slf4j; +import org.apache.ibatis.session.SqlSessionFactory; +import org.mybatis.spring.SqlSessionFactoryBean; +import org.mybatis.spring.SqlSessionTemplate; +import org.mybatis.spring.annotation.MapperScan; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.jdbc.DataSourceBuilder; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Primary; +import org.springframework.core.io.support.PathMatchingResourcePatternResolver; +import org.springframework.data.jpa.repository.config.EnableJpaRepositories; +import org.springframework.jdbc.datasource.DriverManagerDataSource; +import org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy; +import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource; +import org.springframework.orm.jpa.JpaTransactionManager; +import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; +import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter; +import org.springframework.transaction.PlatformTransactionManager; +import org.springframework.transaction.annotation.EnableTransactionManagement; + +import javax.annotation.PostConstruct; +import javax.persistence.EntityManagerFactory; +import javax.sql.DataSource; +import java.util.Map; +import java.util.Properties; +import java.util.concurrent.ConcurrentHashMap; + +@Configuration +@MapperScan(basePackages = "com.icomsys.main_vm.db.mybatis.mapper") +@EnableTransactionManagement +@EnableJpaRepositories("com.icomsys.main_vm.db.jpa.repo") +@Slf4j +public class ConfigDatasource { + + + @Value("${spring.datasource.url}") + private String url; + @Value("${spring.datasource.username}") + private String userName; + @Value("${spring.datasource.password}") + private String passVal; + private String tags = "#"; + @Value("${spring.jpa.properties.hibernate.dialect}") + private String dialect; + @Value("${spring.jpa.show_sql}") + private boolean showSql; + @Value("${spring.jpa.format_sql}") + private boolean formatSql; + @Value("${spring.jpa.hibernate.ddl-auto}") + private String hbm2ddlAuto; + @Value("${spring.datasource.driver-class-name}") + private String driverClassName; + private String validationQuery = "SELECT 1"; + + private final Map dataSourceMap = new ConcurrentHashMap<>(); + private AbstractRoutingDataSource multiDataSource; + + @Value("${spring.datasource.owner}") + private String ownerAndSchema; + @Value("${spring.config.activate.on-profile}") + private String profile; + + private DataSource profileDataSource() { + String password = passVal; + return DataSourceBuilder.create() + .driverClassName(driverClassName) + .url(url) + .username(userName) + .password(password) + .build(); + } + + @Bean + public DataSource dataSource() { + multiDataSource = new AbstractRoutingDataSource() { + @Override + protected Object determineCurrentLookupKey() { + return profile; + } + }; + multiDataSource.setDefaultTargetDataSource(defaultDataSource()); + multiDataSource.setTargetDataSources(dataSourceMap); + multiDataSource.afterPropertiesSet(); + return multiDataSource; + } + +// @Bean +// @Primary +// public DataSource lazyDataSource() { +// return new LazyConnectionDataSourceProxy(dataSource()); +// } + + + @PostConstruct + private void setDataSourceMap() { + log.info("passval - {}", passVal); + String password = passVal; + dataSourceMap.put(profile, DataSourceBuilder.create() + .driverClassName(driverClassName) + .url(url) + .username(userName) + .password(password) + .build()); + } + + private DriverManagerDataSource defaultDataSource() { + String password = passVal; + DriverManagerDataSource defaultDataSource = new DriverManagerDataSource(); + defaultDataSource.setDriverClassName(driverClassName); + defaultDataSource.setUrl(url); + defaultDataSource.setUsername(userName); + defaultDataSource.setPassword(password); + return defaultDataSource; + } + + @Bean + public PlatformTransactionManager transactionManager() throws InterruptedException { + JpaTransactionManager transactionManager = new JpaTransactionManager(); + transactionManager.setEntityManagerFactory(this.entityManagerFactory()); + return transactionManager; + } + + @Bean + public Properties hibernateProperties() throws InterruptedException { + // println형태의 콘솔출력을 사용할때 + Properties properties = new Properties(); + properties.put("hibernate.dialect", dialect); + properties.put("hibernate.show_sql", showSql); + properties.put("hibernate.format_sql", formatSql); + properties.put("hibernate.hbm2ddl.auto", hbm2ddlAuto); + properties.put("useSSL", false); + + log.info("default schema - "); + //오라클create ddl용 + if (profile.equals("create")) { + log.info("default schema - setting"); + properties.put("hibernate.default_schema", ownerAndSchema); + } + return properties; + } + + @Bean + public EntityManagerFactory entityManagerFactory() throws InterruptedException { + final LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean(); + em.setDataSource(dataSource()); + em.setPackagesToScan("com.icomsys.main_vm.db.jpa.entity"); + final HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter(); +// vendorAdapter.setShowSql(true); +// vendorAdapter.setGenerateDdl(true); + em.setJpaVendorAdapter(vendorAdapter); + em.setJpaProperties(hibernateProperties()); + em.afterPropertiesSet(); + return em.getObject(); + } + + @Bean + public com.querydsl.sql.Configuration querydslConfiguration() { +// SQLTemplates templates = PostgreSQLTemplates.builder() + SQLTemplates templates = MySQLTemplates.builder() +// SQLTemplates templates = OracleTemplates.builder() + .printSchema() + .quote() + .newLineToSingleSpace() + .build(); //change to your Templates + com.querydsl.sql.Configuration configuration = new com.querydsl.sql.Configuration(templates); + SpringExceptionTranslator springExceptionTranslator = new SpringExceptionTranslator(); + configuration.setExceptionTranslator(springExceptionTranslator); + return configuration; + } + + @Bean + public SQLQueryFactory SQLQueryFactory() { + SQLQueryFactory sqlQueryFactory = new SQLQueryFactory(querydslConfiguration(), + dataSource() + ); + return sqlQueryFactory; + } + + @Bean + public SqlSessionFactory sqlSession() throws Exception { + PathMatchingResourcePatternResolver pmrpr = new PathMatchingResourcePatternResolver(); + SqlSessionFactoryBean sqlSessionFactoryBean = new SqlSessionFactoryBean(); + sqlSessionFactoryBean.setDataSource(dataSource()); + sqlSessionFactoryBean.setMapperLocations(pmrpr.getResources("classpath:/mapper/**/*.xml")); + sqlSessionFactoryBean.setTypeAliasesPackage("com.icomsys.main_vm.db.mybatis.alias"); + return sqlSessionFactoryBean.getObject(); + } + + @Bean + public SqlSessionTemplate sqlSessionTemplate() throws Exception { + SqlSessionTemplate sst = new SqlSessionTemplate(sqlSession()); + return sst; + } + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/common/config/ConfigFeign.java b/main_vm/src/main/java/com/icomsys/main_vm/common/config/ConfigFeign.java new file mode 100644 index 0000000..38e4c7c --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/common/config/ConfigFeign.java @@ -0,0 +1,41 @@ +package com.icomsys.main_vm.common.config; + +import feign.Logger; +import feign.RequestInterceptor; +import feign.Retryer; +import feign.codec.ErrorDecoder; +import lombok.extern.slf4j.Slf4j; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +@Configuration +@Slf4j +public class ConfigFeign { + + @Bean + public Logger.Level FeignLevel() { + return Logger.Level.FULL; + } + + @Bean + public RequestInterceptor requestInterceptor() { + return requestTemplate -> { + requestTemplate.header("Content-Type", "application/json"); + requestTemplate.header("accept", "application/json"); + }; + } + + //커스터마이징 필요 + @Bean + public ErrorDecoder errorDecoder() { + return new CustomErrorDecoder(); + } + + //요청 실패시 재시도를 한다. 1초간격 5번 + @Bean + public Retryer retryer() { + return new Retryer.Default(); + } + + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/common/config/ConfigLogging.java b/main_vm/src/main/java/com/icomsys/main_vm/common/config/ConfigLogging.java new file mode 100644 index 0000000..b6287d1 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/common/config/ConfigLogging.java @@ -0,0 +1,307 @@ +package com.icomsys.main_vm.common.config; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.google.common.base.Splitter; +import com.icomsys.main_vm.common.code.code.ServiceStatusType; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.exception.ExceptionUtils; +import org.aspectj.lang.JoinPoint; +import org.aspectj.lang.ProceedingJoinPoint; +import org.aspectj.lang.annotation.Around; +import org.aspectj.lang.annotation.Aspect; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Component; +import org.springframework.util.StopWatch; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; +import org.springframework.web.util.ContentCachingRequestWrapper; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.Arrays; +import java.util.Date; + +/** + * @Name ServiceAspect + * @Description 서비스 공통 Logging AOP + * @Author sungbumoh + * @CreateDate 2020. 8. 13. + */ +@Aspect +@Component +@Slf4j +@RequiredArgsConstructor +public class ConfigLogging { + private final HttpServletRequest request; + private final HttpServletResponse rsesponse; + public static final String SERVICE_TIMER_TASK_NAME = "SERVICE_TIMER"; + public static final int SERVICE_LOGPRINT_MAXLINES = 10; + public static final int SERVICE_LOGPRINT_MAXLENGTH = 150; + +// @Around("execution(* com.icomsys.main_vm.biz..*Controller.*(..))") + public Object loggingWsTest(ProceedingJoinPoint joinPoint) throws Throwable { + final StopWatch sw = new StopWatch(); + sw.start(); + Object result = joinPoint.proceed(); + + log.info("=========== logTest"); + log.info("method - {}", joinPoint.getSignature().getName()); + log.info("getKind - {}", joinPoint.getKind()); + log.info("getTarget - {}", joinPoint.getTarget()); + log.info("toLongString - {}", joinPoint.toLongString()); + log.info("toShortString - {}", joinPoint.toShortString()); + log.info("getSignature - {}", joinPoint.getSignature()); + log.info("getThis - {}", joinPoint.getThis()); + log.info("getStaticPart - {}", joinPoint.getStaticPart()); + log.info("getSourceLocation - {}", joinPoint.getSourceLocation()); + + + sw.stop(); + + log.info("time - {}", sw.getTotalTimeMillis()); + + return result; + } + + + /** + * @param joinPoint + * @return + * @throws Throwable + * @Name processServiceLogging + * @Description 서비스 요청 처리 시 요청 및 처리정보 출력 + * @Author sungbumoh + * @CreateDate 2020. 8. 13. + * @ChangeDescription + */ + @SuppressWarnings("unchecked") + @Around("execution(* com.icomsys.main_vm.biz..*Controller.*(..))") + public Object loggingServiceRequest(ProceedingJoinPoint joinPoint) throws Throwable { + // stop watch 설정 + + StopWatch stopWatch = new StopWatch(); + // 시간체크 시작 지점 + stopWatch.start(SERVICE_TIMER_TASK_NAME); + Date inPointTime = new Date(); + // 서비스 상태 유형 (CLEAN ~ CRITICAL) + ServiceStatusType serviceStatus; + // 응답 상태코드 + HttpStatus responseStatus = null; + // JSON 문자열 처리 OM + ObjectMapper objectMapper = new ObjectMapper(); + // Request Parameter(body) 정보 + Object requestBody = ""; + // Response Parameter(body) 정보 + String responseBody = ""; + String contentType = request.getContentType(); + + int contentLength = request.getContentLength(); + + /* + if (contentType !=null && contentType.startsWith("multipart/form-data")) { + requestBody = "Multipart"; + } + if (contentType !=null && contentType.startsWith("application/json") ) { + ContentCachingRequestWrapper wrappingRequest = (ContentCachingRequestWrapper) ((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes()).getRequest(); + requestBody = objectMapper.readTree(wrappingRequest.getContentAsByteArray()); + } + */ + + // Target 엔드포인트 실행 + Object result = joinPoint.proceed(); + + // 결과 타입이 정상적으로 ResponseEntity 일 경우 + if (result instanceof ResponseEntity) { + ResponseEntity responseEntity = (ResponseEntity) result; + // 응답 상태코드 설정 + responseStatus = responseEntity.getStatusCode(); + // 응답 데이터 (to json string) +// if (responseEntity.getBody() != null) +// responseBody = objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(responseEntity.getBody()); + } + // 시간체크 종료 지점 + stopWatch.stop(); + Date outPointTime = new Date(); + + // 실행 시간 (inPointTime ~ outPointTime) + double resultTime = stopWatch.getTotalTimeSeconds(); + + // 실행 시간 별 서비스 상태 설정 (시간 수정은 ServiceStatusType enum type 수정) + if (resultTime <= ServiceStatusType.CLEAN.getServiceTime()) { + serviceStatus = ServiceStatusType.CLEAN; + } else if (resultTime <= ServiceStatusType.WARNING.getServiceTime()) { + serviceStatus = ServiceStatusType.WARNING; + } else if (resultTime <= ServiceStatusType.BAD.getServiceTime()) { + serviceStatus = ServiceStatusType.BAD; + } else { + serviceStatus = ServiceStatusType.CRITICAL; + } + // 요청 URL + String servletPath = request.getServletPath(); + // 요청 METHOD (GET/POST/PUT/DELETE) + String headerMethod = request.getMethod().toUpperCase(); + String queryString = request.getQueryString(); + if (servletPath.equals("/adm/main/actionSecurityLogin.do") || servletPath.equals("/adm/main/actionMain.do")) { + queryString = ""; + } + + // 요청 Host + String remoteHost = request.getRemoteHost(); + // 실행 Class, Method 정보 + String excuteClass = joinPoint.getTarget().getClass().getName(); + String excuteMethod = joinPoint.getSignature().getName(); + + // 요청 IP + String remoteIp = this.getIpFromRequest(request); + // Console logging 처리 + log.info(" "); + log.info("+============================================================================================"); + log.info("|------------------------------- ICOMSYS API LOGGING PRINT IN -------------------------------"); + log.info("| "); + log.info("| +-REQUEST INFO-+"); + log.info("| {} {}", headerMethod, servletPath); +// log.info("| query string: {}", queryString); +// log.info("| Body string: {}", requestBody); + log.info("| "); + log.info("| +-REMOTE INFO-+"); + log.info("| remote host: {}", remoteHost); + log.info("| remote addr: {}", remoteIp); + log.info("| "); + log.info("| +-PROCESS INFO-+"); + log.info("| service class name: {}\t", excuteClass); + log.info("| service method name: {}\t", excuteMethod); + log.info("| service in time: {}\t", inPointTime); + log.info("| service out time: {}\t", outPointTime); + log.info("| service excute time: {}\t", resultTime + "s"); + log.info("| service pass status [ {} ]", serviceStatus.getValue()); + if (responseStatus != null) { + log.info("| http status [ {} ]", responseStatus); + } +// log.info("| "); +// log.info("| +-DATA INFO-+"); +// log.info("| request data:"); +// if (!StringUtils.isEmpty(requestBody)) { +// Arrays.asList(requestBody.lines().toArray(String[]::new)).stream().forEach(line -> { +// log.info("| {}", line); +// }); +// } +// log.info("| response data:"); +// if (!StringUtils.isEmpty(responseBody)) { +// Arrays.asList(responseBody.lines().toArray(String[]::new)).stream().forEach(line -> { +// log.info("| {}", line); +// }); +// } + log.info("| "); + log.info("|------------------------------- ICOMSYS API LOGGING PRINT OUT ------------------------------"); + log.info("+============================================================================================"); + log.info(" "); + + return result; + } + + /** + * @param joinPoint + * @param exception + * @Name processExceptionLogging + * @Description 에러 발생 시 에러정보 출력 + * (예외처리 되지않은 Runtime Exception의 경우는 이곳을 타지 않음..) + * @Author sungbumoh + * @CreateDate 2020. 8. 13. + * @ChangeDescription + */ +// @AfterThrowing(pointcut = "execution(* com.icomsys.samsunglife.biz..*Controller.*(..))", throwing = "exception") + public void loggingServiceException(JoinPoint joinPoint, Throwable exception) { +// ContentCachingRequestWrapper request = (ContentCachingRequestWrapper) httpServletRequest; +// ContentCachingResponseWrapper response = (ContentCachingResponseWrapper) httpServletResponse; + + // 요청 Host + String remoteHost = request.getRemoteHost(); + // 요청 IP + String remoteIp = this.getIpFromRequest(request); + + // 요청 URL + String servletPath = request.getServletPath(); + // 요청 METHOD (GET/POST/PUT/DELETE) + String headerMethod = request.getMethod().toUpperCase(); + + // 실행 Class, Method 정보 + String excuteClass = joinPoint.getTarget().getClass().getName(); + String excuteMethod = joinPoint.getSignature().getName(); + + log.error(" "); + log.error("+============================================================================================"); + log.error("|------------------------------- ICOMSYS ERROR LOGGING PRINT IN -----------------------------"); + log.error("| "); + log.error("| +-LOGGING SERVLET-+"); + log.error("| {} {}", headerMethod, servletPath); + log.error("| query string: {}", request.getQueryString()); + log.error("| "); + log.error("| +-REMOTE INFO-+"); + log.error("| remote host: {}", remoteHost); + log.error("| remote addr: {}", remoteIp); + log.error("| "); + log.error("| service class name: {}\t", excuteClass); + log.error("| service method name: {}\t", excuteMethod); + log.error("| "); + log.error("| +-ERROR INFO-+"); + if (exception.getCause() != null) { + // Root Exception 출력 + log.error("| error type: {}", exception.getCause().getClass().getSimpleName()); + // Exception 상세 (최대 라인까지만 출력) + log.error("| error detail: "); + int[] exceptionPrintIndex = {0}; + Arrays.asList(ExceptionUtils.getStackFrames(exception)).stream().anyMatch(printLine -> { + printLine = printLine.trim(); + exceptionPrintIndex[0]++; + if (printLine.length() > SERVICE_LOGPRINT_MAXLENGTH) { + Splitter.fixedLength(SERVICE_LOGPRINT_MAXLENGTH).splitToList(printLine).stream().forEach(fixedPrintLine -> { + log.error("| " + fixedPrintLine); + }); + } else { + log.error("| " + printLine); + } + // 최대 라인까지만 출력 + return exceptionPrintIndex[0] > SERVICE_LOGPRINT_MAXLINES; + }); + } else { + log.error("| unknown exception cause info"); + } + log.error("| "); + log.error("|------------------------------ ICOMSYS ERROR LOGGING PRINT OUT -----------------------------"); + log.error("+============================================================================================"); + log.error(" "); + } + + /** + * @param request + * @return + * @Name getIpFormRequest + * @Description 요청 정보에서 IP 추출 + * @Author sungbumoh + * @CreateDate 2020. 8. 14. + * @ChangeDescription + */ + private String getIpFromRequest(HttpServletRequest request) { + String ip = request.getHeader("X-Forwarded-For"); + if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { + ip = request.getHeader("Proxy-Client-IP"); + } + if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { + ip = request.getHeader("WL-Proxy-Client-IP"); + } + if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { + ip = request.getHeader("HTTP_CLIENT_IP"); + } + if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { + ip = request.getHeader("HTTP_X_FORWARDED_FOR"); + } + if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { + ip = request.getRemoteAddr(); + } + return ip; + } + + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/common/config/ConfigMessage.java b/main_vm/src/main/java/com/icomsys/main_vm/common/config/ConfigMessage.java new file mode 100644 index 0000000..291737b --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/common/config/ConfigMessage.java @@ -0,0 +1,34 @@ +package com.icomsys.main_vm.common.config; + +import org.springframework.context.MessageSource; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.support.ReloadableResourceBundleMessageSource; +import org.springframework.validation.Validator; +import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; + +import java.util.Locale; + +@Configuration +public class ConfigMessage implements WebMvcConfigurer { + + + @Bean + public MessageSource messageSource(){ + ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource(); + messageSource.setBasenames("classpath:/message/messages","classpath:/message/validation"); + messageSource.setDefaultEncoding("UTF-8"); + messageSource.setCacheSeconds(10); + messageSource.setDefaultLocale(Locale.getDefault()); + return messageSource; + } + + @Override + public Validator getValidator() { + LocalValidatorFactoryBean lvfb = new LocalValidatorFactoryBean(); + lvfb.setValidationMessageSource(messageSource()); + return lvfb; + } + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/common/config/ConfigModelMapper.java b/main_vm/src/main/java/com/icomsys/main_vm/common/config/ConfigModelMapper.java new file mode 100644 index 0000000..acd15aa --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/common/config/ConfigModelMapper.java @@ -0,0 +1,38 @@ +package com.icomsys.main_vm.common.config; + +import org.modelmapper.ModelMapper; +import org.modelmapper.convention.MatchingStrategies; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +@Configuration +public class ConfigModelMapper { + + + @Bean + public ModelMapper strictMapper() { + ModelMapper modelMapper = new ModelMapper(); + modelMapper.getConfiguration() + .setMatchingStrategy(MatchingStrategies.STRICT); + return modelMapper; + } + /* + @Bean + public ModelMapper StandardMapper() { + ModelMapper modelMapper = new ModelMapper(); + modelMapper.getConfiguration() + .setMatchingStrategy(MatchingStrategies.STANDARD); + return modelMapper; + } + */ + /* + @Bean + public ModelMapper LooseMapper() { + ModelMapper modelMapper = new ModelMapper(); + modelMapper.getConfiguration() + .setMatchingStrategy(MatchingStrategies.LOOSE); + return modelMapper; + } + */ +} + diff --git a/main_vm/src/main/java/com/icomsys/main_vm/common/config/ConfigMvc.java b/main_vm/src/main/java/com/icomsys/main_vm/common/config/ConfigMvc.java new file mode 100644 index 0000000..0201a2c --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/common/config/ConfigMvc.java @@ -0,0 +1,127 @@ +package com.icomsys.main_vm.common.config; + +import lombok.extern.slf4j.Slf4j; +import org.apache.http.impl.client.HttpClientBuilder; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; +import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport; +import org.springframework.web.servlet.i18n.LocaleChangeInterceptor; +import org.springframework.web.servlet.i18n.SessionLocaleResolver; +import org.springframework.web.servlet.view.JstlView; +import org.springframework.web.servlet.view.UrlBasedViewResolver; +import org.springframework.web.servlet.view.json.MappingJackson2JsonView; +import org.springframework.web.client.RestTemplate; +import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; +import org.apache.http.client.HttpClient; + + + +@Configuration +@Slf4j +public class ConfigMvc extends WebMvcConfigurationSupport { + + @Value("${file.path}") + private String filePath; +// @Value("${Server.servlet.context-path}") +// private String context; + + + + @Override + public void addResourceHandlers(ResourceHandlerRegistry registry) { + /* + Path path = Paths.get(filePath).toAbsolutePath().normalize(); + String patsString = path.toString(); + log.info("path = {}",path); + log.info("pathString = {}",patsString); + */ + registry.addResourceHandler("/**","/img/**") + .addResourceLocations("/"); +// .addResourceLocations("file:///"+patsString+"/"); + registry.addResourceHandler("/files/**").addResourceLocations("file:/logs/was/aicb/cinnamon_ui/files/"); + + } + + + @Override + public void addViewControllers(ViewControllerRegistry registry) { +// registry.addViewController("/**/*.do").setViewName("redirect:/adm/main/egovLoginUsr.do"); +// registry.addViewController("/").setViewName("redirect:/adm/main/egovLoginUsr.do"); +// registry.setOrder(Ordered.HIGHEST_PRECEDENCE); + } +// @Override +// public void addResourceHandlers(ResourceHandlerRegistry registry) { +// registry.addResourceHandler("/**").addResourceLocations("/"); +// } + + @Bean + public UrlBasedViewResolver urlBasedViewResolver() { + UrlBasedViewResolver urlBasedViewResolver = new UrlBasedViewResolver(); + urlBasedViewResolver.setOrder(1); + urlBasedViewResolver.setViewClass(JstlView.class); + urlBasedViewResolver.setPrefix("/WEB-INF/jsp/"); + urlBasedViewResolver.setSuffix(".jsp"); + return urlBasedViewResolver; + } + + @Bean + public SessionLocaleResolver localeResolver() { + return new SessionLocaleResolver(); + } + + @Bean + public LocaleChangeInterceptor localeChangeInterceptor() { + LocaleChangeInterceptor interceptor = new LocaleChangeInterceptor(); + interceptor.setParamName("language"); + return interceptor; + } + + @Bean + public MappingJackson2JsonView jsonView() { + MappingJackson2JsonView jackson2JsonView = new MappingJackson2JsonView(); +// jackson2JsonView.setContentType("\"text/html;charset=UTF-8\""); + return jackson2JsonView; + } + +// @Override +// public void configureHandlerExceptionResolvers(List exceptionResolvers) { +// Properties prop = new Properties(); +// prop.setProperty("org.springframework.dao.DataAccessException", "cmm/error/dataAccessFailure"); +// prop.setProperty("org.springframework.transaction.TransactionException", "cmm/error/transactionFailure"); +// prop.setProperty("org.springframework.security.AccessDeniedException", "cmm/error/accessDenied"); +// prop.setProperty("java.lang.Throwable", "cmm/error/egovBizException"); +// prop.setProperty("java.lang.NoSuchFieldException", "cmm/error/egovError"); +// prop.setProperty("javax.el.PropertyNotFoundException", "cmm/error/egovError"); +// prop.setProperty("org.springframework.web.servlet.PageNotFound", "cmm/error/egovError"); +// +// Properties statusCode = new Properties(); +// statusCode.setProperty("cmm/error/egovBizException", "400"); +// statusCode.setProperty("cmm/error/accessDenied", "401"); +// statusCode.setProperty("cmm/error/accessDenied", "403"); +// statusCode.setProperty("cmm/error/egovError", "404"); +// statusCode.setProperty("cmm/error/egovBizException", "500"); +// SimpleMappingExceptionResolver smer = new SimpleMappingExceptionResolver(); +// smer.setDefaultErrorView("cmm/error/egovError"); +// smer.setExceptionMappings(prop); +// smer.setStatusCodes(statusCode); +// exceptionResolvers.add(smer); +// } + + + + @Bean + public RestTemplate restTemplate() { + HttpComponentsClientHttpRequestFactory factory = new HttpComponentsClientHttpRequestFactory(); + HttpClient client = HttpClientBuilder.create() + .setMaxConnTotal(50) + .setMaxConnPerRoute(20).build(); + factory.setHttpClient(client); + factory.setConnectTimeout(10000); + factory.setReadTimeout(5000); + return new RestTemplate(factory); + } + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/common/config/ConfigSecurity.java b/main_vm/src/main/java/com/icomsys/main_vm/common/config/ConfigSecurity.java new file mode 100644 index 0000000..0d980e5 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/common/config/ConfigSecurity.java @@ -0,0 +1,104 @@ +package com.icomsys.main_vm.common.config; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.icomsys.main_vm.biz.common.login.service.CustomUserDetailsService; +import com.icomsys.main_vm.common.filter.LoginFilter; +import lombok.RequiredArgsConstructor; +import org.springframework.context.annotation.Bean; +import org.springframework.security.authentication.AuthenticationManager; +import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; +import org.springframework.security.config.annotation.authentication.configuration.AuthenticationConfiguration; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; +import org.springframework.security.config.annotation.web.configuration.WebSecurityCustomizer; +import org.springframework.security.config.http.SessionCreationPolicy; +import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; +import org.springframework.security.crypto.password.PasswordEncoder; +import org.springframework.security.web.SecurityFilterChain; +import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; + +@EnableWebSecurity +@RequiredArgsConstructor +public class ConfigSecurity { + //WebSecurityConfigurerAdapter 디프리케이트 후 + //참조소스 + //https://stackoverflow.com/questions/72381114/spring-security-upgrading-the-deprecated-websecurityconfigureradapter-in-spring + private final ObjectMapper objectMapper; + private final CustomUserDetailsService customUserDetailsService; + private final LoginFilter loginFilter; + @Bean + public PasswordEncoder passwordEncoder() { + return new BCryptPasswordEncoder(); + } + + @Bean + public WebSecurityCustomizer configure() { + return (web) -> web.ignoring().mvcMatchers( +// "/v3/api-docs/**", // doc용 +// "/swagger-ui/**", //스웨거 + "/ws/**", // 테스트API, + "/login", + "/logout" + ); + } + +// @Bean +// public AuthTokenFilter authenticationJwtTokenFilter() { +// return new AuthTokenFilter(); +// } + + @Bean + public AuthenticationManager authenticationManager(AuthenticationConfiguration authenticationConfiguration) throws Exception { + return authenticationConfiguration.getAuthenticationManager(); + } + + public void configure(AuthenticationManagerBuilder authenticationManagerBuilder) throws Exception { + authenticationManagerBuilder.userDetailsService(customUserDetailsService).passwordEncoder(passwordEncoder()); + } + + @Bean + public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { + return http.antMatcher("/**") + .authorizeRequests() + .and() + .csrf().disable() + .cors().disable() + .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS) + .and() + .authorizeRequests() + .anyRequest().permitAll() + .and() +// .exceptionHandling() +// .authenticationEntryPoint(((request, response, authException) -> { +// response.setStatus(HttpStatus.UNAUTHORIZED.value()); +// response.setContentType(MediaType.APPLICATION_JSON_VALUE); +// objectMapper.writeValue( +// response.getOutputStream(), +// ExceptionResponse.of(ExceptionCode.FAIL_AUTHENTICATION) +// ); +// })) +// .accessDeniedHandler(((request, response, accessDeniedException) -> { +// response.setStatus(HttpStatus.FORBIDDEN.value()); +// response.setContentType(MediaType.APPLICATION_JSON_VALUE); +// objectMapper.writeValue( +// response.getOutputStream(), +// ExceptionResponse.of(ExceptionCode.FAIL_AUTHORIZATION) +// ); +// })) + .addFilterBefore(loginFilter, UsernamePasswordAuthenticationFilter.class) + .build(); + } +// @Bean +// public WebMvcConfigurer corsConfigurer() { +// return new WebMvcConfigurer() { +// @Override +// public void addCorsMappings(CorsRegistry registry) { +// registry.addMapping("/**") +// .allowedMethods("*"); +// } +// }; +// } + + + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/common/config/ConfigSqlQuery.java b/main_vm/src/main/java/com/icomsys/main_vm/common/config/ConfigSqlQuery.java new file mode 100644 index 0000000..a1ef2c1 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/common/config/ConfigSqlQuery.java @@ -0,0 +1,44 @@ +package com.icomsys.main_vm.common.config; + +import com.querydsl.jpa.impl.JPAQueryFactory; +import com.querydsl.jpa.sql.JPASQLQuery; +import com.querydsl.sql.MySQLTemplates; +import com.querydsl.sql.OracleTemplates; +import com.querydsl.sql.SQLTemplates; +import com.querydsl.sql.spring.SpringExceptionTranslator; +import lombok.RequiredArgsConstructor; +import org.hibernate.dialect.MySQL57Dialect; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import javax.persistence.EntityManager; +import javax.persistence.PersistenceContext; + +@Configuration +@RequiredArgsConstructor +public class ConfigSqlQuery { + + @PersistenceContext + private EntityManager entityManager; + + @Bean + public JPAQueryFactory jpaQueryFactory() { + return new JPAQueryFactory(entityManager); + } + + @Bean + public JPASQLQuery jpasqlQuery(){ +// SQLTemplates templates = PostgreSQLTemplates.builder() + SQLTemplates templates = MySQLTemplates.builder() +// SQLTemplates templates = OracleTemplates.builder() + .printSchema() + .quote() + .newLineToSingleSpace() + .build(); //change to your Templates + com.querydsl.sql.Configuration configuration = new com.querydsl.sql.Configuration(templates); + SpringExceptionTranslator springExceptionTranslator = new SpringExceptionTranslator(); + configuration.setExceptionTranslator(springExceptionTranslator); + return new JPASQLQuery(entityManager,configuration); + } + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/common/config/ConfigWebsocket.java b/main_vm/src/main/java/com/icomsys/main_vm/common/config/ConfigWebsocket.java new file mode 100644 index 0000000..066e57b --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/common/config/ConfigWebsocket.java @@ -0,0 +1,35 @@ +package com.icomsys.main_vm.common.config; + +import org.springframework.context.annotation.Configuration; +import org.springframework.messaging.simp.config.MessageBrokerRegistry; +import org.springframework.web.socket.config.annotation.EnableWebSocketMessageBroker; +import org.springframework.web.socket.config.annotation.StompEndpointRegistry; +import org.springframework.web.socket.config.annotation.WebSocketMessageBrokerConfigurer; + +@Configuration +@EnableWebSocketMessageBroker +public class ConfigWebsocket implements WebSocketMessageBrokerConfigurer { + + + @Override + public void configureMessageBroker(MessageBrokerRegistry registry) { +// registry.enableSimpleBroker("/user", "/topic", "/queue"); + registry.enableSimpleBroker("/subscribe"); + registry.setApplicationDestinationPrefixes("/send"); + } + + @Override + public void registerStompEndpoints(StompEndpointRegistry registry) { + registry.addEndpoint("/ws") +// .setAllowedOrigins("*") + .setAllowedOriginPatterns("*") + .withSockJS() +// .setClientLibraryUrl("https://cdn.jsdelivr.net/npm/sockjs-client@1/dist/sockjs.min.js") + ; + + // registry.addEndpoint("/notification").setAllowedOriginPatterns("*") +// .setHandshakeHandler(new CustomHandshakeHandler()).withSockJS(); + } + + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/common/config/CustomErrorDecoder.java b/main_vm/src/main/java/com/icomsys/main_vm/common/config/CustomErrorDecoder.java new file mode 100644 index 0000000..25a7313 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/common/config/CustomErrorDecoder.java @@ -0,0 +1,36 @@ +package com.icomsys.main_vm.common.config; + +import com.icomsys.main_vm.biz.advice.excep.CustomBadRequestException; +import com.icomsys.main_vm.biz.advice.excep.CustomNotFoundException; +import feign.Response; +import feign.codec.ErrorDecoder; +import lombok.extern.slf4j.Slf4j; +import org.springframework.http.HttpStatus; +import org.springframework.web.server.ResponseStatusException; + +import javax.naming.AuthenticationException; + +@Slf4j +public class CustomErrorDecoder implements ErrorDecoder { + @Override + public Exception decode(String methodKey, Response response) { + log.info("{} status : {}, body : {}", methodKey, response.status(), response.body()); + switch (response.status()) { + case 400: + return new CustomBadRequestException(); + case 401: + return new AuthenticationException(); + case 403: + return new CustomNotFoundException(); + case 404: + return new ResponseStatusException(HttpStatus.valueOf(response.status()), "User's orders is empty."); + case 405: + return new ResponseStatusException(HttpStatus.valueOf(response.status()), "User's orders is empty."); + default: + return new Exception("Generic error"); + } + + } + + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/common/filter/HibernateInterceptor.java b/main_vm/src/main/java/com/icomsys/main_vm/common/filter/HibernateInterceptor.java new file mode 100644 index 0000000..1024002 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/common/filter/HibernateInterceptor.java @@ -0,0 +1,31 @@ +package com.icomsys.main_vm.common.filter; + +import lombok.extern.slf4j.Slf4j; +import org.hibernate.EmptyInterceptor; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Configuration; + +@Configuration +@Slf4j +public class HibernateInterceptor extends EmptyInterceptor { + + @Value("${spring.datasource.owner}") + private String ownerAndSchema; + @Value("${spring.config.activate.on-profile}") + private String profile; + @Override + public String onPrepareStatement(String sql) { + log.info("profile = {}", profile); + log.info("sql = {}", sql); +// if(profile.equals("create")){ +// sql = sql.replaceAll("#ownerAndSchema#", ownerAndSchema); +// } +// else{ +// sql = sql.replaceAll("#ownerAndSchema#.", ""); +// } + return super.onPrepareStatement(sql); +// return sql; + } + + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/common/filter/LoginFilter.java b/main_vm/src/main/java/com/icomsys/main_vm/common/filter/LoginFilter.java new file mode 100644 index 0000000..229d662 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/common/filter/LoginFilter.java @@ -0,0 +1,109 @@ +package com.icomsys.main_vm.common.filter; + +import com.fasterxml.jackson.databind.ObjectMapper; +//import com.icomsys.main_vm.db.jpa.repo.bot.TbBotAuthMenuRepo; +//import com.icomsys.main_vm.db.jpa.repo.bot.TbBotMenuRepo; +import com.google.gson.Gson; +import com.icomsys.main_vm.common.code.enumresource.SessionResource; +import com.icomsys.main_vm.db.mybatis.alias.LoginVO; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.filter.OncePerRequestFilter; +import org.springframework.web.util.ContentCachingRequestWrapper; +import org.springframework.web.util.ContentCachingResponseWrapper; + +import javax.servlet.FilterChain; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.time.LocalDateTime; + +@Configuration +@Slf4j +@RequiredArgsConstructor +public class LoginFilter extends OncePerRequestFilter { + + private final ObjectMapper objectMapper; +// private final TbBotAuthMenuRepo tbBotAuthMenuRepo; +// private final TbBotMenuRepo tbBotMenuRepo; +// @Value("${Server.servlet.context-path}") +// private String context; + + @Override + protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException { + int chk = 0; +// ContentCachingRequestWrapper wrapRequest = new ContentCachingRequestWrapper(request); // 커스텀으로 생성한 Wrapper +// ContentCachingResponseWrapper wrapResponse = new ContentCachingResponseWrapper(response); +// String reqUrl = request.getRequestURI().toString().replaceAll(context, ""); + String reqUrl = request.getRequestURI(); +// log.info("meyhod-"+ reqUrl+ request.getMethod()); +// log.info("필터 요청유알엘 - {}, {}", reqUrl); + + + if (reqUrl.startsWith("/re1")){ + response.sendError(490); + return; + } + + if (reqUrl.startsWith("/re2")){ + response.sendError(491); + return; + } + + if (reqUrl.startsWith("/lib") + || reqUrl.startsWith("/css") + || reqUrl.startsWith("/images") + || reqUrl.startsWith("/js") + || reqUrl.startsWith("/adm") + || reqUrl.startsWith("/ws") + || reqUrl.startsWith("/rest") + || reqUrl.startsWith("/create") + || reqUrl.startsWith("/data") + || reqUrl.startsWith("/createEnv") + || reqUrl.startsWith("/error") + || reqUrl.startsWith("/files") + || reqUrl.equals("/") + ) { + filterChain.doFilter(request, response); + } else { + if (request.getSession().getAttribute(SessionResource.UserVO.getName()) == null || request.getSession().getAttribute(SessionResource.UserVO.getName()).equals("")) { + log.info("session Check"); + response.sendError(490); + return; + } else { + log.info("Permission Check"); + //세션이 있으면 URL별 권한 확인. + //ajax로 호출되는 url은 auth메뉴에 리스트업이 안되있어서 검사를 어떻게할지 계획이 필요함. +// LoginVO loginVO = (LoginVO) request.getSession().getAttribute("LoginVO"); +// List auths = +// if(!tbBotMenuRepo.findByMenuNoInOrderByMenuNoAsc(tbBotAuthMenuRepo.findByAuthCode(loginVO.getAuthCode()) +// .stream().map(e -> e.getMenuNo()) +// .collect(Collectors.toList())) +// .stream() +// .map(f -> f.getUrlPath()) +// .collect(Collectors.toList()) +// .contains(reqUrl)){ +// wrapResponse.sendRedirect("adm/main/egovLoginUsr.do"); +// } +// log.info("auths - {}", new Gson().toJson(auths)); +// +// for (String e : auths) { +// if (e != null && !e.equals("") && !e.equals("null") && e.equals(reqUrl)) { +// chk+=1; +// break; +// } +// } +// if(chk == 0){ +// wrapResponse.setStatus(404); +// wrapResponse.sendRedirect("adm/main/egovLoginUsr.do"); +// } + filterChain.doFilter(request, response); + } + } +// response.copyBodyToResponse(); + } + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/common/util/ClientIp.java b/main_vm/src/main/java/com/icomsys/main_vm/common/util/ClientIp.java new file mode 100644 index 0000000..2a315f1 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/common/util/ClientIp.java @@ -0,0 +1,52 @@ +package com.icomsys.main_vm.common.util; + +import lombok.RequiredArgsConstructor; +import org.springframework.context.annotation.Configuration; + +import javax.servlet.http.HttpServletRequest; + +import org.springframework.stereotype.Component; +import org.springframework.util.StringUtils; + +import java.net.InetAddress; +import java.net.UnknownHostException; + + +@Component +@RequiredArgsConstructor +public class ClientIp { + private final String LOCALHOST_IPV4 = "127.0.0.1"; + private final String LOCALHOST_IPV6 = "0:0:0:0:0:0:0:1"; + private final HttpServletRequest request; + public String getClientIp() { + String ipAddress = request.getHeader("X-Forwarded-For"); + if (StringUtils.isEmpty(ipAddress) || "unknown".equalsIgnoreCase(ipAddress)) { + ipAddress = request.getHeader("Proxy-Client-IP"); + } + + if (StringUtils.isEmpty(ipAddress) || "unknown".equalsIgnoreCase(ipAddress)) { + ipAddress = request.getHeader("WL-Proxy-Client-IP"); + } + + if (StringUtils.isEmpty(ipAddress) || "unknown".equalsIgnoreCase(ipAddress)) { + ipAddress = request.getRemoteAddr(); + if (LOCALHOST_IPV4.equals(ipAddress) || LOCALHOST_IPV6.equals(ipAddress)) { + try { + InetAddress inetAddress = InetAddress.getLocalHost(); + ipAddress = inetAddress.getHostAddress(); + } catch (UnknownHostException e) { + e.printStackTrace(); + } + } + } + if (!StringUtils.isEmpty(ipAddress) + && ipAddress.length() > 15 + && ipAddress.indexOf(",") > 0) { + ipAddress = ipAddress.substring(0, ipAddress.indexOf(",")); + } + return ipAddress; + } + + + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/common/util/CustomDialect.java b/main_vm/src/main/java/com/icomsys/main_vm/common/util/CustomDialect.java new file mode 100644 index 0000000..2b1547f --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/common/util/CustomDialect.java @@ -0,0 +1,23 @@ +package com.icomsys.main_vm.common.util; + +import org.hibernate.dialect.MySQL57Dialect; +import org.hibernate.dialect.function.SQLFunctionTemplate; +import org.hibernate.dialect.function.StandardSQLFunction; +import org.hibernate.type.StandardBasicTypes; + +public class CustomDialect extends MySQL57Dialect { + + public CustomDialect(){ + + super(); +// registerFunction("match", +// new SQLFunctionTemplate(StandardBasicTypes.DOUBLE,"match(?1, ?2) against (?3 in boolean mode)")); + + registerFunction( + "GROUP_CONCAT", + new StandardSQLFunction("group_concat", StandardBasicTypes.STRING) + ); + } + + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/common/util/EgovFileScrty.java b/main_vm/src/main/java/com/icomsys/main_vm/common/util/EgovFileScrty.java new file mode 100644 index 0000000..5f9b547 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/common/util/EgovFileScrty.java @@ -0,0 +1,290 @@ +package com.icomsys.main_vm.common.util; +import org.apache.commons.codec.binary.Base64; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.*; +import java.security.MessageDigest; + +public class EgovFileScrty { + + private static final Logger LOGGER = LoggerFactory.getLogger(EgovFileScrty.class); + + // 파일구분자 + static final char FILE_SEPARATOR = File.separatorChar; + // 버퍼사이즈 + static final int BUFFER_SIZE = 1024; + + /** + * 파일을 암호화하는 기능 + * + * @param String source 암호화할 파일 + * @param String target 암호화된 파일 + * @return boolean result 암호화여부 True/False + * @exception Exception + */ + public static boolean encryptFile(String source, String target) throws Exception { + + // 암호화 여부 + boolean result = false; + + String sourceFile = source.replace('\\', FILE_SEPARATOR).replace('/', FILE_SEPARATOR); + String targetFile = target.replace('\\', FILE_SEPARATOR).replace('/', FILE_SEPARATOR); + File srcFile = new File(sourceFile); + + BufferedInputStream input = null; + BufferedOutputStream output = null; + + byte[] buffer = new byte[BUFFER_SIZE]; + + try { + if (srcFile.exists() && srcFile.isFile()) { + + input = new BufferedInputStream(new FileInputStream(srcFile)); + output = new BufferedOutputStream(new FileOutputStream(targetFile)); + + int length = 0; + while ((length = input.read(buffer)) >= 0) { + byte[] data = new byte[length]; + System.arraycopy(buffer, 0, data, 0, length); + output.write(encodeBinary(data).getBytes()); + output.write(System.getProperty("line.separator").getBytes()); + } + + result = true; + } + } finally { + if (input != null) { + try { + input.close(); + } catch (Exception ignore) { + LOGGER.debug("IGNORE: {}", ignore); + } + } + if (output != null) { + try { + output.close(); + } catch (Exception ignore) { + LOGGER.debug("IGNORE: {}", ignore); + } + } + } + return result; + } + + /** + * 파일을 복호화하는 기능 + * + * @param String source 복호화할 파일 + * @param String target 복호화된 파일 + * @return boolean result 복호화여부 True/False + * @exception Exception + */ + public static boolean decryptFile(String source, String target) throws Exception { + + // 복호화 여부 + boolean result = false; + + String sourceFile = source.replace('\\', FILE_SEPARATOR).replace('/', FILE_SEPARATOR); + String targetFile = target.replace('\\', FILE_SEPARATOR).replace('/', FILE_SEPARATOR); + File srcFile = new File(sourceFile); + + BufferedReader input = null; + BufferedOutputStream output = null; + + //byte[] buffer = new byte[BUFFER_SIZE]; + String line = null; + + try { + if (srcFile.exists() && srcFile.isFile()) { + + input = new BufferedReader(new InputStreamReader(new FileInputStream(srcFile))); + output = new BufferedOutputStream(new FileOutputStream(targetFile)); + + while ((line = input.readLine()) != null) { + byte[] data = line.getBytes(); + output.write(decodeBinary(new String(data))); + } + + result = true; + } + } finally { + if (input != null) { + try { + input.close(); + } catch (Exception ignore) { + LOGGER.debug("IGNORE: {}", ignore); + } + } + if (output != null) { + try { + output.close(); + } catch (Exception ignore) { + LOGGER.debug("IGNORE: {}", ignore); + } + } + } + return result; + } + + /** + * 데이터를 암호화하는 기능 + * + * @param byte[] data 암호화할 데이터 + * @return String result 암호화된 데이터 + * @exception Exception + */ + public static String encodeBinary(byte[] data) throws Exception { + if (data == null) { + return ""; + } + + return new String(Base64.encodeBase64(data)); + } + + /** + * 데이터를 암호화하는 기능 + * + * @param String data 암호화할 데이터 + * @return String result 암호화된 데이터 + * @exception Exception + */ + public static String encode(String data) throws Exception { + return encodeBinary(data.getBytes()); + } + + /** + * 데이터를 복호화하는 기능 + * + * @param String data 복호화할 데이터 + * @return String result 복호화된 데이터 + * @exception Exception + */ + public static byte[] decodeBinary(String data) throws Exception { + return Base64.decodeBase64(data.getBytes()); + } + + /** + * 데이터를 복호화하는 기능 + * + * @param String data 복호화할 데이터 + * @return String result 복호화된 데이터 + * @exception Exception + */ + public static String decode(String data) throws Exception { + return new String(decodeBinary(data)); + } + + /** + * 비밀번호를 암호화하는 기능(복호화가 되면 안되므로 SHA-256 인코딩 방식 적용). + * + * deprecated : 보안 강화를 위하여 salt로 ID를 지정하는 encryptPassword(password, id) 사용 + * + * @param String data 암호화할 비밀번호 + * @return String result 암호화된 비밀번호 + * @exception Exception + */ + @Deprecated + public static String encryptPassword(String data) throws Exception { + + if (data == null) { + return ""; + } + + byte[] plainText = null; // 평문 + byte[] hashValue = null; // 해쉬값 + plainText = data.getBytes(); + + MessageDigest md = MessageDigest.getInstance("SHA-256"); + + // 변경 시 기존 hash 값에 검증 불가.. => deprecated 시키고 유지 + /* + // Random 방식의 salt 추가 + SecureRandom ng = new SecureRandom(); + byte[] randomBytes = new byte[16]; + ng.nextBytes(randomBytes); + + md.reset(); + md.update(randomBytes); + + */ + hashValue = md.digest(plainText); + + /* + BASE64Encoder encoder = new BASE64Encoder(); + return encoder.encode(hashValue); + */ + return new String(Base64.encodeBase64(hashValue)); + } + + /** + * 비밀번호를 암호화하는 기능(복호화가 되면 안되므로 SHA-256 인코딩 방식 적용) + * + * @param password 암호화될 패스워드 + * @param id salt로 사용될 사용자 ID 지정 + * @return + * @throws Exception + */ + public static String encryptPassword(String password, String id) throws Exception { + + if (password == null) { + return ""; + } + + byte[] hashValue = null; // 해쉬값 + + MessageDigest md = MessageDigest.getInstance("SHA-256"); + + md.reset(); + md.update(id.getBytes()); + + hashValue = md.digest(password.getBytes()); + + return new String(Base64.encodeBase64(hashValue)); + } + + /** + * 비밀번호를 암호화하는 기능(복호화가 되면 안되므로 SHA-256 인코딩 방식 적용) + * @param data 암호화할 비밀번호 + * @param salt Salt + * @return 암호화된 비밀번호 + * @throws Exception + */ + public static String encryptPassword(String data, byte[] salt) throws Exception { + + if (data == null) { + return ""; + } + + byte[] hashValue = null; // 해쉬값 + + MessageDigest md = MessageDigest.getInstance("SHA-256"); + + md.reset(); + md.update(salt); + + hashValue = md.digest(data.getBytes()); + + return new String(Base64.encodeBase64(hashValue)); + } + + /** + * 비밀번호를 암호화된 패스워드 검증(salt가 사용된 경우만 적용). + * + * @param data 원 패스워드 + * @param encoded 해쉬처리된 패스워드(Base64 인코딩) + * @return + * @throws Exception + */ + public static boolean checkPassword(String data, String encoded, byte[] salt) throws Exception { + byte[] hashValue = null; // 해쉬값 + + MessageDigest md = MessageDigest.getInstance("SHA-256"); + + md.reset(); + md.update(salt); + hashValue = md.digest(data.getBytes()); + + return MessageDigest.isEqual(hashValue, Base64.decodeBase64(encoded.getBytes())); + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/common/util/ExcelUtils.java b/main_vm/src/main/java/com/icomsys/main_vm/common/util/ExcelUtils.java new file mode 100644 index 0000000..8157d84 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/common/util/ExcelUtils.java @@ -0,0 +1,59 @@ +package com.icomsys.main_vm.common.util; + +import org.apache.poi.ss.usermodel.*; +import org.apache.poi.xssf.usermodel.*; + +public class ExcelUtils { + + /** + * xlsx 엑셀 스타일 적용 + */ + public static XSSFCell createXSSFCellStyle(XSSFRow row, int col, Font font, short bgColor, HorizontalAlignment hAlign, BorderStyle border, String cellValue) { + + XSSFSheet sheet = row.getSheet(); + XSSFWorkbook wb = sheet.getWorkbook(); + XSSFCellStyle cs = wb.createCellStyle(); + + //정렬 + cs.setAlignment(hAlign); + cs.setVerticalAlignment(VerticalAlignment.CENTER); + + //테두리 설정 + cs.setBorderTop(border); + cs.setBorderRight(border); + cs.setBorderBottom(border); + cs.setBorderLeft(border); + + //글꼴 설정 + cs.setFont(font); + + //배경색 설정 + if (bgColor > 0) { + cs.setFillForegroundColor(bgColor); + cs.setFillPattern(FillPatternType.SOLID_FOREGROUND); + } + + + //셀 생성 + XSSFCell cell = row.createCell(col); + cell.setCellStyle(cs); + cell.setCellValue(cellValue); + + return cell; + } + + /** + * Default value cell + */ + public static XSSFCell createDefaultValueCellStyle(XSSFRow row, int col, XSSFFont font, String cellValue) { + return createXSSFCellStyle(row, col, font, IndexedColors.WHITE.getIndex(), HorizontalAlignment.CENTER, BorderStyle.THIN, cellValue); + } + + /** + * Default header cell + */ + public static XSSFCell createDefaultHeaderCellStyle(XSSFRow row, int col, XSSFFont font, String cellValue) { + return createXSSFCellStyle(row, col, font, IndexedColors.GREY_25_PERCENT.getIndex(), HorizontalAlignment.CENTER, BorderStyle.THIN, cellValue); + } + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/common/util/HashUtil.java b/main_vm/src/main/java/com/icomsys/main_vm/common/util/HashUtil.java new file mode 100644 index 0000000..0ebbb28 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/common/util/HashUtil.java @@ -0,0 +1,15 @@ +package com.icomsys.main_vm.common.util; + +import javax.xml.bind.DatatypeConverter; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; + +public class HashUtil { + + public static String getStringToChecksum(String contents) throws NoSuchAlgorithmException { + // String 값을 입력받아 md5 hash + base64 encoding + MessageDigest md = MessageDigest.getInstance("MD5"); + md.update(contents.getBytes()); + return DatatypeConverter.printBase64Binary(md.digest()); + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/common/util/README.md b/main_vm/src/main/java/com/icomsys/main_vm/common/util/README.md new file mode 100644 index 0000000..be0ce12 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/common/util/README.md @@ -0,0 +1 @@ +EgovFileScrty = 전자정부 패쓰워드 엔코더용 파일 \ No newline at end of file diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/conversation/TbDictionaryMaster.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/conversation/TbDictionaryMaster.java new file mode 100644 index 0000000..2e30eca --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/conversation/TbDictionaryMaster.java @@ -0,0 +1,55 @@ +package com.icomsys.main_vm.db.jpa.entity.conversation; + +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Table; +import java.time.LocalDateTime; + +@Table(name = "TB_DICTIONARY_MASTER") +@Entity +@Getter +@Setter +@NoArgsConstructor +public class TbDictionaryMaster { + @Id + @Column(name = "SEQ", nullable = false, length = 20) + private Long seq; + @Column(name = "OPR_MNG_CODE", nullable = false, length = 40) + private String oprMngCode; + @Column(name = "GROUP_SEQ", nullable = false, length = 20) + private Long groupSeq; + @Column(name = "REP_WORD", nullable = false, length = 20) + private String repWord; + @Column(name = "IF_MAPPING_ID", nullable = true, length = 20) + private Long ifMappingId; + @Column(name = "USE_YN", nullable = false, length = 1) + private String useYn; + @Column(name = "REGIST_ID", nullable = false, length = 30) + private String registId; + @Column(name = "REGIST_DATE", nullable = false) + private LocalDateTime registDate; + @Column(name = "UPDATE_ID", nullable = true, length = 30) + private String updateId; + @Column(name = "UPDATE_DATE", nullable = true) + private LocalDateTime updateDate; + + @Builder + public TbDictionaryMaster(Long seq, String oprMngCode, Long groupSeq, String repWord, Long ifMappingId, String useYn, String registId, LocalDateTime registDate, String updateId, LocalDateTime updateDate) { + this.seq = seq; + this.oprMngCode = oprMngCode; + this.groupSeq = groupSeq; + this.repWord = repWord; + this.ifMappingId = ifMappingId; + this.useYn = useYn; + this.registId = registId; + this.registDate = registDate; + this.updateId = updateId; + this.updateDate = updateDate; + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/conversation/TbEntityMaster.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/conversation/TbEntityMaster.java new file mode 100644 index 0000000..d39810e --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/conversation/TbEntityMaster.java @@ -0,0 +1,34 @@ +package com.icomsys.main_vm.db.jpa.entity.conversation; + +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Table; +import java.time.LocalDateTime; + +@Table(name = "TB_ENTITY_MASTER") +@Entity +@Getter +@Setter +@NoArgsConstructor +public class TbEntityMaster { + @Id + @Column(name = "ENTITY_NAME", nullable = true, length = 50) + private String entityName; + @Column(name = "REGIST_ID", nullable = true, length = 30) + private String registId; + @Column(name = "REGIST_DATE", nullable = true) + private LocalDateTime registDate; + + @Builder + public TbEntityMaster(String entityName, String registId, LocalDateTime registDate) { + this.entityName = entityName; + this.registId = registId; + this.registDate = registDate; + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/conversation/TbIcsLog.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/conversation/TbIcsLog.java new file mode 100644 index 0000000..cd67906 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/conversation/TbIcsLog.java @@ -0,0 +1,64 @@ +package com.icomsys.main_vm.db.jpa.entity.conversation; + +import com.icomsys.main_vm.db.jpa.entity.conversation.id.TbIcsLogId; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +import javax.persistence.*; +import java.time.LocalDateTime; + +@Table(name = "TB_ICS_LOG") +@Entity +@Getter +@Setter +@NoArgsConstructor +@IdClass(TbIcsLogId.class) +public class TbIcsLog { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "SEQ", nullable = false, length = 20) + private Long seq; + @Id + @Column(name = "REGIST_DATE", nullable = false) + private LocalDateTime registDate; + @Id + @Column(name = "USER_ID", nullable = false, length = 20) + private String userId; + @Column(name = "ACTION_CODE", nullable = false, length = 20) + private String actionCode; + @Column(name = "MENU_AUTH", nullable = false, length = 100) + private String menuAuth; + @Column(name = "IP", nullable = false, length = 20) + private String ip; + @Column(name = "REMARK", nullable = true, length = 1000) + private String remark; + @Column(name = "SERVICE_GROUP", nullable = false, length = 20) + private String serviceGroup; + @Column(name = "ATTRIBUTE_1", nullable = true, length = 20) + private String attribute1; + @Column(name = "ATTRIBUTE_2", nullable = true, length = 20) + private String attribute2; + @Column(name = "ATTRIBUTE_3", nullable = true, length = 20) + private String attribute3; + @Column(name = "ATTRIBUTE_4", nullable = true, length = 20) + private String attribute4; + + @Builder + public TbIcsLog(Long seq, LocalDateTime registDate, String userId, String actionCode, String menuAuth, String ip, String remark, String serviceGroup, String attribute1, String attribute2, String attribute3, String attribute4) { + this.seq = seq; + this.registDate = registDate; + this.userId = userId; + this.actionCode = actionCode; + this.menuAuth = menuAuth; + this.ip = ip; + this.remark = remark; + this.serviceGroup = serviceGroup; + this.attribute1 = attribute1; + this.attribute2 = attribute2; + this.attribute3 = attribute3; + this.attribute4 = attribute4; + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/conversation/TbIntentExample.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/conversation/TbIntentExample.java new file mode 100644 index 0000000..53a074e --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/conversation/TbIntentExample.java @@ -0,0 +1,69 @@ +package com.icomsys.main_vm.db.jpa.entity.conversation; + +import com.icomsys.main_vm.biz.rcp.conversation.dto.TbIntentExampleDto; +import com.icomsys.main_vm.db.jpa.entity.conversation.id.TbIntentExampleId; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +import javax.persistence.*; +import java.time.LocalDateTime; + +@Table(name = "TB_INTENT_EXAMPLE") +@Entity +@Getter +@Setter +@NoArgsConstructor +//@IdClass(TbIntentExampleId.class) +public class TbIntentExample { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "SEQ", nullable = false, length = 20) + private Long seq; +// @Id + @Column(name = "INTENT_SEQ", nullable = false, length = 20) + private Long intentSeq; + @Column(name = "EXAMPLE_TEXT", nullable = true, length = 200) + private String exampleText; + @Column(name = "IF_MAPPING_ID", nullable = true, length = 20) + private Long ifMappingId; + @Column(name = "USE_YN", nullable = true, length = 1) + private String useYn; + @Column(name = "REGIST_ID", nullable = false, length = 20) + private String registId; + @Column(name = "REGIST_DATE", nullable = false) + private LocalDateTime registDate; + @Column(name = "UPDATE_ID", nullable = true, length = 20) + private String updateId; + @Column(name = "UPDATE_DATE", nullable = true) + private LocalDateTime updateDate; + + @Builder + public TbIntentExample(Long seq, Long intentSeq, String exampleText, Long ifMappingId, String useYn, String registId, LocalDateTime registDate, String updateId, LocalDateTime updateDate) { + this.seq = seq; + this.intentSeq = intentSeq; + this.exampleText = exampleText; + this.ifMappingId = ifMappingId; + this.useYn = useYn; + this.registId = registId; + this.registDate = registDate; + this.updateId = updateId; + this.updateDate = updateDate; + } + + public TbIntentExampleDto toTbIntentExampleDto() { + TbIntentExampleDto tied = new TbIntentExampleDto(); + tied.setSeq(this.seq); + tied.setIntentSeq(this.intentSeq); + tied.setExampleText(this.exampleText); + tied.setIfMappingId(this.ifMappingId); + tied.setUseYn(this.useYn); + tied.setRegistId(this.registId); + tied.setRegistDate(this.registDate); + tied.setUpdateId(this.updateId); + tied.setUpdateDate(this.updateDate); + return tied; + } + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/conversation/TbIntentMaster.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/conversation/TbIntentMaster.java new file mode 100644 index 0000000..c655561 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/conversation/TbIntentMaster.java @@ -0,0 +1,53 @@ +package com.icomsys.main_vm.db.jpa.entity.conversation; + +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +import javax.persistence.*; +import java.time.LocalDateTime; + +@Table(name = "TB_INTENT_MASTER") +@Entity +@Getter +@Setter +@NoArgsConstructor +public class TbIntentMaster { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY ) + @Column(name = "SEQ", nullable = false, length = 20) + private Long seq; + @Column(name = "OPR_MNG_CODE", nullable = true, length = 50) + private String oprMngCode; + @Column(name = "INTENT_NAME", nullable = true, length = 50) + private String intentName; + @Column(name = "CATEGORY", nullable = true, length = 20) + private String category; + @Column(name = "IF_MAPPING_ID", nullable = true, length = 20) + private Long ifMappingId; + @Column(name = "USE_YN", nullable = true, length = 1) + private String useYn; + @Column(name = "REGIST_ID", nullable = false, length = 20) + private String registId; + @Column(name = "REGIST_DATE", nullable = false) + private LocalDateTime registDate; + @Column(name = "UPDATE_ID", nullable = true, length = 20) + private String updateId; + @Column(name = "UPDATE_DATE", nullable = true) + private LocalDateTime updateDate; + + @Builder + public TbIntentMaster(Long seq, String oprMngCode, String intentName, String category, Long ifMappingId, String useYn, String registId, LocalDateTime registDate, String updateId, LocalDateTime updateDate) { + this.seq = seq; + this.oprMngCode = oprMngCode; + this.intentName = intentName; + this.category = category; + this.ifMappingId = ifMappingId; + this.useYn = useYn; + this.registId = registId; + this.registDate = registDate; + this.updateId = updateId; + this.updateDate = updateDate; + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/conversation/TbProjectSetting.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/conversation/TbProjectSetting.java new file mode 100644 index 0000000..e1aebb9 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/conversation/TbProjectSetting.java @@ -0,0 +1,83 @@ +package com.icomsys.main_vm.db.jpa.entity.conversation; + +import com.icomsys.main_vm.biz.rcp.conversation.vo.SelectSimilarityCriteriaVO; +import com.icomsys.main_vm.db.mybatis.alias.LoginVO; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Table; +import java.time.LocalDateTime; +import java.util.Map; + +@Table(name = "TB_PROJECT_SETTING") +@Entity +@Getter +@Setter +@NoArgsConstructor +public class TbProjectSetting { + @Id + @Column(name = "OPR_MNG_CODE", nullable = false, length = 40) + private String oprMngCode; + @Column(name = "SIMILARITY_CRITERIA", nullable = true) + private double similarityCriteria; + @Column(name = "CLASS_CRITERIA", nullable = true) + private double classCriteria; + @Column(name = "CLASS_RESULT_CRITERIA", nullable = true) + private double classResultCriteria; + @Column(name = "FALLBACK_MSG", nullable = true, length = 500) + private String fallbackMsg; + @Column(name = "GREETING_MSG", nullable = true, length = 500) + private String greetingMsg; + @Column(name = "IF_MAPPING_ID", nullable = true, length = 20) + private Long ifMappingId; + @Column(name = "REGIST_ID", nullable = false, length = 30) + private String registId; + @Column(name = "REGIST_DATE", nullable = false) + private LocalDateTime registDate; + @Column(name = "UPDATE_ID", nullable = true) + private String updateId; + @Column(name = "UPDATE_DATE", nullable = true) + private LocalDateTime updateDate; + + + @Builder + public TbProjectSetting(String oprMngCode, double similarityCriteria, double classCriteria, double classResultCriteria, String fallbackMsg, String greetingMsg, Long ifMappingId, String registId, LocalDateTime registDate, String updateId, LocalDateTime updateDate) { + this.oprMngCode = oprMngCode; + this.similarityCriteria = similarityCriteria; + this.classCriteria = classCriteria; + this.classResultCriteria = classResultCriteria; + this.fallbackMsg = fallbackMsg; + this.greetingMsg = greetingMsg; + this.ifMappingId = ifMappingId; + this.registId = registId; + this.registDate = registDate; + this.updateId = updateId; + this.updateDate = updateDate; + } + + public SelectSimilarityCriteriaVO toSelectSimilarityCriteriaVo() { + SelectSimilarityCriteriaVO sscv = new SelectSimilarityCriteriaVO(); + sscv.setOprMngCode(this.oprMngCode); + sscv.setSimilarityCriteria(this.similarityCriteria); + sscv.setClassResultCriteria(this.classResultCriteria); + sscv.setFallbackMsg(this.fallbackMsg); + sscv.setGreetingMsg(this.greetingMsg); + return sscv; + } + +// public TbProjectSetting UpdateProject(Map dataMap) { +// this.similarityCriteria = Double.parseDouble(dataMap.get("similarityCriteria")); +// this.classCriteria = Double.parseDouble(dataMap.get("classCriteria")); +// this.classResultCriteria = Double.parseDouble(dataMap.get("classResultCriteria")); +// this.fallbackMsg = dataMap.get("fallbackMsg"); +// this.greetingMsg = dataMap.get("greetingMsg"); +// this.updateId = resultVO.getUserId(); +// this.updateDate = LocalDateTime.now(); +// return this; +// } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/conversation/TbSlotMaster.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/conversation/TbSlotMaster.java new file mode 100644 index 0000000..ea6aac1 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/conversation/TbSlotMaster.java @@ -0,0 +1,67 @@ +package com.icomsys.main_vm.db.jpa.entity.conversation; + +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Table; +import java.time.LocalDateTime; + +@Table(name = "TB_SLOT_MASTER") +@Entity +@Getter +@Setter +@NoArgsConstructor +public class TbSlotMaster { + @Id + @Column(name = "SEQ", nullable = false, length = 20) + private Long seq; + @Column(name = "OPR_MNG_CODE", nullable = false, length = 50) + private String oprMngCode; + @Column(name = "GROUP_NAME", nullable = true, length = 50) + private String groupName; + @Column(name = "INTENT_SEQ", nullable = false, length = 11) + private Long intentSeq; + @Column(name = "IF_MAPPING_ID", nullable = true, length = 20) + private Long ifMappingId; + @Column(name = "USE_YN", nullable = true, length = 1) + private String useYn; + @Column(name = "REGIST_ID", nullable = false, length = 20) + private String registId; + @Column(name = "REGIST_DATE", nullable = false) + private LocalDateTime registDate; + @Column(name = "UPDATE_ID", nullable = true, length = 20) + private String updateId; + @Column(name = "UPDATE_DATE", nullable = true) + private LocalDateTime updateDate; + + @Builder + public TbSlotMaster(Long seq, String oprMngCode, String groupName, Long intentSeq, Long ifMappingId, String useYn, String registId, LocalDateTime registDate, String updateId, LocalDateTime updateDate) { + this.seq = seq; + this.oprMngCode = oprMngCode; + this.groupName = groupName; + this.intentSeq = intentSeq; + this.ifMappingId = ifMappingId; + this.useYn = useYn; + this.registId = registId; + this.registDate = registDate; + this.updateId = updateId; + this.updateDate = updateDate; + } + + public TbSlotMaster updateUseY(){ + this.useYn = "Y"; + return this; + } + + + public TbSlotMaster updateUseN(){ + this.useYn = "N"; + return this; + } + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/conversation/TbSynonymMaster.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/conversation/TbSynonymMaster.java new file mode 100644 index 0000000..675d5e5 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/conversation/TbSynonymMaster.java @@ -0,0 +1,72 @@ +package com.icomsys.main_vm.db.jpa.entity.conversation; + +import com.icomsys.main_vm.db.mybatis.alias.LoginVO; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +import javax.persistence.*; +import javax.servlet.http.HttpServletRequest; +import java.time.LocalDateTime; +import java.util.HashMap; +import java.util.List; + +@Table(name = "TB_SYNONYM_MASTER") +@Entity +@Getter +@Setter +@NoArgsConstructor +public class TbSynonymMaster { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "SEQ", nullable = false, length = 20) + private Long seq; + @Column(name = "OPR_MNG_CODE", nullable = true, length = 50) + private String oprMngCode; + @Column(name = "IDIV_WORD", nullable = true, length = 50) + private String idivWord; + @Column(name = "REP_WORD", nullable = true, length = 20) + private String repWord; + @Column(name = "IF_MAPPING_ID", nullable = true, length = 20) + private Long ifMappingId; + @Column(name = "USE_YN", nullable = true, length = 1) + private String useYn; + @Column(name = "REGIST_ID", nullable = false, length = 20) + private String registId; + @Column(name = "REGIST_DATE", nullable = false) + private LocalDateTime registDate; + @Column(name = "UPDATE_ID", nullable = true, length = 20) + private String updateId; + @Column(name = "UPDATE_DATE", nullable = true) + private LocalDateTime updateDate; + + @Builder + public TbSynonymMaster(Long seq, String oprMngCode, String idivWord, String repWord, Long ifMappingId, String useYn, String registId, LocalDateTime registDate, String updateId, LocalDateTime updateDate) { + this.seq = seq; + this.oprMngCode = oprMngCode; + this.idivWord = idivWord; + this.repWord = repWord; + this.ifMappingId = ifMappingId; + this.useYn = useYn; + this.registId = registId; + this.registDate = registDate; + this.updateId = updateId; + this.updateDate = updateDate; + } + + @OneToMany(cascade = CascadeType.ALL, targetEntity = TbSynonymWord.class, fetch = FetchType.EAGER) + @JoinColumn(name = "MASTER_SEQ",referencedColumnName ="SEQ") + private List tbSynonymWords; + + public TbSynonymMaster UpdateSynonymMaster(HashMap eMap) { + this.idivWord = eMap.get("idivWord").toString(); + this.repWord = eMap.get("repWord").toString(); + this.useYn = "Y"; + this.updateId = eMap.get("userId").toString(); + this.updateDate = LocalDateTime.now(); + + return this; + }; + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/conversation/TbSynonymWord.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/conversation/TbSynonymWord.java new file mode 100644 index 0000000..4842a60 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/conversation/TbSynonymWord.java @@ -0,0 +1,69 @@ +package com.icomsys.main_vm.db.jpa.entity.conversation; + +import com.icomsys.main_vm.db.jpa.entity.conversation.id.TbSynonymWordId; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +import javax.naming.ldap.HasControls; +import javax.persistence.*; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +@Table(name = "TB_SYNONYM_WORD") +@Entity +@Getter +@Setter +@NoArgsConstructor +//@IdClass(TbSynonymWordId.class) +public class TbSynonymWord { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "SEQ", nullable = false, length = 20) + private Long seq; + @Column(name = "MASTER_SEQ", nullable = false, length = 20) + private Long masterSeq; + @Column(name = "OPR_MNG_CODE", nullable = true, length = 50) + private String oprMngCode; + @Column(name = "SYNONYM_WORD", nullable = true, length = 50) + private String synonymWord; + @Column(name = "IF_MAPPING_ID", nullable = true, length = 20) + private Long ifMappingId; + @Column(name = "USE_YN", nullable = true, length = 1) + private String useYn; + @Column(name = "REGIST_ID", nullable = false, length = 20) + private String registId; + @Column(name = "REGIST_DATE", nullable = false) + private LocalDateTime registDate; + @Column(name = "UPDATE_ID", nullable = true, length = 20) + private String updateId; + @Column(name = "UPDATE_DATE", nullable = true) + private LocalDateTime updateDate; + + @Builder + public TbSynonymWord(Long seq, Long masterSeq, String oprMngCode, String synonymWord, Long ifMappingId, String useYn, String registId, LocalDateTime registDate, String updateId, LocalDateTime updateDate) { + this.seq = seq; + this.masterSeq = masterSeq; + this.oprMngCode = oprMngCode; + this.synonymWord = synonymWord; + this.ifMappingId = ifMappingId; + this.useYn = useYn; + this.registId = registId; + this.registDate = registDate; + this.updateId = updateId; + this.updateDate = updateDate; + } + + public TbSynonymWord updateSeq(Long masterSeq){ + this.seq = masterSeq; + +// public TbSynonymWord DeleteSynonymWord(){ +// this.useYn = "N"; + return this; + } + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/conversation/id/TbIcsLogId.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/conversation/id/TbIcsLogId.java new file mode 100644 index 0000000..8494eff --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/conversation/id/TbIcsLogId.java @@ -0,0 +1,23 @@ +package com.icomsys.main_vm.db.jpa.entity.conversation.id; + +import lombok.*; + +import javax.persistence.Column; +import java.io.Serializable; +import java.time.LocalDateTime; + +@Getter +@Setter +@NoArgsConstructor +public class TbIcsLogId implements Serializable { + + @Column(name = "SEQ") + private Long seq; + + @Column(name = "REGIST_DATE") + private LocalDateTime registDate; + + @Column(name = "USER_ID") + private String userId; + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/conversation/id/TbIntentExampleId.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/conversation/id/TbIntentExampleId.java new file mode 100644 index 0000000..da8f6ec --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/conversation/id/TbIntentExampleId.java @@ -0,0 +1,12 @@ +package com.icomsys.main_vm.db.jpa.entity.conversation.id; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class TbIntentExampleId implements Serializable { + private Long seq; + private Long intentSeq; + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/conversation/id/TbSynonymWordId.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/conversation/id/TbSynonymWordId.java new file mode 100644 index 0000000..fd5e5d2 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/conversation/id/TbSynonymWordId.java @@ -0,0 +1,11 @@ +package com.icomsys.main_vm.db.jpa.entity.conversation.id; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class TbSynonymWordId implements Serializable { + private Long seq; + private Long masterSeq; +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/learningTest/TbIntentTest.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/learningTest/TbIntentTest.java new file mode 100644 index 0000000..a8709d0 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/learningTest/TbIntentTest.java @@ -0,0 +1,65 @@ +package com.icomsys.main_vm.db.jpa.entity.learningTest; + +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +import javax.persistence.*; +import java.time.LocalDateTime; + +@Table(name = "TB_INTENT_TEST") +@Entity +@Getter +@Setter +@NoArgsConstructor +public class TbIntentTest { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY ) + @Column(name = "SEQ", nullable = false, length = 20) + private Long seq; + @Column(name = "OPR_MNG_CODE", nullable = true, length = 40) + private String oprMngCode; + @Column(name = "ROW_NUM", nullable = true, length = 11) + private Long rowNum; + @Column(name = "UPLOAD_FILE_PATH", nullable = true, length = 200) + private String uploadFilePath; + @Column(name = "UPLOAD_FILE_NAME", nullable = true, length = 100) + private String uploadFileName; + @Column(name = "RESULT_FILE_PATH", nullable = true, length = 1) + private String resultFilePath; + @Column(name = "RESULT_FILE_NAME", nullable = true, length = 30) + private String resultFileName; + @Column(name = "TEST_CNT", nullable = true, length = 11) + private Long testCnt; + @Column(name = "TEST_RESULT", nullable = true, length = 30) + private String testResult; + @Column(name = "USE_YN", nullable = true, length = 1) + private String useYn; + @Column(name = "REGIST_ID", nullable = true, length = 30) + private String registId; + @Column(name = "REGIST_DATE", nullable = true) + private LocalDateTime registDate; + @Column(name = "UPDATE_ID", nullable = true, length = 30) + private String updateId; + @Column(name = "UPDATE_DATE", nullable = true) + private LocalDateTime updateDate; + + @Builder + public TbIntentTest(Long seq, String oprMngCode, Long rowNum, String uploadFilePath, String uploadFileName, String resultFilePath, String resultFileName, Long testCnt, String testResult, String useYn, String registId, LocalDateTime registDate, String updateId, LocalDateTime updateDate) { + this.seq = seq; + this.oprMngCode = oprMngCode; + this.rowNum = rowNum; + this.uploadFilePath = uploadFilePath; + this.uploadFileName = uploadFileName; + this.resultFilePath = resultFilePath; + this.resultFileName = resultFileName; + this.testCnt = testCnt; + this.testResult = testResult; + this.useYn = useYn; + this.registId = registId; + this.registDate = registDate; + this.updateId = updateId; + this.updateDate = updateDate; + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/monitoring/TbCallBotLog.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/monitoring/TbCallBotLog.java new file mode 100644 index 0000000..17b7d7a --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/monitoring/TbCallBotLog.java @@ -0,0 +1,51 @@ +package com.icomsys.main_vm.db.jpa.entity.monitoring; + +import com.icomsys.main_vm.db.jpa.entity.monitoring.id.TbCallBotLogId; +import com.icomsys.main_vm.db.jpa.entity.monitoring.id.TbCallRecId; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import org.hibernate.annotations.DynamicUpdate; + +import javax.persistence.*; +import java.time.LocalDateTime; + +@Table(name = "TB_CALL_BOT_LOG") +@Entity +@Getter +@Setter +@NoArgsConstructor +@DynamicUpdate +@IdClass(TbCallBotLogId.class) +public class TbCallBotLog { + + @Id + @Column(name = "TOKEN", nullable = false) + private String token; + @Id + @Column(name = "TALK_SEQ", nullable = false) + private int talkSeq; + @Id + @Column(name = "MENT_SPEECH_NO", nullable = false) + private int mentSpeechNo; + @Column(name = "BOT_TEXT", nullable = false) + private String botText; + @Column(name = "ITEM_NAME", nullable = false) + private String itemName; + @Column(name = "RCP_INFO", nullable = false) + private String rcpInfo; + @Column(name = "REGIST_DATE", nullable = false) + private LocalDateTime registDate; + + @Builder + public TbCallBotLog(String token, int talkSeq, int mentSpeechNo, String botText, String itemName, String rcpInfo, LocalDateTime registDate) { + this.token = token; + this.talkSeq = talkSeq; + this.mentSpeechNo = mentSpeechNo; + this.botText = botText; + this.itemName = itemName; + this.rcpInfo = rcpInfo; + this.registDate = registDate; + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/monitoring/TbCallBotRec.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/monitoring/TbCallBotRec.java new file mode 100644 index 0000000..3df34e6 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/monitoring/TbCallBotRec.java @@ -0,0 +1,41 @@ +package com.icomsys.main_vm.db.jpa.entity.monitoring; + +import com.icomsys.main_vm.db.jpa.entity.monitoring.id.TbCallInfoId; +import com.icomsys.main_vm.db.jpa.entity.monitoring.id.TbCallRecId; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import org.hibernate.annotations.DynamicUpdate; + +import javax.persistence.*; +import java.time.LocalDateTime; + +@Table(name = "TB_CALL_BOT_REC") +@Entity +@Getter +@Setter +@NoArgsConstructor +@DynamicUpdate +@IdClass(TbCallRecId.class) +public class TbCallBotRec { + + @Id + @Column(name = "TOKEN", nullable = false) + private String token; + @Id + @Column(name = "TALK_SEQ", nullable = false) + private int talkSeq; + @Column(name = "REC_FILE_PATH", nullable = false, length = 200) + private String recFilePath; + @Column(name = "REGIST_DATE", nullable = false) + private LocalDateTime registDate; + + @Builder + public TbCallBotRec(String token, int talkSeq, String recFilePath, LocalDateTime registDate) { + this.token = token; + this.talkSeq = talkSeq; + this.recFilePath = recFilePath; + this.registDate = registDate; + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/monitoring/TbCallInfo.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/monitoring/TbCallInfo.java new file mode 100644 index 0000000..9c892d3 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/monitoring/TbCallInfo.java @@ -0,0 +1,84 @@ +package com.icomsys.main_vm.db.jpa.entity.monitoring; + + +import com.icomsys.main_vm.db.jpa.entity.monitoring.id.TbCallInfoId; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import org.hibernate.annotations.DynamicUpdate; + +import javax.persistence.*; +import java.time.LocalDateTime; + +@Table(name = "TB_CALL_INFO") +@Entity +@Getter +@Setter +@NoArgsConstructor +@DynamicUpdate +@IdClass(TbCallInfoId.class) +public class TbCallInfo { + + @Id + @Column(name = "TOKEN", nullable = false, length = 44) + private String token; + + @Column(name = "OPR_MNG_CODE", nullable = false, length = 100) + private String oprMngCode; + + @Column(name = "IN_CHANNEL_TYPE", nullable = false, length = 5) + private String inChannelType; + + @Id + @Column(name = "CALL_ID", nullable = false, length = 100) + private String callId; + + @Column(name = "TEL_NO", nullable = false, length = 20) + private String telNo; + + @Column(name = "DNIS_NO", nullable = false, length = 20) + private String dnisNo; + + @Column(name = "CALL_INIT_DATE", nullable = true) + private LocalDateTime callInitDate; + + @Column(name = "CALL_END_DATE", nullable = false) + private LocalDateTime callEndDate; + + @Column(name = "CALL_TIME", nullable = false) + private int callTime; + + @Column(name = "CALL_END_TYPE", nullable = false, length = 20) + private String callEndType; + + @Column(name = "CALL_END_CONVERSION", nullable = true, length = 20) + private String callEndConversion; + +// USER_REQ : 사용자 요청 +// SCENARIO : 시나리오 흐름 +// INIT_END : 인입 후 끊음 +// SILENT_FB : 묵음 폴백 +// SPEAK_FB : 발화 폴백 +// USER_END : 고객 끊음 + @Column(name = "CALL_END_REASON", nullable = false, length = 20) + private String callEndReason; + + @Builder + public TbCallInfo(String token, String oprMngCode, String inChannelType, String callId, String telNo, String dnisNo, LocalDateTime callInitDate, LocalDateTime callEndDate, int callTime, String callEndType, String callEndConversion, String callEndReason) { + this.token = token; + this.oprMngCode = oprMngCode; + this.inChannelType = inChannelType; + this.callId = callId; + this.telNo = telNo; + this.dnisNo = dnisNo; + this.callInitDate = callInitDate; + this.callEndDate = callEndDate; + this.callTime = callTime; + this.callEndType = callEndType; + this.callEndConversion = callEndConversion; + this.callEndReason = callEndReason; + } + + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/monitoring/TbCallUserLog.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/monitoring/TbCallUserLog.java new file mode 100644 index 0000000..91e251f --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/monitoring/TbCallUserLog.java @@ -0,0 +1,88 @@ +package com.icomsys.main_vm.db.jpa.entity.monitoring; + +import com.icomsys.main_vm.db.jpa.entity.monitoring.id.TbCallUserLogId; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import org.hibernate.annotations.DynamicUpdate; + +import javax.persistence.*; +import java.time.LocalDateTime; + +@Table(name = "TB_CALL_USER_LOG") +@Entity +@Getter +@Setter +@NoArgsConstructor +@DynamicUpdate +@IdClass(TbCallUserLogId.class) +public class TbCallUserLog { + + @Id + @Column(name = "TOKEN", nullable = false, length = 44) + private String token; + + @Id + @Column(name = "TALK_SEQ", nullable = false) + private int talkSeq; + + @Column(name = "OPR_MNG_CODE", nullable = false, length = 100) + private String oprMngCode; + + @Column(name = "USER_TEXT", nullable = true, length = 1000) + private String userText; + + @Column(name = "INTENT_ID", nullable = true) + private Long intentId; + + @Column(name = "INTENT_NAME", nullable = true, length = 50) + private String intentName; + + @Column(name = "SCORE", nullable = true, length = 10) + private String score; + + @Column(name = "IF_MAPPING_ID", nullable = true) + private Long ifMappingId; + + @Column(name = "IF_RETURN_CODE", nullable = true, length = 10) + private String ifReturnCode; + + @Column(name = "IF_RETURN_MSG", nullable = true, length = 200) + private String ifReturnMsg; + + @Column(name = "REGIST_DATE", nullable = true) + private LocalDateTime registDate; + +// SCORE_FAIL : 점수 미달 +// INTENT_FAIL : 인텐트 실패 +// INTENT_SUCCESS : 인텐트 성공 + @Column(name = "INTENT_RESULT_CODE", nullable = true, length = 20) + private String intentResultCode; + + @Column(name = "SCENARIO_NAME", nullable = true,length = 200) + private String scenarioName; + + @Column(name = "SCENARIO_SEQ", nullable = true) + private Long scenarioSeq; + + @Builder + public TbCallUserLog(String token, int talkSeq, String oprMngCode, String userText, Long intentId, String intentName, String score, String intentResultCode, Long ifMappingId, String ifReturnCode, String ifReturnMsg, LocalDateTime registDate, Long scenarioSeq, String scenarioName) { + this.token = token; + this.talkSeq = talkSeq; + this.oprMngCode = oprMngCode; + this.userText = userText; + this.intentId = intentId; + this.intentName = intentName; + this.score = score; + this.intentResultCode = intentResultCode; + this.ifMappingId = ifMappingId; + this.ifReturnCode = ifReturnCode; + this.ifReturnMsg = ifReturnMsg; + this.registDate = registDate; + this.scenarioSeq = scenarioSeq; + this.scenarioName = scenarioName; + } + + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/monitoring/TbCallUserRec.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/monitoring/TbCallUserRec.java new file mode 100644 index 0000000..5872e25 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/monitoring/TbCallUserRec.java @@ -0,0 +1,43 @@ +package com.icomsys.main_vm.db.jpa.entity.monitoring; + +import com.icomsys.main_vm.db.jpa.entity.monitoring.id.TbCallRecId; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import org.hibernate.annotations.DynamicUpdate; + +import javax.persistence.*; +import java.time.LocalDateTime; + +@Table(name = "TB_CALL_USER_REC") +@Entity +@Getter +@Setter +@NoArgsConstructor +@DynamicUpdate +@IdClass(TbCallRecId.class) +public class TbCallUserRec { + + @Id + @Column(name = "TOKEN", nullable = false) + private String token; + @Id + @Column(name = "TALK_SEQ", nullable = false) + private int talkSeq; + @Column(name = "ITEM_CODE", nullable = false, length = 50) + private String itemCode; + @Column(name = "REC_FILE_PATH", nullable = false, length = 200) + private String recFilePath; + @Column(name = "REGIST_DATE", nullable = false) + private LocalDateTime registDate; + + @Builder + public TbCallUserRec(String token, int talkSeq, String itemCode, String recFilePath, LocalDateTime registDate) { + this.token = token; + this.talkSeq = talkSeq; + this.itemCode = itemCode; + this.recFilePath = recFilePath; + this.registDate = registDate; + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/monitoring/TbScenarioBreakNode.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/monitoring/TbScenarioBreakNode.java new file mode 100644 index 0000000..e8f7291 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/monitoring/TbScenarioBreakNode.java @@ -0,0 +1,75 @@ +package com.icomsys.main_vm.db.jpa.entity.monitoring; + +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import org.hibernate.annotations.DynamicUpdate; + +import javax.persistence.*; +import java.time.LocalDateTime; + +@Table(name = "TB_SCENARIO_BREAK_NODE") +@Entity +@Getter +@Setter +@NoArgsConstructor +@DynamicUpdate +public class TbScenarioBreakNode { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "SEQ", nullable = false) + private Long seq; + + @Column(name = "TOKEN", nullable = false, length = 44) + private String token; + + @Column(name = "TALK_SEQ", nullable = false) + private int talkSeq; + + @Column(name = "OPR_MNG_CODE", nullable = false, length = 100) + private String oprMngCode; + + @Column(name = "SCENARIO_SEQ", nullable = false) + private Long scenatioSeq; + + @Column(name = "RELEASE_SEQ", nullable = false) + private Long releaseSeq; + + @Column(name = "SCENARIO_NAME", nullable = true, length = 50) + private String scenarioName; + +// S : 성공 +// F : 이탈 + @Column(name = "SCENARIO_RESULT_CODE", nullable = false, length = 1) + private String scenarioResultCode; + + @Column(name = "NODE_CODE", nullable = false,length = 4) + private String nodeCode; + + @Column(name = "NODE_NAME", nullable = true, length = 50) + private String nodeName; + + @Column(name = "NODE_TYPE", nullable = true, length = 50) + private String nodeType; + + @Column(name = "REGIST_DATE", nullable = true) + private LocalDateTime registDate; + + @Builder + public TbScenarioBreakNode(Long seq, String token, int talkSeq, String oprMngCode, Long scenatioSeq, Long releaseSeq, String scenarioName, String scenarioResultCode, String nodeCode, String nodeName, String nodeType, LocalDateTime registDate) { + this.seq = seq; + this.token = token; + this.talkSeq = talkSeq; + this.oprMngCode = oprMngCode; + this.scenatioSeq = scenatioSeq; + this.releaseSeq = releaseSeq; + this.scenarioName = scenarioName; + this.scenarioResultCode = scenarioResultCode; + this.nodeCode = nodeCode; + this.nodeName = nodeName; + this.nodeType = nodeType; + this.registDate = registDate; + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/monitoring/TbTalkBookmark.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/monitoring/TbTalkBookmark.java new file mode 100644 index 0000000..8837a18 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/monitoring/TbTalkBookmark.java @@ -0,0 +1,77 @@ +package com.icomsys.main_vm.db.jpa.entity.monitoring; + + +import com.icomsys.main_vm.db.jpa.entity.system.id.TbBotCommonCodeId; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import org.hibernate.annotations.DynamicUpdate; + +import javax.persistence.*; +import java.time.LocalDateTime; + +//@Table(name = "TB_TALK_BOOKMARK") +//@Entity +@Getter +@Setter +@NoArgsConstructor +//@DynamicUpdate +public class TbTalkBookmark { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "SEQ", nullable = false) + private Long seq; + +// 고객통화로그:C +// 봇통화로그:B + @Column(name = "LOG_TYPE", nullable = false, length = 1) + private String logType; + + @Column(name = "TOKEN", nullable = false, length = 44) + private String token; + + @Column(name = "TALK_SEQ", nullable = false) + private int talkSeq; + + + @Column(name = "TALK_TEXT", nullable = true, length = 1000) + private String talkText; + +// STT_ERR : STT 오류 +// TTS_ERR : TTS 오류 +// INTENT_ERR : 인텐트 오류 +// ETC : 기타 + @Column(name = "BOOKMARK_ERR_CODE", nullable = true, length = 20) + private String bookmarkErrCode; + +// COMPLETE : 조치 완료 +// DEL : 삭제 + @Column(name = "MEASURE_TYPE", nullable = true, length = 20) + private String measureType; + + @Column(name = "REGIST_ID", nullable = true, length = 20) + private String registId; + @Column(name = "REGIST_DATE", nullable = true) + private LocalDateTime registDate; + @Column(name = "UPDATE_ID", nullable = true, length = 20) + private String updateId; + @Column(name = "UPDATE_DATE", nullable = true) + private LocalDateTime updateDate; + + @Builder + public TbTalkBookmark(Long seq, String logType, String token, int talkSeq, String talkText, String bookmarkErrCode, String measureType, String registId, LocalDateTime registDate, String updateId, LocalDateTime updateDate) { + this.seq = seq; + this.logType = logType; + this.token = token; + this.talkSeq = talkSeq; + this.talkText = talkText; + this.bookmarkErrCode = bookmarkErrCode; + this.measureType = measureType; + this.registId = registId; + this.registDate = registDate; + this.updateId = updateId; + this.updateDate = updateDate; + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/monitoring/id/TbCallBotLogId.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/monitoring/id/TbCallBotLogId.java new file mode 100644 index 0000000..77f1f72 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/monitoring/id/TbCallBotLogId.java @@ -0,0 +1,15 @@ +package com.icomsys.main_vm.db.jpa.entity.monitoring.id; + +import lombok.Data; +import org.junit.experimental.theories.DataPoints; + +import javax.persistence.Column; +import javax.persistence.Id; +import java.io.Serializable; + +@Data +public class TbCallBotLogId implements Serializable { + private String token; + private int talkSeq; + private int mentSpeechNo; +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/monitoring/id/TbCallInfoId.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/monitoring/id/TbCallInfoId.java new file mode 100644 index 0000000..2d2ee1a --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/monitoring/id/TbCallInfoId.java @@ -0,0 +1,16 @@ +package com.icomsys.main_vm.db.jpa.entity.monitoring.id; + +import lombok.Data; + +import javax.persistence.Column; +import javax.persistence.Id; +import java.io.Serializable; + +@Data +public class TbCallInfoId implements Serializable { + + private String token; + private String callId; + + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/monitoring/id/TbCallRecId.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/monitoring/id/TbCallRecId.java new file mode 100644 index 0000000..cdcbf6d --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/monitoring/id/TbCallRecId.java @@ -0,0 +1,16 @@ +package com.icomsys.main_vm.db.jpa.entity.monitoring.id; + +import lombok.Data; + +import javax.persistence.Column; +import javax.persistence.Id; +import java.io.Serializable; + +@Data +public class TbCallRecId implements Serializable { + + private String token; + private int talkSeq; + + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/monitoring/id/TbCallUserLogId.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/monitoring/id/TbCallUserLogId.java new file mode 100644 index 0000000..e84a995 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/monitoring/id/TbCallUserLogId.java @@ -0,0 +1,15 @@ +package com.icomsys.main_vm.db.jpa.entity.monitoring.id; + +import lombok.Data; + +import javax.persistence.Column; +import javax.persistence.Id; +import java.io.Serializable; + +@Data +public class TbCallUserLogId implements Serializable { + + private String token; + private int talkSeq; + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/oprManage/TbBgmMng.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/oprManage/TbBgmMng.java new file mode 100644 index 0000000..f5cdd41 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/oprManage/TbBgmMng.java @@ -0,0 +1,44 @@ +package com.icomsys.main_vm.db.jpa.entity.oprManage; + + +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import org.hibernate.annotations.GenericGenerator; + +import javax.persistence.*; +import java.io.Serializable; + +@Table(name = "TB_BGM_MNG") +@Entity +@Getter +@Setter +@NoArgsConstructor +public class TbBgmMng implements Serializable { + @Id + @Column(name = "FILE_NAME", nullable = false, length = 100) + private String fileName; + + @Column(name = "FILE_PATH", nullable = false, length = 200) + private String filePath; + + @Column(name = "CUST_CODE", nullable = false, length = 20) + private String custCode; + + @Column(name = "REGIST_ID", nullable = false, length = 20) + private String registId; + + @Column(name = "REGIST_DATE", nullable = false) + private String registDate; + + @Builder + public TbBgmMng(String fileName, String filePath, String custCode, String registId, String registDate) { + this.fileName = fileName; + this.filePath = filePath; + this.custCode = custCode; + this.registId = registId; + this.registDate = registDate; + } + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/oprManage/TbBotTtsTag.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/oprManage/TbBotTtsTag.java new file mode 100644 index 0000000..b3c9efa --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/oprManage/TbBotTtsTag.java @@ -0,0 +1,53 @@ +package com.icomsys.main_vm.db.jpa.entity.oprManage; + +import com.icomsys.main_vm.db.jpa.entity.system.id.TbBotTtsTagId; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import org.hibernate.annotations.DynamicUpdate; + +import javax.persistence.*; +import java.time.LocalDateTime; + +@Table(name = "TB_BOT_TTS_TAG") +@Entity +@Getter +@Setter +@NoArgsConstructor +@DynamicUpdate +@IdClass(TbBotTtsTagId.class) +public class TbBotTtsTag { + + @Id + @Column(name = "TTS_PROD_CODE", nullable = false, length = 20) + private String ttsProdCode; + @Id + @Column(name = "TAG_CODE", nullable = false, length = 20) + private String tagCode; + @Column(name = "TTS_START_TAG", nullable = true, length = 200) + private String ttsStartTag; + @Column(name = "TTS_END_TAG", nullable = true, length = 200) + private String ttsEndTag; + @Column(name = "REGIST_ID", nullable = false, length = 20) + private String registId; + @Column(name = "REGIST_DATE", nullable = false) + private LocalDateTime registDate; + @Column(name = "UPDATE_ID", nullable = false, length = 20) + private String updateId; + @Column(name = "UPDATE_DATE", nullable = false) + private LocalDateTime updateDate; + + @Builder + public TbBotTtsTag(String ttsProdCode, String tagCode, String ttsStartTag, String ttsEndTag, String registId, LocalDateTime registDate, String updateId, LocalDateTime updateDate) { + this.ttsProdCode = ttsProdCode; + this.tagCode = tagCode; + this.ttsStartTag = ttsStartTag; + this.ttsEndTag = ttsEndTag; + this.registId = registId; + this.registDate = registDate; + this.updateId = updateId; + this.updateDate = updateDate; + } + +} \ No newline at end of file diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/scenario/TbApiNode.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/scenario/TbApiNode.java new file mode 100644 index 0000000..0b9e21f --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/scenario/TbApiNode.java @@ -0,0 +1,51 @@ +package com.icomsys.main_vm.db.jpa.entity.scenario; + + +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import org.hibernate.annotations.DynamicUpdate; + +import javax.persistence.*; +import java.time.LocalDateTime; + +@Table(name = "TB_API_NODE") +@Entity +@Getter +@Setter +@NoArgsConstructor +@DynamicUpdate +public class TbApiNode { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "SEQ", nullable = false) + private Long seq; + @Column(name = "NODE_NAME", nullable = true, length = 50) + private String nodeName; + @Column(name = "USE_YN", nullable = false, length = 1) + private String useYn; + @Column(name = "REGIST_ID", nullable = true, length = 20) + private String registId; + @Column(name = "REGIST_DATE", nullable = true) + private LocalDateTime registDate; + @Column(name = "UPDATE_ID", nullable = true, length = 20) + private String updateId; + @Column(name = "UPDATE_DATE", nullable = true) + private LocalDateTime updateDate; + @Column(name = "OPR_MNG_CODE", nullable = false, length = 50) + private String oprMngCode; + + @Builder + public TbApiNode(Long seq, String nodeName, String useYn, String registId, LocalDateTime registDate, String updateId, LocalDateTime updateDate, String oprMngCode) { + this.seq = seq; + this.nodeName = nodeName; + this.useYn = useYn; + this.registId = registId; + this.registDate = registDate; + this.updateId = updateId; + this.updateDate = updateDate; + this.oprMngCode = oprMngCode; + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/scenario/TbCommonNode.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/scenario/TbCommonNode.java new file mode 100644 index 0000000..49b20d5 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/scenario/TbCommonNode.java @@ -0,0 +1,50 @@ +package com.icomsys.main_vm.db.jpa.entity.scenario; + + +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import org.hibernate.annotations.DynamicUpdate; + +import javax.persistence.*; +import java.time.LocalDateTime; + +@Table(name = "TB_COMMON_NODE") +@Entity +@Getter +@Setter +@NoArgsConstructor +@DynamicUpdate +public class TbCommonNode { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "SEQ", nullable = false) + private Long seq; + @Column(name = "NODE_NAME", nullable = true, length = 50) + private String nodeName; + @Column(name = "USE_YN", nullable = false, length = 1) + private String useYn; + @Column(name = "REGIST_ID", nullable = false, length = 20) + private String registId; + @Column(name = "REGIST_DATE", nullable = false) + private LocalDateTime registDate; + @Column(name = "UPDATE_ID", nullable = true, length = 20) + private String updateId; + @Column(name = "UPDATE_DATE", nullable = true) + private LocalDateTime updateDate; + @Column(name = "OPR_MNG_CODE", nullable = false, length = 50) + private String oprMngCode; + + @Builder + public TbCommonNode(Long seq, String nodeName, String useYn, String registId, LocalDateTime registDate, String updateId, LocalDateTime updateDate, String oprMngCode) { + this.seq = seq; + this.nodeName = nodeName; + this.useYn = useYn; + this.registId = registId; + this.registDate = registDate; + this.updateId = updateId; + this.updateDate = updateDate; + this.oprMngCode = oprMngCode; + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/scenario/TbLongtextManager.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/scenario/TbLongtextManager.java new file mode 100644 index 0000000..19c2790 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/scenario/TbLongtextManager.java @@ -0,0 +1,45 @@ +package com.icomsys.main_vm.db.jpa.entity.scenario; + + +import com.icomsys.main_vm.db.jpa.entity.scenario.id.TbLongtextManagerId; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import org.hibernate.annotations.DynamicUpdate; + +import javax.persistence.*; + +@Table(name = "TB_LONGTEXT_MANAGER") +@Entity +@Getter +@Setter +@NoArgsConstructor +@DynamicUpdate +@IdClass(TbLongtextManagerId.class) +public class TbLongtextManager { + + @Id + @Column(name = "RF_SEQ", nullable = false) + private Long rfSeq; + @Id + @Column(name = "TABLE_CODE", nullable = false) + private int tableCode; + @Id + @Column(name = "COLUMN_CODE", nullable = false) + private int columnCode; + @Column(name = "TEXT_CONTENTS", nullable = false, columnDefinition = "MEDIUMTEXT") + private String textContents; + @Column(name = "CHECKSUM", nullable = true, length = 32) + private String checksum; + + @Builder + public TbLongtextManager(Long rfSeq, int tableCode, int columnCode, String textContents, String checksum) { + this.rfSeq = rfSeq; + this.tableCode = tableCode; + this.columnCode = columnCode; + this.textContents = textContents; + this.checksum = checksum; + } + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/scenario/TbScenarioHistory.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/scenario/TbScenarioHistory.java new file mode 100644 index 0000000..ef582ca --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/scenario/TbScenarioHistory.java @@ -0,0 +1,49 @@ +package com.icomsys.main_vm.db.jpa.entity.scenario; + +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import org.hibernate.annotations.DynamicUpdate; + +import javax.persistence.*; +import java.time.LocalDateTime; + +@Table(name = "TB_SCENARIO_HISTORY") +@Entity +@Getter +@Setter +@NoArgsConstructor +@DynamicUpdate +public class TbScenarioHistory { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "SEQ", nullable = false) + private Long seq; + @Column(name = "MASTER_SEQ", nullable = false) + private Long masterSeq; + @Column(name = "LAST_YN", nullable = false, length = 1) + private String lastYn; + @Column(name = "REGIST_ID", nullable = false, length = 20) + private String registId; + @Column(name = "REGIST_DATE", nullable = false) + private LocalDateTime registDate; + + @Builder + public TbScenarioHistory(Long seq, Long masterSeq, String lastYn, String registId, LocalDateTime registDate) { + this.seq = seq; + this.masterSeq = masterSeq; + this.lastYn = lastYn; + this.registId = registId; + this.registDate = registDate; + } + + @Builder + public TbScenarioHistory(Long masterSeq, String lastYn, String registId, LocalDateTime registDate) { + this.masterSeq = masterSeq; + this.lastYn = lastYn; + this.registId = registId; + this.registDate = registDate; + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/scenario/TbScenarioMaster.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/scenario/TbScenarioMaster.java new file mode 100644 index 0000000..cc94144 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/scenario/TbScenarioMaster.java @@ -0,0 +1,51 @@ +package com.icomsys.main_vm.db.jpa.entity.scenario; + + +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import org.hibernate.annotations.DynamicUpdate; + +import javax.persistence.*; +import java.time.LocalDateTime; + +@Table(name = "TB_SCENARIO_MASTER") +@Entity +@Getter +@Setter +@NoArgsConstructor +@DynamicUpdate +public class TbScenarioMaster { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "SEQ", nullable = false) + private Long seq; + @Column(name = "OPR_MNG_CODE", nullable = false, length = 50) + private String oprMngCode; + @Column(name = "SCENARIO_NAME", nullable = false, length = 50) + private String scenarioName; + @Column(name = "USE_YN", nullable = false, length = 1) + private String useYn; + @Column(name = "REGIST_ID", nullable = false, length = 20) + private String registId; + @Column(name = "REGIST_DATE", nullable = false) + private LocalDateTime registDate; + @Column(name = "UPDATE_ID", nullable = true, length = 20) + private String updateId; + @Column(name = "UPDATE_DATE", nullable = true) + private LocalDateTime updateDate; + + @Builder + public TbScenarioMaster(Long seq, String oprMngCode, String scenarioName, String useYn, String registId, LocalDateTime registDate, String updateId, LocalDateTime updateDate) { + this.seq = seq; + this.oprMngCode = oprMngCode; + this.scenarioName = scenarioName; + this.useYn = useYn; + this.registId = registId; + this.registDate = registDate; + this.updateId = updateId; + this.updateDate = updateDate; + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/scenario/TbScenarioRelatedIntent.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/scenario/TbScenarioRelatedIntent.java new file mode 100644 index 0000000..ea851e7 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/scenario/TbScenarioRelatedIntent.java @@ -0,0 +1,35 @@ +package com.icomsys.main_vm.db.jpa.entity.scenario; + +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import org.hibernate.annotations.DynamicUpdate; + +import javax.persistence.*; +import java.io.Serializable; +import java.time.LocalDateTime; + +@Table(name = "TB_SCENARIO_RELATED_INTENT") +@Entity +@Getter +@Setter +@NoArgsConstructor +@DynamicUpdate +@IdClass(TbScenarioRelatedIntent.class) +public class TbScenarioRelatedIntent implements Serializable { + + @Id + @Column(name = "SCENARIO_SEQ", nullable = false) + private Long scenarioSeq; + @Id + @Column(name = "INTENT_SEQ", nullable = false) + private Long intentSeq; + + @Builder + public TbScenarioRelatedIntent(Long scenarioSeq, Long intentSeq) { + this.scenarioSeq = scenarioSeq; + this.intentSeq = intentSeq; + + } +} \ No newline at end of file diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/scenario/TbScenarioRelease.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/scenario/TbScenarioRelease.java new file mode 100644 index 0000000..aa4cf2f --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/scenario/TbScenarioRelease.java @@ -0,0 +1,47 @@ +package com.icomsys.main_vm.db.jpa.entity.scenario; + +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import org.hibernate.annotations.DynamicUpdate; + +import javax.persistence.*; +import java.time.LocalDateTime; + +@Table(name = "TB_SCENARIO_RELEASE") +@Entity +@Getter +@Setter +@NoArgsConstructor +@DynamicUpdate +public class TbScenarioRelease { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "SEQ", nullable = false) + private Long seq; + @Column(name = "MASTER_SEQ", nullable = false) + private Long masterSeq; + @Column(name = "RELEASE_YN", nullable = false) + private String releaseYn; + @Column(name = "VERSION", nullable = false) + private int version; + @Column(name = "REGIST_ID", nullable = false, length = 20) + private String registId; + @Column(name = "REGIST_DATE", nullable = false) + private LocalDateTime registDate; + @Column(name = "INTENT_SEQ", nullable = false) + private Long intentSeq; + + @Builder + public TbScenarioRelease(Long seq, Long masterSeq, String releaseYn, int version, String registId, LocalDateTime registDate, Long intentSeq) { + this.seq = seq; + this.masterSeq = masterSeq; + this.releaseYn = releaseYn; + this.version = version; + this.registId = registId; + this.registDate = registDate; + this.intentSeq = intentSeq; + } +} \ No newline at end of file diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/scenario/TbScenarioTemplate.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/scenario/TbScenarioTemplate.java new file mode 100644 index 0000000..ef4047c --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/scenario/TbScenarioTemplate.java @@ -0,0 +1,35 @@ +package com.icomsys.main_vm.db.jpa.entity.scenario; + + +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import org.hibernate.annotations.DynamicUpdate; + +import javax.persistence.*; + +@Table(name = "TB_SCENARIO_TEMPLATE") +@Entity +@Getter +@Setter +@NoArgsConstructor +@DynamicUpdate +public class TbScenarioTemplate { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "SEQ", nullable = false) + private Long seq; + @Column(name = "TEMPLATE_NAME", nullable = false, length = 50) + private String templateName; + @Column(name = "USE_YN", nullable = false, length = 1) + private String useYn; + + @Builder + public TbScenarioTemplate(Long seq, String templateName, String useYn) { + this.seq = seq; + this.templateName = templateName; + this.useYn = useYn; + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/scenario/id/TbLongtextManagerId.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/scenario/id/TbLongtextManagerId.java new file mode 100644 index 0000000..a799fda --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/scenario/id/TbLongtextManagerId.java @@ -0,0 +1,20 @@ +package com.icomsys.main_vm.db.jpa.entity.scenario.id; + +import com.icomsys.main_vm.biz.rcp.conversation.vo.LongtextManagerVO; +import lombok.*; + +import javax.persistence.Column; +import javax.persistence.Id; +import java.io.Serializable; + +@Getter +@Setter +@AllArgsConstructor +@NoArgsConstructor +public class TbLongtextManagerId implements Serializable { + private Long rfSeq; + private int tableCode; + private int columnCode; + + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/scenario/id/TbScenarioRelatedIntentId.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/scenario/id/TbScenarioRelatedIntentId.java new file mode 100644 index 0000000..ac89443 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/scenario/id/TbScenarioRelatedIntentId.java @@ -0,0 +1,15 @@ +package com.icomsys.main_vm.db.jpa.entity.scenario.id; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +@Getter +@Setter +@AllArgsConstructor +@NoArgsConstructor +public class TbScenarioRelatedIntentId { + private Long scenarioSeq; + private Long intentSeq; +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/system/TbBotCommonCode.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/system/TbBotCommonCode.java new file mode 100644 index 0000000..e90bdca --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/system/TbBotCommonCode.java @@ -0,0 +1,130 @@ +package com.icomsys.main_vm.db.jpa.entity.system; + + +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.res.UserVo; +import com.icomsys.main_vm.biz.common.system.vo.SystemCommoncodeUpdateReq; +import com.icomsys.main_vm.biz.rcp.conversation.vo.RetrieveCustNameVo; +import com.icomsys.main_vm.biz.rcp.conversation.vo.TbBotCommonCodeVo; +import com.icomsys.main_vm.db.jpa.entity.system.id.TbBotCommonCodeId; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import org.hibernate.annotations.DynamicUpdate; + +import javax.persistence.*; +import java.time.LocalDateTime; + +@Table(name = "TB_BOT_COMMON_CODE") +@Entity +@Getter +@Setter +@NoArgsConstructor +@DynamicUpdate +@IdClass(TbBotCommonCodeId.class) +public class TbBotCommonCode { + + @Id + @Column(name = "CUST_CODE", nullable = false, length = 20) + private String custCode; + @Id + @Column(name = "MINOR_CODE", nullable = false, length = 20) + private String minorCode; + @Id + @Column(name = "MAJOR_CODE", nullable = false, length = 20) + private String majorCode; + @Id + @Column(name = "OPR_MNG_CODE", nullable = false, length = 40) + private String oprMngCode; + @Column(name = "CODE_NAME", nullable = true, length = 100) + private String codeName; + @Column(name = "ATTRIBUTE_1", nullable = true, length = 200) + private String attribute1; + @Column(name = "ATTRIBUTE_2", nullable = true, length = 200) + private String attribute2; + @Column(name = "ATTRIBUTE_3", nullable = true, length = 200) + private String attribute3; + @Column(name = "REGIST_ID", nullable = false, length = 20) + private String registId; + @Column(name = "REGIST_DATE", nullable = false) + private LocalDateTime registDate; + @Column(name = "UPDATE_ID", nullable = true, length = 20) + private String updateId; + @Column(name = "UPDATE_DATE", nullable = true) + private LocalDateTime updateDate; + + @Builder + public TbBotCommonCode(String custCode, String minorCode, String majorCode, String oprMngCode, String codeName, String attribute1, String attribute2, String attribute3, String registId, LocalDateTime registDate, String updateId, LocalDateTime updateDate) { + this.custCode = custCode; + this.minorCode = minorCode; + this.majorCode = majorCode; + this.oprMngCode = oprMngCode; + this.codeName = codeName; + this.attribute1 = attribute1; + this.attribute2 = attribute2; + this.attribute3 = attribute3; + this.registId = registId; + this.registDate = registDate; + this.updateId = updateId; + this.updateDate = updateDate; + } + + //Description 가 충돌나서 컨버팅 해주는 메소드 + public TbBotCommonCodeVo toDecs() { + TbBotCommonCodeVo tbccv = new TbBotCommonCodeVo(); + tbccv.setCustCode(this.custCode); + tbccv.setMajorCode(this.majorCode); + tbccv.setMinorCode(this.minorCode); + tbccv.setOprMngCode(this.oprMngCode); + tbccv.setCodeName(this.codeName); + tbccv.setAttribute1(this.attribute1); + tbccv.setAttribute2(this.attribute2); + tbccv.setAttribute3(this.attribute3); + tbccv.setRegistId(this.registId); + tbccv.setRegistDate(this.registDate); + tbccv.setUpdateId(this.updateId); + tbccv.setUpdateDate(this.updateDate); + return tbccv; + } + + public RetrieveCustNameVo toRetrieveCustName() { + RetrieveCustNameVo rcn = new RetrieveCustNameVo(); + rcn.setCodeName(this.codeName); + rcn.setMinorCode(this.minorCode); + return rcn; + } + + public TbBotCommonCode toUpdate(SystemCommoncodeUpdateReq dto, UserVo uv) throws CustomNotFoundException { + + if (dto.getAttribute1().equals(this.attribute1) && dto.getAttribute2().equals(this.attribute2) + && dto.getAttribute3().equals(this.attribute3) && dto.getCodeName().equals(this.codeName)) { + throw new CustomNotFoundException(); + } else { + if (dto.getAttribute1() != null && !dto.getAttribute1().equals("") && dto.getAttribute1() != this.attribute1) { + this.attribute1 = dto.getAttribute1(); + this.updateId = uv.getUserId(); + this.updateDate = LocalDateTime.now(); + } + if (dto.getAttribute2() != null && !dto.getAttribute2().equals("") && dto.getAttribute2() != this.attribute2) { + this.attribute2 = dto.getAttribute2(); + this.updateId = uv.getUserId(); + this.updateDate = LocalDateTime.now(); + } + if (dto.getAttribute3() != null && !dto.getAttribute3().equals("") && dto.getAttribute3() != this.attribute3) { + this.attribute3 = dto.getAttribute3(); + this.updateId = uv.getUserId(); + this.updateDate = LocalDateTime.now(); + } + if (dto.getCodeName() != null && !dto.getCodeName().equals("") && dto.getCodeName() != this.codeName) { + this.codeName = dto.getCodeName(); + this.updateId = uv.getUserId(); + this.updateDate = LocalDateTime.now(); + } + } + + return this; + } + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/system/TbBotUser.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/system/TbBotUser.java new file mode 100644 index 0000000..b737ab5 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/system/TbBotUser.java @@ -0,0 +1,169 @@ +package com.icomsys.main_vm.db.jpa.entity.system; + +import com.icomsys.main_vm.biz.common.login.res.UserVo; +import com.icomsys.main_vm.biz.common.system.vo.SystemBotUserUpdateReq; +import com.icomsys.main_vm.db.mybatis.alias.LoginVO; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import org.hibernate.annotations.DynamicUpdate; +import org.springframework.security.core.userdetails.User; +import org.springframework.security.crypto.password.PasswordEncoder; + +import javax.persistence.*; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; + +@Table(name = "TB_BOT_USER") +@Entity +@Getter +@Setter +@NoArgsConstructor +@DynamicUpdate +public class TbBotUser { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "USER_SEQ", nullable = false) + private Long userSeq; + @Column(name = "CUST_CODE", nullable = false, length = 20) + private String custCode; + @Column(name = "LAST_USE_SERVICE_GROUP", nullable = false, length = 20) + private String lastUseServiceGroup; + @Column(name = "ROLE_VAL", nullable = false, length = 100) + private String roleVal; + @Column(name = "USER_ID", nullable = false, length = 20) + private String userId; + @Column(name = "PASSWORD", nullable = false, length = 200) + private String password; + @Column(name = "USER_NAME", nullable = false, length = 20) + private String userName; + @Column(name = "E_MAIL", nullable = true, length = 50) + private String eMail; + @Column(name = "MOBILE_NO", nullable = true, length = 15) + private String mobileNo; + @Column(name = "LOGIN_CHECK", nullable = false, length = 10) + private int loginCheck; + @Column(name = "USE_YN", nullable = false, length = 1) + private String useYn; + @Column(name = "REGIST_ID", nullable = false, length = 20) + private String registId; + @Column(name = "REGIST_DATE", nullable = false) + private LocalDateTime registDate; + @Column(name = "UPDATE_ID", nullable = true, length = 20) + private String updateId; + @Column(name = "UPDATE_DATE", nullable = true) + private LocalDateTime updateDate; + + + @Builder + public TbBotUser(Long userSeq, String custCode, String lastUseServiceGroup, String roleVal, String userId, String password, 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.password = password; + 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; + } + + + public LoginVO toLoginVO() { + LoginVO re = new LoginVO(); + re.setUserId(this.userId); + re.setUserName(this.userName); + re.setPassword(this.password); + re.seteMail(this.eMail); + re.setSiteCode(this.custCode); + re.setSystemUserId(this.userSeq.toString()); + re.setAuthCode(this.roleVal); + re.setLoginCheck(this.loginCheck); + re.setUpdate_date(this.updateDate.format(DateTimeFormatter.ofPattern("yyyyMMdd"))); + return re; + } + + public UserVo toUserVO() { + UserVo uv = new UserVo(); + uv.setUserSeq(this.userSeq); + uv.setCustCode(this.custCode); + uv.setLastUseServiceGroup(this.lastUseServiceGroup); + uv.setRoleVal(this.roleVal); + uv.setUserId(this.userId); + uv.setUserName(this.userName); + uv.setEMail(this.eMail); + uv.setMobileNo(this.mobileNo); + uv.setLoginCheck(this.loginCheck); + uv.setUseYn(this.useYn); + uv.setRegistId(this.registId); + uv.setRegistDate(this.registDate); + uv.setUpdateId(this.updateId); + uv.setUpdateDate(this.updateDate); + return uv; + } + + + public TbBotUser resetLoginFailCheck() { + this.loginCheck = 0; + return this; + } + + public TbBotUser loginFailCheck() { + this.loginCheck += 1; + return this; + } + + public TbBotUser useYn(String use) { + this.useYn = use; + return this; + } + + public TbBotUser updateLastService(String lastService) { + this.lastUseServiceGroup = lastService; + return this; + } + + public TbBotUser updatePassword(String pass) { + this.password = pass; + this.updateDate = LocalDateTime.now(); + return this; + } + + + + public TbBotUser toUpdate(SystemBotUserUpdateReq dto, UserVo uv, PasswordEncoder pe) { + if (this.roleVal != dto.getRoleVal()) { + this.roleVal = dto.getRoleVal(); + } + if (dto.getUserId() != null && !dto.getUserId().equals("") && this.userId != dto.getUserId()) { + this.userId = dto.getUserId(); + } + if (dto.getUserPass() != null && !dto.getUserPass().equals("")) { + this.password = pe.encode(dto.getUserPass()); + } + if (dto.getUserName() != null && !dto.getUserName().equals("") && this.userName != dto.getUserName()) { + this.userName = dto.getUserName(); + } + if (dto.getEmail() != null && !dto.getEmail().equals("") && this.eMail != dto.getEmail()) { + this.eMail = dto.getEmail(); + } + if (dto.getMobileNo() != null && !dto.getMobileNo().equals("") && this.mobileNo != dto.getMobileNo()) { + this.mobileNo = dto.getMobileNo(); + } + if (dto.getUseYn() != null && !dto.getUseYn().equals("") && this.useYn != dto.getUseYn()) { + this.useYn = dto.getUseYn(); + } + this.loginCheck = dto.getLoginCheck(); + this.updateId = uv.getUserId(); + this.updateDate = LocalDateTime.now(); + return this; + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/system/TbCustPolicy.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/system/TbCustPolicy.java new file mode 100644 index 0000000..1ceff6f --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/system/TbCustPolicy.java @@ -0,0 +1,38 @@ +package com.icomsys.main_vm.db.jpa.entity.system; + +import com.icomsys.main_vm.db.jpa.entity.system.id.TbCustPolicyId; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import org.hibernate.annotations.DynamicUpdate; + +import javax.persistence.*; + +@Table(name = "TB_CUST_POLICY") +@Entity +@Getter +@Setter +@NoArgsConstructor +@DynamicUpdate +@IdClass(TbCustPolicyId.class) +public class TbCustPolicy { + + @Id + @Column(name = "SERVICE_GROUP", nullable = false, length = 20) + private String serviceGroup; + @Id + @Column(name = "POLICY_VAL", nullable = false, length = 50) + private String policyVal; + @Id + @Column(name = "CUST_CODE", nullable = false, length = 20) + private String custCode; + + @Builder + public TbCustPolicy(String serviceGroup, String policyVal, String custCode) { + this.serviceGroup = serviceGroup; + this.policyVal = policyVal; + this.custCode = custCode; + } + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/system/TbIcsCustInfo.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/system/TbIcsCustInfo.java new file mode 100644 index 0000000..8ed1ea4 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/system/TbIcsCustInfo.java @@ -0,0 +1,69 @@ +package com.icomsys.main_vm.db.jpa.entity.system; + +import com.icomsys.main_vm.biz.common.login.res.UserVo; +import com.icomsys.main_vm.biz.common.system.vo.SystemCustSaveReq; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import org.hibernate.annotations.DynamicUpdate; + +import javax.persistence.*; +import java.time.LocalDateTime; + +@Table(name = "TB_ICS_CUST_INFO") +@Entity +@Getter +@Setter +@NoArgsConstructor +@DynamicUpdate +public class TbIcsCustInfo { + + @Id + @Column(name = "CUST_CODE", nullable = false, length = 20) + private String custCode; + @Column(name = "CUST_NAME", nullable = false, length = 50) + private String custName; + @Column(name = "CUST_TEL", nullable = true, length = 20) + private String custTel; + @Column(name = "CUST_SERVICE_MENT", nullable = true, length = 500) + private String custServiceMent; + @Column(name = "USE_YN", nullable = false, length = 1) + private String useYn; + @Column(name = "REGIST_ID", nullable = false, length = 20) + private String registId; + @Column(name = "REGIST_DATE", nullable = false) + private LocalDateTime registDate; + @Column(name = "UPDATE_ID", nullable = true, length = 20) + private String updateId; + @Column(name = "UPDATE_DATE", nullable = true) + private LocalDateTime updateDate; + + @Builder + public TbIcsCustInfo(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 TbIcsCustInfo UpdateCust(SystemCustSaveReq dto, UserVo uv) { + if (dto.getCustName() != null && !dto.getCustName().equals("") && dto.getCustName() != this.custName) { + this.custName = dto.getCustName(); + } + if (dto.getCustUseYn() != null && !dto.getCustUseYn().equals("") && dto.getCustUseYn() != this.useYn) { + this.useYn = dto.getCustUseYn(); + } +// this.custTel = custTel; +// this.custServiceMent = custServiceMent; + this.updateId = uv.getUserId(); + this.updateDate = LocalDateTime.now(); + return this; + } + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/system/TbIcsOprMngInfo.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/system/TbIcsOprMngInfo.java new file mode 100644 index 0000000..79a0d49 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/system/TbIcsOprMngInfo.java @@ -0,0 +1,63 @@ +package com.icomsys.main_vm.db.jpa.entity.system; + +import com.icomsys.main_vm.db.jpa.entity.system.id.TbIcsOprMngInfoId; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import org.hibernate.annotations.DynamicUpdate; + +import javax.persistence.*; +import java.time.LocalDateTime; + +@Table(name = "TB_ICS_OPR_MNG_INFO") +@Entity +@Getter +@Setter +@NoArgsConstructor +@DynamicUpdate +@IdClass(TbIcsOprMngInfoId.class) +public class TbIcsOprMngInfo { + + @Id + @Column(name = "CUST_CODE", nullable = false, length = 40) + private String custCode; + @Id + @Column(name = "SERVICE_CODE", nullable = false, length = 40) + private String serviceGroup; + @Id + @Column(name = "OPR_MNG_CODE", nullable = false, length = 100) + private String oprMngCode; + @Id + @Column(name = "SOL_VAL", nullable = false, length = 40) + private String solVal; + @Column(name = "DTMF", nullable = true) + private int dtmf; + @Column(name = "ROUTE_URL", nullable = true, length = 200) + private String routeUrl; + @Column(name = "USE_YN", nullable = false, length = 1) + private String useYn; + @Column(name = "REGIST_ID", nullable = false, length = 20) + private String registId; + @Column(name = "REGIST_DATE", nullable = false) + private LocalDateTime registDate; + @Column(name = "UPDATE_ID", nullable = true, length = 20) + private String updateId; + @Column(name = "UPDATE_DATE", nullable = true) + private LocalDateTime updateDate; + + @Builder + public TbIcsOprMngInfo(String custCode, String serviceGroup, String oprMngCode, String solVal, int dtmf, String routeUrl, String useYn, String registId, LocalDateTime registDate, String updateId, LocalDateTime updateDate) { + this.custCode = custCode; + this.serviceGroup = serviceGroup; + this.oprMngCode = oprMngCode; + this.solVal = solVal; + this.dtmf = dtmf; + this.routeUrl = routeUrl; + this.useYn = useYn; + this.registId = registId; + this.registDate = registDate; + this.updateId = updateId; + this.updateDate = updateDate; + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/system/TbServiceAuthGroup.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/system/TbServiceAuthGroup.java new file mode 100644 index 0000000..05636a0 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/system/TbServiceAuthGroup.java @@ -0,0 +1,76 @@ +package com.icomsys.main_vm.db.jpa.entity.system; + +import com.icomsys.main_vm.db.jpa.entity.system.id.TbServiceAuthGroupId; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import org.hibernate.annotations.DynamicUpdate; + +import javax.persistence.*; +import java.time.LocalDateTime; + +@Table(name = "TB_SERVICE_AUTH_GROUP") +@Entity +@Getter +@Setter +@NoArgsConstructor +@DynamicUpdate +public class TbServiceAuthGroup { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "AUTH_GROUP_SEQ", nullable = false) + private Long authGroupSeq; + @Column(name = "SERVICE_GROUP", nullable = false, length = 20) + private String serviceGroup; + @Column(name = "CUST_CODE", nullable = false, length = 20) + private String custCode; + @Column(name = "POLICY_GROUP_NAME", nullable = false, length = 50) + private String policyGroupName; + @Column(name = "POLICY_GROUP_DESC", nullable = true, length = 50) + private String policyGroupDesc; + @Column(name = "USE_YN", nullable = false, length = 1) + private String useYn; + @Column(name = "REGIST_ID", nullable = false, length = 20) + private String registId; + @Column(name = "REGIST_DATE", nullable = false) + private LocalDateTime registDate; + @Column(name = "UPDATE_ID", nullable = true, length = 20) + private String updateId; + @Column(name = "UPDATE_DATE", nullable = true) + private LocalDateTime updateDate; + + @Builder + public TbServiceAuthGroup(Long authGroupSeq, String serviceGroup, String custCode, String policyGroupName, String policyGroupDesc, String useYn, String registId, LocalDateTime registDate, String updateId, LocalDateTime updateDate) { + this.authGroupSeq = authGroupSeq; + this.serviceGroup = serviceGroup; + this.custCode = custCode; + this.policyGroupName = policyGroupName; + this.policyGroupDesc = policyGroupDesc; + this.useYn = useYn; + this.registId = registId; + this.registDate = registDate; + this.updateId = updateId; + this.updateDate = updateDate; + } + + public TbServiceAuthGroup TbServiceAuthGroupModify(TbServiceAuthGroup dto){ + + if(dto.authGroupSeq != null || !dto.authGroupSeq.equals("")){ + this.authGroupSeq = dto.authGroupSeq; + } + if(dto.policyGroupName != null || !dto.policyGroupName.equals("")){ + this.policyGroupName = dto.policyGroupName; + } + if(dto.policyGroupDesc != null || !dto.policyGroupDesc.equals("")){ + this.policyGroupDesc = dto.policyGroupDesc; + } + + this.updateId = dto.updateId; + this.updateDate = dto.updateDate; + + return this; + } + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/system/TbServiceGrouop.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/system/TbServiceGrouop.java new file mode 100644 index 0000000..52fb927 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/system/TbServiceGrouop.java @@ -0,0 +1,105 @@ +package com.icomsys.main_vm.db.jpa.entity.system; + +import com.icomsys.main_vm.biz.common.login.res.UserVo; +import com.icomsys.main_vm.biz.common.system.vo.SystemCustSaveSubReq; +import com.icomsys.main_vm.biz.common.system.vo.SystemServiceGroupUpdateReq; +import com.icomsys.main_vm.db.jpa.entity.system.id.TbServiceGrouopId; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import org.hibernate.annotations.DynamicUpdate; + +import javax.persistence.*; +import java.time.LocalDateTime; + +@Table(name = "TB_SERVICE_GROUP") +@Entity +@Getter +@Setter +@NoArgsConstructor +@DynamicUpdate +@IdClass(TbServiceGrouopId.class) +public class TbServiceGrouop { + + @Id + @Column(name = "SERVICE_GROUP", nullable = false, length = 20) + private String serviceGroup; + @Id + @Column(name = "SERVICE_GROUP_UPPER", nullable = false, length = 20) + private String serviceGroupUpper; + @Id + @Column(name = "CUST_CODE", nullable = false, length = 20) + private String custCode; + @Column(name = "SERVICE_TYPE", nullable = false, length = 1) + private String serviceType; + @Column(name = "SERVICE_GROUP_NAME", nullable = false, length = 50) + private String serviceGroupName; + @Column(name = "SERVICE_GROUP_DESC", nullable = true, length = 100) + private String serviceGroupDesc; + @Column(name = "USE_YN", nullable = false, length = 1) + private String useYn; + @Column(name = "REGIST_ID", nullable = false, length = 20) + private String registId; + @Column(name = "REGIST_DATE", nullable = false) + private LocalDateTime registDate; + @Column(name = "UPDATE_ID", nullable = true, length = 20) + private String updateId; + @Column(name = "UPDATE_DATE", nullable = true) + private LocalDateTime updateDate; + + @Builder + public TbServiceGrouop(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 TbServiceGrouop toUpdateMainService(SystemCustSaveSubReq dto, UserVo uv) { + if (dto.getAddServiceGroupName() != null && !dto.getAddServiceGroupName().equals("")) { + this.serviceGroupName = dto.getAddServiceGroupName(); + this.updateId = uv.getUserId(); + this.updateDate = LocalDateTime.now(); + } + if (dto.getAddServiceGroupDesc() != null && !dto.getAddServiceGroupDesc().equals("")) { + this.serviceGroupDesc = dto.getAddServiceGroupDesc(); + this.updateId = uv.getUserId(); + this.updateDate = LocalDateTime.now(); + } + if (dto.getAddUseYn() != null && !dto.getAddUseYn().equals("")) { + this.useYn = dto.getAddUseYn(); + this.updateId = uv.getUserId(); + this.updateDate = LocalDateTime.now(); + } + return this; + } + + public TbServiceGrouop toUpdateSubService(SystemServiceGroupUpdateReq dto, UserVo uv) { + if (dto.getSubServiceGroupName() != null && !dto.getSubServiceGroupName().equals("") && this.serviceGroupName != dto.getSubServiceGroupName()) { + this.serviceGroupName = dto.getSubServiceGroupName(); + this.updateId = uv.getUserId(); + this.updateDate = LocalDateTime.now(); + } + if (dto.getSubServiceGroupDesc() != null && !dto.getSubServiceGroupDesc().equals("") && this.serviceGroupDesc != dto.getSubServiceGroupDesc()) { + this.serviceGroupDesc = dto.getSubServiceGroupDesc(); + this.updateId = uv.getUserId(); + this.updateDate = LocalDateTime.now(); + } + if (dto.getSubUseYn() != null && !dto.getSubUseYn().equals("") && this.useYn != dto.getSubUseYn()) { + this.useYn = dto.getSubUseYn(); + this.updateId = uv.getUserId(); + this.updateDate = LocalDateTime.now(); + } + return this; + + } + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/system/TbServiceGroupPolicy.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/system/TbServiceGroupPolicy.java new file mode 100644 index 0000000..4ee464b --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/system/TbServiceGroupPolicy.java @@ -0,0 +1,42 @@ +package com.icomsys.main_vm.db.jpa.entity.system; + + +import com.icomsys.main_vm.db.jpa.entity.system.id.TbServiceGroupPolicyId; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import org.hibernate.annotations.DynamicUpdate; + +import javax.persistence.*; + +@Table(name = "TB_SERVICE_GROUP_POLICY") +@Entity +@Getter +@Setter +@NoArgsConstructor +@DynamicUpdate +@IdClass(TbServiceGroupPolicyId.class) +public class TbServiceGroupPolicy { + + @Id + @Column(name = "AUTH_GROUP_SEQ", nullable = false) + private Long authGroupSeq; + @Id + @Column(name = "SERVICE_GROUP", nullable = false, length = 20) + private String serviceGroup; + @Id + @Column(name = "POLICY_VAL", nullable = false, length = 50) + private String policyVal; + @Id + @Column(name = "CUST_CODE", nullable = false, length = 20) + private String custCode; + + @Builder + public TbServiceGroupPolicy(Long authGroupSeq, String serviceGroup, String policyVal, String custCode) { + this.authGroupSeq = authGroupSeq; + this.serviceGroup = serviceGroup; + this.policyVal = policyVal; + this.custCode = custCode; + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/system/TbUserAuthGroup.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/system/TbUserAuthGroup.java new file mode 100644 index 0000000..11451d1 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/system/TbUserAuthGroup.java @@ -0,0 +1,41 @@ +package com.icomsys.main_vm.db.jpa.entity.system; + +import com.icomsys.main_vm.db.jpa.entity.system.id.TbUserAuthGroupId; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import org.hibernate.annotations.DynamicUpdate; + +import javax.persistence.*; + +@Table(name = "TB_USER_AUTH_GROUP") +@Entity +@Getter +@Setter +@NoArgsConstructor +@DynamicUpdate +@IdClass(TbUserAuthGroupId.class) +public class TbUserAuthGroup { + + @Id + @Column(name = "USER_SEQ", nullable = false) + private Long userSeq; + @Id + @Column(name = "AUTH_GROUP_SEQ", nullable = false) + private Long authGroupSeq; + @Id + @Column(name = "SERVICE_GROUP", nullable = false, length = 20) + private String serviceGroup; + @Id + @Column(name = "CUST_CODE", nullable = false, length = 20) + private String custCode; + + @Builder + public TbUserAuthGroup(Long userSeq, Long authGroupSeq, String serviceGroup, String custCode) { + this.userSeq = userSeq; + this.authGroupSeq = authGroupSeq; + this.serviceGroup = serviceGroup; + this.custCode = custCode; + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/system/TbUserCust.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/system/TbUserCust.java new file mode 100644 index 0000000..cddd7ea --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/system/TbUserCust.java @@ -0,0 +1,40 @@ +package com.icomsys.main_vm.db.jpa.entity.system; + +import com.icomsys.main_vm.db.jpa.entity.system.id.TbUserCustId; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import org.hibernate.annotations.DynamicUpdate; + +import javax.persistence.*; + +@Table(name = "TB_USER_CUST") +@Entity +@Getter +@Setter +@NoArgsConstructor +@DynamicUpdate +@IdClass(TbUserCustId.class) +public class TbUserCust { + + @Id + @Column(name = "CUST_CODE", nullable = false, length = 20) + private String custCode; + @Id + @Column(name = "SERVICE_GROUP", nullable = false, length = 20) + private String serviceGroup; + @Id + @Column(name = "USER_SEQ", nullable = false) + private Long userSeq; +// @Id +// @Column(name = "LAST_USE_SERVICE_GROUP", nullable = false) +// private String lastUseServiceGroup; + + @Builder + public TbUserCust(String custCode, String serviceGroup, Long userSeq) { + this.custCode = custCode; + this.serviceGroup = serviceGroup; + this.userSeq = userSeq; + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/system/id/TbBotCommonCodeId.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/system/id/TbBotCommonCodeId.java new file mode 100644 index 0000000..5a07fb6 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/system/id/TbBotCommonCodeId.java @@ -0,0 +1,25 @@ +package com.icomsys.main_vm.db.jpa.entity.system.id; + +import lombok.*; + +import java.io.Serializable; + +@Getter +@Setter +@NoArgsConstructor +public class TbBotCommonCodeId implements Serializable { + + private String custCode; + private String minorCode; + private String majorCode; + private String oprMngCode; + + @Builder + public TbBotCommonCodeId(String custCode, String minorCode, String majorCode, String oprMngCode) { + this.custCode = custCode; + this.minorCode = minorCode; + this.majorCode = majorCode; + this.oprMngCode = oprMngCode; + } + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/system/id/TbBotTtsTagId.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/system/id/TbBotTtsTagId.java new file mode 100644 index 0000000..69b3a46 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/system/id/TbBotTtsTagId.java @@ -0,0 +1,23 @@ +package com.icomsys.main_vm.db.jpa.entity.system.id; + +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +import java.io.Serializable; + +@Getter +@Setter +@NoArgsConstructor +public class TbBotTtsTagId implements Serializable { + + private String ttsProdCode; + private String tagCode; + + @Builder + public TbBotTtsTagId(String ttsProdCode, String tagCode) { + this.ttsProdCode = ttsProdCode; + this.tagCode = tagCode; + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/system/id/TbBotUserId.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/system/id/TbBotUserId.java new file mode 100644 index 0000000..6bf78fb --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/system/id/TbBotUserId.java @@ -0,0 +1,16 @@ + +package com.icomsys.main_vm.db.jpa.entity.system.id; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class TbBotUserId implements Serializable { + + private Long userSeq; + private String custCode; + private String lastUseServiceGroup; + private String roleVal; + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/system/id/TbCustPolicyId.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/system/id/TbCustPolicyId.java new file mode 100644 index 0000000..b8c48b5 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/system/id/TbCustPolicyId.java @@ -0,0 +1,22 @@ +package com.icomsys.main_vm.db.jpa.entity.system.id; + +import lombok.*; + +import java.io.Serializable; + +@Getter +@Setter +@NoArgsConstructor +public class TbCustPolicyId implements Serializable { + + private String serviceGroup; + private String policyVal; + private String custCode; + + @Builder + public TbCustPolicyId(String serviceGroup, String policyVal, String custCode) { + this.serviceGroup = serviceGroup; + this.policyVal = policyVal; + this.custCode = custCode; + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/system/id/TbIcsOprMngInfoId.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/system/id/TbIcsOprMngInfoId.java new file mode 100644 index 0000000..1f964ad --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/system/id/TbIcsOprMngInfoId.java @@ -0,0 +1,13 @@ +package com.icomsys.main_vm.db.jpa.entity.system.id; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class TbIcsOprMngInfoId implements Serializable { + + private String custCode; + private String serviceGroup; + private String oprMngCode; +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/system/id/TbServiceAuthGroupId.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/system/id/TbServiceAuthGroupId.java new file mode 100644 index 0000000..ed915a1 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/system/id/TbServiceAuthGroupId.java @@ -0,0 +1,14 @@ +package com.icomsys.main_vm.db.jpa.entity.system.id; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class TbServiceAuthGroupId implements Serializable { + + private Long authGroupSeq; + private String serviceGroup; + private String custCode; + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/system/id/TbServiceGrouopId.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/system/id/TbServiceGrouopId.java new file mode 100644 index 0000000..3252fab --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/system/id/TbServiceGrouopId.java @@ -0,0 +1,14 @@ +package com.icomsys.main_vm.db.jpa.entity.system.id; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class TbServiceGrouopId implements Serializable { + + private String serviceGroup; + private String custCode; + private String serviceGroupUpper; + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/system/id/TbServiceGroupPolicyId.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/system/id/TbServiceGroupPolicyId.java new file mode 100644 index 0000000..ea021b7 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/system/id/TbServiceGroupPolicyId.java @@ -0,0 +1,23 @@ +package com.icomsys.main_vm.db.jpa.entity.system.id; + +import lombok.*; + +import java.io.Serializable; + +@Getter +@Setter +@NoArgsConstructor +public class TbServiceGroupPolicyId implements Serializable { + private Long authGroupSeq; + private String serviceGroup; + private String policyVal; + private String custCode; + + @Builder + public TbServiceGroupPolicyId(Long authGroupSeq, String serviceGroup, String policyVal, String custCode) { + this.authGroupSeq = authGroupSeq; + this.serviceGroup = serviceGroup; + this.policyVal = policyVal; + this.custCode = custCode; + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/system/id/TbUserAuthGroupId.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/system/id/TbUserAuthGroupId.java new file mode 100644 index 0000000..5d66a49 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/system/id/TbUserAuthGroupId.java @@ -0,0 +1,24 @@ +package com.icomsys.main_vm.db.jpa.entity.system.id; + +import lombok.*; + +import java.io.Serializable; + +@Getter +@Setter +@NoArgsConstructor +public class TbUserAuthGroupId implements Serializable { + + private Long userSeq; + private Long authGroupSeq; + private String serviceGroup; + private String custCode; + + @Builder + public TbUserAuthGroupId(Long userSeq, Long authGroupSeq, String serviceGroup, String custCode) { + this.userSeq = userSeq; + this.authGroupSeq = authGroupSeq; + this.serviceGroup = serviceGroup; + this.custCode = custCode; + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/system/id/TbUserCustId.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/system/id/TbUserCustId.java new file mode 100644 index 0000000..8a6b3f7 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/entity/system/id/TbUserCustId.java @@ -0,0 +1,22 @@ +package com.icomsys.main_vm.db.jpa.entity.system.id; + +import lombok.*; + +import java.io.Serializable; + +@Getter +@Setter +@NoArgsConstructor +public class TbUserCustId implements Serializable { + + private String custCode; + private String serviceGroup; + private Long userSeq; + + @Builder + public TbUserCustId(String custCode, String serviceGroup, Long userSeq) { + this.custCode = custCode; + this.serviceGroup = serviceGroup; + this.userSeq = userSeq; + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/conversation/TbProjectSettingRepo.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/conversation/TbProjectSettingRepo.java new file mode 100644 index 0000000..b8761de --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/conversation/TbProjectSettingRepo.java @@ -0,0 +1,16 @@ +package com.icomsys.main_vm.db.jpa.repo.conversation; + +import com.icomsys.main_vm.db.jpa.entity.conversation.TbProjectSetting; +import com.icomsys.main_vm.db.jpa.repo.conversation.dsl.TbProjectSettingRepoDsl; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +import java.util.Optional; + +public interface TbProjectSettingRepo extends JpaRepository, TbProjectSettingRepoDsl { + + Optional findByOprMngCode(String serviceCode); + + + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/conversation/dsl/TbProjectSettingRepoDsl.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/conversation/dsl/TbProjectSettingRepoDsl.java new file mode 100644 index 0000000..9d93f13 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/conversation/dsl/TbProjectSettingRepoDsl.java @@ -0,0 +1,17 @@ +package com.icomsys.main_vm.db.jpa.repo.conversation.dsl; + +import com.icomsys.main_vm.biz.rcp.conversation.vo.ProjectSettingVO; +import com.icomsys.main_vm.biz.rcp.conversation.vo.SelectSimilarityCriteriaVO; +import com.icomsys.main_vm.biz.rcp.learningTest.vo.SelectProjectSettingInfoVO; + +import java.util.List; + +public interface TbProjectSettingRepoDsl { + + List selectSimilarityCriteria(String serviceGroup); + + void updateServiceInfo(ProjectSettingVO vo); + + SelectProjectSettingInfoVO selectProjectSettingInfo(String serviceGroup); + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/conversation/dsl/TbProjectSettingRepoDslImpl.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/conversation/dsl/TbProjectSettingRepoDslImpl.java new file mode 100644 index 0000000..fd93f65 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/conversation/dsl/TbProjectSettingRepoDslImpl.java @@ -0,0 +1,82 @@ +package com.icomsys.main_vm.db.jpa.repo.conversation.dsl; + +import com.icomsys.main_vm.biz.rcp.conversation.vo.ProjectSettingVO; +import com.icomsys.main_vm.biz.rcp.conversation.vo.SelectSimilarityCriteriaVO; +import com.icomsys.main_vm.biz.rcp.learningTest.vo.SelectProjectSettingInfoVO; +import com.icomsys.main_vm.db.jpa.entity.conversation.QTbProjectSetting; +import com.icomsys.main_vm.db.jpa.entity.system.QTbBotUser; +import com.icomsys.main_vm.db.jpa.entity.system.QTbIcsOprMngInfo; +import com.querydsl.core.types.Projections; +import com.querydsl.jpa.impl.JPAQueryFactory; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.aspectj.lang.annotation.Aspect; + +import java.time.LocalDateTime; +import java.util.List; + +@Aspect +@Slf4j +@RequiredArgsConstructor +public class TbProjectSettingRepoDslImpl implements TbProjectSettingRepoDsl{ + + private final JPAQueryFactory queryFactory; + private QTbProjectSetting qTbProjectSetting = QTbProjectSetting.tbProjectSetting; + + @Override + public List selectSimilarityCriteria(String serviceGroup) { + var result = queryFactory.select(Projections.fields( + SelectSimilarityCriteriaVO.class, + qTbProjectSetting.oprMngCode, + qTbProjectSetting.similarityCriteria, + qTbProjectSetting.classCriteria, + qTbProjectSetting.classResultCriteria, + qTbProjectSetting.fallbackMsg, + qTbProjectSetting.greetingMsg + ) + ).from(qTbProjectSetting) + .where(qTbProjectSetting.oprMngCode.eq(serviceGroup)) + .fetch(); + + return result; + } + + public void updateServiceInfo(ProjectSettingVO vo){ + com.querydsl.jpa.impl.JPAUpdateClause query = null; + + query = queryFactory.update(qTbProjectSetting) + .set(qTbProjectSetting.similarityCriteria, vo.getSimilarityCriteria()) + .set(qTbProjectSetting.classCriteria, vo.getClassCriteria()) + .set(qTbProjectSetting.classResultCriteria, vo.getClassResultCriteria()) + .set(qTbProjectSetting.fallbackMsg, vo.getFallbackMsg()) + .set(qTbProjectSetting.greetingMsg, vo.getGreetingMsg()) + .set(qTbProjectSetting.updateId, vo.getUpdateId()) + .set(qTbProjectSetting.updateDate, LocalDateTime.now()) + .where(qTbProjectSetting.oprMngCode.eq(vo.getOprMngCode())); + query.execute(); + + } + + @Override + public SelectProjectSettingInfoVO selectProjectSettingInfo(String serviceGroup) { + var result = queryFactory.select(Projections.fields( + SelectProjectSettingInfoVO.class, + qTbProjectSetting.oprMngCode, + qTbProjectSetting.similarityCriteria, + qTbProjectSetting.classCriteria, + qTbProjectSetting.classResultCriteria, + qTbProjectSetting.fallbackMsg, + qTbProjectSetting.greetingMsg, + qTbProjectSetting.ifMappingId, + qTbProjectSetting.registId, + qTbProjectSetting.registDate, + qTbProjectSetting.updateId, + qTbProjectSetting.updateDate + ) + ).from(qTbProjectSetting) + .where(qTbProjectSetting.oprMngCode.eq(serviceGroup)) + .fetchOne(); + return result; + } + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/learningTest/TbIntentTestRepo.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/learningTest/TbIntentTestRepo.java new file mode 100644 index 0000000..c87f577 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/learningTest/TbIntentTestRepo.java @@ -0,0 +1,12 @@ +package com.icomsys.main_vm.db.jpa.repo.learningTest; + +import com.icomsys.main_vm.db.jpa.entity.learningTest.TbIntentTest; +import com.icomsys.main_vm.db.jpa.repo.learningTest.dsl.TbIntentTestDslRepo; +import org.springframework.data.jpa.repository.JpaRepository; + +import java.util.Optional; + +public interface TbIntentTestRepo extends JpaRepository, TbIntentTestDslRepo { + + Optional findByOprMngCode(String oprMngCode); +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/learningTest/dsl/TbIntentTestDslRepo.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/learningTest/dsl/TbIntentTestDslRepo.java new file mode 100644 index 0000000..f7025c1 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/learningTest/dsl/TbIntentTestDslRepo.java @@ -0,0 +1,10 @@ +package com.icomsys.main_vm.db.jpa.repo.learningTest.dsl; + +import com.icomsys.main_vm.biz.rcp.learningTest.vo.SelectIntentTestVO; + +import java.util.List; + +public interface TbIntentTestDslRepo { + + List selectIntentTestList (String oprMngCode); +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/learningTest/dsl/TbIntentTestDslRepoImpl.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/learningTest/dsl/TbIntentTestDslRepoImpl.java new file mode 100644 index 0000000..6327aef --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/learningTest/dsl/TbIntentTestDslRepoImpl.java @@ -0,0 +1,43 @@ +package com.icomsys.main_vm.db.jpa.repo.learningTest.dsl; + +import com.icomsys.main_vm.biz.rcp.learningTest.vo.SelectIntentTestVO; +import com.icomsys.main_vm.db.jpa.entity.learningTest.QTbIntentTest; +import com.querydsl.core.types.Projections; +import com.querydsl.jpa.impl.JPAQueryFactory; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.aspectj.lang.annotation.Aspect; + +import java.util.List; + +@Aspect +@Slf4j +@RequiredArgsConstructor +public class TbIntentTestDslRepoImpl implements TbIntentTestDslRepo { + + private final JPAQueryFactory queryFactory; + private QTbIntentTest qTbIntentTest = QTbIntentTest.tbIntentTest; + + @Override + public List selectIntentTestList (String oprMngCode) { + + var result = queryFactory.select( + Projections.fields( + SelectIntentTestVO.class, + qTbIntentTest.seq, + qTbIntentTest.rowNum, + qTbIntentTest.uploadFileName, + qTbIntentTest.testCnt, + qTbIntentTest.updateId.as("testId"), + qTbIntentTest.updateDate.as("testDate"), + qTbIntentTest.testResult + ) + ) + .from(qTbIntentTest) + .where(qTbIntentTest.oprMngCode.eq(oprMngCode)) + .orderBy(qTbIntentTest.updateDate.desc()) + .fetch(); + + return result; + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/monitoring/TbCallBotLogRepo.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/monitoring/TbCallBotLogRepo.java new file mode 100644 index 0000000..d93029f --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/monitoring/TbCallBotLogRepo.java @@ -0,0 +1,8 @@ +package com.icomsys.main_vm.db.jpa.repo.monitoring; + +import com.icomsys.main_vm.db.jpa.entity.monitoring.TbCallBotLog; +import com.icomsys.main_vm.db.jpa.entity.monitoring.id.TbCallBotLogId; +import org.springframework.data.jpa.repository.JpaRepository; + +public interface TbCallBotLogRepo extends JpaRepository { +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/monitoring/TbCallBotRecRepo.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/monitoring/TbCallBotRecRepo.java new file mode 100644 index 0000000..7e34434 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/monitoring/TbCallBotRecRepo.java @@ -0,0 +1,8 @@ +package com.icomsys.main_vm.db.jpa.repo.monitoring; + +import com.icomsys.main_vm.db.jpa.entity.monitoring.TbCallBotRec; +import com.icomsys.main_vm.db.jpa.entity.monitoring.id.TbCallRecId; +import org.springframework.data.jpa.repository.JpaRepository; + +public interface TbCallBotRecRepo extends JpaRepository { +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/monitoring/TbCallInfoRepo.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/monitoring/TbCallInfoRepo.java new file mode 100644 index 0000000..66d50d8 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/monitoring/TbCallInfoRepo.java @@ -0,0 +1,8 @@ +package com.icomsys.main_vm.db.jpa.repo.monitoring; + +import com.icomsys.main_vm.db.jpa.entity.monitoring.TbCallInfo; +import com.icomsys.main_vm.db.jpa.entity.monitoring.id.TbCallInfoId; +import org.springframework.data.jpa.repository.JpaRepository; + +public interface TbCallInfoRepo extends JpaRepository { +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/monitoring/TbCallUserLogRepo.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/monitoring/TbCallUserLogRepo.java new file mode 100644 index 0000000..4b1f1c8 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/monitoring/TbCallUserLogRepo.java @@ -0,0 +1,8 @@ +package com.icomsys.main_vm.db.jpa.repo.monitoring; + +import com.icomsys.main_vm.db.jpa.entity.monitoring.TbCallUserLog; +import com.icomsys.main_vm.db.jpa.entity.monitoring.id.TbCallUserLogId; +import org.springframework.data.jpa.repository.JpaRepository; + +public interface TbCallUserLogRepo extends JpaRepository { +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/monitoring/TbCallUserRecRepo.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/monitoring/TbCallUserRecRepo.java new file mode 100644 index 0000000..6548da8 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/monitoring/TbCallUserRecRepo.java @@ -0,0 +1,9 @@ +package com.icomsys.main_vm.db.jpa.repo.monitoring; + +import com.icomsys.main_vm.db.jpa.entity.monitoring.TbCallBotRec; +import com.icomsys.main_vm.db.jpa.entity.monitoring.TbCallUserRec; +import com.icomsys.main_vm.db.jpa.entity.monitoring.id.TbCallRecId; +import org.springframework.data.jpa.repository.JpaRepository; + +public interface TbCallUserRecRepo extends JpaRepository { +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/monitoring/TbScenarioBreakNodeRepo.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/monitoring/TbScenarioBreakNodeRepo.java new file mode 100644 index 0000000..befca50 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/monitoring/TbScenarioBreakNodeRepo.java @@ -0,0 +1,8 @@ +package com.icomsys.main_vm.db.jpa.repo.monitoring; + +import com.icomsys.main_vm.db.jpa.entity.monitoring.TbScenarioBreakNode; +import org.springframework.data.jpa.repository.JpaRepository; + +public interface TbScenarioBreakNodeRepo extends JpaRepository { + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/oprManage/TbBgmMngRepo.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/oprManage/TbBgmMngRepo.java new file mode 100644 index 0000000..5cc5d2d --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/oprManage/TbBgmMngRepo.java @@ -0,0 +1,9 @@ +package com.icomsys.main_vm.db.jpa.repo.oprManage; + +import com.icomsys.main_vm.db.jpa.entity.oprManage.TbBgmMng; +import com.icomsys.main_vm.db.jpa.repo.oprManage.dsl.TbBgmMngDslRepo; +import org.springframework.data.jpa.repository.JpaRepository; + +public interface TbBgmMngRepo extends JpaRepository, TbBgmMngDslRepo { + //List findByFileName(String searchKeyword); +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/oprManage/TbBotTtsTagRepo.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/oprManage/TbBotTtsTagRepo.java new file mode 100644 index 0000000..dbbd596 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/oprManage/TbBotTtsTagRepo.java @@ -0,0 +1,10 @@ +package com.icomsys.main_vm.db.jpa.repo.oprManage; + +import com.icomsys.main_vm.db.jpa.entity.oprManage.TbBotTtsTag; +import com.icomsys.main_vm.db.jpa.repo.oprManage.dsl.TbBotTtsTagRepoDsl; +import org.springframework.data.jpa.repository.JpaRepository; + + +public interface TbBotTtsTagRepo extends JpaRepository, TbBotTtsTagRepoDsl { + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/oprManage/dsl/TbBgmMngDslRepo.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/oprManage/dsl/TbBgmMngDslRepo.java new file mode 100644 index 0000000..76e6815 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/oprManage/dsl/TbBgmMngDslRepo.java @@ -0,0 +1,9 @@ +package com.icomsys.main_vm.db.jpa.repo.oprManage.dsl; + +import com.icomsys.main_vm.biz.rcp.oprManage.vo.OprManageBgmVO; +import com.icomsys.main_vm.db.mybatis.alias.OprManageBgmListVo; +import com.querydsl.core.QueryResults; + +public interface TbBgmMngDslRepo { + public QueryResults selectBgmList(OprManageBgmVO vo); +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/oprManage/dsl/TbBgmMngDslRepoImpl.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/oprManage/dsl/TbBgmMngDslRepoImpl.java new file mode 100644 index 0000000..be55a29 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/oprManage/dsl/TbBgmMngDslRepoImpl.java @@ -0,0 +1,38 @@ +package com.icomsys.main_vm.db.jpa.repo.oprManage.dsl; + +import com.icomsys.main_vm.biz.rcp.oprManage.vo.OprManageBgmVO; +import com.icomsys.main_vm.db.jpa.entity.oprManage.QTbBgmMng; +import com.icomsys.main_vm.db.mybatis.alias.OprManageBgmListVo; +import com.querydsl.core.QueryResults; +import com.querydsl.core.types.Projections; +import com.querydsl.jpa.impl.JPAQueryFactory; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.aspectj.lang.annotation.Aspect; + +@Aspect +@Slf4j +@RequiredArgsConstructor +public class TbBgmMngDslRepoImpl implements TbBgmMngDslRepo { + + private final JPAQueryFactory queryFactory; + private QTbBgmMng qTbBgmMng = QTbBgmMng.tbBgmMng; + OprManageBgmListVo lvo = new OprManageBgmListVo(); + public QueryResults selectBgmList(OprManageBgmVO vo){ + var result = queryFactory.select( + Projections.fields( + OprManageBgmListVo.class, + qTbBgmMng.fileName, + qTbBgmMng.filePath, + qTbBgmMng.registId, + qTbBgmMng.registDate + ) + ) + .from(qTbBgmMng) + .where(qTbBgmMng.fileName.like("%".concat(vo.getSearchKeyword()).concat("%"))) + .fetchResults(); + + log.info("result : " + result.getResults()); + return result; + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/oprManage/dsl/TbBotTtsTagRepoDsl.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/oprManage/dsl/TbBotTtsTagRepoDsl.java new file mode 100644 index 0000000..0b02341 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/oprManage/dsl/TbBotTtsTagRepoDsl.java @@ -0,0 +1,14 @@ +package com.icomsys.main_vm.db.jpa.repo.oprManage.dsl; + +import com.icomsys.main_vm.biz.common.system.vo.SystemBotTtsTagRes; +import com.icomsys.main_vm.biz.common.system.vo.SystemBotTtsTagVo; +import com.icomsys.main_vm.biz.common.system.vo.SystemCommoncodeRes; + +import java.util.List; + +public interface TbBotTtsTagRepoDsl { + + List selectTtsProdCodeList (String majorCode); + List selectTtsTagList (String custCode, String majorCode, String prodCode); + SystemBotTtsTagVo existsById(SystemBotTtsTagVo vo); +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/oprManage/dsl/TbBotTtsTagRepoDslImpl.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/oprManage/dsl/TbBotTtsTagRepoDslImpl.java new file mode 100644 index 0000000..692c1c8 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/oprManage/dsl/TbBotTtsTagRepoDslImpl.java @@ -0,0 +1,83 @@ +package com.icomsys.main_vm.db.jpa.repo.oprManage.dsl; + +import com.icomsys.main_vm.biz.common.system.vo.SystemBotTtsTagRes; +import com.icomsys.main_vm.biz.common.system.vo.SystemBotTtsTagVo; +import com.icomsys.main_vm.biz.common.system.vo.SystemCommoncodeRes; +import com.icomsys.main_vm.biz.rcp.conversation.vo.ProjectSettingVO; +import com.icomsys.main_vm.db.jpa.entity.conversation.TbIcsLog; +import com.icomsys.main_vm.db.jpa.entity.oprManage.QTbBotTtsTag; +import com.icomsys.main_vm.db.jpa.entity.system.QTbBotCommonCode; +import com.querydsl.core.types.Projections; +import com.querydsl.jpa.impl.JPAQueryFactory; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.aspectj.lang.annotation.Aspect; + +import java.time.LocalDateTime; +import java.util.List; + +@Aspect +@Slf4j +@RequiredArgsConstructor +public class TbBotTtsTagRepoDslImpl implements TbBotTtsTagRepoDsl { + + private final JPAQueryFactory queryFactory; + private QTbBotCommonCode qTbBotCommonCode = QTbBotCommonCode.tbBotCommonCode; + private QTbBotTtsTag qTbBotTtsTag = QTbBotTtsTag.tbBotTtsTag; + + @Override + public List selectTtsProdCodeList (String majorCode) { + List result = null; + result = queryFactory.select( + Projections.fields( + SystemCommoncodeRes.class, + qTbBotCommonCode.minorCode, + qTbBotCommonCode.codeName + ) + ) + .from(qTbBotCommonCode) + .where(qTbBotCommonCode.majorCode.eq(majorCode)) + .orderBy(qTbBotCommonCode.updateDate.desc()) + .fetch(); + + return result; + } + @Override + public List selectTtsTagList (String custCode, String majorCode, String prodCode) { + List result = null; + result = queryFactory.select( + Projections.fields( + SystemBotTtsTagRes.class, + qTbBotCommonCode.codeName, + qTbBotCommonCode.attribute1, + qTbBotCommonCode.attribute2, + qTbBotTtsTag.ttsStartTag, + qTbBotTtsTag.ttsEndTag, + qTbBotTtsTag.updateDate + ) + ) + .from(qTbBotCommonCode) + .leftJoin(qTbBotTtsTag) + .on(qTbBotCommonCode.minorCode.eq(qTbBotTtsTag.tagCode).and(qTbBotTtsTag.ttsProdCode.eq(prodCode))) + .where(qTbBotCommonCode.custCode.eq(custCode).and(qTbBotCommonCode.majorCode.eq(majorCode))) + .orderBy(qTbBotCommonCode.updateDate.desc()) + .fetch(); + + return result; + } + + @Override + public SystemBotTtsTagVo existsById(SystemBotTtsTagVo vo) { + return queryFactory.select( + Projections.fields(SystemBotTtsTagVo.class, + qTbBotTtsTag.registId, + qTbBotTtsTag.registDate + ) + ) + .from(qTbBotTtsTag) + .where(qTbBotTtsTag.ttsProdCode.eq(vo.getTtsProdCode()) + .and(qTbBotTtsTag.tagCode.eq(vo.getTagCode()))) + .fetchFirst(); + } + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/scenario/TbApiNodeRepo.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/scenario/TbApiNodeRepo.java new file mode 100644 index 0000000..4dfb1cc --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/scenario/TbApiNodeRepo.java @@ -0,0 +1,14 @@ +package com.icomsys.main_vm.db.jpa.repo.scenario; + +import com.icomsys.main_vm.db.jpa.entity.scenario.TbApiNode; +import com.icomsys.main_vm.db.jpa.repo.scenario.dsl.TbApiNodeRepoDsl; +import org.springframework.data.jpa.repository.JpaRepository; + +import java.util.List; +import java.util.Optional; + +public interface TbApiNodeRepo extends JpaRepository, TbApiNodeRepoDsl { + List findByNodeNameContains(String apiNodeName); + + Optional findBySeqAndUseYn(Long seq, String useYn); +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/scenario/TbCommonNodeRepo.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/scenario/TbCommonNodeRepo.java new file mode 100644 index 0000000..7c38af6 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/scenario/TbCommonNodeRepo.java @@ -0,0 +1,13 @@ +package com.icomsys.main_vm.db.jpa.repo.scenario; + +import com.icomsys.main_vm.db.jpa.entity.scenario.TbCommonNode; +import com.icomsys.main_vm.db.jpa.repo.scenario.dsl.TbCommonNodeRepoDsl; +import org.springframework.data.jpa.repository.JpaRepository; + +import java.util.Optional; + +public interface TbCommonNodeRepo extends JpaRepository, TbCommonNodeRepoDsl { + + Optional findBySeqAndUseYn(Long seq, String useYn); + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/scenario/TbEntityMasterRepo.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/scenario/TbEntityMasterRepo.java new file mode 100644 index 0000000..cc3adc3 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/scenario/TbEntityMasterRepo.java @@ -0,0 +1,16 @@ +package com.icomsys.main_vm.db.jpa.repo.scenario; + +import com.icomsys.main_vm.db.jpa.entity.conversation.TbEntityMaster; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Modifying; +import org.springframework.data.jpa.repository.Query; +import org.springframework.transaction.annotation.Transactional; + +public interface TbEntityMasterRepo extends JpaRepository { + + @Transactional + @Modifying + @Query(value = "truncate TB_ENTITY_MASTER", nativeQuery = true) + void truncateEntityMaster(); + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/scenario/TbLongtextManagerRepo.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/scenario/TbLongtextManagerRepo.java new file mode 100644 index 0000000..0b14def --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/scenario/TbLongtextManagerRepo.java @@ -0,0 +1,15 @@ +package com.icomsys.main_vm.db.jpa.repo.scenario; + +import com.icomsys.main_vm.db.jpa.entity.scenario.TbLongtextManager; +import com.icomsys.main_vm.db.jpa.entity.scenario.id.TbLongtextManagerId; +import com.icomsys.main_vm.db.jpa.repo.scenario.dsl.TbLongTextManagerDsl; +import org.springframework.data.jpa.repository.JpaRepository; + +import java.util.HashMap; +import java.util.Optional; + +public interface TbLongtextManagerRepo extends JpaRepository, TbLongTextManagerDsl { +// Optional findById(int , Long , int ); + + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/scenario/TbScenarioHistoryRepo.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/scenario/TbScenarioHistoryRepo.java new file mode 100644 index 0000000..d58b3ef --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/scenario/TbScenarioHistoryRepo.java @@ -0,0 +1,10 @@ +package com.icomsys.main_vm.db.jpa.repo.scenario; + +import com.icomsys.main_vm.db.jpa.entity.scenario.TbScenarioHistory; +import org.springframework.data.jpa.repository.JpaRepository; + +import java.util.List; + +public interface TbScenarioHistoryRepo extends JpaRepository { + List findByMasterSeqAndLastYn(Long masterSeq, String lastYN); +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/scenario/TbScenarioMasterRepo.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/scenario/TbScenarioMasterRepo.java new file mode 100644 index 0000000..e34a492 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/scenario/TbScenarioMasterRepo.java @@ -0,0 +1,13 @@ +package com.icomsys.main_vm.db.jpa.repo.scenario; + +import com.icomsys.main_vm.db.jpa.entity.scenario.TbScenarioMaster; +import com.icomsys.main_vm.db.jpa.repo.scenario.dsl.TbScenarioManagerRepoDsl; +import org.springframework.data.jpa.repository.JpaRepository; + +import java.util.Optional; + +public interface TbScenarioMasterRepo extends JpaRepository, TbScenarioManagerRepoDsl { + + Optional findBySeqAndUseYn(Long seq, String useYn); + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/scenario/TbScenarioRelatedIntentRepo.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/scenario/TbScenarioRelatedIntentRepo.java new file mode 100644 index 0000000..444535c --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/scenario/TbScenarioRelatedIntentRepo.java @@ -0,0 +1,12 @@ +package com.icomsys.main_vm.db.jpa.repo.scenario; + +import com.icomsys.main_vm.db.jpa.entity.scenario.TbScenarioRelatedIntent; +import com.icomsys.main_vm.db.jpa.entity.scenario.id.TbScenarioRelatedIntentId; +import com.icomsys.main_vm.db.jpa.repo.scenario.dsl.TbScenarioRelatedIntentRepoDsl; +import org.springframework.data.jpa.repository.JpaRepository; + +import java.util.List; + +public interface TbScenarioRelatedIntentRepo extends JpaRepository, TbScenarioRelatedIntentRepoDsl { + List findByScenarioSeqOrderByIntentSeq(Long scSeq); +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/scenario/TbScenarioReleaseRepo.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/scenario/TbScenarioReleaseRepo.java new file mode 100644 index 0000000..1596f07 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/scenario/TbScenarioReleaseRepo.java @@ -0,0 +1,13 @@ +package com.icomsys.main_vm.db.jpa.repo.scenario; + +import com.icomsys.main_vm.db.jpa.entity.scenario.TbScenarioRelease; +import org.springframework.data.jpa.repository.JpaRepository; + +import java.util.List; +import java.util.Optional; + +public interface TbScenarioReleaseRepo extends JpaRepository { + TbScenarioRelease findByMasterSeqAndReleaseYn(Long masterSeq, String releaseYn); + TbScenarioRelease findTopByMasterSeqOrderByVersionDesc(Long masterSeq); + List findByIntentSeqAndReleaseYn(Long intentSeq, String releaseYn); +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/scenario/TbScenarioTemplateRepo.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/scenario/TbScenarioTemplateRepo.java new file mode 100644 index 0000000..9e72aa4 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/scenario/TbScenarioTemplateRepo.java @@ -0,0 +1,7 @@ +package com.icomsys.main_vm.db.jpa.repo.scenario; + +import com.icomsys.main_vm.db.jpa.entity.scenario.TbScenarioTemplate; +import org.springframework.data.jpa.repository.JpaRepository; + +public interface TbScenarioTemplateRepo extends JpaRepository { +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/scenario/dsl/TbApiNodeRepoDsl.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/scenario/dsl/TbApiNodeRepoDsl.java new file mode 100644 index 0000000..1078fc7 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/scenario/dsl/TbApiNodeRepoDsl.java @@ -0,0 +1,18 @@ +package com.icomsys.main_vm.db.jpa.repo.scenario.dsl; + +import com.icomsys.main_vm.biz.rcp.conversation.vo.ConversationApiNodeEditReq; +import com.icomsys.main_vm.biz.rcp.conversation.vo.ConversationApiNodeInfoReq; +import com.icomsys.main_vm.biz.rcp.conversation.vo.ConversationApiNodeInfoRes; +import com.querydsl.core.QueryResults; + +import java.util.HashMap; +import java.util.List; + +public interface TbApiNodeRepoDsl { + QueryResults searchApiNodeList(ConversationApiNodeInfoReq dto); + void updateApiNode(ConversationApiNodeEditReq dto); + + List selectApiNode(Long seq); + + void deleteApiNode(Long seq); +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/scenario/dsl/TbApiNodeRepoDslImpl.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/scenario/dsl/TbApiNodeRepoDslImpl.java new file mode 100644 index 0000000..0b36b2e --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/scenario/dsl/TbApiNodeRepoDslImpl.java @@ -0,0 +1,140 @@ +package com.icomsys.main_vm.db.jpa.repo.scenario.dsl; + +import com.icomsys.main_vm.biz.common.login.service.LoginService; +import com.icomsys.main_vm.biz.rcp.conversation.vo.ConversationApiNodeEditReq; +import com.icomsys.main_vm.biz.rcp.conversation.vo.ConversationApiNodeInfoReq; +import com.icomsys.main_vm.biz.rcp.conversation.vo.ConversationApiNodeInfoRes; +import com.icomsys.main_vm.db.jpa.entity.scenario.QTbApiNode; +import com.icomsys.main_vm.db.jpa.entity.system.QTbIcsOprMngInfo; +import com.icomsys.main_vm.db.jpa.entity.system.QTbServiceGrouop; +import com.querydsl.core.QueryResults; +import com.querydsl.core.types.Projections; +import com.querydsl.core.types.dsl.BooleanExpression; +import com.querydsl.jpa.impl.JPAQueryFactory; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.aspectj.lang.annotation.Aspect; + +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; + +/** + * Name : TbApiNodeRepoDslImpl + * date : 2023-02-09 + * author : Mong + * description : + * =========================================================== + * DATE AUTHOR NOTE + * ----------------------------------------------------------- + * 2023-02-09 Mong 최초 생성 + */ +@Aspect +@Slf4j +@RequiredArgsConstructor +public class TbApiNodeRepoDslImpl implements TbApiNodeRepoDsl { + + private final JPAQueryFactory queryFactory; + + private QTbApiNode qTbApiNode = QTbApiNode.tbApiNode; + private QTbIcsOprMngInfo qTbIcsOprMngInfo = QTbIcsOprMngInfo.tbIcsOprMngInfo; + private QTbServiceGrouop qTbServiceGroup = QTbServiceGrouop.tbServiceGrouop; + + + private final LoginService loginService; + + @Override + public QueryResults searchApiNodeList(ConversationApiNodeInfoReq dto) { + + QueryResults result = + queryFactory.select( + Projections.fields( + ConversationApiNodeInfoRes.class, + qTbApiNode.seq, + qTbApiNode.nodeName, + qTbApiNode.updateDate, + qTbApiNode.updateId, + qTbApiNode.oprMngCode, + qTbServiceGroup.serviceGroupName + ) + ).from(qTbApiNode).innerJoin(qTbIcsOprMngInfo).on(qTbApiNode.oprMngCode.eq(qTbIcsOprMngInfo.oprMngCode)) + .innerJoin(qTbServiceGroup).on(qTbIcsOprMngInfo.serviceGroup.eq(qTbServiceGroup.serviceGroup)) + .where(scenarioNameEq(dto) + ,oprMngCodeEq(dto) + ,(qTbApiNode.useYn.eq("Y")) + ) + .fetchResults(); + return result; + } + + private BooleanExpression scenarioNameEq(ConversationApiNodeInfoReq dto) { + if (dto.getNodeName() == null || dto.getNodeName().equals("")) { + return null; + } else { + return qTbApiNode.nodeName.contains(dto.getNodeName()); + } + } + + private BooleanExpression oprMngCodeEq(ConversationApiNodeInfoReq dto) { + if (dto.getCustCode() == null || dto.getCustCode().equals("")) { + return null; + } else if (dto.getServiceGroup() == null || dto.getServiceGroup().equals("")) { + return null; + } else { + List oprMngCodes = new ArrayList<>(); + oprMngCodes.add(dto.getCustCode() + "_RCP_" + dto.getServiceGroup()); + + if (dto.isContainUpper()) { + oprMngCodes.add(dto.getCustCode() + "_RCP_" + dto.getServiceGroupUpper()); + } + return qTbApiNode.oprMngCode.in(oprMngCodes); + } + } + + @Override + public void updateApiNode(ConversationApiNodeEditReq dto) { + + String userId = loginService.getUserVo().getUserId(); + String oprMngCode = dto.getCustCode() + "_RCP_" + dto.getServiceGroup(); + var query = queryFactory.update(qTbApiNode) + .set(qTbApiNode.nodeName, dto.getNodeName()) + .set(qTbApiNode.updateDate, LocalDateTime.now()) + .set(qTbApiNode.updateId, userId) + .set(qTbApiNode.oprMngCode, oprMngCode) + .where(qTbApiNode.seq.eq(dto.getSeq()).and(qTbApiNode.useYn.eq("Y"))); + query.execute(); + } + + @Override + public List selectApiNode(Long seq) { + + var query = queryFactory.select( + Projections.fields( + ConversationApiNodeInfoRes.class, + qTbApiNode.nodeName, + qTbApiNode.seq, + qTbApiNode.updateId, + qTbApiNode.updateDate, + qTbApiNode.oprMngCode + ) + ).from(qTbApiNode) + .where(qTbApiNode.seq.eq(seq).and(qTbApiNode.useYn.eq("Y"))) + .fetch(); + + return query; + + } + + @Override + public void deleteApiNode(Long seq) { + String userId = loginService.getUserVo().getUserId(); + var query = queryFactory.update(qTbApiNode) + .set(qTbApiNode.useYn, "N") + .set(qTbApiNode.updateDate, LocalDateTime.now()) + .set(qTbApiNode.updateId, userId) + .where(qTbApiNode.seq.eq(seq)); + query.execute(); + + + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/scenario/dsl/TbCommonNodeRepoDsl.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/scenario/dsl/TbCommonNodeRepoDsl.java new file mode 100644 index 0000000..526ce6b --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/scenario/dsl/TbCommonNodeRepoDsl.java @@ -0,0 +1,20 @@ +package com.icomsys.main_vm.db.jpa.repo.scenario.dsl; + +import com.icomsys.main_vm.biz.rcp.conversation.vo.ConversationCmmNodeEditReq; +import com.icomsys.main_vm.biz.rcp.conversation.vo.ConversationCmmNodeInfoReq; +import com.icomsys.main_vm.biz.rcp.conversation.vo.ConversationCmmNodeInfoRes; +import com.querydsl.core.QueryResults; + +import java.util.HashMap; +import java.util.List; + +public interface TbCommonNodeRepoDsl { + + QueryResults serachCmmNodeList(ConversationCmmNodeInfoReq dto); + + void updateCmmNode(ConversationCmmNodeEditReq dto); + + List selectCmmNode(Long seq); + + void deleteCmmNode(Long seq); +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/scenario/dsl/TbCommonNodeRepoDslImpl.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/scenario/dsl/TbCommonNodeRepoDslImpl.java new file mode 100644 index 0000000..2f295d5 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/scenario/dsl/TbCommonNodeRepoDslImpl.java @@ -0,0 +1,127 @@ +package com.icomsys.main_vm.db.jpa.repo.scenario.dsl; + +import com.icomsys.main_vm.biz.common.login.service.LoginService; +import com.icomsys.main_vm.biz.rcp.conversation.vo.*; +import com.icomsys.main_vm.db.jpa.entity.scenario.QTbCommonNode; +import com.querydsl.core.QueryResults; +import com.querydsl.core.types.Projections; +import com.querydsl.core.types.dsl.BooleanExpression; +import com.querydsl.jpa.impl.JPAQueryFactory; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.aspectj.lang.annotation.Aspect; + +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; + +/** + * Name : TbCommonNodeRepoDslImpl + * date : 2023-02-13 + * author : Mong + * description : + * =========================================================== + * DATE AUTHOR NOTE + * ----------------------------------------------------------- + * 2023-02-13 Mong 최초 생성 + */ +@Aspect +@Slf4j +@RequiredArgsConstructor +public class TbCommonNodeRepoDslImpl implements TbCommonNodeRepoDsl{ + + private final JPAQueryFactory queryFactory; + + private QTbCommonNode qTbCommonNode = QTbCommonNode.tbCommonNode; + + private final LoginService loginService; + + @Override + public QueryResults serachCmmNodeList(ConversationCmmNodeInfoReq dto) { + + QueryResults result = + queryFactory.select( + Projections.fields( + ConversationCmmNodeInfoRes.class, + qTbCommonNode.seq, + qTbCommonNode.nodeName, + qTbCommonNode.updateDate, + qTbCommonNode.updateId + ) + ).from(qTbCommonNode) + .where(scenarioNameEq(dto) + ,oprMngCodeEq(dto) + ,(qTbCommonNode.useYn.eq("Y")) + ) + .fetchResults(); + return result; + } + + @Override + public void updateCmmNode(ConversationCmmNodeEditReq dto) { + + String userId = loginService.getUserVo().getUserId(); + String oprMngCode = dto.getCustCode() + "_RCP_" + dto.getServiceGroup(); + var query = queryFactory.update(qTbCommonNode) + .set(qTbCommonNode.nodeName, dto.getNodeName()) + .set(qTbCommonNode.updateDate, LocalDateTime.now()) + .set(qTbCommonNode.updateId, userId) + .set(qTbCommonNode.oprMngCode, oprMngCode) + .where(qTbCommonNode.seq.eq(dto.getSeq()).and(qTbCommonNode.useYn.eq("Y"))); + query.execute(); + + } + + private BooleanExpression scenarioNameEq(ConversationCmmNodeInfoReq dto) { + if (dto.getNodeName() == null || dto.getNodeName().equals("")) { + return null; + } else { + return qTbCommonNode.nodeName.contains(dto.getNodeName()); + } + } + + private BooleanExpression oprMngCodeEq(ConversationCmmNodeInfoReq dto) { + if (dto.getCustCode() == null || dto.getCustCode().equals("")) { + return null; + } else if (dto.getServiceGroup() == null || dto.getServiceGroup().equals("")) { + return null; + } else { + List oprMngCodes = new ArrayList<>(); + oprMngCodes.add(dto.getCustCode() + "_RCP_" + dto.getServiceGroup()); + + if (dto.isContainUpper()) { + oprMngCodes.add(dto.getCustCode() + "_RCP_" + dto.getServiceGroupUpper()); + } + return qTbCommonNode.oprMngCode.in(oprMngCodes); + } + } + + @Override + public List selectCmmNode(Long seq) { + var query = queryFactory.select( + Projections.fields( + ConversationCmmNodeInfoRes.class, + qTbCommonNode.nodeName, + qTbCommonNode.seq, + qTbCommonNode.updateId, + qTbCommonNode.updateDate + ) + ).from(qTbCommonNode) + .where(qTbCommonNode.seq.eq(seq).and(qTbCommonNode.useYn.eq("Y"))) + .fetch(); + + return query; + } + + @Override + public void deleteCmmNode(Long seq) { + String userId = loginService.getUserVo().getUserId(); + var query = queryFactory.update(qTbCommonNode) + .set(qTbCommonNode.useYn, "N") + .set(qTbCommonNode.updateDate, LocalDateTime.now()) + .set(qTbCommonNode.updateId, userId) + .where(qTbCommonNode.seq.eq(seq)); + query.execute(); + + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/scenario/dsl/TbLongTextManagerDsl.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/scenario/dsl/TbLongTextManagerDsl.java new file mode 100644 index 0000000..f502b8a --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/scenario/dsl/TbLongTextManagerDsl.java @@ -0,0 +1,14 @@ +package com.icomsys.main_vm.db.jpa.repo.scenario.dsl; + +import com.icomsys.main_vm.biz.rcp.conversation.vo.LongtextManagerVO; + +import java.util.HashMap; +import java.util.List; + +public interface TbLongTextManagerDsl { + + void updateApiLongTextManager(LongtextManagerVO vo); + + List selectLongTextManager(LongtextManagerVO vo); + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/scenario/dsl/TbLongTextManagerDslImpl.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/scenario/dsl/TbLongTextManagerDslImpl.java new file mode 100644 index 0000000..af2b9e4 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/scenario/dsl/TbLongTextManagerDslImpl.java @@ -0,0 +1,68 @@ +package com.icomsys.main_vm.db.jpa.repo.scenario.dsl; + +import com.google.gson.Gson; +import com.icomsys.main_vm.biz.common.login.service.LoginService; +import com.icomsys.main_vm.biz.rcp.conversation.vo.LongtextManagerVO; +import com.icomsys.main_vm.db.jpa.entity.scenario.QTbApiNode; +import com.icomsys.main_vm.db.jpa.entity.scenario.QTbLongtextManager; +import com.querydsl.core.types.Projections; +import com.querydsl.jpa.impl.JPAQueryFactory; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.aspectj.lang.annotation.Aspect; + +import java.util.HashMap; +import java.util.List; + +/** + * Name : TbLongTextManagerDslImpl + * date : 2023-02-09 + * author : Mong + * description : + * =========================================================== + * DATE AUTHOR NOTE + * ----------------------------------------------------------- + * 2023-02-09 Mong 최초 생성 + */ +@Aspect +@Slf4j +@RequiredArgsConstructor +public class TbLongTextManagerDslImpl implements TbLongTextManagerDsl{ + + private final JPAQueryFactory queryFactory; + + private QTbLongtextManager qTbLongtextManager = QTbLongtextManager.tbLongtextManager; + + private QTbApiNode qTbApiNode = QTbApiNode.tbApiNode; + + @Override + public void updateApiLongTextManager(LongtextManagerVO vo) { + var query = queryFactory.update(qTbLongtextManager) + .set(qTbLongtextManager.textContents, vo.getTextContents()) + .set(qTbLongtextManager.checksum, vo.getChecksum()) + .where(qTbLongtextManager.rfSeq.eq(vo.getRfSeq()) + .and(qTbLongtextManager.tableCode.eq(vo.getTableCode()) + .and(qTbLongtextManager.columnCode.eq(vo.getColumnCode()))) + ); + query.execute(); + } + + @Override + public List selectLongTextManager(LongtextManagerVO vo) { + var query = queryFactory.select( + Projections.fields( + LongtextManagerVO.class, + qTbLongtextManager.textContents + ) + ).from(qTbLongtextManager) + .leftJoin(qTbLongtextManager).on(qTbApiNode.seq.eq(qTbLongtextManager.rfSeq)) + .where(qTbLongtextManager.rfSeq.eq(vo.getRfSeq()) + .and(qTbLongtextManager.columnCode.eq(vo.getColumnCode())) + .and(qTbLongtextManager.tableCode.eq(vo.getTableCode())) + ).fetch(); + + return query; + + } + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/scenario/dsl/TbScenarioManagerRepoDsl.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/scenario/dsl/TbScenarioManagerRepoDsl.java new file mode 100644 index 0000000..31fd583 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/scenario/dsl/TbScenarioManagerRepoDsl.java @@ -0,0 +1,11 @@ +package com.icomsys.main_vm.db.jpa.repo.scenario.dsl; + +import com.icomsys.main_vm.biz.rcp.conversation.vo.ConversationScenarioManagerRes; +import com.icomsys.main_vm.biz.rcp.conversation.vo.ConversationScenarioManagerSearchReq; +import com.icomsys.main_vm.biz.rcp.conversation.vo.ConversationScenarioReleaseRes; +import com.querydsl.core.QueryResults; + +public interface TbScenarioManagerRepoDsl { + QueryResults searchScenarioList(ConversationScenarioManagerSearchReq dto); + QueryResults searchScenarioReleaseList(ConversationScenarioManagerSearchReq dto); +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/scenario/dsl/TbScenarioManagerRepoDslImpl.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/scenario/dsl/TbScenarioManagerRepoDslImpl.java new file mode 100644 index 0000000..54cafc3 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/scenario/dsl/TbScenarioManagerRepoDslImpl.java @@ -0,0 +1,122 @@ +package com.icomsys.main_vm.db.jpa.repo.scenario.dsl; + +import com.google.gson.Gson; +import com.icomsys.main_vm.biz.rcp.conversation.vo.ConversationScenarioManagerRes; +import com.icomsys.main_vm.biz.rcp.conversation.vo.ConversationScenarioManagerSearchReq; +import com.icomsys.main_vm.biz.rcp.conversation.vo.ConversationScenarioReleaseRes; +import com.icomsys.main_vm.db.jpa.entity.conversation.QTbIntentMaster; +import com.icomsys.main_vm.db.jpa.entity.scenario.QTbScenarioMaster; +import com.icomsys.main_vm.db.jpa.entity.scenario.QTbScenarioRelatedIntent; +import com.icomsys.main_vm.db.jpa.entity.scenario.QTbScenarioRelease; +import com.icomsys.main_vm.db.jpa.entity.system.QTbBotUser; +import com.querydsl.core.QueryResults; +import com.querydsl.core.types.ExpressionUtils; +import com.querydsl.core.types.Projections; +import com.querydsl.core.types.dsl.BooleanExpression; +import com.querydsl.core.types.dsl.Expressions; +import com.querydsl.jpa.JPAExpressions; +import com.querydsl.jpa.impl.JPAQueryFactory; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.aspectj.lang.annotation.Aspect; + +@Aspect +@Slf4j +@RequiredArgsConstructor +public class TbScenarioManagerRepoDslImpl implements TbScenarioManagerRepoDsl { + private final JPAQueryFactory queryFactory; + + private QTbScenarioMaster qTbScenarioMaster = QTbScenarioMaster.tbScenarioMaster; + private QTbScenarioRelease qTbScenarioRelease = QTbScenarioRelease.tbScenarioRelease; + private QTbScenarioRelatedIntent qTbScenarioRelatedIntent = QTbScenarioRelatedIntent.tbScenarioRelatedIntent; + private QTbIntentMaster qTbIntentMaster = QTbIntentMaster.tbIntentMaster; + private QTbBotUser qTbBotUser = QTbBotUser.tbBotUser; + + @Override + public QueryResults searchScenarioList(ConversationScenarioManagerSearchReq dto) { + log.info(new Gson().toJson(dto)); + QueryResults result = + queryFactory.select( + Projections.fields( + ConversationScenarioManagerRes.class, + qTbScenarioMaster.seq, + qTbScenarioMaster.scenarioName, + qTbBotUser.userName.as("updateName"), + qTbScenarioMaster.updateDate, + qTbScenarioRelease.version, + ExpressionUtils.as( + JPAExpressions.select(Expressions.stringTemplate("group_concat({0})", qTbIntentMaster.intentName)) + .from(qTbScenarioRelatedIntent) + .innerJoin(qTbIntentMaster).on(qTbScenarioRelatedIntent.intentSeq.eq(qTbIntentMaster.seq)) + .where(qTbScenarioRelatedIntent.scenarioSeq.eq(qTbScenarioMaster.seq)), + "relatedIntents") + ) + ) + .from(qTbScenarioMaster) + .leftJoin(qTbScenarioRelease).on(qTbScenarioMaster.seq.eq(qTbScenarioRelease.masterSeq)) + .innerJoin(qTbBotUser).on(qTbScenarioMaster.updateId.eq(qTbBotUser.userId)) + .where( oprMngCodeEq(dto) + , scenarioNameEq(dto) + , qTbScenarioMaster.useYn.eq("Y") + , qTbScenarioRelease.releaseYn.eq("Y") + .or(qTbScenarioRelease.releaseYn.isNull()) + ) + .limit(dto.getSize()) + .offset(dto.getPage() * dto.getSize()) + .orderBy(qTbScenarioMaster.updateDate.desc()) + .fetchResults(); + + return result; + } + + private BooleanExpression scenarioNameEq(ConversationScenarioManagerSearchReq dto) { + if (dto.getScenarioName() == null || dto.getScenarioName().equals("")) { + return null; + } else { + return qTbScenarioMaster.scenarioName.contains(dto.getScenarioName()); + } + } + + private BooleanExpression oprMngCodeEq(ConversationScenarioManagerSearchReq dto) { + if (dto.getCustCode() == null || dto.getCustCode().equals("")) { + return null; + } else if (dto.getServiceGroup() == null || dto.getServiceGroup().equals("")) { + return null; + } else { + return qTbScenarioMaster.oprMngCode.eq(dto.getCustCode() + "_RCP_" + dto.getServiceGroup()); + } + } + + @Override + public QueryResults searchScenarioReleaseList(ConversationScenarioManagerSearchReq dto){ + log.info(new Gson().toJson(dto)); + QueryResults result = + queryFactory.select( + Projections.fields( + ConversationScenarioReleaseRes.class, + qTbScenarioRelease.seq, + qTbScenarioRelease.version, + qTbScenarioRelease.releaseYn, + qTbBotUser.userName.as("registName"), + qTbScenarioRelease.registDate + ) + ) + .from(qTbScenarioRelease) + .leftJoin(qTbBotUser).on(qTbScenarioRelease.registId.eq(qTbBotUser.userId)) + .where( scenarioReleaseMasterSeqEq(dto)) + .limit(dto.getSize()) + .offset(dto.getPage() * dto.getSize()) + .orderBy(qTbScenarioRelease.version.desc()) + .fetchResults(); + return result; + } + + private BooleanExpression scenarioReleaseMasterSeqEq(ConversationScenarioManagerSearchReq dto) { + if (dto.getScenarioMasterSeq() == null ) { // masterSeq가 없을 경우 -1로 조회하여 조회결과 없도록 처리 + return qTbScenarioRelease.masterSeq.eq(-1L); + } else { + return qTbScenarioRelease.masterSeq.eq(dto.getScenarioMasterSeq()); + } + } + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/scenario/dsl/TbScenarioRelatedIntentRepoDsl.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/scenario/dsl/TbScenarioRelatedIntentRepoDsl.java new file mode 100644 index 0000000..6be8328 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/scenario/dsl/TbScenarioRelatedIntentRepoDsl.java @@ -0,0 +1,10 @@ +package com.icomsys.main_vm.db.jpa.repo.scenario.dsl; + + +import com.icomsys.main_vm.biz.rcp.conversation.vo.ConversationScenarioMasterVO; +import com.icomsys.main_vm.biz.rcp.conversation.vo.ConversationScenarioRelatedIntentVO; +import com.querydsl.core.QueryResults; + +public interface TbScenarioRelatedIntentRepoDsl { + QueryResults findRelatedIntentList(ConversationScenarioMasterVO dto); +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/scenario/dsl/TbScenarioRelatedIntentRepoDslImpl.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/scenario/dsl/TbScenarioRelatedIntentRepoDslImpl.java new file mode 100644 index 0000000..a951752 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/scenario/dsl/TbScenarioRelatedIntentRepoDslImpl.java @@ -0,0 +1,44 @@ +package com.icomsys.main_vm.db.jpa.repo.scenario.dsl; + +import com.icomsys.main_vm.biz.rcp.conversation.vo.ConversationScenarioMasterVO; +import com.icomsys.main_vm.biz.rcp.conversation.vo.ConversationScenarioRelatedIntentVO; +import com.icomsys.main_vm.db.jpa.entity.conversation.QTbIntentMaster; +import com.icomsys.main_vm.db.jpa.entity.scenario.QTbScenarioMaster; +import com.icomsys.main_vm.db.jpa.entity.scenario.QTbScenarioRelatedIntent; +import com.icomsys.main_vm.db.jpa.entity.scenario.QTbScenarioRelease; +import com.querydsl.core.QueryResults; +import com.querydsl.core.types.Projections; +import com.querydsl.jpa.impl.JPAQueryFactory; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.aspectj.lang.annotation.Aspect; + +@Aspect +@Slf4j +@RequiredArgsConstructor +public class TbScenarioRelatedIntentRepoDslImpl implements TbScenarioRelatedIntentRepoDsl { + private final JPAQueryFactory queryFactory; + + private QTbScenarioRelatedIntent qTbScenarioRelatedIntent = QTbScenarioRelatedIntent.tbScenarioRelatedIntent; + private QTbIntentMaster qTbIntentMaster = QTbIntentMaster.tbIntentMaster; + + @Override + public QueryResults findRelatedIntentList(ConversationScenarioMasterVO dto){ + QueryResults result = + queryFactory.select( + Projections.fields( + ConversationScenarioRelatedIntentVO.class, + qTbScenarioRelatedIntent.scenarioSeq, + qTbScenarioRelatedIntent.intentSeq, + qTbIntentMaster.intentName + ) + + ) + .from(qTbScenarioRelatedIntent) + .innerJoin(qTbIntentMaster).on(qTbScenarioRelatedIntent.intentSeq.eq(qTbIntentMaster.seq)) + .where(qTbScenarioRelatedIntent.scenarioSeq.eq(dto.getSeq())) + .fetchResults(); + + return result; + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/TbBotCommonCodeRepo.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/TbBotCommonCodeRepo.java new file mode 100644 index 0000000..e00ba3a --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/TbBotCommonCodeRepo.java @@ -0,0 +1,22 @@ +package com.icomsys.main_vm.db.jpa.repo.system; + +import com.icomsys.main_vm.db.jpa.entity.system.TbBotCommonCode; +import com.icomsys.main_vm.db.jpa.entity.system.id.TbBotCommonCodeId; +import com.icomsys.main_vm.db.jpa.repo.system.dsl.TbBotCommonCodeRepoDsl; +import org.springframework.data.jpa.repository.JpaRepository; + +import java.util.List; + +public interface TbBotCommonCodeRepo extends JpaRepository, TbBotCommonCodeRepoDsl { + + boolean existsByOprMngCodeAndMajorCodeAndMinorCode(String opr, String ma, String mi); + + List findByOprMngCodeAndMajorCode(String opr, String major); + List findByMajorCodeAndOprMngCodeOrderByCodeNameAsc(String major, String oprMgr); + List findByMajorCode(String custName); + + List findByCustCodeAndMajorCodeAndOprMngCodeOrderByCodeNameAsc(String custCode, String major, String oprMngCode); + + List findByCustCodeAndMajorCode(String custCode, String major); + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/TbBotUserRepo.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/TbBotUserRepo.java new file mode 100644 index 0000000..8fb0e63 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/TbBotUserRepo.java @@ -0,0 +1,47 @@ +package com.icomsys.main_vm.db.jpa.repo.system; + +import com.icomsys.main_vm.db.jpa.entity.system.TbBotUser; +import com.icomsys.main_vm.db.jpa.repo.system.dsl.TbBotUserRepoDsl; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Modifying; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; +import java.util.Optional; + +public interface TbBotUserRepo extends JpaRepository, TbBotUserRepoDsl { + + Optional findByUserId(String userId); + Optional findByUserSeq(Long userSeq); + boolean existsByUserId(String userId); + Optional findByUserIdAndUseYn(String userId, String useYn); + Optional findByUserIdAndPasswordAndUseYn(String userId, String pass, String useYn); + boolean existsByUserIdAndPasswordAndUseYn(String userId, String pass, String useYn); + Optional findByUserSeqAndUseYn(Long seq, String use); + + List findByCustCodeAndUseYn(String custCode, String yn); + + @Modifying + @Transactional + @Query( + value = "UPDATE TB_BOT_USER " + + "SET LOGIN_CHECK = LOGIN_CHECK + 1 " + + "WHERE USER_ID = :userId " +// "AND SOLUTION_CODE = 'VM'" + , nativeQuery = true + ) + int loginFail(@Param("userId") String userId); + + @Modifying + @Transactional + @Query( + value = "UPDATE TB_BOT_USER " + + "SET USE_Yn = :useYn " + + "WHERE USER_ID = :userId " +// "AND SOLUTION_CODE = 'VM'" + , nativeQuery = true + ) + void jpqlUesYn(@Param("userId") String userId, @Param("useYn") String useYn); +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/TbCustPolicyRepo.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/TbCustPolicyRepo.java new file mode 100644 index 0000000..32cd08f --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/TbCustPolicyRepo.java @@ -0,0 +1,24 @@ +package com.icomsys.main_vm.db.jpa.repo.system; + +import com.icomsys.main_vm.db.jpa.entity.system.TbCustPolicy; +import com.icomsys.main_vm.db.jpa.entity.system.TbServiceGroupPolicy; +import com.icomsys.main_vm.db.jpa.entity.system.id.TbCustPolicyId; +import com.icomsys.main_vm.db.jpa.repo.system.dsl.TbCustPolicyRepoDsl; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Modifying; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; + +public interface TbCustPolicyRepo extends JpaRepository , TbCustPolicyRepoDsl { + + + List findByCustCode(String cust); + List findByServiceGroup(String serviceGroup); + List findByServiceGroupIn(List serviceGroup); + + void deleteByServiceGroupInAndPolicyValIn(List service, List delpol); + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/TbIcsCustInfoRepo.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/TbIcsCustInfoRepo.java new file mode 100644 index 0000000..0c3bc4d --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/TbIcsCustInfoRepo.java @@ -0,0 +1,14 @@ +package com.icomsys.main_vm.db.jpa.repo.system; + +import com.icomsys.main_vm.db.jpa.entity.system.TbIcsCustInfo; +import com.icomsys.main_vm.db.jpa.repo.system.dsl.TbIcsCustInfoRepoDsl; +import org.springframework.data.domain.PageRequest; +import org.springframework.data.domain.Pageable; +import org.springframework.data.jpa.repository.JpaRepository; + +public interface TbIcsCustInfoRepo extends JpaRepository , TbIcsCustInfoRepoDsl { + + Pageable findAllBy(PageRequest dto); + boolean existsByCustCode(String custCode); + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/TbIcsLogRepo.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/TbIcsLogRepo.java new file mode 100644 index 0000000..ee7a7bc --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/TbIcsLogRepo.java @@ -0,0 +1,9 @@ +package com.icomsys.main_vm.db.jpa.repo.system; + +import com.icomsys.main_vm.db.jpa.entity.conversation.TbIcsLog; +import com.icomsys.main_vm.db.jpa.entity.conversation.id.TbIcsLogId; +import com.icomsys.main_vm.db.jpa.repo.system.dsl.TbIcsLogDsl; +import org.springframework.data.jpa.repository.JpaRepository; + +public interface TbIcsLogRepo extends JpaRepository, TbIcsLogDsl { +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/TbIcsOprMngInfoRepo.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/TbIcsOprMngInfoRepo.java new file mode 100644 index 0000000..4e92687 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/TbIcsOprMngInfoRepo.java @@ -0,0 +1,11 @@ +package com.icomsys.main_vm.db.jpa.repo.system; + +import com.icomsys.main_vm.db.jpa.entity.system.TbIcsOprMngInfo; +import com.icomsys.main_vm.db.jpa.entity.system.id.TbIcsOprMngInfoId; +import com.icomsys.main_vm.db.jpa.repo.system.dsl.TbIcsOprMngInfoRepoDsl; +import org.springframework.data.jpa.repository.JpaRepository; + +public interface TbIcsOprMngInfoRepo extends JpaRepository , TbIcsOprMngInfoRepoDsl { + + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/TbIntentExampleRepo.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/TbIntentExampleRepo.java new file mode 100644 index 0000000..8111180 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/TbIntentExampleRepo.java @@ -0,0 +1,19 @@ +package com.icomsys.main_vm.db.jpa.repo.system; + +import com.icomsys.main_vm.db.jpa.entity.conversation.TbIntentExample; +import com.icomsys.main_vm.db.jpa.entity.conversation.id.TbIntentExampleId; +import com.icomsys.main_vm.db.jpa.repo.system.dsl.TbIntentExampleRepoDsl; +import org.springframework.data.jpa.repository.JpaRepository; + +import java.util.List; +import java.util.Optional; + +public interface TbIntentExampleRepo extends JpaRepository, TbIntentExampleRepoDsl { + + List findByIntentSeqAndUseYn(Long intentSeq, String use); + List findByIntentSeq(Long seq); + + +// Optional findBySeq(Object seq); + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/TbIntentMasterRepo.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/TbIntentMasterRepo.java new file mode 100644 index 0000000..c032d24 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/TbIntentMasterRepo.java @@ -0,0 +1,28 @@ +package com.icomsys.main_vm.db.jpa.repo.system; + +import com.icomsys.main_vm.db.jpa.entity.conversation.TbIntentMaster; +import com.icomsys.main_vm.db.jpa.repo.system.dsl.TbIntentMasterRepoDsl; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Modifying; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; + +public interface TbIntentMasterRepo extends JpaRepository, TbIntentMasterRepoDsl { + + List findByUseYnAndOprMngCode(String use, String opr); + + @Modifying + @Transactional + @Query( + value = "UPDATE TB_INTENT_MASTER " + + "set USE_YN = :useYn " + + "where SEQ = :seq " + ,nativeQuery = true + ) + int deleteDictionary(@Param("useYn") String useYn, @Param("seq") Long seq); + + boolean existsByIntentNameAndUseYn(String intentName, String use); +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/TbServiceAuthGroupRepo.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/TbServiceAuthGroupRepo.java new file mode 100644 index 0000000..839259b --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/TbServiceAuthGroupRepo.java @@ -0,0 +1,18 @@ +package com.icomsys.main_vm.db.jpa.repo.system; + +import com.icomsys.main_vm.db.jpa.entity.system.TbServiceAuthGroup; +import com.icomsys.main_vm.db.jpa.entity.system.id.TbServiceAuthGroupId; +import com.icomsys.main_vm.db.jpa.repo.system.dsl.TbServiceAuthGroupRepoDsl; +import org.springframework.data.jpa.repository.JpaRepository; + +import java.util.List; +import java.util.Optional; + +public interface TbServiceAuthGroupRepo extends JpaRepository , TbServiceAuthGroupRepoDsl { + + List findByServiceGroup(String serviceGroup); + + Optional findByAuthGroupSeq(Long seq); + + List findByCustCodeAndServiceGroup(String cust, String service); +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/TbServiceGrouopRepo.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/TbServiceGrouopRepo.java new file mode 100644 index 0000000..ab35d82 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/TbServiceGrouopRepo.java @@ -0,0 +1,26 @@ +package com.icomsys.main_vm.db.jpa.repo.system; + +import com.icomsys.main_vm.db.jpa.entity.system.TbServiceGrouop; +import com.icomsys.main_vm.db.jpa.entity.system.id.TbServiceGrouopId; +import com.icomsys.main_vm.db.jpa.repo.system.dsl.TbServiceGrouopRepoDsl; +import org.springframework.data.jpa.repository.JpaRepository; + +import java.util.List; +import java.util.Optional; + +public interface TbServiceGrouopRepo extends JpaRepository, TbServiceGrouopRepoDsl { + + List findByServiceGroupIn(List service); + List findByServiceGroupInAndServiceGroupUpper(List service, String lastService); + Optional findByServiceGroup(String serviceGroup); + List findByServiceGroupUpperAndServiceType(String serviceGroup, String type); + List findByServiceGroupUpper(String serviceGroup); + boolean existsByCustCodeAndServiceGroup(String custCode, String service); + List findByServiceType(String type); + boolean existsByServiceGroup(String service); + List findByCustCodeAndServiceType(String cust,String type); + List findByCustCode(String cust); + Optional findByServiceGroupAndCustCode(String service, String cust); + TbServiceGrouop findByCustCodeAndServiceGroup(String custCode, String service); + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/TbServiceGroupPolicyRepo.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/TbServiceGroupPolicyRepo.java new file mode 100644 index 0000000..12315b4 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/TbServiceGroupPolicyRepo.java @@ -0,0 +1,18 @@ +package com.icomsys.main_vm.db.jpa.repo.system; + +import com.icomsys.main_vm.db.jpa.entity.system.TbServiceGroupPolicy; +import com.icomsys.main_vm.db.jpa.entity.system.id.TbServiceGroupPolicyId; +import org.springframework.data.jpa.repository.JpaRepository; + +import java.util.List; + +public interface TbServiceGroupPolicyRepo extends JpaRepository { + + List findByAuthGroupSeq(Long seq); + void deleteByServiceGroupInAndPolicyValIn(List service, List delpol); + void deleteByServiceGroupAndPolicyValIn(String service, List delpol); + void deleteByAuthGroupSeqAndPolicyValIn(Long authSeq, List delpol); + boolean existsByAuthGroupSeq(Long seq); + + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/TbSynonymMasterRepo.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/TbSynonymMasterRepo.java new file mode 100644 index 0000000..1d44d2c --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/TbSynonymMasterRepo.java @@ -0,0 +1,30 @@ +package com.icomsys.main_vm.db.jpa.repo.system; + +import com.icomsys.main_vm.db.jpa.repo.system.dsl.TbSynonymMasterRepoDsl; +import com.icomsys.main_vm.db.jpa.entity.conversation.TbSynonymMaster; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Modifying; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; +import org.springframework.transaction.annotation.Transactional; + +import java.util.HashMap; +import java.util.List; +import java.util.Optional; + +public interface TbSynonymMasterRepo extends JpaRepository, TbSynonymMasterRepoDsl { + + List findByUseYnAndOprMngCode(String use, String opr); + + /* @Modifying + @Transactional + @Query( + value = "UPDATE TB_SYNONYM_MASTER " + + "set USE_YN = 'N' " + + "where SEQ = :seq " + , nativeQuery = true + )*/ + //int deleteSynonym(@Param("seq") HashMap eMap); + boolean existsBySeq(Long seq); + Optional findBySeq(Long seq); +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/TbSynonymWordRepo.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/TbSynonymWordRepo.java new file mode 100644 index 0000000..b791f07 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/TbSynonymWordRepo.java @@ -0,0 +1,16 @@ +package com.icomsys.main_vm.db.jpa.repo.system; + +import com.icomsys.main_vm.db.jpa.entity.conversation.TbIntentExample; +import com.icomsys.main_vm.db.jpa.entity.conversation.TbSynonymWord; +import com.icomsys.main_vm.db.jpa.repo.system.dsl.TbSynonymWordRepoDsl; +import org.springframework.data.jpa.repository.JpaRepository; + +import java.util.List; +import java.util.Optional; + +public interface TbSynonymWordRepo extends JpaRepository, TbSynonymWordRepoDsl { + + Optional findBySynonymWordAndOprMngCode(String synonymWord, String serviceCode); + + List findByMasterSeqAndUseYn(Long seq, String useYn); +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/TbUserAuthGroupRepo.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/TbUserAuthGroupRepo.java new file mode 100644 index 0000000..3fe37ff --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/TbUserAuthGroupRepo.java @@ -0,0 +1,25 @@ +package com.icomsys.main_vm.db.jpa.repo.system; + +import com.icomsys.main_vm.db.jpa.entity.system.TbBotUser; +import com.icomsys.main_vm.db.jpa.entity.system.TbUserAuthGroup; +import com.icomsys.main_vm.db.jpa.entity.system.id.TbUserAuthGroupId; +import com.icomsys.main_vm.db.jpa.repo.system.dsl.TbUserAuthGroupRepoDsl; +import org.springframework.data.jpa.repository.JpaRepository; + +import java.util.List; +import java.util.Optional; + +public interface TbUserAuthGroupRepo extends JpaRepository, TbUserAuthGroupRepoDsl { + + boolean existsByAuthGroupSeq(Long authGroupSeq); + + boolean existsByServiceGroupAndUserSeqAndAuthGroupSeqNot(String service, Long userSeq, Long authSeq); + + + List findByAuthGroupSeq(Long authGroupSeq); + + List findByUserSeq(Long userSeq); + + List findByUserSeqAndServiceGroupAndCustCode(Long user, String service, String cust); + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/TbUserCustRepo.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/TbUserCustRepo.java new file mode 100644 index 0000000..0aa8e02 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/TbUserCustRepo.java @@ -0,0 +1,14 @@ +package com.icomsys.main_vm.db.jpa.repo.system; + +import com.icomsys.main_vm.db.jpa.entity.system.TbUserCust; +import com.icomsys.main_vm.db.jpa.entity.system.id.TbUserCustId; +import org.springframework.data.jpa.repository.JpaRepository; + +import java.util.List; + +public interface TbUserCustRepo extends JpaRepository { + + List findByUserSeqAndServiceGroup(Long seq, String lastService); + List findByUserSeq(Long seq); + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/dsl/TbBotCommonCodeRepoDsl.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/dsl/TbBotCommonCodeRepoDsl.java new file mode 100644 index 0000000..caeb96f --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/dsl/TbBotCommonCodeRepoDsl.java @@ -0,0 +1,11 @@ +package com.icomsys.main_vm.db.jpa.repo.system.dsl; + +import com.icomsys.main_vm.biz.common.system.vo.SystemCommoncodeReq; +import com.icomsys.main_vm.biz.common.system.vo.SystemCommoncodeRes; +import com.querydsl.core.QueryResults; + +public interface TbBotCommonCodeRepoDsl { + QueryResults SystemCommoncodeList(SystemCommoncodeReq dto); + QueryResults SystemCommoncodeCallNumList(SystemCommoncodeReq dto); + QueryResults SystemCommoncodeProductList(SystemCommoncodeReq dto); +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/dsl/TbBotCommonCodeRepoDslImpl.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/dsl/TbBotCommonCodeRepoDslImpl.java new file mode 100644 index 0000000..724cf35 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/dsl/TbBotCommonCodeRepoDslImpl.java @@ -0,0 +1,187 @@ +package com.icomsys.main_vm.db.jpa.repo.system.dsl; + +import com.google.gson.Gson; +import com.icomsys.main_vm.biz.common.system.vo.SystemCommoncodeReq; +import com.icomsys.main_vm.biz.common.system.vo.SystemCommoncodeRes; +import com.icomsys.main_vm.common.code.enumresource.RoleResource; +import com.icomsys.main_vm.db.jpa.entity.system.QTbBotCommonCode; +import com.icomsys.main_vm.db.jpa.entity.system.QTbIcsOprMngInfo; +import com.icomsys.main_vm.db.jpa.entity.system.QTbServiceGrouop; +import com.icomsys.main_vm.db.jpa.entity.system.QTbUserCust; +import com.querydsl.core.QueryResults; +import com.querydsl.core.types.Projections; +import com.querydsl.core.types.dsl.BooleanExpression; +import com.querydsl.jpa.impl.JPAQueryFactory; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.aspectj.lang.annotation.Aspect; + +@Aspect +@Slf4j +@RequiredArgsConstructor +public class TbBotCommonCodeRepoDslImpl implements TbBotCommonCodeRepoDsl { + private final JPAQueryFactory queryFactory; + private QTbBotCommonCode qTbBotCommonCode = QTbBotCommonCode.tbBotCommonCode; + private QTbServiceGrouop qTbServiceGrouop = QTbServiceGrouop.tbServiceGrouop; + private QTbIcsOprMngInfo qTbIcsOprMngInfo = QTbIcsOprMngInfo.tbIcsOprMngInfo; + private QTbUserCust qTbUserCust = QTbUserCust.tbUserCust; + + @Override + public QueryResults SystemCommoncodeList(SystemCommoncodeReq dto) { + + + QueryResults result = null; + if (dto.getUserVo().getRoleVal().equals(RoleResource.SYSTEMADMIN.getName())) { + return result = queryFactory.select( + Projections.fields( + SystemCommoncodeRes.class, + qTbServiceGrouop.custCode, + qTbServiceGrouop.serviceGroupName, + qTbIcsOprMngInfo.serviceGroup, + qTbBotCommonCode.oprMngCode, + qTbBotCommonCode.minorCode, + qTbBotCommonCode.majorCode, + qTbBotCommonCode.codeName, + qTbBotCommonCode.attribute1, + qTbBotCommonCode.attribute2, + qTbBotCommonCode.attribute3 + ) + ) + .from(qTbBotCommonCode) + .innerJoin(qTbIcsOprMngInfo).on(qTbBotCommonCode.oprMngCode.eq(qTbIcsOprMngInfo.oprMngCode)) + .innerJoin(qTbServiceGrouop).on(qTbServiceGrouop.serviceGroup.eq(qTbIcsOprMngInfo.serviceGroup)) + .where( + qTbServiceGrouopeq(dto) + , typeeq(dto) + ) + .limit(dto.getSize()) + .offset(dto.getPage() * dto.getSize()) + .orderBy(qTbBotCommonCode.majorCode.asc(), qTbBotCommonCode.registDate.desc()) + .fetchResults(); + } + else { + return result = queryFactory.select( + Projections.fields( + SystemCommoncodeRes.class, + qTbServiceGrouop.custCode, + qTbServiceGrouop.serviceGroupName, + qTbIcsOprMngInfo.serviceGroup, + qTbBotCommonCode.oprMngCode, + qTbBotCommonCode.minorCode, + qTbBotCommonCode.majorCode, + qTbBotCommonCode.codeName, + qTbBotCommonCode.attribute1, + qTbBotCommonCode.attribute2, + qTbBotCommonCode.attribute3 + ) + ) + .from(qTbServiceGrouop) + .innerJoin(qTbIcsOprMngInfo).on(qTbServiceGrouop.serviceGroup.eq(qTbIcsOprMngInfo.serviceGroup)) + .innerJoin(qTbBotCommonCode).on(qTbIcsOprMngInfo.oprMngCode.eq(qTbBotCommonCode.oprMngCode)) + .where( + qTbServiceGrouop.serviceGroupUpper.eq(dto.getUserVo().getLastUseServiceGroup()) + , qTbServiceGrouopeq(dto) + , typeeq(dto) + ) + .limit(dto.getSize()) + .offset(dto.getPage() * dto.getSize()) + .orderBy(qTbBotCommonCode.majorCode.asc(), qTbBotCommonCode.registDate.desc()) + .fetchResults(); + } + + } + + private BooleanExpression qTbServiceGrouopeq(SystemCommoncodeReq dto) { + return dto.getServiceGroup().equals("ALL") ? + null : qTbServiceGrouop.serviceGroup.eq(dto.getServiceGroup()); + } + + private BooleanExpression typeeq(SystemCommoncodeReq dto) { + log.info(" typeeq dto- {}", new Gson().toJson(dto)); + if (dto.getCodeText() == null || dto.getCodeText().equals("")) { + return null; + } else { + if (dto.getCodeType().equals("ALL")) { + return qTbBotCommonCode.minorCode.upper().contains(dto.getCodeText().toUpperCase()).or(qTbBotCommonCode.majorCode.upper().contains(dto.getCodeText().toUpperCase())); + } else if (dto.getCodeType().equals("major")) { + return qTbBotCommonCode.majorCode.upper().contains(dto.getCodeText().toUpperCase()); + } else if (dto.getCodeType().equals("minor")) { + return qTbBotCommonCode.minorCode.upper().contains(dto.getCodeText().toUpperCase()); + } else { + return null; + } + } + + } + + @Override + public QueryResults SystemCommoncodeCallNumList(SystemCommoncodeReq dto) { + QueryResults result = null; + if (dto.getUserVo().getRoleVal().equals(RoleResource.SYSTEMADMIN.getName())) { + return result = queryFactory.select( + Projections.fields( + SystemCommoncodeRes.class, + qTbBotCommonCode.codeName, + qTbBotCommonCode.attribute1 + ) + ) + .from(qTbBotCommonCode) + .innerJoin(qTbIcsOprMngInfo).on(qTbIcsOprMngInfo.serviceGroup.eq(dto.getServiceGroup()).and(qTbBotCommonCode.oprMngCode.eq(qTbIcsOprMngInfo.oprMngCode))) + .where(qTbBotCommonCode.majorCode.eq("CUST_CALL_NUM")) + .orderBy(qTbBotCommonCode.codeName.asc()) + .fetchResults(); + } else { + return result = queryFactory.select( + Projections.fields( + SystemCommoncodeRes.class, + qTbBotCommonCode.codeName, + qTbBotCommonCode.attribute1 + ) + ) + .from(qTbBotCommonCode) + .innerJoin(qTbIcsOprMngInfo).on(qTbIcsOprMngInfo.serviceGroup.eq(dto.getServiceGroup()).and(qTbBotCommonCode.oprMngCode.eq(qTbIcsOprMngInfo.oprMngCode))) + .where(qTbBotCommonCode.majorCode.eq("CUST_CALL_NUM").and(qTbBotCommonCode.oprMngCode.eq(dto.getOprmngCode()))) + .orderBy(qTbBotCommonCode.codeName.asc()) + .fetchResults(); + } + } + + @Override + public QueryResults SystemCommoncodeProductList(SystemCommoncodeReq dto) { + QueryResults result = null; + if (dto.getUserVo().getRoleVal().equals(RoleResource.SYSTEMADMIN.getName())) { + return result = queryFactory.select( + Projections.fields( + SystemCommoncodeRes.class, + qTbBotCommonCode.minorCode, + qTbBotCommonCode.codeName, + qTbBotCommonCode.attribute1, + qTbBotCommonCode.attribute2, + qTbBotCommonCode.attribute3 + ) + ) + .from(qTbBotCommonCode) + .innerJoin(qTbIcsOprMngInfo).on(qTbIcsOprMngInfo.serviceGroup.eq(dto.getServiceGroup()).and(qTbBotCommonCode.oprMngCode.eq(qTbIcsOprMngInfo.oprMngCode))) + .where(qTbBotCommonCode.majorCode.eq(dto.getCodeType())) + .orderBy(qTbBotCommonCode.codeName.asc()) + .fetchResults(); + } else { + return result = queryFactory.select( + Projections.fields( + SystemCommoncodeRes.class, + qTbBotCommonCode.minorCode, + qTbBotCommonCode.codeName, + qTbBotCommonCode.attribute1, + qTbBotCommonCode.attribute2, + qTbBotCommonCode.attribute3 + ) + ) + .from(qTbBotCommonCode) + .innerJoin(qTbIcsOprMngInfo).on(qTbIcsOprMngInfo.serviceGroup.eq(dto.getServiceGroup()).and(qTbBotCommonCode.oprMngCode.eq(qTbIcsOprMngInfo.oprMngCode))) + .where(qTbBotCommonCode.majorCode.eq(dto.getCodeType()).and(qTbBotCommonCode.oprMngCode.eq(dto.getOprmngCode()))) + .orderBy(qTbBotCommonCode.codeName.asc()) + .fetchResults(); + } + } + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/dsl/TbBotUserRepoDsl.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/dsl/TbBotUserRepoDsl.java new file mode 100644 index 0000000..67519f8 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/dsl/TbBotUserRepoDsl.java @@ -0,0 +1,18 @@ +package com.icomsys.main_vm.db.jpa.repo.system.dsl; + +import com.icomsys.main_vm.biz.common.system.vo.SystemBotUserReq; +import com.icomsys.main_vm.biz.common.system.vo.SystemBotUserRes; +import com.icomsys.main_vm.biz.common.system.vo.SystemServiceAuthGroupUserSearchReq; +import com.icomsys.main_vm.biz.common.system.vo.SystemServiceAuthGroupUserSearchRes; +import com.icomsys.main_vm.biz.test.controller.TestVoUser; +import com.querydsl.core.QueryResults; + +import java.util.List; + +public interface TbBotUserRepoDsl { + + QueryResults SystemUserList(SystemBotUserReq dto, String role); + List AuthGroupUserList(Long authGroupSeq); + public List GroupAuthUpdateDataUserSearch(SystemServiceAuthGroupUserSearchReq dto); +// List testConCat(); +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/dsl/TbBotUserRepoDslImpl.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/dsl/TbBotUserRepoDslImpl.java new file mode 100644 index 0000000..24381af --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/dsl/TbBotUserRepoDslImpl.java @@ -0,0 +1,265 @@ +package com.icomsys.main_vm.db.jpa.repo.system.dsl; + +import com.icomsys.main_vm.biz.common.system.vo.SystemBotUserReq; +import com.icomsys.main_vm.biz.common.system.vo.SystemBotUserRes; +import com.icomsys.main_vm.biz.common.system.vo.SystemServiceAuthGroupUserSearchReq; +import com.icomsys.main_vm.biz.common.system.vo.SystemServiceAuthGroupUserSearchRes; +import com.icomsys.main_vm.biz.test.controller.TestVoUser; +import com.icomsys.main_vm.common.code.enumresource.RoleResource; +import com.icomsys.main_vm.db.jpa.entity.system.*; +import com.querydsl.core.QueryResults; +import com.querydsl.core.types.ExpressionUtils; +import com.querydsl.core.types.Projections; +import com.querydsl.core.types.dsl.BooleanExpression; +import com.querydsl.core.types.dsl.Expressions; +import com.querydsl.jpa.JPAExpressions; +import com.querydsl.jpa.impl.JPAQueryFactory; +import com.querydsl.jpa.sql.JPASQLQuery; +import com.querydsl.sql.SQLExpressions; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.aspectj.lang.annotation.Aspect; + +import java.util.ArrayList; +import java.util.List; + +@Aspect +@Slf4j +@RequiredArgsConstructor +public class TbBotUserRepoDslImpl implements TbBotUserRepoDsl { + + private final JPAQueryFactory queryFactory; + private QTbBotUser qTbBotUser = QTbBotUser.tbBotUser; + private QTbUserCust qTbUserCust = QTbUserCust.tbUserCust; + private QTbServiceGrouop qTbServiceGrouop = QTbServiceGrouop.tbServiceGrouop; + private QTbIcsCustInfo qTbIcsCustInfo = QTbIcsCustInfo.tbIcsCustInfo; + private QTbUserAuthGroup qTbUserAuthGroup = QTbUserAuthGroup.tbUserAuthGroup; + + @Override + public QueryResults SystemUserList(SystemBotUserReq dto, String role) { + QueryResults result = null; + + if (dto.getUserVo().getRoleVal().equals(RoleResource.SYSTEMADMIN.getName())) { + return result = queryFactory.select( + Projections.fields( + SystemBotUserRes.class, + qTbBotUser.custCode, + qTbIcsCustInfo.custName, + qTbBotUser.userSeq, + qTbBotUser.userId, + qTbBotUser.userName, + qTbBotUser.eMail, + qTbBotUser.mobileNo, + qTbBotUser.useYn, + qTbBotUser.registDate + ) + ).from(qTbBotUser) + .innerJoin(qTbIcsCustInfo).on(qTbIcsCustInfo.custCode.eq(qTbBotUser.custCode)) + .where( +// qTbServiceGrouop.serviceGroupUpper.eq(dto.getUserVo().getLastUseServiceGroup()) + qTbCustCodeeq(dto) + , qTbBotUsersearcheq(dto) + , qTbBotUser.roleVal.eq(RoleResource.USERADMIN.getName()).or(qTbBotUser.roleVal.eq(RoleResource.USER.getName())) + ) + + .limit(dto.getSize()) + .offset(dto.getPage() * dto.getSize()) + .orderBy(qTbBotUser.registDate.desc()) + .groupBy( + qTbBotUser.custCode, + qTbIcsCustInfo.custName, + qTbBotUser.userSeq, + qTbBotUser.userId, + qTbBotUser.userName, + qTbBotUser.eMail, + qTbBotUser.mobileNo, + qTbBotUser.useYn, + qTbBotUser.registDate + ) + .fetchResults(); + } else { + return result = queryFactory.select( + Projections.fields( + SystemBotUserRes.class, + qTbBotUser.custCode, + qTbIcsCustInfo.custName, +// qTbServiceGrouop.serviceGroup, +// qTbServiceGrouop.serviceGroupName, + qTbBotUser.userSeq, + qTbBotUser.userId, + qTbBotUser.userName, + qTbBotUser.eMail, + qTbBotUser.mobileNo, + qTbBotUser.useYn, + qTbBotUser.registDate + ) + ).from(qTbBotUser) + .innerJoin(qTbIcsCustInfo).on(qTbBotUser.custCode.eq(qTbIcsCustInfo.custCode)) + .innerJoin(qTbServiceGrouop).on(qTbBotUser.lastUseServiceGroup.eq(qTbServiceGrouop.serviceGroupUpper)) + /* + .from(qTbUserCust) + //내가사용할 수 있는 UserCust의 서비스그룹 + .innerJoin(qTbServiceGrouop).on(qTbUserCust.serviceGroup.eq(qTbServiceGrouop.serviceGroup)) + .innerJoin(qTbIcsCustInfo).on(qTbUserCust.custCode.eq(qTbIcsCustInfo.custCode)) + .innerJoin(qTbBotUser).on(qTbUserCust.userSeq.eq(qTbBotUser.userSeq)) + .where(qTbUserCust.userSeq.eq(dto.getUserVo().getUserSeq()) + , qTbUserCust.serviceGroup.eq(qTbServiceGrouop.serviceGroup) + , qTbServiceGrouop.serviceGroupUpper.eq(dto.getUserVo().getLastUseServiceGroup()) + , qTbServiceGrouopeq(dto) + , qTbBotUsersearcheq(dto) + */ + .where( + qTbServiceGrouop.serviceGroupUpper.eq(dto.getUserVo().getLastUseServiceGroup()) + , qTbCustCodeeq(dto) + , qTbBotUsersearcheq(dto) + , qTbBotUser.roleVal.eq(RoleResource.USERADMIN.getName()).or(qTbBotUser.roleVal.eq(RoleResource.USER.getName())) + ) + .limit(dto.getSize()) + .offset(dto.getPage() * dto.getSize()) + .orderBy(qTbBotUser.registDate.desc()) + .groupBy( + qTbBotUser.custCode, + qTbIcsCustInfo.custName, + qTbBotUser.userSeq, + qTbBotUser.userId, + qTbBotUser.userName, + qTbBotUser.eMail, + qTbBotUser.mobileNo, + qTbBotUser.useYn, + qTbBotUser.registDate + ) + .fetchResults(); + } + } + + private BooleanExpression qTbCustCodeeq(SystemBotUserReq dto) { + return dto.getCustCode().equals("ALL") ? + null : qTbIcsCustInfo.custCode.eq(dto.getCustCode()); + } + + private BooleanExpression qTbBotUsersearcheq(SystemBotUserReq dto) { + if (dto.getCodeText() == null || dto.getCodeText().equals("")) { + return null; + } else { + if (dto.getCodeType().equals("ALL")) { + return qTbBotUser.userId.upper().contains(dto.getCodeText().toUpperCase()).or(qTbBotUser.userName.upper().contains(dto.getCodeText().toUpperCase())); + } else if (dto.getCodeType().equals("userId")) { + return qTbBotUser.userId.upper().contains(dto.getCodeText().toUpperCase()); + } else if (dto.getCodeType().equals("userName")) { + return qTbBotUser.userName.upper().contains(dto.getCodeText().toUpperCase()); + } else { + return null; + } + } + } + + public List AuthGroupUserList(Long authGroupSeq) { + List result = + queryFactory.select( + Projections.fields( + SystemBotUserRes.class, + qTbBotUser.custCode, + qTbIcsCustInfo.custName, +// qTbServiceGrouop.serviceGroup, +// qTbServiceGrouop.serviceGroupName, + qTbBotUser.userSeq, + qTbBotUser.userId, + qTbBotUser.userName, + qTbBotUser.eMail, + qTbBotUser.mobileNo, + qTbBotUser.useYn, + qTbBotUser.registDate + ) + ) + .from(qTbUserAuthGroup) + .innerJoin(qTbBotUser).on(qTbBotUser.userSeq.eq(qTbUserAuthGroup.userSeq)) +// .innerJoin(qTbServiceGrouop).on(qTbServiceGrouop.serviceGroup.eq(qTbUserAuthGroup.serviceGroup)) + .innerJoin(qTbIcsCustInfo).on(qTbIcsCustInfo.custCode.eq(qTbUserAuthGroup.custCode)) + .where(qTbUserAuthGroup.authGroupSeq.eq(authGroupSeq)) + .groupBy(qTbBotUser.custCode, + qTbIcsCustInfo.custName, +// qTbServiceGrouop.serviceGroup, +// qTbServiceGrouop.serviceGroupName, + qTbBotUser.userSeq, + qTbBotUser.userId, + qTbBotUser.userName, + qTbBotUser.eMail, + qTbBotUser.mobileNo, + qTbBotUser.useYn, + qTbBotUser.registDate) + .fetch(); + return result; + } + +// @Override +// public List testConCat() { +// return queryFactory.select( +// Projections.fields( +// TestVoUser.class, +// Expressions.stringTemplate("group_concat( {0} ) ", +// qTbUserAuthGroup.serviceGroup +//// ExpressionUtils.distinctList(JPAExpressions.select(qTbUserAuthGroup.serviceGroup) +//// .from(qTbUserAuthGroup) +//// .where(qTbUserAuthGroup.userSeq.eq(qTbBotUser.userSeq)) +//// .groupBy(qTbUserAuthGroup.serviceGroup))) +// ).as("serviceGroup") +// ) +// ) +// .from(qTbBotUser) +// .innerJoin(qTbUserAuthGroup).on(qTbUserAuthGroup.userSeq.eq(qTbBotUser.userSeq)) +// .fetch(); +// } + +// private String eqTbIntentMasterIntentName(List names) { +// return names != null ? Expressions.allOf( +// names.stream().map(this::isintentName) +// .toArray(BooleanExpression[]::new)) : null; +// } + + public List GroupAuthUpdateDataUserSearch(SystemServiceAuthGroupUserSearchReq dto) { + + List result = new ArrayList<>(); + + result = queryFactory.select( + Projections.fields( + SystemServiceAuthGroupUserSearchRes.class, + qTbBotUser.userSeq, + qTbBotUser.custCode, + qTbBotUser.lastUseServiceGroup, + qTbBotUser.roleVal, + qTbBotUser.userId, + qTbBotUser.userName, + qTbBotUser.eMail, + qTbBotUser.mobileNo, + qTbBotUser.useYn + ) + ) + .from(qTbBotUser) + .where(userTextEq(dto.getUserSearchText())) + .limit(30) + .groupBy( + qTbBotUser.userSeq, + qTbBotUser.custCode, + qTbBotUser.lastUseServiceGroup, + qTbBotUser.roleVal, + qTbBotUser.userId, + qTbBotUser.userName, + qTbBotUser.eMail, + qTbBotUser.mobileNo, + qTbBotUser.useYn + ) + .fetchResults() + .getResults(); + return result; + } + + private BooleanExpression userTextEq(String s){ + if(s == null){ + return null; + } + else { + return qTbBotUser.userId.toUpperCase().contains(s.toUpperCase()).or(qTbBotUser.userName.toUpperCase().contains(s.toUpperCase())); + } + } + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/dsl/TbCustPolicyRepoDsl.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/dsl/TbCustPolicyRepoDsl.java new file mode 100644 index 0000000..325f5b6 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/dsl/TbCustPolicyRepoDsl.java @@ -0,0 +1,13 @@ +package com.icomsys.main_vm.db.jpa.repo.system.dsl; + +import com.icomsys.main_vm.biz.common.system.vo.SystemPolicyMenuReq; +import com.icomsys.main_vm.biz.common.system.vo.SystemPolicyMenuRes; +import com.querydsl.core.QueryResults; + +import java.util.List; + +public interface TbCustPolicyRepoDsl { + + QueryResults PolicyMenuListQueryResult(SystemPolicyMenuReq dto); + List PolicyMenuListQueryList(SystemPolicyMenuReq dto); +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/dsl/TbCustPolicyRepoDslImpl.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/dsl/TbCustPolicyRepoDslImpl.java new file mode 100644 index 0000000..6832fc7 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/dsl/TbCustPolicyRepoDslImpl.java @@ -0,0 +1,143 @@ +package com.icomsys.main_vm.db.jpa.repo.system.dsl; + +import com.google.gson.Gson; +import com.icomsys.main_vm.biz.common.system.vo.SystemBotUserRes; +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.RoleResource; +import com.icomsys.main_vm.db.jpa.entity.system.QTbCustPolicy; +import com.icomsys.main_vm.db.jpa.entity.system.QTbIcsCustInfo; +import com.icomsys.main_vm.db.jpa.entity.system.QTbServiceGrouop; +import com.icomsys.main_vm.db.jpa.entity.system.QTbUserCust; +import com.querydsl.core.QueryResults; +import com.querydsl.core.types.Projections; +import com.querydsl.jpa.impl.JPAQueryFactory; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.aspectj.lang.annotation.Aspect; + +import java.util.List; + +@Aspect +@Slf4j +@RequiredArgsConstructor +public class TbCustPolicyRepoDslImpl implements TbCustPolicyRepoDsl { + + private final JPAQueryFactory queryFactory; + private QTbCustPolicy qTbCustPolicy = QTbCustPolicy.tbCustPolicy; + private QTbIcsCustInfo qTbIcsCustInfo = QTbIcsCustInfo.tbIcsCustInfo; + private QTbServiceGrouop qTbServiceGrouop = QTbServiceGrouop.tbServiceGrouop; + private QTbUserCust qTbUserCust = QTbUserCust.tbUserCust; + + @Override + public QueryResults PolicyMenuListQueryResult(SystemPolicyMenuReq dto) { + log.info("PolicyMenuList - {}", new Gson().toJson(dto)); + QueryResults result = null; + + if (dto.getUserVo().getRoleVal().equals(RoleResource.SYSTEMADMIN.getName())) { + result = queryFactory.select( + Projections.fields( + SystemPolicyMenuRes.class, + qTbCustPolicy.custCode, + qTbIcsCustInfo.custName, + qTbCustPolicy.serviceGroup, + qTbServiceGrouop.serviceGroupName, + qTbCustPolicy.policyVal + ) + ) + .from(qTbCustPolicy) + .innerJoin(qTbIcsCustInfo).on(qTbCustPolicy.custCode.eq(qTbIcsCustInfo.custCode)) + .innerJoin(qTbServiceGrouop).on(qTbCustPolicy.serviceGroup.eq(qTbServiceGrouop.serviceGroup)) + .orderBy(qTbCustPolicy.policyVal.asc()) + .limit(dto.getSize()) + .offset(dto.getSize() * dto.getPage()) + .fetchResults(); + return result; + } else { + log.info("dsl init -{} ", new Gson().toJson(dto) ); + result = queryFactory.select(Projections.fields( + SystemPolicyMenuRes.class, + qTbCustPolicy.custCode, + qTbIcsCustInfo.custName, + qTbCustPolicy.serviceGroup, + qTbServiceGrouop.serviceGroupName, + qTbCustPolicy.policyVal + ) + ) + .from(qTbUserCust) + .innerJoin(qTbServiceGrouop).on(qTbUserCust.serviceGroup.eq(qTbServiceGrouop.serviceGroup)) + .innerJoin(qTbIcsCustInfo).on(qTbUserCust.custCode.eq(qTbIcsCustInfo.custCode)) + .innerJoin(qTbCustPolicy).on(qTbServiceGrouop.serviceGroup.eq(qTbCustPolicy.serviceGroup)) + .where(qTbUserCust.userSeq.eq(dto.getUserVo().getUserSeq()) + , qTbUserCust.serviceGroup.eq(qTbServiceGrouop.serviceGroup) + , qTbServiceGrouop.serviceGroupUpper.eq(dto.getUserVo().getLastUseServiceGroup()) + ) + .limit(dto.getSize()) + .offset(dto.getSize() * dto.getPage()) + .orderBy(qTbCustPolicy.policyVal.asc()) + .groupBy( + qTbCustPolicy.custCode, + qTbIcsCustInfo.custName, + qTbCustPolicy.serviceGroup, + qTbServiceGrouop.serviceGroupName, + qTbCustPolicy.policyVal) + .fetchResults(); + return result; + } + + } + + @Override + public List PolicyMenuListQueryList(SystemPolicyMenuReq dto) { + log.info("PolicyMenuList - {}", new Gson().toJson(dto)); + List result = null; + + if (dto.getUserVo().getRoleVal().equals(RoleResource.SYSTEMADMIN.getName())) { + result = queryFactory.select( + Projections.fields( + SystemPolicyMenuRes.class, + qTbCustPolicy.custCode, + qTbIcsCustInfo.custName, + qTbCustPolicy.serviceGroup, + qTbServiceGrouop.serviceGroupName, + qTbCustPolicy.policyVal + ) + ) + .from(qTbCustPolicy) + .innerJoin(qTbIcsCustInfo).on(qTbCustPolicy.custCode.eq(qTbIcsCustInfo.custCode)) + .innerJoin(qTbServiceGrouop).on(qTbCustPolicy.serviceGroup.eq(qTbServiceGrouop.serviceGroup)) + .orderBy(qTbCustPolicy.policyVal.asc()) + .fetch(); + return result; + } else { + result = queryFactory.select(Projections.fields( + SystemPolicyMenuRes.class, + qTbCustPolicy.custCode, + qTbIcsCustInfo.custName, + qTbCustPolicy.serviceGroup, + qTbServiceGrouop.serviceGroupName, + qTbCustPolicy.policyVal + ) + ) + .from(qTbUserCust) + .innerJoin(qTbServiceGrouop).on(qTbUserCust.serviceGroup.eq(qTbServiceGrouop.serviceGroup)) + .innerJoin(qTbIcsCustInfo).on(qTbUserCust.custCode.eq(qTbIcsCustInfo.custCode)) + .innerJoin(qTbCustPolicy).on(qTbServiceGrouop.serviceGroup.eq(qTbCustPolicy.serviceGroup)) + .where(qTbUserCust.userSeq.eq(dto.getUserVo().getUserSeq()) + , qTbUserCust.serviceGroup.eq(qTbServiceGrouop.serviceGroup) + , qTbServiceGrouop.serviceGroupUpper.eq(dto.getUserVo().getLastUseServiceGroup()) + ) + .orderBy(qTbCustPolicy.policyVal.asc()) + .groupBy( + qTbCustPolicy.custCode, + qTbIcsCustInfo.custName, + qTbCustPolicy.serviceGroup, + qTbServiceGrouop.serviceGroupName, + qTbCustPolicy.policyVal) + .fetch(); + return result; + } + } + + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/dsl/TbIcsCustInfoRepoDsl.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/dsl/TbIcsCustInfoRepoDsl.java new file mode 100644 index 0000000..fc18068 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/dsl/TbIcsCustInfoRepoDsl.java @@ -0,0 +1,11 @@ +package com.icomsys.main_vm.db.jpa.repo.system.dsl; + +import com.icomsys.main_vm.biz.common.system.vo.SystemIcsCustInfoReq; +import com.icomsys.main_vm.biz.common.system.vo.SystemIcsCustInfoRes; +import com.querydsl.core.QueryResults; + +public interface TbIcsCustInfoRepoDsl { + + QueryResults SelectCustInfo(SystemIcsCustInfoReq dto); + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/dsl/TbIcsCustInfoRepoDslImpl.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/dsl/TbIcsCustInfoRepoDslImpl.java new file mode 100644 index 0000000..4619bc4 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/dsl/TbIcsCustInfoRepoDslImpl.java @@ -0,0 +1,56 @@ +package com.icomsys.main_vm.db.jpa.repo.system.dsl; + + +import com.icomsys.main_vm.biz.common.system.vo.SystemIcsCustInfoReq; +import com.icomsys.main_vm.biz.common.system.vo.SystemIcsCustInfoRes; +import com.icomsys.main_vm.db.jpa.entity.system.QTbIcsCustInfo; +import com.querydsl.core.QueryResults; +import com.querydsl.core.types.Projections; +import com.querydsl.core.types.dsl.BooleanExpression; +import com.querydsl.jpa.impl.JPAQueryFactory; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.aspectj.lang.annotation.Aspect; + +@Aspect +@Slf4j +@RequiredArgsConstructor +public class TbIcsCustInfoRepoDslImpl implements TbIcsCustInfoRepoDsl { + private final JPAQueryFactory queryFactory; + private QTbIcsCustInfo qTbIcsCustInfo = QTbIcsCustInfo.tbIcsCustInfo; + + @Override + public QueryResults SelectCustInfo(SystemIcsCustInfoReq dto) { + QueryResults result = + queryFactory.select( + Projections.fields( + SystemIcsCustInfoRes.class, + qTbIcsCustInfo.custCode, + qTbIcsCustInfo.custName, + qTbIcsCustInfo.custTel, + qTbIcsCustInfo.custServiceMent, + qTbIcsCustInfo.useYn, + qTbIcsCustInfo.registId, + qTbIcsCustInfo.registDate, + qTbIcsCustInfo.updateId, + qTbIcsCustInfo.updateDate + ) + ) + .from(qTbIcsCustInfo) + .where(custNameeq(dto)) + .orderBy(qTbIcsCustInfo.registDate.desc()) + .limit(dto.getSize()) + .offset(dto.getSize() * dto.getPage()) + .fetchResults(); + return result; + } + + private BooleanExpression custNameeq(SystemIcsCustInfoReq dto){ + if (dto.getCodeText() == null || dto.getCodeText().equals("")) { + return null; + } else { + return qTbIcsCustInfo.custName.upper().contains(dto.getCodeText().toUpperCase()); + } + } + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/dsl/TbIcsLogDsl.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/dsl/TbIcsLogDsl.java new file mode 100644 index 0000000..9c2f01a --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/dsl/TbIcsLogDsl.java @@ -0,0 +1,13 @@ +package com.icomsys.main_vm.db.jpa.repo.system.dsl; + +import com.icomsys.main_vm.biz.rcp.conversation.vo.ConversationScenarioWorkHistoryRes; +import com.icomsys.main_vm.biz.rcp.monitoring.vo.RetrieveWorkHstListVo; +import com.icomsys.main_vm.biz.rcp.monitoring.vo.SearchWorkHstVo; +import com.querydsl.core.QueryResults; + +public interface TbIcsLogDsl { + + QueryResults retrieveWorkHst(SearchWorkHstVo searchWorkHstVo); + + QueryResults scenarioWorkHistory(String menuAuth, String scenarioSeq); +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/dsl/TbIcsLogDslImpl.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/dsl/TbIcsLogDslImpl.java new file mode 100644 index 0000000..22c09aa --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/dsl/TbIcsLogDslImpl.java @@ -0,0 +1,127 @@ +package com.icomsys.main_vm.db.jpa.repo.system.dsl; + +import com.icomsys.main_vm.biz.rcp.conversation.vo.ConversationScenarioWorkHistoryRes; +import com.icomsys.main_vm.biz.rcp.monitoring.vo.RetrieveWorkHstListVo; +import com.icomsys.main_vm.biz.rcp.monitoring.vo.SearchWorkHstVo; +import com.icomsys.main_vm.common.code.enumresource.MenuResource; +import com.icomsys.main_vm.db.jpa.entity.conversation.QTbIcsLog; +import com.icomsys.main_vm.db.jpa.entity.system.QTbBotCommonCode; +import com.icomsys.main_vm.db.jpa.entity.system.QTbBotUser; +import com.icomsys.main_vm.db.jpa.entity.system.QTbIcsOprMngInfo; +import com.icomsys.main_vm.db.jpa.entity.system.QTbServiceGrouop; +import com.querydsl.core.QueryResults; +import com.querydsl.core.types.ConstantImpl; +import com.querydsl.core.types.Projections; +import com.querydsl.core.types.dsl.Expressions; +import com.querydsl.core.types.dsl.StringTemplate; +import com.querydsl.jpa.impl.JPAQueryFactory; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.aspectj.lang.annotation.Aspect; + +@Aspect +@Slf4j +@RequiredArgsConstructor +public class TbIcsLogDslImpl implements TbIcsLogDsl { + + private final JPAQueryFactory queryFactory; + QTbIcsLog qTbIcsLog = QTbIcsLog.tbIcsLog; + QTbBotUser qTbBotUser = QTbBotUser.tbBotUser; + QTbServiceGrouop qTbServiceGrouop = QTbServiceGrouop.tbServiceGrouop; + QTbIcsOprMngInfo qTbIcsOprMngInfo = QTbIcsOprMngInfo.tbIcsOprMngInfo; + + StringTemplate dateTemplate = Expressions.stringTemplate( + "DATE_FORMAT({0}, {1})" + , qTbIcsLog.registDate + , ConstantImpl.create("%Y-%m-%d") + ); + + @Override + public QueryResults retrieveWorkHst(SearchWorkHstVo searchWorkHstVo) { + QueryResults result = null; + + var query = queryFactory.select( + Projections.fields(RetrieveWorkHstListVo.class + , qTbIcsLog.seq + , Expressions.stringTemplate( + "DATE_FORMAT({0}, {1})" + , qTbIcsLog.registDate + , ConstantImpl.create("%Y-%m-%d %H:%i:%s") + ).as("registDate") +// , qTbIcsLog.serviceGroup.coalesce("-").as("serviceGroup") + , qTbServiceGrouop.serviceGroupName.coalesce("-").as("serviceGroup") + , qTbIcsLog.userId + , qTbBotUser.userName + , qTbIcsLog.menuAuth + , qTbIcsLog.actionCode + , qTbIcsLog.ip + , qTbIcsLog.remark.coalesce("-").as("remark"))) + .from(qTbIcsLog) + .innerJoin(qTbBotUser).on(qTbIcsLog.userId.eq(qTbBotUser.userId)) + .innerJoin(qTbServiceGrouop).on(qTbIcsLog.serviceGroup.eq(qTbServiceGrouop.serviceGroup)) + .where(dateTemplate.goe(searchWorkHstVo.getStartDate()) + .and(dateTemplate.loe(searchWorkHstVo.getEndDate()))); + query.limit(searchWorkHstVo.getSize()).offset(searchWorkHstVo.getPage() * searchWorkHstVo.getSize()); + //조회조건 + if (searchWorkHstVo.getSearchKey1().equals("id")) { + query.where(qTbIcsLog.userId.upper().contains(searchWorkHstVo.getCodeText().toUpperCase())); + } + if (searchWorkHstVo.getSearchKey1().equals("userName")) { + query.where(qTbBotUser.userName.upper().contains(searchWorkHstVo.getCodeText().toUpperCase())); + } + if (searchWorkHstVo.getSearchKey1().equals("ip")) { + query.where(qTbIcsLog.ip.upper().contains(searchWorkHstVo.getCodeText().toUpperCase())); + } + if (searchWorkHstVo.getSearchKey1().equals("remark")) { + query.where(qTbIcsLog.remark.upper().contains(searchWorkHstVo.getCodeText().toUpperCase())); + } + if (searchWorkHstVo.getServiceGroup() != null && !(searchWorkHstVo.getServiceGroup().equals("ALL"))) { + query.where(qTbIcsLog.serviceGroup.eq(searchWorkHstVo.getServiceGroup())); + } + if (searchWorkHstVo.getMenuCategory() != null && !(searchWorkHstVo.getMenuCategory().equals("ALL"))) { + query.where(qTbIcsLog.actionCode.eq(searchWorkHstVo.getMenuCategory())); + } + if (searchWorkHstVo.getMenuName() != null && !(searchWorkHstVo.getMenuName().equals("ALL"))) { + query.where(qTbIcsLog.menuAuth.eq(searchWorkHstVo.getMenuName())); + } + //order By + query.orderBy(qTbIcsLog.seq.desc()); + result = query.fetchResults(); + + return result; + } + + public QueryResults scenarioWorkHistory(String menuAuth, String scenarioSeq) { + QueryResults result = queryFactory.select( + Projections.fields( + ConversationScenarioWorkHistoryRes.class, + qTbIcsLog.seq, + qTbIcsLog.registDate, + qTbIcsLog.actionCode, + qTbIcsLog.actionCode.as("action"), // Todo: Common Code 정의 후 다시 생성 +// qTbBotCommonCode.description.as("action"), + qTbIcsLog.userId, + qTbBotUser.userName, + qTbIcsLog.ip, + qTbIcsLog.remark, + qTbIcsLog.attribute1, + qTbIcsLog.attribute2, + qTbIcsLog.attribute3, + qTbIcsLog.attribute4 + ) + ) + .from(qTbIcsLog) + .innerJoin(qTbBotUser).on(qTbIcsLog.userId.eq(qTbBotUser.userId)) +// .innerJoin(qTbBotCommonCode).on(qTbIcsLog.actionCode.eq(qTbBotCommonCode.minorCode)) + .where( qTbIcsLog.menuAuth.eq(menuAuth), + qTbIcsLog.attribute1.eq(scenarioSeq) + ) + .orderBy(qTbIcsLog.registDate.asc()) + .fetchResults(); + + return result; + } + + +} + diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/dsl/TbIcsOprMngInfoRepoDsl.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/dsl/TbIcsOprMngInfoRepoDsl.java new file mode 100644 index 0000000..6b10388 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/dsl/TbIcsOprMngInfoRepoDsl.java @@ -0,0 +1,6 @@ +package com.icomsys.main_vm.db.jpa.repo.system.dsl; + +public interface TbIcsOprMngInfoRepoDsl { + + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/dsl/TbIcsOprMngInfoRepoDslImpl.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/dsl/TbIcsOprMngInfoRepoDslImpl.java new file mode 100644 index 0000000..3e3fc79 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/dsl/TbIcsOprMngInfoRepoDslImpl.java @@ -0,0 +1,19 @@ +package com.icomsys.main_vm.db.jpa.repo.system.dsl; + +import com.icomsys.main_vm.db.jpa.entity.system.QTbIcsCustInfo; +import com.icomsys.main_vm.db.jpa.entity.system.QTbIcsOprMngInfo; +import com.querydsl.jpa.impl.JPAQueryFactory; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.aspectj.lang.annotation.Aspect; + +@Aspect +@Slf4j +@RequiredArgsConstructor +public class TbIcsOprMngInfoRepoDslImpl implements TbIcsOprMngInfoRepoDsl { + + private final JPAQueryFactory queryFactory; + private QTbIcsCustInfo qTbIcsCustInfo = QTbIcsCustInfo.tbIcsCustInfo; + private QTbIcsOprMngInfo qTbIcsOprMngInfo = QTbIcsOprMngInfo.tbIcsOprMngInfo; + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/dsl/TbIntentExamplRepoDslImpl.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/dsl/TbIntentExamplRepoDslImpl.java new file mode 100644 index 0000000..936b975 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/dsl/TbIntentExamplRepoDslImpl.java @@ -0,0 +1,88 @@ +package com.icomsys.main_vm.db.jpa.repo.system.dsl; + +import java.util.HashMap; + +public class TbIntentExamplRepoDslImpl implements TbIntentExampleRepoDsl { + /* @Override + public void updateDeleteIntentExample(HashMap eMap) { + + + *//*DELETE FROM TB_INTENT_EXAMPLE + + AND INTENT_SEQ = #{intentSeq} + + AND SEQ NOT IN ( + + + + #{item.seq} + + + ) + + *//* + + }*/ + + /* @Override + public void insertIntentExample(HashMap eMap) { + + *//* INSERT INTO TB_INTENT_EXAMPLE ( + INTENT_SEQ + , EXAMPLE_TEXT + , IF_MAPPING_ID + , REGIST_ID + , REGIST_DATE + , UPDATE_ID + , UPDATE_DATE + , USE_YN + ) VALUES + + + + + ( + + + (SELECT IFNULL(MAX(SEQ), 0) FROM TB_INTENT_MASTER), + + + #{intentSeq}, + + + #{item.exampleText}, + #{mappingId}, + #{registId}, + NOW(), + #{registId}, + NOW(), + 'Y' + ) + + + + + ( + + + (SELECT IFNULL(MAX(SEQ), 0) FROM TB_INTENT_MASTER) A, + + + #{intentSeq}, + + + #{exampleText}, + #{registId}, + NOW(), + #{registId}, + NOW(), + 'Y' + ) + + + + + SELECT LAST_INSERT_ID() + *//* + }*/ +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/dsl/TbIntentExampleRepoDsl.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/dsl/TbIntentExampleRepoDsl.java new file mode 100644 index 0000000..c5ff46d --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/dsl/TbIntentExampleRepoDsl.java @@ -0,0 +1,9 @@ +package com.icomsys.main_vm.db.jpa.repo.system.dsl; + +import java.util.HashMap; + +public interface TbIntentExampleRepoDsl { + //void updateDeleteIntentExample(HashMap eMap); + + // void insertIntentExample(HashMap eMap); +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/dsl/TbIntentMasterRepoDsl.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/dsl/TbIntentMasterRepoDsl.java new file mode 100644 index 0000000..6402092 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/dsl/TbIntentMasterRepoDsl.java @@ -0,0 +1,21 @@ +package com.icomsys.main_vm.db.jpa.repo.system.dsl; + +import com.icomsys.main_vm.biz.rcp.conversation.dto.IntentRequestDTO; +import com.icomsys.main_vm.biz.rcp.conversation.vo.SearchIntentListVo; +import com.icomsys.main_vm.biz.rcp.conversation.vo.SelectIntentListVo; +import com.icomsys.main_vm.biz.rcp.conversation.vo.SelectSlotIntentListVo; +import com.icomsys.main_vm.biz.rcp.conversation.vo.intent.ExcelIntentListVo; +import com.icomsys.main_vm.biz.rcp.conversation.vo.intent.IntentSearchVo; +import com.icomsys.main_vm.biz.rcp.conversation.vo.selectIntentEntityNameListVo; + +import java.util.HashMap; +import java.util.List; + +public interface TbIntentMasterRepoDsl { + List selectSlotIntentList(String opr); + ListselectIntentEntityNameList(String opr, String entityType); + List selectIntentList(IntentSearchVo dto); + List excelIntentList(IntentSearchVo dto); + // void updateIntentMaster(HashMap eMap); + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/dsl/TbIntentMasterRepoDslImpl.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/dsl/TbIntentMasterRepoDslImpl.java new file mode 100644 index 0000000..bb5dc51 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/dsl/TbIntentMasterRepoDslImpl.java @@ -0,0 +1,244 @@ +package com.icomsys.main_vm.db.jpa.repo.system.dsl; + +import com.google.gson.Gson; +import com.icomsys.main_vm.biz.rcp.conversation.dto.IntentRequestDTO; +import com.icomsys.main_vm.biz.rcp.conversation.vo.SearchIntentListVo; +import com.icomsys.main_vm.biz.rcp.conversation.vo.SelectIntentListVo; +import com.icomsys.main_vm.biz.rcp.conversation.vo.SelectSlotIntentListVo; +import com.icomsys.main_vm.biz.rcp.conversation.vo.intent.ExcelIntentListVo; +import com.icomsys.main_vm.biz.rcp.conversation.vo.intent.IntentSearchVo; +import com.icomsys.main_vm.biz.rcp.conversation.vo.selectIntentEntityNameListVo; +import com.icomsys.main_vm.db.jpa.entity.conversation.*; +import com.icomsys.main_vm.db.jpa.entity.system.*; +import com.querydsl.core.types.ExpressionUtils; +import com.querydsl.core.types.Projections; +import com.querydsl.core.types.dsl.BooleanExpression; +import com.querydsl.core.types.dsl.Expressions; +import com.querydsl.jpa.JPAExpressions; +import com.querydsl.jpa.impl.JPAQuery; +import com.querydsl.jpa.impl.JPAQueryFactory; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.aspectj.lang.annotation.Aspect; +import org.springframework.transaction.annotation.Transactional; + +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; + +import static com.querydsl.sql.SQLExpressions.set; + +@Aspect +@Slf4j +@RequiredArgsConstructor +public class TbIntentMasterRepoDslImpl implements TbIntentMasterRepoDsl { + + private final JPAQueryFactory queryFactory; + private QTbIntentMaster qTbIntentMaster = QTbIntentMaster.tbIntentMaster; + private QTbSlotMaster qTbSlotMaster = QTbSlotMaster.tbSlotMaster; + private QTbSynonymMaster qTbSynonymMaster = QTbSynonymMaster.tbSynonymMaster; + private QTbDictionaryMaster qTbDictionaryMaster = QTbDictionaryMaster.tbDictionaryMaster; + private QTbBotCommonCode qTbBotCommonCode = QTbBotCommonCode.tbBotCommonCode; + private QTbIntentExample qTbIntentExample = QTbIntentExample.tbIntentExample; + + @Override + public List selectSlotIntentList(String opr) { + + var result = queryFactory.select( + Projections.fields( + SelectSlotIntentListVo.class, + qTbIntentMaster.oprMngCode, + qTbIntentMaster.intentName, + qTbSlotMaster.groupName, + qTbIntentMaster.seq.as("intentSeq") + ) + ) + .from(qTbIntentMaster) + .leftJoin(qTbSlotMaster).on(qTbSlotMaster.oprMngCode.eq(qTbIntentMaster.oprMngCode)) + .where(qTbIntentMaster.useYn.eq("Y").and(qTbIntentMaster.oprMngCode.eq(opr))) + .groupBy(qTbIntentMaster.intentName) + .orderBy(qTbIntentMaster.updateDate.desc()) + .fetch(); + + return result; + } + + @Override + public List selectIntentEntityNameList(String opr, String entityType) { + List result = new ArrayList<>(); + + //if문이 나을듯. + switch (entityType) { + case "B": + result = queryFactory.select( + Projections.fields(selectIntentEntityNameListVo.class, + qTbSynonymMaster.seq, + qTbSynonymMaster.repWord.as("entityName") + ) + ).from(qTbSynonymMaster) + .where(qTbSynonymMaster.useYn.eq("Y") + .and(qTbSynonymMaster.oprMngCode.eq(opr))) + .fetch(); + break; + case "C": + result = queryFactory.select( + Projections.fields(selectIntentEntityNameListVo.class, + qTbDictionaryMaster.seq, + qTbDictionaryMaster.repWord.as("entityName") + ) + ).from(qTbDictionaryMaster) + .where(qTbDictionaryMaster.useYn.eq("Y") + .and(qTbDictionaryMaster.oprMngCode.eq(opr))) + .fetch(); + break; + } + return result; + } + + @Override + public List selectIntentList(IntentSearchVo dto) { + JPAQuery query = null; + query = queryFactory.select( + Projections.fields(SelectIntentListVo.class, + qTbIntentMaster.seq, + qTbIntentMaster.oprMngCode, + qTbIntentMaster.intentName, + qTbIntentMaster.category, + qTbIntentMaster.registId, + qTbIntentMaster.registDate, + qTbIntentMaster.updateId, + qTbIntentMaster.updateDate, + qTbBotCommonCode.codeName, + ExpressionUtils.as( + JPAExpressions.select(qTbIntentExample.count()) + .from(qTbIntentExample) + .where(qTbIntentExample.intentSeq.eq(qTbIntentMaster.seq) + .and(qTbIntentExample.useYn.eq("Y") + ) + ), "exampleCnt") + ) + ).from(qTbIntentMaster) + .innerJoin(qTbBotCommonCode).on(qTbIntentMaster.category.eq(qTbBotCommonCode.minorCode) + .and(qTbBotCommonCode.oprMngCode.eq(dto.getOprMngCodeUpper()))) + .where(qTbIntentMaster.useYn.eq("Y") + .and(qTbBotCommonCode.majorCode.eq("INTENT_GROUP"))); //INTENT_GROUP + + if (dto.getOprMngCode() != null && !(dto.getOprMngCode().equals(""))) { + query.where(qTbIntentMaster.oprMngCode.eq(dto.getOprMngCode())); + } + if (dto.getCategory() != null && !(dto.getCategory().equals(""))) { + query.where(qTbIntentMaster.category.eq(dto.getCategory())); + } + if (dto.getIntentName() != null && !(dto.getIntentName().equals(""))) { + query.where(qTbIntentMaster.intentName.contains(dto.getIntentName())); + } + query.orderBy(qTbIntentMaster.registDate.desc()); + + return query.fetch(); + + + } + +/* List intentnames = null; + String regExp = null; + if (regExp !=null && !regExp.equals("")) { + intentnames = new ArrayList<>(); + intentnames = Arrays.asList(regExp.trim().split("|")); + } + + query.where(qTbIntentMaster.useYn.eq("Y") +// , qTbBotCommonCode.majorCode.eq("INTENT_GROUP") + , eqTbIntentMasterOprMngCode(oprMngCode) + , eqTbIntentMasterCategory(category) + //test case 없어서 확인 못해봄... + , eqTbIntentMasterIntentName(intentnames) + ) + .orderBy(qTbIntentMaster.registDate.desc()); + + return query.fetch(); + } + + private BooleanExpression eqTbIntentMasterOprMngCode(String oprMngCode) { + return oprMngCode != null && !oprMngCode.equals("") && !oprMngCode.equals("ALL") ? qTbIntentMaster.oprMngCode.eq(oprMngCode) : null; + } + + private BooleanExpression eqTbIntentMasterCategory(String category) { + return category != null && !category.equals("") ? qTbIntentMaster.category.eq(category) : null; + } + + //동작할지 모르겠음. + private BooleanExpression eqTbIntentMasterIntentName(List names) { + return names != null ? Expressions.allOf( + names.stream().map(this::isintentName) + .toArray(BooleanExpression[]::new)) : null; + } + + private BooleanExpression isintentName(String intentName) { + return qTbIntentMaster.intentName.contains(intentName); + }*/ + + + /* public void updateIntentMaster(HashMap eMap) { + log.info("dto -> {}", new Gson().toJson(eMap)); + try { + var query = queryFactory.update(qTbIntentMaster) + .set(qTbIntentMaster.updateId, eMap.get("updateId")) + .set(qTbIntentMaster.updateDate, LocalDateTime.now()); + if (dto.getIntentName() != null && !dto.getIntentName().equals("")) { + query.set(qTbIntentMaster.intentName, dto.getIntentName()); + } + if (dto.getCategory() != null && !dto.getCategory().equals("")) { + query.set(qTbIntentMaster.category, dto.getCategory()); + } + if (dto.getUseYn() != null && !dto.getUseYn().equals("")) { + query.set(qTbIntentMaster.useYn, dto.getUseYn()); + } + query.where(qTbIntentMaster.seq.eq(Long.valueOf(dto.getSeq()))); + query.execute(); + }catch (Exception e){ + e.printStackTrace(); + } + }*/ + + @Override + public List excelIntentList(IntentSearchVo dto) { + List result = null; + + var query = queryFactory.select( + Projections.fields(ExcelIntentListVo.class, + qTbIntentMaster.seq + ,qTbIntentMaster.intentName + ,qTbBotCommonCode.codeName +// ,Expressions.stringTemplate("group_concat({0})", qTbIntentExample.exampleText).as("exampleText") + ) + ).from(qTbIntentMaster) + .innerJoin(qTbBotCommonCode).on(qTbIntentMaster.category.eq(qTbBotCommonCode.minorCode) + .and(qTbBotCommonCode.oprMngCode.eq(dto.getOprMngCodeUpper()))) + /*.innerJoin(qTbIntentExample).on(qTbIntentMaster.seq.eq(qTbIntentExample.intentSeq)) + .and(qTbIntentExample.useYn.eq("Y")))*/ + .where(qTbIntentMaster.useYn.eq("Y") + .and(qTbBotCommonCode.majorCode.eq("INTENT_GROUP"))); + if (dto.getOprMngCode() != null && !(dto.getOprMngCode().equals(""))) { + query.where(qTbIntentMaster.oprMngCode.eq(dto.getOprMngCode())); + } + if (dto.getCategory() != null && !(dto.getCategory().equals(""))) { + query.where(qTbIntentMaster.category.eq(dto.getCategory())); + } + if (dto.getIntentName() != null && !(dto.getIntentName().equals(""))) { + query.where(qTbIntentMaster.intentName.contains(dto.getIntentName())); + } + query.groupBy(qTbIntentMaster.seq + , qTbIntentMaster.intentName + , qTbBotCommonCode.codeName + ); + query.orderBy(qTbIntentMaster.intentName.asc()); + + result = query.fetch(); + + return result; + + } + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/dsl/TbServiceAuthGroupRepoDsl.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/dsl/TbServiceAuthGroupRepoDsl.java new file mode 100644 index 0000000..bb8ae37 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/dsl/TbServiceAuthGroupRepoDsl.java @@ -0,0 +1,11 @@ +package com.icomsys.main_vm.db.jpa.repo.system.dsl; + +import com.icomsys.main_vm.biz.common.system.vo.SystemServiceAuthGroupReq; +import com.icomsys.main_vm.biz.common.system.vo.SystemServiceAuthGroupRes; +import com.querydsl.core.QueryResults; + +public interface TbServiceAuthGroupRepoDsl { + + QueryResults ServiceAuthGroupListView(SystemServiceAuthGroupReq uv); + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/dsl/TbServiceAuthGroupRepoDslImpl.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/dsl/TbServiceAuthGroupRepoDslImpl.java new file mode 100644 index 0000000..b0bdb31 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/dsl/TbServiceAuthGroupRepoDslImpl.java @@ -0,0 +1,127 @@ +package com.icomsys.main_vm.db.jpa.repo.system.dsl; + +import com.icomsys.main_vm.biz.common.system.vo.SystemServiceAuthGroupReq; +import com.icomsys.main_vm.biz.common.system.vo.SystemServiceAuthGroupRes; +import com.icomsys.main_vm.common.code.enumresource.RoleResource; +import com.icomsys.main_vm.db.jpa.entity.system.QTbIcsCustInfo; +import com.icomsys.main_vm.db.jpa.entity.system.QTbServiceAuthGroup; +import com.icomsys.main_vm.db.jpa.entity.system.QTbServiceGrouop; +import com.icomsys.main_vm.db.jpa.entity.system.QTbUserCust; +import com.querydsl.core.QueryResults; +import com.querydsl.core.types.Projections; +import com.querydsl.core.types.dsl.BooleanExpression; +import com.querydsl.jpa.impl.JPAQueryFactory; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.aspectj.lang.annotation.Aspect; + +@Aspect +@Slf4j +@RequiredArgsConstructor +public class TbServiceAuthGroupRepoDslImpl implements TbServiceAuthGroupRepoDsl { + + private final JPAQueryFactory queryFactory; + private QTbServiceAuthGroup qTbServiceAuthGroup = QTbServiceAuthGroup.tbServiceAuthGroup; + private QTbServiceGrouop qTbServiceGrouop = QTbServiceGrouop.tbServiceGrouop; + private QTbIcsCustInfo qTbIcsCustInfo = QTbIcsCustInfo.tbIcsCustInfo; + private QTbUserCust qTbUserCust = QTbUserCust.tbUserCust; + + @Override + public QueryResults ServiceAuthGroupListView(SystemServiceAuthGroupReq dto) { +// +// QueryResults result = null; + + if (dto.getUserVo().getRoleVal().equals(RoleResource.SYSTEMADMIN.getName())) { + return queryFactory.select( + Projections.fields( + SystemServiceAuthGroupRes.class, + qTbServiceGrouop.serviceGroup, + qTbServiceGrouop.serviceGroupName, + qTbServiceAuthGroup.authGroupSeq, + qTbServiceAuthGroup.policyGroupName, + qTbServiceAuthGroup.policyGroupDesc, + qTbServiceGrouop.custCode, + qTbServiceAuthGroup.registDate + ) + ) +// .from(qTbUserCust) +// //내가사용할 수 있는 UserCust의 서비스그룹 +// .innerJoin(qTbServiceGrouop).on(qTbUserCust.serviceGroup.eq(qTbServiceGrouop.serviceGroup)) +// .innerJoin(qTbServiceAuthGroup).on(qTbServiceGrouop.serviceGroup.eq(qTbServiceAuthGroup.serviceGroup)) + .from(qTbServiceGrouop) + .innerJoin(qTbServiceAuthGroup).on(qTbServiceGrouop.serviceGroup.eq(qTbServiceAuthGroup.serviceGroup)) + .where( +// qTbUserCust.userSeq.eq(dto.getUserVo().getUserSeq()) +// 현재 사용중인 ServiceTypeM = lastUseServiceGroup로 +// qTbServiceGrouop.serviceGroupUpper.eq(dto.getUserVo().getLastUseServiceGroup()) + qTbServiceGrouopeq(dto) + , qTbServiceAuthGroupNameeq(dto) + ) + .limit(dto.getSize()) + .offset(dto.getPage() * dto.getSize()) + .orderBy(qTbServiceAuthGroup.registDate.desc()) + .groupBy(qTbServiceGrouop.serviceGroup, + qTbServiceGrouop.serviceGroupName, + qTbServiceAuthGroup.authGroupSeq, + qTbServiceAuthGroup.policyGroupName, + qTbServiceAuthGroup.policyGroupDesc, + qTbServiceGrouop.custCode, + qTbServiceAuthGroup.registDate) + .fetchResults(); + } else { + return queryFactory.select( + Projections.fields( + SystemServiceAuthGroupRes.class, + qTbServiceGrouop.serviceGroup, + qTbServiceGrouop.serviceGroupName, + qTbServiceAuthGroup.authGroupSeq, + qTbServiceAuthGroup.policyGroupName, + qTbServiceAuthGroup.policyGroupDesc, + qTbServiceGrouop.custCode, + qTbServiceAuthGroup.registDate + ) + ) +// .from(qTbUserCust) +// //내가사용할 수 있는 UserCust의 서비스그룹 +// .innerJoin(qTbServiceGrouop).on(qTbUserCust.serviceGroup.eq(qTbServiceGrouop.serviceGroup)) +// .innerJoin(qTbServiceAuthGroup).on(qTbServiceGrouop.serviceGroup.eq(qTbServiceAuthGroup.serviceGroup)) + .from(qTbServiceGrouop) + .innerJoin(qTbServiceAuthGroup).on(qTbServiceGrouop.serviceGroup.eq(qTbServiceAuthGroup.serviceGroup)) + .where( +// qTbUserCust.userSeq.eq(dto.getUserVo().getUserSeq()) +// 현재 사용중인 ServiceTypeM = lastUseServiceGroup로 + qTbServiceGrouop.serviceGroupUpper.eq(dto.getUserVo().getLastUseServiceGroup()) + , qTbServiceGrouopeq(dto) + , qTbServiceAuthGroupNameeq(dto) +// , qTbServiceGrouop.serviceType.eq("S") + ) + .limit(dto.getSize()) + .offset(dto.getPage() * dto.getSize()) + .orderBy(qTbServiceAuthGroup.registDate.desc()) + .groupBy(qTbServiceGrouop.serviceGroup, + qTbServiceGrouop.serviceGroupName, + qTbServiceAuthGroup.authGroupSeq, + qTbServiceAuthGroup.policyGroupName, + qTbServiceAuthGroup.policyGroupDesc, + qTbServiceGrouop.custCode, + qTbServiceAuthGroup.registDate) + .fetchResults(); + } + +// return result; + } + + private BooleanExpression qTbServiceGrouopeq(SystemServiceAuthGroupReq dto) { + return dto.getServiceGroup().equals("ALL") ? + null : qTbServiceGrouop.serviceGroup.eq(dto.getServiceGroup()); + } + + private BooleanExpression qTbServiceAuthGroupNameeq(SystemServiceAuthGroupReq dto) { + if (dto.getCodeText() == null || dto.getCodeText().equals("")) { + return null; + } else { + return qTbServiceAuthGroup.policyGroupName.upper().contains(dto.getCodeText().toUpperCase()); + } + } + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/dsl/TbServiceGrouopRepoDsl.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/dsl/TbServiceGrouopRepoDsl.java new file mode 100644 index 0000000..02d9729 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/dsl/TbServiceGrouopRepoDsl.java @@ -0,0 +1,18 @@ +package com.icomsys.main_vm.db.jpa.repo.system.dsl; + +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.system.vo.SystemServiceGroupReq; +import com.icomsys.main_vm.biz.common.system.vo.SystemServiceGroupRes; +import com.icomsys.main_vm.biz.common.system.vo.SystemServiceGroupViewVo; +import com.querydsl.core.QueryResults; + +import java.util.List; + +public interface TbServiceGrouopRepoDsl { + QueryResults ServiceGroupList(SystemServiceGroupReq dto); + List getOprmngCode(UserVo dto, String serviceType, String menuval); + List getMainOprmngCode(UserVo dto); + List getServiceGroupView(String serviceGroup); + List getOprmngCodeAdmin(UserVo dto, String serviceType); +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/dsl/TbServiceGrouopRepoDslImpl.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/dsl/TbServiceGrouopRepoDslImpl.java new file mode 100644 index 0000000..689dc78 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/dsl/TbServiceGrouopRepoDslImpl.java @@ -0,0 +1,311 @@ +package com.icomsys.main_vm.db.jpa.repo.system.dsl; + +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.system.vo.SystemServiceGroupReq; +import com.icomsys.main_vm.biz.common.system.vo.SystemServiceGroupRes; +import com.icomsys.main_vm.biz.common.system.vo.SystemServiceGroupViewVo; +import com.icomsys.main_vm.common.code.enumresource.RoleResource; +import com.icomsys.main_vm.db.jpa.entity.system.*; +import com.querydsl.core.QueryResults; +import com.querydsl.core.types.ExpressionUtils; +import com.querydsl.core.types.Projections; +import com.querydsl.core.types.dsl.BooleanExpression; +import com.querydsl.jpa.JPAExpressions; +import com.querydsl.jpa.impl.JPAQueryFactory; +import com.querydsl.jpa.sql.JPASQLQuery; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.aspectj.lang.annotation.Aspect; + +import java.util.ArrayList; +import java.util.List; + +@Aspect +@Slf4j +@RequiredArgsConstructor +public class TbServiceGrouopRepoDslImpl implements TbServiceGrouopRepoDsl { + + + private final JPAQueryFactory queryFactory; + private final QTbIcsCustInfo qTbIcsCustInfo = QTbIcsCustInfo.tbIcsCustInfo; + private final QTbServiceGrouop qTbServiceGrouop = QTbServiceGrouop.tbServiceGrouop; + private final QTbIcsOprMngInfo qTbIcsOprMngInfo = QTbIcsOprMngInfo.tbIcsOprMngInfo; + private final QTbUserCust qTbUserCust = QTbUserCust.tbUserCust; + private final QTbCustPolicy qTbCustPolicy = QTbCustPolicy.tbCustPolicy; + private final QTbServiceGroupPolicy qTbServiceGroupPolicy = QTbServiceGroupPolicy.tbServiceGroupPolicy; + private final QTbUserAuthGroup qTbUserAuthGroup = QTbUserAuthGroup.tbUserAuthGroup; + + @Override + public QueryResults ServiceGroupList(SystemServiceGroupReq dto) { + QueryResults result = + queryFactory.select( + Projections.fields( + SystemServiceGroupRes.class, + qTbServiceGrouop.custCode, + qTbIcsCustInfo.custName, + qTbServiceGrouop.serviceGroup, + qTbServiceGrouop.serviceGroupName, + qTbServiceGrouop.serviceType, + qTbServiceGrouop.useYn, + qTbServiceGrouop.registDate + ) + ).from(qTbServiceGrouop) + .innerJoin(qTbIcsCustInfo).on(qTbIcsCustInfo.custCode.eq(qTbServiceGrouop.custCode)) + .where(qTbServiceGrouopeq(dto) + , QTbserviceGroupNameeq(dto) + , qTbServiceGrouop.serviceType.eq("M") + ) + .limit(dto.getSize()) + .offset(dto.getPage() * dto.getSize()) + .orderBy(qTbServiceGrouop.registDate.asc()) + .fetchResults(); + return result; + } + + private BooleanExpression qTbServiceGrouopeq(SystemServiceGroupReq dto) { + return dto.getServiceGroup().equals("ALL") ? + null : qTbServiceGrouop.serviceGroup.eq(dto.getServiceGroup()); + } + + private BooleanExpression QTbserviceGroupNameeq(SystemServiceGroupReq dto) { + if (dto.getCodeText() == null || dto.getCodeText().equals("")) { + return null; + } else { + return qTbServiceGrouop.serviceGroupName.upper().contains(dto.getCodeText().toUpperCase()); + } + } + + @Override + public List getOprmngCode(UserVo dto, String serviceType, String menuval) { + List result = new ArrayList<>(); + //시스템어드민은다보여줌. + if (dto.getRoleVal().equals(RoleResource.SYSTEMADMIN.getName())) { + return result = queryFactory.select( + Projections.fields( + OprmngCodeRes.class, + qTbServiceGrouop.custCode, + qTbServiceGrouop.serviceGroup, + qTbServiceGrouop.serviceGroupName, + qTbServiceGrouop.serviceGroupUpper + ) + ) + .from(qTbServiceGrouop) + .where(serviceTypeEq(serviceType), qTbServiceGrouop.useYn.eq("Y")) +// .innerJoin(qTbIcsOprMngInfo).on(qTbServiceGrouop.serviceGroup.eq(qTbIcsOprMngInfo.serviceGroup)) + .groupBy(qTbServiceGrouop.custCode, + qTbServiceGrouop.serviceGroup, + qTbServiceGrouop.serviceGroupName, + qTbServiceGrouop.serviceGroupUpper) + .fetch(); + } else { + if (menuval == null || menuval.equals("")) { + //메뉴발이 없는 유저어드민 + if (dto.getRoleVal().equals(RoleResource.USERADMIN.getName())) { + return result = queryFactory.select( + Projections.fields( + OprmngCodeRes.class, + qTbServiceGrouop.custCode, + qTbServiceGrouop.serviceGroup, + qTbServiceGrouop.serviceGroupName, + qTbServiceGrouop.serviceGroupUpper + ) + ) + .from(qTbServiceGrouop) + .where(serviceTypeEq(serviceType), qTbServiceGrouop.serviceGroupUpper.eq(dto.getLastUseServiceGroup()), qTbServiceGrouop.useYn.eq("Y")) +// .innerJoin(qTbIcsOprMngInfo).on(qTbServiceGrouop.serviceGroup.eq(qTbIcsOprMngInfo.serviceGroup)) + .groupBy(qTbServiceGrouop.custCode, + qTbServiceGrouop.serviceGroup, + qTbServiceGrouop.serviceGroupName, + qTbServiceGrouop.serviceGroupUpper) + .fetch(); + } + //메뉴발이 없는 유저 + else { + return result = queryFactory.select( + Projections.fields( + OprmngCodeRes.class, + qTbServiceGrouop.custCode, + qTbServiceGrouop.serviceGroup, + qTbServiceGrouop.serviceGroupName, + qTbServiceGrouop.serviceGroupUpper + ) + ) + .from(qTbUserCust) + //내가사용할 수 있는 UserCust의 서비스그룹 + .innerJoin(qTbServiceGrouop).on(qTbUserCust.serviceGroup.eq(qTbServiceGrouop.serviceGroup)) + //서비스그룹으로 공통코드 opr 값 뽑기 +// .innerJoin(qTbIcsOprMngInfo).on(qTbServiceGrouop.serviceGroup.eq(qTbIcsOprMngInfo.serviceGroup)) + //뽑은 opr로 공통코드 데이터뽑기 + .where(qTbUserCust.userSeq.eq(dto.getUserSeq()) + //현재 사용중인 ServiceTypeM = lastUseServiceGroup로 + , qTbServiceGrouop.serviceGroupUpper.eq(dto.getLastUseServiceGroup()) + , serviceTypeEq(serviceType) + , qTbServiceGrouop.useYn.eq("Y") + ) + .groupBy(qTbServiceGrouop.custCode, + qTbServiceGrouop.serviceGroup, + qTbServiceGrouop.serviceGroupName, + qTbServiceGrouop.serviceGroupUpper) + .fetch(); + } + } else { + + //메뉴발이 있는 유저어드민 + //유저어드민은 권한 상관 없이 상위서비스그룹의 메뉴들을 다 볼수 있어야함. + if (dto.getRoleVal().equals(RoleResource.USERADMIN.getName())) { + result = queryFactory.select( + Projections.fields( + OprmngCodeRes.class, + qTbServiceGrouop.custCode, + qTbServiceGrouop.serviceGroup, + qTbServiceGrouop.serviceGroupName, + qTbServiceGrouop.serviceGroupUpper + ) + ) + .from(qTbServiceGrouop) +// .innerJoin(qTbServiceGroupPolicy).on(qTbServiceGrouop.serviceGroup.eq(qTbServiceGroupPolicy.serviceGroup)) + .where(qTbServiceGrouop.serviceGroupUpper.eq(dto.getLastUseServiceGroup()) + , serviceTypeEq(serviceType) +// , qTbServiceGroupPolicy.policyVal.like(menuval + "%") + ) + .groupBy(qTbServiceGrouop.custCode, + qTbServiceGrouop.serviceGroup, + qTbServiceGrouop.serviceGroupName, + qTbServiceGrouop.serviceGroupUpper) + .fetch(); + + return result; + } + //메뉴발이 있는 유저 + else { + + result = queryFactory.select( + Projections.fields( + OprmngCodeRes.class, + qTbServiceGrouop.custCode, + qTbServiceGrouop.serviceGroup, + qTbServiceGrouop.serviceGroupName, + qTbServiceGrouop.serviceGroupUpper + ) + ) + .from(qTbUserAuthGroup) + .innerJoin(qTbServiceGroupPolicy).on(qTbUserAuthGroup.authGroupSeq.eq(qTbServiceGroupPolicy.authGroupSeq)) + .innerJoin(qTbServiceGrouop).on(qTbServiceGroupPolicy.serviceGroup.eq(qTbServiceGrouop.serviceGroup)) + .where(qTbUserAuthGroup.userSeq.eq(dto.getUserSeq()), + qTbServiceGroupPolicy.policyVal.like(menuval + "%") +// , qTbServiceGrouop.serviceType.eq("S") + , serviceTypeEq(serviceType), + qTbServiceGrouop.useYn.eq("Y")) + .groupBy(qTbServiceGrouop.custCode, + qTbServiceGrouop.serviceGroup, + qTbServiceGrouop.serviceGroupName, + qTbServiceGrouop.serviceGroupUpper) + .fetch(); + + return result; + } + } + } + } + + private BooleanExpression serviceTypeEq(String serviceType) { + if (serviceType == null || serviceType.equals("")) { + return null; + } else { + return qTbServiceGrouop.serviceType.eq(serviceType); + } + } + + @Override + public List getMainOprmngCode(UserVo dto) { + + List result = new ArrayList<>(); + + if (dto.getRoleVal().equals(RoleResource.SYSTEMADMIN.getName())) { + result = queryFactory.select( + Projections.fields( + OprmngCodeRes.class, + qTbServiceGrouop.serviceGroup, + qTbServiceGrouop.serviceGroupName + ) + ).from(qTbServiceGrouop) + .where(qTbServiceGrouop.serviceType.eq("M")) + .fetch(); + return result; + } else { + result = queryFactory.select( + Projections.fields( + OprmngCodeRes.class, + qTbServiceGrouop.serviceGroup, + qTbServiceGrouop.serviceGroupName + ) + ).from(qTbUserCust) + .innerJoin(qTbServiceGrouop).on(qTbUserCust.serviceGroup.eq(qTbServiceGrouop.serviceGroup)) + .where( + qTbUserCust.userSeq.eq(dto.getUserSeq()) +// , qTbServiceGrouop.serviceType.eq("M") + ) + .groupBy(qTbServiceGrouop.serviceGroup, + qTbServiceGrouop.serviceGroupName) + .fetch(); + return result; + } + } + + @Override + public List getServiceGroupView(String serviceGroup) { + + List result = new ArrayList<>(); + + try { + result = queryFactory.select( + Projections.fields( + SystemServiceGroupViewVo.class, + qTbServiceGrouop.custCode, + qTbServiceGrouop.serviceGroup, + qTbServiceGrouop.serviceGroupName, + qTbServiceGrouop.serviceGroupDesc, + qTbServiceGrouop.serviceType, + qTbServiceGrouop.useYn, + qTbIcsOprMngInfo.oprMngCode + ) + ).from(qTbServiceGrouop) + .innerJoin(qTbIcsOprMngInfo).on(qTbServiceGrouop.serviceGroup.eq(qTbIcsOprMngInfo.serviceGroup)) + .where(qTbServiceGrouop.serviceGroupUpper.eq(serviceGroup)) + .groupBy( + qTbServiceGrouop.custCode, + qTbServiceGrouop.serviceGroup, + qTbServiceGrouop.serviceGroupName, + qTbServiceGrouop.serviceGroupDesc, + qTbServiceGrouop.serviceType, + qTbServiceGrouop.useYn, + qTbIcsOprMngInfo.oprMngCode) + .fetch(); + } catch (Exception e) { + log.info("error - {}", e.getMessage()); + } + return result; + } + + @Override + public List getOprmngCodeAdmin(UserVo dto, String serviceType) { + List result = new ArrayList<>(); + return result = queryFactory.select( + Projections.fields( + OprmngCodeRes.class, + qTbIcsOprMngInfo.serviceGroup, + qTbServiceGrouop.serviceGroupName + ) + ) + .from(qTbServiceGrouop) + .innerJoin(qTbIcsOprMngInfo).on(qTbServiceGrouop.serviceGroup.eq(qTbIcsOprMngInfo.serviceGroup)) + //현재 사용중인 서비스그룹의 하위검색 + .where(qTbServiceGrouop.serviceGroupUpper.eq(dto.getLastUseServiceGroup()) + , serviceTypeEq(serviceType) + ) + .fetch(); + } + + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/dsl/TbSynonymMasterRepoDsl.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/dsl/TbSynonymMasterRepoDsl.java new file mode 100644 index 0000000..0b42ad3 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/dsl/TbSynonymMasterRepoDsl.java @@ -0,0 +1,30 @@ +package com.icomsys.main_vm.db.jpa.repo.system.dsl; + +import com.icomsys.main_vm.biz.rcp.conversation.vo.SynonymWordListVo; +import com.icomsys.main_vm.biz.rcp.conversation.vo.synonym.ExcelSynonymListVo; +import com.icomsys.main_vm.biz.rcp.conversation.vo.synonym.SelectSynonymList2Vo; +import com.icomsys.main_vm.biz.rcp.conversation.vo.synonym.SelectSynonymListVo; +import org.springframework.transaction.annotation.Transactional; + +import java.util.HashMap; +import java.util.List; + +public interface TbSynonymMasterRepoDsl { + + @Transactional(readOnly = true) + List selectSynonymList2(String opr, String repWord); + @Transactional(readOnly = true) + List selectSynonymList(String oprMngCode, String repWord); + Long dupIndivWord(HashMap eMap); + Long dupRepWord(HashMap eMap); + Long selectSynonymMaster(HashMap eMap); + Long dupRepWordN(HashMap eMap); + Long dupSynonymY(HashMap eMap); + Long dupSynonymN(HashMap eMap); + List insertSynonymWord(HashMap eMap); + int deleteSynonyms(HashMap eMap); + + void updateSynonymMaster(HashMap eMap); + + //List excelSynonymList(String opr, String repWord); +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/dsl/TbSynonymMasterRepoDslImpl.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/dsl/TbSynonymMasterRepoDslImpl.java new file mode 100644 index 0000000..289e701 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/dsl/TbSynonymMasterRepoDslImpl.java @@ -0,0 +1,266 @@ +package com.icomsys.main_vm.db.jpa.repo.system.dsl; + + +import com.google.gson.Gson; +import com.icomsys.main_vm.biz.rcp.conversation.vo.SynonymWordListVo; +import com.icomsys.main_vm.biz.rcp.conversation.vo.synonym.ExcelSynonymListVo; +import com.icomsys.main_vm.biz.rcp.conversation.vo.synonym.SelectSynonymList2Vo; +import com.icomsys.main_vm.biz.rcp.conversation.vo.synonym.SelectSynonymListVo; +import com.icomsys.main_vm.db.jpa.entity.conversation.QTbSynonymMaster; +import com.icomsys.main_vm.db.jpa.entity.conversation.QTbSynonymWord; +import com.querydsl.core.types.ExpressionUtils; +import com.querydsl.core.types.Projections; +import com.querydsl.core.types.dsl.Expressions; +import com.querydsl.jpa.JPAExpressions; +import com.querydsl.jpa.impl.JPAQueryFactory; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.aspectj.lang.annotation.Aspect; +import org.springframework.transaction.annotation.Transactional; + +import java.time.LocalDateTime; +import java.util.HashMap; +import java.util.List; + +@Aspect +@Slf4j +@RequiredArgsConstructor +public class TbSynonymMasterRepoDslImpl implements TbSynonymMasterRepoDsl { + + private final JPAQueryFactory queryFactory; + private QTbSynonymMaster qTbSynonymMaster = QTbSynonymMaster.tbSynonymMaster; + private QTbSynonymWord qTbSynonymWord = QTbSynonymWord.tbSynonymWord; + + @Override + public List selectSynonymList(String oprMngCode, String repWord) { + List result = null; + + var query = queryFactory.select(Projections.fields( + SelectSynonymListVo.class, + qTbSynonymMaster.seq, + qTbSynonymMaster.idivWord, + qTbSynonymMaster.repWord + //Expressions.stringTemplate("group_concat({0})", qTbSynonymWord.seq, ",").as("synonymSeqs"), + //Expressions.stringTemplate("group_concat({0})", qTbSynonymWord.synonymWord, ",").as("synonymWords") + ) + ) + .from(qTbSynonymMaster) + .leftJoin(qTbSynonymWord).on(qTbSynonymMaster.seq.eq(qTbSynonymWord.masterSeq) + .and(qTbSynonymWord.useYn.eq("Y"))) + .where(qTbSynonymMaster.useYn.eq("Y") + .and(qTbSynonymWord.useYn.eq("Y") + .and(qTbSynonymMaster.oprMngCode.eq(oprMngCode)))); + if (repWord != null && !(repWord.equals(""))) { + query.where(qTbSynonymMaster.repWord.like("%".concat(repWord).concat("%"))); + } + query.groupBy(qTbSynonymMaster.seq, qTbSynonymMaster.idivWord, qTbSynonymMaster.repWord); + query.orderBy(qTbSynonymMaster.updateDate.desc()); + result = query.fetch(); + + return result; + } + + + //사용안함 + @Override + public List selectSynonymList2(String opr, String repWord) { + log.info("Synonym2 dsl impl"); + + //서브쿼리 리스트 바인딩이.. + var result = queryFactory.select(Projections.fields( + SelectSynonymList2Vo.class, + qTbSynonymMaster.seq, + qTbSynonymMaster.idivWord, + qTbSynonymMaster.repWord, +// qTbSynonymWord.seq.stringValue().as("synonymSeqs"), + ExpressionUtils.as( + JPAExpressions + .select(qTbSynonymWord.seq) + .from(qTbSynonymWord) + .where(qTbSynonymWord.masterSeq.eq(qTbSynonymMaster.seq)), + "synonymSeqs"), +// qTbSynonymWord.synonymWord.stringValue().as("synonymWords") + ExpressionUtils.as(JPAExpressions + .select(qTbSynonymWord.synonymWord) + .from(qTbSynonymWord) + .where(qTbSynonymWord.masterSeq.eq(qTbSynonymMaster.seq)), + "synonymWords") + ) + ) + .from(qTbSynonymMaster) + .leftJoin(qTbSynonymWord).on(qTbSynonymMaster.seq.eq(qTbSynonymWord.masterSeq) + .and(qTbSynonymWord.useYn.eq("Y")) + ) + .where( + qTbSynonymMaster.useYn.eq("Y") + .and(qTbSynonymWord.useYn.eq("Y")) + ).groupBy(qTbSynonymMaster.seq) + .fetch(); + return result; + } + + @Override + public Long dupIndivWord(HashMap eMap) { + Long result = null; + String oprMngCode = eMap.get("custCode") + "_RCP_" + eMap.get("serviceGroup"); + var query = queryFactory.select( + qTbSynonymMaster.count() + ).from(qTbSynonymMaster) + .where(qTbSynonymMaster.idivWord.eq(eMap.get("idivWord").toString()) + .and(qTbSynonymMaster.useYn.eq("Y")) + .and(qTbSynonymMaster.oprMngCode.eq(oprMngCode))); + + if(eMap.get("seq") != null && !(eMap.get("seq").equals(""))) { + query.where(qTbSynonymMaster.seq.ne(Long.valueOf(String.valueOf(eMap.get("seq"))))); + } + result = query.fetchOne(); + return result; + } + + + @Override + public Long dupRepWord(HashMap eMap) { + Long result = null; + String oprMngCode = eMap.get("custCode") + "_RCP_" + eMap.get("serviceGroup"); + + var query = queryFactory.select( + qTbSynonymMaster.count() + ).from(qTbSynonymMaster) + .where(qTbSynonymMaster.repWord.eq(eMap.get("repWord").toString()) + .and(qTbSynonymMaster.useYn.eq("Y")) + .and(qTbSynonymMaster.oprMngCode.eq(oprMngCode))); + if(eMap.get("seq") != null && !(eMap.get("seq").equals(""))) { + query.where(qTbSynonymMaster.seq.ne(Long.valueOf(String.valueOf(eMap.get("seq"))))); + } + result = query.fetchOne(); + return result; + } + + @Override + public Long selectSynonymMaster(HashMap eMap) { + String oprMngCode = eMap.get("custCode") + "_RCP_" + eMap.get("serviceGroup"); + + var query = queryFactory.select( + qTbSynonymMaster.seq + ).from(qTbSynonymMaster) + .where(qTbSynonymMaster.oprMngCode.eq(oprMngCode) + .and(qTbSynonymMaster.idivWord.eq(eMap.get("idivWord").toString()))) + .fetchOne(); + + return query; + } + + @Override + public Long dupRepWordN(HashMap eMap) { + Long result = null; + String oprMngCode = eMap.get("custCode") + "_RCP_" + eMap.get("serviceGroup"); + + var query = queryFactory.select( + qTbSynonymMaster.count() + ).from(qTbSynonymMaster) + .where(qTbSynonymMaster.repWord.eq(eMap.get("repWord").toString()) + .and(qTbSynonymMaster.oprMngCode.eq(oprMngCode))); + if(eMap.get("seq") != null && !(eMap.get("seq").equals(""))) { + query.where(qTbSynonymMaster.seq.ne(Long.valueOf(String.valueOf(eMap.get("seq"))))); + } + result = query.fetchOne(); + return result; + } + + @Override + public Long dupSynonymY(HashMap eMap) { + Long result = null; + String oprMngCode = eMap.get("custCode") + "_RCP_" + eMap.get("serviceGroup"); + + var query = queryFactory.select( + qTbSynonymWord.count() + ).from(qTbSynonymWord) + .where(qTbSynonymWord.synonymWord.eq(eMap.get("synonymWord").toString()) + .and(qTbSynonymWord.useYn.eq("Y")) + .and(qTbSynonymWord.oprMngCode.eq(oprMngCode))); + if (eMap.get("seq") != null && !(eMap.get("seq").equals(""))) { + query.where(qTbSynonymWord.masterSeq.ne(Long.valueOf(String.valueOf(eMap.get("seq"))))); + } + result = query.fetchOne(); + return result; + + } + + @Override + public Long dupSynonymN(HashMap eMap) { + String oprMngCode = eMap.get("custCode") + "_RCP_" + eMap.get("serviceGroup"); + + var query = queryFactory.select( + qTbSynonymWord.count() + ).from(qTbSynonymWord) + .where(qTbSynonymWord.synonymWord.eq(eMap.get("synonymWord").toString()) + .and(qTbSynonymWord.oprMngCode.eq(oprMngCode))) + .fetchOne(); + return query; + } + + @Override + public List insertSynonymWord(HashMap eMap) { + String oprMngCode = eMap.get("custCode") + "_RCP_" + eMap.get("serviceGroup"); + + var query = queryFactory.select( + Projections.fields(SynonymWordListVo.class, + qTbSynonymMaster.seq)) + .from(qTbSynonymMaster) + .where(qTbSynonymMaster.idivWord.eq(eMap.get("idivWord").toString()) + .and(qTbSynonymMaster.oprMngCode.eq(oprMngCode))) + .fetch(); + return query; + } + + @Override + public int deleteSynonyms(HashMap eMap) { + var query = queryFactory.update(qTbSynonymMaster) + .set(qTbSynonymMaster.useYn, "N") + .where(qTbSynonymMaster.seq.eq(Long.valueOf(String.valueOf(eMap.get("seq"))))); + return (int) query.execute(); + + } + + @Override + public void updateSynonymMaster(HashMap eMap) { + var query = queryFactory.update(qTbSynonymMaster) + .set(qTbSynonymMaster.idivWord, eMap.get("idivWord").toString()) + .set(qTbSynonymMaster.repWord, eMap.get("repWord").toString()) + .set(qTbSynonymMaster.useYn, "Y") + .set(qTbSynonymMaster.updateId, eMap.get("userId").toString()) + .set(qTbSynonymMaster.updateDate, LocalDateTime.now()) + .where(qTbSynonymMaster.seq.eq((Long) eMap.get("seq"))) + .execute(); + + } + + /*@Override + public List excelSynonymList(String opr, String repWord) { + List result = null; + + var query = queryFactory.select(Projections.fields( + ExcelSynonymListVo.class, + qTbSynonymMaster.idivWord, + qTbSynonymMaster.repWord + //Expressions.stringTemplate("group_concat({0})", qTbSynonymWord.synonymWord, ",").as("synonymWords") + ) + ) + .from(qTbSynonymMaster) + .leftJoin(qTbSynonymWord).on(qTbSynonymMaster.seq.eq(qTbSynonymWord.masterSeq) + .and(qTbSynonymWord.useYn.eq("Y"))) + .where(qTbSynonymMaster.useYn.eq("Y") + .and(qTbSynonymWord.useYn.eq("Y") + .and(qTbSynonymMaster.oprMngCode.eq(opr)))); + if (repWord != null && !(repWord.equals(""))) { + query.where(qTbSynonymMaster.repWord.like("%".concat(repWord).concat("%"))); + } + query.groupBy(qTbSynonymMaster.seq, qTbSynonymMaster.idivWord, qTbSynonymMaster.repWord); + query.orderBy(qTbSynonymMaster.updateDate.desc()); + result = query.fetch(); + + return result; + }*/ + + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/dsl/TbSynonymWordRepoDsl.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/dsl/TbSynonymWordRepoDsl.java new file mode 100644 index 0000000..0a78c00 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/dsl/TbSynonymWordRepoDsl.java @@ -0,0 +1,14 @@ +package com.icomsys.main_vm.db.jpa.repo.system.dsl; + +import com.icomsys.main_vm.biz.rcp.conversation.vo.SynonymWordListVo; + +import java.util.HashMap; +import java.util.List; + +public interface TbSynonymWordRepoDsl { + + List insertSynonymWord(HashMap eMap); + //List updateSynonymWord(HashMap eMap); + void updateSynonymWord(HashMap eMap); + void deleteSynonymWord(HashMap eMap); +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/dsl/TbSynonymWordRepoDslImpl.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/dsl/TbSynonymWordRepoDslImpl.java new file mode 100644 index 0000000..159eafe --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/dsl/TbSynonymWordRepoDslImpl.java @@ -0,0 +1,80 @@ +package com.icomsys.main_vm.db.jpa.repo.system.dsl; + +import com.google.gson.Gson; +import com.icomsys.main_vm.biz.rcp.conversation.vo.SynonymWordListVo; +import com.icomsys.main_vm.db.jpa.entity.conversation.QTbSynonymMaster; +import com.icomsys.main_vm.db.jpa.entity.conversation.QTbSynonymWord; +import com.icomsys.main_vm.db.jpa.entity.conversation.TbSynonymWord; +import com.icomsys.main_vm.db.mybatis.alias.LoginVO; +import com.querydsl.core.types.ExpressionUtils; +import com.querydsl.core.types.Projections; +import com.querydsl.jpa.JPAExpressions; +import com.querydsl.jpa.impl.JPAQueryFactory; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.aspectj.lang.annotation.Aspect; + +import javax.servlet.http.HttpServletRequest; +import java.time.LocalDateTime; +import java.util.HashMap; +import java.util.List; + +@Aspect +@Slf4j +@RequiredArgsConstructor +public class TbSynonymWordRepoDslImpl implements TbSynonymWordRepoDsl { + + private final JPAQueryFactory queryFactory; + private QTbSynonymMaster qTbSynonymMaster = QTbSynonymMaster.tbSynonymMaster; + private QTbSynonymWord qTbSynonymWord = QTbSynonymWord.tbSynonymWord; + @Override + public List insertSynonymWord(HashMap eMap) { + var query = queryFactory.select( + Projections.fields(SynonymWordListVo.class, + qTbSynonymMaster.seq)) + .from(qTbSynonymMaster) + .where(qTbSynonymMaster.idivWord.eq(eMap.get("idivWord").toString()) + .and(qTbSynonymMaster.oprMngCode.eq(eMap.get("serviceCode").toString()))) + .fetch(); + return query; + } + + + @Override + public void updateSynonymWord(HashMap eMap) { +// var query = queryFactory.select( +// Projections.fields(SynonymWordListVo.class, +// qTbSynonymMaster.seq)) +// .from(qTbSynonymMaster) +// .where(qTbSynonymMaster.idivWord.eq(eMap.get("idivWord").toString()) +// .and(qTbSynonymMaster.oprMngCode.eq(eMap.get("serviceCode").toString())) +// .and(qTbSynonymMaster.useYn.eq("Y"))) +// .fetch(); +// return query; + try { + var query = queryFactory.update(qTbSynonymWord) + .set(qTbSynonymWord.masterSeq, ( + ExpressionUtils.as(JPAExpressions + .select(qTbSynonymMaster.seq).from(qTbSynonymMaster) + .where(qTbSynonymMaster.idivWord.eq(eMap.get("idivWord").toString()) + .and(qTbSynonymMaster.oprMngCode.eq(eMap.get("serviceCode").toString()) + .and(qTbSynonymMaster.useYn.eq("Y")))), "seq"))) + .set(qTbSynonymWord.useYn, "Y") + .set(qTbSynonymWord.updateId, eMap.get("userId").toString()) + .set(qTbSynonymWord.updateDate, LocalDateTime.now()) + .where(qTbSynonymWord.synonymWord.eq(eMap.get("synonymWord").toString()) + .and(qTbSynonymWord.oprMngCode.eq(eMap.get("serviceCode").toString()))) + .execute(); + }catch (Exception e){ + e.printStackTrace(); + } + } + + @Override + public void deleteSynonymWord(HashMap eMap) { + var query = queryFactory.update(qTbSynonymWord) + .set(qTbSynonymWord.useYn, "N") + .where(qTbSynonymWord.masterSeq.eq(Long.valueOf(String.valueOf(eMap.get("seq"))))) + .execute(); + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/dsl/TbUserAuthGroupRepoDsl.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/dsl/TbUserAuthGroupRepoDsl.java new file mode 100644 index 0000000..616aae4 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/dsl/TbUserAuthGroupRepoDsl.java @@ -0,0 +1,15 @@ +package com.icomsys.main_vm.db.jpa.repo.system.dsl; + +import com.icomsys.main_vm.biz.common.system.vo.SystemBotUserViewSubRes; +import com.icomsys.main_vm.db.jpa.entity.system.TbBotUser; + +import java.util.List; + +public interface TbUserAuthGroupRepoDsl { + + List userPolicyListSelect(Long userSeq, String lastService); + + List userUseAuthGroup(Long userSeq); + + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/dsl/TbUserAuthGroupRepoDslImpl.java b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/dsl/TbUserAuthGroupRepoDslImpl.java new file mode 100644 index 0000000..fcd8778 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/jpa/repo/system/dsl/TbUserAuthGroupRepoDslImpl.java @@ -0,0 +1,88 @@ +package com.icomsys.main_vm.db.jpa.repo.system.dsl; + +import com.icomsys.main_vm.biz.common.system.vo.SystemBotUserViewSubRes; +import com.icomsys.main_vm.biz.common.system.vo.SystemServiceGroupRes; +import com.icomsys.main_vm.common.code.enumresource.PolicyResource; +import com.icomsys.main_vm.common.code.enumresource.RoleResource; +import com.icomsys.main_vm.db.jpa.entity.system.*; +import com.querydsl.core.QueryResults; +import com.querydsl.core.types.Projections; +import com.querydsl.jpa.impl.JPAQueryFactory; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.aspectj.lang.annotation.Aspect; + +import java.util.List; +import java.util.stream.Collectors; + +@Aspect +@Slf4j +@RequiredArgsConstructor +public class TbUserAuthGroupRepoDslImpl implements TbUserAuthGroupRepoDsl { + + private final JPAQueryFactory queryFactory; + private final QTbUserAuthGroup qTbUserAuthGroup = QTbUserAuthGroup.tbUserAuthGroup; + private final QTbServiceGroupPolicy qTbServiceGroupPolicy = QTbServiceGroupPolicy.tbServiceGroupPolicy; + private final QTbServiceGrouop qTbServiceGrouop = QTbServiceGrouop.tbServiceGrouop; + private final QTbBotUser qTbBotUser = QTbBotUser.tbBotUser; + private final QTbUserCust qTbUserCust = QTbUserCust.tbUserCust; + + @Override + public List userPolicyListSelect(Long userSeq, String lastService) { + + TbBotUser userget = queryFactory.selectFrom(qTbBotUser).where(qTbBotUser.userSeq.eq(userSeq)) + .fetchOne(); + + if (RoleResource.SYSTEMADMIN.getName().equals(userget.getRoleVal())) { + return PolicyResource.ALL.stream().map(e -> e.getName()).collect(Collectors.toList()); +// return queryFactory.select( +// qTbServiceGroupPolicy.policyVal +// ) +// .from(qTbUserAuthGroup) +// .innerJoin(qTbServiceGroupPolicy).on(qTbUserAuthGroup.authGroupSeq.eq(qTbServiceGroupPolicy.authGroupSeq)) +//// .innerJoin(qTbServiceGrouop).on(qTbServiceGroupPolicy.serviceGroup.eq(qTbServiceGrouop.serviceGroup)) +// .where( +// qTbUserAuthGroup.userSeq.eq(userSeq) +//// , qTbServiceGrouop.serviceGroupUpper.eq(lastService) +// ) +// .groupBy(qTbServiceGroupPolicy.policyVal) +// .fetch(); + } else { + return queryFactory.select( + qTbServiceGroupPolicy.policyVal + ) + .from(qTbServiceGrouop) + .innerJoin(qTbUserCust).on(qTbServiceGrouop.serviceGroup.eq(qTbUserCust.serviceGroup)) + .innerJoin(qTbUserAuthGroup).on(qTbUserCust.serviceGroup.eq(qTbUserAuthGroup.serviceGroup)) + .innerJoin(qTbServiceGroupPolicy).on(qTbUserAuthGroup.authGroupSeq.eq(qTbServiceGroupPolicy.authGroupSeq)) +// .innerJoin(qTbServiceGrouop).on(qTbServiceGroupPolicy.serviceGroup.eq(qTbServiceGrouop.serviceGroup)) + .where( + qTbUserAuthGroup.userSeq.eq(userSeq) + , qTbServiceGrouop.serviceGroupUpper.eq(lastService) + ) + .groupBy(qTbServiceGroupPolicy.policyVal) + .fetch(); + } + + + } + + @Override + public List userUseAuthGroup(Long userSeq) { + List result = + queryFactory.select( + Projections.fields( + SystemBotUserViewSubRes.class, + qTbServiceGrouop.serviceGroup, + qTbServiceGrouop.serviceGroupName, + qTbUserAuthGroup.authGroupSeq + ) + ).from(qTbUserAuthGroup) + .innerJoin(qTbServiceGrouop).on(qTbServiceGrouop.serviceGroup.eq(qTbUserAuthGroup.serviceGroup)) + .where(qTbUserAuthGroup.userSeq.eq(userSeq)) + .fetch(); + + return result; + } + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/mybatis/alias/IntentAnalysisDayVO.java b/main_vm/src/main/java/com/icomsys/main_vm/db/mybatis/alias/IntentAnalysisDayVO.java new file mode 100644 index 0000000..6e1f3cd --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/mybatis/alias/IntentAnalysisDayVO.java @@ -0,0 +1,67 @@ +package com.icomsys.main_vm.db.mybatis.alias; + +public class IntentAnalysisDayVO { + private String oprMngCodeName; + private String callInitDate; + private String totCnt; + private String succCnt; + private String failCnt; + private String succPer; + private String avgIntentPer; + + public String getOprMngCodeName() { + return oprMngCodeName; + } + + public void setOprMngCodeName(String oprMngCodeName) { + this.oprMngCodeName = oprMngCodeName; + } + + public String getCallInitDate() { + return callInitDate; + } + + public void setCallInitDate(String callInitDate) { + this.callInitDate = callInitDate; + } + + public String getTotCnt() { + return totCnt; + } + + public void setTotCnt(String totCnt) { + this.totCnt = totCnt; + } + + public String getSuccCnt() { + return succCnt; + } + + public void setSuccCnt(String succCnt) { + this.succCnt = succCnt; + } + + public String getFailCnt() { + return failCnt; + } + + public void setFailCnt(String failCnt) { + this.failCnt = failCnt; + } + + public String getSuccPer() { + return succPer; + } + + public void setSuccPer(String succPer) { + this.succPer = succPer; + } + + public String getAvgIntentPer() { + return avgIntentPer; + } + + public void setAvgIntentPer(String avgIntentPer) { + this.avgIntentPer = avgIntentPer; + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/mybatis/alias/IntentAnalysisItemVO.java b/main_vm/src/main/java/com/icomsys/main_vm/db/mybatis/alias/IntentAnalysisItemVO.java new file mode 100644 index 0000000..1403ece --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/mybatis/alias/IntentAnalysisItemVO.java @@ -0,0 +1,76 @@ +package com.icomsys.main_vm.db.mybatis.alias; + +public class IntentAnalysisItemVO { + private String oprMngCodeName; + private String intentGroup; + private String intentName; + private String totCnt; + private String succCnt; + private String failCnt; + private String succPer; + private String avgIntentPer; + + public String getOprMngCodeName() { + return oprMngCodeName; + } + + public void setOprMngCodeName(String oprMngCodeName) { + this.oprMngCodeName = oprMngCodeName; + } + + public String getIntentGroup() { + return intentGroup; + } + + public void setIntentGroup(String intentGroup) { + this.intentGroup = intentGroup; + } + + public String getIntentName() { + return intentName; + } + + public void setIntentName(String intentName) { + this.intentName = intentName; + } + + public String getTotCnt() { + return totCnt; + } + + public void setTotCnt(String totCnt) { + this.totCnt = totCnt; + } + + public String getSuccCnt() { + return succCnt; + } + + public void setSuccCnt(String succCnt) { + this.succCnt = succCnt; + } + + public String getFailCnt() { + return failCnt; + } + + public void setFailCnt(String failCnt) { + this.failCnt = failCnt; + } + + public String getSuccPer() { + return succPer; + } + + public void setSuccPer(String succPer) { + this.succPer = succPer; + } + + public String getAvgIntentPer() { + return avgIntentPer; + } + + public void setAvgIntentPer(String avgIntentPer) { + this.avgIntentPer = avgIntentPer; + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/mybatis/alias/LoginVO.java b/main_vm/src/main/java/com/icomsys/main_vm/db/mybatis/alias/LoginVO.java new file mode 100644 index 0000000..6c5c81f --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/mybatis/alias/LoginVO.java @@ -0,0 +1,93 @@ +package com.icomsys.main_vm.db.mybatis.alias; + +import org.springframework.security.crypto.password.PasswordEncoder; + +import java.io.Serializable; + +/** + * @Class Name : LoginVO.java + * @Description : Login VO class + * @Modification Information + * @ + * @ 수정일 수정자 수정내용 + * @ ------- -------- --------------------------- + * @ 2009.03.03 박지욱 최초 생성 + * + * @author 공통서비스 개발팀 박지욱 + * @since 2009.03.03 + * @version 1.0 + * @see + * + */ +public class LoginVO implements Serializable{ + private static final long serialVersionUID = -8274004534207618049L; + + private String userId; + private String userName; + private String eMail; + private String password; + private String authCode; + private String siteCode; + private String systemUserId; + private int loginCheck; + private String update_date; + private String ip; + + public String getUserId() { + return userId; + } + public void setUserId(String userId) { + this.userId = userId; + } + public String getUserName() { + return userName; + } + public void setUserName(String userName) { + this.userName = userName; + } + public String geteMail() { + return eMail; + } + public void seteMail(String eMail) { + this.eMail = eMail; + } + public String getPassword() { + return password; + } + public void setPassword(String password) { + this.password = password; + } + public String getSiteCode() { + return siteCode; + } + public void setSiteCode(String siteCode) { + this.siteCode = siteCode; + } + public String getSystemUserId() { + return systemUserId; + } + public void setSystemUserId(String systemUserId) { + this.systemUserId = systemUserId; + } + public String getAuthCode() { + return authCode; + } + public void setAuthCode(String authCode) { + this.authCode = authCode; + } + public int getLoginCheck() { return loginCheck; } + public void setLoginCheck(int loginCheck) { this.loginCheck = loginCheck; } + public String getIp() { + return ip; + } + public void setIp(String ip) { + this.ip = ip; + } + public String getUpdate_date() { return update_date; } + public void setUpdate_date(String update_date) { this.update_date = update_date; } + + public boolean ofValid(PasswordEncoder passwordEncoder, String dbPass) { + return passwordEncoder.matches(this.password, dbPass); + } + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/mybatis/alias/MenuManageVO.java b/main_vm/src/main/java/com/icomsys/main_vm/db/mybatis/alias/MenuManageVO.java new file mode 100644 index 0000000..207f207 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/mybatis/alias/MenuManageVO.java @@ -0,0 +1,173 @@ +package com.icomsys.main_vm.db.mybatis.alias; + +import org.apache.commons.lang3.builder.ToStringBuilder; + +/** + * 메뉴목록관리 처리를 위한 VO 클래스르를 정의한다 + * @author 개발환경 개발팀 이용 + * @since 2009.06.01 + * @version 1.0 + * @see + * + *
+ * << 개정이력(Modification Information) >>
+ *   
+ *   수정일      수정자           수정내용
+ *  -------    --------    ---------------------------
+ *   2009.03.20  이  용          최초 생성
+ *   2011.08.31  JJY            경량환경 템플릿 커스터마이징버전 생성 
+ *
+ * 
+ */ + +public class MenuManageVO { + + private int menuNo; + private String menuName; + private int upperMenuNo; + private String menuDesc; + private String urlPath; + private String authCode; + + /* 기타VO변수 + private int tempInt; + */ + private String tempValue; + + /* Login 메뉴관련 VO변수 */ + private String tmp_Id; + private String tmp_Password; + private String tmp_Name; + private String tmp_UserSe; + private String tmp_Email; + private String tmp_OrgnztId; + private String tmp_UniqId; + private String tmp_Cmd; + + public String getTempValue() { + return tempValue; + } + + public void setTempValue(String tempValue) { + this.tempValue = tempValue; + } + + public int getMenuNo() { + return menuNo; + } + + public void setMenuNo(int menuNo) { + this.menuNo = menuNo; + } + + public String getMenuName() { + return menuName; + } + + public void setMenuName(String menuName) { + this.menuName = menuName; + } + + public int getUpperMenuNo() { + return upperMenuNo; + } + + public void setUpperMenuNo(int upperMenuNo) { + this.upperMenuNo = upperMenuNo; + } + + public String getMenuDesc() { + return menuDesc; + } + + public void setMenuDesc(String menuDesc) { + this.menuDesc = menuDesc; + } + + public String getUrlPath() { + return urlPath; + } + + public void setUrlPath(String urlPath) { + this.urlPath = urlPath; + } + + public String getAuthCode() { + return authCode; + } + + public void setAuthCode(String authCode) { + this.authCode = authCode; + } + + public String getTmp_Id() { + return tmp_Id; + } + + public void setTmp_Id(String tmp_Id) { + this.tmp_Id = tmp_Id; + } + + public String getTmp_Password() { + return tmp_Password; + } + + public void setTmp_Password(String tmp_Password) { + this.tmp_Password = tmp_Password; + } + + public String getTmp_Name() { + return tmp_Name; + } + + public void setTmp_Name(String tmp_Name) { + this.tmp_Name = tmp_Name; + } + + public String getTmp_UserSe() { + return tmp_UserSe; + } + + public void setTmp_UserSe(String tmp_UserSe) { + this.tmp_UserSe = tmp_UserSe; + } + + public String getTmp_Email() { + return tmp_Email; + } + + public void setTmp_Email(String tmp_Email) { + this.tmp_Email = tmp_Email; + } + + public String getTmp_OrgnztId() { + return tmp_OrgnztId; + } + + public void setTmp_OrgnztId(String tmp_OrgnztId) { + this.tmp_OrgnztId = tmp_OrgnztId; + } + + public String getTmp_UniqId() { + return tmp_UniqId; + } + + public void setTmp_UniqId(String tmp_UniqId) { + this.tmp_UniqId = tmp_UniqId; + } + + public String getTmp_Cmd() { + return tmp_Cmd; + } + + public void setTmp_Cmd(String tmp_Cmd) { + this.tmp_Cmd = tmp_Cmd; + } + + /** + * toString 메소드를 대치한다. + */ + public String toString() { + return ToStringBuilder.reflectionToString(this); + } +} \ No newline at end of file diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/mybatis/alias/MonitoringConsultingVO.java b/main_vm/src/main/java/com/icomsys/main_vm/db/mybatis/alias/MonitoringConsultingVO.java new file mode 100644 index 0000000..3f65c99 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/mybatis/alias/MonitoringConsultingVO.java @@ -0,0 +1,188 @@ +package com.icomsys.main_vm.db.mybatis.alias; + +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.List; + +public class MonitoringConsultingVO { + private String token; + private String custCode; + private List custCodeList; + private String oprMngCode; + private List oprMngCodeList; + private String oprMngCodeUpper; + private List oprMngCodeUpperList; + private Long scenarioSeq; + private String scenarioName; + private String callInitDateFrom; + private String callInitDateTo; + private String callEndConversion; + private String callEndReason; + private String majorCode; + private String telNo; + private String dnisNo; + private int page; + private int pageSize; + private int limit; + private int offset; + + public String getToken() { + return token; + } + + public void setToken(String token) { + this.token = token; + } + + public String getCustCode() { + return custCode; + } + + public void setCustCode(String custCode) { + this.custCode = custCode; + } + + public List getCustCodeList() { + return custCodeList; + } + + public void setCustCodeList(List custCodeList) { + this.custCodeList = custCodeList; + } + + public String getOprMngCode() { + return oprMngCode; + } + + public void setOprMngCode(String oprMngCode) { + this.oprMngCode = oprMngCode; + } + + public List getOprMngCodeList() { + return oprMngCodeList; + } + + public void setOprMngCodeList(List oprMngCodeList) { + this.oprMngCodeList = oprMngCodeList; + } + + public String getOprMngCodeUpper() { + return oprMngCodeUpper; + } + + public void setOprMngCodeUpper(String oprMngCodeUpper) { + this.oprMngCodeUpper = oprMngCodeUpper; + } + + public List getOprMngCodeUpperList() { + return oprMngCodeUpperList; + } + + public void setOprMngCodeUpperList(List oprMngCodeUpperList) { + this.oprMngCodeUpperList = oprMngCodeUpperList; + } + + public Long getScenarioSeq() { + return scenarioSeq; + } + + public void setScenarioSeq(Long scenarioSeq) { + this.scenarioSeq = scenarioSeq; + } + + public String getScenarioName() { + return scenarioName; + } + + public void setScenarioName(String scenarioName) { + this.scenarioName = scenarioName; + } + + public String getCallInitDateFrom() { + return callInitDateFrom; + } + + public void setCallInitDateFrom(String callInitDateFrom) { + this.callInitDateFrom = callInitDateFrom; + } + + public String getCallInitDateTo() { + return callInitDateTo; + } + + public void setCallInitDateTo(String callInitDateTo) { + this.callInitDateTo = callInitDateTo; + } + + public String getCallEndConversion() { + return callEndConversion; + } + + public void setCallEndConversion(String callEndConversion) { + this.callEndConversion = callEndConversion; + } + + public String getCallEndReason() { + return callEndReason; + } + + public void setCallEndReason(String callEndReason) { + this.callEndReason = callEndReason; + } + + public String getMajorCode() { + return majorCode; + } + + public void setMajorCode(String majorCode) { + this.majorCode = majorCode; + } + + public String getTelNo() { + return telNo; + } + + public void setTelNo(String telNo) { + this.telNo = telNo; + } + + public String getDnisNo() { + return dnisNo; + } + + public void setDnisNo(String dnisNo) { + this.dnisNo = dnisNo; + } + + public int getPage() { + return page; + } + + public void setPage(int page) { + this.page = page; + } + + public int getPageSize() { + return pageSize; + } + + public void setPageSize(int pageSize) { + this.pageSize = pageSize; + } + + public int getLimit() { + return limit; + } + + public void setLimit(int limit) { + this.limit = limit; + } + + public int getOffset() { + return offset; + } + + public void setOffset(int offset) { + this.offset = offset; + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/mybatis/alias/MonitoringConversationMarkVO.java b/main_vm/src/main/java/com/icomsys/main_vm/db/mybatis/alias/MonitoringConversationMarkVO.java new file mode 100644 index 0000000..ddb3b44 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/mybatis/alias/MonitoringConversationMarkVO.java @@ -0,0 +1,184 @@ +package com.icomsys.main_vm.db.mybatis.alias; + +public class MonitoringConversationMarkVO { + private Long seq; + private String mainOpr; + private String oprMngCode; + private String logType; + private String token; + private int talkSeq; + private String talkText; + private String bookmarkErrCode; + private String measureType; + private String measureInfo; + private String callInitDateFrom; + private String callInitDateTo; + private String registId; + private String updateId; + private String chkMeasure; + private String menuVal; + private int page; + private int pageSize; + private int limit; + private int offset; + + public Long getSeq() { + return seq; + } + + public void setSeq(Long seq) { + this.seq = seq; + } + + public String getMainOpr() { + return mainOpr; + } + + public void setMainOpr(String mainOpr) { + this.mainOpr = mainOpr; + } + + public String getOprMngCode() { + return oprMngCode; + } + + public void setOprMngCode(String oprMngCode) { + this.oprMngCode = oprMngCode; + } + + public String getLogType() { + return logType; + } + + public void setLogType(String logType) { + this.logType = logType; + } + + public String getToken() { + return token; + } + + public void setToken(String token) { + this.token = token; + } + + public int getTalkSeq() { + return talkSeq; + } + + public void setTalkSeq(int talkSeq) { + this.talkSeq = talkSeq; + } + + public String getTalkText() { + return talkText; + } + + public void setTalkText(String talkText) { + this.talkText = talkText; + } + + public String getBookmarkErrCode() { + return bookmarkErrCode; + } + + public void setBookmarkErrCode(String bookmarkErrCode) { + this.bookmarkErrCode = bookmarkErrCode; + } + + public String getMeasureType() { + return measureType; + } + + public void setMeasureType(String measureType) { + this.measureType = measureType; + } + + public String getMeasureInfo() { + return measureInfo; + } + + public void setMeasureInfo(String measureInfo) { + this.measureInfo = measureInfo; + } + + public String getCallInitDateFrom() { + return callInitDateFrom; + } + + public void setCallInitDateFrom(String callInitDateFrom) { + this.callInitDateFrom = callInitDateFrom; + } + + public String getCallInitDateTo() { + return callInitDateTo; + } + + public void setCallInitDateTo(String callInitDateTo) { + this.callInitDateTo = callInitDateTo; + } + + public String getRegistId() { + return registId; + } + + public void setRegistId(String registId) { + this.registId = registId; + } + + public String getUpdateId() { + return updateId; + } + + public void setUpdateId(String updateId) { + this.updateId = updateId; + } + + public String getChkMeasure() { + return chkMeasure; + } + + public void setChkMeasure(String chkMeasure) { + this.chkMeasure = chkMeasure; + } + + public String getMenuVal() { + return menuVal; + } + + public void setMenuVal(String menuVal) { + this.menuVal = menuVal; + } + + public int getPage() { + return page; + } + + public void setPage(int page) { + this.page = page; + } + + public int getPageSize() { + return pageSize; + } + + public void setPageSize(int pageSize) { + this.pageSize = pageSize; + } + + public int getLimit() { + return limit; + } + + public void setLimit(int limit) { + this.limit = limit; + } + + public int getOffset() { + return offset; + } + + public void setOffset(int offset) { + this.offset = offset; + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/mybatis/alias/MonitoringIntentAnalysisVO.java b/main_vm/src/main/java/com/icomsys/main_vm/db/mybatis/alias/MonitoringIntentAnalysisVO.java new file mode 100644 index 0000000..75a685c --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/mybatis/alias/MonitoringIntentAnalysisVO.java @@ -0,0 +1,31 @@ +package com.icomsys.main_vm.db.mybatis.alias; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +import java.util.List; + +@Getter +@Setter +@NoArgsConstructor +public class MonitoringIntentAnalysisVO { + private String oprMngCode; + private List oprMngCodeList; + private String callInitDateFrom; + private String callInitDateTo; + private String intentResultCode; + private String scoreFrom; + private String scoreTo; + private List intentIdList; + private List allIntentIdList; + private String chkIntentAll; + private String intentGroupCode; + private String serviceGroup; + private int page; + private int pageSize; + private int limit; + private int offset; + + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/mybatis/alias/MonitoringOutscenarioVO.java b/main_vm/src/main/java/com/icomsys/main_vm/db/mybatis/alias/MonitoringOutscenarioVO.java new file mode 100644 index 0000000..71ad3cd --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/mybatis/alias/MonitoringOutscenarioVO.java @@ -0,0 +1,29 @@ +package com.icomsys.main_vm.db.mybatis.alias; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +import java.util.List; + +@Getter +@Setter +@NoArgsConstructor +public class MonitoringOutscenarioVO { + + private String oprMngCode; + private List oprMngCodeList; + private String callInitDateFrom; + private String callInitDateTo; + private List scenarioIdList; + private List allScenarioIdList; + private String chkScenarioAll; + private List tokenList; + private int page; + private int pageSize; + private int limit; + private int offset; + private Long scenarioSeq; + private String nodeCode; + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/mybatis/alias/MonitoringScenarioBreakVO.java b/main_vm/src/main/java/com/icomsys/main_vm/db/mybatis/alias/MonitoringScenarioBreakVO.java new file mode 100644 index 0000000..132d372 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/mybatis/alias/MonitoringScenarioBreakVO.java @@ -0,0 +1,46 @@ +package com.icomsys.main_vm.db.mybatis.alias; + +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +import java.time.LocalDateTime; + +@Getter +@Setter +@NoArgsConstructor +public class MonitoringScenarioBreakVO { + + //브래이크노드 + private Long seq; + private String token; + private int talkSeq; + private String oprMngCode; + private Long scenarioSeq; + private Long releaseSeq; + private String scenarioName; +// S : 성공 +// F : 이탈 + private String scenarioResultCode; + + + // USER_REQ : 사용자 요청 +// SCENARIO : 시나리오 흐름 +// INIT_END : 인입 후 끊음 +// SILENT_FB : 묵음 폴백 +// SPEAK_FB : 발화 폴백 +// USER_END : 고객 끊음 + + @Builder + public MonitoringScenarioBreakVO(Long seq, String token, int talkSeq, String oprMngCode, Long scenarioSeq, Long releaseSeq, String scenarioName, String scenarioResultCode) { + this.seq = seq; + this.token = token; + this.talkSeq = talkSeq; + this.oprMngCode = oprMngCode; + this.scenarioSeq = scenarioSeq; + this.releaseSeq = releaseSeq; + this.scenarioName = scenarioName; + this.scenarioResultCode = scenarioResultCode; + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/mybatis/alias/OprManageBgmListVo.java b/main_vm/src/main/java/com/icomsys/main_vm/db/mybatis/alias/OprManageBgmListVo.java new file mode 100644 index 0000000..18ab37a --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/mybatis/alias/OprManageBgmListVo.java @@ -0,0 +1,16 @@ +package com.icomsys.main_vm.db.mybatis.alias; + +import lombok.Data; +import lombok.Getter; +import lombok.Setter; + + +@Data +public class OprManageBgmListVo { + private String fileName; + //private String fileType; + private String registDate; + private String registId; + private String filePath; + //private String searchKeyword; +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/mybatis/alias/StatisticsCallInfoVO.java b/main_vm/src/main/java/com/icomsys/main_vm/db/mybatis/alias/StatisticsCallInfoVO.java new file mode 100644 index 0000000..148a372 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/mybatis/alias/StatisticsCallInfoVO.java @@ -0,0 +1,42 @@ +package com.icomsys.main_vm.db.mybatis.alias; + +import java.util.List; + +public class StatisticsCallInfoVO { + private String oprMngCode; + private List oprMngCodeList; + private String callInitDateFrom; + private String callInitDateTo; + + public String getOprMngCode() { + return oprMngCode; + } + + public void setOprMngCode(String oprMngCode) { + this.oprMngCode = oprMngCode; + } + + public List getOprMngCodeList() { + return oprMngCodeList; + } + + public void setOprMngCodeList(List oprMngCodeList) { + this.oprMngCodeList = oprMngCodeList; + } + + public String getCallInitDateFrom() { + return callInitDateFrom; + } + + public void setCallInitDateFrom(String callInitDateFrom) { + this.callInitDateFrom = callInitDateFrom; + } + + public String getCallInitDateTo() { + return callInitDateTo; + } + + public void setCallInitDateTo(String callInitDateTo) { + this.callInitDateTo = callInitDateTo; + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/mybatis/alias/StatisticsDashboardVO.java b/main_vm/src/main/java/com/icomsys/main_vm/db/mybatis/alias/StatisticsDashboardVO.java new file mode 100644 index 0000000..1b1da4c --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/mybatis/alias/StatisticsDashboardVO.java @@ -0,0 +1,24 @@ +package com.icomsys.main_vm.db.mybatis.alias; + +import java.util.List; + +public class StatisticsDashboardVO { + private String oprMngCode; + private List oprMngCodeList; + + public String getOprMngCode() { + return oprMngCode; + } + + public void setOprMngCode(String oprMngCode) { + this.oprMngCode = oprMngCode; + } + + public List getOprMngCodeList() { + return oprMngCodeList; + } + + public void setOprMngCodeList(List oprMngCodeList) { + this.oprMngCodeList = oprMngCodeList; + } +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/mybatis/mapper/BgmManageMapper.java b/main_vm/src/main/java/com/icomsys/main_vm/db/mybatis/mapper/BgmManageMapper.java new file mode 100644 index 0000000..580f322 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/mybatis/mapper/BgmManageMapper.java @@ -0,0 +1,15 @@ +package com.icomsys.main_vm.db.mybatis.mapper; + +import com.icomsys.main_vm.db.mybatis.alias.OprManageBgmListVo; +import com.icomsys.main_vm.biz.rcp.oprManage.vo.OprManageBgmVO; +import org.apache.ibatis.annotations.Mapper; + +import java.util.HashMap; +import java.util.List; + +@Mapper +public interface BgmManageMapper { + + List selectBgmList(OprManageBgmListVo vo); + int insertBgm(OprManageBgmVO vo); +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/mybatis/mapper/BotTTSTagMapper.java b/main_vm/src/main/java/com/icomsys/main_vm/db/mybatis/mapper/BotTTSTagMapper.java new file mode 100644 index 0000000..45ac4db --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/mybatis/mapper/BotTTSTagMapper.java @@ -0,0 +1,12 @@ +package com.icomsys.main_vm.db.mybatis.mapper; + +import org.apache.ibatis.annotations.Mapper; + +import java.util.HashMap; +import java.util.List; + +@Mapper +public interface BotTTSTagMapper { + + List selectTtsTagList (HashMap eMap); +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/mybatis/mapper/ConversationMarkMapper.java b/main_vm/src/main/java/com/icomsys/main_vm/db/mybatis/mapper/ConversationMarkMapper.java new file mode 100644 index 0000000..9adc26d --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/mybatis/mapper/ConversationMarkMapper.java @@ -0,0 +1,20 @@ +package com.icomsys.main_vm.db.mybatis.mapper; + +import com.icomsys.main_vm.db.mybatis.alias.MonitoringConversationMarkVO; +import org.apache.ibatis.annotations.Mapper; + +import java.util.HashMap; +import java.util.List; + +@Mapper +public interface ConversationMarkMapper { + List selectBookmarkList(MonitoringConversationMarkVO vo); + + int selectBookmarkListCnt(MonitoringConversationMarkVO vo); + + int insertBookmark(MonitoringConversationMarkVO vo); + + int updateBookmark(MonitoringConversationMarkVO vo); + + HashMap checkBookmarkCnt(MonitoringConversationMarkVO vo); +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/mybatis/mapper/IntentAnalysisMapper.java b/main_vm/src/main/java/com/icomsys/main_vm/db/mybatis/mapper/IntentAnalysisMapper.java new file mode 100644 index 0000000..9f7cd25 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/mybatis/mapper/IntentAnalysisMapper.java @@ -0,0 +1,16 @@ +package com.icomsys.main_vm.db.mybatis.mapper; + +import com.icomsys.main_vm.db.mybatis.alias.MonitoringIntentAnalysisVO; +import org.apache.ibatis.annotations.Mapper; + +import java.util.HashMap; +import java.util.List; + +@Mapper +public interface IntentAnalysisMapper { + List selectIntentNameList(MonitoringIntentAnalysisVO vo); + String selectServiceGroupUpper(MonitoringIntentAnalysisVO vo); + String selectOprByServiceCode(MonitoringIntentAnalysisVO vo); + List selectIntentAnalysisList(MonitoringIntentAnalysisVO vo); + int selectIntentAnalysisListCnt(MonitoringIntentAnalysisVO vo); +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/mybatis/mapper/IntentManageMapper.java b/main_vm/src/main/java/com/icomsys/main_vm/db/mybatis/mapper/IntentManageMapper.java new file mode 100644 index 0000000..0358d0a --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/mybatis/mapper/IntentManageMapper.java @@ -0,0 +1,42 @@ +package com.icomsys.main_vm.db.mybatis.mapper; + +import org.apache.ibatis.annotations.Mapper; + +import java.util.HashMap; +import java.util.List; + +@Mapper +public interface IntentManageMapper { + + List selectIntentList(HashMap eMap); + + List selectIntentExampleList(HashMap eMap); + + int selectIntentCnt(HashMap eMap); + + int selectIntentExampleCnt(HashMap eMap); + + List selectIntentCategoryList(HashMap eMap); + + HashMap selectIntentCategoryCode(HashMap eMap); + + void insertIntentMaster(HashMap eMap); + + int insertIntentExample(HashMap eMap); + + void updateIntentMaster(HashMap eMap); + + void updateDeleteIntentExample(HashMap eMap); + + void deleteIntentMaster(HashMap eMap); + + void deleteIntentExample(HashMap eMap); + + void deleteIntentExample_one(HashMap eMap); + + long selectIntentMappingId(HashMap eMap); + + int selectIntentSeq(HashMap eMap); + +} + diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/mybatis/mapper/MonitoringConsultingMapper.java b/main_vm/src/main/java/com/icomsys/main_vm/db/mybatis/mapper/MonitoringConsultingMapper.java new file mode 100644 index 0000000..54ac183 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/mybatis/mapper/MonitoringConsultingMapper.java @@ -0,0 +1,21 @@ +package com.icomsys.main_vm.db.mybatis.mapper; + +import com.icomsys.main_vm.db.mybatis.alias.MonitoringConsultingVO; +import org.apache.ibatis.annotations.Mapper; + +import java.util.HashMap; +import java.util.List; + +@Mapper +public interface MonitoringConsultingMapper { + List selectConsultingList(MonitoringConsultingVO vo); + + int selectConsultingListCnt(MonitoringConsultingVO vo); + + List selectRecordCallList(MonitoringConsultingVO vo); + + List selectScenarioSeqAndName(MonitoringConsultingVO vo); + + List selectCommonCodeAndDesc(MonitoringConsultingVO vo); + int selectUserCallCnt(MonitoringConsultingVO vo); +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/mybatis/mapper/MonitoringOutscenarioMapper.java b/main_vm/src/main/java/com/icomsys/main_vm/db/mybatis/mapper/MonitoringOutscenarioMapper.java new file mode 100644 index 0000000..2c666d0 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/mybatis/mapper/MonitoringOutscenarioMapper.java @@ -0,0 +1,19 @@ +package com.icomsys.main_vm.db.mybatis.mapper; + +import com.icomsys.main_vm.db.mybatis.alias.MonitoringOutscenarioVO; +import org.apache.ibatis.annotations.Mapper; + +import java.util.HashMap; +import java.util.List; + +@Mapper +public interface MonitoringOutscenarioMapper { + List selectOutscenarioList(MonitoringOutscenarioVO vo); + int selectOutscenarioListCnt(MonitoringOutscenarioVO vo); + + int selectOutscenarioCnt(MonitoringOutscenarioVO vo); + + List selectScenarioNameList(MonitoringOutscenarioVO vo); + List selectTokenListByScenario(MonitoringOutscenarioVO vo); + List selectCallListByScenario(MonitoringOutscenarioVO vo); +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/mybatis/mapper/NlpWisenutApiMapper.java b/main_vm/src/main/java/com/icomsys/main_vm/db/mybatis/mapper/NlpWisenutApiMapper.java new file mode 100644 index 0000000..17e7c92 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/mybatis/mapper/NlpWisenutApiMapper.java @@ -0,0 +1,22 @@ +package com.icomsys.main_vm.db.mybatis.mapper; + +import org.apache.ibatis.annotations.Mapper; + +import java.util.HashMap; + +@Mapper +public interface NlpWisenutApiMapper { + + long selectProjectId(HashMap eMap); + long selectProjectIdforOprMngCode(HashMap eMap); + HashMap selectProjectName(HashMap eMap); + long selectIntentId(HashMap eMap); + HashMap selectIntentIdForDelete(HashMap eMap); + long selectIntentSentenctId(HashMap eMap); + HashMap selectIntentSentenctIdforDelete(HashMap eMap); + long selectEntityId(HashMap eMap); + HashMap selectEntityIdForDelete(HashMap eMap); + long selectDictionaryId(HashMap eMap); + HashMap selectDictionaryIdforDelete(HashMap eMap); + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/mybatis/mapper/StatisticsCallInfoMapper.java b/main_vm/src/main/java/com/icomsys/main_vm/db/mybatis/mapper/StatisticsCallInfoMapper.java new file mode 100644 index 0000000..60044ba --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/mybatis/mapper/StatisticsCallInfoMapper.java @@ -0,0 +1,12 @@ +package com.icomsys.main_vm.db.mybatis.mapper; + +import com.icomsys.main_vm.db.mybatis.alias.StatisticsCallInfoVO; +import org.apache.ibatis.annotations.Mapper; + +import java.util.HashMap; +import java.util.List; + +@Mapper +public interface StatisticsCallInfoMapper { + List selectStatCallInfo(StatisticsCallInfoVO vo); +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/mybatis/mapper/StatisticsDashboardMapper.java b/main_vm/src/main/java/com/icomsys/main_vm/db/mybatis/mapper/StatisticsDashboardMapper.java new file mode 100644 index 0000000..85c61cf --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/mybatis/mapper/StatisticsDashboardMapper.java @@ -0,0 +1,16 @@ +package com.icomsys.main_vm.db.mybatis.mapper; + +import com.icomsys.main_vm.db.mybatis.alias.StatisticsDashboardVO; +import org.apache.ibatis.annotations.Mapper; + +import java.util.HashMap; +import java.util.List; + +@Mapper +public interface StatisticsDashboardMapper { + List selectStatCallInfo(StatisticsDashboardVO vo); + List selectStatIntent(StatisticsDashboardVO vo); + List selectStatScenario(StatisticsDashboardVO vo); + List selectCallCntByToday(StatisticsDashboardVO vo); + int selectCurCallCnt(StatisticsDashboardVO vo); +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/mybatis/mapper/StatisticsIntentMapper.java b/main_vm/src/main/java/com/icomsys/main_vm/db/mybatis/mapper/StatisticsIntentMapper.java new file mode 100644 index 0000000..13aae4f --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/mybatis/mapper/StatisticsIntentMapper.java @@ -0,0 +1,13 @@ +package com.icomsys.main_vm.db.mybatis.mapper; + +import com.icomsys.main_vm.db.mybatis.alias.MonitoringIntentAnalysisVO; +import org.apache.ibatis.annotations.Mapper; + +import java.util.HashMap; +import java.util.List; + +@Mapper +public interface StatisticsIntentMapper { + List selectStatIntentDay(MonitoringIntentAnalysisVO vo); + List selectStatIntentItem(MonitoringIntentAnalysisVO vo); +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/mybatis/mapper/StatisticsScenarioMapper.java b/main_vm/src/main/java/com/icomsys/main_vm/db/mybatis/mapper/StatisticsScenarioMapper.java new file mode 100644 index 0000000..4561ebf --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/mybatis/mapper/StatisticsScenarioMapper.java @@ -0,0 +1,13 @@ +package com.icomsys.main_vm.db.mybatis.mapper; + +import com.icomsys.main_vm.db.mybatis.alias.MonitoringOutscenarioVO; +import org.apache.ibatis.annotations.Mapper; + +import java.util.HashMap; +import java.util.List; + +@Mapper +public interface StatisticsScenarioMapper { + List selectStatScenarioDay(MonitoringOutscenarioVO vo); + List selectStatScenarioItem(MonitoringOutscenarioVO vo); +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/mybatis/mapper/SynonymManageMapper.java b/main_vm/src/main/java/com/icomsys/main_vm/db/mybatis/mapper/SynonymManageMapper.java new file mode 100644 index 0000000..91ad9a7 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/mybatis/mapper/SynonymManageMapper.java @@ -0,0 +1,41 @@ +package com.icomsys.main_vm.db.mybatis.mapper; + +import org.apache.ibatis.annotations.Mapper; + +import java.util.HashMap; +import java.util.List; + +@Mapper +public interface SynonymManageMapper { + + List selectSynonymList(HashMap eMap); + + int deleteSynonym(HashMap eMap); + + // dupCheck + int dupIndivWord(HashMap eMap); + + int dupRepWord(HashMap eMap); + + int dupRepWordN(HashMap eMap); + + int dupSynonymY(HashMap eMap); + + int dupSynonymN(HashMap eMap); + + int insertSynonymMaster(HashMap eMap); + + void insertSynonymWord(HashMap eMap); + + void updateSynonymWord(HashMap eMap); + + // saveSynonymList + int saveSynonymList(HashMap eMap); + + Integer selectSynonymMaster(HashMap eMap); + + void deleteSynonymWord(HashMap HashMap); + + int countSynonymWord(HashMap eMap); + +} diff --git a/main_vm/src/main/java/com/icomsys/main_vm/db/mybatis/mapper/TestMapper.java b/main_vm/src/main/java/com/icomsys/main_vm/db/mybatis/mapper/TestMapper.java new file mode 100644 index 0000000..9c36626 --- /dev/null +++ b/main_vm/src/main/java/com/icomsys/main_vm/db/mybatis/mapper/TestMapper.java @@ -0,0 +1,23 @@ +package com.icomsys.main_vm.db.mybatis.mapper; + +import com.icomsys.main_vm.db.mybatis.alias.LoginVO; +import com.icomsys.main_vm.db.mybatis.alias.MonitoringScenarioBreakVO; +import org.apache.ibatis.annotations.Mapper; + +import java.util.HashMap; +import java.util.List; + +@Mapper +public interface TestMapper { + String TestMapper1(); + + public LoginVO idLoginFailCheck11(LoginVO vo) ; + + List getUserPolicy(Long seq, String lastService); + + List MonitoringScenarioBreak(String datea, String dateb); + +} + + + diff --git a/main_vm/src/main/resources/application-create-local.yml b/main_vm/src/main/resources/application-create-local.yml new file mode 100644 index 0000000..59d4c6f --- /dev/null +++ b/main_vm/src/main/resources/application-create-local.yml @@ -0,0 +1,45 @@ +#* @Name Env Create Properties +#* @Description 최초 환경설정시 사용 프로퍼티. +#* @Danger 테스트 금지입니다. DDL CREATE +#* @Author JangWonSeok +#* @CreateDate 2022. 11. 10. +Server: + host: localhost + port: 8009 + +spring: + config: + activate: + on-profile: create-local + datasource: + url: jdbc:log4jdbc:mysql://dev-ics-db.c9i6xgmcxx18.ap-northeast-2.rds.amazonaws.com/UPLUS_CINNAMON + username: ics_mgr + password: "#pass180901" + owner: ICS_DEV + driver-class-name: net.sf.log4jdbc.DriverSpy +# driver-class-name: oracle.jdbc.driver.OracleDriver + type: org.apache.tomcat.jdbc.pool.DataSource + hikari: + maximum-pool-size: 10 + connection-timeout: 60000 + + jpa: + hibernate: + ddl-auto: create + properties: + hibernate: +# dialect: org.hibernate.dialect.Oracle10gDialect + dialect: org.hibernate.dialect.MySQL57Dialect +#https://docs.jboss.org/hibernate/orm/3.5/javadocs/org/hibernate/dialect/package-summary.html + +feign: + url: + test: http://localhost:8014 + cinnamon: http://127.0.0.1:8080 + nlp: http://211.168.38.130:17500/ichatApi + s3Bucket: local + +nlpapi: false + +file: + path: C:\workspace\multipartfile \ No newline at end of file diff --git a/main_vm/src/main/resources/application-create.yml b/main_vm/src/main/resources/application-create.yml new file mode 100644 index 0000000..6ee571d --- /dev/null +++ b/main_vm/src/main/resources/application-create.yml @@ -0,0 +1,50 @@ +#* @Name Env Create Properties +#* @Description 최초 환경설정시 사용 프로퍼티. +#* @Danger 테스트 금지입니다. DDL CREATE +#* @Author JangWonSeok +#* @CreateDate 2022. 11. 10. +Server: + host: localhost + port: 8009 + +spring: + config: + activate: + on-profile: create + datasource: + # url: jdbc:log4jdbc:mysql://dev-ics-db.c9i6xgmcxx18.ap-northeast-2.rds.amazonaws.com/UPLUS_CINNAMON + url: jdbc:log4jdbc:mysql://rdsinst-dev-aisb-db-az2c-instance-1.ctgq4zvwl9iz.ap-northeast-2.rds.amazonaws.com/ICS_CINNAMON + username: aistore + password: roqkf123!!! + owner: ICS_DEV + driver-class-name: net.sf.log4jdbc.DriverSpy +# driver-class-name: oracle.jdbc.driver.OracleDriver + type: org.apache.tomcat.jdbc.pool.DataSource + hikari: + maximum-pool-size: 10 + connection-timeout: 60000 + + jpa: + hibernate: + ddl-auto: create + properties: + hibernate: +# dialect: org.hibernate.dialect.Oracle10gDialect + dialect: org.hibernate.dialect.MySQL57Dialect +#https://docs.jboss.org/hibernate/orm/3.5/javadocs/org/hibernate/dialect/package-summary.html + +feign: + url: + test: http://localhost:8014 + cinnamon: http://127.0.0.1:8080 + nlp: http://211.168.38.130:17500/ichatApi + s3Bucket: local + +file: + path: C:\workspace\multipartfile + +nlpapi: false + +Globals: + profiles: + active: 'local' diff --git a/main_vm/src/main/resources/application-dev.yml b/main_vm/src/main/resources/application-dev.yml new file mode 100644 index 0000000..f772022 --- /dev/null +++ b/main_vm/src/main/resources/application-dev.yml @@ -0,0 +1,64 @@ +#* @Name Env Create Properties +#* @Description 최초 환경설정시 사용 프로퍼티. +#* @Danger 테스트 금지입니다. DDL CREATE +#* @Author JangWonSeok +#* @CreateDate 2022. 11. 10. +Server: + host: localhost + port: 8050 + +spring: + config: + activate: + on-profile: dev + datasource: + # url: jdbc:log4jdbc:mysql://dev-ics-db.c9i6xgmcxx18.ap-northeast-2.rds.amazonaws.com/UPLUS_CINNAMON + url: jdbc:log4jdbc:mysql://rdsinst-dev-aisb-db-az2c-instance-1.ctgq4zvwl9iz.ap-northeast-2.rds.amazonaws.com/ICS_CINNAMON3 +# url: jdbc:log4jdbc:mysql://rdsinst-dev-aisb-db-az2c-instance-1.ctgq4zvwl9iz.ap-northeast-2.rds.amazonaws.com/migrationUplus + username: aistore + password: roqkf123!!! + owner: ICS_DEV + driver-class-name: net.sf.log4jdbc.DriverSpy + # driver-class-name: oracle.jdbc.driver.OracleDriver + type: org.apache.tomcat.jdbc.pool.DataSource + hikari: + maximum-pool-size: 10 + connection-timeout: 60000 + + jpa: + hibernate: + ddl-auto: none + properties: + hibernate: + # dialect: org.hibernate.dialect.Oracle10gDialect + #dialect: org.hibernate.dialect.MySQL57Dialect + dialect: com.icomsys.main_vm.common.util.CustomDialect +#https://docs.jboss.org/hibernate/orm/3.5/javadocs/org/hibernate/dialect/package-summary.html + +feign: + url: + test: http://localhost:8014 + cinnamon: http://127.0.0.1:8080 + nlp: http://172.31.34.38:17500/ichatApi + s3Bucket: s3-dev-aisb-soe + bgmpath: bgm/ + selvas: 172.31.34.52 + ttsport: 7890 + sttport: 9999 + +file: + path: /logs/was/aicb/cinnamon_ui/files/ + +nlpapi: true + +Globals: + profiles: + active: 'dev' + +cloud: + aws: + stack: + auto: false +# credentials: +# instance-profile: false +# use-default-aws-credentials-chain: true \ No newline at end of file diff --git a/main_vm/src/main/resources/application-devjj.yml b/main_vm/src/main/resources/application-devjj.yml new file mode 100644 index 0000000..3c9585c --- /dev/null +++ b/main_vm/src/main/resources/application-devjj.yml @@ -0,0 +1,64 @@ +#* @Name Env Create Properties +#* @Description 최초 환경설정시 사용 프로퍼티. +#* @Danger 테스트 금지입니다. DDL CREATE +#* @Author JangWonSeok +#* @CreateDate 2022. 11. 10. +Server: + host: localhost + port: 7080 + +spring: + config: + activate: + on-profile: devjj + datasource: + # url: jdbc:log4jdbc:mysql://dev-ics-db.c9i6xgmcxx18.ap-northeast-2.rds.amazonaws.com/UPLUS_CINNAMON + url: jdbc:log4jdbc:mysql://rdsinst-dev-aisb-db-az2c-instance-1.ctgq4zvwl9iz.ap-northeast-2.rds.amazonaws.com/ICS_CINNAMON + username: aistore + password: roqkf123!!! + owner: ICS_DEV + driver-class-name: net.sf.log4jdbc.DriverSpy + # driver-class-name: oracle.jdbc.driver.OracleDriver + type: org.apache.tomcat.jdbc.pool.DataSource + hikari: + maximum-pool-size: 10 + connection-timeout: 60000 + + jpa: + hibernate: + ddl-auto: none + properties: + hibernate: + # dialect: org.hibernate.dialect.Oracle10gDialect + #dialect: org.hibernate.dialect.MySQL57Dialect + dialect: com.icomsys.main_vm.common.util.CustomDialect +#https://docs.jboss.org/hibernate/orm/3.5/javadocs/org/hibernate/dialect/package-summary.html + +feign: + url: + test: http://localhost:8014 + cinnamon: http://127.0.0.1:8080 + nlp: http://172.31.34.38:17500/ichatApi + s3Bucket: s3-dev-aisb-soe + bgmpath: bgmfile/ + selvas: 172.31.34.52 + ttsport: 7890 + sttport: 9999 + +file: + path: /logs/was/aicb/cinnamon_ui/files/ + uploadpath: /logs/was/aicb/cinnamon_ui/stttest/ + +nlpapi: false + +Globals: + profiles: + active: 'dev' + +cloud: + aws: + stack: + auto: false +# credentials: +# instance-profile: false +# use-default-aws-credentials-chain: true \ No newline at end of file diff --git a/main_vm/src/main/resources/application-drop.yml b/main_vm/src/main/resources/application-drop.yml new file mode 100644 index 0000000..273275c --- /dev/null +++ b/main_vm/src/main/resources/application-drop.yml @@ -0,0 +1,50 @@ +#* @Name Env Create Properties +#* @Description 최초 환경설정시 사용 프로퍼티. +#* @Danger 테스트 금지입니다. DDL CREATE +#* @Author JangWonSeok +#* @CreateDate 2022. 11. 10. +Server: + host: localhost + port: 8009 + +spring: + config: + activate: + on-profile: drop + datasource: + # url: jdbc:log4jdbc:mysql://dev-ics-db.c9i6xgmcxx18.ap-northeast-2.rds.amazonaws.com/UPLUS_CINNAMON + url: jdbc:log4jdbc:mysql://rdsinst-dev-aisb-db-az2c-instance-1.ctgq4zvwl9iz.ap-northeast-2.rds.amazonaws.com/ICS_CINNAMON + username: aistore + password: roqkf123!!! + owner: ICS_DEV + driver-class-name: net.sf.log4jdbc.DriverSpy +# driver-class-name: oracle.jdbc.driver.OracleDriver + type: org.apache.tomcat.jdbc.pool.DataSource + hikari: + maximum-pool-size: 10 + connection-timeout: 60000 + + jpa: + hibernate: + ddl-auto: create-drop + properties: + hibernate: +# dialect: org.hibernate.dialect.Oracle10gDialect + dialect: org.hibernate.dialect.MySQL57Dialect +#https://docs.jboss.org/hibernate/orm/3.5/javadocs/org/hibernate/dialect/package-summary.html + +feign: + url: + test: http://localhost:8014 + cinnamon: http://127.0.0.1:8080 + nlp: http://211.168.38.130:17500/ichatApi + s3Bucket: local + +file: + path: C:\workspace\multipartfile + +nlpapi: false + +Globals: + profiles: + active: 'local' diff --git a/main_vm/src/main/resources/application-local-jws.yml b/main_vm/src/main/resources/application-local-jws.yml new file mode 100644 index 0000000..c454dce --- /dev/null +++ b/main_vm/src/main/resources/application-local-jws.yml @@ -0,0 +1,52 @@ +#* @Name Env Create Properties +#* @Description 최초 환경설정시 사용 프로퍼티. +#* @Danger 테스트 금지입니다. DDL CREATE +#* @Author JangWonSeok +#* @CreateDate 2022. 11. 10. +Server: + host: localhost + port: 8009 + +spring: + config: + activate: + on-profile: local-jws + datasource: + url: jdbc:log4jdbc:mysql://localhost:3309/UPLUS_CINNAMON + username: dev + password: dev!23 +# url: jdbc:log4jdbc:mysql://192.168.0.26/UPLUS_CINNAMON_2CH +# username: icomsys +# password: "#pass180901" + owner: UPLUS_CINNAMON + driver-class-name: net.sf.log4jdbc.DriverSpy +# driver-class-name: oracle.jdbc.driver.OracleDriver + type: org.apache.tomcat.jdbc.pool.DataSource + hikari: + maximum-pool-size: 10 + connection-timeout: 60000 + + jpa: + hibernate: + ddl-auto: none + properties: + hibernate: +# dialect: org.hibernate.dialect.Oracle10gDialect + dialect: com.icomsys.main_vm.common.util.CustomDialect +#https://docs.jboss.org/hibernate/orm/3.5/javadocs/org/hibernate/dialect/package-summary.html + +feign: + url: + test: http://localhost:8014 + cinnamon: http://127.0.0.1:8080 + nlp: http://localhost:8014/ichatApi + s3Bucket: local + bgmpath: bgmfile/ + selvas: 172.31.34.52 + ttsport: 7890 + sttport: 9999 + +nlpapi: false + +file: + path: C:\workspace\multipartfile \ No newline at end of file diff --git a/main_vm/src/main/resources/application-local-kgw.yml b/main_vm/src/main/resources/application-local-kgw.yml new file mode 100644 index 0000000..94320c0 --- /dev/null +++ b/main_vm/src/main/resources/application-local-kgw.yml @@ -0,0 +1,50 @@ +Server: + host: localhost + port: 8011 + +spring: + config: + activate: + on-profile: local-kgw + datasource: +# url: jdbc:log4jdbc:mysql://dev-ics-db.c9i6xgmcxx18.ap-northeast-2.rds.amazonaws.com/UPLUS_CINNAMON +# username: ics_mgr +# password: "#pass180901" + url: jdbc:log4jdbc:mysql://127.0.0.1/uplus_cinnamon + username: root + password: "2973" +# url: jdbc:log4jdbc:oracle:thin:@localhost:1522:XE +# username: LG_LOCAL +# password: pass180901 + owner: LG_LOCAL + driver-class-name: net.sf.log4jdbc.DriverSpy + hikari: + connection-timeout: 60000 + maximum-pool-size: 5 + jpa: + hibernate: + ddl-auto: none + properties: + hibernate: +# dialect: org.hibernate.dialect.Oracle10gDialect + dialect: com.icomsys.main_vm.common.util.CustomDialect +#https://docs.jboss.org/hibernate/orm/3.5/javadocs/org/hibernate/dialect/package-summary.html +feign: + url: + test: http://localhost:8014 + cinnamon: http://127.0.0.1:8080 + nlp: http://211.168.38.130:17500/ichatApi + s3Bucket: local + bgmpath: bgmfile/ + selvas: 172.31.34.52 + ttsport: 7890 + sttport: 9999 + +file: + path: C:\workspace\uplus_ui_soe\main_vm\src\main\webapp + +nlpapi: false + +Globals: + profiles: + active: 'local' diff --git a/main_vm/src/main/resources/application-local.yml b/main_vm/src/main/resources/application-local.yml new file mode 100644 index 0000000..aff9d62 --- /dev/null +++ b/main_vm/src/main/resources/application-local.yml @@ -0,0 +1,58 @@ +Server: + host: localhost + port: 8011 + +spring: + config: + activate: + on-profile: local + datasource: + url: jdbc:log4jdbc:mysql://dev-ics-db.c9i6xgmcxx18.ap-northeast-2.rds.amazonaws.com/UPLUS_CINNAMON + username: ics_mgr + password: "#pass180901" +# url: jdbc:log4jdbc:oracle:thin:@localhost:1522:XE +# username: LG_LOCAL +# password: pass180901 + owner: LG_LOCAL + driver-class-name: net.sf.log4jdbc.DriverSpy + hikari: + connection-timeout: 60000 + maximum-pool-size: 5 + jpa: + hibernate: + ddl-auto: none + properties: + hibernate: +# dialect: org.hibernate.dialect.Oracle10gDialect +# dialect: org.hibernate.dialect.MySQL57Dialect + dialect: com.icomsys.main_vm.common.util.CustomDialect + generate_statistics: true + +#https://docs.jboss.org/hibernate/orm/3.5/javadocs/org/hibernate/dialect/package-summary.html + +feign: + url: + test: http://localhost:8014 + cinnamon: http://127.0.0.1:8080 + nlp: http://localhost:8014/ichatApi + s3Bucket: s3-dev-aisb-soe0 + bgmpath: bgmfile/ + selvas: 172.31.34.52 + ttsport: 7890 + sttport: 9999 + +file: + path: C:\workspace\uplus\main_vm\src\main\webapp + +nlpapi: false + +Globals: + profiles: + active: 'local' + +#cloud: +# aws: +# stack: +# auto: false +# region: +# static: ap-northeast-2 \ No newline at end of file diff --git a/main_vm/src/main/resources/application-local_lek.yml b/main_vm/src/main/resources/application-local_lek.yml new file mode 100644 index 0000000..5bd3484 --- /dev/null +++ b/main_vm/src/main/resources/application-local_lek.yml @@ -0,0 +1,56 @@ +Server: + host: localhost + port: 8011 + +spring: + config: + activate: + on-profile: local_lek + datasource: + + password: 'root1!' +# url: jdbc:log4jdbc:mysql://localhost:3306/ICS_CINNAMON #ICS_CINNAMON + url: jdbc:log4jdbc:mysql://localhost:3306/UPLUSDB #ICS_CINNAMON + username: root + +# url: jdbc:log4jdbc:mysql://dev-ics-db.c9i6xgmcxx18.ap-northeast-2.rds.amazonaws.com/UPLUS_CINNAMON +# username: ics_mgr +# password: "#pass180901" +# url: jdbc:log4jdbc:oracle:thin:@localhost:1522:XE +# username: LG_LOCAL +# password: pass180901 + owner: LG_LOCAL + driver-class-name: net.sf.log4jdbc.DriverSpy + hikari: + connection-timeout: 60000 + maximum-pool-size: 5 + jpa: + hibernate: + ddl-auto: none + properties: + hibernate: +# dialect: org.hibernate.dialect.Oracle10gDialect +# dialect: org.hibernate.dialect.MySQL57Dialect + dialect: com.icomsys.main_vm.common.util.CustomDialect +#https://docs.jboss.org/hibernate/orm/3.5/javadocs/org/hibernate/dialect/package-summary.html +feign: + url: + test: http://localhost:8014 + cinnamon: http://127.0.0.1:8080 + nlp: http://13.125.175.14:17500/ichatApi + s3Bucket: local + bgmpath: bgmfile/ + selvas: 172.31.34.52 + ttsport: 7890 + sttport: 9999 + +file: + path: C:\workspace\multipartfile + +nlpapi: false + +Globals: + profiles: + active: 'local' + + diff --git a/main_vm/src/main/resources/application-prod.yml b/main_vm/src/main/resources/application-prod.yml new file mode 100644 index 0000000..1c4b6c2 --- /dev/null +++ b/main_vm/src/main/resources/application-prod.yml @@ -0,0 +1,54 @@ +Server: + host: localhost + port: 8050 + +spring: + config: + activate: + on-profile: prod + datasource: + url: jdbc:log4jdbc:mysql://rdsinst-prd-aisb-db.cluster-cvqg2qu2yggz.ap-northeast-2.rds.amazonaws.com/ICS_CINNAMON + username: aistore + password: dnsdud123!!! + owner: ICS_DEV + driver-class-name: net.sf.log4jdbc.DriverSpy + # driver-class-name: oracle.jdbc.driver.OracleDriver + type: org.apache.tomcat.jdbc.pool.DataSource + hikari: + maximum-pool-size: 10 + connection-timeout: 60000 + + jpa: + hibernate: + ddl-auto: none + properties: + hibernate: + dialect: com.icomsys.main_vm.common.util.CustomDialect + +feign: + url: + test: http://localhost:8014 + cinnamon: http://nlb-prd-aisb-callbot-455ec1b24bedbc3d.elb.ap-northeast-2.amazonaws.com:8080 + nlp: http://nlb-prd-aisb-callbot-455ec1b24bedbc3d.elb.ap-northeast-2.amazonaws.com:17500/ichatApi + s3Bucket: s3-prd-aisb-soe + bgmpath: bgm/ + selvas: nlb-prd-aisb-callbot-455ec1b24bedbc3d.elb.ap-northeast-2.amazonaws.com + ttsport: 7890 + sttport: 9999 + +file: + path: /logs/was/aicb/cinnamon_ui/files/ + +nlpapi: true + +Globals: + profiles: + active: 'pro' + +cloud: + aws: + stack: + auto: false +# credentials: +# instance-profile: false +# use-default-aws-credentials-chain: true diff --git a/main_vm/src/main/resources/application-stg.yml b/main_vm/src/main/resources/application-stg.yml new file mode 100644 index 0000000..ad7f1b2 --- /dev/null +++ b/main_vm/src/main/resources/application-stg.yml @@ -0,0 +1,53 @@ +Server: + host: localhost + port: 8050 + +spring: + config: + activate: + on-profile: stg + datasource: + url: jdbc:log4jdbc:mysql://rdsinst-stg-aisb-db.cluster-cvws7pmet6x1.ap-northeast-2.rds.amazonaws.com/ICS_CINNAMON + username: aistore + password: dnsdud123!!! + owner: ICS_DEV + driver-class-name: net.sf.log4jdbc.DriverSpy + # driver-class-name: oracle.jdbc.driver.OracleDriver + type: org.apache.tomcat.jdbc.pool.DataSource + hikari: + maximum-pool-size: 10 + connection-timeout: 60000 + jpa: + hibernate: + ddl-auto: none + properties: + hibernate: + dialect: com.icomsys.main_vm.common.util.CustomDialect + +feign: + url: + test: http://localhost:8014 + cinnamon: http://nlb-stg-aisb-callbot-f08fc9a5ae1cc747.elb.ap-northeast-2.amazonaws.com:8080 + nlp: http://nlb-stg-aisb-callbot-f08fc9a5ae1cc747.elb.ap-northeast-2.amazonaws.com:17500/ichatApi + s3Bucket: s3-stg-aisb-soe + bgmpath: bgm/ + selvas: nlb-stg-aisb-callbot-f08fc9a5ae1cc747.elb.ap-northeast-2.amazonaws.com + ttsport: 7890 + sttport: 9999 + +file: + path: /logs/was/aicb/cinnamon_ui/files/ + +nlpapi: true + +Globals: + profiles: + active: 'stg' + +cloud: + aws: + stack: + auto: false +# credentials: +# instance-profile: false +# use-default-aws-credentials-chain: true \ No newline at end of file diff --git a/main_vm/src/main/resources/application.yml b/main_vm/src/main/resources/application.yml new file mode 100644 index 0000000..352fbd4 --- /dev/null +++ b/main_vm/src/main/resources/application.yml @@ -0,0 +1,91 @@ +#boot2.4 이상 +#2022-11-03 jangwonseok +#java -jar {ARG} --spring.profiles.active=dev +#boot2.4 이하 +#java -jar -Dspring.profiles.active=dev {ARG} + + +Server: + shutdown: graceful + servlet: +# context-path: /BotMain_VM + context-path: +# session: +# timeout: 60m + + error: + path: /error + include-exception: false +# include-stacktrace: never + include-stacktrace: always + whitelabel: + enabled: false + session: + tracking-modes: cookie + # path: #에러발생시 전달할 경로 + + +spring: + profiles: + default: local + +# 공통부분 작성 + main: + allow-bean-definition-overriding: true + mvc: + pathmatch: + matching-strategy: ant_path_matcher + application: + name: botmain + jpa: + properties: +# hibernate: #오라클 DB테스트하는중 공통에서 임시제외 +# dialect: org.hibernate.dialect.MySQL57Dialect +# storage_engine: innodb + format_sql: true + default_batch_fetch_size: 1000 + show_sql: true + format_sql: true + use_sql_comments: true + jackson: + serialization: + fail-on-empty-beans: false + + autoconfigure: +# exclude: org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration + devtools: + livereload: + enabled: true + servlet: + multipart: + enabled: true + max-file-size: 10MB + max-request-size: 50MB +logging: +# level: +# org: +# hibernate: +# SQL: debug +# type: trace + ## log4j ??????? xml ??? ????? spring ????? ???. + jdbc: + sqlonly: off + sqltiming: debug + audit: off + resultset: off + resultsettable: debug + connection: off + + +# config server actuator +management: + endpoints: + web: + exposure: + include: refresh, health, beans, info + +#??????? ??? yml?? ?? +#mybatis: +# type-aliases-package: egovframework/example/mapper/aliase +# mapper-locations: sqlmap/mappers/mysql/icomsys/**/*.xml + diff --git a/main_vm/src/main/resources/document/Ourstore_Ai_Manager_User_Manual.pdf b/main_vm/src/main/resources/document/Ourstore_Ai_Manager_User_Manual.pdf new file mode 100644 index 0000000..2047b6f Binary files /dev/null and b/main_vm/src/main/resources/document/Ourstore_Ai_Manager_User_Manual.pdf differ diff --git a/main_vm/src/main/resources/logback-spring.xml b/main_vm/src/main/resources/logback-spring.xml new file mode 100644 index 0000000..9132d4a --- /dev/null +++ b/main_vm/src/main/resources/logback-spring.xml @@ -0,0 +1,42 @@ + + + + + + + + + + %d{yyyy-MM-dd HH:mm:ss.SSS} %highlight(%-5level) %magenta(%-4relative) - [%thread{10}, %X{traceId:-}, %X{spanId:-}] %cyan(%logger{20}): %msg%n + + + + + ${LOG_PATH_NAME}.log + + ${ROLLING_PATH_NAME}.%d{yyyy-MM-dd}.log + 90 + + + + + %d{yyyy-MM-dd HH:mm:ss} [%-5p] [%F]%M\(%L\) : %m%n + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/main_vm/src/main/resources/mapper/test/BgmManage_SQL.xml b/main_vm/src/main/resources/mapper/test/BgmManage_SQL.xml new file mode 100644 index 0000000..57f5274 --- /dev/null +++ b/main_vm/src/main/resources/mapper/test/BgmManage_SQL.xml @@ -0,0 +1,56 @@ + + + + + + + + + + INSERT INTO TB_BGM_MNG ( + CUST_CODE + , FILE_NAME + , FILE_PATH + , REGIST_ID + + + ) VALUES ( + #{custCode} + , #{fileName} + , #{filePath} + , #{registId} + + ) + + \ No newline at end of file diff --git a/main_vm/src/main/resources/mapper/test/BotTTSTag_SQL.xml b/main_vm/src/main/resources/mapper/test/BotTTSTag_SQL.xml new file mode 100644 index 0000000..dadbda5 --- /dev/null +++ b/main_vm/src/main/resources/mapper/test/BotTTSTag_SQL.xml @@ -0,0 +1,37 @@ + + + + + + + + diff --git a/main_vm/src/main/resources/mapper/test/ConversationMark_SQL.xml b/main_vm/src/main/resources/mapper/test/ConversationMark_SQL.xml new file mode 100644 index 0000000..1e75868 --- /dev/null +++ b/main_vm/src/main/resources/mapper/test/ConversationMark_SQL.xml @@ -0,0 +1,229 @@ + + + + + + + + + + INSERT INTO TB_TALK_BOOKMARK ( + LOG_TYPE + , OPR_MNG_CODE + , TOKEN + , TALK_SEQ + , TALK_TEXT + , BOOKMARK_ERROR_CODE + , REGIST_DATE + , REGIST_ID + , UPDATE_DATE + , UPDATE_ID + ) VALUES ( + #{logType} + , #{oprMngCode} + , #{token} + , #{talkSeq} + , #{talkText} + , #{bookmarkErrCode} + , NOW() + , #{registId} + , NOW() + , #{updateId} + ) + + + + + + , BOOKMARK_ERROR_CODE = #{bookmarkErrCode} + + + + + + + diff --git a/main_vm/src/main/resources/mapper/test/IntentAnalysis_SQL.xml b/main_vm/src/main/resources/mapper/test/IntentAnalysis_SQL.xml new file mode 100644 index 0000000..da5a142 --- /dev/null +++ b/main_vm/src/main/resources/mapper/test/IntentAnalysis_SQL.xml @@ -0,0 +1,262 @@ + + + + + + + + + + + + + + + diff --git a/main_vm/src/main/resources/mapper/test/IntentManage_SQL.xml b/main_vm/src/main/resources/mapper/test/IntentManage_SQL.xml new file mode 100644 index 0000000..9703aa2 --- /dev/null +++ b/main_vm/src/main/resources/mapper/test/IntentManage_SQL.xml @@ -0,0 +1,285 @@ + + + + + + + + + + + + + + + + + + /* IntentManageMapper.insertIntentMaster */ + INSERT INTO TB_INTENT_MASTER ( + OPR_MNG_CODE + , INTENT_NAME + , CATEGORY + , REGIST_ID + , REGIST_DATE + , UPDATE_ID + , UPDATE_DATE + , USE_YN + , IF_MAPPING_ID + ) VALUES ( + #{oprMngCode}, + #{intentName}, + #{category}, + #{registId}, + NOW(), + #{registId}, + NOW(), + 'Y', + #{mappingId} + ) + + SELECT LAST_INSERT_ID() + + + + + + /* IntentManageMapper.insertIntent */ + INSERT INTO TB_INTENT_EXAMPLE ( + INTENT_SEQ + , EXAMPLE_TEXT + , IF_MAPPING_ID + , REGIST_ID + , REGIST_DATE + , UPDATE_ID + , UPDATE_DATE + , USE_YN + ) VALUES + + + + + ( + + + (SELECT IFNULL(MAX(SEQ), 0) FROM TB_INTENT_MASTER), + + + #{intentSeq}, + + + #{item.exampleText}, + #{mappingId}, + #{registId}, + NOW(), + #{registId}, + NOW(), + 'Y' + ) + + + + + ( + + + (SELECT IFNULL(MAX(SEQ), 0) FROM TB_INTENT_MASTER) A, + + + #{intentSeq}, + + + #{exampleText}, + #{registId}, + NOW(), + #{registId}, + NOW(), + 'Y' + ) + + + + + SELECT LAST_INSERT_ID() + + + + + + /* IntentManageMapper.updateIntentMaster */ + UPDATE TB_INTENT_MASTER + + UPDATE_ID = #{updateId}, + UPDATE_DATE = NOW(), + + INTENT_NAME = #{intentName}, + + + CATEGORY = #{category}, + + + USE_YN = #{useYn} + + + + AND SEQ = #{seq} + + + + + + /* IntentManageMapper.deleteIntentMaster */ + UPDATE TB_INTENT_MASTER + + AND SEQ = #{seq} + + + + + + /* IntentManageMapper.deleteIntentExample */ + DELETE FROM TB_INTENT_EXAMPLE + + AND INTENT_SEQ = #{intentSeq} + + AND SEQ NOT IN ( + + + + #{item.seq} + + + ) + + + + + + + /* IntentManageMapper.deleteIntentExample_one */ + DELETE FROM TB_INTENT_EXAMPLE + WHERE SEQ = #{seq} + + + + + /* IntentManageMapper.updateDeleteIntentExample */ + UPDATE TB_INTENT_EXAMPLE + + USE_YN = #{useYn}, + + + AND INTENT_SEQ = #{seq} + + AND SEQ NOT IN ( + + + + #{item.seq} + + + ) + + + + + + + + + + + + + + + diff --git a/main_vm/src/main/resources/mapper/test/MonitoringConsulting_SQL.xml b/main_vm/src/main/resources/mapper/test/MonitoringConsulting_SQL.xml new file mode 100644 index 0000000..9c9c0a3 --- /dev/null +++ b/main_vm/src/main/resources/mapper/test/MonitoringConsulting_SQL.xml @@ -0,0 +1,321 @@ + + + + + + + + + + + + + + + + + + diff --git a/main_vm/src/main/resources/mapper/test/MonitoringOutscenario_SQL.xml b/main_vm/src/main/resources/mapper/test/MonitoringOutscenario_SQL.xml new file mode 100644 index 0000000..eebf86e --- /dev/null +++ b/main_vm/src/main/resources/mapper/test/MonitoringOutscenario_SQL.xml @@ -0,0 +1,243 @@ + + + + + + + + + + + + + + + + + diff --git a/main_vm/src/main/resources/mapper/test/NlpWisenutApi_SQL.xml b/main_vm/src/main/resources/mapper/test/NlpWisenutApi_SQL.xml new file mode 100644 index 0000000..1e0330e --- /dev/null +++ b/main_vm/src/main/resources/mapper/test/NlpWisenutApi_SQL.xml @@ -0,0 +1,111 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/main_vm/src/main/resources/mapper/test/StatisticsCallInfo_SQL.xml b/main_vm/src/main/resources/mapper/test/StatisticsCallInfo_SQL.xml new file mode 100644 index 0000000..1e77eb6 --- /dev/null +++ b/main_vm/src/main/resources/mapper/test/StatisticsCallInfo_SQL.xml @@ -0,0 +1,47 @@ + + + + + + + + diff --git a/main_vm/src/main/resources/mapper/test/StatisticsDashboard_SQL.xml b/main_vm/src/main/resources/mapper/test/StatisticsDashboard_SQL.xml new file mode 100644 index 0000000..33ba6a2 --- /dev/null +++ b/main_vm/src/main/resources/mapper/test/StatisticsDashboard_SQL.xml @@ -0,0 +1,228 @@ + + + + + + + + + + + + + + + diff --git a/main_vm/src/main/resources/mapper/test/StatisticsIntent_SQL.xml b/main_vm/src/main/resources/mapper/test/StatisticsIntent_SQL.xml new file mode 100644 index 0000000..8159eca --- /dev/null +++ b/main_vm/src/main/resources/mapper/test/StatisticsIntent_SQL.xml @@ -0,0 +1,119 @@ + + + + + + + + + + diff --git a/main_vm/src/main/resources/mapper/test/StatisticsScenario_SQL.xml b/main_vm/src/main/resources/mapper/test/StatisticsScenario_SQL.xml new file mode 100644 index 0000000..0c1c2ea --- /dev/null +++ b/main_vm/src/main/resources/mapper/test/StatisticsScenario_SQL.xml @@ -0,0 +1,102 @@ + + + + + + + + + + diff --git a/main_vm/src/main/resources/mapper/test/SynonymManage_SQL.xml b/main_vm/src/main/resources/mapper/test/SynonymManage_SQL.xml new file mode 100644 index 0000000..7bb12a5 --- /dev/null +++ b/main_vm/src/main/resources/mapper/test/SynonymManage_SQL.xml @@ -0,0 +1,198 @@ + + + + + + + + /* SynonymManageMapper.deleteSynonym */ + UPDATE TB_SYNONYM_MASTER SET + USE_YN='N' + WHERE SEQ=#{seq} + + + + + + + + + + + + + + /* SynonymManageMapper.insertSynonymMaster */ + + INSERT INTO TB_SYNONYM_MASTER + (OPR_MNG_CODE, IDIV_WORD, REP_WORD, IF_MAPPING_ID, USE_YN, REGIST_ID, REGIST_DATE, UPDATE_ID, UPDATE_DATE) + VALUES + (#{serviceCode}, #{idivWord}, #{repWord}, #{mappingId},'Y', #{userId}, NOW(), #{userId}, NOW()) + + + UPDATE TB_SYNONYM_MASTER + SET + IDIV_WORD=#{idivWord}, + REP_WORD=#{repWord}, + USE_YN = 'Y', + UPDATE_ID=#{userId}, + UPDATE_DATE=NOW() + WHERE + SEQ=#{seq} + + + + + /* SynonymManageMapper.insertSynonymWord */ + INSERT INTO TB_SYNONYM_WORD + (MASTER_SEQ, OPR_MNG_CODE, SYNONYM_WORD, USE_YN, REGIST_ID, REGIST_DATE, UPDATE_ID, UPDATE_DATE) + SELECT + a.SEQ, #{serviceCode}, #{synonymWord}, 'Y',#{userId}, NOW() ,#{userId}, NOW() + FROM + TB_SYNONYM_MASTER a + WHERE + a.IDIV_WORD=#{idivWord} + AND a.OPR_MNG_CODE=#{serviceCode} + + + + /* SynonymManageMapper.updateSynonymWord */ + UPDATE TB_SYNONYM_WORD a, + (SELECT SEQ FROM TB_SYNONYM_MASTER WHERE IDIV_WORD=#{idivWord} AND OPR_MNG_CODE = #{serviceCode} AND USE_YN = 'Y') b + SET + a.MASTER_SEQ=b.SEQ, + a.USE_YN='Y', + a.UPDATE_ID=#{userId}, + a.UPDATE_DATE=NOW() + WHERE SYNONYM_WORD = #{synonymWord} + AND OPR_MNG_CODE = #{serviceCode} + + + + /* SynonymManageMapper.saveSynonymList */ + UPDATE TB_SYNONYM_MASTER a, + TB_SYNONYM_WORD b + SET + a.IDIV_WORD = #{idivWord}, + a.REP_WORD = #{repWord}, + a.UPDATE_ID = #{userId}, + a.UPDATE_DATE = NOW() + + , b.USE_YN = IF(b.SYNONYM_WORD IN( + + #{item} + + ), 'Y', 'N') + + WHERE + a.IDIV_WORD = #{idivWord} + AND b.MASTER_SEQ = a.SEQ + AND a.USE_YN = 'Y' + AND b.OPR_MNG_CODE = #{serviceCode}; + + + + + + /* SynonymManageMapper.deleteSynonymWord */ + UPDATE TB_SYNONYM_WORD SET + USE_YN='N' + WHERE MASTER_SEQ=#{seq} + + + + + diff --git a/main_vm/src/main/resources/mapper/test/Test1.xml b/main_vm/src/main/resources/mapper/test/Test1.xml new file mode 100644 index 0000000..551e970 --- /dev/null +++ b/main_vm/src/main/resources/mapper/test/Test1.xml @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/main_vm/src/main/resources/message/messages.properties b/main_vm/src/main/resources/message/messages.properties new file mode 100644 index 0000000..74ccb25 --- /dev/null +++ b/main_vm/src/main/resources/message/messages.properties @@ -0,0 +1,45 @@ +#UI resource# +list.sample=List Sample +button.search=\uAC80\uC0C9 +button.list=\uBAA9\uB85D +button.modify=\uC218\uC815 +button.create=\uB4F1\uB85D +button.reset=\uC7AC\uC124\uC815 +button.delete=\uC0AD\uC81C +search.choose=\uAC80\uC0C9\uC5B4 \uC120\uD0DD +search.keyword=\uAC80\uC0C9\uC5B4 \uC785\uB825 +search.name=\uC774\uB984 +search.id=ID +title.sample.id=\uCE74\uD14C\uACE0\uB9ACID +title.sample.name=\uCE74\uD14C\uACE0\uB9AC\uBA85 +title.sample.useYn=\uC0AC\uC6A9\uC5EC\uBD80 +title.sample.description=\uC124\uBA85 +title.sample.regUser=\uB4F1\uB85D\uC790 +title.sample=\uAE30\uBCF8 \uAC8C\uC2DC\uD310 \uBAA9\uB85D + +# image name # +image.search=btn_form_search.gif +image.errorBg=error + +# -- validator errors -- # +fail.common.msg=\uC5D0\uB7EC\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4! +fail.common.sql=sql \uC5D0\uB7EC\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4! error code: {0}, error msg: {1} +info.nodata.msg=\uD574\uB2F9 \uB370\uC774\uD130\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4. +errors.prefix=
+errors.suffix=

+errors.required={0} \uC740 \uD544\uC218 \uC785\uB825\uAC12\uC785\uB2C8\uB2E4. +errors.minlength={0} \uC740 {1}\uC790 \uC774\uC0C1 \uC785\uB825\uD574\uC57C \uD569\uB2C8\uB2E4. +errors.maxlength={0} \uC740 {1}\uC790 \uC774\uC0C1 \uC785\uB825\uD560\uC218 \uC5C6\uC2B5\uB2C8\uB2E4. +errors.invalid={0} \uC740 \uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 \uAC12\uC785\uB2C8\uB2E4. +errors.byte={0} \uC740 byte \uD0C0\uC785\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4. +errors.short={0} \uC740 short \uD0C0\uC785\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4. +errors.integer={0} \uC740 integer \uD0C0\uC785\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4. +errors.long={0} \uC740 long \uD0C0\uC785\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4. +errors.float={0} \uC740 float \uD0C0\uC785\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4. +errors.double={0} \uC740 double \uD0C0\uC785\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4. +errors.date={0} \uC740 \uB0A0\uC9DC \uC720\uD615\uC774 \uC544\uB2D9\uB2C8\uB2E4. +errors.range={0} \uC740 {1} \uACFC {2} \uC0AC\uC774\uC758 \uAC12\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4. +errors.creditcard={0} \uC740 \uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 \uC2E0\uC6A9\uCE74\uB4DC \uBC88\uD638\uC785\uB2C8\uB2E4. +errors.email={0} \uC740 \uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 \uC774\uBA54\uC77C \uC8FC\uC18C\uC785\uB2C8\uB2E4. +errors.ihidnum=\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 \uC8FC\uBBFC\uB4F1\uB85D\uBC88\uD638\uC785\uB2C8\uB2E4. +errors.korean={0}\uC740 \uD55C\uAE00\uC744 \uC785\uB825\uD558\uC154\uC57C \uD569\uB2C8\uB2E4. \ No newline at end of file diff --git a/main_vm/src/main/resources/message/messages_ko.properties b/main_vm/src/main/resources/message/messages_ko.properties new file mode 100644 index 0000000..815f95f --- /dev/null +++ b/main_vm/src/main/resources/message/messages_ko.properties @@ -0,0 +1,46 @@ +#UI resource# +list.sample=List Sample +button.search=\uAC80\uC0C9 +button.list=\uBAA9\uB85D +button.modify=\uC218\uC815 +button.create=\uB4F1\uB85D +button.reset=\uC7AC\uC124\uC815 +button.delete=\uC0AD\uC81C +search.choose=\uAC80\uC0C9\uC5B4 \uC120\uD0DD +search.keyword=\uAC80\uC0C9\uC5B4 \uC785\uB825 +search.name=\uC774\uB984 +search.id=ID +title.sample.id=\uCE74\uD14C\uACE0\uB9ACID +title.sample.name=\uCE74\uD14C\uACE0\uB9AC\uBA85 +title.sample.useYn=\uC0AC\uC6A9\uC5EC\uBD80 +title.sample.description=\uC124\uBA85 +title.sample.regUser=\uB4F1\uB85D\uC790 +title.sample=\uAE30\uBCF8 \uAC8C\uC2DC\uD310 \uBAA9\uB85D + +# image name # +image.search=btn_form_search.gif +image.errorBg=error + +# -- validator errors -- # +fail.common.msg=\uC5D0\uB7EC\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4! +fail.common.bad=\uC720\uD6A8\uD558\uC9C0\uC54A\uC740 \uC694\uCCAD\uC785\uB2C8\uB2E4. +fail.common.sql=sql \uC5D0\uB7EC\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4! error code: {0}, error msg: {1} +info.nodata.msg=\uD574\uB2F9 \uB370\uC774\uD130\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4. +errors.prefix=
+errors.suffix=

+errors.required={0} \uC740 \uD544\uC218 \uC785\uB825\uAC12\uC785\uB2C8\uB2E4. +errors.minlength={0} \uC740 {1}\uC790 \uC774\uC0C1 \uC785\uB825\uD574\uC57C \uD569\uB2C8\uB2E4. +errors.maxlength={0} \uC740 {1}\uC790 \uC774\uC0C1 \uC785\uB825\uD560\uC218 \uC5C6\uC2B5\uB2C8\uB2E4. +errors.invalid={0} \uC740 \uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 \uAC12\uC785\uB2C8\uB2E4. +errors.byte={0} \uC740 byte \uD0C0\uC785\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4. +errors.short={0} \uC740 short \uD0C0\uC785\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4. +errors.integer={0} \uC740 integer \uD0C0\uC785\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4. +errors.long={0} \uC740 long \uD0C0\uC785\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4. +errors.float={0} \uC740 float \uD0C0\uC785\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4. +errors.double={0} \uC740 double \uD0C0\uC785\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4. +errors.date={0} \uC740 \uB0A0\uC9DC \uC720\uD615\uC774 \uC544\uB2D9\uB2C8\uB2E4. +errors.range={0} \uC740 {1} \uACFC {2} \uC0AC\uC774\uC758 \uAC12\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4. +errors.creditcard={0} \uC740 \uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 \uC2E0\uC6A9\uCE74\uB4DC \uBC88\uD638\uC785\uB2C8\uB2E4. +errors.email={0} \uC740 \uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 \uC774\uBA54\uC77C \uC8FC\uC18C\uC785\uB2C8\uB2E4. +errors.ihidnum=\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 \uC8FC\uBBFC\uB4F1\uB85D\uBC88\uD638\uC785\uB2C8\uB2E4. +errors.korean={0}\uC740 \uD55C\uAE00\uC744 \uC785\uB825\uD558\uC154\uC57C \uD569\uB2C8\uB2E4. \ No newline at end of file diff --git a/main_vm/src/main/resources/message/messages_ko_KR.properties b/main_vm/src/main/resources/message/messages_ko_KR.properties new file mode 100644 index 0000000..74ccb25 --- /dev/null +++ b/main_vm/src/main/resources/message/messages_ko_KR.properties @@ -0,0 +1,45 @@ +#UI resource# +list.sample=List Sample +button.search=\uAC80\uC0C9 +button.list=\uBAA9\uB85D +button.modify=\uC218\uC815 +button.create=\uB4F1\uB85D +button.reset=\uC7AC\uC124\uC815 +button.delete=\uC0AD\uC81C +search.choose=\uAC80\uC0C9\uC5B4 \uC120\uD0DD +search.keyword=\uAC80\uC0C9\uC5B4 \uC785\uB825 +search.name=\uC774\uB984 +search.id=ID +title.sample.id=\uCE74\uD14C\uACE0\uB9ACID +title.sample.name=\uCE74\uD14C\uACE0\uB9AC\uBA85 +title.sample.useYn=\uC0AC\uC6A9\uC5EC\uBD80 +title.sample.description=\uC124\uBA85 +title.sample.regUser=\uB4F1\uB85D\uC790 +title.sample=\uAE30\uBCF8 \uAC8C\uC2DC\uD310 \uBAA9\uB85D + +# image name # +image.search=btn_form_search.gif +image.errorBg=error + +# -- validator errors -- # +fail.common.msg=\uC5D0\uB7EC\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4! +fail.common.sql=sql \uC5D0\uB7EC\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4! error code: {0}, error msg: {1} +info.nodata.msg=\uD574\uB2F9 \uB370\uC774\uD130\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4. +errors.prefix=
+errors.suffix=

+errors.required={0} \uC740 \uD544\uC218 \uC785\uB825\uAC12\uC785\uB2C8\uB2E4. +errors.minlength={0} \uC740 {1}\uC790 \uC774\uC0C1 \uC785\uB825\uD574\uC57C \uD569\uB2C8\uB2E4. +errors.maxlength={0} \uC740 {1}\uC790 \uC774\uC0C1 \uC785\uB825\uD560\uC218 \uC5C6\uC2B5\uB2C8\uB2E4. +errors.invalid={0} \uC740 \uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 \uAC12\uC785\uB2C8\uB2E4. +errors.byte={0} \uC740 byte \uD0C0\uC785\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4. +errors.short={0} \uC740 short \uD0C0\uC785\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4. +errors.integer={0} \uC740 integer \uD0C0\uC785\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4. +errors.long={0} \uC740 long \uD0C0\uC785\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4. +errors.float={0} \uC740 float \uD0C0\uC785\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4. +errors.double={0} \uC740 double \uD0C0\uC785\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4. +errors.date={0} \uC740 \uB0A0\uC9DC \uC720\uD615\uC774 \uC544\uB2D9\uB2C8\uB2E4. +errors.range={0} \uC740 {1} \uACFC {2} \uC0AC\uC774\uC758 \uAC12\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4. +errors.creditcard={0} \uC740 \uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 \uC2E0\uC6A9\uCE74\uB4DC \uBC88\uD638\uC785\uB2C8\uB2E4. +errors.email={0} \uC740 \uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 \uC774\uBA54\uC77C \uC8FC\uC18C\uC785\uB2C8\uB2E4. +errors.ihidnum=\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 \uC8FC\uBBFC\uB4F1\uB85D\uBC88\uD638\uC785\uB2C8\uB2E4. +errors.korean={0}\uC740 \uD55C\uAE00\uC744 \uC785\uB825\uD558\uC154\uC57C \uD569\uB2C8\uB2E4. \ No newline at end of file diff --git a/main_vm/src/main/resources/message/validation.properties b/main_vm/src/main/resources/message/validation.properties new file mode 100644 index 0000000..20bfcf7 --- /dev/null +++ b/main_vm/src/main/resources/message/validation.properties @@ -0,0 +1,4 @@ +#NotNull.testcheck.name=\uD14C\uC2A4\uD2B8\uCCB4\uD06C \uC774\uB984\uC740 \uB110\uC77C\uC218 \uC5C6\uC2B5\uB2C8\uB2E4. +NotNull.name=\uC774\uB984\uC740 \uB110\uC77C\uC218 \uC5C6\uC2B5\uB2C8\uB2E4. +NotNull.java.lang.String=\uBB38\uC790\uC5F4\uC740 \uB110\uC77C\uC218 \uC5C6\uC2B5\uB2C8\uB2E4. +NotNull=\uB110\uC774\uC5B4\uC11C\uB294 \uC548\uB429\uB2C8\uB2E4...... \ No newline at end of file diff --git a/main_vm/src/main/resources/message/validation_ko_KR.properties b/main_vm/src/main/resources/message/validation_ko_KR.properties new file mode 100644 index 0000000..8fda447 --- /dev/null +++ b/main_vm/src/main/resources/message/validation_ko_KR.properties @@ -0,0 +1,4 @@ +#NotNull.testcheck.name=\uD14C\uC2A4\uD2B8\uCCB4\uD06C \uC774\uB984\uC740 \uB110\uC77C\uC218 \uC5C6\uC2B5\uB2C8\uB2E4. +#NotNull.name=\uC774\uB984\uC740 \uB110\uC77C\uC218 \uC5C6\uC2B5\uB2C8\uB2E4. +#NotNull.java.lang.String=\uBB38\uC790\uC5F4\uC740 \uB110\uC77C\uC218 \uC5C6\uC2B5\uB2C8\uB2E4. +#NotNull=\uB110\uC774\uC5B4\uC11C\uB294 \uC548\uB429\uB2C8\uB2E4...... \ No newline at end of file diff --git a/main_vm/src/main/webapp/META-INF/MANIFEST.MF b/main_vm/src/main/webapp/META-INF/MANIFEST.MF new file mode 100644 index 0000000..254272e --- /dev/null +++ b/main_vm/src/main/webapp/META-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +Class-Path: + diff --git a/main_vm/src/main/webapp/META-INF/license b/main_vm/src/main/webapp/META-INF/license new file mode 100644 index 0000000..d645695 --- /dev/null +++ b/main_vm/src/main/webapp/META-INF/license @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + 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 + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/main_vm/src/main/webapp/META-INF/osslicenses b/main_vm/src/main/webapp/META-INF/osslicenses new file mode 100644 index 0000000..25c8d8b --- /dev/null +++ b/main_vm/src/main/webapp/META-INF/osslicenses @@ -0,0 +1,1688 @@ +전자정부 표준프레임워크에 포함된 다음 오픈소스소프트웨어는 아래 명시된 +------- +Apache License 2.0 +* spring +* spring-social-sa mples +* Spring Social Config +* godsoft +* egovframework +* Commons IO +------- +BSD 3-clause "New" or "Revised" License +* HTMLarea Editor For XOOPS +------- +GNU Lesser General Public License v2.1 or later +* FCKeditor - CKEditor +------- +JSON License +* JSON in Java +------- +MIT License +* jsTree +* Prototype JavaScript Framework +* jQuery +* jsx-requirejs-plu gin +* jQuery +* jQuery UI +------- +htmlArea License +* htmlArea +* HTMLarea Editor For XOOPS +------- +라이센스 적용을 받습니다. + . + . + . + Oss License Details +--------------------------------------------------------------------------------- +Apache License 2.0 +* spring +* spring-social-sa mples +* Spring Social Config +* godsoft +* egovframework +* Commons IO + +---------------------------------------------- +* spring +* spring-social-sa mples +* Spring Social Config +* godsoft +* egovframework +* Commons IO + +Apache License +Version 2.0, January 2004 +http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + +"License" shall mean the terms and conditions for use, reproduction, +and distribution as defined by Sections 1 through 9 of this document. + +"Licensor" shall mean the copyright owner or entity authorized by +the copyright owner that is granting the License. + +"Legal Entity" shall mean the union of the acting entity and all +other entities that control, are controlled by, or are under common +control with that entity. For the purposes of this definition, +"control" means (i) the power, direct or indirect, to cause the +direction or management of such entity, whether by contract or +otherwise, or (ii) ownership of fifty percent (50%) or more of the +outstanding shares, or (iii) beneficial ownership of such entity. + +"You" (or "Your") shall mean an individual or Legal Entity +exercising permissions granted by this License. + +"Source" form shall mean the preferred form for making modifications, +including but not limited to software source code, documentation +source, and configuration files. + +"Object" form shall mean any form resulting from mechanical +transformation or translation of a Source form, including but +not limited to compiled object code, generated documentation, +and conversions to other media types. + +"Work" shall mean the work of authorship, whether in Source or +Object form, made available under the License, as indicated by a +copyright notice that is included in or attached to the work +(an example is provided in the Appendix below). + +"Derivative Works" shall mean any work, whether in Source or Object +form, that is based on (or derived from) the Work and for which the +editorial revisions, annotations, elaborations, or other modifications +represent, as a whole, an original work of authorship. For the purposes +of this License, Derivative Works shall not include works that remain +separable from, or merely link (or bind by name) to the interfaces of, +the Work and Derivative Works thereof. + +"Contribution" shall mean any work of authorship, including +the original version of the Work and any modifications or additions +to that Work or Derivative Works thereof, that is intentionally +submitted to Licensor for inclusion in the Work by the copyright owner +or by an individual or Legal Entity authorized to submit on behalf of +the copyright owner. For the purposes of this definition, "submitted" +means any form of electronic, verbal, or written communication sent +to the Licensor or its representatives, including but not limited to +communication on electronic mailing lists, source code control systems, +and issue tracking systems that are managed by, or on behalf of, the +Licensor for the purpose of discussing and improving the Work, but +excluding communication that is conspicuously marked or otherwise +designated in writing by the copyright owner as "Not a Contribution." + +"Contributor" shall mean Licensor and any individual or Legal Entity +on behalf of whom a Contribution has been received by Licensor and +subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of +this License, each Contributor hereby grants to You a perpetual, +worldwide, non-exclusive, no-charge, royalty-free, irrevocable +copyright license to reproduce, prepare Derivative Works of, +publicly display, publicly perform, sublicense, and distribute the +Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of +this License, each Contributor hereby grants to You a perpetual, +worldwide, non-exclusive, no-charge, royalty-free, irrevocable +(except as stated in this section) patent license to make, have made, +use, offer to sell, sell, import, and otherwise transfer the Work, +where such license applies only to those patent claims licensable +by such Contributor that are necessarily infringed by their +Contribution(s) alone or by combination of their Contribution(s) +with the Work to which such Contribution(s) was submitted. If You +institute patent litigation against any entity (including a +cross-claim or counterclaim in a lawsuit) alleging that the Work +or a Contribution incorporated within the Work constitutes direct +or contributory patent infringement, then any patent licenses +granted to You under this License for that Work shall terminate +as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the +Work or Derivative Works thereof in any medium, with or without +modifications, and in Source or Object form, provided that You +meet the following conditions: + +(a) You must give any other recipients of the Work or +Derivative Works a copy of this License; and + +(b) You must cause any modified files to carry prominent notices +stating that You changed the files; and + +(c) You must retain, in the Source form of any Derivative Works +that You distribute, all copyright, patent, trademark, and +attribution notices from the Source form of the Work, +excluding those notices that do not pertain to any part of +the Derivative Works; and + +(d) If the Work includes a "NOTICE" text file as part of its +distribution, then any Derivative Works that You distribute must +include a readable copy of the attribution notices contained +within such NOTICE file, excluding those notices that do not +pertain to any part of the Derivative Works, in at least one +of the following places: within a NOTICE text file distributed +as part of the Derivative Works; within the Source form or +documentation, if provided along with the Derivative Works; or, +within a display generated by the Derivative Works, if and +wherever such third-party notices normally appear. The contents +of the NOTICE file are for informational purposes only and +do not modify the License. You may add Your own attribution +notices within Derivative Works that You distribute, alongside +or as an addendum to the NOTICE text from the Work, provided +that such additional attribution notices cannot be construed +as modifying the License. + +You may add Your own copyright statement to Your modifications and +may provide additional or different license terms and conditions +for use, reproduction, or distribution of Your modifications, or +for any such Derivative Works as a whole, provided Your use, +reproduction, and distribution of the Work otherwise complies with +the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, +any Contribution intentionally submitted for inclusion in the Work +by You to the Licensor shall be under the terms and conditions of +this License, without any additional terms or conditions. +Notwithstanding the above, nothing herein shall supersede or modify +the terms of any separate license agreement you may have executed +with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade +names, trademarks, service marks, or product names of the Licensor, +except as required for reasonable and customary use in describing the +origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or +agreed to in writing, Licensor provides the Work (and each +Contributor provides its Contributions) on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +implied, including, without limitation, any warranties or conditions +of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A +PARTICULAR PURPOSE. You are solely responsible for determining the +appropriateness of using or redistributing the Work and assume any +risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, +whether in tort (including negligence), contract, or otherwise, +unless required by applicable law (such as deliberate and grossly +negligent acts) or agreed to in writing, shall any Contributor be +liable to You for damages, including any direct, indirect, special, +incidental, or consequential damages of any character arising as a +result of this License or out of the use or inability to use the +Work (including but not limited to damages for loss of goodwill, +work stoppage, computer failure or malfunction, or any and all +other commercial damages or losses), even if such Contributor +has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing +the Work or Derivative Works thereof, You may choose to offer, +and charge a fee for, acceptance of support, warranty, indemnity, +or other liability obligations and/or rights consistent with this +License. However, in accepting such obligations, You may act only +on Your own behalf and on Your sole responsibility, not on behalf +of any other Contributor, and only if You agree to indemnify, +defend, and hold each Contributor harmless for any liability +incurred by, or claims asserted against, such Contributor by reason +of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + +To apply the Apache License to your work, attach the following +boilerplate notice, with the fields enclosed by brackets "[]" +replaced with your own identifying information. (Don't include +the brackets!) The text should be enclosed in the appropriate +comment syntax for the file format. We also recommend that a +file or class name and description of purpose be included on the +same "printed page" as the copyright notice for easier +identification within third-party archives. + +Copyright [yyyy] [name of copyright owner] + +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 + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +--------------------------------------------------------------------------------- +BSD 3-clause "New" or "Revised" License +-* HTMLarea Editor For XOOPS +htmlArea License (based on BSD license) +Copyright (c) 2002-2004, interactivetools.com, inc. +Copyright (c) 2003-2005 dynarch.com +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1) Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + +2) Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3) Neither the name of interactivetools.com, inc. nor the names of its + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +zCONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. + +--------------------------------------------------------------------------------- +GNU Lesser General Public License v2.1 or later +* FCKeditor - CKEditor +---------------------------------------------- +Software License Agreement +========================== + +CKEditor - The text editor for Internet - http://ckeditor.com +Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved. + +Licensed under the terms of any of the following licenses at your +choice: + + - GNU General Public License Version 2 or later (the "GPL") + http://www.gnu.org/licenses/gpl.html + (See Appendix A) + + - GNU Lesser General Public License Version 2.1 or later (the "LGPL") + http://www.gnu.org/licenses/lgpl.html + (See Appendix B) + + - Mozilla Public License Version 1.1 or later (the "MPL") + http://www.mozilla.org/MPL/MPL-1.1.html + (See Appendix C) + +You are not required to, but if you want to explicitly declare the +license you have chosen to be bound to when using, reproducing, +modifying and distributing this software, just include a text file +titled "legal.txt" in your version of this software, indicating your +license choice. In any case, your choice will not restrict any +recipient of your version of this software to use, reproduce, modify +and distribute this software under any of the above licenses. + +Sources of Intellectual Property Included in CKEditor +----------------------------------------------------- + +Where not otherwise indicated, all CKEditor content is authored by +CKSource engineers and consists of CKSource-owned intellectual +property. In some specific instances, CKEditor will incorporate work +done by developers outside of CKSource with their express permission. + +Trademarks +---------- + +CKEditor is a trademark of CKSource - Frederico Knabben. All other brand +and product names are trademarks, registered trademarks or service +marks of their respective holders. + +--- + +Appendix A: The GPL License +--------------------------- + +GNU GENERAL PUBLIC LICENSE +Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software-to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + +GNU GENERAL PUBLIC LICENSE +TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + +NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + +END OF TERMS AND CONDITIONS + + +Appendix B: The LGPL License +---------------------------- + +GNU LESSER GENERAL PUBLIC LICENSE +Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + +Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software-to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages-typically libraries-of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + +GNU LESSER GENERAL PUBLIC LICENSE +TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + +NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + +END OF TERMS AND CONDITIONS + + +Appendix C: The MPL License +--------------------------- + +MOZILLA PUBLIC LICENSE +Version 1.1 + +1. Definitions. + + 1.0.1. "Commercial Use" means distribution or otherwise making the + Covered Code available to a third party. + + 1.1. "Contributor" means each entity that creates or contributes to + the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the Original + Code, prior Modifications used by a Contributor, and the Modifications + made by that particular Contributor. + + 1.3. "Covered Code" means the Original Code or Modifications or the + combination of the Original Code and Modifications, in each case + including portions thereof. + + 1.4. "Electronic Distribution Mechanism" means a mechanism generally + accepted in the software development community for the electronic + transfer of data. + + 1.5. "Executable" means Covered Code in any form other than Source + Code. + + 1.6. "Initial Developer" means the individual or entity identified + as the Initial Developer in the Source Code notice required by Exhibit + A. + + 1.7. "Larger Work" means a work which combines Covered Code or + portions thereof with code not governed by the terms of this License. + + 1.8. "License" means this document. + + 1.8.1. "Licensable" means having the right to grant, to the maximum + extent possible, whether at the time of the initial grant or + subsequently acquired, any and all of the rights conveyed herein. + + 1.9. "Modifications" means any addition to or deletion from the + substance or structure of either the Original Code or any previous + Modifications. When Covered Code is released as a series of files, a + Modification is: + A. Any addition to or deletion from the contents of a file + containing Original Code or previous Modifications. + + B. Any new file that contains any part of the Original Code or + previous Modifications. + + 1.10. "Original Code" means Source Code of computer software code + which is described in the Source Code notice required by Exhibit A as + Original Code, and which, at the time of its release under this + License is not already Covered Code governed by this License. + + 1.10.1. "Patent Claims" means any patent claim(s), now owned or + hereafter acquired, including without limitation, method, process, + and apparatus claims, in any patent Licensable by grantor. + + 1.11. "Source Code" means the preferred form of the Covered Code for + making modifications to it, including all modules it contains, plus + any associated interface definition files, scripts used to control + compilation and installation of an Executable, or source code + differential comparisons against either the Original Code or another + well known, available Covered Code of the Contributor's choice. The + Source Code can be in a compressed or archival form, provided the + appropriate decompression or de-archiving software is widely available + for no charge. + + 1.12. "You" (or "Your") means an individual or a legal entity + exercising rights under, and complying with all of the terms of, this + License or a future version of this License issued under Section 6.1. + For legal entities, "You" includes any entity which controls, is + controlled by, or is under common control with You. For purposes of + this definition, "control" means (a) the power, direct or indirect, + to cause the direction or management of such entity, whether by + contract or otherwise, or (b) ownership of more than fifty percent + (50%) of the outstanding shares or beneficial ownership of such + entity. + +2. Source Code License. + + 2.1. The Initial Developer Grant. + The Initial Developer hereby grants You a world-wide, royalty-free, + non-exclusive license, subject to third party intellectual property + claims: + (a) under intellectual property rights (other than patent or + trademark) Licensable by Initial Developer to use, reproduce, + modify, display, perform, sublicense and distribute the Original + Code (or portions thereof) with or without Modifications, and/or + as part of a Larger Work; and + + (b) under Patents Claims infringed by the making, using or + selling of Original Code, to make, have made, use, practice, + sell, and offer for sale, and/or otherwise dispose of the + Original Code (or portions thereof). + + (c) the licenses granted in this Section 2.1(a) and (b) are + effective on the date Initial Developer first distributes + Original Code under the terms of this License. + + (d) Notwithstanding Section 2.1(b) above, no patent license is + granted: 1) for code that You delete from the Original Code; 2) + separate from the Original Code; or 3) for infringements caused + by: i) the modification of the Original Code or ii) the + combination of the Original Code with other software or devices. + + 2.2. Contributor Grant. + Subject to third party intellectual property claims, each Contributor + hereby grants You a world-wide, royalty-free, non-exclusive license + + (a) under intellectual property rights (other than patent or + trademark) Licensable by Contributor, to use, reproduce, modify, + display, perform, sublicense and distribute the Modifications + created by such Contributor (or portions thereof) either on an + unmodified basis, with other Modifications, as Covered Code + and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, using, or + selling of Modifications made by that Contributor either alone + and/or in combination with its Contributor Version (or portions + of such combination), to make, use, sell, offer for sale, have + made, and/or otherwise dispose of: 1) Modifications made by that + Contributor (or portions thereof); and 2) the combination of + Modifications made by that Contributor with its Contributor + Version (or portions of such combination). + + (c) the licenses granted in Sections 2.2(a) and 2.2(b) are + effective on the date Contributor first makes Commercial Use of + the Covered Code. + + (d) Notwithstanding Section 2.2(b) above, no patent license is + granted: 1) for any code that Contributor has deleted from the + Contributor Version; 2) separate from the Contributor Version; + 3) for infringements caused by: i) third party modifications of + Contributor Version or ii) the combination of Modifications made + by that Contributor with other software (except as part of the + Contributor Version) or other devices; or 4) under Patent Claims + infringed by Covered Code in the absence of Modifications made by + that Contributor. + +3. Distribution Obligations. + + 3.1. Application of License. + The Modifications which You create or to which You contribute are + governed by the terms of this License, including without limitation + Section 2.2. The Source Code version of Covered Code may be + distributed only under the terms of this License or a future version + of this License released under Section 6.1, and You must include a + copy of this License with every copy of the Source Code You + distribute. You may not offer or impose any terms on any Source Code + version that alters or restricts the applicable version of this + License or the recipients' rights hereunder. However, You may include + an additional document offering the additional rights described in + Section 3.5. + + 3.2. Availability of Source Code. + Any Modification which You create or to which You contribute must be + made available in Source Code form under the terms of this License + either on the same media as an Executable version or via an accepted + Electronic Distribution Mechanism to anyone to whom you made an + Executable version available; and if made available via Electronic + Distribution Mechanism, must remain available for at least twelve (12) + months after the date it initially became available, or at least six + (6) months after a subsequent version of that particular Modification + has been made available to such recipients. You are responsible for + ensuring that the Source Code version remains available even if the + Electronic Distribution Mechanism is maintained by a third party. + + 3.3. Description of Modifications. + You must cause all Covered Code to which You contribute to contain a + file documenting the changes You made to create that Covered Code and + the date of any change. You must include a prominent statement that + the Modification is derived, directly or indirectly, from Original + Code provided by the Initial Developer and including the name of the + Initial Developer in (a) the Source Code, and (b) in any notice in an + Executable version or related documentation in which You describe the + origin or ownership of the Covered Code. + + 3.4. Intellectual Property Matters + (a) Third Party Claims. + If Contributor has knowledge that a license under a third party's + intellectual property rights is required to exercise the rights + granted by such Contributor under Sections 2.1 or 2.2, + Contributor must include a text file with the Source Code + distribution titled "LEGAL" which describes the claim and the + party making the claim in sufficient detail that a recipient will + know whom to contact. If Contributor obtains such knowledge after + the Modification is made available as described in Section 3.2, + Contributor shall promptly modify the LEGAL file in all copies + Contributor makes available thereafter and shall take other steps + (such as notifying appropriate mailing lists or newsgroups) + reasonably calculated to inform those who received the Covered + Code that new knowledge has been obtained. + + (b) Contributor APIs. + If Contributor's Modifications include an application programming + interface and Contributor has knowledge of patent licenses which + are reasonably necessary to implement that API, Contributor must + also include this information in the LEGAL file. + + (c) Representations. + Contributor represents that, except as disclosed pursuant to + Section 3.4(a) above, Contributor believes that Contributor's + Modifications are Contributor's original creation(s) and/or + Contributor has sufficient rights to grant the rights conveyed by + this License. + + 3.5. Required Notices. + You must duplicate the notice in Exhibit A in each file of the Source + Code. If it is not possible to put such notice in a particular Source + Code file due to its structure, then You must include such notice in a + location (such as a relevant directory) where a user would be likely + to look for such a notice. If You created one or more Modification(s) + You may add your name as a Contributor to the notice described in + Exhibit A. You must also duplicate this License in any documentation + for the Source Code where You describe recipients' rights or ownership + rights relating to Covered Code. You may choose to offer, and to + charge a fee for, warranty, support, indemnity or liability + obligations to one or more recipients of Covered Code. However, You + may do so only on Your own behalf, and not on behalf of the Initial + Developer or any Contributor. You must make it absolutely clear than + any such warranty, support, indemnity or liability obligation is + offered by You alone, and You hereby agree to indemnify the Initial + Developer and every Contributor for any liability incurred by the + Initial Developer or such Contributor as a result of warranty, + support, indemnity or liability terms You offer. + + 3.6. Distribution of Executable Versions. + You may distribute Covered Code in Executable form only if the + requirements of Section 3.1-3.5 have been met for that Covered Code, + and if You include a notice stating that the Source Code version of + the Covered Code is available under the terms of this License, + including a description of how and where You have fulfilled the + obligations of Section 3.2. The notice must be conspicuously included + in any notice in an Executable version, related documentation or + collateral in which You describe recipients' rights relating to the + Covered Code. You may distribute the Executable version of Covered + Code or ownership rights under a license of Your choice, which may + contain terms different from this License, provided that You are in + compliance with the terms of this License and that the license for the + Executable version does not attempt to limit or alter the recipient's + rights in the Source Code version from the rights set forth in this + License. If You distribute the Executable version under a different + license You must make it absolutely clear that any terms which differ + from this License are offered by You alone, not by the Initial + Developer or any Contributor. You hereby agree to indemnify the + Initial Developer and every Contributor for any liability incurred by + the Initial Developer or such Contributor as a result of any such + terms You offer. + + 3.7. Larger Works. + You may create a Larger Work by combining Covered Code with other code + not governed by the terms of this License and distribute the Larger + Work as a single product. In such a case, You must make sure the + requirements of this License are fulfilled for the Covered Code. + +4. Inability to Comply Due to Statute or Regulation. + + If it is impossible for You to comply with any of the terms of this + License with respect to some or all of the Covered Code due to + statute, judicial order, or regulation then You must: (a) comply with + the terms of this License to the maximum extent possible; and (b) + describe the limitations and the code they affect. Such description + must be included in the LEGAL file described in Section 3.4 and must + be included with all distributions of the Source Code. Except to the + extent prohibited by statute or regulation, such description must be + sufficiently detailed for a recipient of ordinary skill to be able to + understand it. + +5. Application of this License. + + This License applies to code to which the Initial Developer has + attached the notice in Exhibit A and to related Covered Code. + +6. Versions of the License. + + 6.1. New Versions. + Netscape Communications Corporation ("Netscape") may publish revised + and/or new versions of the License from time to time. Each version + will be given a distinguishing version number. + + 6.2. Effect of New Versions. + Once Covered Code has been published under a particular version of the + License, You may always continue to use it under the terms of that + version. You may also choose to use such Covered Code under the terms + of any subsequent version of the License published by Netscape. No one + other than Netscape has the right to modify the terms applicable to + Covered Code created under this License. + + 6.3. Derivative Works. + If You create or use a modified version of this License (which you may + only do in order to apply it to code which is not already Covered Code + governed by this License), You must (a) rename Your license so that + the phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", + "MPL", "NPL" or any confusingly similar phrase do not appear in your + license (except to note that your license differs from this License) + and (b) otherwise make it clear that Your version of the license + contains terms which differ from the Mozilla Public License and + Netscape Public License. (Filling in the name of the Initial + Developer, Original Code or Contributor in the notice described in + Exhibit A shall not of themselves be deemed to be modifications of + this License.) + +7. DISCLAIMER OF WARRANTY. + + COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF + DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. + THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED CODE + IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, + YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE + COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER + OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF + ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER. + +8. TERMINATION. + + 8.1. This License and the rights granted hereunder will terminate + automatically if You fail to comply with terms herein and fail to cure + such breach within 30 days of becoming aware of the breach. All + sublicenses to the Covered Code which are properly granted shall + survive any termination of this License. Provisions which, by their + nature, must remain in effect beyond the termination of this License + shall survive. + + 8.2. If You initiate litigation by asserting a patent infringement + claim (excluding declatory judgment actions) against Initial Developer + or a Contributor (the Initial Developer or Contributor against whom + You file such action is referred to as "Participant") alleging that: + + (a) such Participant's Contributor Version directly or indirectly + infringes any patent, then any and all rights granted by such + Participant to You under Sections 2.1 and/or 2.2 of this License + shall, upon 60 days notice from Participant terminate prospectively, + unless if within 60 days after receipt of notice You either: (i) + agree in writing to pay Participant a mutually agreeable reasonable + royalty for Your past and future use of Modifications made by such + Participant, or (ii) withdraw Your litigation claim with respect to + the Contributor Version against such Participant. If within 60 days + of notice, a reasonable royalty and payment arrangement are not + mutually agreed upon in writing by the parties or the litigation claim + is not withdrawn, the rights granted by Participant to You under + Sections 2.1 and/or 2.2 automatically terminate at the expiration of + the 60 day notice period specified above. + + (b) any software, hardware, or device, other than such Participant's + Contributor Version, directly or indirectly infringes any patent, then + any rights granted to You by such Participant under Sections 2.1(b) + and 2.2(b) are revoked effective as of the date You first made, used, + sold, distributed, or had made, Modifications made by that + Participant. + + 8.3. If You assert a patent infringement claim against Participant + alleging that such Participant's Contributor Version directly or + indirectly infringes any patent where such claim is resolved (such as + by license or settlement) prior to the initiation of patent + infringement litigation, then the reasonable value of the licenses + granted by such Participant under Sections 2.1 or 2.2 shall be taken + into account in determining the amount or value of any payment or + license. + + 8.4. In the event of termination under Sections 8.1 or 8.2 above, + all end user license agreements (excluding distributors and resellers) + which have been validly granted by You or any distributor hereunder + prior to termination shall survive termination. + +9. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT + (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL + DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, + OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR + ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY + CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, + WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER + COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN + INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF + LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY + RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW + PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE + EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO + THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. + +10. U.S. GOVERNMENT END USERS. + + The Covered Code is a "commercial item," as that term is defined in + 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer + software" and "commercial computer software documentation," as such + terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48 + C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995), + all U.S. Government End Users acquire Covered Code with only those + rights set forth herein. + +11. MISCELLANEOUS. + + This License represents the complete agreement concerning subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the extent + necessary to make it enforceable. This License shall be governed by + California law provisions (except to the extent applicable law, if + any, provides otherwise), excluding its conflict-of-law provisions. + With respect to disputes in which at least one party is a citizen of, + or an entity chartered or registered to do business in the United + States of America, any litigation relating to this License shall be + subject to the jurisdiction of the Federal Courts of the Northern + District of California, with venue lying in Santa Clara County, + California, with the losing party responsible for costs, including + without limitation, court costs and reasonable attorneys' fees and + expenses. The application of the United Nations Convention on + Contracts for the International Sale of Goods is expressly excluded. + Any law or regulation which provides that the language of a contract + shall be construed against the drafter shall not apply to this + License. + +12. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is + responsible for claims and damages arising, directly or indirectly, + out of its utilization of rights under this License and You agree to + work with Initial Developer and Contributors to distribute such + responsibility on an equitable basis. Nothing herein is intended or + shall be deemed to constitute any admission of liability. + +13. MULTIPLE-LICENSED CODE. + + Initial Developer may designate portions of the Covered Code as + "Multiple-Licensed". "Multiple-Licensed" means that the Initial + Developer permits you to utilize portions of the Covered Code under + Your choice of the NPL or the alternative licenses, if any, specified + by the Initial Developer in the file described in Exhibit A. + +EXHIBIT A -Mozilla Public License. + + ``The contents of this file are subject to the Mozilla Public License + Version 1.1 (the "License"); you may not use this file except in + compliance with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + License for the specific language governing rights and limitations + under the License. + + The Original Code is ______________________________________. + + The Initial Developer of the Original Code is ________________________. + Portions created by ______________________ are Copyright (C) ______ + _______________________. All Rights Reserved. + + Contributor(s): ______________________________________. + + Alternatively, the contents of this file may be used under the terms + of the _____ license (the "[___] License"), in which case the + provisions of [______] License are applicable instead of those + above. If you wish to allow use of your version of this file only + under the terms of the [____] License and not to allow others to use + your version of this file under the MPL, indicate your decision by + deleting the provisions above and replace them with the notice and + other provisions required by the [___] License. If you do not delete + the provisions above, a recipient may use your version of this file + under either the MPL or the [___] License." + + [NOTE: The text of this Exhibit A may differ slightly from the text of + the notices in the Source Code files of the Original Code. You should + use the text of this Exhibit A rather than the text found in the + Original Code Source Code for Your Modifications.] + +--------------------------------------------------------------------------------- +JSON License +* JSON in Java +---------------------------------------------- +Copyright (c) 2002 JSON.org + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +The Software shall be used for Good, not Evil. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +--------------------------------------------------------------------------------- +MIT License +* jsTree +* Prototype JavaScript Framework +* jsx-requirejs-plu gin +* jQuery +* jQuery UI +---------------------------------------------- +* Prototype JavaScript Framework +Prototype is Copyright © 2005-2007 Sam Stephenson. It is freely distributable under the terms of an MIT-style license. + +Copyright (c) 2005-2010 Sam Stephenson + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +The Prototype documentation is Copyright © 2007 The Prototype Core Team. It is released under the Creative Commons Attribution-ShareAlike 3.0 license. +---------------------------------------------- +* jsTree +Copyright (c) 2014 Ivan Bozhanov + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +---------------------------------------------- +* jQuery +Copyright JS Foundation and other contributors, https://js.foundation/ + +This software consists of voluntary contributions made by many +individuals. For exact contribution history, see the revision history +available at https://github.com/jquery/jquery + +The following license applies to all parts of this software except as +documented below: + +==== + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +==== + +All files located in the node_modules and external directories are +externally maintained libraries used by this software which have their +own licenses; we recommend you read them, as their terms may differ from +the terms above. + +--------------------------------------------------------------------------------- +htmlArea License +* htmlArea +* HTMLarea Editor For XOOPS +---------------------------------------------- +htmlArea License (based on BSD license) +Copyright (c) 2002-2004, interactivetools.com, inc. +Copyright (c) 2003-2005 dynarch.com +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1) Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + +2) Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3) Neither the name of interactivetools.com, inc. nor the names of its + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. +--------------------------------------------------------------------------------- \ No newline at end of file diff --git a/main_vm/src/main/webapp/META-INF/readme b/main_vm/src/main/webapp/META-INF/readme new file mode 100644 index 0000000..c6126ec --- /dev/null +++ b/main_vm/src/main/webapp/META-INF/readme @@ -0,0 +1,10 @@ +Copyright Since 2009 전자정부 표준프레임워크 + +전자정부 표준프레임워크는 공통컴포넌트는 + +Apache License 2.0, BSD 3, GNU 2.1, JSON License, MIT License, htmlArea License 의 적용을 받는 오픈소스소프트웨어를 기반으로 만들어졌습니다. + +전자정부 표준프레임워크를 수정 혹은 확장한 2차적 저작물을 사용하거나 배포하여 발생하는 모든 손해나 법적 문제에 대해 +전자정부 표준프레임워크의 저작권자는 일체의 책임을 지지 않습니다. + +전자정부 표준프레임워크에 사용된 오픈 소스소프트웨어의 라이선스는 osslicenses 파일을 참조하십시오 diff --git a/main_vm/src/main/webapp/WEB-INF/jsp/adm/common/dashboard.jsp b/main_vm/src/main/webapp/WEB-INF/jsp/adm/common/dashboard.jsp new file mode 100644 index 0000000..355d57b --- /dev/null +++ b/main_vm/src/main/webapp/WEB-INF/jsp/adm/common/dashboard.jsp @@ -0,0 +1,146 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> + + + + +대시보드 +<%@ include file="/WEB-INF/jsp/adm/include/topLinkTag.jsp"%> + + + +

ICOMSYS ADMIN

+

대시보드

+ + + + + + + +<%-- --%> + +

DASH BOARD

+ +
+
+ +
+ + +
+
+
+
+

대시보드

+
+
+
+ 조회 +
+
+
+
+ + + + + + + + + + + + +
+
+ +
+
+
+
+
전체 콜 그래프 (단위 : 건)
+
+
+
+
+
+
+
+
+
+ +
+
+
인텐트 그래프 (단위 : 건)
+
+
+
+
+
+
+
+
+
+ +
+
+
시나리오 그래프 (단위 : 건)
+
+
+
+
+
+
+
+
+
+ +
+
+
오늘 시간대별 통화량 (단위 : 건)
+
현재 통화량 : 0건
+
+
+
+
+
+
+
+
+
+ + +
+
+
+ +
+ + + diff --git a/main_vm/src/main/webapp/WEB-INF/jsp/adm/common/error.jsp b/main_vm/src/main/webapp/WEB-INF/jsp/adm/common/error.jsp new file mode 100644 index 0000000..ecabc78 --- /dev/null +++ b/main_vm/src/main/webapp/WEB-INF/jsp/adm/common/error.jsp @@ -0,0 +1,22 @@ +<%@ page contentType="text/html; charset=utf-8" pageEncoding="utf-8"%> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%> + + + + + +ERROR + + + + + + +
+ + + +
오류발생 알림화면(허용되지 않는 요청을 하셨습니다)2
+ + \ No newline at end of file diff --git a/main_vm/src/main/webapp/WEB-INF/jsp/adm/common/system/A030301.html b/main_vm/src/main/webapp/WEB-INF/jsp/adm/common/system/A030301.html new file mode 100644 index 0000000..df67fb6 --- /dev/null +++ b/main_vm/src/main/webapp/WEB-INF/jsp/adm/common/system/A030301.html @@ -0,0 +1,446 @@ + + + + {{title}} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

ICOMSYS ADMIN

+ + + + + + + +
+
+ +
+ + +
+
+
+
+

권한그룹편집

+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
그룹명 +
+ +
+
그룹설명 +
+ +
+
소속사용자 * +
+
+ +
+ 사용자 추가 + + +
+
+
+
소속타이틀(필요시 사용)
+
    +
  • +
    + + +
    +
  • + +
  • +
    + + +
    +
  • + +
  • +
    + + +
    +
  • + +
  • +
    + + +
    +
  • + +
  • +
    + + +
    +
  • + +
  • +
    + + +
    +
  • + +
  • +
    + + +
    +
  • + +
  • +
    + + +
    +
  • + +
  • +
    + + +
    +
  • + +
  • +
    + + +
    +
  • + +
  • +
    + + +
    +
  • + +
  • +
    + + +
    +
  • +
+
+ + +
+
권한 + +
+
+
    +
  • root +
      +
    • 주소BOT +
        +
      • 지명 유사어 관리
      • +
      • 빌딩 유사어 관리
      • +
      • 유의어 전처리 관리
      • +
      • 주소봇 멘트 관리
      • +
      • 발화 건물유형 관리
      • +
      • 주소 월별 업데이트
      • +
      • 주소처리내역(녹취)
      • +
      +
    • +
    • BOT 공통 관리 +
        +
      • 서비스별관리 +
          +
        • 요일/시간대별 멘트 관리
        • +
        • 휴무일 관리
        • +
        • 자연어 전처리 관리
        • +
        +
      • +
      • 공통 코드 관리
      • +
      +
    • +
    • 무인접수BOT +
        +
      • 무인 접수 리스트
      • +
      • 제품군 유의어 관리
      • +
      +
    • +
    • 영상상담 +
        +
      • 컨텐츠등록 관리
      • +
      • 영상상담
      • +
      • 상담이력 조회
      • +
      +
    • +
    +
  • +
+
+
+
+
+
+ +
+
+ 취소 + 저장 +
+
+
+ +
+ + + \ No newline at end of file diff --git a/main_vm/src/main/webapp/WEB-INF/jsp/adm/common/system/commoncode.jsp b/main_vm/src/main/webapp/WEB-INF/jsp/adm/common/system/commoncode.jsp new file mode 100644 index 0000000..02c4e5c --- /dev/null +++ b/main_vm/src/main/webapp/WEB-INF/jsp/adm/common/system/commoncode.jsp @@ -0,0 +1,734 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + + + + + 시나리오코드 + <%@ include file="/WEB-INF/jsp/adm/include/topLinkTag.jsp" %> + + + + + + +

ICOMSYS ADMIN

+ + + + + +
+ + + +
+ + + + +<%--