first commit
@456bf8a7685d81d387e22f2a95c33412a16333cc
+++ .gitignore
... | ... | @@ -0,0 +1,37 @@ |
| 1 | +HELP.md | |
| 2 | +.gradle | |
| 3 | +build/ | |
| 4 | +!gradle/wrapper/gradle-wrapper.jar | |
| 5 | +!**/src/main/**/build/ | |
| 6 | +!**/src/test/**/build/ | |
| 7 | + | |
| 8 | +### STS ### | |
| 9 | +.apt_generated | |
| 10 | +.classpath | |
| 11 | +.factorypath | |
| 12 | +.project | |
| 13 | +.settings | |
| 14 | +.springBeans | |
| 15 | +.sts4-cache | |
| 16 | +bin/ | |
| 17 | +!**/src/main/**/bin/ | |
| 18 | +!**/src/test/**/bin/ | |
| 19 | + | |
| 20 | +### IntelliJ IDEA ### | |
| 21 | +.idea | |
| 22 | +*.iws | |
| 23 | +*.iml | |
| 24 | +*.ipr | |
| 25 | +out/ | |
| 26 | +!**/src/main/**/out/ | |
| 27 | +!**/src/test/**/out/ | |
| 28 | + | |
| 29 | +### NetBeans ### | |
| 30 | +/nbproject/private/ | |
| 31 | +/nbbuild/ | |
| 32 | +/dist/ | |
| 33 | +/nbdist/ | |
| 34 | +/.nb-gradle/ | |
| 35 | + | |
| 36 | +### VS Code ### | |
| 37 | +.vscode/ |
+++ build.gradle
... | ... | @@ -0,0 +1,69 @@ |
| 1 | +plugins { | |
| 2 | + id 'java' | |
| 3 | + id 'war' | |
| 4 | + id 'org.springframework.boot' version '3.2.5' | |
| 5 | + id 'io.spring.dependency-management' version '1.1.4' | |
| 6 | +} | |
| 7 | + | |
| 8 | +group = 'com.munjaon' | |
| 9 | +version = '0.0.1-SNAPSHOT' | |
| 10 | + | |
| 11 | +java { | |
| 12 | + sourceCompatibility = '17' | |
| 13 | +} | |
| 14 | + | |
| 15 | +configurations { | |
| 16 | + compileOnly { | |
| 17 | + extendsFrom annotationProcessor | |
| 18 | + } | |
| 19 | +} | |
| 20 | + | |
| 21 | +repositories { | |
| 22 | + mavenCentral() | |
| 23 | +} | |
| 24 | + | |
| 25 | +dependencies { | |
| 26 | + implementation 'org.springframework.boot:spring-boot-starter-batch' | |
| 27 | + implementation 'org.springframework.boot:spring-boot-starter-web' | |
| 28 | + implementation 'org.mybatis.spring.boot:mybatis-spring-boot-starter:3.0.3' | |
| 29 | + compileOnly 'org.projectlombok:lombok' | |
| 30 | + developmentOnly 'org.springframework.boot:spring-boot-devtools' | |
| 31 | + runtimeOnly 'org.mariadb.jdbc:mariadb-java-client' | |
| 32 | + annotationProcessor 'org.projectlombok:lombok' | |
| 33 | + testImplementation 'org.springframework.boot:spring-boot-starter-test' | |
| 34 | + testImplementation 'org.mybatis.spring.boot:mybatis-spring-boot-starter-test:3.0.3' | |
| 35 | + testImplementation 'org.springframework.batch:spring-batch-test' | |
| 36 | + | |
| 37 | + // https://mvnrepository.com/artifact/com.zaxxer/HikariCP | |
| 38 | + implementation 'com.zaxxer:HikariCP:4.0.3' | |
| 39 | + // https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-cache | |
| 40 | + implementation 'org.springframework.boot:spring-boot-starter-cache:3.2.5' | |
| 41 | + providedRuntime 'org.springframework.boot:spring-boot-starter-tomcat' | |
| 42 | + // https://mvnrepository.com/artifact/com.googlecode.json-simple/json-simple | |
| 43 | + implementation 'com.googlecode.json-simple:json-simple:1.1.1' | |
| 44 | + // https://mvnrepository.com/artifact/org.apache.commons/commons-configuration2 | |
| 45 | + implementation 'org.apache.commons:commons-configuration2:2.10.1' | |
| 46 | + // https://mvnrepository.com/artifact/commons-beanutils/commons-beanutils | |
| 47 | + implementation 'commons-beanutils:commons-beanutils:1.9.4' | |
| 48 | + // https://mvnrepository.com/artifact/io.netty/netty-all | |
| 49 | + implementation 'io.netty:netty-all:4.1.42.Final' | |
| 50 | + | |
| 51 | + testCompileOnly 'org.projectlombok:lombok' | |
| 52 | + testAnnotationProcessor 'org.projectlombok:lombok' | |
| 53 | +} | |
| 54 | + | |
| 55 | +tasks.named('test') { | |
| 56 | + useJUnitPlatform() | |
| 57 | +} | |
| 58 | + | |
| 59 | +// profile의 기본값 local로 설정 | |
| 60 | +ext.profile = (!project.hasProperty('profile') || !profile) ? 'local' : profile | |
| 61 | + | |
| 62 | +// 리소스 디렉토리 추가 | |
| 63 | +sourceSets { | |
| 64 | + main { | |
| 65 | + resources { | |
| 66 | + srcDirs "src/main/resources/${profile}" | |
| 67 | + } | |
| 68 | + } | |
| 69 | +} |
+++ gradle/wrapper/gradle-wrapper.jar
| Binary file is not shown |
+++ gradle/wrapper/gradle-wrapper.properties
... | ... | @@ -0,0 +1,7 @@ |
| 1 | +distributionBase=GRADLE_USER_HOME | |
| 2 | +distributionPath=wrapper/dists | |
| 3 | +distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip | |
| 4 | +networkTimeout=10000 | |
| 5 | +validateDistributionUrl=true | |
| 6 | +zipStoreBase=GRADLE_USER_HOME | |
| 7 | +zipStorePath=wrapper/dists |
+++ gradlew
... | ... | @@ -0,0 +1,249 @@ |
| 1 | +#!/bin/sh | |
| 2 | + | |
| 3 | +# | |
| 4 | +# Copyright © 2015-2021 the original authors. | |
| 5 | +# | |
| 6 | +# Licensed under the Apache License, Version 2.0 (the "License"); | |
| 7 | +# you may not use this file except in compliance with the License. | |
| 8 | +# You may obtain a copy of the License at | |
| 9 | +# | |
| 10 | +# https://www.apache.org/licenses/LICENSE-2.0 | |
| 11 | +# | |
| 12 | +# Unless required by applicable law or agreed to in writing, software | |
| 13 | +# distributed under the License is distributed on an "AS IS" BASIS, | |
| 14 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 15 | +# See the License for the specific language governing permissions and | |
| 16 | +# limitations under the License. | |
| 17 | +# | |
| 18 | + | |
| 19 | +############################################################################## | |
| 20 | +# | |
| 21 | +# Gradle start up script for POSIX generated by Gradle. | |
| 22 | +# | |
| 23 | +# Important for running: | |
| 24 | +# | |
| 25 | +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is | |
| 26 | +# noncompliant, but you have some other compliant shell such as ksh or | |
| 27 | +# bash, then to run this script, type that shell name before the whole | |
| 28 | +# command line, like: | |
| 29 | +# | |
| 30 | +# ksh Gradle | |
| 31 | +# | |
| 32 | +# Busybox and similar reduced shells will NOT work, because this script | |
| 33 | +# requires all of these POSIX shell features: | |
| 34 | +# * functions; | |
| 35 | +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», | |
| 36 | +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; | |
| 37 | +# * compound commands having a testable exit status, especially «case»; | |
| 38 | +# * various built-in commands including «command», «set», and «ulimit». | |
| 39 | +# | |
| 40 | +# Important for patching: | |
| 41 | +# | |
| 42 | +# (2) This script targets any POSIX shell, so it avoids extensions provided | |
| 43 | +# by Bash, Ksh, etc; in particular arrays are avoided. | |
| 44 | +# | |
| 45 | +# The "traditional" practice of packing multiple parameters into a | |
| 46 | +# space-separated string is a well documented source of bugs and security | |
| 47 | +# problems, so this is (mostly) avoided, by progressively accumulating | |
| 48 | +# options in "$@", and eventually passing that to Java. | |
| 49 | +# | |
| 50 | +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, | |
| 51 | +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; | |
| 52 | +# see the in-line comments for details. | |
| 53 | +# | |
| 54 | +# There are tweaks for specific operating systems such as AIX, CygWin, | |
| 55 | +# Darwin, MinGW, and NonStop. | |
| 56 | +# | |
| 57 | +# (3) This script is generated from the Groovy template | |
| 58 | +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt | |
| 59 | +# within the Gradle project. | |
| 60 | +# | |
| 61 | +# You can find Gradle at https://github.com/gradle/gradle/. | |
| 62 | +# | |
| 63 | +############################################################################## | |
| 64 | + | |
| 65 | +# Attempt to set APP_HOME | |
| 66 | + | |
| 67 | +# Resolve links: $0 may be a link | |
| 68 | +app_path=$0 | |
| 69 | + | |
| 70 | +# Need this for daisy-chained symlinks. | |
| 71 | +while | |
| 72 | + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path | |
| 73 | + [ -h "$app_path" ] | |
| 74 | +do | |
| 75 | + ls=$( ls -ld "$app_path" ) | |
| 76 | + link=${ls#*' -> '} | |
| 77 | + case $link in #( | |
| 78 | + /*) app_path=$link ;; #( | |
| 79 | + *) app_path=$APP_HOME$link ;; | |
| 80 | + esac | |
| 81 | +done | |
| 82 | + | |
| 83 | +# This is normally unused | |
| 84 | +# shellcheck disable=SC2034 | |
| 85 | +APP_BASE_NAME=${0##*/} | |
| 86 | +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) | |
| 87 | +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit | |
| 88 | + | |
| 89 | +# Use the maximum available, or set MAX_FD != -1 to use that value. | |
| 90 | +MAX_FD=maximum | |
| 91 | + | |
| 92 | +warn () { | |
| 93 | + echo "$*" | |
| 94 | +} >&2 | |
| 95 | + | |
| 96 | +die () { | |
| 97 | + echo | |
| 98 | + echo "$*" | |
| 99 | + echo | |
| 100 | + exit 1 | |
| 101 | +} >&2 | |
| 102 | + | |
| 103 | +# OS specific support (must be 'true' or 'false'). | |
| 104 | +cygwin=false | |
| 105 | +msys=false | |
| 106 | +darwin=false | |
| 107 | +nonstop=false | |
| 108 | +case "$( uname )" in #( | |
| 109 | + CYGWIN* ) cygwin=true ;; #( | |
| 110 | + Darwin* ) darwin=true ;; #( | |
| 111 | + MSYS* | MINGW* ) msys=true ;; #( | |
| 112 | + NONSTOP* ) nonstop=true ;; | |
| 113 | +esac | |
| 114 | + | |
| 115 | +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar | |
| 116 | + | |
| 117 | + | |
| 118 | +# Determine the Java command to use to start the JVM. | |
| 119 | +if [ -n "$JAVA_HOME" ] ; then | |
| 120 | + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then | |
| 121 | + # IBM's JDK on AIX uses strange locations for the executables | |
| 122 | + JAVACMD=$JAVA_HOME/jre/sh/java | |
| 123 | + else | |
| 124 | + JAVACMD=$JAVA_HOME/bin/java | |
| 125 | + fi | |
| 126 | + if [ ! -x "$JAVACMD" ] ; then | |
| 127 | + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME | |
| 128 | + | |
| 129 | +Please set the JAVA_HOME variable in your environment to match the | |
| 130 | +location of your Java installation." | |
| 131 | + fi | |
| 132 | +else | |
| 133 | + JAVACMD=java | |
| 134 | + if ! command -v java >/dev/null 2>&1 | |
| 135 | + then | |
| 136 | + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. | |
| 137 | + | |
| 138 | +Please set the JAVA_HOME variable in your environment to match the | |
| 139 | +location of your Java installation." | |
| 140 | + fi | |
| 141 | +fi | |
| 142 | + | |
| 143 | +# Increase the maximum file descriptors if we can. | |
| 144 | +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then | |
| 145 | + case $MAX_FD in #( | |
| 146 | + max*) | |
| 147 | + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. | |
| 148 | + # shellcheck disable=SC2039,SC3045 | |
| 149 | + MAX_FD=$( ulimit -H -n ) || | |
| 150 | + warn "Could not query maximum file descriptor limit" | |
| 151 | + esac | |
| 152 | + case $MAX_FD in #( | |
| 153 | + '' | soft) :;; #( | |
| 154 | + *) | |
| 155 | + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. | |
| 156 | + # shellcheck disable=SC2039,SC3045 | |
| 157 | + ulimit -n "$MAX_FD" || | |
| 158 | + warn "Could not set maximum file descriptor limit to $MAX_FD" | |
| 159 | + esac | |
| 160 | +fi | |
| 161 | + | |
| 162 | +# Collect all arguments for the java command, stacking in reverse order: | |
| 163 | +# * args from the command line | |
| 164 | +# * the main class name | |
| 165 | +# * -classpath | |
| 166 | +# * -D...appname settings | |
| 167 | +# * --module-path (only if needed) | |
| 168 | +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. | |
| 169 | + | |
| 170 | +# For Cygwin or MSYS, switch paths to Windows format before running java | |
| 171 | +if "$cygwin" || "$msys" ; then | |
| 172 | + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) | |
| 173 | + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) | |
| 174 | + | |
| 175 | + JAVACMD=$( cygpath --unix "$JAVACMD" ) | |
| 176 | + | |
| 177 | + # Now convert the arguments - kludge to limit ourselves to /bin/sh | |
| 178 | + for arg do | |
| 179 | + if | |
| 180 | + case $arg in #( | |
| 181 | + -*) false ;; # don't mess with options #( | |
| 182 | + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath | |
| 183 | + [ -e "$t" ] ;; #( | |
| 184 | + *) false ;; | |
| 185 | + esac | |
| 186 | + then | |
| 187 | + arg=$( cygpath --path --ignore --mixed "$arg" ) | |
| 188 | + fi | |
| 189 | + # Roll the args list around exactly as many times as the number of | |
| 190 | + # args, so each arg winds up back in the position where it started, but | |
| 191 | + # possibly modified. | |
| 192 | + # | |
| 193 | + # NB: a `for` loop captures its iteration list before it begins, so | |
| 194 | + # changing the positional parameters here affects neither the number of | |
| 195 | + # iterations, nor the values presented in `arg`. | |
| 196 | + shift # remove old arg | |
| 197 | + set -- "$@" "$arg" # push replacement arg | |
| 198 | + done | |
| 199 | +fi | |
| 200 | + | |
| 201 | + | |
| 202 | +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. | |
| 203 | +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' | |
| 204 | + | |
| 205 | +# Collect all arguments for the java command: | |
| 206 | +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, | |
| 207 | +# and any embedded shellness will be escaped. | |
| 208 | +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be | |
| 209 | +# treated as '${Hostname}' itself on the command line. | |
| 210 | + | |
| 211 | +set -- \ | |
| 212 | + "-Dorg.gradle.appname=$APP_BASE_NAME" \ | |
| 213 | + -classpath "$CLASSPATH" \ | |
| 214 | + org.gradle.wrapper.GradleWrapperMain \ | |
| 215 | + "$@" | |
| 216 | + | |
| 217 | +# Stop when "xargs" is not available. | |
| 218 | +if ! command -v xargs >/dev/null 2>&1 | |
| 219 | +then | |
| 220 | + die "xargs is not available" | |
| 221 | +fi | |
| 222 | + | |
| 223 | +# Use "xargs" to parse quoted args. | |
| 224 | +# | |
| 225 | +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. | |
| 226 | +# | |
| 227 | +# In Bash we could simply go: | |
| 228 | +# | |
| 229 | +# readarray ARGS < <( xargs -n1 <<<"$var" ) && | |
| 230 | +# set -- "${ARGS[@]}" "$@" | |
| 231 | +# | |
| 232 | +# but POSIX shell has neither arrays nor command substitution, so instead we | |
| 233 | +# post-process each arg (as a line of input to sed) to backslash-escape any | |
| 234 | +# character that might be a shell metacharacter, then use eval to reverse | |
| 235 | +# that process (while maintaining the separation between arguments), and wrap | |
| 236 | +# the whole thing up as a single "set" statement. | |
| 237 | +# | |
| 238 | +# This will of course break if any of these variables contains a newline or | |
| 239 | +# an unmatched quote. | |
| 240 | +# | |
| 241 | + | |
| 242 | +eval "set -- $( | |
| 243 | + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | | |
| 244 | + xargs -n1 | | |
| 245 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | | |
| 246 | + tr '\n' ' ' | |
| 247 | + )" '"$@"' | |
| 248 | + | |
| 249 | +exec "$JAVACMD" "$@" |
+++ gradlew.bat
... | ... | @@ -0,0 +1,92 @@ |
| 1 | +@rem | |
| 2 | +@rem Copyright 2015 the original author or authors. | |
| 3 | +@rem | |
| 4 | +@rem Licensed under the Apache License, Version 2.0 (the "License"); | |
| 5 | +@rem you may not use this file except in compliance with the License. | |
| 6 | +@rem You may obtain a copy of the License at | |
| 7 | +@rem | |
| 8 | +@rem https://www.apache.org/licenses/LICENSE-2.0 | |
| 9 | +@rem | |
| 10 | +@rem Unless required by applicable law or agreed to in writing, software | |
| 11 | +@rem distributed under the License is distributed on an "AS IS" BASIS, | |
| 12 | +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 13 | +@rem See the License for the specific language governing permissions and | |
| 14 | +@rem limitations under the License. | |
| 15 | +@rem | |
| 16 | + | |
| 17 | +@if "%DEBUG%"=="" @echo off | |
| 18 | +@rem ########################################################################## | |
| 19 | +@rem | |
| 20 | +@rem Gradle startup script for Windows | |
| 21 | +@rem | |
| 22 | +@rem ########################################################################## | |
| 23 | + | |
| 24 | +@rem Set local scope for the variables with windows NT shell | |
| 25 | +if "%OS%"=="Windows_NT" setlocal | |
| 26 | + | |
| 27 | +set DIRNAME=%~dp0 | |
| 28 | +if "%DIRNAME%"=="" set DIRNAME=. | |
| 29 | +@rem This is normally unused | |
| 30 | +set APP_BASE_NAME=%~n0 | |
| 31 | +set APP_HOME=%DIRNAME% | |
| 32 | + | |
| 33 | +@rem Resolve any "." and ".." in APP_HOME to make it shorter. | |
| 34 | +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi | |
| 35 | + | |
| 36 | +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. | |
| 37 | +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" | |
| 38 | + | |
| 39 | +@rem Find java.exe | |
| 40 | +if defined JAVA_HOME goto findJavaFromJavaHome | |
| 41 | + | |
| 42 | +set JAVA_EXE=java.exe | |
| 43 | +%JAVA_EXE% -version >NUL 2>&1 | |
| 44 | +if %ERRORLEVEL% equ 0 goto execute | |
| 45 | + | |
| 46 | +echo. 1>&2 | |
| 47 | +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 | |
| 48 | +echo. 1>&2 | |
| 49 | +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 | |
| 50 | +echo location of your Java installation. 1>&2 | |
| 51 | + | |
| 52 | +goto fail | |
| 53 | + | |
| 54 | +:findJavaFromJavaHome | |
| 55 | +set JAVA_HOME=%JAVA_HOME:"=% | |
| 56 | +set JAVA_EXE=%JAVA_HOME%/bin/java.exe | |
| 57 | + | |
| 58 | +if exist "%JAVA_EXE%" goto execute | |
| 59 | + | |
| 60 | +echo. 1>&2 | |
| 61 | +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 | |
| 62 | +echo. 1>&2 | |
| 63 | +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 | |
| 64 | +echo location of your Java installation. 1>&2 | |
| 65 | + | |
| 66 | +goto fail | |
| 67 | + | |
| 68 | +:execute | |
| 69 | +@rem Setup the command line | |
| 70 | + | |
| 71 | +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar | |
| 72 | + | |
| 73 | + | |
| 74 | +@rem Execute Gradle | |
| 75 | +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* | |
| 76 | + | |
| 77 | +:end | |
| 78 | +@rem End local scope for the variables with windows NT shell | |
| 79 | +if %ERRORLEVEL% equ 0 goto mainEnd | |
| 80 | + | |
| 81 | +:fail | |
| 82 | +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of | |
| 83 | +rem the _cmd.exe /c_ return code! | |
| 84 | +set EXIT_CODE=%ERRORLEVEL% | |
| 85 | +if %EXIT_CODE% equ 0 set EXIT_CODE=1 | |
| 86 | +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% | |
| 87 | +exit /b %EXIT_CODE% | |
| 88 | + | |
| 89 | +:mainEnd | |
| 90 | +if "%OS%"=="Windows_NT" endlocal | |
| 91 | + | |
| 92 | +:omega |
+++ settings.gradle
... | ... | @@ -0,0 +1,1 @@ |
| 1 | +rootProject.name = 'munjaon_server' |
+++ src/main/java/com/munjaon/server/MunjaonServerApplication.java
... | ... | @@ -0,0 +1,23 @@ |
| 1 | +package com.munjaon.server; | |
| 2 | + | |
| 3 | +import org.springframework.boot.SpringApplication; | |
| 4 | +import org.springframework.boot.autoconfigure.SpringBootApplication; | |
| 5 | +import org.springframework.boot.builder.SpringApplicationBuilder; | |
| 6 | +import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; | |
| 7 | +import org.springframework.cache.annotation.EnableCaching; | |
| 8 | +import org.springframework.scheduling.annotation.EnableScheduling; | |
| 9 | + | |
| 10 | +@EnableCaching | |
| 11 | +@EnableScheduling | |
| 12 | +@SpringBootApplication | |
| 13 | +public class MunjaonServerApplication extends SpringBootServletInitializer { | |
| 14 | + | |
| 15 | + public static void main(String[] args) { | |
| 16 | + SpringApplication.run(MunjaonServerApplication.class, args); | |
| 17 | + } | |
| 18 | + | |
| 19 | + @Override | |
| 20 | + protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) { | |
| 21 | + return super.configure(builder); | |
| 22 | + } | |
| 23 | +} |
+++ src/main/java/com/munjaon/server/api/controller/SampleController.java
... | ... | @@ -0,0 +1,33 @@ |
| 1 | +package com.munjaon.server.api.controller; | |
| 2 | + | |
| 3 | +import com.munjaon.server.api.dto.SampleDto; | |
| 4 | +import com.munjaon.server.api.dto.base.ApiResponse; | |
| 5 | +import com.munjaon.server.api.service.SampleService; | |
| 6 | +import lombok.RequiredArgsConstructor; | |
| 7 | +import lombok.extern.slf4j.Slf4j; | |
| 8 | +import org.apache.commons.configuration2.ex.ConfigurationException; | |
| 9 | +import org.springframework.http.HttpStatus; | |
| 10 | +import org.springframework.http.ResponseEntity; | |
| 11 | +import org.springframework.web.bind.annotation.PostMapping; | |
| 12 | +import org.springframework.web.bind.annotation.RequestBody; | |
| 13 | +import org.springframework.web.bind.annotation.RequestMapping; | |
| 14 | +import org.springframework.web.bind.annotation.RestController; | |
| 15 | + | |
| 16 | +@Slf4j | |
| 17 | +@RequestMapping("/api") | |
| 18 | +@RestController | |
| 19 | +@RequiredArgsConstructor | |
| 20 | +public class SampleController { | |
| 21 | + private final SampleService sampleService; | |
| 22 | + | |
| 23 | + @PostMapping("/sample") | |
| 24 | + public ResponseEntity postSample(@RequestBody SampleDto sample) throws ConfigurationException { | |
| 25 | + log.debug("sample : {}", sampleService.get()); | |
| 26 | + System.out.println("command : " + sample.getCommand()); | |
| 27 | + | |
| 28 | + /* 설정 Load */ | |
| 29 | + sampleService.printConfig(); | |
| 30 | + | |
| 31 | + return new ResponseEntity(ApiResponse.toResponse(200, "OK", sample), HttpStatus.OK); | |
| 32 | + } | |
| 33 | +} |
+++ src/main/java/com/munjaon/server/api/dto/SampleDto.java
... | ... | @@ -0,0 +1,12 @@ |
| 1 | +package com.munjaon.server.api.dto; | |
| 2 | + | |
| 3 | +import com.munjaon.server.api.dto.base.BaseDto; | |
| 4 | +import lombok.Getter; | |
| 5 | +import lombok.Setter; | |
| 6 | +import lombok.ToString; | |
| 7 | + | |
| 8 | +@Getter | |
| 9 | +@Setter | |
| 10 | +@ToString | |
| 11 | +public class SampleDto extends BaseDto { | |
| 12 | +} |
+++ src/main/java/com/munjaon/server/api/dto/base/ApiResponse.java
... | ... | @@ -0,0 +1,31 @@ |
| 1 | +package com.munjaon.server.api.dto.base; | |
| 2 | + | |
| 3 | +import lombok.AllArgsConstructor; | |
| 4 | +import lombok.Builder; | |
| 5 | +import lombok.Data; | |
| 6 | +import lombok.NoArgsConstructor; | |
| 7 | + | |
| 8 | +@Data | |
| 9 | +@AllArgsConstructor | |
| 10 | +@NoArgsConstructor | |
| 11 | +@Builder | |
| 12 | +public class ApiResponse<T> { | |
| 13 | + /* 응답코드 */ | |
| 14 | + private Integer code; | |
| 15 | + /* 응답 메시지 */ | |
| 16 | + private String message; | |
| 17 | + /* Response 객체 */ | |
| 18 | + private T data; | |
| 19 | + | |
| 20 | + public ApiResponse(final Integer code, final String message) { | |
| 21 | + this.code = code; | |
| 22 | + this.message = message; | |
| 23 | + } | |
| 24 | + | |
| 25 | + public static <T> ApiResponse<T> toResponse(final Integer code, final String message, final T t) { | |
| 26 | + return ApiResponse.<T>builder().code(code) | |
| 27 | + .message(message) | |
| 28 | + .data(t) | |
| 29 | + .build(); | |
| 30 | + } | |
| 31 | +} |
+++ src/main/java/com/munjaon/server/api/dto/base/BaseDto.java
... | ... | @@ -0,0 +1,13 @@ |
| 1 | +package com.munjaon.server.api.dto.base; | |
| 2 | + | |
| 3 | +import lombok.Getter; | |
| 4 | +import lombok.Setter; | |
| 5 | +import lombok.ToString; | |
| 6 | + | |
| 7 | +@Getter | |
| 8 | +@Setter | |
| 9 | +@ToString | |
| 10 | +public class BaseDto { | |
| 11 | + protected String command; | |
| 12 | + protected String authKey; | |
| 13 | +} |
+++ src/main/java/com/munjaon/server/api/mapper/SampleMapper.java
... | ... | @@ -0,0 +1,8 @@ |
| 1 | +package com.munjaon.server.api.mapper; | |
| 2 | + | |
| 3 | +import org.apache.ibatis.annotations.Mapper; | |
| 4 | + | |
| 5 | +@Mapper | |
| 6 | +public interface SampleMapper { | |
| 7 | + int get(); | |
| 8 | +} |
+++ src/main/java/com/munjaon/server/api/service/SampleService.java
... | ... | @@ -0,0 +1,31 @@ |
| 1 | +package com.munjaon.server.api.service; | |
| 2 | + | |
| 3 | +import com.munjaon.server.api.mapper.SampleMapper; | |
| 4 | +import com.munjaon.server.cache.service.MemberService; | |
| 5 | +import com.munjaon.server.config.ServerConfig; | |
| 6 | +import lombok.RequiredArgsConstructor; | |
| 7 | +import lombok.extern.slf4j.Slf4j; | |
| 8 | +import org.apache.commons.configuration2.ex.ConfigurationException; | |
| 9 | +import org.springframework.stereotype.Service; | |
| 10 | + | |
| 11 | +@Slf4j | |
| 12 | +@Service | |
| 13 | +@RequiredArgsConstructor | |
| 14 | +public class SampleService { | |
| 15 | + private final SampleMapper sampleMapper; | |
| 16 | + | |
| 17 | + private final ServerConfig serverConfig; | |
| 18 | + | |
| 19 | + private final MemberService memberService; | |
| 20 | + | |
| 21 | + public int get() { | |
| 22 | + return sampleMapper.get(); | |
| 23 | + } | |
| 24 | + | |
| 25 | + public void printConfig() throws ConfigurationException { | |
| 26 | + log.info("server.run : {}", serverConfig.getString("server.run")); | |
| 27 | + log.info("sms.queue.count : {}", serverConfig.getInt("sms.queue.count")); | |
| 28 | + log.info("member list : {}", memberService.list()); | |
| 29 | + log.info("member get : {}", memberService.get("006star")); | |
| 30 | + } | |
| 31 | +} |
+++ src/main/java/com/munjaon/server/cache/dto/MemberDto.java
... | ... | @@ -0,0 +1,26 @@ |
| 1 | +package com.munjaon.server.cache.dto; | |
| 2 | + | |
| 3 | +import lombok.Getter; | |
| 4 | +import lombok.Setter; | |
| 5 | +import lombok.ToString; | |
| 6 | + | |
| 7 | +@Getter | |
| 8 | +@Setter | |
| 9 | +@ToString | |
| 10 | +public class MemberDto { | |
| 11 | + private String mberId; | |
| 12 | + private String esntlId; | |
| 13 | + private String mberSttus; | |
| 14 | + private String dept; | |
| 15 | + private float shortPrice; | |
| 16 | + private float longPrice; | |
| 17 | + private float picturePrice; | |
| 18 | + private float picture2Price; | |
| 19 | + private float picture3Price; | |
| 20 | + private float kakaoAtPrice; | |
| 21 | + private float kakaoFtPrice; | |
| 22 | + private float kakaoFtImgPrice; | |
| 23 | + private float kakaoFtWideImgPrice; | |
| 24 | + private float faxPrice; | |
| 25 | + private float userMoney; | |
| 26 | +} |
+++ src/main/java/com/munjaon/server/cache/mapper/MemberMapper.java
... | ... | @@ -0,0 +1,35 @@ |
| 1 | +package com.munjaon.server.cache.mapper; | |
| 2 | + | |
| 3 | +import com.munjaon.server.cache.dto.MemberDto; | |
| 4 | +import org.apache.ibatis.annotations.Mapper; | |
| 5 | + | |
| 6 | +import java.util.List; | |
| 7 | + | |
| 8 | +@Mapper | |
| 9 | +public interface MemberMapper { | |
| 10 | + /** | |
| 11 | + * 회원테이블 마지막으로 변경된 시간 조회 | |
| 12 | + * @return | |
| 13 | + */ | |
| 14 | + String getLastModifiedTime(String tableSchema); | |
| 15 | + | |
| 16 | + /** | |
| 17 | + * 회원 전체 목록 | |
| 18 | + * @return | |
| 19 | + */ | |
| 20 | + List<MemberDto> list(); | |
| 21 | + | |
| 22 | + /** | |
| 23 | + * 회원조회 | |
| 24 | + * @param mberId | |
| 25 | + * @return | |
| 26 | + */ | |
| 27 | + MemberDto get(String mberId); | |
| 28 | + | |
| 29 | + /** | |
| 30 | + * 회원상태 업데이트 | |
| 31 | + * @param params | |
| 32 | + * @return | |
| 33 | + */ | |
| 34 | + int updateStts(MemberDto params); | |
| 35 | +} |
+++ src/main/java/com/munjaon/server/cache/service/MemberService.java
... | ... | @@ -0,0 +1,89 @@ |
| 1 | +package com.munjaon.server.cache.service; | |
| 2 | + | |
| 3 | +import com.munjaon.server.cache.dto.MemberDto; | |
| 4 | +import com.munjaon.server.cache.mapper.MemberMapper; | |
| 5 | +import lombok.RequiredArgsConstructor; | |
| 6 | +import lombok.extern.slf4j.Slf4j; | |
| 7 | +import org.springframework.cache.annotation.CacheEvict; | |
| 8 | +import org.springframework.cache.annotation.Cacheable; | |
| 9 | +import org.springframework.stereotype.Service; | |
| 10 | +import org.springframework.transaction.annotation.Transactional; | |
| 11 | + | |
| 12 | +import java.util.List; | |
| 13 | + | |
| 14 | +@Slf4j | |
| 15 | +@Service | |
| 16 | +@RequiredArgsConstructor | |
| 17 | +public class MemberService { | |
| 18 | + private final MemberMapper memberMapper; | |
| 19 | + | |
| 20 | + /** | |
| 21 | + * 회원테이블 마지막으로 변경된 시간 조회 | |
| 22 | + * @return | |
| 23 | + */ | |
| 24 | + public String getLastModifiedTime(String tableSchema) { | |
| 25 | + return memberMapper.getLastModifiedTime(tableSchema); | |
| 26 | + } | |
| 27 | + | |
| 28 | + /** | |
| 29 | + * 회원 전체 목록 | |
| 30 | + * @return | |
| 31 | + */ | |
| 32 | + @Transactional(readOnly = true) | |
| 33 | + @Cacheable("cacheMember") | |
| 34 | + public List<MemberDto> list() { | |
| 35 | + return memberMapper.list(); | |
| 36 | + } | |
| 37 | + | |
| 38 | + /** | |
| 39 | + * 회원조회 | |
| 40 | + * @param mberId | |
| 41 | + * @return | |
| 42 | + */ | |
| 43 | + @Transactional(readOnly = true) | |
| 44 | + @Cacheable(value = "cacheMember", key = "#mberId") | |
| 45 | + public MemberDto get(String mberId) { | |
| 46 | + return memberMapper.get(mberId); | |
| 47 | + } | |
| 48 | + | |
| 49 | + /** | |
| 50 | + * 회원 Cache 전체 삭제 | |
| 51 | + */ | |
| 52 | + @CacheEvict(value = "cacheMember", allEntries = true) | |
| 53 | + public void deleteAllMember(){ | |
| 54 | + log.info("Cache All Clear"); | |
| 55 | + } | |
| 56 | + | |
| 57 | + /** | |
| 58 | + * 회원 Cache 아이디 삭제 | |
| 59 | + * @param mberId | |
| 60 | + */ | |
| 61 | + @CacheEvict(value = "cacheMember", key = "#mberId") | |
| 62 | + public void deleteOneMember(final String mberId){ | |
| 63 | + log.info("Cache Clear: {}", mberId); | |
| 64 | + } | |
| 65 | + | |
| 66 | + /** | |
| 67 | + * 회원상태 업데이트 | |
| 68 | + * @param params | |
| 69 | + * @return | |
| 70 | + */ | |
| 71 | + @Transactional | |
| 72 | + public int updateStts(MemberDto params) { | |
| 73 | + return memberMapper.updateStts(params); | |
| 74 | + } | |
| 75 | + | |
| 76 | + /** | |
| 77 | + * 회원상태 업데이트 | |
| 78 | + * @param mberId | |
| 79 | + * @param mberSttus | |
| 80 | + * @return | |
| 81 | + */ | |
| 82 | + public int updateStts(String mberId, String mberSttus) { | |
| 83 | + MemberDto params = new MemberDto(); | |
| 84 | + params.setMberId(mberId); | |
| 85 | + params.setMberSttus(mberSttus); | |
| 86 | + | |
| 87 | + return memberMapper.updateStts(params); | |
| 88 | + } | |
| 89 | +} |
+++ src/main/java/com/munjaon/server/config/DataSourceConfig.java
... | ... | @@ -0,0 +1,51 @@ |
| 1 | +package com.munjaon.server.config; | |
| 2 | + | |
| 3 | +import org.apache.ibatis.session.SqlSessionFactory; | |
| 4 | +import org.mybatis.spring.SqlSessionFactoryBean; | |
| 5 | +import org.mybatis.spring.SqlSessionTemplate; | |
| 6 | +import org.mybatis.spring.annotation.MapperScan; | |
| 7 | +import org.mybatis.spring.boot.autoconfigure.SpringBootVFS; | |
| 8 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 9 | +import org.springframework.boot.context.properties.ConfigurationProperties; | |
| 10 | +import org.springframework.boot.jdbc.DataSourceBuilder; | |
| 11 | +import org.springframework.context.ApplicationContext; | |
| 12 | +import org.springframework.context.annotation.Bean; | |
| 13 | +import org.springframework.context.annotation.Configuration; | |
| 14 | +import org.springframework.context.annotation.Primary; | |
| 15 | +import org.springframework.core.io.support.PathMatchingResourcePatternResolver; | |
| 16 | +import org.springframework.transaction.annotation.EnableTransactionManagement; | |
| 17 | + | |
| 18 | +import javax.sql.DataSource; | |
| 19 | + | |
| 20 | +@Configuration | |
| 21 | +@EnableTransactionManagement | |
| 22 | +@MapperScan(basePackages= "com.munjaon.server.**.mapper") | |
| 23 | +public class DataSourceConfig { | |
| 24 | + @Autowired | |
| 25 | + private ApplicationContext applicationContext; | |
| 26 | + | |
| 27 | + @Primary | |
| 28 | + @Bean(name = "datasource") | |
| 29 | + @ConfigurationProperties(prefix = "spring.datasource.server") | |
| 30 | + public DataSource dataSource() { | |
| 31 | + return DataSourceBuilder.create().build(); | |
| 32 | + } | |
| 33 | + | |
| 34 | + @Primary | |
| 35 | + @Bean(name = "factory") | |
| 36 | + public SqlSessionFactory sqlSessionFactory(DataSource dataSource) throws Exception { | |
| 37 | + SqlSessionFactoryBean sqlSessionFactory = new SqlSessionFactoryBean(); | |
| 38 | + sqlSessionFactory.setVfs(SpringBootVFS.class); | |
| 39 | + sqlSessionFactory.setDataSource(dataSource); | |
| 40 | + sqlSessionFactory.setTypeAliasesPackage("com.munjaon.server.**.dto"); | |
| 41 | + sqlSessionFactory.setConfigLocation(applicationContext.getResource("classpath:mybatis-config.xml")); | |
| 42 | + sqlSessionFactory.setMapperLocations(new PathMatchingResourcePatternResolver().getResources("classpath:/sqlmap/**/*.xml")); | |
| 43 | + return sqlSessionFactory.getObject(); | |
| 44 | + } | |
| 45 | + | |
| 46 | + @Primary | |
| 47 | + @Bean(name = "sqlSession") | |
| 48 | + public SqlSessionTemplate sqlSession(SqlSessionFactory sqlSessionFactory) { | |
| 49 | + return new SqlSessionTemplate(sqlSessionFactory); | |
| 50 | + } | |
| 51 | +} |
+++ src/main/java/com/munjaon/server/config/ServerConfig.java
... | ... | @@ -0,0 +1,50 @@ |
| 1 | +package com.munjaon.server.config; | |
| 2 | + | |
| 3 | +import jakarta.annotation.PostConstruct; | |
| 4 | +import lombok.extern.slf4j.Slf4j; | |
| 5 | +import org.apache.commons.configuration2.PropertiesConfiguration; | |
| 6 | +import org.apache.commons.configuration2.builder.ConfigurationBuilderEvent; | |
| 7 | +import org.apache.commons.configuration2.builder.ReloadingFileBasedConfigurationBuilder; | |
| 8 | +import org.apache.commons.configuration2.builder.fluent.Parameters; | |
| 9 | +import org.apache.commons.configuration2.event.Event; | |
| 10 | +import org.apache.commons.configuration2.event.EventListener; | |
| 11 | +import org.apache.commons.configuration2.ex.ConfigurationException; | |
| 12 | +import org.apache.commons.configuration2.reloading.PeriodicReloadingTrigger; | |
| 13 | +import org.springframework.beans.factory.annotation.Value; | |
| 14 | +import org.springframework.stereotype.Component; | |
| 15 | + | |
| 16 | +import java.io.File; | |
| 17 | +import java.util.concurrent.TimeUnit; | |
| 18 | + | |
| 19 | +@Slf4j | |
| 20 | +@Component | |
| 21 | +public class ServerConfig { | |
| 22 | + @Value("${agent.server-property-file}") | |
| 23 | + private String serverProperyFile; | |
| 24 | + | |
| 25 | + private ReloadingFileBasedConfigurationBuilder<PropertiesConfiguration> builder; | |
| 26 | + | |
| 27 | + @PostConstruct | |
| 28 | + void init() throws ConfigurationException { | |
| 29 | + log.info("serverProperyFile : {}", serverProperyFile); | |
| 30 | + builder = new ReloadingFileBasedConfigurationBuilder<>(PropertiesConfiguration.class).configure(new Parameters().fileBased().setFile(new File(serverProperyFile))); | |
| 31 | + | |
| 32 | + builder.addEventListener(ConfigurationBuilderEvent.CONFIGURATION_REQUEST, new EventListener<Event>() { | |
| 33 | + @Override | |
| 34 | + public void onEvent(Event event) { | |
| 35 | + log.info("builder.getConfiguration() is Called!!"); | |
| 36 | + } | |
| 37 | + }); | |
| 38 | + | |
| 39 | + PeriodicReloadingTrigger configReloadingTrigger = new PeriodicReloadingTrigger(builder.getReloadingController(), null, 1, TimeUnit.SECONDS); | |
| 40 | + configReloadingTrigger.start(); | |
| 41 | + } | |
| 42 | + | |
| 43 | + public String getString(String key) throws ConfigurationException { | |
| 44 | + return builder.getConfiguration().getString(key); | |
| 45 | + } | |
| 46 | + | |
| 47 | + public int getInt(String key) throws ConfigurationException { | |
| 48 | + return builder.getConfiguration().getInt(key, 3); | |
| 49 | + } | |
| 50 | +} |
+++ src/main/java/com/munjaon/server/netty/config/BaseConfig.java
... | ... | @@ -0,0 +1,15 @@ |
| 1 | +package com.munjaon.server.netty.config; | |
| 2 | + | |
| 3 | +import io.netty.bootstrap.ServerBootstrap; | |
| 4 | +import io.netty.channel.ChannelInboundHandlerAdapter; | |
| 5 | +import io.netty.channel.nio.NioEventLoopGroup; | |
| 6 | + | |
| 7 | +import java.net.InetSocketAddress; | |
| 8 | + | |
| 9 | +public interface BaseConfig { | |
| 10 | + NioEventLoopGroup bossGroup(); | |
| 11 | + NioEventLoopGroup workerGroup(); | |
| 12 | + InetSocketAddress port(); | |
| 13 | + ServerBootstrap serverBootstrap(); | |
| 14 | + ChannelInboundHandlerAdapter handler(); | |
| 15 | +} |
+++ src/main/java/com/munjaon/server/netty/handler/SampleHandler.java
... | ... | @@ -0,0 +1,21 @@ |
| 1 | +package com.munjaon.server.netty.handler; | |
| 2 | + | |
| 3 | +import io.netty.channel.ChannelHandlerContext; | |
| 4 | +import io.netty.channel.SimpleChannelInboundHandler; | |
| 5 | + | |
| 6 | +public class SampleHandler extends SimpleChannelInboundHandler<String> { | |
| 7 | + @Override | |
| 8 | + protected void channelRead0(ChannelHandlerContext channelHandlerContext, String s) throws Exception { | |
| 9 | + | |
| 10 | + } | |
| 11 | + | |
| 12 | + @Override | |
| 13 | + public void channelInactive(ChannelHandlerContext ctx) throws Exception { | |
| 14 | + | |
| 15 | + } | |
| 16 | + | |
| 17 | + @Override | |
| 18 | + public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { | |
| 19 | + | |
| 20 | + } | |
| 21 | +} |
+++ src/main/java/com/munjaon/server/netty/init/SampleNettyInitializer.java
... | ... | @@ -0,0 +1,11 @@ |
| 1 | +package com.munjaon.server.netty.init; | |
| 2 | + | |
| 3 | +import io.netty.channel.Channel; | |
| 4 | +import io.netty.channel.ChannelInitializer; | |
| 5 | + | |
| 6 | +public class SampleNettyInitializer extends ChannelInitializer<Channel> { | |
| 7 | + @Override | |
| 8 | + protected void initChannel(Channel channel) throws Exception { | |
| 9 | + | |
| 10 | + } | |
| 11 | +} |
+++ src/main/java/com/munjaon/server/queue/config/QueueConstants.java
... | ... | @@ -0,0 +1,80 @@ |
| 1 | +package com.munjaon.server.queue.config; | |
| 2 | + | |
| 3 | +public final class QueueConstants { | |
| 4 | + /** Queue File Header Length - [Create Date:10 Byte, Push Count:10 Byte] */ | |
| 5 | + public static final int QUEUE_HEADER_LENGTH = 20; | |
| 6 | + // 큐에 저장할 SMS/URL 전체 바이트 길이 | |
| 7 | + public static final int SMS_TOTAL_BYTE_LENGTH = 473; | |
| 8 | + // 큐에 저장할 LMS/MMS 전체 바이트 길이 | |
| 9 | + public static final int MMS_TOTAL_BYTE_LENGTH = 3365; | |
| 10 | + | |
| 11 | + // 다음 부분은 SMS/URL/LMS/MMS에서 공통으로 사용되는 컬럼 | |
| 12 | + // 회원 시퀀스 | |
| 13 | + public static final int USERSEQ_BYTE_LENGTH = 10; | |
| 14 | + // 회원 아이디 | |
| 15 | + public static final int USERID_BYTE_LENGTH = 20; | |
| 16 | + // 요금제 정보 | |
| 17 | + public static final int FEETYPE_BYTE_LENGTH = 1; | |
| 18 | + // 단가정보 | |
| 19 | + public static final int UNITCOST_BYTE_LENGTH = 10; | |
| 20 | + // 선불일 경우 결제방법(0:현금 / 1:포인트)aqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAQ | |
| 21 | + public static final int CASHTYPE_BYTE_LENGTH = 1; | |
| 22 | + // 메시지 시퀀스34 | |
| 23 | + public static final int MSGID_BYTE_LENGTH = 20; | |
| 24 | + // 메시지 그룹 아이디 | |
| 25 | + public static final int MSGGROUPID_BYTE_LENGTH = 20; | |
| 26 | + // 서비스타입(S:SMS / U:URL / L:LMS / M:MMS) | |
| 27 | + public static final int SERVICETYPE_BYTE_LENGTH = 1; | |
| 28 | + // 결과코드(SendStatus) | |
| 29 | + public static final int SENDSTATUS_BYTE_LENGTH = 4; | |
| 30 | + // 회신번호 | |
| 31 | + public static final int SENDER_BYTE_LENGTH = 12; | |
| 32 | + // 수신번호 | |
| 33 | + public static final int RECEIVER_BYTE_LENGTH = 12; | |
| 34 | + // 예약시간 | |
| 35 | + public static final int RESERVEDT_BYTE_LENGTH = 15; | |
| 36 | + // 요청시간 | |
| 37 | + public static final int REQUESTDT_BYTE_LENGTH = 15; | |
| 38 | + // 원격접속지 주소 | |
| 39 | + public static final int REMOTEIP_BYTE_LENGTH = 25; | |
| 40 | + // 라우터시퀀스 | |
| 41 | + public static final int ROUTERSEQ_BYTE_LENGTH = 6; | |
| 42 | + // KISA 필터링 여부 | |
| 43 | + public static final int KISAFILTER_BYTE_LENGTH = 1; | |
| 44 | + // 파일카운트 | |
| 45 | + public static final int FILECNT_BYTE_LENGTH = 2; | |
| 46 | + // 파일사이즈 | |
| 47 | + public static final int FILESIZE_BYTE_LENGTH = 2; | |
| 48 | + // 파일명 | |
| 49 | + public static final int FILENAME_BYTE_LENGTH = 128; | |
| 50 | + // 제목 | |
| 51 | + public static final int SUBJECT_BYTE_LENGTH = 60; | |
| 52 | + // SMS/URL Message | |
| 53 | + public static final int SMSMSG_BYTE_LENGTH = 240; | |
| 54 | + // LMS/MMS Message | |
| 55 | + public static final int MMSMSG_BYTE_LENGTH = 3000; | |
| 56 | + | |
| 57 | + /** 리포트큐 전체 사이즈 및 데이터 개별 사이즈 | |
| 58 | + * REPORT_TOTAL_LENGTH : 62 | |
| 59 | + * REPORT_MSGID_LENGTH : 20 | |
| 60 | + * REPORT_RECEIVER_LENGTH : 12 | |
| 61 | + * REPORT_SENDDT_LENGTH : 20 | |
| 62 | + * REPORT_RESULT_LENGTH : 3 | |
| 63 | + * REPORT_TELECOM_LENGTH : 7 | |
| 64 | + * */ | |
| 65 | + /** 리포트큐 전체 사이즈 */ | |
| 66 | + public static final int REPORT_TOTAL_LENGTH = 62; | |
| 67 | + /** 리포트큐 MSGID 사이즈 */ | |
| 68 | + public static final int REPORT_MSGID_LENGTH = 20; | |
| 69 | + /** 리포트큐 RECEIVER 사이즈 */ | |
| 70 | + public static final int REPORT_RECEIVER_LENGTH = 12; | |
| 71 | + /** 리포트큐 SENDDT 사이즈 */ | |
| 72 | + public static final int REPORT_SENDDT_LENGTH = 20; | |
| 73 | + /** 리포트큐 RESULT 사이즈 */ | |
| 74 | + public static final int REPORT_RESULT_LENGTH = 3; | |
| 75 | + /** 리포트큐 TELECOM 사이즈 */ | |
| 76 | + public static final int REPORT_TELECOM_LENGTH = 7; | |
| 77 | + | |
| 78 | + // 큐에 저장하기전에 바이트를 채울 문자 | |
| 79 | + public static final byte SET_DEFAULT_BYTE = (byte) 0x20; | |
| 80 | +} |
+++ src/main/java/com/munjaon/server/queue/dto/BasicMessageDto.java
... | ... | @@ -0,0 +1,18 @@ |
| 1 | +package com.munjaon.server.queue.dto; | |
| 2 | + | |
| 3 | +import lombok.Getter; | |
| 4 | +import lombok.Setter; | |
| 5 | +import lombok.ToString; | |
| 6 | + | |
| 7 | +@Getter | |
| 8 | +@Setter | |
| 9 | +@ToString | |
| 10 | +public class BasicMessageDto { | |
| 11 | + protected String userMsgID = ""; | |
| 12 | + protected String userSender = ""; | |
| 13 | + protected String userReceiver = ""; | |
| 14 | + protected String userMessage = ""; | |
| 15 | + protected String userMsgType = ""; | |
| 16 | + protected String userRequestDate = ""; | |
| 17 | + protected String sendStatus = "0"; | |
| 18 | +} |
+++ src/main/java/com/munjaon/server/queue/dto/KakaoMessageDto.java
... | ... | @@ -0,0 +1,11 @@ |
| 1 | +package com.munjaon.server.queue.dto; | |
| 2 | + | |
| 3 | +import lombok.Getter; | |
| 4 | +import lombok.Setter; | |
| 5 | +import lombok.ToString; | |
| 6 | + | |
| 7 | +@Getter | |
| 8 | +@Setter | |
| 9 | +@ToString | |
| 10 | +public class KakaoMessageDto extends BasicMessageDto { | |
| 11 | +} |
+++ src/main/java/com/munjaon/server/queue/dto/MmsMessageDto.java
... | ... | @@ -0,0 +1,19 @@ |
| 1 | +package com.munjaon.server.queue.dto; | |
| 2 | + | |
| 3 | +import lombok.Getter; | |
| 4 | +import lombok.Setter; | |
| 5 | +import lombok.ToString; | |
| 6 | + | |
| 7 | +@Getter | |
| 8 | +@Setter | |
| 9 | +@ToString | |
| 10 | +public class MmsMessageDto extends BasicMessageDto { | |
| 11 | + private String userSubject = ""; | |
| 12 | + private int userFileCnt = 0; | |
| 13 | + private String userFileName01 = ""; | |
| 14 | + private String userFileName02 = ""; | |
| 15 | + private String userFileName03 = ""; | |
| 16 | + private int userFileSize01 = 0; | |
| 17 | + private int userFileSize02 = 0; | |
| 18 | + private int userFileSize03 = 0; | |
| 19 | +} |
+++ src/main/java/com/munjaon/server/queue/enums/QueueService.java
... | ... | @@ -0,0 +1,17 @@ |
| 1 | +package com.munjaon.server.queue.enums; | |
| 2 | + | |
| 3 | +import lombok.Getter; | |
| 4 | + | |
| 5 | +@Getter | |
| 6 | +public enum QueueService { | |
| 7 | + SMS_QUEUE, | |
| 8 | + LMS_QUEUE, | |
| 9 | + MMS_QUEUE, | |
| 10 | + KAKAO_QUEUE; | |
| 11 | + | |
| 12 | + private Object service; | |
| 13 | + | |
| 14 | + public void setService(Object service) { | |
| 15 | + this.service = service; | |
| 16 | + } | |
| 17 | +} |
+++ src/main/java/com/munjaon/server/queue/service/KakaoQueueService.java
... | ... | @@ -0,0 +1,11 @@ |
| 1 | +package com.munjaon.server.queue.service; | |
| 2 | + | |
| 3 | +import lombok.RequiredArgsConstructor; | |
| 4 | +import lombok.extern.slf4j.Slf4j; | |
| 5 | +import org.springframework.stereotype.Service; | |
| 6 | + | |
| 7 | +@Slf4j | |
| 8 | +@Service | |
| 9 | +@RequiredArgsConstructor | |
| 10 | +public class KakaoQueueService { | |
| 11 | +} |
+++ src/main/java/com/munjaon/server/queue/service/LmsQueueService.java
... | ... | @@ -0,0 +1,11 @@ |
| 1 | +package com.munjaon.server.queue.service; | |
| 2 | + | |
| 3 | +import lombok.RequiredArgsConstructor; | |
| 4 | +import lombok.extern.slf4j.Slf4j; | |
| 5 | +import org.springframework.stereotype.Service; | |
| 6 | + | |
| 7 | +@Slf4j | |
| 8 | +@Service | |
| 9 | +@RequiredArgsConstructor | |
| 10 | +public class LmsQueueService { | |
| 11 | +} |
+++ src/main/java/com/munjaon/server/queue/service/MmsQueueService.java
... | ... | @@ -0,0 +1,11 @@ |
| 1 | +package com.munjaon.server.queue.service; | |
| 2 | + | |
| 3 | +import lombok.RequiredArgsConstructor; | |
| 4 | +import lombok.extern.slf4j.Slf4j; | |
| 5 | +import org.springframework.stereotype.Service; | |
| 6 | + | |
| 7 | +@Slf4j | |
| 8 | +@Service | |
| 9 | +@RequiredArgsConstructor | |
| 10 | +public class MmsQueueService { | |
| 11 | +} |
+++ src/main/java/com/munjaon/server/queue/service/QueueServiceInjector.java
... | ... | @@ -0,0 +1,37 @@ |
| 1 | +package com.munjaon.server.queue.service; | |
| 2 | + | |
| 3 | +import com.munjaon.server.queue.enums.QueueService; | |
| 4 | +import jakarta.annotation.PostConstruct; | |
| 5 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 6 | +import org.springframework.stereotype.Component; | |
| 7 | + | |
| 8 | +import java.util.EnumSet; | |
| 9 | + | |
| 10 | +@Component | |
| 11 | +public class QueueServiceInjector { | |
| 12 | + @Autowired | |
| 13 | + private SmsQueueService smsQueueService; | |
| 14 | + @Autowired | |
| 15 | + private LmsQueueService lmsQueueService; | |
| 16 | + @Autowired | |
| 17 | + private MmsQueueService mmsQueueService; | |
| 18 | + @Autowired | |
| 19 | + private KakaoQueueService kakaoQueueService; | |
| 20 | + | |
| 21 | + @PostConstruct | |
| 22 | + public void postConstruct() { | |
| 23 | + for (QueueService svc : EnumSet.allOf(QueueService.class)) { | |
| 24 | + switch (svc) { | |
| 25 | + case SMS_QUEUE: svc.setService(smsQueueService); | |
| 26 | + break; | |
| 27 | + case LMS_QUEUE: svc.setService(lmsQueueService); | |
| 28 | + break; | |
| 29 | + case MMS_QUEUE: svc.setService(mmsQueueService); | |
| 30 | + break; | |
| 31 | + case KAKAO_QUEUE: svc.setService(kakaoQueueService); | |
| 32 | + break; | |
| 33 | + default: break; | |
| 34 | + } | |
| 35 | + } | |
| 36 | + } | |
| 37 | +} |
+++ src/main/java/com/munjaon/server/queue/service/SmsQueueService.java
... | ... | @@ -0,0 +1,11 @@ |
| 1 | +package com.munjaon.server.queue.service; | |
| 2 | + | |
| 3 | +import lombok.RequiredArgsConstructor; | |
| 4 | +import lombok.extern.slf4j.Slf4j; | |
| 5 | +import org.springframework.stereotype.Service; | |
| 6 | + | |
| 7 | +@Slf4j | |
| 8 | +@Service | |
| 9 | +@RequiredArgsConstructor | |
| 10 | +public class SmsQueueService { | |
| 11 | +} |
+++ src/main/java/com/munjaon/server/scheduler/mapper/SchedulerMapper.java
... | ... | @@ -0,0 +1,8 @@ |
| 1 | +package com.munjaon.server.scheduler.mapper; | |
| 2 | + | |
| 3 | +import org.apache.ibatis.annotations.Mapper; | |
| 4 | + | |
| 5 | +@Mapper | |
| 6 | +public interface SchedulerMapper { | |
| 7 | + int get(); | |
| 8 | +} |
+++ src/main/java/com/munjaon/server/scheduler/service/CacheScheduleService.java
... | ... | @@ -0,0 +1,49 @@ |
| 1 | +package com.munjaon.server.scheduler.service; | |
| 2 | + | |
| 3 | +import com.munjaon.server.cache.service.MemberService; | |
| 4 | +import lombok.RequiredArgsConstructor; | |
| 5 | +import lombok.extern.slf4j.Slf4j; | |
| 6 | +import org.springframework.beans.factory.annotation.Value; | |
| 7 | +import org.springframework.scheduling.annotation.Scheduled; | |
| 8 | +import org.springframework.stereotype.Component; | |
| 9 | + | |
| 10 | +@Slf4j | |
| 11 | +@Component | |
| 12 | +@RequiredArgsConstructor | |
| 13 | +public class CacheScheduleService { | |
| 14 | + private final MemberService memberService; | |
| 15 | + | |
| 16 | + @Value("${agent.db-name}") | |
| 17 | + private String tableSchema; | |
| 18 | + /* 사용자 테이블 마지막 업데이트 시간 */ | |
| 19 | + private String member_last_modified_time = null; | |
| 20 | + | |
| 21 | + @Scheduled(cron="0/5 * * * * *") | |
| 22 | + public void doService() throws Exception { | |
| 23 | + doMemberService(); | |
| 24 | + } | |
| 25 | + | |
| 26 | + private void doMemberService() { | |
| 27 | + if (member_last_modified_time == null) { | |
| 28 | + log.info("Member List Info is First Caching~~~"); | |
| 29 | + memberService.deleteAllMember(); | |
| 30 | +// memberService.list(); | |
| 31 | + | |
| 32 | + /* 회원 정보 마지막 변경시간 저장 */ | |
| 33 | + member_last_modified_time = memberService.getLastModifiedTime(tableSchema); | |
| 34 | + return; | |
| 35 | + } | |
| 36 | + | |
| 37 | + /* 변경이 없는 경우 */ | |
| 38 | + if (member_last_modified_time.equals(memberService.getLastModifiedTime(tableSchema))) { | |
| 39 | + return; | |
| 40 | + } | |
| 41 | + | |
| 42 | + /* 테이블에 변경이 있는 경우 */ | |
| 43 | + log.info("Member List Info is Delete And Caching~~~"); | |
| 44 | + memberService.deleteAllMember(); | |
| 45 | +// memberService.list(); | |
| 46 | + /* 회원 정보 마지막 변경시간 저장 */ | |
| 47 | + member_last_modified_time = memberService.getLastModifiedTime(tableSchema); | |
| 48 | + } | |
| 49 | +} |
+++ src/main/resources/application.yml
... | ... | @@ -0,0 +1,11 @@ |
| 1 | +spring: | |
| 2 | + application: | |
| 3 | + name: munjaon_server | |
| 4 | + profiles: | |
| 5 | + default: local | |
| 6 | + | |
| 7 | +mybatis: | |
| 8 | + configuration: | |
| 9 | + map-underscore-to-camel-case: true | |
| 10 | + type-aliases-package: com.munjaon.server.**.dto | |
| 11 | + mapper-locations: classpath:/sqlmap/**/*.xml(No newline at end of file) |
+++ src/main/resources/dev/application-dev.yml
... | ... | @@ -0,0 +1,16 @@ |
| 1 | +spring: | |
| 2 | + datasource: | |
| 3 | + server: | |
| 4 | + driver-class-name: org.mariadb.jdbc.Driver | |
| 5 | + jdbc-url: jdbc:mariadb://119.193.215.98:3306/mjon_agent | |
| 6 | + username: mjonUr_agent | |
| 7 | + password: mjagent123$ | |
| 8 | + | |
| 9 | +server: | |
| 10 | + port: 8090 | |
| 11 | + shutdown: graceful | |
| 12 | + | |
| 13 | +# ### 에이전트 설정 관련 #################################################################################### | |
| 14 | +agent: | |
| 15 | + server-property-file: C:/apps/agent_server/config/server.properties | |
| 16 | + db-name: mjon_agent_back(No newline at end of file) |
+++ src/main/resources/local/application-local.yml
... | ... | @@ -0,0 +1,16 @@ |
| 1 | +spring: | |
| 2 | + datasource: | |
| 3 | + server: | |
| 4 | + driver-class-name: org.mariadb.jdbc.Driver | |
| 5 | + jdbc-url: jdbc:mariadb://119.193.215.98:3306/mjon_agent_back | |
| 6 | + username: mjonUr_agent | |
| 7 | + password: mjagent123$ | |
| 8 | + | |
| 9 | +server: | |
| 10 | + port: 8090 | |
| 11 | + shutdown: graceful | |
| 12 | + | |
| 13 | +# ### 에이전트 설정 관련 #################################################################################### | |
| 14 | +agent: | |
| 15 | + server-property-file: C:/apps/agent_server/config/server.properties | |
| 16 | + db-name: mjon_agent_back(No newline at end of file) |
+++ src/main/resources/logback-spring.xml
... | ... | @@ -0,0 +1,80 @@ |
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | |
| 2 | +<configuration> | |
| 3 | + <timestamp key="BY_DATE" datePattern="yyyy-MM-dd"/> | |
| 4 | + <property name="LOG_PATTERN" | |
| 5 | + value="[%d{yyyy-MM-dd HH:mm:ss}:%-4relative] %green([%thread]) %highlight(%-5level) %boldWhite([%C.%M:%yellow(%L)]) - %msg%n%ex"/> | |
| 6 | + | |
| 7 | + <springProfile name="local"> | |
| 8 | + <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender"> | |
| 9 | + <encoder> | |
| 10 | + <pattern>${LOG_PATTERN}</pattern> | |
| 11 | + </encoder> | |
| 12 | + </appender> | |
| 13 | + <logger name="com.munjaon.server" level="DEBUG" /> | |
| 14 | + <root level="ERROR"> | |
| 15 | + <appender-ref ref="CONSOLE"/> | |
| 16 | + </root> | |
| 17 | + </springProfile> | |
| 18 | + | |
| 19 | + <springProfile name="prod|dev"> | |
| 20 | + <appender name="FILE-INFO" class="ch.qos.logback.core.rolling.RollingFileAppender"> | |
| 21 | + <file>./log/info/info-${BY_DATE}.log</file> | |
| 22 | + <filter class = "ch.qos.logback.classic.filter.LevelFilter"> | |
| 23 | + <level>INFO</level> | |
| 24 | + <onMatch>ACCEPT</onMatch> | |
| 25 | + <onMismatch>DENY</onMismatch> | |
| 26 | + </filter> | |
| 27 | + <encoder> | |
| 28 | + <pattern>${LOG_PATTERN}</pattern> | |
| 29 | + </encoder> | |
| 30 | + <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> | |
| 31 | + <fileNamePattern> ./backup/info/info-%d{yyyy-MM-dd}.%i.log</fileNamePattern> | |
| 32 | + <maxFileSize>100MB</maxFileSize> | |
| 33 | + <maxHistory>30</maxHistory> | |
| 34 | + <totalSizeCap>3GB</totalSizeCap> | |
| 35 | + </rollingPolicy> | |
| 36 | + </appender> | |
| 37 | + | |
| 38 | + <appender name="FILE-WARN" class="ch.qos.logback.core.rolling.RollingFileAppender"> | |
| 39 | + <file>./log/warn/warn-${BY_DATE}.log</file> | |
| 40 | + <filter class = "ch.qos.logback.classic.filter.LevelFilter"> | |
| 41 | + <level>WARN</level> | |
| 42 | + <onMatch>ACCEPT</onMatch> | |
| 43 | + <onMismatch>DENY</onMismatch> | |
| 44 | + </filter> | |
| 45 | + <encoder> | |
| 46 | + <pattern>${LOG_PATTERN}</pattern> | |
| 47 | + </encoder> | |
| 48 | + <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> | |
| 49 | + <fileNamePattern> ./backup/warn/warn-%d{yyyy-MM-dd}.%i.log</fileNamePattern> | |
| 50 | + <maxFileSize>100MB</maxFileSize> | |
| 51 | + <maxHistory>30</maxHistory> | |
| 52 | + <totalSizeCap>3GB</totalSizeCap> | |
| 53 | + </rollingPolicy> | |
| 54 | + </appender> | |
| 55 | + | |
| 56 | + <appender name="FILE-ERROR" class="ch.qos.logback.core.rolling.RollingFileAppender"> | |
| 57 | + <file>./log/error/error-${BY_DATE}.log</file> | |
| 58 | + <filter class = "ch.qos.logback.classic.filter.LevelFilter"> | |
| 59 | + <level>ERROR</level> | |
| 60 | + <onMatch>ACCEPT</onMatch> | |
| 61 | + <onMismatch>DENY</onMismatch> | |
| 62 | + </filter> | |
| 63 | + <encoder> | |
| 64 | + <pattern>${LOG_PATTERN}</pattern> | |
| 65 | + </encoder> | |
| 66 | + <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> | |
| 67 | + <fileNamePattern> ./backup/error/error-%d{yyyy-MM-dd}.%i.log</fileNamePattern> | |
| 68 | + <maxFileSize>100MB</maxFileSize> | |
| 69 | + <maxHistory>30</maxHistory> | |
| 70 | + <totalSizeCap>3GB</totalSizeCap> | |
| 71 | + </rollingPolicy> | |
| 72 | + </appender> | |
| 73 | + | |
| 74 | + <root level="INFO"> | |
| 75 | + <appender-ref ref="FILE-INFO"/> | |
| 76 | + <appender-ref ref="FILE-WARN"/> | |
| 77 | + <appender-ref ref="FILE-ERROR"/> | |
| 78 | + </root> | |
| 79 | + </springProfile> | |
| 80 | +</configuration>(No newline at end of file) |
+++ src/main/resources/mybatis-config.xml
... | ... | @@ -0,0 +1,13 @@ |
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | |
| 2 | +<!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN" | |
| 3 | + "http://mybatis.org/dtd/mybatis-3-config.dtd"> | |
| 4 | +<configuration> | |
| 5 | + <settings> | |
| 6 | + <setting name="mapUnderscoreToCamelCase" value="true" /> | |
| 7 | + <setting name="callSettersOnNulls" value="true" /> | |
| 8 | + <setting name="jdbcTypeForNull" value="NULL"/> | |
| 9 | + </settings> | |
| 10 | +<!-- <typeAliases>--> | |
| 11 | +<!-- <package name="com.dopco.psm.**.dto" />--> | |
| 12 | +<!-- </typeAliases>--> | |
| 13 | +</configuration>(No newline at end of file) |
+++ src/main/resources/prod/application-prod.yml
... | ... | @@ -0,0 +1,16 @@ |
| 1 | +spring: | |
| 2 | + datasource: | |
| 3 | + server: | |
| 4 | + driver-class-name: org.mariadb.jdbc.Driver | |
| 5 | + jdbc-url: jdbc:mariadb://119.193.215.98:3306/mjon_agent | |
| 6 | + username: mjonUr_agent | |
| 7 | + password: mjagent123$ | |
| 8 | + | |
| 9 | +server: | |
| 10 | + port: 8090 | |
| 11 | + shutdown: graceful | |
| 12 | + | |
| 13 | +# ### 에이전트 설정 관련 #################################################################################### | |
| 14 | +agent: | |
| 15 | + server-property-file: C:/apps/agent_server/config/server.properties | |
| 16 | + db-name: mjon_agent_back |
+++ src/main/resources/sqlmap/member_sql.xml
... | ... | @@ -0,0 +1,54 @@ |
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | |
| 2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |
| 3 | +<mapper namespace="com.munjaon.server.cache.mapper.MemberMapper"> | |
| 4 | + <select id="getLastModifiedTime" resultType="String"> | |
| 5 | + /* MemberMapper.getLastModifiedTime */ | |
| 6 | + SELECT CASE WHEN UPDATE_TIME IS NULL THEN '0' ELSE DATE_FORMAT(UPDATE_TIME, '%Y%m%d%H%i%s') END AS last_modify_time | |
| 7 | + FROM information_schema.tables | |
| 8 | + WHERE TABLE_SCHEMA = #{tableSchema} AND TABLE_NAME = 'lettngnrlmber' | |
| 9 | + </select> | |
| 10 | + <select id="list" resultType="MemberDto"> | |
| 11 | + /* MemberMapper.list */ | |
| 12 | + SELECT | |
| 13 | + MBER_ID | |
| 14 | + , ESNTL_ID | |
| 15 | + , MBER_STTUS | |
| 16 | + , DEPT | |
| 17 | + , SHORT_PRICE | |
| 18 | + , LONG_PRICE | |
| 19 | + , PICTURE_PRICE | |
| 20 | + , PICTURE2_PRICE | |
| 21 | + , PICTURE3_PRICE | |
| 22 | + , KAKAO_AT_PRICE | |
| 23 | + , KAKAO_FT_PRICE | |
| 24 | + , KAKAO_FT_IMG_PRICE | |
| 25 | + , KAKAO_FT_WIDE_IMG_PRICE | |
| 26 | + , FAX_PRICE | |
| 27 | + , USER_MONEY | |
| 28 | + FROM lettngnrlmber | |
| 29 | + </select> | |
| 30 | + <select id="get" resultType="MemberDto"> | |
| 31 | + /* MemberMapper.get */ | |
| 32 | + SELECT | |
| 33 | + MBER_ID | |
| 34 | + , ESNTL_ID | |
| 35 | + , MBER_STTUS | |
| 36 | + , DEPT | |
| 37 | + , SHORT_PRICE | |
| 38 | + , LONG_PRICE | |
| 39 | + , PICTURE_PRICE | |
| 40 | + , PICTURE2_PRICE | |
| 41 | + , PICTURE3_PRICE | |
| 42 | + , KAKAO_AT_PRICE | |
| 43 | + , KAKAO_FT_PRICE | |
| 44 | + , KAKAO_FT_IMG_PRICE | |
| 45 | + , KAKAO_FT_WIDE_IMG_PRICE | |
| 46 | + , FAX_PRICE | |
| 47 | + , USER_MONEY | |
| 48 | + FROM lettngnrlmber | |
| 49 | + WHERE MBER_ID = #{mberId} | |
| 50 | + </select> | |
| 51 | + <update id="updateStts" parameterType="MemberDto"> | |
| 52 | + UPDATE lettngnrlmber SET MBER_STTUS = #{mberSttus} WHERE MBER_ID = #{mberId} | |
| 53 | + </update> | |
| 54 | +</mapper>(No newline at end of file) |
+++ src/main/resources/sqlmap/sample_sql.xml
... | ... | @@ -0,0 +1,8 @@ |
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | |
| 2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |
| 3 | +<mapper namespace="com.munjaon.server.api.mapper.SampleMapper"> | |
| 4 | + <select id="get" resultType="int"> | |
| 5 | + /* SampleMapper.get */ | |
| 6 | + SELECT 1 | |
| 7 | + </select> | |
| 8 | +</mapper>(No newline at end of file) |
+++ src/main/resources/sqlmap/scheduler_sql.xml
... | ... | @@ -0,0 +1,8 @@ |
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | |
| 2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |
| 3 | +<mapper namespace="com.munjaon.server.scheduler.mapper.SchedulerMapper"> | |
| 4 | + <select id="get" resultType="int"> | |
| 5 | + /* SchedulerMapper.get */ | |
| 6 | + SELECT 1 | |
| 7 | + </select> | |
| 8 | +</mapper>(No newline at end of file) |
+++ src/test/java/com/munjaon/server/MunjaonServerApplicationTests.java
... | ... | @@ -0,0 +1,13 @@ |
| 1 | +package com.munjaon.server; | |
| 2 | + | |
| 3 | +import org.junit.jupiter.api.Test; | |
| 4 | +import org.springframework.boot.test.context.SpringBootTest; | |
| 5 | + | |
| 6 | +@SpringBootTest | |
| 7 | +class MunjaonServerApplicationTests { | |
| 8 | + | |
| 9 | + @Test | |
| 10 | + void contextLoads() { | |
| 11 | + } | |
| 12 | + | |
| 13 | +} |
Add a comment
Delete comment
Once you delete this comment, you won't be able to recover it. Are you sure you want to delete this comment?