diff --git a/mvnw b/mvnw new file mode 100644 index 0000000..21d3ee8 --- /dev/null +++ b/mvnw @@ -0,0 +1,310 @@ +#!/bin/sh +# ---------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Maven2 Start Up Batch script +# +# Required ENV vars: +# ------------------ +# JAVA_HOME - location of a JDK home dir +# +# Optional ENV vars +# ----------------- +# M2_HOME - location of maven2's installed home dir +# MAVEN_OPTS - parameters passed to the Java VM when running Maven +# e.g. to debug Maven itself, use +# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +# MAVEN_SKIP_RC - flag to disable loading of mavenrc files +# ---------------------------------------------------------------------------- + +if [ -z "$MAVEN_SKIP_RC" ] ; then + + if [ -f /etc/mavenrc ] ; then + . /etc/mavenrc + fi + + if [ -f "$HOME/.mavenrc" ] ; then + . "$HOME/.mavenrc" + fi + +fi + +# OS specific support. $var _must_ be set to either true or false. +cygwin=false; +darwin=false; +mingw=false +case "`uname`" in + CYGWIN*) cygwin=true ;; + MINGW*) mingw=true;; + Darwin*) darwin=true + # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home + # See https://developer.apple.com/library/mac/qa/qa1170/_index.html + if [ -z "$JAVA_HOME" ]; then + if [ -x "/usr/libexec/java_home" ]; then + export JAVA_HOME="`/usr/libexec/java_home`" + else + export JAVA_HOME="/Library/Java/Home" + fi + fi + ;; +esac + +if [ -z "$JAVA_HOME" ] ; then + if [ -r /etc/gentoo-release ] ; then + JAVA_HOME=`java-config --jre-home` + fi +fi + +if [ -z "$M2_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname "$PRG"`/$link" + fi + done + + saveddir=`pwd` + + M2_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + M2_HOME=`cd "$M2_HOME" && pwd` + + cd "$saveddir" + # echo Using m2 at $M2_HOME +fi + +# For Cygwin, ensure paths are in UNIX format before anything is touched +if $cygwin ; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --unix "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --unix "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --unix "$CLASSPATH"` +fi + +# For Mingw, ensure paths are in UNIX format before anything is touched +if $mingw ; then + [ -n "$M2_HOME" ] && + M2_HOME="`(cd "$M2_HOME"; pwd)`" + [ -n "$JAVA_HOME" ] && + JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" +fi + +if [ -z "$JAVA_HOME" ]; then + javaExecutable="`which javac`" + if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then + # readlink(1) is not available as standard on Solaris 10. + readLink=`which readlink` + if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then + if $darwin ; then + javaHome="`dirname \"$javaExecutable\"`" + javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" + else + javaExecutable="`readlink -f \"$javaExecutable\"`" + fi + javaHome="`dirname \"$javaExecutable\"`" + javaHome=`expr "$javaHome" : '\(.*\)/bin'` + JAVA_HOME="$javaHome" + export JAVA_HOME + fi + fi +fi + +if [ -z "$JAVACMD" ] ; then + 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 + else + JAVACMD="`which java`" + fi +fi + +if [ ! -x "$JAVACMD" ] ; then + echo "Error: JAVA_HOME is not defined correctly." >&2 + echo " We cannot execute $JAVACMD" >&2 + exit 1 +fi + +if [ -z "$JAVA_HOME" ] ; then + echo "Warning: JAVA_HOME environment variable is not set." +fi + +CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher + +# traverses directory structure from process work directory to filesystem root +# first directory with .mvn subdirectory is considered project base directory +find_maven_basedir() { + + if [ -z "$1" ] + then + echo "Path not specified to find_maven_basedir" + return 1 + fi + + basedir="$1" + wdir="$1" + while [ "$wdir" != '/' ] ; do + if [ -d "$wdir"/.mvn ] ; then + basedir=$wdir + break + fi + # workaround for JBEAP-8937 (on Solaris 10/Sparc) + if [ -d "${wdir}" ]; then + wdir=`cd "$wdir/.."; pwd` + fi + # end of workaround + done + echo "${basedir}" +} + +# concatenates all lines of a file +concat_lines() { + if [ -f "$1" ]; then + echo "$(tr -s '\n' ' ' < "$1")" + fi +} + +BASE_DIR=`find_maven_basedir "$(pwd)"` +if [ -z "$BASE_DIR" ]; then + exit 1; +fi + +########################################################################################## +# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +# This allows using the maven wrapper in projects that prohibit checking in binary data. +########################################################################################## +if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found .mvn/wrapper/maven-wrapper.jar" + fi +else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." + fi + if [ -n "$MVNW_REPOURL" ]; then + jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.5/maven-wrapper-0.5.5.jar" + else + jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.5/maven-wrapper-0.5.5.jar" + fi + while IFS="=" read key value; do + case "$key" in (wrapperUrl) jarUrl="$value"; break ;; + esac + done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" + if [ "$MVNW_VERBOSE" = true ]; then + echo "Downloading from: $jarUrl" + fi + wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" + if $cygwin; then + wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"` + fi + + if command -v wget > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found wget ... using wget" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + wget "$jarUrl" -O "$wrapperJarPath" + else + wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" + fi + elif command -v curl > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found curl ... using curl" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + curl -o "$wrapperJarPath" "$jarUrl" -f + else + curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f + fi + + else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Falling back to using Java to download" + fi + javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" + # For Cygwin, switch paths to Windows format before running javac + if $cygwin; then + javaClass=`cygpath --path --windows "$javaClass"` + fi + if [ -e "$javaClass" ]; then + if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Compiling MavenWrapperDownloader.java ..." + fi + # Compiling the Java class + ("$JAVA_HOME/bin/javac" "$javaClass") + fi + if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + # Running the downloader + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Running MavenWrapperDownloader.java ..." + fi + ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") + fi + fi + fi +fi +########################################################################################## +# End of extension +########################################################################################## + +export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} +if [ "$MVNW_VERBOSE" = true ]; then + echo $MAVEN_PROJECTBASEDIR +fi +MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" + +# For Cygwin, switch paths to Windows format before running java +if $cygwin; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --path --windows "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --windows "$CLASSPATH"` + [ -n "$MAVEN_PROJECTBASEDIR" ] && + MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` +fi + +# Provide a "standardized" way to retrieve the CLI args that will +# work with both Windows and non-Windows executions. +MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" +export MAVEN_CMD_LINE_ARGS + +WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +exec "$JAVACMD" \ + $MAVEN_OPTS \ + -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ + "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ + ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/mvnw.cmd b/mvnw.cmd new file mode 100644 index 0000000..84d60ab --- /dev/null +++ b/mvnw.cmd @@ -0,0 +1,182 @@ +@REM ---------------------------------------------------------------------------- +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM https://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM ---------------------------------------------------------------------------- + +@REM ---------------------------------------------------------------------------- +@REM Maven2 Start Up Batch script +@REM +@REM Required ENV vars: +@REM JAVA_HOME - location of a JDK home dir +@REM +@REM Optional ENV vars +@REM M2_HOME - location of maven2's installed home dir +@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands +@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending +@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven +@REM e.g. to debug Maven itself, use +@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files +@REM ---------------------------------------------------------------------------- + +@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' +@echo off +@REM set title of command window +title %0 +@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on' +@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% + +@REM set %HOME% to equivalent of $HOME +if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") + +@REM Execute a user defined script before this one +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre +@REM check for pre script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" +if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" +:skipRcPre + +@setlocal + +set ERROR_CODE=0 + +@REM To isolate internal variables from possible post scripts, we use another setlocal +@setlocal + +@REM ==== START VALIDATION ==== +if not "%JAVA_HOME%" == "" goto OkJHome + +echo. +echo Error: JAVA_HOME not found in your environment. >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +:OkJHome +if exist "%JAVA_HOME%\bin\java.exe" goto init + +echo. +echo Error: JAVA_HOME is set to an invalid directory. >&2 +echo JAVA_HOME = "%JAVA_HOME%" >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +@REM ==== END VALIDATION ==== + +:init + +@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". +@REM Fallback to current working directory if not found. + +set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% +IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir + +set EXEC_DIR=%CD% +set WDIR=%EXEC_DIR% +:findBaseDir +IF EXIST "%WDIR%"\.mvn goto baseDirFound +cd .. +IF "%WDIR%"=="%CD%" goto baseDirNotFound +set WDIR=%CD% +goto findBaseDir + +:baseDirFound +set MAVEN_PROJECTBASEDIR=%WDIR% +cd "%EXEC_DIR%" +goto endDetectBaseDir + +:baseDirNotFound +set MAVEN_PROJECTBASEDIR=%EXEC_DIR% +cd "%EXEC_DIR%" + +:endDetectBaseDir + +IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig + +@setlocal EnableExtensions EnableDelayedExpansion +for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a +@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% + +:endReadAdditionalConfig + +SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" +set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" +set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.5/maven-wrapper-0.5.5.jar" + +FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( + IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B +) + +@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +@REM This allows using the maven wrapper in projects that prohibit checking in binary data. +if exist %WRAPPER_JAR% ( + if "%MVNW_VERBOSE%" == "true" ( + echo Found %WRAPPER_JAR% + ) +) else ( + if not "%MVNW_REPOURL%" == "" ( + SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.5/maven-wrapper-0.5.5.jar" + ) + if "%MVNW_VERBOSE%" == "true" ( + echo Couldn't find %WRAPPER_JAR%, downloading it ... + echo Downloading from: %DOWNLOAD_URL% + ) + + powershell -Command "&{"^ + "$webclient = new-object System.Net.WebClient;"^ + "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ + "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ + "}"^ + "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^ + "}" + if "%MVNW_VERBOSE%" == "true" ( + echo Finished downloading %WRAPPER_JAR% + ) +) +@REM End of extension + +@REM Provide a "standardized" way to retrieve the CLI args that will +@REM work with both Windows and non-Windows executions. +set MAVEN_CMD_LINE_ARGS=%* + +%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* +if ERRORLEVEL 1 goto error +goto end + +:error +set ERROR_CODE=1 + +:end +@endlocal & set ERROR_CODE=%ERROR_CODE% + +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost +@REM check for post script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" +if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" +:skipRcPost + +@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' +if "%MAVEN_BATCH_PAUSE%" == "on" pause + +if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% + +exit /B %ERROR_CODE% diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..747fd04 --- /dev/null +++ b/pom.xml @@ -0,0 +1,400 @@ + + + 4.0.0 + + + org.springframework.boot + spring-boot-starter-parent + 2.3.12.RELEASE + + + + LogLogAPI + 1.0.0-SNAPSHOT + war + LogLogAPI + LogLogAPI for Spring Boot + + + + 1.8 + + UTF-8 + UTF-8 + + + + LogLogAPI + + + org.springframework.boot + spring-boot-maven-plugin + + + + + + + src/main/resources + + *.properties + *.xml + + . + true + + + src/main/java/com/loglog/api/commons/daos/mapper + + *.xml + + com/loglog/api/commons/daos/mapper + true + + + + + + + + jcenter + https://jcenter.bintray.com/ + + false + + + + + inner project + external jars + file://${project.basedir}/lib + + + + in-project-jenkins + custom jars-jenkins + file://${JENKINS_HOME}/jobs/${JOB_NAME}/workspace/lib + + + + Java-fcm + Java-fcm for Maven + http://dl.bintray.com/tudor/Pixsee + + + + + + + + software.amazon.awssdk + bom + 2.11.12 + pom + import + + + + + com.google.cloud + libraries-bom + 12.1.0 + pom + import + + + + + + + + org.springframework.boot + spring-boot-starter-web + + + org.junit.vintage + junit-vintage-engine + + + org.springframework.boot + spring-boot-starter-logging + + + commons-logging + commons-logging + + + org.slf4j + slf4j-log4j12 + + + org.slf4j + slf4j-api + + + log4j + log4j + + + ch.qos.logback + logback-classic + + + ch.qos.logback + logback-core + + + + + + org.springframework.boot + spring-boot-starter + + + org.springframework.boot + spring-boot-starter-logging + + + commons-logging + commons-logging + + + org.slf4j + slf4j-log4j12 + + + org.slf4j + slf4j-api + + + log4j + log4j + + + ch.qos.logback + logback-classic + + + ch.qos.logback + logback-core + + + + + + + org.springframework.boot + spring-boot-starter-actuator + + + org.springframework.boot + spring-boot-starter-logging + + + commons-logging + commons-logging + + + org.slf4j + slf4j-log4j12 + + + org.slf4j + slf4j-api + + + log4j + log4j + + + ch.qos.logback + logback-classic + + + ch.qos.logback + logback-core + + + + + + org.springframework.boot + spring-boot-devtools + true + + + + de.codecentric + spring-boot-admin-starter-client + 2.2.0 + + + + javax.servlet + jstl + + + + org.apache.tomcat.embed + tomcat-embed-jasper + + + + com.google.code.gson + gson + + + + org.apache.commons + commons-lang3 + + + + commons-beanutils + commons-beanutils + 1.9.3 + + + + + + + org.postgresql + postgresql + + + + org.projectlombok + lombok + true + + + + commons-io + commons-io + 2.6 + + + + + + org.mybatis.spring.boot + mybatis-spring-boot-starter + 1.3.2 + + + + + org.mybatis + mybatis-spring + 1.3.2 + + + + + org.mybatis + mybatis + 3.4.6 + + + + + org.mariadb.jdbc + mariadb-java-client + + + + + + commons-dbcp + commons-dbcp + 1.2.2 + + + + + + org.json + json + 20160810 + + + + + io.jsonwebtoken + jjwt + 0.9.1 + + + + javax.xml.bind + jaxb-api + + + + commons-fileupload + commons-fileupload + 1.3.1 + + + + + com.drewnoakes + metadata-extractor + 2.9.1 + + + + + org.imgscalr + imgscalr-lib + 4.2 + + + + org.springframework + spring-context-support + + + + + org.jsoup + jsoup + 1.14.1 + + + + + + org.apache.logging.log4j + log4j-core + 2.15.0 + + + + org.apache.logging.log4j + log4j-api + 2.15.0 + + + + ch.qos.logback + logback-classic + + + + ch.qos.logback + logback-core + + + + + + org.springframework.boot + spring-boot-starter-mail + + + + + diff --git a/src/main/java/com/loglog/api/LogLogAppApplication.java b/src/main/java/com/loglog/api/LogLogAppApplication.java new file mode 100644 index 0000000..2e22938 --- /dev/null +++ b/src/main/java/com/loglog/api/LogLogAppApplication.java @@ -0,0 +1,45 @@ +package com.loglog.api; + +import org.mybatis.spring.annotation.MapperScan; +import org.springframework.boot.Banner; +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.context.annotation.ComponentScan; +import org.springframework.context.annotation.PropertySource; +import org.springframework.context.annotation.PropertySources; +import org.springframework.web.WebApplicationInitializer; + +import com.loglog.api.commons.constants.Constants; + + + + +@SpringBootApplication +@ComponentScan(basePackages= {Constants.COMM_PACKAGE, Constants.BASE_PACKAGE}) +@PropertySources({ + @PropertySource(value = "classpath:application.properties", ignoreResourceNotFound = false) +}) +@MapperScan(basePackages= {Constants.COMM_PACKAGE+".daos.mapper"}) +public class LogLogAppApplication extends SpringBootServletInitializer implements WebApplicationInitializer { + + public LogLogAppApplication() { + super(); + //error org.springframework.boot.web.servlet.support.errorpagefilter 硫붿떆吏� �븞�굹�삤寃� 泥섎━ + setRegisterErrorPageFilter(false); + } + + public static void main(String[] args) { + + SpringApplication app = new SpringApplication(LogLogAppApplication.class); + app.setBannerMode(Banner.Mode.OFF); + app.run(args); + } + + @Override + protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) { + return builder.sources(LogLogAppApplication.class); + } + +} diff --git a/src/main/java/com/loglog/api/commons/beans/AutoLoginBean.java b/src/main/java/com/loglog/api/commons/beans/AutoLoginBean.java new file mode 100644 index 0000000..c0489ec --- /dev/null +++ b/src/main/java/com/loglog/api/commons/beans/AutoLoginBean.java @@ -0,0 +1,46 @@ +package com.loglog.api.commons.beans; + +/** + * 자동로그인 Bean + * + * @author PCH + */ +public class AutoLoginBean extends CommonBean { + + /** 자동로그인 ID */ + private String autoLoginId; + /** 회원구분코드 ( 1 : 사용자, 2 : 판매자, 3 : 관리자 ) */ + private String memberTypeCd; + /** 회원ID */ + private String memberId; + /** 세션ID*/ + private String sessionId; + + + public String getAutoLoginId() { + return autoLoginId; + } + public void setAutoLoginId(String autoLoginId) { + this.autoLoginId = autoLoginId; + } + public String getMemberTypeCd() { + return memberTypeCd; + } + public void setMemberTypeCd(String memberTypeCd) { + this.memberTypeCd = memberTypeCd; + } + public String getMemberId() { + return memberId; + } + public void setMemberId(String memberId) { + this.memberId = memberId; + } + public String getSessionId() { + return sessionId; + } + public void setSessionId(String sessionId) { + this.sessionId = sessionId; + } + + +} \ No newline at end of file diff --git a/src/main/java/com/loglog/api/commons/beans/BoardApplyBean.java b/src/main/java/com/loglog/api/commons/beans/BoardApplyBean.java new file mode 100644 index 0000000..fdb60e7 --- /dev/null +++ b/src/main/java/com/loglog/api/commons/beans/BoardApplyBean.java @@ -0,0 +1,176 @@ +package com.loglog.api.commons.beans; + +/** + * 게시판 신청 Bean + * + * @author SJW + * @since 2018.06.08 + */ +public class BoardApplyBean extends CommonBean { + + private static final long serialVersionUID = -3271644440516180579L; + + private String bdTypeCd; + + /** 신청번호 */ + private int bdApplyNo; + + /** Board 순번 */ + private int bdNo; + + /** UserId */ + private String userId; + + /** User레벨 */ + private Integer userLevel; + + /** 신청자 유져명 */ + private String applyUserName; + + /** 신청타입 */ + private String applyType; + + /** 신청명 */ + private String applyName; + + /** 신청자 핸드폰 */ + private String applyHp; + + /** 신청자 이메일 */ + private String applyEmail; + + /** 신청자 우편번호 */ + private String applyZipcode; + + /** 신청자 주소 */ + private String applyAddr; + + /** 신청자 상품타입 */ + private String applyPrdType; + + /** 추천인 정 */ + private String applyRecommender; + + /** 기타 신청내용 */ + private String applyEtc; + + /** 총게시물 수 */ + private String contentCount; + + /** 총 신청 수 */ + private String applyCount; + + /** 관리자 여부 */ + private String adminYn; + + + public String getBdTypeCd() { + return bdTypeCd; + } + public void setBdTypeCd(String bdTypeCd) { + this.bdTypeCd = bdTypeCd; + } + public int getBdApplyNo() { + return bdApplyNo; + } + public void setBdApplyNo(int bdApplyNo) { + this.bdApplyNo = bdApplyNo; + } + public int getBdNo() { + return bdNo; + } + public void setBdNo(int bdNo) { + this.bdNo = bdNo; + } + public String getUserId() { + return userId; + } + public void setUserId(String userId) { + this.userId = userId; + } + public Integer getUserLevel() { + return userLevel; + } + public void setUserLevel(Integer userLevel) { + this.userLevel = userLevel; + } + public String getApplyUserName() { + return applyUserName; + } + public void setApplyUserName(String applyUserName) { + this.applyUserName = applyUserName; + } + public String getApplyType() { + return applyType; + } + public void setApplyType(String applyType) { + this.applyType = applyType; + } + public String getApplyName() { + return applyName; + } + public void setApplyName(String applyName) { + this.applyName = applyName; + } + public String getApplyHp() { + return applyHp; + } + public void setApplyHp(String applyHp) { + this.applyHp = applyHp; + } + public String getApplyEmail() { + return applyEmail; + } + public void setApplyEmail(String applyEmail) { + this.applyEmail = applyEmail; + } + public String getApplyZipcode() { + return applyZipcode; + } + public void setApplyZipcode(String applyZipcode) { + this.applyZipcode = applyZipcode; + } + public String getApplyAddr() { + return applyAddr; + } + public void setApplyAddr(String applyAddr) { + this.applyAddr = applyAddr; + } + public String getApplyRecommender() { + return applyRecommender; + } + public void setApplyRecommender(String applyRecommender) { + this.applyRecommender = applyRecommender; + } + public String getApplyPrdType() { + return applyPrdType; + } + public void setApplyPrdType(String applyPrdType) { + this.applyPrdType = applyPrdType; + } + public String getApplyEtc() { + return applyEtc; + } + public void setApplyEtc(String applyEtc) { + this.applyEtc = applyEtc; + } + public String getContentCount() { + return contentCount; + } + public void setContentCount(String contentCount) { + this.contentCount = contentCount; + } + public String getApplyCount() { + return applyCount; + } + public void setApplyCount(String applyCount) { + this.applyCount = applyCount; + } + public String getAdminYn() { + return adminYn; + } + public void setAdminYn(String adminYn) { + this.adminYn = adminYn; + } + +} diff --git a/src/main/java/com/loglog/api/commons/beans/BoardBean.java b/src/main/java/com/loglog/api/commons/beans/BoardBean.java new file mode 100644 index 0000000..c4e0b0c --- /dev/null +++ b/src/main/java/com/loglog/api/commons/beans/BoardBean.java @@ -0,0 +1,288 @@ +package com.loglog.api.commons.beans; + +import java.util.List; + +import org.springframework.web.multipart.MultipartFile; + + +public class BoardBean extends CommonBean { + + private static final long serialVersionUID = 3326779846408868973L; + + /** 순번*/ + private int bdNo; + + /** 게시판 유형 코드*/ + private String bdTypeCd; + + /** 공지사항여부*/ + private String bdNoticeYn; + + /** 비밀글여부*/ + private String bdSecretYn; + + /** 게시물 비밀번호 */ + private String bdPass; + + /** 카테고리 유형 코드*/ + private String bdCategoryCd; + + /** 제목*/ + private String bdTitle; + + /** 썸네일 이미지1 **/ + private String bdThumbImg1; + + /** 썸네일 이미지2 **/ + private String bdThumbImg2; + + /** 썸네일 업로드 파일 이미지1 **/ + private MultipartFile bdThumbImgFile1; + + /** 썸네일 업로드 이미지2 **/ + private MultipartFile bdThumbImgFile2; + + /** 이미지내용 */ + private String bdImgCont; + + /** 내용 */ + private String bdCont; + + /** 작성자ID */ + private String bdWriterId; + + /** 작성자 이름 */ + private String bdWriterName; + + /** 조회수*/ + private int bdHit; + + /** 답변여부*/ + private String bdReplyYn; + + /** 신청 가능여부*/ + private String bdApplyYn; + + /** 관리자 전용 게시판 여부(쓰기, 읽기) */ + private String bdAdminYn; + + /** 게시글 이미지 목록 조회 */ + private List boardImgList; + + /** 게시글 파일 목록 조회 */ + private List boardFileList; + + /** 답변 목록 */ + private List replyList; + + /** 게시글에 신청된 총 신청건수 */ + private String totApplyCount; + + /** 신청번호 */ + private String bdApplyNo; + + + //2023-06-18 + /* 게시글 이미지 */ + private String[] imgPath; + + /* 게시글 이미지 원본이름 */ + private String[] imgOriginName; + + /* 게시글 이미지 원본 사이즈 */ + private String[] imgSize; + + /* 게시글 파일 */ + private String[] filePath; + + /* 게시글 파일 원본이름 */ + private String[] fileOriginName; + + /* 게시글 파일 원본 사이즈 */ + private String[] fileSize; + + public MultipartFile getBdThumbImgFile1() { + return bdThumbImgFile1; + } + public void setBdThumbImgFile1(MultipartFile bdThumbImgFile1) { + this.bdThumbImgFile1 = bdThumbImgFile1; + } + public MultipartFile getBdThumbImgFile2() { + return bdThumbImgFile2; + } + public void setBdThumbImgFile2(MultipartFile bdThumbImgFile2) { + this.bdThumbImgFile2 = bdThumbImgFile2; + } + public String getBdThumbImg1() { + return bdThumbImg1; + } + public void setBdThumbImg1(String bdThumbImg1) { + this.bdThumbImg1 = bdThumbImg1; + } + public String getBdThumbImg2() { + return bdThumbImg2; + } + public void setBdThumbImg2(String bdThumbImg2) { + this.bdThumbImg2 = bdThumbImg2; + } + public int getBdNo() { + return bdNo; + } + public void setBdNo(int bdNo) { + this.bdNo = bdNo; + } + public String getBdTypeCd() { + return bdTypeCd; + } + public void setBdTypeCd(String bdTypeCd) { + this.bdTypeCd = bdTypeCd; + } + public String getBdNoticeYn() { + return bdNoticeYn; + } + public void setBdNoticeYn(String bdNoticeYn) { + this.bdNoticeYn = bdNoticeYn; + } + public String getBdSecretYn() { + return bdSecretYn; + } + public void setBdSecretYn(String bdSecretYn) { + this.bdSecretYn = bdSecretYn; + } + public String getBdPass() { + return bdPass; + } + public void setBdPass(String bdPass) { + this.bdPass = bdPass; + } + public String getBdCategoryCd() { + return bdCategoryCd; + } + public void setBdCategoryCd(String bdCategoryCd) { + this.bdCategoryCd = bdCategoryCd; + } + public String getBdTitle() { + return bdTitle; + } + public void setBdTitle(String bdTitle) { + this.bdTitle = bdTitle; + } + public String getBdCont() { + return bdCont; + } + public void setBdCont(String bdCont) { + this.bdCont = bdCont; + } + public String getBdWriterId() { + return bdWriterId; + } + public void setBdWriterId(String bdWriterId) { + this.bdWriterId = bdWriterId; + } + public String getBdWriterName() { + return bdWriterName; + } + public void setBdWriterName(String bdWriterName) { + this.bdWriterName = bdWriterName; + } + public int getBdHit() { + return bdHit; + } + public void setBdHit(int bdHit) { + this.bdHit = bdHit; + } + public String getBdReplyYn() { + return bdReplyYn; + } + public void setBdReplyYn(String bdReplyYn) { + this.bdReplyYn = bdReplyYn; + } + public String getBdApplyYn() { + return bdApplyYn; + } + public void setBdApplyYn(String bdApplyYn) { + this.bdApplyYn = bdApplyYn; + } + public List getBoardImgList() { + return boardImgList; + } + public void setBoardImgList(List boardImgList) { + this.boardImgList = boardImgList; + } + public List getBoardFileList() { + return boardFileList; + } + public void setBoardFileList(List boardFileList) { + this.boardFileList = boardFileList; + } + public List getReplyList() { + return replyList; + } + public void setReplyList(List replyList) { + this.replyList = replyList; + } + public String getBdImgCont() { + return bdImgCont; + } + public void setBdImgCont(String bdImgCont) { + this.bdImgCont = bdImgCont; + } + public String getTotApplyCount() { + return totApplyCount; + } + public void setTotApplyCount(String totApplyCount) { + this.totApplyCount = totApplyCount; + } + public String getBdApplyNo() { + return bdApplyNo; + } + public void setBdApplyNo(String bdApplyNo) { + this.bdApplyNo = bdApplyNo; + } + public String getBdAdminYn() { + return bdAdminYn; + } + public void setBdAdminYn(String bdAdminYn) { + this.bdAdminYn = bdAdminYn; + } + public String[] getImgPath() { + return imgPath; + } + public void setImgPath(String[] imgPath) { + this.imgPath = imgPath; + } + public String[] getImgOriginName() { + return imgOriginName; + } + public void setImgOriginName(String[] imgOriginName) { + this.imgOriginName = imgOriginName; + } + public String[] getImgSize() { + return imgSize; + } + public void setImgSize(String[] imgSize) { + this.imgSize = imgSize; + } + public String[] getFilePath() { + return filePath; + } + public void setFilePath(String[] filePath) { + this.filePath = filePath; + } + public String[] getFileOriginName() { + return fileOriginName; + } + public void setFileOriginName(String[] fileOriginName) { + this.fileOriginName = fileOriginName; + } + public String[] getFileSize() { + return fileSize; + } + public void setFileSize(String[] fileSize) { + this.fileSize = fileSize; + } + public static long getSerialversionuid() { + return serialVersionUID; + } + +} diff --git a/src/main/java/com/loglog/api/commons/beans/BoardFileBean.java b/src/main/java/com/loglog/api/commons/beans/BoardFileBean.java new file mode 100644 index 0000000..913b9e6 --- /dev/null +++ b/src/main/java/com/loglog/api/commons/beans/BoardFileBean.java @@ -0,0 +1,65 @@ +package com.loglog.api.commons.beans; + +public class BoardFileBean extends CommonBean { + + /** 게시판 파일 */ + private String bdFileNo; + /** 게시판번호 */ + private int bdNo; + /** 파일 경로 */ + private String filePath; + /** 파일 원본이름 */ + private String fileOriginName; + /** 파일 크기 */ + private String fileSize; + /** 예약번호 */ + private int reserveNo; + /** 교육신청번호 */ + private int eduNo; + + + public int getReserveNo() { + return reserveNo; + } + public void setReserveNo(int reserveNo) { + this.reserveNo = reserveNo; + } + public int getEduNo() { + return eduNo; + } + public void setEduNo(int eduNo) { + this.eduNo = eduNo; + } + public String getFileSize() { + return fileSize; + } + public void setFileSize(String fileSize) { + this.fileSize = fileSize; + } + public String getBdFileNo() { + return bdFileNo; + } + public void setBdFileNo(String bdFileNo) { + this.bdFileNo = bdFileNo; + } + public int getBdNo() { + return bdNo; + } + public void setBdNo(int bdNo) { + this.bdNo = bdNo; + } + public String getFilePath() { + return filePath; + } + public void setFilePath(String filePath) { + this.filePath = filePath; + } + public String getFileOriginName() { + return fileOriginName; + } + public void setFileOriginName(String fileOriginName) { + this.fileOriginName = fileOriginName; + } + + +} diff --git a/src/main/java/com/loglog/api/commons/beans/BoardImgBean.java b/src/main/java/com/loglog/api/commons/beans/BoardImgBean.java new file mode 100644 index 0000000..2b90f67 --- /dev/null +++ b/src/main/java/com/loglog/api/commons/beans/BoardImgBean.java @@ -0,0 +1,102 @@ +package com.loglog.api.commons.beans; + +/** + * 게시판 이미지 Bean + * @author "PCH" + * + */ +public class BoardImgBean extends CommonBean { + + /** 게시판이미지 */ + private String bdImgNo; + /** 게시글번호 */ + private int bdNo; + /** 이미지경로 */ + private String imgPath; + /** 이미지 원본이름 */ + private String imgOriginName; + /** 이미지크기 */ + private String imgSize; + /** 예약번호 */ + private int reserveNo; + /** 교육신청번호 */ + private int eduNo; + /** 썸네일 1 */ + private String thumbImg1; + /** 썸네일 2 */ + private String thumbImg2; + /** 썸네일1 원본이름 */ + private String imgOriginNameThumb; + /** 썸네일1 이미지크기*/ + private String imgSizeThumb; + + + + public String getImgOriginNameThumb() { + return imgOriginNameThumb; + } + public void setImgOriginNameThumb(String imgOriginNameThumb) { + this.imgOriginNameThumb = imgOriginNameThumb; + } + public String getImgSizeThumb() { + return imgSizeThumb; + } + public void setImgSizeThumb(String imgSizeThumb) { + this.imgSizeThumb = imgSizeThumb; + } + public String getThumbImg1() { + return thumbImg1; + } + public void setThumbImg1(String thumbImg1) { + this.thumbImg1 = thumbImg1; + } + public String getThumbImg2() { + return thumbImg2; + } + public void setThumbImg2(String thumbImg2) { + this.thumbImg2 = thumbImg2; + } + public int getReserveNo() { + return reserveNo; + } + public void setReserveNo(int reserveNo) { + this.reserveNo = reserveNo; + } + public int getEduNo() { + return eduNo; + } + public void setEduNo(int eduNo) { + this.eduNo = eduNo; + } + public String getBdImgNo() { + return bdImgNo; + } + public void setBdImgNo(String bdImgNo) { + this.bdImgNo = bdImgNo; + } + public int getBdNo() { + return bdNo; + } + public void setBdNo(int bdNo) { + this.bdNo = bdNo; + } + public String getImgPath() { + return imgPath; + } + public void setImgPath(String imgPath) { + this.imgPath = imgPath; + } + public String getImgOriginName() { + return imgOriginName; + } + public void setImgOriginName(String imgOriginName) { + this.imgOriginName = imgOriginName; + } + public String getImgSize() { + return imgSize; + } + public void setImgSize(String imgSize) { + this.imgSize = imgSize; + } + +} diff --git a/src/main/java/com/loglog/api/commons/beans/BoardReplyBean.java b/src/main/java/com/loglog/api/commons/beans/BoardReplyBean.java new file mode 100644 index 0000000..8922802 --- /dev/null +++ b/src/main/java/com/loglog/api/commons/beans/BoardReplyBean.java @@ -0,0 +1,82 @@ +package com.loglog.api.commons.beans; + +import java.util.List; + +public class BoardReplyBean extends CommonBean { + + /** 댓글번호 */ + private String replyNo; + /** 부모글번호 */ + private int bdNo; + /** 내용 */ + private String replyCont; + /** 작성자ID */ + private String replyWriterId; + /** 작성자이름 */ + private String replyWriterName; + /** 작성자 Level */ + private int replyWriterLevel; + /** 작성자이름 */ + private String secretYn; + /** 댓글 비밀번호 */ + private String replyPass; + /** 관리자여부 */ + private String adminYn; + + private List boardreplyList; + public String getReplyNo() { + return replyNo; + } + public void setReplyNo(String replyNo) { + this.replyNo = replyNo; + } + public int getBdNo() { + return bdNo; + } + public void setBdNo(int bdNo) { + this.bdNo = bdNo; + } + public String getReplyCont() { + return replyCont; + } + public void setReplyCont(String replyCont) { + this.replyCont = replyCont; + } + public String getReplyWriterId() { + return replyWriterId; + } + public void setReplyWriterId(String replyWriterId) { + this.replyWriterId = replyWriterId; + } + public String getReplyWriterName() { + return replyWriterName; + } + public void setReplyWriterName(String replyWriterName) { + this.replyWriterName = replyWriterName; + } + public String getSecretYn() { + return secretYn; + } + public void setSecretYn(String secretYn) { + this.secretYn = secretYn; + } + public int getReplyWriterLevel() { + return replyWriterLevel; + } + public void setReplyWriterLevel(int replyWriterLevel) { + this.replyWriterLevel = replyWriterLevel; + } + public String getReplyPass() { + return replyPass; + } + public void setReplyPass(String replyPass) { + this.replyPass = replyPass; + } + public String getAdminYn() { + return adminYn; + } + public void setAdminYn(String adminYn) { + this.adminYn = adminYn; + } + +} diff --git a/src/main/java/com/loglog/api/commons/beans/CalenderBean.java b/src/main/java/com/loglog/api/commons/beans/CalenderBean.java new file mode 100644 index 0000000..57956c2 --- /dev/null +++ b/src/main/java/com/loglog/api/commons/beans/CalenderBean.java @@ -0,0 +1,287 @@ + package com.loglog.api.commons.beans; + +/** + * 사용자 Bean + * 내점기록에 사용될 Bean trn0012가 메인이다 + * @author SJG + */ +public class CalenderBean extends CommonBean { + + /** 입력코드*/ + private String insuserCd; + + /** 저장시간*/ + private String insdatetime; + + /** 업데이트 코드*/ + private String upduserCd; + + /** 업데이트 시간*/ + private String updatetime; + + /** 사용자코드*/ + private String userCd; + + /** 상점 코드*/ + private String shopCd; + + /** 상점이름*/ + private String shopNm; + + /** 내점시간 */ + private String raitenTime; + + /** 내점시간변경 */ + private String raitenChange; + + /**메모 변경*/ + private String nikkiTitleChange; + + /** 메모 제목*/ + private String nikkiTitle; + + /** 메모 내용*/ + private String nikkiText; + + /** 썸네일1*/ + private String thumbnail1; + + /** 썸네일2*/ + private String thumbnail2; + + /** 썸네일2*/ + private String thumbnail3; + + /** 협업 카테고리*/ + private String connectKbn; + + /** 협업 카테고리*/ + private String url; + + /** 협업 카테고리*/ + private String location; + + /** 협업 카테고리*/ + private String endRaitenTime; + + /** 협업 카테고리*/ + private String color; + + /** 협업 카테고리*/ + private String allday; + + /** 월별조회 */ + private String inputMon; + + /** 월별조회 */ + private String startMon; + + /** 월별조회 */ + private String endMon; + + /** 업데이트 안한 이미지 URL 리스트 */ + private String noteUpdatedImgUrlList; + + + public String getInsuserCd() { + return insuserCd; + } + + public void setInsuserCd(String insuserCd) { + this.insuserCd = insuserCd; + } + + public String getInsdatetime() { + return insdatetime; + } + + public void setInsdatetime(String insdatetime) { + this.insdatetime = insdatetime; + } + + public String getUpduserCd() { + return upduserCd; + } + + public void setUpduserCd(String upduserCd) { + this.upduserCd = upduserCd; + } + + public String getUpdatetime() { + return updatetime; + } + + public void setUpdatetime(String updatetime) { + this.updatetime = updatetime; + } + + public String getUserCd() { + return userCd; + } + + public void setUserCd(String userCd) { + this.userCd = userCd; + } + + public String getShopCd() { + return shopCd; + } + + public void setShopCd(String shopCd) { + this.shopCd = shopCd; + } + + public String getShopNm() { + return shopNm; + } + + public void setShopNm(String shopNm) { + this.shopNm = shopNm; + } + + public String getRaitenTime() { + return raitenTime; + } + + public void setRaitenTime(String raitenTime) { + this.raitenTime = raitenTime; + } + + public String getRaitenChange() { + return raitenChange; + } + + public void setRaitenChange(String raitenChange) { + this.raitenChange = raitenChange; + } + + public String getNikkiTitle() { + return nikkiTitle; + } + + public void setNikkiTitle(String nikkiTitle) { + this.nikkiTitle = nikkiTitle; + } + + public String getNikkiText() { + return nikkiText; + } + + public void setNikkiText(String nikkiText) { + this.nikkiText = nikkiText; + } + + public String getThumbnail1() { + return thumbnail1; + } + + public void setThumbnail1(String thumbnail1) { + this.thumbnail1 = thumbnail1; + } + + public String getThumbnail2() { + return thumbnail2; + } + + public void setThumbnail2(String thumbnail2) { + this.thumbnail2 = thumbnail2; + } + + public String getThumbnail3() { + return thumbnail3; + } + + public void setThumbnail3(String thumbnail3) { + this.thumbnail3 = thumbnail3; + } + + public String getConnectKbn() { + return connectKbn; + } + + public void setConnectKbn(String connectKbn) { + this.connectKbn = connectKbn; + } + + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + public String getLocation() { + return location; + } + + public void setLocation(String location) { + this.location = location; + } + + public String getEndRaitenTime() { + return endRaitenTime; + } + + public void setEndRaitenTime(String endRaitenTime) { + this.endRaitenTime = endRaitenTime; + } + + public String getColor() { + return color; + } + + public void setColor(String color) { + this.color = color; + } + + public String getAllday() { + return allday; + } + + public void setAllday(String allday) { + this.allday = allday; + } + + public String getInputMon() { + return inputMon; + } + + public void setInputMon(String inputMon) { + this.inputMon = inputMon; + } + + public String getStartMon() { + return startMon; + } + + public void setStartMon(String startMon) { + this.startMon = startMon; + } + + public String getEndMon() { + return endMon; + } + + public void setEndMon(String endMon) { + this.endMon = endMon; + } + + private String getNikkiTitleChange() { + return nikkiTitleChange; + } + + private void setNikkiTitleChange(String nikkiTitleChange) { + this.nikkiTitleChange = nikkiTitleChange; + } + + public String getNoteUpdatedImgUrlList() { + return noteUpdatedImgUrlList; + } + + public void setNoteUpdatedImgUrlList(String noteUpdatedImgUrlList) { + this.noteUpdatedImgUrlList = noteUpdatedImgUrlList; + } + +} \ No newline at end of file diff --git a/src/main/java/com/loglog/api/commons/beans/CardImgBean.java b/src/main/java/com/loglog/api/commons/beans/CardImgBean.java new file mode 100644 index 0000000..52cfa56 --- /dev/null +++ b/src/main/java/com/loglog/api/commons/beans/CardImgBean.java @@ -0,0 +1,62 @@ +package com.loglog.api.commons.beans; + + +/** + * 공지사항 Bean + * mst0017를 참조하는 Bean + * @author "JIK" + * + */ +public class CardImgBean { + + /** 이미지경로 */ + private String imgPath; + /** 이미지 원본이름 */ + private String imgOriginName; + /** 이미지크기 */ + private String imgSize; + /** 썸네일 1 */ + private String thumbImg1; + /** 썸네일1 원본이름 */ + private String imgOriginNameThumb; + /** 썸네일1 이미지크기*/ + private String imgSizeThumb; + public String getImgPath() { + return imgPath; + } + public void setImgPath(String imgPath) { + this.imgPath = imgPath; + } + public String getImgOriginName() { + return imgOriginName; + } + public void setImgOriginName(String imgOriginName) { + this.imgOriginName = imgOriginName; + } + public String getImgSize() { + return imgSize; + } + public void setImgSize(String imgSize) { + this.imgSize = imgSize; + } + public String getThumbImg1() { + return thumbImg1; + } + public void setThumbImg1(String thumbImg1) { + this.thumbImg1 = thumbImg1; + } + public String getImgOriginNameThumb() { + return imgOriginNameThumb; + } + public void setImgOriginNameThumb(String imgOriginNameThumb) { + this.imgOriginNameThumb = imgOriginNameThumb; + } + public String getImgSizeThumb() { + return imgSizeThumb; + } + public void setImgSizeThumb(String imgSizeThumb) { + this.imgSizeThumb = imgSizeThumb; + } + + +} \ No newline at end of file diff --git a/src/main/java/com/loglog/api/commons/beans/CardMasterBean.java b/src/main/java/com/loglog/api/commons/beans/CardMasterBean.java new file mode 100644 index 0000000..cde110f --- /dev/null +++ b/src/main/java/com/loglog/api/commons/beans/CardMasterBean.java @@ -0,0 +1,236 @@ +package com.loglog.api.commons.beans; + +import org.springframework.web.multipart.MultipartFile; +import java.util.List; + +/** + * 공지사항 Bean + * mst0017를 참조하는 Bean + * @author "JIK" + * + */ +public class CardMasterBean extends CommonBean { + + /** 유저코드 */ + private String userCd; + + /** 코드업데이트 */ + private String upduserCd; + + /** 최종 갱신일 */ + private String upDate; + + /** 업데이트시간 */ + private String updatetime; + + /** 상점그룹코드 */ + private String shopGroupCd; + + /** 상점 코드 */ + private String shopCd; + + /** 현재포인트 */ + private int nowPoint; + + /** 메일주소2 */ + private String mailAddr2; + + /** 메일주소 */ + private String mailAddr; + + /** */ + private String janNo; + + /** 입력코드 */ + private String insuserCd; + + /** 최종내점일 */ + private String eDate; + + /** 좋아요 유무 */ + private String custCd; + + /** 카드이름 */ + private String cardNm; + + /** 카드이미지 */ + private String cardImage; + + /** 바코드번호 */ + private String barcodeKbn; + + /** 바꿀 카드이름 */ + private String chanCardNm; + + /** 바꿀 카드번호 */ + private String chanJanNo; + + /** 추가되는 포인트값 */ + private int point; + + /**상점 이름*/ + private String shopNm; + + public String getUserCd() { + return userCd; + } + + public void setUserCd(String userCd) { + this.userCd = userCd; + } + + public String getUpduserCd() { + return upduserCd; + } + + public void setUpduserCd(String upduserCd) { + this.upduserCd = upduserCd; + } + + public String getUpDate() { + return upDate; + } + + public void setUpDate(String upDate) { + this.upDate = upDate; + } + + + public String getUpdatetime() { + return updatetime; + } + + public void setUpdatetime(String updatetime) { + this.updatetime = updatetime; + } + + public String getShopGroupCd() { + return shopGroupCd; + } + + public void setShopGroupCd(String shopGroupCd) { + this.shopGroupCd = shopGroupCd; + } + + public String getShopCd() { + return shopCd; + } + + public void setShopCd(String shopCd) { + this.shopCd = shopCd; + } + + public int getNowPoint() { + return nowPoint; + } + + public void setNowPoint(int nowPoint) { + this.nowPoint = nowPoint; + } + + public String getMailAddr2() { + return mailAddr2; + } + + public void setMailAddr2(String mailAddr2) { + this.mailAddr2 = mailAddr2; + } + + public String getMailAddr() { + return mailAddr; + } + + public void setMailAddr(String mailAddr) { + this.mailAddr = mailAddr; + } + + public String getJanNo() { + return janNo; + } + + public void setJanNo(String janNo) { + this.janNo = janNo; + } + + public String getInsuserCd() { + return insuserCd; + } + + public void setInsuserCd(String insuserCd) { + this.insuserCd = insuserCd; + } + + public String geteDate() { + return eDate; + } + + public void seteDate(String eDate) { + this.eDate = eDate; + } + + public String getCustCd() { + return custCd; + } + + public void setCustCd(String custCd) { + this.custCd = custCd; + } + + public String getCardNm() { + return cardNm; + } + + public void setCardNm(String cardNm) { + this.cardNm = cardNm; + } + + public String getCardImage() { + return cardImage; + } + + public void setCardImage(String cardImage) { + this.cardImage = cardImage; + } + + public String getBarcodeKbn() { + return barcodeKbn; + } + + public void setBarcodeKbn(String barcodeKbn) { + this.barcodeKbn = barcodeKbn; + } + + public String getChanCardNm() { + return chanCardNm; + } + + public void setChanCardNm(String chanCardNm) { + this.chanCardNm = chanCardNm; + } + + public String getChanJanNo() { + return chanJanNo; + } + + public void setChanJanNo(String chanJanNo) { + this.chanJanNo = chanJanNo; + } + + public int getPoint() { + return point; + } + + public void setPoint(int point) { + this.point = point; + } + + public String getShopNm() { + return shopNm; + } + + public void setShopNm(String shopNm) { + this.shopNm = shopNm; + } + + +} \ No newline at end of file diff --git a/src/main/java/com/loglog/api/commons/beans/CategoryBean.java b/src/main/java/com/loglog/api/commons/beans/CategoryBean.java new file mode 100644 index 0000000..59a30a2 --- /dev/null +++ b/src/main/java/com/loglog/api/commons/beans/CategoryBean.java @@ -0,0 +1,45 @@ + package com.loglog.api.commons.beans; + +/** + * 사용자 Bean + * 내점기록에 사용될 Bean trn0012가 메인이다 + * @author SJG + */ +public class CategoryBean extends CommonBean { + + /**카테고리 코드*/ + private String categoryCd; + + /**카테고리 이름*/ + private String categoryNm; + + /**카테고리 이미지*/ + private String categoryImg; + + public String getCategoryCd() { + return categoryCd; + } + + public void setCategoryCd(String categoryCd) { + this.categoryCd = categoryCd; + } + + public String getCategoryNm() { + return categoryNm; + } + + public void setCategoryNm(String categoryNm) { + this.categoryNm = categoryNm; + } + + public String getCategoryImg() { + return categoryImg; + } + + public void setCategoryImg(String categoryImg) { + this.categoryImg = categoryImg; + } + + + +} \ No newline at end of file diff --git a/src/main/java/com/loglog/api/commons/beans/CommonBean.java b/src/main/java/com/loglog/api/commons/beans/CommonBean.java new file mode 100644 index 0000000..30dab9b --- /dev/null +++ b/src/main/java/com/loglog/api/commons/beans/CommonBean.java @@ -0,0 +1,64 @@ +package com.loglog.api.commons.beans; + +import java.io.Serializable; + +/** + * 공통 Bean + * + * @author SJG + */ +public class CommonBean implements Serializable { + + /** 토큰 **/ + private String authToken; + /** 생성날짜 **/ + private String regDt; + /** 수정날짜 **/ + private String updDt; + /** 로그인 후 이동할 URL */ + private String resultUrl; + /** BASE Img URL */ + private String baseImgUrl; + + /** BASE Img URL2 */ + private String baseImgUrl2; + + public String getAuthToken() { + return authToken; + } + public void setAuthToken(String authToken) { + this.authToken = authToken; + } + public String getRegDt() { + return regDt; + } + public void setRegDt(String regDt) { + this.regDt = regDt; + } + public String getUpdDt() { + return updDt; + } + public void setUpdDt(String updDt) { + this.updDt = updDt; + } + public String getResultUrl() { + return resultUrl; + } + public void setResultUrl(String resultUrl) { + this.resultUrl = resultUrl; + } + public String getBaseImgUrl() { + return baseImgUrl; + } + public void setBaseImgUrl(String baseImgUrl) { + this.baseImgUrl = baseImgUrl; + } + public String getBaseImgUrl2() { + return baseImgUrl2; + } + public void setBaseImgUrl2(String baseImgUrl2) { + this.baseImgUrl2 = baseImgUrl2; + } + + +} diff --git a/src/main/java/com/loglog/api/commons/beans/CouponLikedBean.java b/src/main/java/com/loglog/api/commons/beans/CouponLikedBean.java new file mode 100644 index 0000000..167660c --- /dev/null +++ b/src/main/java/com/loglog/api/commons/beans/CouponLikedBean.java @@ -0,0 +1,34 @@ + package com.loglog.api.commons.beans; + +/** + * 사용자 Bean + * + * @author SJG + */ +public class CouponLikedBean extends CommonBean { + + private static final long serialVersionUID = -8015604660465562829L; + + /** 고유 쿠폰번호 */ + private int uniqueCouponCd; + + /** 사용자번호 */ + private String userCd; + + public int getUniqueCouponCd() { + return uniqueCouponCd; + } + + public void setUniqueCouponCd(int uniqueCouponCd) { + this.uniqueCouponCd = uniqueCouponCd; + } + + public String getUserCd() { + return userCd; + } + + public void setUserCd(String userCd) { + this.userCd = userCd; + } + +} \ No newline at end of file diff --git a/src/main/java/com/loglog/api/commons/beans/CouponMasterBean.java b/src/main/java/com/loglog/api/commons/beans/CouponMasterBean.java new file mode 100644 index 0000000..d89d306 --- /dev/null +++ b/src/main/java/com/loglog/api/commons/beans/CouponMasterBean.java @@ -0,0 +1,254 @@ + package com.loglog.api.commons.beans; + +/** + * 사용자 Bean + * + * @author SJG + */ +public class CouponMasterBean extends CommonBean { + + private static final long serialVersionUID = -8015604660465562829L; + /** 등록 된 코드 */ + private String insuserCd; + + /** 코드 업데이트 */ + private String upduserCd; + + /** 저장 코드 */ + private String shopCd; + + /** 쿠폰 코드 */ + private String couponCd; + + /** 상품명 */ + private String couponGoods; + + /** 만료일 (시작) */ + private String effectSrt; + + /** 만료일 (종료) */ + private String effectEnd; + + /** 할인 가격 */ + private String couponDiscount; + + /** 썸네일 사진 1 */ + private String thumbnail1; + + /** 썸네일 사진 2 */ + private String thumbnail2; + + /** 썸네일 사진 3 */ + private String thumbnail3; + + /** 사용자 코드 */ + private String userCd; + + /** 협업 카테고리 */ + private String connectKbn; + + /** 사용 된 카테고리 */ + private String used; + + /** 배경 */ + private String background; + + /** 색상 */ + private String color; + + /** 지사 */ + private String prefecture; + + /** 나이 */ + private String age; + + /** 성별 */ + private String gender; + + /** 생일 */ + private String birthday; + + /** 랭킹 */ + private String rank; + + /** 내점조건 */ + private String visitCondition; + + public String getInsuserCd() { + return insuserCd; + } + + public void setInsuserCd(String insuserCd) { + this.insuserCd = insuserCd; + } + + public String getUpduserCd() { + return upduserCd; + } + + public void setUpduserCd(String upduserCd) { + this.upduserCd = upduserCd; + } + + public String getShopCd() { + return shopCd; + } + + public void setShopCd(String shopCd) { + this.shopCd = shopCd; + } + + public String getCouponCd() { + return couponCd; + } + + public void setCouponCd(String couponCd) { + this.couponCd = couponCd; + } + + public String getCouponGoods() { + return couponGoods; + } + + public void setCouponGoods(String couponGoods) { + this.couponGoods = couponGoods; + } + + public String getEffectSrt() { + return effectSrt; + } + + public void setEffectSrt(String effectSrt) { + this.effectSrt = effectSrt; + } + + public String getEffectEnd() { + return effectEnd; + } + + public void setEffectEnd(String effectEnd) { + this.effectEnd = effectEnd; + } + + public String getCouponDiscount() { + return couponDiscount; + } + + public void setCouponDiscount(String couponDiscount) { + this.couponDiscount = couponDiscount; + } + + public String getThumbnail1() { + return thumbnail1; + } + + public void setThumbnail1(String thumbnail1) { + this.thumbnail1 = thumbnail1; + } + + public String getThumbnail2() { + return thumbnail2; + } + + public void setThumbnail2(String thumbnail2) { + this.thumbnail2 = thumbnail2; + } + + public String getThumbnail3() { + return thumbnail3; + } + + public void setThumbnail3(String thumbnail3) { + this.thumbnail3 = thumbnail3; + } + + public String getUserCd() { + return userCd; + } + + public void setUserCd(String userCd) { + this.userCd = userCd; + } + + public String getConnectKbn() { + return connectKbn; + } + + public void setConnectKbn(String connectKbn) { + this.connectKbn = connectKbn; + } + + public String getUsed() { + return used; + } + + public void setUsed(String used) { + this.used = used; + } + + public String getBackground() { + return background; + } + + public void setBackground(String background) { + this.background = background; + } + + public String getColor() { + return color; + } + + public void setColor(String color) { + this.color = color; + } + + public String getPrefecture() { + return prefecture; + } + + public void setPrefecture(String prefecture) { + this.prefecture = prefecture; + } + + public String getAge() { + return age; + } + + public void setAge(String age) { + this.age = age; + } + + public String getGender() { + return gender; + } + + public void setGender(String gender) { + this.gender = gender; + } + + public String getBirthday() { + return birthday; + } + + public void setBirthday(String birthday) { + this.birthday = birthday; + } + + public String getRank() { + return rank; + } + + public void setRank(String rank) { + this.rank = rank; + } + + public String getVisitCondition() { + return visitCondition; + } + + public void setVisitCondition(String visitCondition) { + this.visitCondition = visitCondition; + } + + +} \ No newline at end of file diff --git a/src/main/java/com/loglog/api/commons/beans/CouponPublicBean.java b/src/main/java/com/loglog/api/commons/beans/CouponPublicBean.java new file mode 100644 index 0000000..3dab640 --- /dev/null +++ b/src/main/java/com/loglog/api/commons/beans/CouponPublicBean.java @@ -0,0 +1,452 @@ + package com.loglog.api.commons.beans; + +/** + * 사용자 Bean + * + * @author SJG + */ +public class CouponPublicBean extends CommonBean { + + private static final long serialVersionUID = -8015604660465562829L; + + /**유저 코드*/ + private String userCd; + + /**쿠폰 조회 타입*/ + private String type; + + /** 쿠폰 코드 */ + private int uniqueCouponCd; + + /**매장 코드*/ + private String shopCd; + + /**만료일 (시작)*/ + private String effectSrt; + + /**만료일 (종료)*/ + private String effectEnd; + + /**쿠폰이름*/ + private String couponGoods; + + /**쿠폰내용*/ + private String couponDiscount; + + /**상점이미지*/ + private String shopimage; + + /**썸네일 사진 1*/ + private String thumbnail1; + + /**썸네일 사진 2*/ + private String thumbnail2; + + /**썸네일 사진 3*/ + private String thumbnail3; + + /**???*/ + private String connectKbn; + + /**카테고리코드*/ + private String categoryCd; + + /**배경색*/ + private String background; + + /**색코드*/ + private String color; + + /**지사*/ + private String prefecture; + + /**나이*/ + private String age; + + /**성별*/ + private String gender; + + /**생일*/ + private String birthday; + + /**랭킹*/ + private String rank; + + /**내점 조건*/ + private String visitCondition; + + /**쿠폰 코드*/ + private int couponCd; + + /**지방 자치 단체*/ + private String municipality; + + /** 가게의 날*/ + private String visitWithin; + + /**내점 유무*/ + private String visitOrNot; + + /**배포된 쿠폰 코드*/ + private String sentCouponCd; + + /**배포된 쿠폰 상태*/ + private String sentCouponStatus; + + /**타점 이용 점포 코드 1*/ + private String shopCd1; + + /**타점 이용 점포 코드 2*/ + private String shopCd2; + + /**타점 이용 점포 코드 3*/ + private String shopCd3; + + /**타점 이용 점포 코드 4*/ + private String shopCd4; + + /**타점 이용 점포 코드 5*/ + private String shopCd5; + + /**타점 이용 점포 코드 6*/ + private String shopCd6; + + /**타점 이용 점포 코드 7*/ + private String shopCd7; + + /**타점 이용 점포 코드 8*/ + private String shopCd8; + + /**타점 이용 점포 코드 9*/ + private String shopCd9; + + /**타점 이용 점포 코드 10*/ + private String shopCd10; + + /**유료 맴버*/ + private int paidMember; + + /**좋아요 유무*/ + private int liked; + + public String getUserCd() { + return userCd; + } + + public void setUserCd(String userCd) { + this.userCd = userCd; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public int getUniqueCouponCd() { + return uniqueCouponCd; + } + + public void setUniqueCouponCd(int uniqueCouponCd) { + this.uniqueCouponCd = uniqueCouponCd; + } + + public String getShopCd() { + return shopCd; + } + + public void setShopCd(String shopCd) { + this.shopCd = shopCd; + } + + public String getEffectSrt() { + return effectSrt; + } + + public void setEffectSrt(String effectSrt) { + this.effectSrt = effectSrt; + } + + public String getEffectEnd() { + return effectEnd; + } + + public void setEffectEnd(String effectEnd) { + this.effectEnd = effectEnd; + } + + public String getCouponGoods() { + return couponGoods; + } + + public void setCouponGoods(String couponGoods) { + this.couponGoods = couponGoods; + } + + public String getCouponDiscount() { + return couponDiscount; + } + + public void setCouponDiscount(String couponDiscount) { + this.couponDiscount = couponDiscount; + } + + public String getShopimage() { + return shopimage; + } + + public void setShopimage(String shopimage) { + this.shopimage = shopimage; + } + + public String getThumbnail1() { + return thumbnail1; + } + + public void setThumbnail1(String thumbnail1) { + this.thumbnail1 = thumbnail1; + } + + public String getThumbnail2() { + return thumbnail2; + } + + public void setThumbnail2(String thumbnail2) { + this.thumbnail2 = thumbnail2; + } + + public String getThumbnail3() { + return thumbnail3; + } + + public void setThumbnail3(String thumbnail3) { + this.thumbnail3 = thumbnail3; + } + + public String getConnectKbn() { + return connectKbn; + } + + public void setConnectKbn(String connectKbn) { + this.connectKbn = connectKbn; + } + + public String getCategoryCd() { + return categoryCd; + } + + public void setCategoryCd(String categoryCd) { + this.categoryCd = categoryCd; + } + + public String getBackground() { + return background; + } + + public void setBackground(String background) { + this.background = background; + } + + public String getColor() { + return color; + } + + public void setColor(String color) { + this.color = color; + } + + public String getPrefecture() { + return prefecture; + } + + public void setPrefecture(String prefecture) { + this.prefecture = prefecture; + } + + public String getAge() { + return age; + } + + public void setAge(String age) { + this.age = age; + } + + public String getGender() { + return gender; + } + + public void setGender(String gender) { + this.gender = gender; + } + + public String getBirthday() { + return birthday; + } + + public void setBirthday(String birthday) { + this.birthday = birthday; + } + + public String getRank() { + return rank; + } + + public void setRank(String rank) { + this.rank = rank; + } + + public String getVisitCondition() { + return visitCondition; + } + + public void setVisitCondition(String visitCondition) { + this.visitCondition = visitCondition; + } + + public int getCouponCd() { + return couponCd; + } + + public void setCouponCd(int couponCd) { + this.couponCd = couponCd; + } + + public String getMunicipality() { + return municipality; + } + + public void setMunicipality(String municipality) { + this.municipality = municipality; + } + + public String getVisitWithin() { + return visitWithin; + } + + public void setVisitWithin(String visitWithin) { + this.visitWithin = visitWithin; + } + + public String getVisitOrNot() { + return visitOrNot; + } + + public void setVisitOrNot(String visitOrNot) { + this.visitOrNot = visitOrNot; + } + + public String getSentCouponCd() { + return sentCouponCd; + } + + public void setSentCouponCd(String sentCouponCd) { + this.sentCouponCd = sentCouponCd; + } + + public String getSentCouponStatus() { + return sentCouponStatus; + } + + public void setSentCouponStatus(String sentCouponStatus) { + this.sentCouponStatus = sentCouponStatus; + } + + public String getShopCd1() { + return shopCd1; + } + + public void setShopCd1(String shopCd1) { + this.shopCd1 = shopCd1; + } + + public String getShopCd2() { + return shopCd2; + } + + public void setShopCd2(String shopCd2) { + this.shopCd2 = shopCd2; + } + + public String getShopCd3() { + return shopCd3; + } + + public void setShopCd3(String shopCd3) { + this.shopCd3 = shopCd3; + } + + public String getShopCd4() { + return shopCd4; + } + + public void setShopCd4(String shopCd4) { + this.shopCd4 = shopCd4; + } + + public String getShopCd5() { + return shopCd5; + } + + public void setShopCd5(String shopCd5) { + this.shopCd5 = shopCd5; + } + + public String getShopCd6() { + return shopCd6; + } + + public void setShopCd6(String shopCd6) { + this.shopCd6 = shopCd6; + } + + public String getShopCd7() { + return shopCd7; + } + + public void setShopCd7(String shopCd7) { + this.shopCd7 = shopCd7; + } + + public String getShopCd8() { + return shopCd8; + } + + public void setShopCd8(String shopCd8) { + this.shopCd8 = shopCd8; + } + + public String getShopCd9() { + return shopCd9; + } + + public void setShopCd9(String shopCd9) { + this.shopCd9 = shopCd9; + } + + public String getShopCd10() { + return shopCd10; + } + + public void setShopCd10(String shopCd10) { + this.shopCd10 = shopCd10; + } + + public int getPaidMember() { + return paidMember; + } + + public void setPaidMember(int paidMember) { + this.paidMember = paidMember; + } + + public int getLiked() { + return liked; + } + + public void setLiked(int liked) { + this.liked = liked; + } + +} \ No newline at end of file diff --git a/src/main/java/com/loglog/api/commons/beans/CouponUsedBean.java b/src/main/java/com/loglog/api/commons/beans/CouponUsedBean.java new file mode 100644 index 0000000..a44ec33 --- /dev/null +++ b/src/main/java/com/loglog/api/commons/beans/CouponUsedBean.java @@ -0,0 +1,23 @@ + package com.loglog.api.commons.beans; + +/** + * 사용자 Bean + * + * @author SJG + */ +public class CouponUsedBean extends CommonBean { + + private static final long serialVersionUID = -8015604660465562829L; + /** 고유 쿠폰번호 */ + private int unique_coupon_cd; + + /** 사용자번호 */ + private String user_cd; + + /** 사용여부 */ + private int used; + + /** ?? */ + private String seen; + +} \ No newline at end of file diff --git a/src/main/java/com/loglog/api/commons/beans/CouponUserListBean.java b/src/main/java/com/loglog/api/commons/beans/CouponUserListBean.java new file mode 100644 index 0000000..391225c --- /dev/null +++ b/src/main/java/com/loglog/api/commons/beans/CouponUserListBean.java @@ -0,0 +1,166 @@ + package com.loglog.api.commons.beans; + +/** + * 사용자 Bean + * getCouponAjax를 받기위한 Bean + * @author SJG + */ +public class CouponUserListBean extends CommonBean { + + private String shopCd; + private String shopAdd1; + private String shopAdd2; + private String couponCd; + private String shopNm; + private String categoryCd; + private String couponGoods; + private String effectSrt; + private String effectEnd; + private String couponDiscount; + private String shopimage; + private String thumbnail1; + private String thumbnail2; + private String thumbnail3; + private String connectKbn; + private String used; + private String color; + private String visitCondition; + private String proximity; + private String liked; + private String shopThumbNail1; + private String couponThumbnail1; + + public String getShopCd() { + return shopCd; + } + public void setShopCd(String shopCd) { + this.shopCd = shopCd; + } + public String getShopAdd1() { + return shopAdd1; + } + public void setShopAdd1(String shopAdd1) { + this.shopAdd1 = shopAdd1; + } + public String getShopAdd2() { + return shopAdd2; + } + public void setShopAdd2(String shopAdd2) { + this.shopAdd2 = shopAdd2; + } + public String getCouponCd() { + return couponCd; + } + public void setCouponCd(String couponCd) { + this.couponCd = couponCd; + } + public String getShopNm() { + return shopNm; + } + public void setShopNm(String shopNm) { + this.shopNm = shopNm; + } + public String getCategoryCd() { + return categoryCd; + } + public void setCategoryCd(String categoryCd) { + this.categoryCd = categoryCd; + } + public String getCouponGoods() { + return couponGoods; + } + public void setCouponGoods(String couponGoods) { + this.couponGoods = couponGoods; + } + public String getEffectSrt() { + return effectSrt; + } + public void setEffectSrt(String effectSrt) { + this.effectSrt = effectSrt; + } + public String getEffectEnd() { + return effectEnd; + } + public void setEffectEnd(String effectEnd) { + this.effectEnd = effectEnd; + } + public String getCouponDiscount() { + return couponDiscount; + } + public void setCouponDiscount(String couponDiscount) { + this.couponDiscount = couponDiscount; + } + public String getShopimage() { + return shopimage; + } + public void setShopimage(String shopimage) { + this.shopimage = shopimage; + } + public String getThumbnail1() { + return thumbnail1; + } + public void setThumbnail1(String thumbnail1) { + this.thumbnail1 = thumbnail1; + } + public String getThumbnail2() { + return thumbnail2; + } + public void setThumbnail2(String thumbnail2) { + this.thumbnail2 = thumbnail2; + } + public String getThumbnail3() { + return thumbnail3; + } + public void setThumbnail3(String thumbnail3) { + this.thumbnail3 = thumbnail3; + } + public String getConnectKbn() { + return connectKbn; + } + public void setConnectKbn(String connectKbn) { + this.connectKbn = connectKbn; + } + public String getUsed() { + return used; + } + public void setUsed(String used) { + this.used = used; + } + public String getColor() { + return color; + } + public void setColor(String color) { + this.color = color; + } + public String getVisitCondition() { + return visitCondition; + } + public void setVisitCondition(String visitCondition) { + this.visitCondition = visitCondition; + } + public String getProximity() { + return proximity; + } + public void setProximity(String proximity) { + this.proximity = proximity; + } + public String getLiked() { + return liked; + } + public void setLiked(String liked) { + this.liked = liked; + } + public String getShopThumbNail1() { + return shopThumbNail1; + } + public void setShopThumbNail1(String shopThumbNail1) { + this.shopThumbNail1 = shopThumbNail1; + } + public String getCouponThumbnail1() { + return couponThumbnail1; + } + public void setCouponThumbnail1(String couponThumbnail1) { + this.couponThumbnail1 = couponThumbnail1; + } + +} \ No newline at end of file diff --git a/src/main/java/com/loglog/api/commons/beans/GeolocationBean.java b/src/main/java/com/loglog/api/commons/beans/GeolocationBean.java new file mode 100644 index 0000000..e899840 --- /dev/null +++ b/src/main/java/com/loglog/api/commons/beans/GeolocationBean.java @@ -0,0 +1,58 @@ + package com.loglog.api.commons.beans; + +/** + * 사용자 Bean + * + * @author SJG + */ +public class GeolocationBean extends CommonBean { + + private static final long serialVersionUID = -8015604660465562829L; + + /**상점 코드*/ + private String shopCd; + + /**경도*/ + private Double longtitude; + + /**위도*/ + private Double latitude; + + /**주소*/ + private String address; + + public String getShopCd() { + return shopCd; + } + + public void setShopCd(String shopCd) { + this.shopCd = shopCd; + } + + public Double getLongtitude() { + return longtitude; + } + + public void setLongtitude(Double longtitude) { + this.longtitude = longtitude; + } + + public Double getLatitude() { + return latitude; + } + + public void setLatitude(Double latitude) { + this.latitude = latitude; + } + + public String getAddress() { + return address; + } + + public void setAddress(String address) { + this.address = address; + } + + + +} \ No newline at end of file diff --git a/src/main/java/com/loglog/api/commons/beans/ImageDataBean.java b/src/main/java/com/loglog/api/commons/beans/ImageDataBean.java new file mode 100644 index 0000000..69a0647 --- /dev/null +++ b/src/main/java/com/loglog/api/commons/beans/ImageDataBean.java @@ -0,0 +1,68 @@ +package com.loglog.api.commons.beans; + +public class ImageDataBean { + private String attachurl; + private int dataSeq; + private String dispElId; + private String filename; + private int filesize; + private String imageurl; + private String originalurl; + private String thumburl; + private int tmpSeq; + + public String getAttachurl() { + return attachurl; + } + public void setAttachurl(String attachurl) { + this.attachurl = attachurl; + } + public int getDataSeq() { + return dataSeq; + } + public void setDataSeq(int dataSeq) { + this.dataSeq = dataSeq; + } + public String getDispElId() { + return dispElId; + } + public void setDispElId(String dispElId) { + this.dispElId = dispElId; + } + public String getFilename() { + return filename; + } + public void setFilename(String filename) { + this.filename = filename; + } + public int getFilesize() { + return filesize; + } + public void setFilesize(int filesize) { + this.filesize = filesize; + } + public String getImageurl() { + return imageurl; + } + public void setImageurl(String imageurl) { + this.imageurl = imageurl; + } + public String getOriginalurl() { + return originalurl; + } + public void setOriginalurl(String originalurl) { + this.originalurl = originalurl; + } + public String getThumburl() { + return thumburl; + } + public void setThumburl(String thumburl) { + this.thumburl = thumburl; + } + public int getTmpSeq() { + return tmpSeq; + } + public void setTmpSeq(int tmpSeq) { + this.tmpSeq = tmpSeq; + } +} diff --git a/src/main/java/com/loglog/api/commons/beans/MsgMasterBean.java b/src/main/java/com/loglog/api/commons/beans/MsgMasterBean.java new file mode 100644 index 0000000..6a59c07 --- /dev/null +++ b/src/main/java/com/loglog/api/commons/beans/MsgMasterBean.java @@ -0,0 +1,176 @@ + package com.loglog.api.commons.beans; + +/** + * 사용자 Bean + * + * @author SJG + */ +public class MsgMasterBean extends CommonBean { + + /**메세지 구분값 */ + private String msgType; + + /**공지사항 메세지 내용*/ + private String noitCont; + + /**메세지방 고유번호*/ + private int roomId; + + /**유저코드*/ + private String userCd; + + /**상점 코드*/ + private String shopCd; + + /**상점이름*/ + private String shopNm; + + /**상점이름-카나*/ + private String shopKn; + + /**상점 이미지*/ + private String thumbnail1; + + /**보낸 메세지 시간*/ + private String datesent; + + /**메세지 내용*/ + private String content; + + /**메세지 확인 여부*/ + private String seen; + + /**보낸 장소*/ + private String sender; + + /**메시지 좋아요*/ + private int liked; + + /**통지 메세지 이미지 */ + private String msgImg; + + /**메세지 개수*/ + private String msgCount; + + /**메세지 코드*/ + private String msgCd; + + /** 메세지 입력시간*/ + private String insdatetime; + + /**읽지 않은 메세제 개수*/ + private String notReadMsg; + + public String getMsgType() { + return msgType; + } + public void setMsgType(String msgType) { + this.msgType = msgType; + } + + public String getNoitCont() { + return noitCont; + } + public void setNoitCont(String noitCont) { + this.noitCont = noitCont; + } + public int getRoomId() { + return roomId; + } + public void setRoomId(int roomId) { + this.roomId = roomId; + } + public String getUserCd() { + return userCd; + } + public void setUserCd(String userCd) { + this.userCd = userCd; + } + public String getShopCd() { + return shopCd; + } + public void setShopCd(String shopCd) { + this.shopCd = shopCd; + } + public String getShopNm() { + return shopNm; + } + public void setShopNm(String shopNm) { + this.shopNm = shopNm; + } + public String getShopKn() { + return shopKn; + } + public void setShopKn(String shopKn) { + this.shopKn = shopKn; + } + public String getThumbnail1() { + return thumbnail1; + } + public void setThumbnail1(String thumbnail1) { + this.thumbnail1 = thumbnail1; + } + public String getDatesent() { + return datesent; + } + public void setDatesent(String datesent) { + this.datesent = datesent; + } + public String getContent() { + return content; + } + public void setContent(String content) { + this.content = content; + } + public String getSeen() { + return seen; + } + public void setSeen(String seen) { + this.seen = seen; + } + public String getSender() { + return sender; + } + public void setSender(String sender) { + this.sender = sender; + } + public int getLiked() { + return liked; + } + public void setLiked(int liked) { + this.liked = liked; + } + public String getMsgCount() { + return msgCount; + } + public void setMsgCount(String msgCount) { + this.msgCount = msgCount; + } + public String getMsgImg() { + return msgImg; + } + public void setMsgImg(String msgImg) { + this.msgImg = msgImg; + } + public String getMsgCd() { + return msgCd; + } + public void setMegCd(String megCd) { + this.msgCd = megCd; + } + public String getInsdatetime() { + return insdatetime; + } + public void setInsdatetime(String insdatetime) { + this.insdatetime = insdatetime; + } + public String getNotReadMsg() { + return notReadMsg; + } + public void setNotReadMsg(String notReadMsg) { + this.notReadMsg = notReadMsg; + } + + + +} \ No newline at end of file diff --git a/src/main/java/com/loglog/api/commons/beans/NotiAttachBean.java b/src/main/java/com/loglog/api/commons/beans/NotiAttachBean.java new file mode 100644 index 0000000..c772f88 --- /dev/null +++ b/src/main/java/com/loglog/api/commons/beans/NotiAttachBean.java @@ -0,0 +1,94 @@ +package com.loglog.api.commons.beans; + +/** + * 공지사항 첨부파일 Bean + * + * @author "JIK" + * + */ +public class NotiAttachBean { + + /** 공지사항 첨부파일 고유번호 */ + private String notiAttachId; + /** 공지사항 고유번호 */ + private String notiId; + /** 공지사항 첨부파일 정렬번호 */ + private String ord; + /** 공지사항 첨부파일 타입 */ + private String fileType; + /** 공지사항 첨부파일 원본파일명 */ + private String fileName; + /** 공지사항 첨부파일 저장된 경로 */ + private String filePath; + /** 공지사항 첨부파일 크기 */ + private String fileSize; + /** 공지사항 첨부파일 등록일시 */ + private String regDt; + /** 공지사항 첨부파일 수정일시 */ + private String updDt; + /** 공지사항 첨부파일 이미지 Url */ + private String imageUrl; + + + public String getNotiAttachId() { + return notiAttachId; + } + public void setNotiAttachId(String notiAttachId) { + this.notiAttachId = notiAttachId; + } + public String getNotiId() { + return notiId; + } + public void setNotiId(String notiId) { + this.notiId = notiId; + } + public String getOrd() { + return ord; + } + public void setOrd(String ord) { + this.ord = ord; + } + public String getFileType() { + return fileType; + } + public void setFileType(String fileType) { + this.fileType = fileType; + } + public String getFileName() { + return fileName; + } + public void setFileName(String fileName) { + this.fileName = fileName; + } + public String getFilePath() { + return filePath; + } + public void setFilePath(String filePath) { + this.filePath = filePath; + } + public String getFileSize() { + return fileSize; + } + public void setFileSize(String fileSize) { + this.fileSize = fileSize; + } + public String getRegDt() { + return regDt; + } + public void setRegDt(String regDt) { + this.regDt = regDt; + } + public String getUpdDt() { + return updDt; + } + public void setUpdDt(String updDt) { + this.updDt = updDt; + } + public String getImageUrl() { + return imageUrl; + } + public void setImageUrl(String imageUrl) { + this.imageUrl = imageUrl; + } + +} diff --git a/src/main/java/com/loglog/api/commons/beans/NotiBean.java b/src/main/java/com/loglog/api/commons/beans/NotiBean.java new file mode 100644 index 0000000..89392f9 --- /dev/null +++ b/src/main/java/com/loglog/api/commons/beans/NotiBean.java @@ -0,0 +1,105 @@ +package com.loglog.api.commons.beans; + + +/** + * 공지사항 Bean + * + * @author "JIK" + * + */ +public class NotiBean { + + /** 공지사항 번호 */ + private String notiId; + /** 공지사항 종류 코드*/ + private String typeCd; + /** 공지사항 종류(사용자, 판매자) */ + private String notiType; + /** 공지사항 내용 분류 코드*/ + private String notiContTypeCd; + /** 공지사항 내용 분류 */ + private String notiContType; + /** 공지사항 제목 */ + private String notiTitle; + /** 공지사항 내용 */ + private String notiCont; + /** 공지사항 조회수 */ + private String hit; + /** 공지사항 등록일시 */ + private String regDt; + /** 공지사항 등록일시 - 년월일 */ + private String regDtYmd; + /** 공지사항 수정일시 */ + private String updDt; + + + + public String getNotiId() { + return notiId; + } + public void setNotiId(String notiId) { + this.notiId = notiId; + } + public String getTypeCd() { + return typeCd; + } + public void setTypeCd(String typeCd) { + this.typeCd = typeCd; + } + public String getNotiType() { + return notiType; + } + public void setNotiType(String notiType) { + this.notiType = notiType; + } + public String getNotiContTypeCd() { + return notiContTypeCd; + } + public void setNotiContTypeCd(String notiContTypeCd) { + this.notiContTypeCd = notiContTypeCd; + } + public String getNotiContType() { + return notiContType; + } + public void setNotiContType(String notiContType) { + this.notiContType = notiContType; + } + public String getNotiTitle() { + return notiTitle; + } + public void setNotiTitle(String notiTitle) { + this.notiTitle = notiTitle; + } + public String getNotiCont() { + return notiCont; + } + public void setNotiCont(String notiCont) { + this.notiCont = notiCont; + } + public String getHit() { + return hit; + } + public void setHit(String hit) { + this.hit = hit; + } + public String getRegDt() { + return regDt; + } + public void setRegDt(String regDt) { + this.regDt = regDt; + } + public String getUpdDt() { + return updDt; + } + public void setUpdDt(String updDt) { + this.updDt = updDt; + } + public String getRegDtYmd() { + return regDtYmd; + } + public void setRegDtYmd(String regDtYmd) { + this.regDtYmd = regDtYmd; + } + + +} \ No newline at end of file diff --git a/src/main/java/com/loglog/api/commons/beans/PagingBean.java b/src/main/java/com/loglog/api/commons/beans/PagingBean.java new file mode 100644 index 0000000..790eda1 --- /dev/null +++ b/src/main/java/com/loglog/api/commons/beans/PagingBean.java @@ -0,0 +1,419 @@ +package com.loglog.api.commons.beans; + +/** + * 리스트의 페이징을 처리하는 Bean + * + * @author SJW + */ +public class PagingBean { + + /** 페이지당 보여줄 레코드수 (변경가능하게 set/get 추가함) */ + private int countPerRecord = 10; + /** all: 모든 레코드를 표시한다. **/ + private String countPerRecordTypeCd; + + /** 한 화면에 보여줄 페이지 수 (변경가능하게 set/get 추가함) */ + private int countPerPage = 10; + + /** 인덱스에 보여줄 공지사항 수 (변경가능하게 set/get 추가함) */ + private int countPerNoti = 15; + + /** 전체 레코드수 */ + private int totalRecordCount; + /** 전체 페이지 수 */ + private int totalPageCount; + /** 요청 페이지 */ + private int pageNo; + /** DB 시작 로우 번호 */ + private int startRow; + /** DB 종료 로우 번호 */ + private int endRow; + + /** 전체 페이지의 그룹갯수 */ + private int totalGroupCount; + /** 현재 페이지의 그룹번호 (그룹번호는 1부터 시작) */ + private int groupNo; + /** 시작 페이지 번호 */ + private int pageStartNo; + /** 끝 페이지 번호 */ + private int pageEndNo; + + /** 검색어 */ + private String search; + /** 검색 종류 */ + private String searchKind; + /** 탭 구분자 */ + private String tapType; + /** 정렬 문자열 */ + private String orderByStr; + + /** 공지 타입 코드 */ + private String typeCd; + + /** 1대1 판매자 및 적립금 문의 기간 */ + private String period; + /** 1대1 판매자 문의 답변유형 */ + private String replyYn; + /** 1대1 문의 및 조회 할때 사용자 ID */ + private String sellerUserId; + + /** 사용자ID */ + private String userId; + /** 판매자 ID */ + private String sellerId; + /** 관리자ID*/ + private String adminId; + + /** 적립금 입출금유형 */ + private String inYn; + + /** 적립금 조회시 주문번호 */ + private String orderId; + /** 적립금 조회시 주문딜번호 */ + private String orderDealId; + + /** 판매자 주문/배송관리 조회 시작 날 */ + /** 검색문의 시작일 */ + private String startDt; + /** 판매자 주문/배송관리 조회 끝 날 */ + /** 검색문의 종료일 */ + private String endDt; + + /** 딜명 **/ + private String dealName; + /** 딜아이디 */ + private String dealId; + + /** 공동구매 정산 아이디 */ + private String calGroupId; + + /** 주문 상태 코드 */ + private String orderStatusCd; + + /** 쿠폰 검색시 필요한 정보 */ + private String couponStatus1; + private String couponStatus2; + private String couponStatus3; + + /** 검색시 필요한 키워드 */ + private String searchKeyword; + + /** 게시판 유형 코드 */ + private String bdTypeCd; + /** 게시물 고유번호 */ + private int bdNo; + + /** 교육신청 번호 */ + private int eduNo; + + /** + * 화면에 표시할 페이지를 계산한다. + * @param totalRecordCount : 전체 레코드 갯수 + */ + public void calcPage(int totalRecordCount) { + //페이지 디폴트값은 무조건 1 이다. + this.pageNo = pageNo == 0 ? 1 : pageNo; + this.totalRecordCount = totalRecordCount; + + //전체 페이지 갯수 + totalPageCount = calculateTotalPageCount(totalRecordCount, countPerRecord); + //DB에서 가져올 시작행 번호 + //startRow = ((pageNo - 1) * countPerRecord) + 1; + // mysql limit 를 사용하므로 +1은 사용안한다. + startRow = (pageNo - 1) * countPerRecord; + //DB에서 가져올 끝행 번호 + endRow = pageNo * countPerRecord; + + + //전체 페이징 그룹 갯수 + totalGroupCount = calculateTotalPageCount( totalPageCount, countPerPage ); + //현재 페이지의 소속 그룹번호 + groupNo = calculateTotalPageCount(pageNo, countPerPage); + //시작, 끝 페이지번호 구하기 + //게시물총수가 0일때는 스타트번호를 0으로 줌 + if(totalRecordCount == 0){ + pageStartNo = 0; + } else { + pageStartNo = ((groupNo - 1) * countPerPage) + 1; + } + pageEndNo = groupNo * countPerPage; + + //마지막 페이지 번호보다 같거나 크다면 더이상의 페이지가 없는것이기 때문에 전체 페이지 갯수를 대입해준다. + if(pageEndNo >= totalPageCount) { + pageEndNo = totalPageCount; + } + } + + /** + * 전체 레코드 개수에 대한 화면에 표시할 페이징 계산 + * @param totalCount + * @return + */ + private int calculateTotalPageCount(int totalRecordCount , int countPerPage){ + int totalPageCount = 0; + if(totalRecordCount > 0){ + totalPageCount = totalRecordCount / countPerPage; + if( (totalRecordCount % countPerPage) > 0 ){ + totalPageCount ++; + } + } + return totalPageCount; + } + + + public int getCountPerRecord() { + return countPerRecord; + } + public void setCountPerRecord(int countPerRecord) { + this.countPerRecord = countPerRecord; + } + public String getCountPerRecordTypeCd() { + return countPerRecordTypeCd; + } + public void setCountPerRecordTypeCd(String countPerRecordTypeCd) { + this.countPerRecordTypeCd = countPerRecordTypeCd; + } + public int getCountPerPage() { + return countPerPage; + } + public void setCountPerPage(int countPerPage) { + this.countPerPage = countPerPage; + } + public int getCountPerNoti() { + return countPerNoti; + } + public void setCountPerNoti(int countPerNoti) { + this.countPerNoti = countPerNoti; + } + public int getTotalPageCount() { + return totalPageCount; + } + public int getStartRow() { + return startRow; + } + public int getEndRow() { + return endRow; + } + public int getTotalRecordCount() { + return totalRecordCount; + } + public void setTotalRecordCount(int totalRecordCount) { + this.totalRecordCount = totalRecordCount; + } + public int getPageNo() { + return pageNo; + } + public void setPageNo(int pageNo) { + this.pageNo = pageNo; + } + public void setTotalPageCount(int totalPageCount) { + this.totalPageCount = totalPageCount; + } + public void setStartRow(int startRow) { + this.startRow = startRow; + } + public void setEndRow(int endRow) { + this.endRow = endRow; + } + public int getTotalGroupCount() { + return totalGroupCount; + } + public void setTotalGroupCount(int totalGroupCount) { + this.totalGroupCount = totalGroupCount; + } + public int getGroupNo() { + return groupNo; + } + public void setGroupNo(int groupNo) { + this.groupNo = groupNo; + } + public int getPageStartNo() { + return pageStartNo; + } + public void setPageStartNo(int pageStartNo) { + this.pageStartNo = pageStartNo; + } + public int getPageEndNo() { + return pageEndNo; + } + public void setPageEndNo(int pageEndNo) { + this.pageEndNo = pageEndNo; + } + public String getSearch() { + return search; + } + public void setSearch(String search) { + this.search = search; + } + public String getSearchKind() { + return searchKind; + } + public void setSearchKind(String searchKind) { + this.searchKind = searchKind; + } + public String getTapType() { + return tapType; + } + public void setTapType(String tapType) { + this.tapType = tapType; + } + public String getTypeCd() { + return typeCd; + } + public void setTypeCd(String typeCd) { + this.typeCd = typeCd; + } + public String getPeriod() { + return period; + } + public void setPeriod(String period) { + this.period = period; + } + public String getReplyYn() { + return replyYn; + } + public void setReplyYn(String replyYn) { + this.replyYn = replyYn; + } + public String getSellerUserId() { + return sellerUserId; + } + public void setSellerUserId(String sellerUserId) { + this.sellerUserId = sellerUserId; + } + public String getUserId() { + return userId; + } + public void setUserId(String userId) { + this.userId = userId; + } + public String getSellerId() { + return sellerId; + } + public void setSellerId(String sellerId) { + this.sellerId = sellerId; + } + public String getAdminId() { + return adminId; + } + public void setAdminId(String adminId) { + this.adminId = adminId; + } + public String getInYn() { + return inYn; + } + public void setInYn(String inYn) { + this.inYn = inYn; + } + public String getOrderId() { + return orderId; + } + public void setOrderId(String orderId) { + this.orderId = orderId; + } + public String getOrderDealId() { + return orderDealId; + } + public void setOrderDealId(String orderDealId) { + this.orderDealId = orderDealId; + } + public String getStartDt() { + return startDt; + } + public void setStartDt(String startDt) { + this.startDt = startDt; + } + public String getEndDt() { + return endDt; + } + public void setEndDt(String endDt) { + this.endDt = endDt; + } + public String getDealName() { + return dealName; + } + public void setDealName(String dealName) { + this.dealName = dealName; + } + public String getDealId() { + return dealId; + } + public void setDealId(String dealId) { + this.dealId = dealId; + } + public String getCalGroupId() { + return calGroupId; + } + public void setCalGroupId(String calGroupId) { + this.calGroupId = calGroupId; + } + public String getOrderByStr() { + return orderByStr; + } + public void setOrderByStr(String orderByStr) { + this.orderByStr = orderByStr; + } + public String getOrderStatusCd() { + return orderStatusCd; + } + public void setOrderStatusCd(String orderStatusCd) { + this.orderStatusCd = orderStatusCd; + } + + public String getCouponStatus1() { + return couponStatus1; + } + + public void setCouponStatus1(String couponStatus1) { + this.couponStatus1 = couponStatus1; + } + + public String getCouponStatus2() { + return couponStatus2; + } + + public void setCouponStatus2(String couponStatus2) { + this.couponStatus2 = couponStatus2; + } + + public String getSearchKeyword() { + return searchKeyword; + } + + public void setSearchKeyword(String searchKeyword) { + this.searchKeyword = searchKeyword; + } + + public String getCouponStatus3() { + return couponStatus3; + } + + public void setCouponStatus3(String couponStatus3) { + this.couponStatus3 = couponStatus3; + } + + public String getBdTypeCd() { + return bdTypeCd; + } + + public void setBdTypeCd(String bdTypeCd) { + this.bdTypeCd = bdTypeCd; + } + + public int getEduNo() { + return eduNo; + } + + public void setEduNo(int eduNo) { + this.eduNo = eduNo; + } + + public int getBdNo() { + return bdNo; + } + + public void setBdNo(int bdNo) { + this.bdNo = bdNo; + } + +} diff --git a/src/main/java/com/loglog/api/commons/beans/ResultBean.java b/src/main/java/com/loglog/api/commons/beans/ResultBean.java new file mode 100644 index 0000000..3195621 --- /dev/null +++ b/src/main/java/com/loglog/api/commons/beans/ResultBean.java @@ -0,0 +1,43 @@ +package com.loglog.api.commons.beans; + +/** + * 결과 Bean + * + * @author SJG + */ +public class ResultBean { + + /** 결과 */ + private String result; + /** 결과 메시지 */ + private String resultMsg; + /** 결과 코드 */ + private String resultCode; + /** 취소 일시 */ + private String cancelDt; + + public String getResult() { + return result; + } + public void setResult(String result) { + this.result = result; + } + public String getResultMsg() { + return resultMsg; + } + public void setResultMsg(String resultMsg) { + this.resultMsg = resultMsg; + } + public String getCancelDt() { + return cancelDt; + } + public void setCancelDt(String cancelDt) { + this.cancelDt = cancelDt; + } + public String getResultCode() { + return resultCode; + } + public void setResultCode(String resultCode) { + this.resultCode = resultCode; + } +} \ No newline at end of file diff --git a/src/main/java/com/loglog/api/commons/beans/ShopDetailBean.java b/src/main/java/com/loglog/api/commons/beans/ShopDetailBean.java new file mode 100644 index 0000000..ff128c1 --- /dev/null +++ b/src/main/java/com/loglog/api/commons/beans/ShopDetailBean.java @@ -0,0 +1,327 @@ + package com.loglog.api.commons.beans; + +/** + * 사용자 Bean + * + * @author SJG + */ +public class ShopDetailBean extends CommonBean { + /** 유저코드*/ + private String userCd; + + /** 상점 고유번호 */ + private String shopCd; + + /** 상점 핸드폰번호 */ + private String shopPhone; + + /** 상점이름 */ + private String shopNm; + + /** sns주소1 */ + private String urlSns1; + + /** sns주소2 */ + private String urlSns2; + + /** sns주소3 */ + private String urlSns3; + + /** sns주소4 */ + private String urlSns4; + + /** HP */ + private String urlHp; + + /** 썸네일1 */ + private String thumbnail1; + + /** 썸네일2 */ + private String thumbnail2; + + /** 썸네일3 */ + private String thumbnail3; + + /** 휴일1 */ + private String holiDay1; + + /** 휴일2 */ + private String holiDay2; + + /** 휴일3 */ + private String holiDay3; + + /** 무료텍스트 */ + private String freeText; + + /** 로고 */ + private String logo; + + /** 오픈시간1 */ + private String openTime1; + + /** 닫는시간1 */ + private String closeTime1; + + /** 오픈시간2 */ + private String openTime2; + + /** 닫는시간2 */ + private String closeTime2; + + /** 상점주소3 */ + private String shopAdd3; + + /** 상점주소2 */ + private String shopAdd2; + + /** 상점주소1 */ + private String shopAdd1; + + /** 상점 우편주소 */ + private String shopPostcd; + + /** 사용가능한 쿠폰갯수*/ + private String couponCnt; + /** 즐겨찾기 여부*/ + private String liked; + /** 방문 휫수*/ + private String visitCnt; + /** 최근 공지사항 */ + private String message; + + public String getUserCd() { + return userCd; + } + + public void setUserCd(String userCd) { + this.userCd = userCd; + } + + public String getShopCd() { + return shopCd; + } + + public void setShopCd(String shopCd) { + this.shopCd = shopCd; + } + + public String getShopPhone() { + return shopPhone; + } + + public void setShopPhone(String shopPhone) { + this.shopPhone = shopPhone; + } + + public String getShopNm() { + return shopNm; + } + + public void setShopNm(String shopNm) { + this.shopNm = shopNm; + } + + public String getUrlSns1() { + return urlSns1; + } + + public void setUrlSns1(String urlSns1) { + this.urlSns1 = urlSns1; + } + + public String getUrlSns2() { + return urlSns2; + } + + public void setUrlSns2(String urlSns2) { + this.urlSns2 = urlSns2; + } + + public String getUrlSns3() { + return urlSns3; + } + + public void setUrlSns3(String urlSns3) { + this.urlSns3 = urlSns3; + } + + public String getUrlSns4() { + return urlSns4; + } + + public void setUrlSns4(String urlSns4) { + this.urlSns4 = urlSns4; + } + + public String getUrlHp() { + return urlHp; + } + + public void setUrlHp(String urlHp) { + this.urlHp = urlHp; + } + + public String getThumbnail1() { + return thumbnail1; + } + + public void setThumbnail1(String thumbnail1) { + this.thumbnail1 = thumbnail1; + } + + public String getThumbnail2() { + return thumbnail2; + } + + public void setThumbnail2(String thumbnail2) { + this.thumbnail2 = thumbnail2; + } + + public String getThumbnail3() { + return thumbnail3; + } + + public void setThumbnail3(String thumbnail3) { + this.thumbnail3 = thumbnail3; + } + + public String getHoliDay1() { + return holiDay1; + } + + public void setHoliDay1(String holiDay1) { + this.holiDay1 = holiDay1; + } + + public String getHoliDay2() { + return holiDay2; + } + + public void setHoliDay2(String holiDay2) { + this.holiDay2 = holiDay2; + } + + public String getHoliDay3() { + return holiDay3; + } + + public void setHoliDay3(String holiDay3) { + this.holiDay3 = holiDay3; + } + + public String getFreeText() { + return freeText; + } + + public void setFreeText(String freeText) { + this.freeText = freeText; + } + + public String getLogo() { + return logo; + } + + public void setLogo(String logo) { + this.logo = logo; + } + + public String getOpenTime1() { + return openTime1; + } + + public void setOpenTime1(String openTime1) { + this.openTime1 = openTime1; + } + + public String getCloseTime1() { + return closeTime1; + } + + public void setCloseTime1(String closeTime1) { + this.closeTime1 = closeTime1; + } + + public String getOpenTime2() { + return openTime2; + } + + public void setOpenTime2(String openTime2) { + this.openTime2 = openTime2; + } + + public String getCloseTime2() { + return closeTime2; + } + + public void setCloseTime2(String closeTime2) { + this.closeTime2 = closeTime2; + } + + public String getShopAdd3() { + return shopAdd3; + } + + public void setShopAdd3(String shopAdd3) { + this.shopAdd3 = shopAdd3; + } + + public String getShopAdd2() { + return shopAdd2; + } + + public void setShopAdd2(String shopAdd2) { + this.shopAdd2 = shopAdd2; + } + + public String getShopAdd1() { + return shopAdd1; + } + + public void setShopAdd1(String shopAdd1) { + this.shopAdd1 = shopAdd1; + } + + public String getShopPostcd() { + return shopPostcd; + } + + public void setShopPostcd(String shopPostcd) { + this.shopPostcd = shopPostcd; + } + + public String getCouponCnt() { + return couponCnt; + } + + public void setCouponCnt(String couponCnt) { + this.couponCnt = couponCnt; + } + + public String getLiked() { + return liked; + } + + public void setLiked(String liked) { + this.liked = liked; + } + + public String getVisitCnt() { + return visitCnt; + } + + public void setVisitCnt(String visitCnt) { + this.visitCnt = visitCnt; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + + +} \ No newline at end of file diff --git a/src/main/java/com/loglog/api/commons/beans/ShopMasterBean.java b/src/main/java/com/loglog/api/commons/beans/ShopMasterBean.java new file mode 100644 index 0000000..3fafcfc --- /dev/null +++ b/src/main/java/com/loglog/api/commons/beans/ShopMasterBean.java @@ -0,0 +1,176 @@ + package com.loglog.api.commons.beans; + +/** + * 사용자 Bean + * + * @author SJG + */ +public class ShopMasterBean extends CommonBean { + + /**Tempo_liked 고유번호*/ + private String id; + + /**상점코드*/ + private String shopCd; + + /**유저 코드*/ + private String userCd; + + /**룸ID*/ + private String roomId; + + /**상점이름*/ + private String shopNm; + + /**상점이름 - 일본어*/ + private String shopKn; + + /**상점이미지*/ + private String thumbnail1; + + /**상점 전화번호*/ + private String shopPhone; + + /**상점주소*/ + private String shopAdd1 ; + + /**상점상세주소*/ + private String shopAdd2 ; + + /**카테고리 코드*/ + private String categoryCd; + + /**경도*/ + private Double longtitude ; + + /**경도*/ + private Double latitude ; + + /**접근성*/ + private String proximity; + + private String liked; + + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getShopCd() { + return shopCd; + } + + public void setShopCd(String shopCd) { + this.shopCd = shopCd; + } + + public String getRoomId() { + return roomId; + } + + public void setRoomId(String roomId) { + this.roomId = roomId; + } + + public String getUserCd() { + return userCd; + } + + public void setUserCd(String userCd) { + this.userCd = userCd; + } + + public String getShopNm() { + return shopNm; + } + + public void setShopNm(String shopNm) { + this.shopNm = shopNm; + } + + public String getShopKn() { + return shopKn; + } + + public void setShopKn(String shopKn) { + this.shopKn = shopKn; + } + + public String getThumbnail1() { + return thumbnail1; + } + + public void setThumbnail1(String thumbnail1) { + this.thumbnail1 = thumbnail1; + } + + public String getShopPhone() { + return shopPhone; + } + + public void setShopPhone(String shopPhone) { + this.shopPhone = shopPhone; + } + + public String getShopAdd1() { + return shopAdd1; + } + + public void setShopAdd1(String shopAdd1) { + this.shopAdd1 = shopAdd1; + } + + public String getShopAdd2() { + return shopAdd2; + } + + public void setShopAdd2(String shopAdd2) { + this.shopAdd2 = shopAdd2; + } + + public String getCategoryCd() { + return categoryCd; + } + + public void setCategoryCd(String categoryCd) { + this.categoryCd = categoryCd; + } + + public Double getLongtitude() { + return longtitude; + } + + public void setLongtitude(Double longtitude) { + this.longtitude = longtitude; + } + + public Double getLatitude() { + return latitude; + } + + public void setLatitude(Double latitude) { + this.latitude = latitude; + } + + public String getProximity() { + return proximity; + } + + public void setProximity(String proximity) { + this.proximity = proximity; + } + + public String getLiked() { + return liked; + } + + public void setLiked(String liked) { + this.liked = liked; + } + + +} \ No newline at end of file diff --git a/src/main/java/com/loglog/api/commons/beans/UserBean.java b/src/main/java/com/loglog/api/commons/beans/UserBean.java new file mode 100644 index 0000000..32cc40a --- /dev/null +++ b/src/main/java/com/loglog/api/commons/beans/UserBean.java @@ -0,0 +1,172 @@ + package com.loglog.api.commons.beans; + +/** + * 사용자 Bean + * + * @author SJG + */ +public class UserBean extends CommonBean { + + private static final long serialVersionUID = -8015604660465562829L; + /**등록된 코드*/ + private String insuserCd; + /**코드업데이트*/ + private String upduserCd; + /**사용자코드*/ + private String userCd; + /**사용자이름*/ + private String userNm; + /**사용자이름 카나*/ + private String userKn; + /**사용자 생일*/ + private String birthday; + /**사용자 성별*/ + private String gender; + /**사용자 이메일*/ + private String userMail; + /**사용자 비밀번호*/ + private String userPw; + /**사용자 핸드폰번호*/ + private String userPhone; + /**협업 카테고리*/ + private String connectKbn; + /**주소*/ + private String add1; + /**상세주소*/ + private String add2; + /**랭킹*/ + private String rank; + /** ?? */ + private String janNo; + /** ?? */ + private String custCd; + + private String custCd1; + private String custCd2; + private String custCd3; + + /**비밀번호 확인*/ + private String checkPw; + + public String getInsuserCd() { + return insuserCd; + } + public void setInsuserCd(String insuserCd) { + this.insuserCd = insuserCd; + } + public String getUpduserCd() { + return upduserCd; + } + public void setUpduserCd(String upduserCd) { + this.upduserCd = upduserCd; + } + public String getUserCd() { + return userCd; + } + public void setUserCd(String userCd) { + this.userCd = userCd; + } + public String getUserNm() { + return userNm; + } + public void setUserNm(String userNm) { + this.userNm = userNm; + } + public String getUserKn() { + return userKn; + } + public void setUserKn(String userKn) { + this.userKn = userKn; + } + public String getBirthday() { + return birthday; + } + public void setBirthday(String birthday) { + this.birthday = birthday; + } + public String getGender() { + return gender; + } + public void setGender(String gender) { + this.gender = gender; + } + public String getUserMail() { + return userMail; + } + public void setUserMail(String userMail) { + this.userMail = userMail; + } + public String getUserPw() { + return userPw; + } + public void setUserPw(String userPw) { + this.userPw = userPw; + } + public String getUserPhone() { + return userPhone; + } + public void setUserPhone(String userPhone) { + this.userPhone = userPhone; + } + public String getConnectKbn() { + return connectKbn; + } + public void setConnectKbn(String connectKbn) { + this.connectKbn = connectKbn; + } + public String getAdd1() { + return add1; + } + public void setAdd1(String add1) { + this.add1 = add1; + } + public String getAdd2() { + return add2; + } + public void setAdd2(String add2) { + this.add2 = add2; + } + public String getRank() { + return rank; + } + public void setRank(String rank) { + this.rank = rank; + } + public String getJanNo() { + return janNo; + } + public void setJanNo(String janNo) { + this.janNo = janNo; + } + public String getCustCd() { + return custCd; + } + public void setCustCd(String custCd) { + this.custCd = custCd; + } + public String getCustCd1() { + return custCd1; + } + public void setCustCd1(String custCd1) { + this.custCd1 = custCd1; + } + public String getCustCd2() { + return custCd2; + } + public void setCustCd2(String custCd2) { + this.custCd2 = custCd2; + } + public String getCustCd3() { + return custCd3; + } + public void setCustCd3(String custCd3) { + this.custCd3 = custCd3; + } + public String getCheckPw() { + return checkPw; + } + public void setCheckPw(String checkPw) { + this.checkPw = checkPw; + } + +} \ No newline at end of file diff --git a/src/main/java/com/loglog/api/commons/constants/BoardConstant.java b/src/main/java/com/loglog/api/commons/constants/BoardConstant.java new file mode 100644 index 0000000..e07f427 --- /dev/null +++ b/src/main/java/com/loglog/api/commons/constants/BoardConstant.java @@ -0,0 +1,96 @@ +package com.loglog.api.commons.constants; + +/** + * 게시판 상수코드 정의 + * + * @since 2017.12.12 + */ +public class BoardConstant { + + /** + * 게시판 유형 코드- 이벤트 - {@value} + * */ + public static final String BOARD_TYPE_CD_01 = "1"; + + /** + * 게시판 유형 코드- 자격신청 - {@value} + * */ + public static final String BOARD_TYPE_CD_02 = "2"; + + /** + * 게시판 유형 코드- KSA News - {@value} + * */ + public static final String BOARD_TYPE_CD_03 = "3"; + + /** + * 게시판 유형 코드- photo - {@value} + * */ + public static final String BOARD_TYPE_CD_04 = "4"; + + /** + * 게시판 유형 코드- video - {@value} + * */ + public static final String BOARD_TYPE_CD_05 = "5"; + + /** + * 게시판 유형 코드- 공지사항 - {@value} + * */ + public static final String BOARD_TYPE_CD_06 = "6"; + + /** + * 게시판 유형 코드- 자유게시판 - {@value} + * */ + public static final String BOARD_TYPE_CD_07 = "7"; + + /** + * 게시판 유형 코드- 서핑포인트 - {@value} + * */ + public static final String BOARD_TYPE_CD_08 = "8"; + + /** + * 게시판 유형 코드- 자료실 - {@value} + * */ + public static final String BOARD_TYPE_CD_09 = "9"; + + /** + * 게시판 유형 코드- 1:1문의 - {@value} + * */ + public static final String BOARD_TYPE_CD_10 = "10"; + + + /** + * 게시판 유형 코드- 서울특별시 서핑협회 - {@value} + * */ + public static final String BOARD_TYPE_CD_11 = "11"; + + /** + * 게시판 유형 코드- 대전광역시 서핑협회 - {@value} + * */ + public static final String BOARD_TYPE_CD_12 = "12"; + + /** + * 게시판 유형 코드- 울산광역시 서핑협회 - {@value} + * */ + public static final String BOARD_TYPE_CD_13 = "13"; + + /** + * 게시판 유형 코드- 강원도 서핑협회 - {@value} + * */ + public static final String BOARD_TYPE_CD_14 = "14"; + + /** + * 게시판 유형 코드- 충청남도 서핑협회 - {@value} + * */ + public static final String BOARD_TYPE_CD_15 = "15"; + + /** + * 게시판 유형 코드- 경상북도 서핑협회 - {@value} + * */ + public static final String BOARD_TYPE_CD_16 = "16"; + + /** + * 게시판 유형 코드- 제주특별자치도 서핑협회 - {@value} + * */ + public static final String BOARD_TYPE_CD_17 = "17"; + +} \ No newline at end of file diff --git a/src/main/java/com/loglog/api/commons/constants/CodeConstant.java b/src/main/java/com/loglog/api/commons/constants/CodeConstant.java new file mode 100644 index 0000000..35b1e0b --- /dev/null +++ b/src/main/java/com/loglog/api/commons/constants/CodeConstant.java @@ -0,0 +1,422 @@ +package com.loglog.api.commons.constants; + +/** + * TB_CODE 테이블 상수정의 + * + * @author SJW + */ +public class CodeConstant { + + /** 관리자 상태 코드- 가입심사중 - {@value} */ + public static final String ADMIN_STATUS_CD_1001 = "1001"; + /** 관리자 상태 코드- 정상이용 - {@value} */ + public static final String ADMIN_STATUS_CD_1000 = "1000"; + + /** 판매자 상태 코드- 가입심사중 - {@value} */ + public static final String SELLER_STATUS_CD_1001 = "1001"; + /** 판매자 상태 코드- 정상이용 - {@value} */ + public static final String SELLER_STATUS_CD_1000 = "1000"; + + + /** 인증 상태 코드- 인증메일발송 - {@value} */ + public static final String AUTH_STATUS_CD_01 = "01"; + /** 인증 상태 코드- 인증확인 - {@value} */ + public static final String AUTH_STATUS_CD_02 = "02"; + /** 인증 상태 코드- 승인대기 - {@value} */ + public static final String AUTH_STATUS_CD_03 = "03"; + /** 인증 상태 코드- 정상이용 - {@value} */ + public static final String AUTH_STATUS_CD_04 = "04"; + /** 인증 상태 코드- 일시정지 - {@value} */ + public static final String AUTH_STATUS_CD_05 = "05"; + + + /** 주소 종류 코드- 일반주소 - {@value} */ + public static final String ADDR_TYPE_CD_01 = "01"; + /** 주소 종류 코드- 대표출고지 주소 - {@value} */ + public static final String ADDR_TYPE_CD_02 = "02"; + /** 주소 종류 코드- 대표 반품/교환지 주소 - {@value} */ + public static final String ADDR_TYPE_CD_03 = "03"; + + /** 판매자 유형 코드- 사업자 판매 회원 - {@value} */ + public static final String SELLER_TYPE_CD_01 = "01"; + /** 판매자 유형 코드- 개인 판매 회원 - {@value} */ + public static final String SELLER_TYPE_CD_02 = "02"; + + + /** 사용자 상태 코드- 정상 이용 - {@value} */ + public static final String USER_STATUS_CD_1000 = "1000"; + + /** 사용자 상태 코드- 가입 심사중 - {@value} */ + public static final String USER_STATUS_CD_1001 = "1001"; + /** 사용자 상태 코드- 메일 인증 대기 - {@value} */ + public static final String USER_STATUS_CD_2001 = "2001"; + /** 사용자 상태 코드- 활동 정지 - {@value} */ + public static final String USER_STATUS_CD_5001 = "5001"; + /** 사용자 상태 코드- 탈퇴 - {@value} */ + public static final String USER_STATUS_CD_9999 = "9999"; + /** 사용자 상태 코드- 탈퇴요청 - {@value} */ + public static final String USER_STATUS_CD_9001 = "9001"; + /** 사용자 상태 코드- 탈퇴반려 - {@value} */ + public static final String USER_STATUS_CD_9002 = "9002"; + + + /** 딜 상태 코드- 딜 등록대기 - {@value} */ + public static final String DEAL_STATUS_CD_100 = "100"; + /** 딜 상태 코드- 딜 심사요청 - {@value} */ + public static final String DEAL_STATUS_CD_101 = "101"; + /** 딜 상태 코드- 딜 심사중 - {@value} */ + public static final String DEAL_STATUS_CD_111 = "111"; + /** 딜 상태 코드- 딜 심사 반려 - {@value} */ + public static final String DEAL_STATUS_CD_121 = "121"; + /** 딜 상태 코드- 딜 진행중 - {@value} */ + public static final String DEAL_STATUS_CD_131 = "131"; + /** 딜 상태 코드- 딜 종료 - {@value} */ + public static final String DEAL_STATUS_CD_141 = "141"; + /** 딜 상태 코드- 딜 삭제 - {@value} */ + public static final String DEAL_STATUS_CD_191 = "191"; + + /** 딜 상태 코드- 딜 수요조사 등록대기- {@value} */ + public static final String DEAL_STATUS_CD_200 = "200"; + /** 딜 상태 코드- 딜 수요조사 심사요청- {@value} */ + public static final String DEAL_STATUS_CD_201 = "201"; + /** 딜 상태 코드- 딜 수요조사 심사중 - {@value} */ + public static final String DEAL_STATUS_CD_211 = "211"; + /** 딜 상태 코드- 딜 수요조사 심사반려 - {@value} */ + public static final String DEAL_STATUS_CD_221 = "221"; + /** 딜 상태 코드- 딜 수요조사 진행중 - {@value} */ + public static final String DEAL_STATUS_CD_231 = "231"; + /** 딜 상태 코드- 딜 수요조사 종료 - {@value} */ + public static final String DEAL_STATUS_CD_241 = "241"; + /** 딜 상태 코드- 딜 수요조사 삭제 - {@value} */ + public static final String DEAL_STATUS_CD_291 = "291"; + + /** 딜 상태 코드- 딜 공동구매 등록대기 - {@value} */ + public static final String DEAL_STATUS_CD_300 = "300"; + /** 딜 상태 코드- 딜 공동구매 심사요청 - {@value} */ + public static final String DEAL_STATUS_CD_301 = "301"; + /** 딜 상태 코드- 딜 공동구매 심사중 - {@value} */ + public static final String DEAL_STATUS_CD_311 = "311"; + /** 딜 상태 코드- 딜 공동구매 심사 반려 - {@value} */ + public static final String DEAL_STATUS_CD_321 = "321"; + /** 딜 상태 코드- 딜 공동구매 모집중 - {@value} */ + public static final String DEAL_STATUS_CD_331 = "331"; + /** 딜 상태 코드- 딜 공동구매 모집실패 처리중 - {@value} */ + public static final String DEAL_STATUS_CD_335 = "335"; + /** 딜 상태 코드- 딜 공동구매 모집종료 - {@value} */ + public static final String DEAL_STATUS_CD_341 = "341"; + /** 딜 상태 코드- 딜 공동구매 배송중 - {@value} */ + public static final String DEAL_STATUS_CD_351 = "351"; + /** 딜 상태 코드- 딜 공동구매 종료 - {@value} */ + public static final String DEAL_STATUS_CD_361 = "361"; + /** 딜 상태 코드- 딜 공동구매 모집실패 - {@value} */ + public static final String DEAL_STATUS_CD_381 = "381"; + /** 딜 상태 코드- 딜 공동구매 삭제 - {@value} */ + public static final String DEAL_STATUS_CD_391 = "391"; + + /** 딜 타입 코드 - 판매딜 - {@value} */ + public static final String DEAL_TYPE_CD_1 = "1"; + /** 딜 타입 코드 - 수요조사딜 - {@value} */ + public static final String DEAL_TYPE_CD_2 = "2"; + /** 딜 타입 코드 - 공동구매딜 - {@value} */ + public static final String DEAL_TYPE_CD_3 = "3"; + + /** 딜 타입별 상태 - 판매딜 - 판매자 - {@value} */ + public static final String[] DEAL_TYPE_1_CDS_SELLER = {"100","101","111","121","131","141"}; + /** 딜 타입별 상태 - 판매딜 - 관리자 - {@value} */ + public static final String[] DEAL_TYPE_1_CDS_ADMIN = {"100","101","111","121","131","141", "191"}; + + /** 딜 타입별 상태 - 수요조사딜 - {@value} */ + public static final String[] DEAL_TYPE_2_CDS = {"201","211","221","231","241"}; + + /** 딜 타입별 상태 - 공동구매딜 - 판매자 - {@value} */ + public static final String[] DEAL_TYPE_3_CDS_SELLER = {"300","301","311","321","331","335","341","351","361","381"}; + /** 딜 타입별 상태 - 공동구매 주문관리 딜 - 판매자 - {@value} */ + public static final String[] DEAL_TYPE_3_CDS_SELLER_GROUP = {"331","335","341","351","361","381"}; + /** 딜 타입별 상태 - 공동구매딜 - 관리자 - {@value} */ + public static final String[] DEAL_TYPE_3_CDS_ADMIN = {"300","301","311","321","331","335","341","351","361","381","391"}; + + /** 옵션 타입 코드 - 기본 옵션 - {@value} */ + public static final String OPTION_TYPE_CD_1 = "1"; + /** 옵션 타입 코드 - 하위옵션 - {@value} */ + public static final String OPTION_TYPE_CD_2 = "2"; + /** 옵션 타입 코드 - 추가구성품 - {@value} */ + public static final String OPTION_TYPE_CD_3 = "3"; + + + /** 결제 수단 코드 - 신용카드 {@value} */ + public static final String PAY_MEANS_CD_CREDIT_CARD = "CREDIT_CARD"; + /** 결제 수단 코드 - 실시간계좌이체 {@value} */ + public static final String PAY_MEANS_CD_BANK = "BANK"; + /** 결제 수단 코드 - 무통장입금 {@value} */ + public static final String PAY_MEANS_CD_VIRTUAL_ACCOUNT = "VIRTUAL_ACCOUNT"; + /** 결제 수단 코드 - 휴대폰 {@value} */ + public static final String PAY_MEANS_CD_MOBILE = "MOBILE"; + /** 결제 수단 코드 - 카카오페이 {@value} */ + public static final String PAY_MEANS_CD_KAKAO_PAY= "KAKAO_PAY"; + + + /** 배송비 그룹 계산 방식 코드 - 묶음그룹에서 가장 작은 배송비로 부과 - {@value} */ + public static final String DELI_FEE_GROUP_CAL_TYPE_CD_01 = "01"; + /** 배송비 그룹 계산 방식 코드 - 묶음그룹에서 가장 큰 배송비로 부과 - {@value} */ + public static final String DELI_FEE_GROUP_CAL_TYPE_CD_02 = "02"; + + + /** 주문 상태 코드 - 주문접수 {@value} */ + public static final String ORDER_STATUS_CD_101 = "101"; + /** 주문 상태 코드 - 입금대기중 {@value} */ + public static final String ORDER_STATUS_CD_201 = "201"; + /** 주문 상태 코드 - 결제완료 {@value} */ + public static final String ORDER_STATUS_CD_301 = "301"; + /** 주문 상태 코드 - 배송준비중 {@value} */ + public static final String ORDER_STATUS_CD_401 = "401"; + /** 주문 상태 코드 - 배송중 {@value} */ + public static final String ORDER_STATUS_CD_501 = "501"; + /** 주문 상태 코드 - 배송완료 {@value} */ + public static final String ORDER_STATUS_CD_601 = "601"; + /** 주문 상태 코드 - 구매확정 {@value} */ + public static final String ORDER_STATUS_CD_701 = "701"; + /** 주문 상태 코드 - 주문취소접수 {@value} */ + public static final String ORDER_STATUS_CD_801 = "801"; + /** 주문 상태 코드 - 주문취소 {@value} */ + public static final String ORDER_STATUS_CD_901 = "901"; + + + /** 공동구매 주문 목록 상태 코드 - 판매자 {@value} */ + public static final String[] ORDER_STATUS_CDS_SELLER= {"301","401","501","601","701","901"}; + + + /** 회원 구분 코드 - 사용자 {@value} */ + public static final String MEMBER_TYPE_CD_1 = "1"; + /** 회원 구분 코드 - 판매자 {@value} */ + public static final String MEMBER_TYPE_CD_2 = "2"; + /** 회원 구분 코드 - 관리자 {@value} */ + public static final String MEMBER_TYPE_CD_3 = "3"; + + + /** 결제 상태 코드 - 결제대기 {@value} */ + public static final String PAY_STATUS_CD_101 = "101"; + /** 결제 상태 코드 - 입금대기 {@value} */ + public static final String PAY_STATUS_CD_201 = "201"; + /** 결제 상태 코드 - 결제완료 {@value} */ + public static final String PAY_STATUS_CD_301 = "301"; + /** 결제 상태 코드 - 결제완료(취소불가) {@value} */ + public static final String PAY_STATUS_CD_302 = "302"; + /** 결제 상태 코드 - 결제취소 {@value} */ + public static final String PAY_STATUS_CD_701 = "701"; + /** 결제 상태 코드 - 결제실패 {@value} */ + public static final String PAY_STATUS_CD_901 = "901"; + + + /** 게시 기간 코드 - 재고소진시까지 {@value} */ + public static final String INFORM_DT_CD_1 = "1"; + /** 게시 기간 코드 - 게시기간 {@value} */ + public static final String INFORM_DT_CD_2 = "2"; + + + /** 공지사항 타입 - 판매자 {@value} */ + public static final String NOTI_TYPE_S = "S"; + /** 공지사항 타입 - 사용자 {@value} */ + public static final String NOTI_TYPE_U = "U"; + + /** 사용자 공지사항 탭 구분 - 공지 {@value} */ + public static final String NOTI_EVENT_N = "N"; + /** 사용자 공지사항 탭 구분 - 이벤트 {@value} */ + public static final String NOTI_EVENT_E = "E"; + + /** 자주하는 질문 탭 구분 - 주문/배송 {@value} */ + public static final String FAQ_ORDER = "1"; + /** 자주하는 질문 탭 구분 - 취소/환불 {@value} */ + public static final String FAQ_CANCEL = "2"; + /** 자주하는 질문 탭 구분 - 서비스 {@value} */ + public static final String FAQ_SERVICE = "3"; + + + /** 발송 메일 주소 코드 - help {@value} */ + public static final String SEND_MAIL_CD_01 = "01"; + + + /** 다우 페이 카드 코드 - 신한카드 {@value} */ + public static final String DAOU_PAY_CARD_CD_CCLG = "CCLG"; + /** 다우 페이 카드 코드 - BC카드 {@value} */ + public static final String DAOU_PAY_CARD_CD_CCBC = "CCBC"; + /** 다우 페이 카드 코드 - 국민카드 {@value} */ + public static final String DAOU_PAY_CARD_CD_CCKM = "CCKM"; + /** 다우 페이 카드 코드 - 삼성카드 {@value} */ + public static final String DAOU_PAY_CARD_CD_CCSS = "CCSS"; + /** 다우 페이 카드 코드 - 현대카드 {@value} */ + public static final String DAOU_PAY_CARD_CD_CCDI = "CCDI"; + /** 다우 페이 카드 코드 - 롯데카드 {@value} */ + public static final String DAOU_PAY_CARD_CD_CCLO = "CCLO"; + /** 다우 페이 카드 코드 - 하나SK카드 {@value} */ + public static final String DAOU_PAY_CARD_CD_CCHN = "CCHN"; + /** 다우 페이 카드 코드 - 외환카드 {@value} */ + public static final String DAOU_PAY_CARD_CD_CCKE = "CCKE"; + /** 다우 페이 카드 코드 - NH농협카드 {@value} */ + public static final String DAOU_PAY_CARD_CD_CCNH = "CCNH"; + /** 다우 페이 카드 코드 - 시티카드 {@value} */ + public static final String DAOU_PAY_CARD_CD_CCCT = "CCCT"; + /** 다우 페이 카드 코드 - 우리카드 {@value} */ + public static final String DAOU_PAY_CARD_CD_CCPH = "CCPH"; + + + /** 다우 페이 상품 구분 코드 - 디지털 {@value} */ + public static final String DAOU_PAY_PRODUCT_TYPE_CD_1 = "1"; + /** 다우 페이 상품 구분 코드 - 실물 {@value} */ + public static final String DAOU_PAY_PRODUCT_TYPE_CD_2 = "2"; + + + /** 다우 페이 과금 유형 코드 - 일반 {@value} */ + public static final String DAOU_PAY_BILL_TYPE_CD_1 = "1"; + + + /** 다우 페이 입금만료일(가상계좌) {@value} */ + public static final String DAOU_PAY_DEPOSIT_END_DATE= "3"; + + + /** 다우 페이 현금영수증 발행여부 - 발행 {@value} */ + public static final String DAOU_PAY_CASH_RECEIPT_FLAG_1 = "1"; + /** 다우 페이 현금영수증 발행여부 - 미발행 {@value} */ + public static final String DAOU_PAY_CASH_RECEIPT_FLAG_2 = "2"; + + + /** 다우 페이 콜백 - 결제수단 - 신용카드 결과통보 {@value} */ + public static final String DAOU_PAY_PAY_METHOD_CD_CARD = "CARD"; + /** 다우 페이 콜백 - 결제수단 - 가상계좌 계좌발행 {@value} */ + public static final String DAOU_PAY_PAY_METHOD_CD_VACCOUNTISSUE = "VACCOUNTISSUE"; + /** 다우 페이 콜백 - 결제수단 - 가상계좌 결과통보 {@value} */ + public static final String DAOU_PAY_PAY_METHOD_CD_VACCOUNT = "VACCOUNT"; + /** 다우 페이 콜백 - 결제수단 - 계좌이체 결과통보 {@value} */ + public static final String DAOU_PAY_PAY_METHOD_CD_BANK = "BANK"; + + + /** 다우 페이 비과세 여부 코드 - 과세 {@value} */ + public static final String DAOU_PAY_TAX_FREE_CD_00 = "00"; + /** 다우 페이 비과세 여부 코드 - 비과세 {@value} */ + public static final String DAOU_PAY_TAX_FREE_CD_01 = "01"; + + + /** PG사 코드 - 다우페이 {@value} */ + public static final String PG_CD_DAOU = "DAOU"; + public static final String PG_CD_INICIS = "INICIS"; + + + /** 구매평 샘플 코드 - 매우좋아요 {@value} */ + public static final String BUY_EVAL_SAMPLE_CD_01 = "01"; + /** 구매평 샘플 코드 - 좋아요 {@value} */ + public static final String BUY_EVAL_SAMPLE_CD_02 = "02"; + /** 구매평 샘플 코드 - 보통입니다 {@value} */ + public static final String BUY_EVAL_SAMPLE_CD_03 = "03"; + /** 구매평 샘플 코드 - 별로입니다 {@value} */ + public static final String BUY_EVAL_SAMPLE_CD_04 = "04"; + /** 구매평 샘플 코드 - 매우별로 {@value} */ + public static final String BUY_EVAL_SAMPLE_CD_05 = "05"; + + + /** 적립금 구분 코드 - 구매확정 {@value} */ + public static final String SAVE_CASH_TYPE_CD_01 = "01"; + /** 적립금 구분 코드 - SNS 공유 {@value} */ + public static final String SAVE_CASH_TYPE_CD_02 = "02"; + /** 적립금 구분 코드 - 가격구간 할인 {@value} */ + public static final String SAVE_CASH_TYPE_CD_03 = "03"; + /** 적립금 구분 코드 - 구매후기 {@value} */ + public static final String SAVE_CASH_TYPE_CD_04 = "04"; + /** 적립금 구분 코드 - 인출신청 {@value} */ + public static final String SAVE_CASH_TYPE_CD_05 = "05"; + /** 적립금 구분 코드 - 인출완료 {@value} */ + public static final String SAVE_CASH_TYPE_CD_06 = "06"; + /** 적립금 구분 코드 - 인출불가 {@value} */ + public static final String SAVE_CASH_TYPE_CD_07 = "07"; + /** 적립금 구분 코드 - 인출취소 {@value} */ + public static final String SAVE_CASH_TYPE_CD_08 = "08"; + /** 적립금 구분 코드 - 결제 {@value} */ + public static final String SAVE_CASH_TYPE_CD_09 = "09"; + /** 적립금 구분 코드 - 결제취소 {@value} */ + public static final String SAVE_CASH_TYPE_CD_10 = "10"; + /** 적립금 구분 코드 - 구매평 {@value} */ + public static final String SAVE_CASH_TYPE_CD_11 = "11"; + /** 적립금 구분 코드 - 이벤트 {@value} */ + public static final String SAVE_CASH_TYPE_CD_30 = "30"; + /** 적립금 구분 코드 - 회원가입 {@value} */ + public static final String SAVE_CASH_TYPE_CD_40 = "40"; + /** 적립금 구분 코드 - 회원가입 추천인 ID {@value} */ + public static final String SAVE_CASH_TYPE_CD_41 = "41"; + + /**쿠폰 타입 구분 코드 + + + /** 인출신청 상태 코드 - 신청 {@value} */ + public static final String WITHDRAW_REQUEST_STATUS_CD_01 = "01"; + /** 인출신청 상태 코드 - 처리완료 {@value} */ + public static final String WITHDRAW_REQUEST_STATUS_CD_02 = "02"; + /** 인출신청 상태 코드 - 불가 {@value} */ + public static final String WITHDRAW_REQUEST_STATUS_CD_03 = "03"; + /** 인출신청 상태 코드 - 취소 {@value} */ + public static final String WITHDRAW_REQUEST_STATUS_CD_04 = "04"; + + + /** 결제 타입 코드 - 주문 {@value} */ + public static final String PAY_TYPE_CD_ORDER = "ORDER"; + /** 결제 타입 코드 - 취소 {@value} */ + public static final String PAY_TYPE_CD_CANCEL = "CANCEL"; + /** 결제 타입 코드 - 재결제 {@value} */ + public static final String PAY_TYPE_CD_REPAY = "REPAY"; + + /** SNS 유형 코드 - facebook {@value} */ + public static final String SNS_TYPE_CD_FACEBOOK = "01"; + /** SNS 유형 코드 - twitter {@value} */ + public static final String SNS_TYPE_CD_TWITTER= "02"; + /** SNS 유형 코드 - naver {@value} */ + public static final String SNS_TYPE_CD_NAVER= "03"; + /** SNS 유형 코드 - daumCafe {@value} */ + public static final String SNS_TYPE_CD_DAUMCAFE= "04"; + /** SNS 유형 코드 - tumblr {@value} */ + public static final String SNS_TYPE_CD_TUMBLR= "05"; + /** SNS 유형 코드 - pinterest {@value} */ + public static final String SNS_TYPE_CD_PINTEREST= "06"; + /** SNS 유형 코드 - google {@value} */ + public static final String SNS_TYPE_CD_GOOGLE= "07"; + /** SNS 유형 코드 - kakaoStory {@value} */ + public static final String SNS_TYPE_CD_KAKAOSTORY= "08"; + /** SNS 유형 코드 - band {@value} */ + public static final String SNS_TYPE_CD_BAND= "09"; + + + /** 추천인 유형 코드 - 없음 {@value} */ + public static final String RECOMMENDER_TYPE_CD_NONE = "00"; + /** 추천인 유형 코드 - 판매자 {@value} */ + public static final String RECOMMENDER_TYPE_CD_SELLER = "01"; + /** 추천인 유형 코드 - 일반사용자 {@value} */ + public static final String RECOMMENDER_TYPE_CD_USER = "02"; + + /** 광고 딜 그룹 타입 코드 - 전체 {@value} */ + public static final String AD_DEAL_GRP_TYPE_CD_A = "A"; + /** 광고 딜 그룹 타입 코드 - PC {@value} */ + public static final String AD_DEAL_GRP_TYPE_CD_P = "P"; + /** 광고 딜 그룹 타입 코드 - 모바일 {@value} */ + public static final String AD_DEAL_GRP_TYPE_CD_M = "M"; + + /** 정산 상태 코드 - 정산예정{@value} */ + public static final String CAL_STATUS_CD_101 = "101"; + /** 정산 상태 코드 - 정산완료{@value} */ + public static final String CAL_STATUS_CD_201 = "201"; + + /** 송금 상태 코드 - 송금전{@value} */ + public static final String REMIT_STATUS_CD_101 = "101"; + /** 송금 상태 코드 - 송금완료{@value} */ + public static final String REMIT_STATUS_CD_201 = "201"; + + /** 세금계산서 발행 코드 - 발행대기{@value} */ + public static final String TAX_BILL_PUB_CD_101 = "101"; + /** 세금계산서 발행 코드 - 발행완료{@value} */ + public static final String TAX_BILL_PUB_CD_201 = "201"; + + + /** 다우페이 결과 코드 - 성공 */ + public static final String DAOU_PAY_RESULT_CD_0000 = "0000"; + /** 다우페이 결과 코드 - 취소가능 금액 부족 */ + public static final String DAOU_PAY_RESULT_CD_9029 = "9029"; + /** 다우페이 결과 코드 - 이미 취소 되었습니다 */ + public static final String DAOU_PAY_RESULT_CD_9112 = "9112"; + /** 다우페이 결과 코드 - 예외상황-에러발생 */ + public static final String DAOU_PAY_RESULT_CD_9999 = "9999"; +} \ No newline at end of file diff --git a/src/main/java/com/loglog/api/commons/constants/CodeGrpConstant.java b/src/main/java/com/loglog/api/commons/constants/CodeGrpConstant.java new file mode 100644 index 0000000..96ae531 --- /dev/null +++ b/src/main/java/com/loglog/api/commons/constants/CodeGrpConstant.java @@ -0,0 +1,153 @@ +package com.loglog.api.commons.constants; + +/** + * TB_CODE_GRP 테이블 상수정의 + * + * @author SJW + */ +public class CodeGrpConstant { + + /** 이메일 - {@value} */ + public static final String EMAIL = "1"; + + /** 사용자회원 상태코드 - {@value} */ + public static final String USER_STATUS_CD = "2"; + + /** 지역번호코드 - {@value} */ + public static final String AREA_CD = "3"; + + /** 통신사코드 - {@value} */ + public static final String MOBILE_CD = "4"; + + /** 대금결제은행코드(G마켓ESM참조) - {@value} */ + public static final String ACCOUNT_BANK_CD = "5"; + + /** 사업자종류코드 - {@value} */ + public static final String BIZ_TYPE_CD = "6"; + + /** 판매자유형코드 - {@value} */ + public static final String SELLER_TYPE_CD = "7"; + + /** 상품형태코드 - {@value} */ + public static final String PRODUCT_TYPE_CD = "8"; + + /** 주소종류코드 - {@value} */ + public static final String ADDR_TYPE_CD = "9"; + + /** 과세 구분 코드 - {@value} */ + public static final String TAX_TYPE_CD = "10"; + + /** 배송 방법 코드 - {@value} */ + public static final String DELI_TYPE_CD = "11"; + + /** 배송비 유형 코드 - {@value} */ + public static final String DELI_FEE_TYPE_CD = "12"; + + /** 배송비 결제 방식 코드 - {@value} */ + public static final String DELI_FEE_PAY_TYPE_CD = "13"; + + /** 판매자 상태 코드 - {@value} */ + public static final String SELLER_STATUS_CD = "14"; + + /** 인증 상태 코드 - {@value} */ + public static final String AUTH_STATUS_CD = "15"; + + /** 배송비 그룹 계산 방식 코드 - {@value} */ + public static final String DELI_FEE_GROUP_CAL_TYPE_CD = "16"; + + /** 질문 코드 - {@value} */ + public static final String QUESTION_CD = "17"; + + /** 딜 상태 코드 - {@value} */ + public static final String DEAL_STATUS_CD = "18"; + + /** 옵션 타입 코드 - {@value} */ + public static final String OPTION_TYPE_CD = "19"; + + /** 결제 수단 코드 - {@value} */ + public static final String PAY_MEANS_CD = "20"; + + /** 주문 상태 코드 - {@value} */ + public static final String ORDER_STATUS_CD = "28"; + + /** 회원 구분 코드 - {@value} */ + public static final String MEMBER_TYPE_CD = "29"; + + /** 결제 상태 코드 - {@value} */ + public static final String PAY_STATUS_CD = "30"; + + /** 게시 기간 코드 - {@value} */ + public static final String INFORM_DT_CD = "31"; + + /** 발송 메일 주소 코드 - {@value} */ + public static final String SEND_MAIL_CD = "32"; + + /** 다우 페이 카드 코드 - {@value} */ + public static final String DAOU_PAY_CARD_CD = "33"; + + /** 다우 페이 상품 구분 코드 - {@value} */ + public static final String DAOU_PAY_PRODUCT_TYPE_CD = "34"; + + /** 다우 페이 과금 유형 코드 - {@value} */ + public static final String DAOU_PAY_BILL_TYPE_CD = "35"; + + /** 다우 페이 콜백 - 결제수단 - {@value} */ + public static final String DAOU_PAY_PAY_METHOD_CD = "36"; + + /** 다우 페이 비과세 여부 코드 - {@value} */ + public static final String DAOU_PAY_TAX_FREE_CD = "37"; + + /** 1대1 문의유형 코드 - {@value} */ + public static final String INQUIRY_TYPE_CD = "38"; + + /** PG사 코드 - {@value} */ + public static final String PG_CD = "39"; + + /** 공지사항 종류 코드 -{@value} */ + public static final String USER_SELLER_TYPE_CD = "40"; + + /** 공지사항 내용 분류 코드 -{@value} */ + public static final String NOTI_CONT_TYPE_CD = "41"; + + /** 자주하는질문 분류 코드 -{@value} */ + public static final String FAQ_TYPE_CD = "42"; + + /** 구매평 샘플 코드 -{@value} */ + public static final String BUY_EVAL_SAMPLE_CD = "43"; + + /** 적립금 구분 코드 -{@value} */ + public static final String SAVE_CASH_TYPE_CD = "44"; + + /** 인출 요청 상태 코드 -{@value} */ + public static final String WITHDRAW_REQUEST_STATUS_CD = "47"; + + /** 주문 취소 사유 코드 -{@value} */ + public static final String ORDER_CANCEL_REASON_CD = "48"; + + /** 결제 타입 코드 -{@value} */ + public static final String PAY_TYPE_CD = "49"; + + /** SNS 유형 코드 -{@value} */ + public static final String SNS_TYPE_CD = "50"; + + /** 추천인 유형 코드 -{@value} */ + public static final String RECOMMENDER_TYPE_CD = "51"; + + /** 광고 딜 그룹 타입 코드 -{@value} */ + public static final String AD_DEAL_GRP_TYPE_CD = "52"; + + /** 딜 타입 코드 -{@value} */ + public static final String DEAL_TYPE_CD = "53"; + + /** 정산 상태 코드 -{@value} */ + public static final String CAL_STATUS_CD = "54"; + + /** 송금 상태 코드 -{@value} */ + public static final String REMIT_STATUS_CD = "55"; + + /** 세금계산서 발행 코드 -{@value} */ + public static final String TAX_BILL_PUB_CD = "56"; + + /** 다우페이 결과 코드 -{@value} */ + public static final String DAOU_PAY_RESULT_CODE = "57"; +} \ No newline at end of file diff --git a/src/main/java/com/loglog/api/commons/constants/Constants.java b/src/main/java/com/loglog/api/commons/constants/Constants.java new file mode 100644 index 0000000..b41062c --- /dev/null +++ b/src/main/java/com/loglog/api/commons/constants/Constants.java @@ -0,0 +1,87 @@ +package com.loglog.api.commons.constants; + +public final class Constants { + + public static final String OK = "ok"; + + public static final String FAIL = "fail"; + + public static final String WAIT = "wait"; + + public static final String OK_PAY = "okPay"; + + public static final String RESULT = "result"; + + public static final String RESULT_MSG = "resultMsg"; + + public static final String REDIRECT_MSG = "redirectMsg"; + + public static final String RESULT_URL = "resultUrl"; + + public static final String AUTH_TOKEN = "auth_token"; + + public static final String SESSION_USER_ID = "userId"; + + public static final String SESSION_ADMIN_BEAN = "adminBean"; + + public static final String SESSION_SELLER_BEAN = "sellerBean"; + + public static final String SESSION_USER_BEAN = "userBean"; + + public static final String BASE_PACKAGE = "com.loglog.api"; + public static final String COMM_PACKAGE = "com.loglog.api.commons"; + + /** 세션에 저장된 판매자의 구분코드를 저장 **/ + public static final String SESSION_SELLER_TYPE_CD = "sessionSellerTypeCd"; + + /** 네이버 회원가입 임시 유져정보 저장 **/ + public static final String SESSION_NAVER_TEMP_USER_BEAN = "sessioNaverTempUserBean"; + + public static final String SESSION_RECOMMENDER_ID = "recommenderId"; + + public static final String SESSION_SNS_MAP = "snsMap"; + + public static final String SESSION_ORDER_BEAN = "orderBean"; + + /** 나이스 SMS 요청시 세션에 저장하는 요청번호(고유번호) **/ + public static final String SESSION_SMS_NICE_REQ_NUMBER = "sessionSmsNiceReqNumber"; + + public static final String USER_FORM = "1"; + + public static final String SELLER_FORM = "2"; + + public static final String ADMIN_FORM = "3"; + + public static final String UPDATE_FLAG = "updateFlag"; + + public static final String CHECK_PW_LOCATION = "chkPwLocation"; + + public static final String CATE_LEVEL2_LIST = "cateLevel2List"; + + /** 서버 키 - 사용자 */ + public static final String SERVER_USER = "U"; + /** 서버 키 - 판매자 */ + public static final String SERVER_SELLER = "S"; + /** 서버 키 - 관리자 */ + public static final String SERVER_ADMIN = "A"; + /** 서버 키 - 모바일 */ + public static final String SERVER_MOBILE = "M"; + + /** 관리자 메일 */ + public static final String ADMIN_MAIL = "sales@showpun.com"; + + /** 메일전송 방식 - 네이버웍스 **/ + public static final int MAIL_TYPE_NAVER_WORKS = 1; + /** 메일전송 방식 - 지메일 **/ + public static final int MAIL_TYPE_GMAIL = 2; + + + /** 나이스 SMS 인증시 사용자 ID를 세션에 저장할때 사용하는 키 **/ + public static final String NICE_SESSION_USER_ID = "niceSessionUserId"; + /** 나이스 SMS 인증시 사용자 이름을 세션에 저장할때 사용하는 키 **/ + public static final String NICE_SESSION_USER_NAME = "niceSessionUserName"; + + + public static final String VER_BUILD_DATE = "VER_BUILD_DATE"; + +} diff --git a/src/main/java/com/loglog/api/commons/daos/BoardDao.java b/src/main/java/com/loglog/api/commons/daos/BoardDao.java new file mode 100644 index 0000000..e59eaa4 --- /dev/null +++ b/src/main/java/com/loglog/api/commons/daos/BoardDao.java @@ -0,0 +1,30 @@ +package com.loglog.api.commons.daos; + +import java.util.List; + +import com.loglog.api.commons.beans.BoardBean; +import com.loglog.api.commons.beans.PagingBean; + +public interface BoardDao { + + /** 글작성 */ + public void insertBoard(BoardBean boardBean); + + /** 게시글 수정 */ + public int updateBoard(BoardBean boardBean); + + /** 게시글 갯수 */ + public int selectBoardCount(PagingBean pagingBean); + + /** 글 목록 가져오기 */ + public List boardList(PagingBean pagingBean); + + /** 조회수 업데이트 */ + public void updateHit(BoardBean boardBean); + + /** 글 상세보기 */ + public BoardBean selectInBoard(BoardBean boardBean); + + /** 글 삭제하기 */ + public void deleteBoard(BoardBean boardBean); +} diff --git a/src/main/java/com/loglog/api/commons/daos/BoardFileDao.java b/src/main/java/com/loglog/api/commons/daos/BoardFileDao.java new file mode 100644 index 0000000..c62b657 --- /dev/null +++ b/src/main/java/com/loglog/api/commons/daos/BoardFileDao.java @@ -0,0 +1,32 @@ +package com.loglog.api.commons.daos; + +import java.util.List; + +import org.apache.ibatis.annotations.Param; + +import com.loglog.api.commons.beans.BoardBean; +import com.loglog.api.commons.beans.BoardFileBean; + + +public interface BoardFileDao { + /**게시물 이미지/파일 등록 */ + public int insertBoardFile(BoardFileBean boardFileBean); + + /** 게시글 수정시 삭제할 이미지/파일 목록 */ + public List deleteFileList(@Param("bdNo") int bdNo,@Param("boardFileArray") List boardFileArray); + + /** 게시글 수정시 삭제할 이미지/파일 목록 - 교육신청 */ + public List deleteFileListEdu(@Param("eduNo") int eduNo,@Param("boardFileArray") List boardFileArray); + + /** 게시글 수정시 이미지/파일 삭제 */ + public void deleteFileForUpdate(@Param("boardFileList") List boardFileList); + + /** 한개의 글 이미지/파일 목록 */ + public List selectBoardFile(int bdNo); + + /** 많은 게시물 이미지/파일들 가져오기 */ + public List boardFileList(@Param("boardList") List boardList); + /** 게시글 이미지/파일 삭제 */ + public void deleteFile(@Param("bdNo") int bdNo); + +} diff --git a/src/main/java/com/loglog/api/commons/daos/BoardImgDao.java b/src/main/java/com/loglog/api/commons/daos/BoardImgDao.java new file mode 100644 index 0000000..f2f0fe4 --- /dev/null +++ b/src/main/java/com/loglog/api/commons/daos/BoardImgDao.java @@ -0,0 +1,44 @@ +package com.loglog.api.commons.daos; + +import java.util.List; + +import org.apache.ibatis.annotations.Param; + +import com.loglog.api.commons.beans.BoardBean; +import com.loglog.api.commons.beans.BoardImgBean; + +public interface BoardImgDao { + + /** 게시글 이미지 등록 */ + public int insertBoardImg(BoardImgBean boardImgBean); + + /** 게시글 이미지 수정 */ + public int updateBoardImg(BoardImgBean boardImgBean); + + /** 게시글 이미지 수정 -교육신청- */ + public int updateBoardImgEdu(BoardImgBean boardImgBean); + + /** 게시글 수정시 이미지 삭제 */ + public void deleteImgForUpdate(@Param("boardImgList") List boardImgList); + + /** 게시글 수정시 삭제할 이미지 목록 */ + public List deleteImgList(@Param("bdNo") int bdNo,@Param("boardImgArray") List boardImgArray); + + /** 게시글 수정시 삭제할 이미지 목록 - 교육신청*/ + public List deleteImgListEdu(@Param("eduNo") int eduNo,@Param("boardImgArray") List boardImgArray); + + /** 많은 게시물 이미지들 가져오기 -게시판- */ + public List boardImgList(@Param("boardList") List list); + + /** 한개의 글 이미지 목록 */ + public List selectBoardImg(int bdNo); + + /** 한개의 글 이미지 목록 */ + public List selectBoardImgEdu(int eduNo); + + /** 게시글 이미지 삭제 */ + public void deleteImg(@Param("bdNo") int bdNo); + + /** 게시글 이미지 삭제 */ + public void deleteImgEdu(@Param("eduNo") int eduNo); +} diff --git a/src/main/java/com/loglog/api/commons/daos/BoardReplyDao.java b/src/main/java/com/loglog/api/commons/daos/BoardReplyDao.java new file mode 100644 index 0000000..24b80b7 --- /dev/null +++ b/src/main/java/com/loglog/api/commons/daos/BoardReplyDao.java @@ -0,0 +1,43 @@ +package com.loglog.api.commons.daos; + +import java.util.List; + +import com.loglog.api.commons.beans.BoardReplyBean; +import com.loglog.api.commons.beans.PagingBean; + + +public interface BoardReplyDao { + + /** 댓글 입력 */ + public int insertReply(BoardReplyBean replyBean); + + /** 댓글목록 갯수 가져오기 */ + public int replyListCount(PagingBean pagingBean); + + /** 댓글목록 가져오기 */ + public List replyList(PagingBean pagingBean); + + /** 댓글 1건 삭제 */ + public int deleteReply(BoardReplyBean replyBean); + + /** 댓글 여러건 삭제 */ + public int deleteReplyList(BoardReplyBean replyBean); + + /** 댓글 수정 */ + public int updateReply(BoardReplyBean replyBean); + + /** 댓글 하나 가져오기 */ + public BoardReplyBean selectTheReply(BoardReplyBean replyBean); + + /** 댓글 비밀번호 + 입력 */ + public int insertNeedPassReply(BoardReplyBean replyBean); + + /** 댓글 비밀번호 비교 */ + public int selectReplyPass(BoardReplyBean replyBean); + + /** 댓글 비밀번호 수정 */ + public int updateNeedPassReply(BoardReplyBean replyBean); + + /** 댓글 + 비밀번호 1건 삭제 */ + public int deleteNeedPassReply(BoardReplyBean replyBean); +} diff --git a/src/main/java/com/loglog/api/commons/daos/CalenderDao.java b/src/main/java/com/loglog/api/commons/daos/CalenderDao.java new file mode 100644 index 0000000..eb1e22f --- /dev/null +++ b/src/main/java/com/loglog/api/commons/daos/CalenderDao.java @@ -0,0 +1,51 @@ +package com.loglog.api.commons.daos; + +import java.util.List; +import java.util.Map; + +import com.loglog.api.commons.beans.PagingBean; +import com.loglog.api.commons.beans.CalenderBean; + +/** + * 사용자 DAO + * + * @author SJG + */ +public interface CalenderDao { + + /** 상점정보 있는지 체크 */ + public int selectShopInfo(CalenderBean calenderBean); + + /** 내점기록 저장 */ + public int insertCalender(CalenderBean calenderBean); + + /** 캘린더 조회 */ + public List selectCalenderMon(CalenderBean calenderBean); + + /** 스케줄 저장 */ + public int insertSchedule(CalenderBean calenderBean); + + /** 스케줄 디테일 조회*/ + public List selectCalenderDay(CalenderBean calenderBean); + + /** 스케줄 업데이트 */ + public int updateCalender(CalenderBean calenderBean); + + /** 저장후 고유ID를 이용해 데이터를 조회*/ + public CalenderBean selectCalenderId(CalenderBean calenderBean); + + /** 내점기록저장후 내용이나 사진 업데이트*/ + public int updateCalenderthum(CalenderBean calenderBean); + + /** 업데이트 이후 ID값을 이용해 조회후 출력*/ + public CalenderBean selectUpdateId(CalenderBean calenderBean); + + /** 내점이력 삭제*/ + public int deleteVisitCalender(CalenderBean calenderBean); + + /**내점이력 리스트 조회*/ + public List selectVisitList(CalenderBean calenderBean); + + /**섬네일 초기화*/ + public int cleanCalenderThum(CalenderBean calenderBean); +} \ No newline at end of file diff --git a/src/main/java/com/loglog/api/commons/daos/CardImgDao.java b/src/main/java/com/loglog/api/commons/daos/CardImgDao.java new file mode 100644 index 0000000..becd298 --- /dev/null +++ b/src/main/java/com/loglog/api/commons/daos/CardImgDao.java @@ -0,0 +1,42 @@ +package com.loglog.api.commons.daos; + +import java.util.List; +import java.util.Map; + +import org.apache.ibatis.annotations.Param; + +import com.loglog.api.commons.beans.PagingBean; +import com.loglog.api.commons.beans.UserBean; +import com.loglog.api.commons.beans.CardImgBean; +import com.loglog.api.commons.beans.CardMasterBean; +import com.loglog.api.commons.beans.CouponPublicBean; +import com.loglog.api.commons.beans.CouponUserListBean; +/** + * 사용자 DAO + * + * @author SJG + */ +public interface CardImgDao { + /**카드 이미지 등록*/ + public int insertCardImg(CardImgBean cardImgBean); + + /**카드 이미지 수정*/ + public int updateCardImg(CardImgBean cardImgBean); + + /** 카드 이미지 삭제*/ + public void DeleteImg(int janNo )throws Exception; + + /** 카드 이미지 리스트*/ + public List cardImgList(List list); + + /** 게시글 수정시 이미지 삭제 */ + public void deleteImgForUpdate(@Param("boardImgList") List cardImgList); + + /** 게시글 수정시 삭제할 이미지 목록 */ + public List deleteImgList(@Param("janNo") String janNo, @Param("cardImgArray") List cardImgArray); + + /** 게시글 이미지 삭제 */ + public void deleteImg(@Param("janNo") String janNo); + + +} \ No newline at end of file diff --git a/src/main/java/com/loglog/api/commons/daos/CardMasterDao.java b/src/main/java/com/loglog/api/commons/daos/CardMasterDao.java new file mode 100644 index 0000000..63c9c2b --- /dev/null +++ b/src/main/java/com/loglog/api/commons/daos/CardMasterDao.java @@ -0,0 +1,68 @@ +package com.loglog.api.commons.daos; + +import java.util.List; +import java.util.Map; + +import com.loglog.api.commons.beans.PagingBean; +import com.loglog.api.commons.beans.UserBean; +import com.loglog.api.commons.beans.CardMasterBean; +import com.loglog.api.commons.beans.CouponPublicBean; +import com.loglog.api.commons.beans.ShopMasterBean; +/** + * 사용자 DAO + * + * @author SJG + */ +public interface CardMasterDao { + /** 유저 카드 이미지 조회 */ + public List selectCardList(CardMasterBean cardMasterBean); + + /**카드저장*/ + public int insertCard(CardMasterBean cardMasterBean); + + /**카드저장*/ + public int insertCardNoimg(CardMasterBean cardMasterBean); + + /**카드 저장전 중복체크*/ + public int checkCardNm(CardMasterBean cardMasterBean); + + /**카드 수정 전 카드이름 중복체크*/ + public int checkCardNmUpdate(CardMasterBean cardMasterBean); + + /**카드 정보 수정*/ + public int updateCard(CardMasterBean cardMasterBean); + + /**카드 정보 수정*/ + public int updateCardNoimg(CardMasterBean cardMasterBean); + + /**카드 정보 삭제*/ + public int deleteCard(CardMasterBean cardMasterBean); + + /**자세한 카드정보 조회*/ + public CardMasterBean detailCard(CardMasterBean cardMasterBean); + + /**포인트값 더하기 */ + public int updatePoint(CardMasterBean cardMasterBean); + + /**포인트값 치김 */ + public int deletePoint(CardMasterBean cardMasterBean); + + /**포인트값 null을 0으로 바꾸기 */ + public int changZeroPoint(CardMasterBean cardMasterBean); + + /**포인트값 조회 */ + public int selectPoint(CardMasterBean cardMasterBean); + + /** 즐겨찾기한 카드 조회 */ + public List selectLikeCardList(CardMasterBean cardMasterBean); + + /**카드좋아요 */ + public int likeCard(CardMasterBean cardMasterBean); + + /**카드좋아요 취소ㅓ */ + public int unlikeCard(CardMasterBean cardMasterBean); + + /**마이카드 등록하기 전 등록하지 않은 상점리스트 출력*/ + public List selectNotRegisShopList(CardMasterBean cardMasterBean); + +} \ No newline at end of file diff --git a/src/main/java/com/loglog/api/commons/daos/CouponLikedDao.java b/src/main/java/com/loglog/api/commons/daos/CouponLikedDao.java new file mode 100644 index 0000000..accfdbf --- /dev/null +++ b/src/main/java/com/loglog/api/commons/daos/CouponLikedDao.java @@ -0,0 +1,17 @@ +package com.loglog.api.commons.daos; + +import java.util.List; +import java.util.Map; + +import com.loglog.api.commons.beans.PagingBean; +import com.loglog.api.commons.beans.UserBean; + +/** + * 사용자 DAO + * + * @author SJG + */ +public interface CouponLikedDao { + + +} \ No newline at end of file diff --git a/src/main/java/com/loglog/api/commons/daos/CouponMasterDao.java b/src/main/java/com/loglog/api/commons/daos/CouponMasterDao.java new file mode 100644 index 0000000..30f4bed --- /dev/null +++ b/src/main/java/com/loglog/api/commons/daos/CouponMasterDao.java @@ -0,0 +1,20 @@ +package com.loglog.api.commons.daos; + +import java.util.List; +import java.util.Map; + +import com.loglog.api.commons.beans.PagingBean; +import com.loglog.api.commons.beans.UserBean; +import com.loglog.api.commons.beans.CouponMasterBean; +/** + * 사용자 DAO + * + * @author SJG + */ +public interface CouponMasterDao { + + public int selectCouponPage(CouponMasterBean couponMasterBean); + + public CouponMasterBean selectCouponDetail(CouponMasterBean CouponMasterBean); + +} \ No newline at end of file diff --git a/src/main/java/com/loglog/api/commons/daos/CouponPublicDao.java b/src/main/java/com/loglog/api/commons/daos/CouponPublicDao.java new file mode 100644 index 0000000..7456195 --- /dev/null +++ b/src/main/java/com/loglog/api/commons/daos/CouponPublicDao.java @@ -0,0 +1,70 @@ +package com.loglog.api.commons.daos; + +import java.util.List; +import java.util.Map; + +import com.loglog.api.commons.beans.GeolocationBean; +import com.loglog.api.commons.beans.PagingBean; +import com.loglog.api.commons.beans.CouponPublicBean; +import com.loglog.api.commons.beans.CouponUserListBean; +import com.loglog.api.commons.beans.CategoryBean; +/** + * 사용자 DAO + * + * @author SJG + */ +public interface CouponPublicDao { + + /**사용자 쿠폰정보 가져오기 위경도값 없음 */ + public List selectGetCoupons(Map parameter); + + /**사용자 쿠폰정보 가져오기 위경도값 있음 */ + public List selectGeoGetCoupons(Map parameter); + + /**쿠폰 갯수 반환 */ + public int selectCouponCount(Map parameter); + + /**쿠폰생성(유효회원이 아닐때) */ + public int insertCouponNotPaid(CouponPublicBean couponPublicBean); + + /**쿠폰생성(유효회원) */ + public int insertCouponPaid(CouponPublicBean couponPublicBean); + + /**좋아요 쿠폰 개수 반환*/ + public int selectLikeCouponCount(Map parameter); + + /** 좋아요 쿠폰 조회 */ + public List selectGetLikeCoupons(Map parameter); + + /**쿠폰 좋아요*/ + public int insertCouponLike(CouponPublicBean couponPublicBean); + + /**쿠폰 좋아요*/ + public int insertCouponUnLike(CouponPublicBean couponPublicBean); + + /**쿠폰 사용*/ + public int insertUseCoupon(CouponPublicBean couponPublicBean); + + /**상세정보를 확인한 쿠폰 개수 반환*/ + public int selectSeenCouponCount(Map parameter); + + /**coupon_seen에 중복데이터 체크*/ + public int selectSeenCheck(CouponPublicBean couponPublicBean); + + /**상세정보를 확인한 쿠폰 리스트 */ + public List selectSeenCoupons(Map parameter); + + /**쿠폰 상세정보를 볼때 DB업데이트 - coupon_seen*/ + public int insertSeenCoupon(CouponPublicBean couponPublicBean); + + /**카테고리 리스트*/ + public List selectCategoryList(CategoryBean categoryBean); + + /**쿠폰의 존재 여부 체크*/ + public int selectCouponCheck(CouponPublicBean couponPublicBean); + + /**쿠폰의 사용여부 체크*/ + public int selectUsedCouponCheck(CouponPublicBean couponPublicBean); + + +} \ No newline at end of file diff --git a/src/main/java/com/loglog/api/commons/daos/CouponUsedDao.java b/src/main/java/com/loglog/api/commons/daos/CouponUsedDao.java new file mode 100644 index 0000000..31c5552 --- /dev/null +++ b/src/main/java/com/loglog/api/commons/daos/CouponUsedDao.java @@ -0,0 +1,17 @@ +package com.loglog.api.commons.daos; + +import java.util.List; +import java.util.Map; + +import com.loglog.api.commons.beans.PagingBean; +import com.loglog.api.commons.beans.UserBean; + +/** + * 사용자 DAO + * + * @author SJG + */ +public interface CouponUsedDao { + + +} \ No newline at end of file diff --git a/src/main/java/com/loglog/api/commons/daos/MsgMasterDao.java b/src/main/java/com/loglog/api/commons/daos/MsgMasterDao.java new file mode 100644 index 0000000..5b111a7 --- /dev/null +++ b/src/main/java/com/loglog/api/commons/daos/MsgMasterDao.java @@ -0,0 +1,49 @@ +package com.loglog.api.commons.daos; + +import java.util.List; +import java.util.Map; + +import com.loglog.api.commons.beans.PagingBean; +import com.loglog.api.commons.beans.MsgMasterBean; + +/** + * 사용자 DAO + * + * @author SJG + */ +public interface MsgMasterDao { + + /** 뮤저 전체 메세지 출력 */ + public List selectMsgText(MsgMasterBean msgMasterBean); + + /**통지 메시지 출력*/ + public List selectNoitMsg(MsgMasterBean msgMasterBean); + + /**유저 전체 메세지 디테일*/ + public MsgMasterBean selectMsgTextDetail(MsgMasterBean msgMasterBean); + + /**유저 통지 메세지 디테일*/ + public MsgMasterBean selectNoitMsgDetail(MsgMasterBean msgMasterBean); + + /**즐겨찾기한 상점의 메세지리스트*/ + public List selectShopMsgList(MsgMasterBean msgMasterBean); + + /**즐겨찾기한 상점이 보내준 메세지 상세내용*/ + public List selectShopMsgDetail(MsgMasterBean msgMasterBean); + + /**오시라세 디테일 확인시 seen컬럼 1로 업데이트*/ + public int updateMsgSeen(MsgMasterBean msgMasterBean); + + /**msgType : 1인 메세지의 상세내용*/ + public List selectMegDeltail(MsgMasterBean msgMasterBean); + + /**유저 읽지 않은 통지 메세지 개수 반환*/ + public MsgMasterBean selectNotReadNotice(MsgMasterBean msgMasterBean); + + /**유저 읽지 않은 오시라세 메세지 개수 반환*/ + public MsgMasterBean selectNotReadShopMsg(MsgMasterBean msgMasterBean); + + /**통지 상세보기 읽음처리*/ + public int updateNoticSeen(MsgMasterBean msgMasterBean); + +} \ No newline at end of file diff --git a/src/main/java/com/loglog/api/commons/daos/NotiAttachDao.java b/src/main/java/com/loglog/api/commons/daos/NotiAttachDao.java new file mode 100644 index 0000000..cd5eeaf --- /dev/null +++ b/src/main/java/com/loglog/api/commons/daos/NotiAttachDao.java @@ -0,0 +1,36 @@ +package com.loglog.api.commons.daos; + +import java.util.List; + +import org.apache.ibatis.annotations.Param; + +import com.loglog.api.commons.beans.NotiAttachBean; + + +/** + * 공지사항 첨부파일 Dao + * + * @author "JIK" + * + */ +public interface NotiAttachDao { + + /** 공지사항 첨부파일 정보 등록 */ + public int insertNotiAttach(NotiAttachBean notiAttachBean); + + /** 공지사항 첨부파일 정보 조회 */ + public List selectNotiAttach( + @Param("notiId")String notiId, + @Param("serverUrlAdmin") String serverUrlAdmin + ); + + /** 공지사항 첨부파일 다운로드 정보 조회 */ + public NotiAttachBean selectNotiAttachInfo(String notiAttachId); + + /** 공지사항 첨부파일 정보 삭제 */ + public int deleteNotiAttach( + @Param("notiAttachId")String notiAttachId + ); + + +} diff --git a/src/main/java/com/loglog/api/commons/daos/NotiDao.java b/src/main/java/com/loglog/api/commons/daos/NotiDao.java new file mode 100644 index 0000000..f16826c --- /dev/null +++ b/src/main/java/com/loglog/api/commons/daos/NotiDao.java @@ -0,0 +1,42 @@ +package com.loglog.api.commons.daos; + +import java.util.List; + +import com.loglog.api.commons.beans.NotiBean; +import com.loglog.api.commons.beans.PagingBean; + + +/** + * Noti Dao + * @author "JIK" + * + */ +public interface NotiDao { + + /** 공지사항 SelectNotiList */ + public List selectNotiList(PagingBean pagingBean); + + /** 공지사항 InsertNoti */ + public int insertNoti(NotiBean notiBean); + + /** 조회수 올리기 */ + public void updateHit(NotiBean notiBean); + + /** 공지사항 SelectNoti */ + public NotiBean selectNoti(NotiBean notiBean); + + /** 공지사항 UpdateNoti */ + public int updateNoti(NotiBean notiBean); + + /** 공지사항 DeleteNoti */ + public int deleteNoti(NotiBean notiBean); + + /** 공지사항 총 수 */ + public int notiTotCnt(PagingBean pagingBean); + + /** 공지사항 IndexList */ + public List selectNotiIndexList(PagingBean pagingBean); + + + +} diff --git a/src/main/java/com/loglog/api/commons/daos/ShopMasterDao.java b/src/main/java/com/loglog/api/commons/daos/ShopMasterDao.java new file mode 100644 index 0000000..2aa1e56 --- /dev/null +++ b/src/main/java/com/loglog/api/commons/daos/ShopMasterDao.java @@ -0,0 +1,44 @@ +package com.loglog.api.commons.daos; + +import java.util.List; + +import com.loglog.api.commons.beans.ShopMasterBean; +import com.loglog.api.commons.beans.PagingBean; +import com.loglog.api.commons.beans.ShopDetailBean; + + +/** + * Noti Dao + * @author "JIK" + * + */ +public interface ShopMasterDao { + + /**상점 상세정보*/ + public ShopDetailBean selectShopDetail(ShopDetailBean shopDetailBean); + + /**유저 주위의 상점 리스트 출력*/ + public List selectProxShopList(ShopMasterBean shopMasterBean); + + /**room 생성하기 전 중복체크*/ + public int selectCheckRoom(ShopMasterBean shopMasterBean); + + /**상점 즐겨찾기 - room 추가*/ + public int insertLikeShop(ShopMasterBean shopMasterBean); + + /**상점 즐겨찾기 - tempo_liked 추가*/ + public int insertLikeTempo(ShopMasterBean shopMasterBean); + + /**상점 즐겨찾기 취소*/ + public int calcelLikeShop(ShopMasterBean shopMasterBean); + + /**상점 즐겨찾기 취소 - tempo_liked*/ + public int deleteLikeTempo(ShopMasterBean shopMasterBean); + + /**즐겨찾기한 상점 리스트 출력*/ + public List selectShopList(ShopDetailBean shopDetailBean); + + /**상점이름으로 검색 출력 리스트*/ + public List selectSearchShopList(ShopDetailBean shopDetailBean); + +} diff --git a/src/main/java/com/loglog/api/commons/daos/UserDao.java b/src/main/java/com/loglog/api/commons/daos/UserDao.java new file mode 100644 index 0000000..22735b4 --- /dev/null +++ b/src/main/java/com/loglog/api/commons/daos/UserDao.java @@ -0,0 +1,123 @@ +package com.loglog.api.commons.daos; + +import java.util.List; +import java.util.Map; + +import com.loglog.api.commons.beans.PagingBean; +import com.loglog.api.commons.beans.UserBean; + +/** + * 사용자 DAO + * + * @author SJG + */ +public interface UserDao { + + /** 회원가입 */ + public int insertUser(UserBean userBean); + + /** UserCd값 가져오기 */ + public String selectUserCdStr(UserBean userBean); + + /** 아이디 중복 체크 */ + public int chkUserId(UserBean userBean); + + /**닉네임 중복 체크*/ + public int chkNickName(UserBean userBean); + + /**userCd 조회*/ + public int selectUserCd(UserBean userBean); + + /**로그인한 회원 정보 찾기 */ + public UserBean selectUser(UserBean userBean); + + /**로그인한 회원 상세정보 조회*/ + public UserBean selectUserDetail(UserBean userBean); + + /**세션아이디로 로그인한 회원 정보 찾기 */ + public UserBean selectUserBySessionId(String sessionId); + + /** 이전 세션쿠키로 로그인한 회원 확인 */ + public UserBean selectUserByBeforeSessionId(String sessionId); + + /** ID와 PW가 일치하는 회원 정보 찾기 */ + public UserBean selectUserPW(UserBean userBean); + + /**아이디 찾기 - JSON */ + public String findUserId(UserBean userBean); + + /**회원 비밀번호 찾을시 해당 정보 회원있는지 확인*/ + public int findUser(UserBean userBean); + + /**db에 새 비밀번호 세팅*/ + public int updateUserPw(UserBean userBean); + + /**update last login dt */ + public int updLastLoginDt(UserBean userBean); + + /**회원 정보 수정*/ + public int updateUser(UserBean userBean); + + /**회원 계좌 정보 수정*/ + public int updateAccount(UserBean userBean); + + /**db에 새 인출 비밀번호 세팅*/ + public void updateAccountPw(UserBean userBean); + + /**user table에 네이버 아이디 있는지 확인*/ + public int searchNaverIdInUserTable(UserBean userBean); + + /**사용자 총 수*/ + public int userTotCnt(PagingBean pagingBean); + + /**사용자 목록 조회*/ + public List selectUserList(Map parameter); + + /**사용자 목록 조회*/ + public List selectUserListByPagingBean(PagingBean pagingBean); + + /**사용자 상태 변경*/ + public int updateUserStatusCd(UserBean userBean); + + /**푸시알림, 자동로그인 설정값 변경*/ + public int updateUserSetting(UserBean userBean); + + /**사용자 답변 확인*/ + public int userAnswerChk(UserBean userBean); + + /**회원 탈퇴*/ + public int deleteUser(UserBean userBean); + + /**회원 비밀번호 찾을시 해당 정보 회원있는지 확인( 이름 -> 이메이로 대체)*/ + public int findUserL(UserBean userBean); + + /**db에 새 비밀번호 세팅 (이름 -> 이메일로 대체)*/ + public int updateUserPwL(UserBean userBean); + + /**이메일 체크 - JSON */ + public String findUserEmail(UserBean userBean); + + /** 사용자 목록 조회 정보 개수*/ + public int countUserList(PagingBean pagingBean); + + /** 회원 등급 수정 */ + public void updateUserLevel(Map parameter); + + /** 회원 탈퇴*/ + public UserBean userDelete(UserBean userBean); + + /** 회원이름 조회 */ + public UserBean userName(UserBean userBean); + + /**QR 로그인*/ + public UserBean qRLogin(UserBean userBean); + + /**비밀번호 수정 - 이메일을 모르고 UserCd를 아는 경우*/ + public int selectKnowUserCd(UserBean userBean); + + /** 사용자 이메일이 있는지 확인*/ + public int selectCheckEmail(UserBean userBean); + + /**이메일로 임시비밀번호를 보내면 비밀번호 업데이트*/ + public int updatetempPw(UserBean userBean); +} \ No newline at end of file diff --git a/src/main/java/com/loglog/api/commons/daos/mapper/BoardFileMapper.xml b/src/main/java/com/loglog/api/commons/daos/mapper/BoardFileMapper.xml new file mode 100644 index 0000000..cd17cbc --- /dev/null +++ b/src/main/java/com/loglog/api/commons/daos/mapper/BoardFileMapper.xml @@ -0,0 +1,152 @@ + + + + + + bd_file_no as bdFileNo, + bd_no as bdNo, + edu_no as eduNo, + reserve_no as reserveNo, + CONCAT("http://koreasurfing.org",file_path) as filePath, + file_origin_name as fileOriginName, + file_size as fileSize, + reg_dt as regDt, + upd_dt as updDt + + + + + INSERT INTO tb_board_file( + bd_no, + edu_no, + reserve_no, + file_path, + file_origin_name, + file_size + ) VALUES( + #{bdNo}, + #{eduNo}, + #{reserveNo}, + #{filePath}, + #{fileOriginName}, + #{fileSize} + ) + + + + + UPDATE tb_board_file + SET + WHERE bd_no = #{bdNo} + AND file_path = #{filePath} + + + + + UPDATE tb_board_file + SET + WHERE edu_no = #{eduNo} + AND file_path = #{filePath} + + + + + + + + + + + + + + + + + DELETE FROM tb_board_file + WHERE bd_no = #{bdNo} + + + + + DELETE FROM tb_board_file + WHERE edu_no = #{eduNo} + + + + + + + + + + + DELETE FROM tb_board_file + WHERE 1=1 + + AND bd_file_no IN + + #{boardFile.bdFileNo} + + + + + + + \ No newline at end of file diff --git a/src/main/java/com/loglog/api/commons/daos/mapper/BoardImgMapper.xml b/src/main/java/com/loglog/api/commons/daos/mapper/BoardImgMapper.xml new file mode 100644 index 0000000..e2cc81c --- /dev/null +++ b/src/main/java/com/loglog/api/commons/daos/mapper/BoardImgMapper.xml @@ -0,0 +1,162 @@ + + + + + + + bd_img_no as bdImgNo, + bd_no as bdNo, + edu_no as eduNo, + reserve_no as reserveNo, + CONCAT("http://koreasurfing.org", img_path) as imgPath, + img_origin_name as imgOriginName, + img_size as imgSize, + reg_dt as regDt, + upd_dt as updDt + + + + + + INSERT INTO + tb_board_img( + bd_no, + edu_no, + reserve_no, + img_path, + img_origin_name, + img_size + ) VALUES ( + #{bdNo}, + #{eduNo}, + #{reserveNo}, + #{imgPath}, + #{imgOriginName}, + #{imgSize} + ) + + + + + + UPDATE tb_board_img + SET + WHERE bd_no = #{bdNo} + AND img_path = #{imgPath} + + + + + UPDATE tb_board_img + SET + WHERE edu_no = #{eduNo} + AND img_path = #{imgPath} + + + + + + + + + + + + + + + + + DELETE FROM tb_board_img + WHERE bd_no = #{bdNo} + + + + + DELETE FROM tb_board_img + WHERE edu_no = #{eduNo} + + + + + + + + + + + DELETE FROM tb_board_img + WHERE 1=1 + + AND bd_img_no IN + + #{boardImg.bdImgNo} + + + + + + + \ No newline at end of file diff --git a/src/main/java/com/loglog/api/commons/daos/mapper/BoardMapper.xml b/src/main/java/com/loglog/api/commons/daos/mapper/BoardMapper.xml new file mode 100644 index 0000000..599163f --- /dev/null +++ b/src/main/java/com/loglog/api/commons/daos/mapper/BoardMapper.xml @@ -0,0 +1,315 @@ + + + + + + 'Y' + + + + 'N' + + + + 'N' + + + + '1' + + + + bd_no as bdNo, + bd_type_cd as bdTypeCd, + bd_notice_yn as bdNoticeYn, + bd_secret_yn as bdSecretYn, + bd_pass as bdPass, + bd_category_cd as bdCategoryCd, + bd_title as bdTitle, + bd_cont as bdCont, + bd_img_cont as bdImgCont, + bd_thumb_img1 as bdThumbImg1, + bd_thumb_img2 as bdThumbImg2, + bd_writer_id as bdWriterId, + bd_writer_name as bdWriterName, + bd_hit as bdHit, + bd_reply_yn as bdReplyYn, + bd_apply_yn as bdApplyYn, + bd_admin_yn as bdAdminYn, + DATE_FORMAT(REG_DT,'%Y-%m-%d') as regDt, + DATE_FORMAT(UPD_DT,'$Y-%m-%d') as updDt + + + + + INSERT INTO tb_board( + bd_type_cd, + bd_notice_yn, + bd_secret_yn, + bd_pass, + bd_reply_yn, + bd_apply_yn, + bd_admin_yn, + bd_category_cd, + bd_title, + bd_cont, + bd_img_cont, + bd_thumb_img1, + bd_thumb_img2, + bd_writer_id, + bd_writer_name + ) VALUES( + #{bdTypeCd}, + + + #{bdNoticeYn}, + + + , + + + + + #{bdSecretYn}, + + + , + + + #{bdPass}, + + + #{bdReplyYn}, + + + , + + + + + #{bdApplyYn}, + + + , + + + + + #{bdAdminYn}, + + + , + + + + + #{bdCategoryCd}, + + + null, + + + + + #{bdTitle}, + + + null, + + + + + #{bdCont}, + + + null, + + + + + #{bdImgCont}, + + + null, + + + #{bdThumbImg1}, + #{bdThumbImg2}, + #{bdWriterId}, + #{bdWriterName} + ) + + + SELECT LAST_INSERT_ID() + + + + + + UPDATE tb_board + SET + + + bd_category_cd = #{bdCategoryCd}, + + + bd_category_cd = null, + + + + + bd_notice_yn = #{bdNoticeYn}, + + + bd_notice_yn = + + , + + + + + bd_secret_yn = #{bdSecretYn}, + + + bd_secret_yn = + + , + + + + bd_writer_name = #{bdWriterName}, + + bd_title = #{bdTitle}, + upd_dt = CURRENT_TIMESTAMP, + bd_cont = #{bdCont}, + + bd_reply_yn = #{bdReplyYn}, + + + bd_apply_yn = #{bdApplyYn}, + + + bd_admin_yn = #{bdAdminYn}, + + + bd_thumb_img1 = #{bdThumbImg1}, + + + bd_thumb_img2 = #{bdThumbImg2}, + + + + bd_img_cont = #{bdImgCont} + + + bd_img_cont = null + + + WHERE 1=1 + AND bd_no = #{bdNo} + + + + + UPDATE tb_board + SET + bd_hit = bd_hit +1 + WHERE 1=1 + AND bd_no = #{bdNo} + + + + + + + + + + + + + + DELETE FROM tb_board + WHERE 1=1 + AND bd_no = #{bdNo} + + + + \ No newline at end of file diff --git a/src/main/java/com/loglog/api/commons/daos/mapper/BoardReplyMapper.xml b/src/main/java/com/loglog/api/commons/daos/mapper/BoardReplyMapper.xml new file mode 100644 index 0000000..9078da2 --- /dev/null +++ b/src/main/java/com/loglog/api/commons/daos/mapper/BoardReplyMapper.xml @@ -0,0 +1,166 @@ + + + + + + + reply_no as replyNo, + bd_no as bdNo, + reply_cont as replyCont, + reply_writer_id as replyWriterId, + reply_writer_name as replyWriterName, + reply_writer_level as replyWriterLevel, + secret_yn as secretYn, + reply_pass as replyPass, + reg_dt as regDt, + upd_dt as updDt + + + + + INSERT INTO tb_board_reply ( + bd_no, + reply_cont, + reply_writer_id, + reply_writer_name, + reply_writer_level, + secret_yn + )VALUES( + #{bdNo}, + #{replyCont}, + #{replyWriterId}, + #{replyWriterName}, + #{replyWriterLevel}, + + + #{secretYn} + + + 'N' + + + ) + + + + + INSERT INTO tb_board_reply ( + bd_no, + reply_cont, + reply_pass, + reply_writer_id, + reply_writer_name, + secret_yn + )VALUES( + #{bdNo}, + #{replyCont}, + #{replyPass}, + #{replyWriterId}, + #{replyWriterName}, + + + #{secretYn} + + + 'N' + + + ) + + + + + + + + + + + DELETE FROM tb_board_reply + WHERE + reply_no = #{replyNo} + + AND reply_writer_id = #{replyWriterId} + + + + + + DELETE FROM tb_board_reply + WHERE + reply_no = #{replyNo} + + AND reply_writer_id = #{replyWriterId} + + + + + + DELETE FROM tb_board_reply + WHERE + bd_no = #{bdNo} + + + + + UPDATE tb_board_reply + SET + reply_cont = #{replyCont} + WHERE + reply_no = #{replyNo} + + AND reply_writer_id = #{replyWriterId} + + + + + + UPDATE tb_board_reply + SET + reply_cont = #{replyCont} + WHERE + reply_no = #{replyNo} + + AND reply_pass = #{replyPass} + + + + + + + + + \ No newline at end of file diff --git a/src/main/java/com/loglog/api/commons/daos/mapper/CalenderMapper.xml b/src/main/java/com/loglog/api/commons/daos/mapper/CalenderMapper.xml new file mode 100644 index 0000000..1ccac5b --- /dev/null +++ b/src/main/java/com/loglog/api/commons/daos/mapper/CalenderMapper.xml @@ -0,0 +1,264 @@ + + + + + + + insuser_cd AS insuserCd, + insdatetime AS insdatetime, + upduser_cd AS upduserCd, + updatetime AS updatetime, + user_cd AS userCd, + shop_cd AS shopCd, + shop_nm AS shopNm, + nikki_title AS nikkiTitle, + nikki_text AS nikkiText, + thumbnail1 AS thumbnail1, + thumbnail2 AS thumbnail2, + thumbnail3 AS thumbnail3, + connect_kbn AS connectKbn, + url AS url, + location AS location, + end_raiten_time AS endRaitenTime, + color AS color, + allday AS allday, + raiten_time AS raitenTime + + + + + + + + INSERT INTO trn0012 ( + insuser_cd, + insdatetime, + upduser_cd, + updatetime, + user_cd, + shop_cd, + shop_nm, + raiten_time, + thumbnail1, + thumbnail2, + thumbnail3, + connect_kbn + ) VALUES( + #{insuserCd}, + now(), + #{userCd}, + now(), + #{userCd}, + #{shopCd}, + #{shopNm}, + now(), + '', + '', + '', + '1' + ) + + + + + + + + + INSERT INTO trn0012 ( + insuser_cd, + insdatetime, + upduser_cd, + updatetime, + user_cd, + nikki_title, + nikki_text, + location, + allday, + raiten_time, + end_raiten_time, + color, + url + ) VALUES( + #{userCd}, + now(), + #{userCd}, + now(), + #{userCd}, + #{nikkiTitle}, + #{nikkiText}, + #{location}, + #{allday}, + TO_TIMESTAMP(#{raitenTime},'YYYYMMDD HH24:MI'), + + + #{endRaitenTime}, + + + null, + + + #{color}, + #{url} + ) + + + + + + + + UPDATE trn0012 + SET + updatetime = now() + + ,nikki_title = #{nikkiTitle} + + + ,nikki_text = #{nikkiText} + + ,allday = #{allday} + + ,location = #{location} + + + + ,end_raiten_time = #{endRaitenTime} + ,raiten_time = TO_TIMESTAMP(#{raitenTime},'YYYY-MM-DD HH24:MI') + + + ,end_raiten_time = null + + + + ,color = #{color} + + + ,url = #{url} + + where 1 = 1 + and user_cd = #{userCd} + and to_char(insdatetime ,'YYYYMMDD HH24:MI') = #{insdatetime} + + + + + + + + UPDATE trn0012 + SET + updatetime = now() + + ,nikki_title = #{nikkiTitle} + + + ,nikki_text = #{nikkiText} + + ,thumbnail1 = #{thumbnail1} + ,thumbnail2 = #{thumbnail2} + ,thumbnail3 = #{thumbnail3} + where 1 = 1 + and user_cd = #{userCd} + and insuser_cd = #{insuserCd} + + + + + UPDATE trn0012 + SET + thumbnail1 = null + ,thumbnail2 = null + ,thumbnail3 = null + where 1 = 1 + and user_cd = #{userCd} + and insuser_cd = #{insuserCd} + + + + + + + + delete + from trn0012 + where user_cd = #{userCd} + and insuser_cd = #{insuserCd} + + + + + \ No newline at end of file diff --git a/src/main/java/com/loglog/api/commons/daos/mapper/CardMasterMapper.xml b/src/main/java/com/loglog/api/commons/daos/mapper/CardMasterMapper.xml new file mode 100644 index 0000000..28d45c5 --- /dev/null +++ b/src/main/java/com/loglog/api/commons/daos/mapper/CardMasterMapper.xml @@ -0,0 +1,283 @@ + + + + + + + A.updatetime as updatetime, + A.user_cd as userCd, + A.jan_no as janNo, + A.card_nm as cardNm, + A.shop_group_cd as shopGroupCd, + CONCAT(#{baseImgUrl}, A.card_image) as cardImage, + B.shop_cd as shopCd, + A.e_date as eDate, + A.up_date as upDate, + A.now_point as nowPoint, + B.barcode_kbn as barcodeKbn, + A.cust_cd as custCd + + + + + + + + INSERT INTO mst0017 ( + insuser_cd, + insdatetime, + upduser_cd, + updatetime, + user_cd, + jan_no, + card_nm, + card_image, + shop_cd + ) VALUES( + #{userCd}, + now(), + #{userCd}, + now(), + #{userCd}, + #{janNo}, + #{cardNm}, + #{cardImage}, + #{shopCd} + ) + + + + + INSERT INTO mst0017 ( + insuser_cd, + insdatetime, + upduser_cd, + updatetime, + user_cd, + jan_no, + card_nm + + ) VALUES( + #{userCd}, + now(), + #{userCd}, + now(), + #{userCd}, + #{janNo}, + #{cardNm} + + ) + + + + + + + + + + + + UPDATE mst0017 + SET + card_nm = #{chanCardNm} + ,jan_no = #{chanJanNo} + ,updatetime = now() + + + ,card_image =#{cardImage} + + + ,card_image = null + + + WHERE 1=1 + AND user_cd = #{userCd} + and card_nm = #{cardNm} + and jan_no = #{janNo} + + + + + UPDATE mst0017 + SET + card_nm = #{chanCardNm} + ,jan_no = #{chanJanNo} + ,updatetime = now() + WHERE 1=1 + AND user_cd = #{userCd} + and card_nm = #{cardNm} + and jan_no = #{janNo} + + + + + + delete + from mst0017 + where user_cd = #{userCd} + and jan_no = #{janNo} + and card_nm = #{cardNm} + + + + + + + + UPDATE mst0017 SET + now_point = now_point + #{point} , + updatetime = now() + where user_cd = #{userCd} + and card_nm = #{cardNm} + and jan_no = #{janNo} + + + + + UPDATE mst0017 SET + now_point = now_point - #{point} , + updatetime = now() + where user_cd = #{userCd} + and card_nm = #{cardNm} + and jan_no = #{janNo} + + + + + UPDATE mst0017 SET + now_point = 0 + where user_cd = #{userCd} + and card_nm = #{cardNm} + and jan_no = #{janNo} + + + + + + + + + + + UPDATE mst0017 SET + cust_cd = 1 + where user_cd = #{userCd} + and card_nm = #{cardNm} + and jan_no = #{janNo} + + + + + UPDATE mst0017 SET + cust_cd = 0 + where user_cd = #{userCd} + and card_nm = #{cardNm} + and jan_no = #{janNo} + + + + + \ No newline at end of file diff --git a/src/main/java/com/loglog/api/commons/daos/mapper/CouponMasterMapper.xml b/src/main/java/com/loglog/api/commons/daos/mapper/CouponMasterMapper.xml new file mode 100644 index 0000000..e0b3a1a --- /dev/null +++ b/src/main/java/com/loglog/api/commons/daos/mapper/CouponMasterMapper.xml @@ -0,0 +1,69 @@ + + + + + + + insuser_cd AS insuserCd, + insdatetime AS insdatetime, + upduser_cd AS upduserCd, + updatetime AS updatetime, + shop_cd AS shopCd, + unique_coupon_cd AS couponCd, + coupon_goods AS couponGoods, + effect_srt AS effectSrt, + effect_end AS effectEnd, + coupon_discount AS couponDiscount, + CONCAT(#{baseImgUrl}, '/', shop_cd , '/', thumbnail1) as thumbnail1, + thumbnail2 AS thumbnail2, + thumbnail3 AS thumbnail3, + user_cd AS userCd, + connect_kbn AS connectKbn, + used AS used, + background AS background, + color AS color, + prefecture AS prefecture, + age AS age, + gender AS gender, + birthday AS birthday, + rank AS rank, + visit_condition AS visit_condition + + + + + + + + \ No newline at end of file diff --git a/src/main/java/com/loglog/api/commons/daos/mapper/CouponPublicMapper.xml b/src/main/java/com/loglog/api/commons/daos/mapper/CouponPublicMapper.xml new file mode 100644 index 0000000..18e0467 --- /dev/null +++ b/src/main/java/com/loglog/api/commons/daos/mapper/CouponPublicMapper.xml @@ -0,0 +1,435 @@ + + + + + + + COALESCE(cpnTrn.used, 0) as used, + CASE + WHEN CL.unique_coupon_cd IS NOT NULL THEN 1 + ELSE 0 + END AS liked, + coupons.unique_coupon_cd as couponCd, + coupons.shop_cd as shopCd , + mst0010.shop_add1 as shopAdd1, + mst0010.shop_add2 as shopAdd2, + mst0010.shop_nm as shopNm, + mst0010.category_cd as categoryCd, + coupons.coupon_goods as couponGoods, + coupons.effect_srt as effectSrt, + coupons.effect_end as effectEnd, + coupons.coupon_discount as couponDiscount, + CONCAT(#{baseImgUrl2}, '/', coupons.shop_cd, '/',mst0010.thumbnail1) as shopimage, + CONCAT(#{baseImgUrl}, '/', coupons.shop_cd , '/', coupons.thumbnail1) as thumbnail1, + coupons.thumbnail2 as thumbnail2, + coupons.thumbnail3 as thumbnail3, + mst0010.thumbnail1 as shopThumbNail1, + coupons.thumbnail1 as couponThumbnail1, + coupons.connect_kbn as connectKbn, + coupons.color as color, + coupons.visit_condition as visitCondition, + '0' as proximity + + + + + + + + + + + + + + INSERT INTO coupons ( + unique_coupon_cd, + updatetime, + shop_cd, + coupon_goods, + effect_srt, + effect_end, + coupon_discount, + thumbnail1, + thumbnail2, + thumbnail3, + connect_kbn, + visit_condition + ) VALUES( + nextval('unique_coupon_cd_seq'), + now(), + #{shopCd}, + #{couponGoods}, + #{effectSrt}, + #{effectEnd}, + #{couponDiscount}, + #{thumbnail1}, + #{thumbnail2}, + #{thumbnail3}, + #{connectKbn}, + #{visitCondition} + ) + + + + + INSERT INTO coupons ( + unique_coupon_cd, + updatetime, + shop_cd, + coupon_goods, + effect_srt, + effect_end, + coupon_discount, + thumbnail1, + thumbnail2, + thumbnail3, + connect_kbn, + background, + color, + prefecture, + age, + gender, + birthday, + rank, + visit_condition + ) VALUES( + nextval('unique_coupon_cd_seq'), + now(), + #{shopCd}, + #{couponGoods}, + #{effectSrt}, + #{effectEnd}, + #{couponDiscount}, + #{thumbnail1}, + #{thumbnail2}, + #{thumbnail3}, + #{connectKbn}, + #{background}, + #{color}, + #{prefecture}, + #{age}, + #{gender}, + #{birthday}, + #{rank}, + #{visitCondition} + ) + + + + + + + + + + + INSERT INTO coupons_liked ( + unique_coupon_cd + ,user_cd + ) VALUES( + #{uniqueCouponCd} + ,#{userCd} + ) + + + + + delete + from coupons_liked + where user_cd = #{userCd} + and unique_coupon_cd = #{uniqueCouponCd} + + + + + INSERT INTO coupons_used ( + unique_coupon_cd + ,user_cd + ,used + ) VALUES( + #{uniqueCouponCd} + ,#{userCd} + ,'1' + ); + + + + + + + + + + + INSERT INTO coupons_seen ( + unique_coupon_cd + ,updatetime + ,user_cd + ,seen + ) VALUES( + #{uniqueCouponCd} + ,now() + ,#{userCd} + ,'1' + ); + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/java/com/loglog/api/commons/daos/mapper/MsgMasterMapper.xml b/src/main/java/com/loglog/api/commons/daos/mapper/MsgMasterMapper.xml new file mode 100644 index 0000000..417b9e9 --- /dev/null +++ b/src/main/java/com/loglog/api/commons/daos/mapper/MsgMasterMapper.xml @@ -0,0 +1,192 @@ + + + + + + + + insuser_cd AS insuserCd , + insdatetime AS insdatetime , + upduser_cd AS upduserCd , + updatetime AS updatetime , + shop_cd AS shopCd , + msg_cd AS msgCd , + msg_text AS msgText , + thumbnail1 AS thumbnail1 , + thumbnail2 AS thumbnail1 , + thumbnail3 AS thumbnail1 , + user_cd AS userCd , + connect_kbn AS connectKbn , + background AS background , + color AS color , + prefecture AS prefecture , + age AS age , + gender AS gender , + birthday AS birthday , + rank AS rank + + + + + + + + + + + + + + + + + + + + + UPDATE messages + SET + seen = '1' + where user_cd = #{userCd} + and shop_cd = #{shopCd} + + + + + + + + + + + + + + UPDATE messages + SET + seen = '1' + where user_cd = #{userCd} + and shop_cd = '0001' + and msg_cd = #{msgCd} + + \ No newline at end of file diff --git a/src/main/java/com/loglog/api/commons/daos/mapper/NotiAttachMapper.xml b/src/main/java/com/loglog/api/commons/daos/mapper/NotiAttachMapper.xml new file mode 100644 index 0000000..676903e --- /dev/null +++ b/src/main/java/com/loglog/api/commons/daos/mapper/NotiAttachMapper.xml @@ -0,0 +1,70 @@ + + + + + + + noti_attach_id as notiAttachId, + noti_id as notiId, + ord as ord, + file_type as fileType, + file_name as fileName, + file_path as filePath, + file_size as fileSize, + CASE file_type + WHEN 'I' THEN concat( #{serverUrlAdmin} , file_path ) + ELSE '' + END as imageUrl + + + + + INSERT INTO tb_noti_attach( + noti_id, + ord, + file_type, + file_name, + file_path, + file_size + ) VALUES ( + #{notiId}, + #{ord}, + #{fileType}, + #{fileName}, + #{filePath}, + #{fileSize} + ) + + + SELECT LAST_INSERT_ID() + + + + + + + + + + + DELETE + FROM tb_noti_attach + WHERE 1=1 + AND noti_attach_id = #{notiAttachId} + + + + \ No newline at end of file diff --git a/src/main/java/com/loglog/api/commons/daos/mapper/NotiMapper.xml b/src/main/java/com/loglog/api/commons/daos/mapper/NotiMapper.xml new file mode 100644 index 0000000..767383b --- /dev/null +++ b/src/main/java/com/loglog/api/commons/daos/mapper/NotiMapper.xml @@ -0,0 +1,155 @@ + + + + + + + noti_id as notiId, + ( SELECT code_name FROM tb_code WHERE code_grp_id = '40' AND code = noti_type_cd ) as notiType, + noti_type_cd as typeCd, + ( SELECT code_name FROM tb_code WHERE code_grp_id = '41' AND code = noti_cont_type_cd ) as notiContType, + noti_cont_type_cd as notiContTypeCd, + noti_title as notiTitle, + noti_cont as notiCont, + hit as hit, + reg_dt as regDt, + DATE_FORMAT(reg_dt, '%Y-%m-%d') AS regDtYmd, + upd_dt as updDt + + + + + + + + + + + INSERT INTO tb_noti ( + noti_type_cd, + noti_cont_type_cd, + noti_title, + noti_cont + ) values( + #{typeCd}, + #{notiContTypeCd}, + #{notiTitle}, + #{notiCont} + ) + + + + SELECT LAST_INSERT_ID() + + + + + + UPDATE tb_noti + SET + hit = hit + 1 + WHERE noti_id = #{notiId} + + + + + + + + UPDATE tb_noti + SET + noti_type_cd = #{typeCd}, + noti_cont_type_cd = #{notiContTypeCd}, + noti_title = #{notiTitle}, + noti_cont = #{notiCont} + WHERE noti_id = #{notiId} + + + + + DELETE + FROM tb_noti + WHERE noti_id = #{notiId} + + + + + + \ No newline at end of file diff --git a/src/main/java/com/loglog/api/commons/daos/mapper/ShopMasterMapper.xml b/src/main/java/com/loglog/api/commons/daos/mapper/ShopMasterMapper.xml new file mode 100644 index 0000000..f0ee624 --- /dev/null +++ b/src/main/java/com/loglog/api/commons/daos/mapper/ShopMasterMapper.xml @@ -0,0 +1,236 @@ + + + + + + + shop_cd as shopCd , + shop_phone as shopPhone , + shop_nm as shopNm , + url_sns1 as urlSns1 , + url_sns2 as urlSns2 , + url_sns3 as urlSns3 , + url_sns4 as urlSns4 , + url_hp as urlHp , + CONCAT(#{baseImgUrl}, '/', shop_cd , '/', thumbnail1) as thumbnail1, + thumbnail2 as thumbnail2, + thumbnail3 as thumbnail3, + holiday1 as holiDay1 , + holiday2 as holiDay2 , + holiday3 as holiDay3 , + free_text as freeText , + logo as logo , + opentime1 as openTime1 , + closetime1 as closeTime1, + opentime2 as openTime2 , + closetime2 as closeTime2, + shop_add3 as shopAdd3 , + shop_add2 as shopAdd2 , + shop_add1 as shopAdd1 , + shop_postcd as shopPostcd + + + + + + + + + + + + + + INSERT INTO rooms ( + shop_cd + ,user_cd + ,liked + ) VALUES( + #{shopCd} + ,#{userCd} + ,'0' + ) + + + + + INSERT INTO tempo_liked ( + id + ,shop_cd + ,user_cd + ,liked + ) VALUES( + #{id} + ,#{shopCd} + ,#{userCd} + ,'0' + ) + + + + + delete + from rooms + where user_cd = #{userCd} + and shop_cd = #{shopCd} + and room_id = #{roomId}::INTEGER + + + + + delete + from tempo_liked + where shop_cd = #{shopCd} + and user_cd = #{userCd} + + + + + + + + \ No newline at end of file diff --git a/src/main/java/com/loglog/api/commons/daos/mapper/UserMapper.xml b/src/main/java/com/loglog/api/commons/daos/mapper/UserMapper.xml new file mode 100644 index 0000000..375aacc --- /dev/null +++ b/src/main/java/com/loglog/api/commons/daos/mapper/UserMapper.xml @@ -0,0 +1,450 @@ + + + + + + + insuser_cd as insuserCd, + insdatetime as insdatetime, + upduser_cd as upduserCd, + updatetime as updatetime, + user_cd as userCd , + user_nm as userNm, + user_kn as userKn, + birthday as birthday, + gender as gender, + user_mail as userMail, + user_pw as userPw, + user_phone as userPhone, + connect_kbn as connectKbn, + add1 as add1, + add2 as add2, + rank as rank, + jan_no as janNo, + cust_cd as custCd + + + + + INSERT INTO mst0011 ( + insdatetime, + updatetime, + user_nm, + user_pw, + user_mail, + user_phone, + connect_kbn + ) VALUES( + now(), + now(), + #{userNm}, + #{userPw}, + #{userMail}, + #{userPhone}, + 0 + ) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + UPDATE tb_user + SET + password = #{password}, + upd_dt = now() + WHERE user_id = #{userId} + AND user_Name = #{userName} + + + + + UPDATE tb_user + SET + last_login_dt = now() + WHERE 1=1 + AND user_id = #{userId} + + + + + UPDATE mst0011 + SET + + + birthday = #{birthday} + + + birthday = null + + + + ,user_nm = #{userNm} + + + ,user_kn=#{userKn} + + + ,user_pw=#{userPw} + + + ,user_mail=#{userMail} + + + ,gender=#{gender} + + + ,add1 = #{add1} + + + ,add2 = #{add2} + + ,updatetime = now() + WHERE 1=1 + AND user_mail=#{userMail} + + + + + UPDATE tb_user + SET + account_bank_cd = #{accountBankCd}, + account_name = #{accountName}, + account = #{account}, + upd_dt = now() + WHERE 1=1 + AND user_id = #{userId} + + + + + UPDATE tb_user + SET + account_pw = #{accountPw}, + upd_dt = now() + WHERE user_id = #{userId} + AND user_Name = #{userName} + + + + + + + + + + + + + + + + + + + UPDATE tb_user + SET + status_cd = #{statusCd} + WHERE user_id = #{userId} + + + + + + UPDATE tb_user + + + push_recv_yn = #{pushRecvYn}, + + + auto_login_yn = #{autoLoginYn}, + + + push_key_and = #{pushKeyAnd}, + + + push_key_ios = #{pushKeyIos}, + + + user_hp = #{userHp}, + + + WHERE + user_id = #{userId} + + + + + + + + DELETE + FROM tb_user + WHERE + user_id = #{userId} + + + + + + + + UPDATE tb_user + SET + password = #{password}, + upd_dt = now() + WHERE user_id = #{userId} + AND user_email = #{userEmail} + + + + + + + UPDATE tb_user + SET + + user_level = #{userLevel}, + + + admin_yn = #{adminYn} + + WHERE + user_id = #{userId} + + + + + + + + UPDATE mst0011 + SET + user_pw = #{userPw} + WHERE user_cd = #{userCd} + + + + + + + UPDATE mst0011 SET + user_pw = #{userPw} + WHERE + user_mail = #{userMail} + + \ No newline at end of file diff --git a/src/main/java/com/loglog/api/commons/filter/CORSFilter.java b/src/main/java/com/loglog/api/commons/filter/CORSFilter.java new file mode 100644 index 0000000..dbbe27a --- /dev/null +++ b/src/main/java/com/loglog/api/commons/filter/CORSFilter.java @@ -0,0 +1,44 @@ +package com.loglog.api.commons.filter; + +import java.io.IOException; + +import javax.servlet.Filter; +import javax.servlet.FilterChain; +import javax.servlet.FilterConfig; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.springframework.stereotype.Component; + +@Component +public class CORSFilter implements Filter { + + private FilterConfig filterConfig; + + public void init(FilterConfig config) throws ServletException { + filterConfig = config; + } + + public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException { + + //CORS 처리 시작 + HttpServletRequest request = (HttpServletRequest) req; + HttpServletResponse response = (HttpServletResponse) res; + + response.setHeader("Access-Control-Allow-Origin", "*"); + response.setHeader("Access-Control-Allow-Methods", "POST, GET, DELETE, PUT"); + response.setHeader("Access-Control-Max-Age", "3600"); + response.setHeader("Access-Control-Allow-Credentials", "true"); + response.setHeader("Access-Control-Allow-Headers", "Origin, Accept, X-Requested-With, Content-Type, Access-Control-Request-Method, Access-Control-Request-Headers, Authorization"); + response.setHeader("Access-Control-Allow-Headers", "*"); + + chain.doFilter(request, response); + + } + + public void destroy() {} + +} \ No newline at end of file diff --git a/src/main/java/com/loglog/api/commons/interceptor/MybatisLogInterceptor.java b/src/main/java/com/loglog/api/commons/interceptor/MybatisLogInterceptor.java new file mode 100644 index 0000000..d6c497e --- /dev/null +++ b/src/main/java/com/loglog/api/commons/interceptor/MybatisLogInterceptor.java @@ -0,0 +1,118 @@ +package com.loglog.api.commons.interceptor; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Properties; + +import org.apache.commons.beanutils.PropertyUtils; +import org.apache.ibatis.cache.CacheKey; +import org.apache.ibatis.executor.Executor; +import org.apache.ibatis.executor.statement.StatementHandler; +import org.apache.ibatis.mapping.BoundSql; +import org.apache.ibatis.mapping.MappedStatement; +import org.apache.ibatis.mapping.ParameterMapping; +import org.apache.ibatis.plugin.Interceptor; +import org.apache.ibatis.plugin.Intercepts; +import org.apache.ibatis.plugin.Invocation; +import org.apache.ibatis.plugin.Plugin; +import org.apache.ibatis.plugin.Signature; +import org.apache.ibatis.session.ResultHandler; +import org.apache.ibatis.session.RowBounds; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + + +@Intercepts({ + @Signature(type = Executor.class, method = "update", args ={MappedStatement.class, Object.class}), + @Signature(type = Executor.class, method = "query", args ={MappedStatement.class, Object.class, RowBounds.class, ResultHandler.class, CacheKey.class, BoundSql.class}), + @Signature(type = Executor.class, method = "query", args ={MappedStatement.class, Object.class, RowBounds.class, ResultHandler.class}) +}) +public class MybatisLogInterceptor implements Interceptor { + + private static final Logger logger = LoggerFactory.getLogger("mybatis.log"); + + @Override + public Object intercept(Invocation invocation) throws Throwable { + + Object[] args = invocation.getArgs(); + MappedStatement ms = (MappedStatement)args[0]; + + logger.info("====================================================================="); + logger.info(ms.getId()); + logger.info("====================================================================="); + + return invocation.proceed(); // 쿼리 실행 + } + + @Override + public Object plugin(Object target) { + return Plugin.wrap(target, this); + } + + @Override + public void setProperties(Properties properties) { + } + + private List getColumnValues(StatementHandler handler, BoundSql boundSql) { + List columnValues = new ArrayList(); + Object parameter = handler.getParameterHandler().getParameterObject(); + List parameterMappingList = boundSql.getParameterMappings(); + + for(int i = 0;i) parameter).get(parameterMappingList.get(i).getProperty()) ); + } else { + columnValues.add(parameter); + } + } + } catch (Exception e) { + e.printStackTrace(); + } + } + return columnValues; + } + + private Object[] getTypes(List columnValues) { + Object[] object = new Object[columnValues.size()]; + for(int i = 0; i < columnValues.size(); i++) { + object[i] = columnValues.get(i); + } + return object; + } + + private String getSql(String sqlStr, Object[] items) { + int seq = 0; + StringBuffer buf = new StringBuffer(); + int i; + + while ((i = sqlStr.indexOf("?")) >= 0) { + if(seq == items.length) break; + + buf.append(sqlStr.substring(0, i)); + + if (items[seq] instanceof String) { + buf.append("'" + items[seq] + "'"); + } else if (items[seq] instanceof Integer) { + buf.append(items[seq]); + } else if (items[seq] instanceof Long) { + buf.append(items[seq]); + } else if (items[seq] == null) { + buf.append("null"); + } else { + buf.append(items[seq]); + } + + sqlStr = sqlStr.substring(i + "?".length()); + + seq++; + } + buf.append(sqlStr); + return buf.toString(); + } +} \ No newline at end of file diff --git a/src/main/java/com/loglog/api/commons/interceptor/UrlTranferInterceptor.java b/src/main/java/com/loglog/api/commons/interceptor/UrlTranferInterceptor.java new file mode 100644 index 0000000..5bbff92 --- /dev/null +++ b/src/main/java/com/loglog/api/commons/interceptor/UrlTranferInterceptor.java @@ -0,0 +1,92 @@ +package com.loglog.api.commons.interceptor; + +import java.util.HashMap; +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; + +import com.loglog.api.commons.utils.UAgentInfo; + +/** + * PC 나 Mobile 로 들어오는 Request를 보고 해당 OS의 URL로 맵핑하여 이동시킨다. + * @author SJW + * + */ +public class UrlTranferInterceptor extends HandlerInterceptorAdapter { + + public static final Map URI_MOBILE_2_PC = new HashMap(); + public static final Map URI_PC_2_MOBILE = new HashMap(); + private static UAgentInfo mUAgentInfo = new UAgentInfo(); + + @Value("#{server['server.url.user']}") + public String SHOWPUN_PC_URL; + @Value("#{server['server.url.mobile']}") + public String SHOWPUN_MOBILE_URL; + + + static { + //PC 에서 들어온 URL을 Mobile로 매핑해서 이동시킬때 사용한다. + URI_PC_2_MOBILE.put("/myPage/orderHistList.ans", "/myPage/myPageMain.ans"); //마이페이지 + URI_PC_2_MOBILE.put("/cs/selectNotiList.ans", "/mainMenu/noticeList.ans"); //고객센터 - 공지 리스트 + URI_PC_2_MOBILE.put("/cs/selectFaqList.ans", "/mainMenu/faqList.ans"); //고객센터 - 자주하는 질문 + + //Mobile 에서 들어온 URL을 PC로 매핑해서 이동시킬때 사용한다. + URI_MOBILE_2_PC.put("/myPage/myPageMain.ans", "/myPage/orderHistList.ans"); //마이페이지 + URI_MOBILE_2_PC.put("/mainMenu/noticeList.ans", "/cs/selectNotiList.ans"); //고객센터 - 공지 리스트 + } + + + @Override + public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { + + mUAgentInfo.setUAgentInfo(request.getHeader("user-agent"), request.getHeader("accept")); + + String reqUri = request.getRequestURI(); + String queryStr = request.getQueryString() == null ? "" : request.getQueryString(); + + if( StringUtils.indexOf(reqUri, "Ajax") >= 0 ) return true; + + System.out.println("isMobilePhone: " + mUAgentInfo.isMobilePhone); + System.out.println("reqUri : " + reqUri); + System.out.println("queryStr : " + queryStr); + + String moveUri = reqUri; + + //PC --> Mobile 로 이동 + if( mUAgentInfo.isMobilePhone ) { + //맵핑 URI 처리 + if( StringUtils.isNotEmpty(URI_PC_2_MOBILE.get(reqUri)) ) { + moveUri = URI_PC_2_MOBILE.get(reqUri); + //Query처리 + if ( StringUtils.isNotEmpty(queryStr ) ) { + moveUri += "?" + queryStr; + } + //이동 + response.sendRedirect(SHOWPUN_MOBILE_URL + moveUri); + return false; + } + } + //Mobile --> PC 로 이동 + else { + //맵핑 URI 처리 + if( StringUtils.isNotEmpty(URI_MOBILE_2_PC.get(reqUri)) ) { + moveUri = URI_MOBILE_2_PC.get(reqUri); + //Query처리 + if ( StringUtils.isNotEmpty(queryStr ) ) { + moveUri += "?" + queryStr; + } + //이동 + response.sendRedirect(SHOWPUN_PC_URL + moveUri); + return false; + } + } + + return true; + } + +} diff --git a/src/main/java/com/loglog/api/commons/interfaces/CommonInterface.java b/src/main/java/com/loglog/api/commons/interfaces/CommonInterface.java new file mode 100644 index 0000000..6597771 --- /dev/null +++ b/src/main/java/com/loglog/api/commons/interfaces/CommonInterface.java @@ -0,0 +1,13 @@ +package com.loglog.api.commons.interfaces; + +/** + * Service 공통 인터페이스 + * + * @author itbong + * @since 2019.07.01 + */ +public interface CommonInterface { + + public void setServerUrlImg(String serverUrlImg); + +} diff --git a/src/main/java/com/loglog/api/commons/modules/service/board/BoardFileService.java b/src/main/java/com/loglog/api/commons/modules/service/board/BoardFileService.java new file mode 100644 index 0000000..f531bb4 --- /dev/null +++ b/src/main/java/com/loglog/api/commons/modules/service/board/BoardFileService.java @@ -0,0 +1,18 @@ +package com.loglog.api.commons.modules.service.board; + +import java.util.List; + +import com.loglog.api.commons.beans.BoardBean; +import com.loglog.api.commons.beans.BoardFileBean; + +public interface BoardFileService { + /** 질문 이미지 등록 */ + public int insertBoardFile(BoardBean boardBean, List boardFileList) throws Exception; + + /** 게시글 이미지 수정 */ + public int updateBoardFile(BoardBean boardBean,List boardFileList) throws Exception; + + /** 게시글 파일 삭제 */ + public void deleteFile(int bdNo) throws Exception; + +} diff --git a/src/main/java/com/loglog/api/commons/modules/service/board/BoardFileServiceImpl.java b/src/main/java/com/loglog/api/commons/modules/service/board/BoardFileServiceImpl.java new file mode 100644 index 0000000..bfc40ea --- /dev/null +++ b/src/main/java/com/loglog/api/commons/modules/service/board/BoardFileServiceImpl.java @@ -0,0 +1,169 @@ +package com.loglog.api.commons.modules.service.board; + +import java.io.File; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import org.apache.commons.io.FileUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; + +import com.loglog.api.commons.beans.BoardBean; +import com.loglog.api.commons.beans.BoardFileBean; +import com.loglog.api.commons.daos.BoardFileDao; + + +@Service +public class BoardFileServiceImpl implements BoardFileService { + + @Autowired + private BoardFileDao boardFileDao; + + // 레파지토리 경로 + @Value("${repository.path}") + private String RESPOSITORY_PATH; + // 보드 파일 폴더 경로 + @Value("${upload.board.file.path}") + private String UPLOAD_BOARD_FILE_PATH; + // 다음 에디터 파일 임시 폴더 경로 + @Value("${upload.daum.editor.file.temp.path}") + private String UPLOAD_DAUM_EDITOR_FILE_TEMP_PATH; + + + /** 게시글 파일 등록 */ + @Override + public int insertBoardFile(BoardBean boardBean, List boardFileList) throws Exception { + int result = 0; + + List deleteFileList = new ArrayList(); + + /* 게시글 이미지 등록 */ + for(int i=0; i boardFileList) throws Exception { + + int result =0; + + List deleteFileList = new ArrayList(); + + //기존이미지 데이터 삭제 + //UI에서 삭제된 이미지일 경우 이미지 경로가 안들어오므로 체크하여 삭제한다. + List boardFileArray = new ArrayList(); + if(boardFileList != null && boardFileList.size() != 0){ + for(int i=0; i deleteBoardFileList = boardFileDao.deleteFileList(boardBean.getBdNo(),boardFileArray); + if(deleteBoardFileList != null && deleteBoardFileList.size() != 0){ + boardFileDao.deleteFileForUpdate(deleteBoardFileList); + + //서버에서 이미지 삭제 처리 + for(BoardFileBean boardFileBean : deleteBoardFileList){ + + File deleteFileFile = new File(RESPOSITORY_PATH + boardFileBean.getFilePath()); + + try { + deleteFileFile.delete(); + } catch (Exception e) { + e.getMessage(); + } + }//end for(); + } + + if(boardFileList != null && boardFileList.size() != 0){ + + //게시글 이미지 수정 + for(int i = 0; i boardImgList) throws Exception; + + /** 게시글 이미지 수정 */ + public int updateBoardImg(BoardBean boardBean, List boardImgList) throws Exception; + + /** 게시글 이미지 삭제*/ + public void deleteImg(int bdNo) throws Exception; + + /** 게시글 이미지 리스트*/ + public List boardImgList(List list) throws Exception; + +} diff --git a/src/main/java/com/loglog/api/commons/modules/service/board/BoardImgServiceImpl.java b/src/main/java/com/loglog/api/commons/modules/service/board/BoardImgServiceImpl.java new file mode 100644 index 0000000..af9e130 --- /dev/null +++ b/src/main/java/com/loglog/api/commons/modules/service/board/BoardImgServiceImpl.java @@ -0,0 +1,204 @@ +package com.loglog.api.commons.modules.service.board; + +import java.io.File; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import org.apache.commons.io.FileUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; + +import com.loglog.api.commons.beans.BoardBean; +import com.loglog.api.commons.beans.BoardImgBean; +import com.loglog.api.commons.daos.BoardDao; +import com.loglog.api.commons.daos.BoardImgDao; + +@Service +public class BoardImgServiceImpl implements BoardImgService { + @Autowired + private BoardImgDao boardImgDao; + @Autowired + private BoardDao boardDao; + + // 레파지토리 경로 + @Value("${repository.path}") + private String RESPOSITORY_PATH; + // 보드 이미지 폴더 경로 + @Value("${upload.board.path}") + private String UPLOAD_BOARD_PATH; + // 다음 에디터 이미지 임시 폴더 경로 + @Value("${upload.daum.editor.image.temp.path}") + private String UPLOAD_DAUM_EDITOR_IMAGE_TEMP_PATH; + // 다음 에디터 파일 임시 폴더 경로 + @Value("${upload.daum.editor.file.temp.path}") + private String UPLOAD_DAUM_EDITOR_FILE_TEMP_PATH; + + /** + * 게시글 이미지 등록 + */ + @Override + public int insertBoardImg(BoardBean boardBean,List boardImgList) throws Exception { + + int result =0; + + List deleteFileList = new ArrayList(); + + /* 게시글 이미지 등록 */ + for(int i=0; i boardImgList) throws Exception { + + int result = 0; + + List deleteFileList = new ArrayList(); + + // 기존 이미지 데이터 삭제 + // UI에서 삭제된 이미지일 경우 이미지 경로가 안들어오므로, + // 체크하여 삭제한다. + List boardImgArray = new ArrayList(); + if (boardImgList != null && boardImgList.size() != 0) { + for (int i = 0; i < boardImgList.size(); i++) { + BoardImgBean boardImgBean = boardImgList.get(i); + // 게시글 key 셋팅 + boardImgBean.setBdNo(boardBean.getBdNo()); + // 이미지 변경 없음 + System.out.println("first---"+boardImgBean.getImgPath().indexOf(UPLOAD_BOARD_PATH)); + System.out.println("second---"+boardImgBean.getImgPath().indexOf(UPLOAD_DAUM_EDITOR_IMAGE_TEMP_PATH)); + + if (boardImgBean.getImgPath().indexOf(UPLOAD_DAUM_EDITOR_IMAGE_TEMP_PATH) == -1) { + boardImgArray.add(boardImgBean.getImgPath()); + } + } + } + + // 삭제될 이미지 목록 조회 + List deleteBoardImgList = boardImgDao.deleteImgList(boardBean.getBdNo(),boardImgArray); + + if (deleteBoardImgList != null && deleteBoardImgList.size() != 0) { + // 삭제된 이미지 DB 삭제 처리 + boardImgDao.deleteImgForUpdate(deleteBoardImgList); + + // 서버에서 이미지 삭제 처리 + for (BoardImgBean boardImgBean : deleteBoardImgList) { + File deleteImgFile = new File(RESPOSITORY_PATH + boardImgBean.getImgPath()); + try { + deleteImgFile.delete(); + } catch (Exception e) { + e.getMessage(); + } + } + } + + if (boardImgList != null && boardImgList.size() != 0) { + + // 게시글 이미지 수정 + for (int i = 0; i < boardImgList.size(); i++) { + BoardImgBean boardImgBean = boardImgList.get(i); + + // 게시글 key 셋팅 + boardImgBean.setBdNo(boardBean.getBdNo()); + System.out.println("last---"+boardImgBean.getImgPath().indexOf(UPLOAD_DAUM_EDITOR_IMAGE_TEMP_PATH)); + + // 이미지 변경 없음 + if (boardImgBean.getImgPath().indexOf(UPLOAD_DAUM_EDITOR_IMAGE_TEMP_PATH) == -1) { + + //boardImgDao.updateBoardImg(boardImgBean); + + // 이미지 변경 또는 신규 등록됨 + } else { + File boardImgTempFile = new File(RESPOSITORY_PATH + + boardImgBean.getImgPath()); + deleteFileList.add(boardImgTempFile); + + Date date = new Date(); + + SimpleDateFormat newDate = new SimpleDateFormat("yyyyMMdd"); + + String boardImgPath = UPLOAD_BOARD_PATH + "/" + boardBean.getBdNo() + "/" + newDate.format(date) + "/"+ boardImgTempFile.getName(); + + File boardImgFile = new File(RESPOSITORY_PATH + boardImgPath); + + // 정상적인 프로세스상 파일 이동이 이동되어야 하지만, + // 파일 복사로 변경 + FileUtils.copyFile(boardImgTempFile, boardImgFile); + + boardImgBean.setImgPath(boardImgPath); + + result += boardImgDao.insertBoardImg(boardImgBean); + + String changeImg = " boardImgList(List list) throws Exception { + return boardImgDao.boardImgList(list); + } + + +} diff --git a/src/main/java/com/loglog/api/commons/modules/service/board/BoardReplyService.java b/src/main/java/com/loglog/api/commons/modules/service/board/BoardReplyService.java new file mode 100644 index 0000000..ff2ca7e --- /dev/null +++ b/src/main/java/com/loglog/api/commons/modules/service/board/BoardReplyService.java @@ -0,0 +1,34 @@ +package com.loglog.api.commons.modules.service.board; + +import java.util.List; + +import com.loglog.api.commons.beans.BoardBean; +import com.loglog.api.commons.beans.BoardFileBean; +import com.loglog.api.commons.beans.BoardImgBean; +import com.loglog.api.commons.beans.BoardReplyBean; +import com.loglog.api.commons.beans.PagingBean; + +public interface BoardReplyService { + + /** 댓글작성 */ + public void insertReplyBoard(BoardReplyBean boardReplyBean,BoardBean boardBean) throws Exception; + + /** 댓글 수정 */ + public int updateReplyBoard(BoardReplyBean boardReplyBean) throws Exception; + + /** 페이징 갯수 */ + //public int selectReplyCount(PagingBean pagingBean) throws Exception; + + /** 댓글 리스트 가져오기 */ + public List replyList(PagingBean pagingBean) throws Exception; + + /** 글 상세보기(글 이미지 포함 및 Hit 업데이트) */ +// public BoardBean selectInBoard(BoardBean boardBean) throws Exception; +// +// /** 글 상세값만 가져오기 */ +// public BoardBean selectTheBoard(BoardBean boardBean) throws Exception; +// + /** 댓글 삭제하기 */ + public void deleteReplyBoard(BoardReplyBean boardReplyBean, BoardBean boardBean) throws Exception; + +} diff --git a/src/main/java/com/loglog/api/commons/modules/service/board/BoardReplyServiceImpl.java b/src/main/java/com/loglog/api/commons/modules/service/board/BoardReplyServiceImpl.java new file mode 100644 index 0000000..2b85348 --- /dev/null +++ b/src/main/java/com/loglog/api/commons/modules/service/board/BoardReplyServiceImpl.java @@ -0,0 +1,85 @@ +package com.loglog.api.commons.modules.service.board; + +import java.io.File; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.UUID; + +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 com.loglog.api.commons.beans.BoardBean; +import com.loglog.api.commons.beans.BoardFileBean; +import com.loglog.api.commons.beans.BoardImgBean; +import com.loglog.api.commons.beans.BoardReplyBean; +import com.loglog.api.commons.beans.PagingBean; +import com.loglog.api.commons.daos.BoardDao; +import com.loglog.api.commons.daos.BoardFileDao; +import com.loglog.api.commons.daos.BoardImgDao; +import com.loglog.api.commons.daos.BoardReplyDao; + +@Service +public class BoardReplyServiceImpl implements BoardReplyService { + + // 레파지토리 경로 + @Value("${repository.path}") + private String RESPOSITORY_PATH; + // 보드 이미지 폴더 경로 + @Value("${upload.board.path}") + private String UPLOAD_BOARD_PATH; + + + @Autowired + private BoardDao boardDao; + @Autowired + private BoardImgDao boardImgDao; + @Autowired + private BoardReplyDao boardReplyDao; + @Autowired + private BoardFileDao boardFileDao; + @Autowired + private BoardFileService boardFileService; + @Autowired + private BoardImgService boardImgService; + + // 댓글 저장 + @Override + public void insertReplyBoard(BoardReplyBean boardReplyBean,BoardBean boardBean) throws Exception { + // TODO Auto-generated method stub + + /*댓글 등록*/ + BoardReplyBean replyBean = new BoardReplyBean(); + replyBean.setBdNo(boardBean.getBdNo()); + boardReplyDao.insertReply(boardReplyBean); + + } + + // 댓글 수정 + @Override + public int updateReplyBoard(BoardReplyBean boardReplyBean) throws Exception { + + return boardReplyDao.updateReply(boardReplyBean); + } + + // 댓글 리스트 + @Override + public List replyList(PagingBean pagingBean) throws Exception { + // TODO Auto-generated method stub + return boardReplyDao.replyList(pagingBean); + } + + // 댓글 삭제 + @Override + public void deleteReplyBoard(BoardReplyBean boardReplyBean,BoardBean boardBean) throws Exception { + // TODO Auto-generated method stub +// System.out.println("파리미터 서비스" + boardReplyBean.getReplyNo() + "--" + boardBean.getBdNo()); +// BoardReplyBean replyBean = new BoardReplyBean(); +// replyBean.setBdNo(boardBean.getBdNo()); + boardReplyDao.deleteReply(boardReplyBean); + } + +} diff --git a/src/main/java/com/loglog/api/commons/modules/service/board/BoardService.java b/src/main/java/com/loglog/api/commons/modules/service/board/BoardService.java new file mode 100644 index 0000000..3c7d1c8 --- /dev/null +++ b/src/main/java/com/loglog/api/commons/modules/service/board/BoardService.java @@ -0,0 +1,33 @@ +package com.loglog.api.commons.modules.service.board; + +import java.util.List; + +import com.loglog.api.commons.beans.BoardBean; +import com.loglog.api.commons.beans.BoardFileBean; +import com.loglog.api.commons.beans.BoardImgBean; +import com.loglog.api.commons.beans.PagingBean; + +public interface BoardService { + + /** 글작성 */ + public void insertBoard(BoardBean boardBean, List boardImgList, List boardFileList) throws Exception; + + /** 게시글 수정 */ + public int updateBoard(BoardBean boardBean, List boardImgList, List boardFileList) throws Exception; + + /** 게시글 갯수 */ + public int selectBoardCount(PagingBean pagingBean) throws Exception; + + /** 글 목록 가져오기 */ + public List boardList(PagingBean pagingBean) throws Exception; + + /** 글 상세보기(글 이미지 포함 및 Hit 업데이트) */ + public BoardBean selectInBoard(BoardBean boardBean) throws Exception; +// +// /** 글 상세값만 가져오기 */ +// public BoardBean selectTheBoard(BoardBean boardBean) throws Exception; +// + /** 글 삭제하기 */ + public void deleteBoard(BoardBean boardBean) throws Exception; + +} diff --git a/src/main/java/com/loglog/api/commons/modules/service/board/BoardServiceImpl.java b/src/main/java/com/loglog/api/commons/modules/service/board/BoardServiceImpl.java new file mode 100644 index 0000000..b1b7ca7 --- /dev/null +++ b/src/main/java/com/loglog/api/commons/modules/service/board/BoardServiceImpl.java @@ -0,0 +1,303 @@ +package com.loglog.api.commons.modules.service.board; + +import java.io.File; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.UUID; + +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 com.loglog.api.commons.beans.BoardBean; +import com.loglog.api.commons.beans.BoardFileBean; +import com.loglog.api.commons.beans.BoardImgBean; +import com.loglog.api.commons.beans.BoardReplyBean; +import com.loglog.api.commons.beans.PagingBean; +import com.loglog.api.commons.daos.BoardDao; +import com.loglog.api.commons.daos.BoardFileDao; +import com.loglog.api.commons.daos.BoardImgDao; +import com.loglog.api.commons.daos.BoardReplyDao; + +@Service +public class BoardServiceImpl implements BoardService { + + // 레파지토리 경로 + @Value("${repository.path}") + private String RESPOSITORY_PATH; + // 보드 이미지 폴더 경로 + @Value("${upload.board.path}") + private String UPLOAD_BOARD_PATH; + + + @Autowired + private BoardDao boardDao; + @Autowired + private BoardImgDao boardImgDao; + @Autowired + private BoardReplyDao boardReplyDao; + @Autowired + private BoardFileDao boardFileDao; + @Autowired + private BoardFileService boardFileService; + @Autowired + private BoardImgService boardImgService; + + + /** + * 글 작성 + * Insert + */ + @Override + public void insertBoard(BoardBean boardBean, List boardImgList, List boardFileList) throws Exception { + + SimpleDateFormat newDate = new SimpleDateFormat("yyyyMMdd"); + Date date = new Date(); + + //썸네일 이미지를 등록한다. + if(boardBean.getBdThumbImgFile1() != null) { + MultipartFile thumbFile = boardBean.getBdThumbImgFile1(); + String fileName = thumbFile.getOriginalFilename(); + String fileExt = fileName.substring( fileName.lastIndexOf(".") + 1 ); + UUID uuid = UUID.randomUUID(); + + String thumbPath = System.getProperty("user.dir") + RESPOSITORY_PATH + UPLOAD_BOARD_PATH + "/thumb/" + newDate.format(date) + "/" + uuid + "." + fileExt; + String thumbFolder = System.getProperty("user.dir") + RESPOSITORY_PATH + UPLOAD_BOARD_PATH +"/thumb/" + newDate.format(date); + + File tempFolder = new File( thumbFolder ); + if ( !tempFolder.exists() ){ + tempFolder.mkdirs(); + } + + thumbFile.transferTo(new File(thumbPath)); + + boardBean.setBdThumbImg1( UPLOAD_BOARD_PATH + "/thumb/" + newDate.format(date) + "/" + uuid + "." + fileExt ); + } + + if(boardBean.getBdThumbImgFile2() != null) { + MultipartFile thumbFile = boardBean.getBdThumbImgFile2(); + String fileName = thumbFile.getOriginalFilename(); + String fileExt = fileName.substring( fileName.lastIndexOf(".") + 1 ); + UUID uuid = UUID.randomUUID(); + + String thumbPath = System.getProperty("user.dir") + RESPOSITORY_PATH + UPLOAD_BOARD_PATH + "/thumb/" + newDate.format(date) + "/" + uuid + "." + fileExt; + String thumbFolder = System.getProperty("user.dir") + RESPOSITORY_PATH + UPLOAD_BOARD_PATH +"/thumb/" + newDate.format(date); + + File tempFolder = new File( thumbFolder ); + if ( !tempFolder.exists() ){ + tempFolder.mkdirs(); + } + + thumbFile.transferTo(new File(thumbPath)); + + boardBean.setBdThumbImg2( UPLOAD_BOARD_PATH + "/thumb/" + newDate.format(date) + "/" + uuid + "." + fileExt ); + } + + /* 글등록 */ + boardDao.insertBoard(boardBean); + + /* 이미지등록 */ + if(boardImgList != null && boardImgList.size() != 0){ + boardImgService.insertBoardImg(boardBean, boardImgList); + } + /* 파일등록 */ + if(boardFileList != null && boardFileList.size() != 0){ + boardFileService.insertBoardFile(boardBean, boardFileList); + } + } + + + /** + * 게시글 수정 + * update + */ + @Override + public int updateBoard(BoardBean boardBean, List boardImgList, List boardFileList) throws Exception { + + SimpleDateFormat newDate = new SimpleDateFormat("yyyyMMdd"); + Date date = new Date(); + + String btThumbImg1Path = null; + String btThumbImg2Path = null; + + //썸네일 이미지를 수정한다. + if(boardBean.getBdThumbImgFile1() != null) { + MultipartFile thumbFile = boardBean.getBdThumbImgFile1(); + String fileName = thumbFile.getOriginalFilename(); + String fileExt = fileName.substring( fileName.lastIndexOf(".") + 1 ); + UUID uuid = UUID.randomUUID(); + + String thumbPath = System.getProperty("user.dir") + RESPOSITORY_PATH + UPLOAD_BOARD_PATH + "/thumb/" + newDate.format(date) + "/" + uuid + "." + fileExt; + String thumbFolder = System.getProperty("user.dir") + RESPOSITORY_PATH + UPLOAD_BOARD_PATH +"/thumb/" + newDate.format(date); + + File tempFolder = new File( thumbFolder ); + if ( !tempFolder.exists() ){ + tempFolder.mkdirs(); + } + + thumbFile.transferTo(new File(thumbPath)); + + //수정전 백업 + btThumbImg1Path = boardBean.getBdThumbImg1(); + + boardBean.setBdThumbImg1( UPLOAD_BOARD_PATH + "/thumb/" + newDate.format(date) + "/" + uuid + "." + fileExt ); + } + + if(boardBean.getBdThumbImgFile2() != null) { + MultipartFile thumbFile = boardBean.getBdThumbImgFile2(); + String fileName = thumbFile.getOriginalFilename(); + String fileExt = fileName.substring( fileName.lastIndexOf(".") + 1 ); + UUID uuid = UUID.randomUUID(); + + String thumbPath = System.getProperty("user.dir") + RESPOSITORY_PATH + UPLOAD_BOARD_PATH + "/thumb/" + newDate.format(date) + "/" + uuid + "." + fileExt; + String thumbFolder = System.getProperty("user.dir") + RESPOSITORY_PATH + UPLOAD_BOARD_PATH +"/thumb/" + newDate.format(date); + + File tempFolder = new File( thumbFolder ); + if ( !tempFolder.exists() ){ + tempFolder.mkdirs(); + } + + thumbFile.transferTo(new File(thumbPath)); + + //수정전 백업 + btThumbImg2Path = boardBean.getBdThumbImg2(); + + boardBean.setBdThumbImg2( UPLOAD_BOARD_PATH + "/thumb/" + newDate.format(date) + "/" + uuid + "." + fileExt ); + } + + int result = boardDao.updateBoard(boardBean); + + if(result > 0) { + //기존 썸네일 이미지 삭제 + if(btThumbImg1Path != null) { + File thumb1Img = new File(System.getProperty("user.dir") + RESPOSITORY_PATH + btThumbImg1Path); + try { + thumb1Img.delete(); + } catch (Exception e) { + e.getMessage(); + } + } + if(btThumbImg2Path != null) { + File thumb2Img = new File(System.getProperty("user.dir") + RESPOSITORY_PATH + btThumbImg2Path); + try { + thumb2Img.delete(); + } catch (Exception e) { + e.getMessage(); + } + } + } + + /* 게시글 이미지 수정 */ + if(boardImgList != null && boardImgList.size() != 0){ + boardImgService.updateBoardImg(boardBean, boardImgList); + } + if(boardFileList != null && boardFileList.size() != 0){ + boardFileService.updateBoardFile(boardBean, boardFileList); + } + + return result; + } + + + /** + * 게시글 갯수 + */ + @Override + public int selectBoardCount(PagingBean pagingBean) throws Exception { + return boardDao.selectBoardCount(pagingBean); + } + + + /** + * 글 목록 가져오기 + */ + @Override + public List boardList(PagingBean pagingBean) throws Exception { + return boardDao.boardList(pagingBean); + } + + + /** + * 글 상세보기 + */ + @Override + public BoardBean selectInBoard(BoardBean boardBean) throws Exception{ + + //한개의 글 이미지 목록 + List boardImgList = boardImgDao.selectBoardImg(boardBean.getBdNo()); + //한개의 글 파일 목록 + List boardFileList = boardFileDao.selectBoardFile(boardBean.getBdNo()); + //답변목록 + PagingBean pagingBean = new PagingBean(); + int totCount = boardReplyDao.replyListCount(pagingBean); + // 페이징 계산 , 가져올 데이터 시작위치 끝위치 계산 + pagingBean.calcPage(totCount); + pagingBean.setBdNo(boardBean.getBdNo()); + List replyList = boardReplyDao.replyList(pagingBean); + + try { + //조회수 +1 + boardDao.updateHit(boardBean); + } catch (Exception e) { + e.printStackTrace(); + } + boardBean = boardDao.selectInBoard(boardBean); + boardBean.setBoardImgList(boardImgList.size() > 0 ? boardImgList : new ArrayList<>()); + boardBean.setBoardFileList(boardFileList.size() > 0 ? boardFileList : new ArrayList<>()); + boardBean.setReplyList(replyList.size() > 0 ? replyList : new ArrayList<>()); + + return boardBean; + } +// +// +// /** 글 상세값만 가져오기 */ +// public BoardBean selectTheBoard(BoardBean boardBean) throws Exception { +// return boardDao.selectInBoard(boardBean); +// } +// +// + /** + * 게시글 삭제 + */ + @Override + public void deleteBoard(BoardBean boardBean) throws Exception{ + + boardBean = boardDao.selectInBoard(boardBean); + + //썸네일 삭제 + if(boardBean.getBdThumbImg1() != null) { + File thumb1Img = new File(System.getProperty("user.dir") + RESPOSITORY_PATH + boardBean.getBdThumbImg1()); + try { + thumb1Img.delete(); + } catch (Exception e) { + e.getMessage(); + } + } + if(boardBean.getBdThumbImg2() != null) { + File thumb2Img = new File(System.getProperty("user.dir") + RESPOSITORY_PATH + boardBean.getBdThumbImg2()); + try { + thumb2Img.delete(); + } catch (Exception e) { + e.getMessage(); + } + } + + //댓글 여러건 삭제 + BoardReplyBean replyBean = new BoardReplyBean(); + replyBean.setBdNo(boardBean.getBdNo()); + boardReplyDao.deleteReplyList(replyBean); + + //게시글 이미지 삭제 + boardImgService.deleteImg(boardBean.getBdNo()); + + //게시글 파일 삭제 + boardFileService.deleteFile(boardBean.getBdNo()); + + //게시글 삭제 + boardDao.deleteBoard(boardBean); + } + +} diff --git a/src/main/java/com/loglog/api/commons/modules/service/calender/CalenderService.java b/src/main/java/com/loglog/api/commons/modules/service/calender/CalenderService.java new file mode 100644 index 0000000..f3158a9 --- /dev/null +++ b/src/main/java/com/loglog/api/commons/modules/service/calender/CalenderService.java @@ -0,0 +1,48 @@ +package com.loglog.api.commons.modules.service.calender; + +import java.util.List; +import java.util.Map; +import org.springframework.web.multipart.MultipartFile; +import javax.servlet.http.HttpServletRequest; + +import com.loglog.api.commons.beans.CalenderBean; +import com.loglog.api.commons.beans.PagingBean; +import com.loglog.api.commons.beans.UserBean; + +public interface CalenderService { + /** 상점정보 있는지 체크 */ + public int selectShopInfo(CalenderBean calenderBean); + + /** 내점기록 저장 */ + public int insertCalender(CalenderBean calenderBean); + + /** 캘린더 조회 */ + public List selectCalenderMon(CalenderBean calenderBean); + + /** 스케줄 저장 */ + public int insertSchedule (CalenderBean calenderBean); + + /** 스케줄 디테일 조회*/ + public List selectCalenderDay(CalenderBean calenderBean); + + /** 스케줄 업데이트 */ + public int updateCalender(CalenderBean calenderBean); + + /** 저장후 고유ID를 이용해 데이터를 조회*/ + public CalenderBean selectCalenderId(CalenderBean calenderBean)throws Exception; + + /** 내점기록저장후 내용이나 사진 업데이트*/ + public int updateCalenderthum(CalenderBean calenderBean,List thumFileList)throws Exception; + + /** 내점기록저장후 내용이나 사진 업데이트한걸 다시 업데이트*/ + public int updateCalenderUrl(CalenderBean calenderBean,List thumFileList)throws Exception; + + /** 업데이트 이후 ID값을 이용해 조회후 출력*/ + public CalenderBean selectUpdateId(CalenderBean calenderBean)throws Exception; + + /** 내점이력 삭제*/ + public int deleteVisitCalender(CalenderBean calenderBean)throws Exception; + + /**내점이력 리스트 조회*/ + public List selectVisitList(CalenderBean calenderBean)throws Exception; +} diff --git a/src/main/java/com/loglog/api/commons/modules/service/calender/CalenderServiceImpl.java b/src/main/java/com/loglog/api/commons/modules/service/calender/CalenderServiceImpl.java new file mode 100644 index 0000000..b5e4fe5 --- /dev/null +++ b/src/main/java/com/loglog/api/commons/modules/service/calender/CalenderServiceImpl.java @@ -0,0 +1,253 @@ +package com.loglog.api.commons.modules.service.calender; + +import java.io.File; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.UUID; + +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 com.loglog.api.commons.beans.CalenderBean; +import com.loglog.api.commons.daos.CalenderDao; + +@Service +public class CalenderServiceImpl implements CalenderService { + + // 레파지토리 경로 + @Value("${repository.path}") + private String RESPOSITORY_PATH; + + // 내점이력 이미지 폴더 경로 + @Value("${upload.visit.path}") + private String UPLOAD_VISIT_PATH; + + // BASE URL 내점기록 경로 + @Value("${server.url.img.mycard}") + private String URL_IMG_thumFile; + + @Autowired + private CalenderDao calenderDao; + + @Override + public int selectShopInfo(CalenderBean calenderBean) { + return calenderDao.selectShopInfo(calenderBean); + } + + @Override + public int insertCalender(CalenderBean calenderBean) { + return calenderDao.insertCalender(calenderBean); + } + + /** 캘린더 조회 */ + public List selectCalenderMon(CalenderBean calenderBean){ + return calenderDao.selectCalenderMon(calenderBean); + } + + /** 스케줄 저장 */ + public int insertSchedule (CalenderBean calenderBean) { + return calenderDao.insertSchedule(calenderBean); + } + + /** 스케줄 디테일 조회*/ + public List selectCalenderDay(CalenderBean calenderBean){ + return calenderDao.selectCalenderDay(calenderBean); + } + + /** 스케줄 업데이트 */ + public int updateCalender(CalenderBean calenderBean) { + return calenderDao.updateCalender(calenderBean); + } + + /** 저장후 고유ID를 이용해 데이터를 조회*/ + public CalenderBean selectCalenderId(CalenderBean calenderBean)throws Exception{ + calenderBean.setBaseImgUrl(URL_IMG_thumFile); + return calenderDao.selectCalenderId(calenderBean); + } + + /** 내점기록저장후 내용이나 사진 업데이트*/ + public int updateCalenderthum(CalenderBean calenderBean, List thumFileList)throws Exception{ + int result = 0; + CalenderBean calBean = calenderDao.selectCalenderId(calenderBean); + + //1.유지처리 + String updatedImgUrl = calenderBean.getNoteUpdatedImgUrlList(); // 유지시킬 URL + String splitList[] = null; + int loopCnt = 0; + if(updatedImgUrl == null) { + System.out.println("111"); + } + if(updatedImgUrl != null) { + splitList = updatedImgUrl.split(","); + calenderDao.cleanCalenderThum(calenderBean); // 섬네일 초기화 + for(int i=0; i Files = new ArrayList (); + String baseFolder = UPLOAD_VISIT_PATH +"/visitRecord/"; // baseFolder = /up_imgs/visit_img/visitRecord/ + // thumbFolder = C:/DEV/WORKS/loglog_project/SRC/LogLogAPI/src/main/webapp/up_imgs/visit_img/visitRecord/오늘날짜 + String thumbFolder = RESPOSITORY_PATH + baseFolder + calenderBean.getUserCd() + "/" + calenderBean.getShopCd(); + String btThumbImg1Path = null; + String btThumbImg2Path = null; + String btThumbImg3Path = null; + CalenderBean thumimg = calenderDao.selectCalenderId(calenderBean); + if( thumimg != null) { + btThumbImg1Path = thumimg.getThumbnail1(); // 기존에 있는 파일이 있을때 수정 전 파일을 백업 + btThumbImg2Path = thumimg.getThumbnail2(); + btThumbImg3Path = thumimg.getThumbnail3(); + } + if(thumFileList != null && updatedImgUrl == null) { + for(MultipartFile file : thumFileList ) { + //System.out.println("이미지 파일 로그:: " + file.getOriginalFilename()); + MultipartFile thumbFile = file; + String fileName = thumbFile.getOriginalFilename(); + String fileExt = fileName.substring( fileName.lastIndexOf(".") + 1 ); + UUID uuid = UUID.randomUUID(); + String thumImgPath = baseFolder + calenderBean.getUserCd() + "/" + calenderBean.getShopCd() + "/" + uuid + "." + fileExt; // db애 저장된 경로 + String thumbPath = thumbFolder + "/" + uuid + "." + fileExt; // 파일 완전경로 + + File tempFolder = new File( thumbFolder ); + if ( !tempFolder.exists() ){ + tempFolder.mkdirs(); + } + //System.out.println("thumbPath: " + thumbPath); + thumbFile.transferTo(new File(thumbPath)); + Files.add(thumImgPath); + } + if(thumFileList.size() == 1) { + String filePath1 = Files.get(0); + calenderBean.setThumbnail1(filePath1); + }else if(thumFileList.size() == 2) { + String filePath1 = Files.get(0); + String filePath2 = Files.get(1); + calenderBean.setThumbnail1(filePath1); + calenderBean.setThumbnail2(filePath2); + }else if(thumFileList.size() == 3) { + String filePath1 = Files.get(0); + String filePath2 = Files.get(1); + String filePath3 = Files.get(2); + calenderBean.setThumbnail1(filePath1); + calenderBean.setThumbnail2(filePath2); + calenderBean.setThumbnail3(filePath3); + } + }else if(thumFileList != null && updatedImgUrl != null) { + for(MultipartFile file : thumFileList ) { + //System.out.println("이미지 파일 로그:: " + file.getOriginalFilename()); + MultipartFile thumbFile = file; + String fileName = thumbFile.getOriginalFilename(); + String fileExt = fileName.substring( fileName.lastIndexOf(".") + 1 ); + UUID uuid = UUID.randomUUID(); + String thumImgPath = baseFolder + calenderBean.getUserCd() + "/" + calenderBean.getShopCd() + "/" + uuid + "." + fileExt; // db애 저장된 경로 + String thumbPath = thumbFolder + "/" + uuid + "." + fileExt; // 파일 완전경로 + + File tempFolder = new File( thumbFolder ); + if ( !tempFolder.exists() ){ + tempFolder.mkdirs(); + } + //System.out.println("thumbPath: " + thumbPath); + thumbFile.transferTo(new File(thumbPath)); + Files.add(thumImgPath); + } + if(thumFileList.size() == 1) { + String filePath3 = Files.get(0); + System.out.println("유지하는 이미지 개수" + splitList.length); + if(splitList.length == 1) { + calenderBean.setThumbnail2(filePath3); + }else if(splitList.length == 2) { + calenderBean.setThumbnail3(filePath3); + } + }else if(thumFileList.size() == 2) { + String filePath2 = Files.get(0); + String filePath3 = Files.get(1); + calenderBean.setThumbnail2(filePath2); + calenderBean.setThumbnail3(filePath3); + }else if(thumFileList.size() == 3) { + String filePath1 = Files.get(0); + String filePath2 = Files.get(1); + String filePath3 = Files.get(2); + calenderBean.setThumbnail1(filePath1); + calenderBean.setThumbnail2(filePath2); + calenderBean.setThumbnail3(filePath3); + } + } + result = calenderDao.updateCalenderthum(calenderBean); + +// if(result > 0) { +// if(btThumbImg1Path != null) { +// File thumb1Img = new File(RESPOSITORY_PATH + btThumbImg1Path); +// try { +// thumb1Img.delete(); +// } catch (Exception e) { +// e.getMessage(); +// } +// } +// +// if(btThumbImg2Path != null) { +// File thumb1Img = new File(RESPOSITORY_PATH + btThumbImg2Path); +// try { +// thumb1Img.delete(); +// } catch (Exception e) { +// e.getMessage(); +// } +// } +// +// if(btThumbImg3Path != null) { +// File thumb1Img = new File(RESPOSITORY_PATH + btThumbImg3Path); +// try { +// thumb1Img.delete(); +// } catch (Exception e) { +// e.getMessage(); +// } +// } +// } + return result; + } + /** 내점기록저장후 내용이나 사진 업데이트한걸 다시 업데이트*/ + public int updateCalenderUrl(CalenderBean calenderBean,List thumFileList)throws Exception{ + + return calenderDao.updateCalenderthum(calenderBean); + } + /** 업데이트 이후 ID값을 이용해 조회후 출력*/ + public CalenderBean selectUpdateId(CalenderBean calenderBean)throws Exception{ + calenderBean.setBaseImgUrl(URL_IMG_thumFile); + return calenderDao.selectUpdateId(calenderBean); + } + + /** 내점이력 삭제*/ + public int deleteVisitCalender(CalenderBean calenderBean)throws Exception{ + return calenderDao.deleteVisitCalender(calenderBean); + } + + /**내점이력 리스트 조회*/ + public List selectVisitList(CalenderBean calenderBean)throws Exception{ + calenderBean.setBaseImgUrl(URL_IMG_thumFile); + return calenderDao.selectVisitList(calenderBean); + } +} diff --git a/src/main/java/com/loglog/api/commons/modules/service/card/CardImgService.java b/src/main/java/com/loglog/api/commons/modules/service/card/CardImgService.java new file mode 100644 index 0000000..0a683e3 --- /dev/null +++ b/src/main/java/com/loglog/api/commons/modules/service/card/CardImgService.java @@ -0,0 +1,26 @@ +package com.loglog.api.commons.modules.service.card; + +import java.util.List; +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; + +import com.loglog.api.commons.beans.CardMasterBean; +import com.loglog.api.commons.beans.CardImgBean; + + +public interface CardImgService { + + /**카드 이미지 등록*/ + public int insertCardImg(CardMasterBean cardMasterBean, List cardImgList) throws Exception; + + /**카드 이미지 수정*/ + public int updateCardImg(CardMasterBean cardMasterBean, List cardImgList) throws Exception; + + /** 카드 이미지 삭제*/ + public void DeleteImg(int janNo )throws Exception; + + /** 카드 이미지 리스트*/ + public List cardImgList(List list)throws Exception; + +} diff --git a/src/main/java/com/loglog/api/commons/modules/service/card/CardImgServiceImpl.java b/src/main/java/com/loglog/api/commons/modules/service/card/CardImgServiceImpl.java new file mode 100644 index 0000000..a04a431 --- /dev/null +++ b/src/main/java/com/loglog/api/commons/modules/service/card/CardImgServiceImpl.java @@ -0,0 +1,192 @@ +package com.loglog.api.commons.modules.service.card; + +import java.io.File; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import org.apache.commons.io.FileUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; + +import com.loglog.api.commons.beans.CardImgBean; +import com.loglog.api.commons.beans.CardMasterBean; + +import com.loglog.api.commons.daos.CardMasterDao; +import com.loglog.api.commons.daos.CardImgDao; +@Service +public class CardImgServiceImpl implements CardImgService { + @Autowired + private CardMasterDao cardMasterDao; + @Autowired + private CardImgDao cardImgDao; + + + // 레파지토리 경로 + @Value("${repository.path}") + private String RESPOSITORY_PATH; + // 보드 이미지 폴더 경로 + @Value("${upload.board.path}") + private String UPLOAD_BOARD_PATH; + // 다음 에디터 이미지 임시 폴더 경로 + @Value("${upload.daum.editor.image.temp.path}") + private String UPLOAD_DAUM_EDITOR_IMAGE_TEMP_PATH; + // 다음 에디터 파일 임시 폴더 경로 + @Value("${upload.daum.editor.file.temp.path}") + private String UPLOAD_DAUM_EDITOR_FILE_TEMP_PATH; + + /**카드 이미지 등록*/ + public int insertCardImg(CardMasterBean cardMasterBean, List cardImgList) throws Exception{ + int result =0; + + List deleteFileList = new ArrayList(); + + /* 게시글 이미지 등록 */ + for(int i=0; i cardImgList) throws Exception{ + int result = 0; + + List deleteFileList = new ArrayList(); + + // 기존 이미지 데이터 삭제 + // UI에서 삭제된 이미지일 경우 이미지 경로가 안들어오므로, + // 체크하여 삭제한다. + List cardImgArray = new ArrayList(); + if (cardImgList != null && cardImgList.size() != 0) { + for (int i = 0; i < cardImgList.size(); i++) { + CardImgBean cardImgBean = cardImgList.get(i); + + // 이미지 변경 없음 + System.out.println("first---"+cardImgBean.getImgPath().indexOf(UPLOAD_BOARD_PATH)); + System.out.println("second---"+cardImgBean.getImgPath().indexOf(UPLOAD_DAUM_EDITOR_IMAGE_TEMP_PATH)); + + if (cardImgBean.getImgPath().indexOf(UPLOAD_DAUM_EDITOR_IMAGE_TEMP_PATH) == -1) { + cardImgArray.add(cardImgBean.getImgPath()); + } + } + } + + // 삭제될 이미지 목록 조회 + List deleteCardImgList = cardImgDao.deleteImgList(cardMasterBean.getJanNo(),cardImgArray); + + if (deleteCardImgList != null && deleteCardImgList.size() != 0) { + // 삭제된 이미지 DB 삭제 처리 + cardImgDao.deleteImgForUpdate(deleteCardImgList); + + // 서버에서 이미지 삭제 처리 + for (CardImgBean cardImgBean : deleteCardImgList) { + File deleteImgFile = new File(RESPOSITORY_PATH + cardImgBean.getImgPath()); + try { + deleteImgFile.delete(); + } catch (Exception e) { + e.getMessage(); + } + } + } + + if (cardImgList != null && cardImgList.size() != 0) { + + // 게시글 이미지 수정 + for (int i = 0; i < cardImgList.size(); i++) { + CardImgBean cardImgBean = cardImgList.get(i); + + System.out.println("last---"+cardImgBean.getImgPath().indexOf(UPLOAD_DAUM_EDITOR_IMAGE_TEMP_PATH)); + + // 이미지 변경 없음 + if (cardImgBean.getImgPath().indexOf(UPLOAD_DAUM_EDITOR_IMAGE_TEMP_PATH) == -1) { + + //boardImgDao.updateBoardImg(boardImgBean); + + // 이미지 변경 또는 신규 등록됨 + } else { + File cardImgTempFile = new File(RESPOSITORY_PATH + + cardImgBean.getImgPath()); + deleteFileList.add(cardImgTempFile); + + Date date = new Date(); + + SimpleDateFormat newDate = new SimpleDateFormat("yyyyMMdd"); + + String boardImgPath = UPLOAD_BOARD_PATH + "/" + cardMasterBean.getJanNo() + "/" + newDate.format(date) + "/"+ cardImgTempFile.getName(); + + File boardImgFile = new File(RESPOSITORY_PATH + boardImgPath); + + // 정상적인 프로세스상 파일 이동이 이동되어야 하지만, + // 파일 복사로 변경 + FileUtils.copyFile(cardImgTempFile, boardImgFile); + + cardImgBean.setImgPath(boardImgPath); + + result += cardImgDao.insertCardImg(cardImgBean); + + String changeImg = " cardImgList(List list)throws Exception{ + return cardImgDao.cardImgList(list); + } + + @Override + public void DeleteImg(int janNo) throws Exception { + // TODO Auto-generated method stub + + } +} diff --git a/src/main/java/com/loglog/api/commons/modules/service/card/CardMasterService.java b/src/main/java/com/loglog/api/commons/modules/service/card/CardMasterService.java new file mode 100644 index 0000000..403b3bf --- /dev/null +++ b/src/main/java/com/loglog/api/commons/modules/service/card/CardMasterService.java @@ -0,0 +1,64 @@ +package com.loglog.api.commons.modules.service.card; + +import java.util.List; +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; + +import org.springframework.web.multipart.MultipartFile; + +import com.loglog.api.commons.beans.PagingBean; +import com.loglog.api.commons.beans.ShopMasterBean; +import com.loglog.api.commons.beans.UserBean; +import com.loglog.api.commons.beans.CardMasterBean; +import com.loglog.api.commons.beans.CardImgBean; + +public interface CardMasterService { + /**유저 카드 조회*/ + public List selectCardList(CardMasterBean cardMasterBean) throws Exception; + + /**카드저장*/ + public int insertCard(CardMasterBean cardMasterBean, MultipartFile cardImageFile) throws Exception; + + /**카드 저장전 중복체크*/ + public int checkCardNm(CardMasterBean cardMasterBean) throws Exception; + + /**카드 수정 전 카드이름 중복체크*/ + public int checkCardNmUpdate(CardMasterBean cardMasterBean)throws Exception; + + /**카드 정보 수정*/ + public int updateCard(CardMasterBean cardMasterBean, MultipartFile cardImageFile) throws Exception; + + /**카드 정보 수정*/ + public int updateCardNoimg(CardMasterBean cardMasterBean)throws Exception; + + /**카드 정보 삭제*/ + public int deleteCard(CardMasterBean cardMasterBean) throws Exception; + + /**자세한 카드정보 조회*/ + public CardMasterBean detailCard(CardMasterBean cardMasterBean) throws Exception; + + /**포인트값 더하기 */ + public int updatePoint(CardMasterBean cardMasterBean)throws Exception; + + /**포인트값 치김 */ + public int deletePoint(CardMasterBean cardMasterBean)throws Exception; + + /**포인트값 null을 0으로 바꾸기 */ + public int changZeroPoint(CardMasterBean cardMasterBean)throws Exception; + + /**포인트값 조회 */ + public int selectPoint(CardMasterBean cardMasterBean)throws Exception; + + /** 즐겨찾기한 카드 조회 */ + public List selectLikeCardList(CardMasterBean cardMasterBean); + + /**카드좋아요 */ + public int likeCard(CardMasterBean cardMasterBean); + + /**카드좋아요 취소ㅓ */ + public int unlikeCard(CardMasterBean cardMasterBean); + + /**마이카드 등록하기 전 등록하지 않은 상점리스트 출력*/ + public List selectNotRegisShopList(CardMasterBean cardMasterBean)throws Exception; +} diff --git a/src/main/java/com/loglog/api/commons/modules/service/card/CardMasterServiceImpl.java b/src/main/java/com/loglog/api/commons/modules/service/card/CardMasterServiceImpl.java new file mode 100644 index 0000000..f1dc0f5 --- /dev/null +++ b/src/main/java/com/loglog/api/commons/modules/service/card/CardMasterServiceImpl.java @@ -0,0 +1,197 @@ +package com.loglog.api.commons.modules.service.card; + +import java.io.File; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; +import java.util.UUID; + +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 com.loglog.api.commons.beans.CardImgBean; +import com.loglog.api.commons.beans.CardMasterBean; +import com.loglog.api.commons.beans.CouponUserListBean; +import com.loglog.api.commons.beans.ShopMasterBean; +import com.loglog.api.commons.daos.CardMasterDao; +import com.loglog.api.commons.daos.CardImgDao; + +@Service +public class CardMasterServiceImpl implements CardMasterService { + + // 레파지토리 경로 + @Value("${repository.path}") + private String RESPOSITORY_PATH; + // 보드 이미지 폴더 경로 + @Value("${upload.board.path}") + private String UPLOAD_CARD_PATH; + // BASE URL MyCard 경로 + @Value("${server.url.img.mycard}") + private String URL_IMG_MYCARD; + + @Value("${server.url.img.shop}") + private String URL_IMG_SHOP; + + @Autowired + private CardMasterDao cardMasterDao; + @Autowired + private CardImgDao cardImgDao; + @Autowired + private CardImgService cardImgService; + + + @Override + public List selectCardList(CardMasterBean cardMasterBean) throws Exception { + // TODO Auto-generated method stub + cardMasterBean.setBaseImgUrl(URL_IMG_MYCARD); + cardMasterBean.setBaseImgUrl2(URL_IMG_SHOP); + List list = cardMasterDao.selectCardList(cardMasterBean); + return list; + } + + @Override + public int insertCard(CardMasterBean cardMasterBean, MultipartFile cardImageFile) throws Exception{ + SimpleDateFormat newDate = new SimpleDateFormat("yyyyMMdd"); + Date date = new Date(); + + if(cardImageFile != null) { + System.out.println("이미지 파일 로그:: " + cardImageFile.getOriginalFilename()); + System.out.println("디버그1"); + MultipartFile thumbFile = cardImageFile; + String fileName = thumbFile.getOriginalFilename(); + String fileExt = fileName.substring( fileName.lastIndexOf(".") + 1 ); + UUID uuid = UUID.randomUUID(); + + String baseFolder = UPLOAD_CARD_PATH +"/mycard/"; + String thumbFolder = RESPOSITORY_PATH + baseFolder + newDate.format(date); + String cardImgPath = baseFolder + newDate.format(date) + "/" + uuid + "." + fileExt; // db애 저장된 경로 + String thumbPath = thumbFolder + "/" + uuid + "." + fileExt; // 파일 완전경로 + + File tempFolder = new File( thumbFolder ); + if ( !tempFolder.exists() ){ + tempFolder.mkdirs(); + System.out.println("디버그2"); + } + System.out.println("thumbPath: " + thumbPath); + thumbFile.transferTo(new File(thumbPath)); + + cardMasterBean.setCardImage( cardImgPath ); + System.out.println("디버그" + cardMasterBean.getCardImage()); + } + + return cardMasterDao.insertCard(cardMasterBean); + } + public int checkCardNm(CardMasterBean cardMasterBean) throws Exception{ + return cardMasterDao.checkCardNm(cardMasterBean); + } + /**카드 수정 전 카드이름 중복체크*/ + public int checkCardNmUpdate(CardMasterBean cardMasterBean)throws Exception{ + return cardMasterDao.checkCardNmUpdate(cardMasterBean); + } + public int updateCard(CardMasterBean cardMasterBean,MultipartFile cardImageFile) throws Exception{ + SimpleDateFormat newDate = new SimpleDateFormat("yyyyMMdd"); + Date date = new Date(); + String btThumbImg1Path = null; + + if(cardImageFile != null) { + System.out.println("이미지 파일 로그(수정)" + cardImageFile.getOriginalFilename()); + MultipartFile thumbFile = cardImageFile; + String fileName = thumbFile.getOriginalFilename(); + String fileExt = fileName.substring( fileName.lastIndexOf(".") + 1 ); + UUID uuid = UUID.randomUUID(); + + String baseFolder = UPLOAD_CARD_PATH +"/mycard/"; + String thumbFolder = RESPOSITORY_PATH + baseFolder + newDate.format(date); + String cardImgPath = baseFolder + newDate.format(date) + "/" + uuid + "." + fileExt; // db애 저장된 경로 + String thumbPath = thumbFolder + "/" + uuid + "." + fileExt; // 파일 완전경로 + + File tempFolder = new File( thumbFolder ); + if ( !tempFolder.exists() ){ + tempFolder.mkdirs(); + System.out.println("디버그2"); + } + System.out.println("thumbPath: " + thumbPath); + thumbFile.transferTo(new File(thumbPath)); + + // 수정전 백업 + btThumbImg1Path = cardMasterBean.getCardImage(); + + cardMasterBean.setCardImage(cardImgPath); + + } + int result = cardMasterDao.updateCard(cardMasterBean); + + if(result > 0) { + if(btThumbImg1Path != null) { + File thumb1Img = new File(RESPOSITORY_PATH + btThumbImg1Path); + try { + thumb1Img.delete(); + } catch (Exception e) { + e.getMessage(); + } + } + } + return result; + } + + /**카드 정보 수정*/ + public int updateCardNoimg(CardMasterBean cardMasterBean)throws Exception{ + return cardMasterDao.updateCardNoimg(cardMasterBean); + } + + public int deleteCard(CardMasterBean cardMasterBean) throws Exception{ + return cardMasterDao.deleteCard(cardMasterBean); + } + + /**자세한 카드정보 조회*/ + public CardMasterBean detailCard(CardMasterBean cardMasterBean) throws Exception{ + return cardMasterDao.detailCard(cardMasterBean); + } + + /**포인트값 더하기 */ + public int updatePoint(CardMasterBean cardMasterBean)throws Exception{ + return cardMasterDao.updatePoint(cardMasterBean); + } + + /**포인트값 치김 */ + public int deletePoint(CardMasterBean cardMasterBean)throws Exception{ + return cardMasterDao.deletePoint(cardMasterBean); + } + + /**포인트값 null을 0으로 바꾸기 */ + public int changZeroPoint(CardMasterBean cardMasterBean)throws Exception{ + return cardMasterDao.changZeroPoint(cardMasterBean); + } + + /**포인트값 조회 */ + public int selectPoint(CardMasterBean cardMasterBean)throws Exception{ + return cardMasterDao.selectPoint(cardMasterBean); + } + + /** 즐겨찾기한 카드 조회 */ + public List selectLikeCardList(CardMasterBean cardMasterBean){ + System.out.println(URL_IMG_MYCARD); + cardMasterBean.setBaseImgUrl(URL_IMG_MYCARD); + return cardMasterDao.selectLikeCardList(cardMasterBean); + } + + /**카드좋아요 */ + public int likeCard(CardMasterBean cardMasterBean) { + return cardMasterDao.likeCard(cardMasterBean); + } + + /**카드좋아요 취소ㅓ */ + public int unlikeCard(CardMasterBean cardMasterBean) { + return cardMasterDao.unlikeCard(cardMasterBean); + } + + /**마이카드 등록하기 전 등록하지 않은 상점리스트 출력*/ + public List selectNotRegisShopList(CardMasterBean cardMasterBean)throws Exception{ + cardMasterBean.setBaseImgUrl(URL_IMG_SHOP); + return cardMasterDao.selectNotRegisShopList(cardMasterBean); + } +} diff --git a/src/main/java/com/loglog/api/commons/modules/service/coupon/ConponPublicServiceImpl.java b/src/main/java/com/loglog/api/commons/modules/service/coupon/ConponPublicServiceImpl.java new file mode 100644 index 0000000..042c822 --- /dev/null +++ b/src/main/java/com/loglog/api/commons/modules/service/coupon/ConponPublicServiceImpl.java @@ -0,0 +1,266 @@ +package com.loglog.api.commons.modules.service.coupon; + +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; + +import com.loglog.api.commons.utils.CommonUtils; +import com.loglog.api.commons.beans.CategoryBean; +import com.loglog.api.commons.beans.CouponPublicBean; +import com.loglog.api.commons.beans.CouponUserListBean; +import com.loglog.api.commons.beans.GeolocationBean; +import com.loglog.api.commons.beans.PagingBean; +import com.loglog.api.commons.daos.CouponPublicDao; + + +@Service +public class ConponPublicServiceImpl implements CouponPublicService { + + @Value("${server.url.img.coupon}") + private String URL_IMG_COUPON; + + @Value("${server.url.img.shop}") + private String URL_IMG_SHOP; + + @Value("${server.url.img.mycard}") // https://loglog.le-it.com + private String URL_IMG_MYCARD; + + @Autowired + private CouponPublicDao couponPublicDao; + + /**type : 1*/ + public List selectGetCoupons(CouponPublicBean couponPublicBean,PagingBean pagingBean) throws Exception { + Map parameter = new HashMap(); + couponPublicBean.setBaseImgUrl(URL_IMG_COUPON); + couponPublicBean.setBaseImgUrl2(URL_IMG_SHOP); // 상점 이미지 BASE URL + parameter.put("userCd",couponPublicBean.getUserCd()); + parameter.put("baseImgUrl", couponPublicBean.getBaseImgUrl()); + parameter.put("baseImgUrl2", couponPublicBean.getBaseImgUrl2()); + parameter.put("categoryCd", couponPublicBean.getCategoryCd()); + parameter.put("type", couponPublicBean.getType()); + parameter.put("searchKind",pagingBean.getSearchKind()); + parameter.put("search", pagingBean.getSearch()); + parameter.put("pageNo", pagingBean.getPageNo()); + parameter.put("startRow", pagingBean.getStartRow()); + parameter.put("countPerRecord", pagingBean.getCountPerRecord()); + + List list = couponPublicDao.selectGetCoupons(parameter); + //기존 파일명을 URL 인코딩 하여 전달한다. 파일명이 일본어일 경우 표시가 안됨으로 + for(CouponUserListBean item : list) { + String encodShopImg = URLEncoder.encode(item.getShopThumbNail1(), StandardCharsets.UTF_8.toString()).replace("+", "%20"); + String shopCd = item.getShopCd(); + String couponCd = item.getCouponCd(); + String shopUrlPath = URL_IMG_SHOP + "/" + shopCd + "/" + encodShopImg; + item.setShopimage( shopUrlPath ); + //System.out.println("shopUrlPath:" + shopUrlPath); + + String encodCouponImg = URLEncoder.encode(item.getCouponThumbnail1(), StandardCharsets.UTF_8.toString()).replace("+", "%20"); + String couponUrlPath = URL_IMG_COUPON + "/" + shopCd + "/" + couponCd + "/"+ encodCouponImg; + if( "000011".equals(shopCd) ) { + System.out.println("getCouponThumbnail1:" + item.getCouponThumbnail1()); + System.out.println("encodCouponImg:" + encodCouponImg); + System.out.println("couponUrlPath:" + couponUrlPath); + } + boolean isVerify = CommonUtils.getImageUrlVerify( couponUrlPath ); + item.setThumbnail1( couponUrlPath ); +// if(isVerify) { +// item.setThumbnail1( couponUrlPath ); +// }else { +// item.setThumbnail1( shopUrlPath ); +// } + + } + + return list; + } + + /**type : 2*/ + public List selectGeoGetCoupons(CouponPublicBean couponPublicBean, GeolocationBean geolocationBean,PagingBean pagingBean) throws Exception { + Map parameter = new HashMap(); + couponPublicBean.setBaseImgUrl(URL_IMG_COUPON); + couponPublicBean.setBaseImgUrl2(URL_IMG_SHOP); + parameter.put("longtitude",geolocationBean.getLongtitude()); + parameter.put("latitude",geolocationBean.getLatitude()); + parameter.put("userCd",couponPublicBean.getUserCd()); + parameter.put("baseImgUrl", couponPublicBean.getBaseImgUrl()); + parameter.put("baseImgUrl2", couponPublicBean.getBaseImgUrl2()); + parameter.put("categoryCd", couponPublicBean.getCategoryCd()); + parameter.put("searchKind",pagingBean.getSearchKind()); + parameter.put("search", pagingBean.getSearch()); + parameter.put("pageNo", pagingBean.getPageNo()); + parameter.put("startRow", pagingBean.getStartRow()); + parameter.put("countPerRecord", pagingBean.getCountPerRecord()); + List list = couponPublicDao.selectGeoGetCoupons(parameter); + //기존 파일명을 URL 인코딩 하여 전달한다. 파일명이 일본어일 경우 표시가 안됨으로 + for(CouponUserListBean item : list) { + String encodShopImg = URLEncoder.encode(item.getShopThumbNail1(), StandardCharsets.UTF_8.toString()).replace("+", "%20"); + String shopCd = item.getShopCd(); + String couponCd = item.getCouponCd(); + String shopUrlPath = URL_IMG_SHOP + "/" + shopCd + "/" + encodShopImg; + item.setShopimage( shopUrlPath ); + //System.out.println("shopUrlPath:" + shopUrlPath); + + String encodCouponImg = URLEncoder.encode(item.getCouponThumbnail1(), StandardCharsets.UTF_8.toString()).replace("+", "%20"); + String couponUrlPath = URL_IMG_COUPON + "/" + shopCd + "/" + couponCd + "/"+ encodCouponImg; + item.setThumbnail1( couponUrlPath ); + } + return list; + } + + /**쿠폰 갯수 반환 */ + public int selectCouponCount(CouponPublicBean couponPublicBean,PagingBean pagingBean) { + Map parameter = new HashMap(); + parameter.put("userCd",couponPublicBean.getUserCd()); + parameter.put("categoryCd", couponPublicBean.getCategoryCd()); + parameter.put("searchKind",pagingBean.getSearchKind()); + parameter.put("search", pagingBean.getSearch()); + parameter.put("pageNo", pagingBean.getPageNo()); + return couponPublicDao.selectCouponCount(parameter); + } + + /**쿠폰생성(유효회원이 아닐때) */ + public int insertCouponNotPaid(CouponPublicBean couponPublicBean)throws Exception{ + return couponPublicDao.insertCouponNotPaid(couponPublicBean); + } + + /**쿠폰생성(유효회원) */ + public int insertCouponPaid(CouponPublicBean couponPublicBean)throws Exception{ + return couponPublicDao.insertCouponPaid(couponPublicBean); + } + + /**좋아요 쿠폰 개수 반환*/ + public int selectLikeCouponCount(CouponPublicBean couponPublicBean,PagingBean pagingBean)throws Exception{ + Map parameter = new HashMap(); + parameter.put("userCd",couponPublicBean.getUserCd()); + parameter.put("categoryCd", couponPublicBean.getCategoryCd()); + parameter.put("searchKind",pagingBean.getSearchKind()); + parameter.put("search", pagingBean.getSearch()); + parameter.put("pageNo", pagingBean.getPageNo()); + return couponPublicDao.selectLikeCouponCount(parameter); + + } + + /** 좋아요 쿠폰 조회 */ + public List selectGetLikeCoupons(CouponPublicBean couponPublicBean, PagingBean pagingBean)throws Exception{ + Map parameter = new HashMap(); + couponPublicBean.setBaseImgUrl(URL_IMG_COUPON); + couponPublicBean.setBaseImgUrl2(URL_IMG_SHOP); + parameter.put("userCd",couponPublicBean.getUserCd()); + parameter.put("baseImgUrl", couponPublicBean.getBaseImgUrl()); + parameter.put("baseImgUrl2", couponPublicBean.getBaseImgUrl2()); + parameter.put("categoryCd", couponPublicBean.getCategoryCd()); + parameter.put("searchKind",pagingBean.getSearchKind()); + parameter.put("search", pagingBean.getSearch()); + parameter.put("pageNo", pagingBean.getPageNo()); + parameter.put("startRow", pagingBean.getStartRow()); + parameter.put("countPerRecord", pagingBean.getCountPerRecord()); + + List list = couponPublicDao.selectGetLikeCoupons(parameter); + //기존 파일명을 URL 인코딩 하여 전달한다. 파일명이 일본어일 경우 표시가 안됨으로 + for(CouponUserListBean item : list) { + String encodShopImg = URLEncoder.encode(item.getShopThumbNail1(), StandardCharsets.UTF_8.toString()).replace("+", "%20"); + String shopCd = item.getShopCd(); + String shopUrlPath = URL_IMG_SHOP + "/" + shopCd + "/" + encodShopImg; + item.setShopimage( shopUrlPath ); + //System.out.println("shopUrlPath:" + shopUrlPath); + + String couponCd = item.getCouponCd(); + String encodCouponImg = URLEncoder.encode(item.getCouponThumbnail1(), StandardCharsets.UTF_8.toString()).replace("+", "%20"); + String couponUrlPath = URL_IMG_COUPON + "/" + shopCd + "/" + couponCd + "/"+ encodCouponImg; + item.setThumbnail1( couponUrlPath ); + + } + + return list; + } + + /** 쿠폰 좋아요 */ + public int insertCouponLike(CouponPublicBean couponPublicBean)throws Exception{ + return couponPublicDao.insertCouponLike(couponPublicBean); + } + + /** 쿠폰 좋아요 취소 */ + public int insertCouponUnLike(CouponPublicBean couponPublicBean)throws Exception{ + return couponPublicDao.insertCouponUnLike(couponPublicBean); + } + + /** 쿠폰 사용 */ + public int insertUseCoupon(CouponPublicBean couponPublicBean)throws Exception{ + return couponPublicDao.insertUseCoupon(couponPublicBean); + } + + /**상세정보를 확인한 쿠폰 개수 반환*/ + public int selectSeenCouponCount(CouponPublicBean couponPublicBean,PagingBean pagingBean)throws Exception{ + Map parameter = new HashMap(); + parameter.put("userCd",couponPublicBean.getUserCd()); + parameter.put("categoryCd", couponPublicBean.getCategoryCd()); + parameter.put("searchKind",pagingBean.getSearchKind()); + parameter.put("search", pagingBean.getSearch()); + parameter.put("pageNo", pagingBean.getPageNo()); + return couponPublicDao.selectSeenCouponCount(parameter); + } + + /**상세정보를 확인한 쿠폰 리스트 */ + public List selectSeenCoupons(CouponPublicBean couponPublicBean,PagingBean pagingBean)throws Exception{ + Map parameter = new HashMap(); + couponPublicBean.setBaseImgUrl(URL_IMG_COUPON); + couponPublicBean.setBaseImgUrl2(URL_IMG_SHOP); + parameter.put("userCd",couponPublicBean.getUserCd()); + parameter.put("baseImgUrl", couponPublicBean.getBaseImgUrl()); + parameter.put("baseImgUrl2", couponPublicBean.getBaseImgUrl2()); + parameter.put("categoryCd", couponPublicBean.getCategoryCd()); + parameter.put("searchKind",pagingBean.getSearchKind()); + parameter.put("search", pagingBean.getSearch()); + parameter.put("pageNo", pagingBean.getPageNo()); + parameter.put("startRow", pagingBean.getStartRow()); + parameter.put("countPerRecord", pagingBean.getCountPerRecord()); + + List list = couponPublicDao.selectSeenCoupons(parameter); + for(CouponUserListBean item : list) { + String encodShopImg = URLEncoder.encode(item.getShopThumbNail1(), StandardCharsets.UTF_8.toString()).replace("+", "%20"); + String shopCd = item.getShopCd(); + String couponCd = item.getCouponCd(); + String shopUrlPath = URL_IMG_SHOP + "/" + shopCd + "/" + encodShopImg; + item.setShopimage( shopUrlPath ); + //System.out.println("shopUrlPath:" + shopUrlPath); + + String encodCouponImg = URLEncoder.encode(item.getCouponThumbnail1(), StandardCharsets.UTF_8.toString()).replace("+", "%20"); + String couponUrlPath = URL_IMG_COUPON + "/" + shopCd + "/" + couponCd + "/"+ encodCouponImg; + item.setThumbnail1( couponUrlPath ); + + } + return list; + } + + /**쿠폰 상세정보를 볼때 DB업데이트 - coupon_seen*/ + public int insertSeenCoupon(CouponPublicBean couponPublicBean)throws Exception{ + return couponPublicDao.insertSeenCoupon(couponPublicBean); + } + + /**coupon_seen에 중복데이터 체크*/ + public int selectSeenCheck(CouponPublicBean couponPublicBean)throws Exception{ + return couponPublicDao.selectSeenCheck(couponPublicBean); + } + + /** 카테고리 리스트 */ + public List selectCategoryList(CategoryBean categoryBean)throws Exception{ + categoryBean.setBaseImgUrl(URL_IMG_MYCARD); + return couponPublicDao.selectCategoryList(categoryBean); + } + + /** 쿠폰의 존재 여부 체크 */ + public int selectCouponCheck(CouponPublicBean couponPublicBean)throws Exception{ + return couponPublicDao.selectCouponCheck(couponPublicBean); + } + + /** 쿠폰의 사용여부 체크 */ + public int selectUsedCouponCheck(CouponPublicBean couponPublicBean)throws Exception{ + return couponPublicDao.selectUsedCouponCheck(couponPublicBean); + } +} diff --git a/src/main/java/com/loglog/api/commons/modules/service/coupon/CouponMasterService.java b/src/main/java/com/loglog/api/commons/modules/service/coupon/CouponMasterService.java new file mode 100644 index 0000000..a95d59a --- /dev/null +++ b/src/main/java/com/loglog/api/commons/modules/service/coupon/CouponMasterService.java @@ -0,0 +1,19 @@ +package com.loglog.api.commons.modules.service.coupon; + +import java.util.List; +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; + +import com.loglog.api.commons.beans.CouponMasterBean; +import com.loglog.api.commons.beans.CouponPublicBean; +import com.loglog.api.commons.beans.PagingBean; +import com.loglog.api.commons.beans.UserBean; +import com.loglog.api.commons.beans.GeolocationBean; + +public interface CouponMasterService { + + public int selectCouponPage(CouponMasterBean couponMasterBean) throws Exception; + + public CouponMasterBean selectCouponDetail(CouponMasterBean CouponMasterBean) throws Exception; +} diff --git a/src/main/java/com/loglog/api/commons/modules/service/coupon/CouponMasterServiceImpl.java b/src/main/java/com/loglog/api/commons/modules/service/coupon/CouponMasterServiceImpl.java new file mode 100644 index 0000000..a1a447d --- /dev/null +++ b/src/main/java/com/loglog/api/commons/modules/service/coupon/CouponMasterServiceImpl.java @@ -0,0 +1,28 @@ +package com.loglog.api.commons.modules.service.coupon; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; + +import com.loglog.api.commons.beans.CouponMasterBean; +import com.loglog.api.commons.daos.CouponMasterDao; + +@Service +public class CouponMasterServiceImpl implements CouponMasterService { + + @Value("${server.url.img.coupon}") + private String URL_IMG_COUPON; + + @Autowired + private CouponMasterDao couponMasterDao; + + @Override + public int selectCouponPage(CouponMasterBean couponMasterBean) throws Exception { + return couponMasterDao.selectCouponPage(couponMasterBean); + } + + public CouponMasterBean selectCouponDetail(CouponMasterBean CouponMasterBean) throws Exception{ + CouponMasterBean.setBaseImgUrl(URL_IMG_COUPON); + return couponMasterDao.selectCouponDetail(CouponMasterBean); + } +} diff --git a/src/main/java/com/loglog/api/commons/modules/service/coupon/CouponPublicService.java b/src/main/java/com/loglog/api/commons/modules/service/coupon/CouponPublicService.java new file mode 100644 index 0000000..cdff427 --- /dev/null +++ b/src/main/java/com/loglog/api/commons/modules/service/coupon/CouponPublicService.java @@ -0,0 +1,67 @@ +package com.loglog.api.commons.modules.service.coupon; + +import java.util.List; +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; + +import com.loglog.api.commons.beans.CategoryBean; +import com.loglog.api.commons.beans.CouponPublicBean; +import com.loglog.api.commons.beans.CouponUserListBean; +import com.loglog.api.commons.beans.PagingBean; +import com.loglog.api.commons.beans.UserBean; +import com.loglog.api.commons.beans.GeolocationBean; + +public interface CouponPublicService { + + /**사용자 쿠폰정보 가져오기 위경도값 없음 */ + public List selectGetCoupons(CouponPublicBean couponPublicBean,PagingBean pagingBean) throws Exception; + + /**사용자 쿠폰정보 가져오기 위경도값 있음 */ + public List selectGeoGetCoupons(CouponPublicBean couponPublicBean, GeolocationBean geolocationBean ,PagingBean pagingBean ) throws Exception; + + /**쿠폰 갯수 반환 */ + public int selectCouponCount(CouponPublicBean couponPublicBean,PagingBean pagingBean); + + /**쿠폰생성(유효회원이 아닐때) */ + public int insertCouponNotPaid(CouponPublicBean couponPublicBean)throws Exception; + + /**쿠폰생성(유효회원) */ + public int insertCouponPaid(CouponPublicBean couponPublicBean)throws Exception; + + /**좋아요 쿠폰 개수 반환*/ + public int selectLikeCouponCount(CouponPublicBean couponPublicBean,PagingBean pagingBean)throws Exception; + + /** 좋아요 쿠폰 조회 */ + public List selectGetLikeCoupons(CouponPublicBean couponPublicBean,PagingBean pagingBean)throws Exception; + + /**쿠폰 좋아요*/ + public int insertCouponLike(CouponPublicBean couponPublicBean)throws Exception; + + /**쿠폰 좋아요*/ + public int insertCouponUnLike(CouponPublicBean couponPublicBean)throws Exception; + + /**쿠폰 사용*/ + public int insertUseCoupon(CouponPublicBean couponPublicBean)throws Exception; + + /**상세정보를 확인한 쿠폰 개수 반환*/ + public int selectSeenCouponCount(CouponPublicBean couponPublicBean,PagingBean pagingBean)throws Exception; + + /**상세정보를 확인한 쿠폰 리스트 */ + public List selectSeenCoupons(CouponPublicBean couponPublicBean,PagingBean pagingBean)throws Exception; + + /**쿠폰 상세정보를 볼때 DB업데이트 - coupon_seen*/ + public int insertSeenCoupon(CouponPublicBean couponPublicBean)throws Exception; + + /**coupon_seen에 중복데이터 체크*/ + public int selectSeenCheck(CouponPublicBean couponPublicBean)throws Exception; + + /**카테고리 리스트*/ + public List selectCategoryList(CategoryBean categoryBean)throws Exception; + + /**쿠폰의 존재 여부 체크*/ + public int selectCouponCheck(CouponPublicBean couponPublicBean)throws Exception; + + /**쿠폰의 사용여부 체크*/ + public int selectUsedCouponCheck(CouponPublicBean couponPublicBean)throws Exception; +} diff --git a/src/main/java/com/loglog/api/commons/modules/service/message/MsgMasterService.java b/src/main/java/com/loglog/api/commons/modules/service/message/MsgMasterService.java new file mode 100644 index 0000000..e1a9df6 --- /dev/null +++ b/src/main/java/com/loglog/api/commons/modules/service/message/MsgMasterService.java @@ -0,0 +1,49 @@ +package com.loglog.api.commons.modules.service.message; + +import java.util.List; +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; + +import com.loglog.api.commons.beans.PagingBean; +import com.loglog.api.commons.beans.ShopDetailBean; +import com.loglog.api.commons.beans.UserBean; +import com.loglog.api.commons.beans.CardMasterBean; +import com.loglog.api.commons.beans.CouponPublicBean; +import com.loglog.api.commons.beans.CouponUserListBean; +import com.loglog.api.commons.beans.MsgMasterBean; + +public interface MsgMasterService { + + public List selectMsgText(MsgMasterBean msgMasterBean); + + /**통지 메시지 출력*/ + public List selectNoitMsg(MsgMasterBean msgMasterBean); + + /**유저 전체 메세지 디테일*/ + public MsgMasterBean selectMsgTextDetail(MsgMasterBean msgMasterBean); + + /**유저 통지 메세지 디테일*/ + public MsgMasterBean selectNoitMsgDetail(MsgMasterBean msgMasterBean); + + /**즐겨찾기한 상점의 메세지리스트*/ + public List selectShopMsgList(MsgMasterBean msgMasterBean)throws Exception; + + /**즐겨찾기한 상점이 보내준 메세지 상세내용*/ + public List selectShopMsgDetail(MsgMasterBean msgMasterBean)throws Exception; + + /**오시라세 디테일 확인시 seen컬럼 1로 업데이트*/ + public int updateMsgSeen(MsgMasterBean msgMasterBean)throws Exception; + + /**msgType : 1인 메세지의 상세내용*/ + public List selectMegDeltail(MsgMasterBean msgMasterBean)throws Exception; + + /**유저 읽지 않은 통지 메세지 개수 반환*/ + public MsgMasterBean selectNotReadNotice(MsgMasterBean msgMasterBean)throws Exception; + + /**유저 읽지 않은 오시라세 메세지 개수 반환*/ + public MsgMasterBean selectNotReadShopMsg(MsgMasterBean msgMasterBean)throws Exception; + + /**통지 상세보기 읽음처리*/ + public int updateNoticSeen(MsgMasterBean msgMasterBean)throws Exception; +} diff --git a/src/main/java/com/loglog/api/commons/modules/service/message/MsgMasterServiceImpl.java b/src/main/java/com/loglog/api/commons/modules/service/message/MsgMasterServiceImpl.java new file mode 100644 index 0000000..d901e05 --- /dev/null +++ b/src/main/java/com/loglog/api/commons/modules/service/message/MsgMasterServiceImpl.java @@ -0,0 +1,79 @@ +package com.loglog.api.commons.modules.service.message; + +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; + +import com.loglog.api.commons.beans.MsgMasterBean; +import com.loglog.api.commons.daos.MsgMasterDao; +@Service +public class MsgMasterServiceImpl implements MsgMasterService { + + @Value("${server.url.img.shop}") + private String URL_IMG_SHOP; + + @Autowired + private MsgMasterDao msgMasterDao; + @Override + public List selectMsgText(MsgMasterBean msgMasterBean) { + msgMasterBean.setBaseImgUrl(URL_IMG_SHOP); + return msgMasterDao.selectMsgText(msgMasterBean); + } + + /**통지 메시지 출력*/ + public List selectNoitMsg(MsgMasterBean msgMasterBean){ + msgMasterBean.setBaseImgUrl(URL_IMG_SHOP); + return msgMasterDao.selectNoitMsg(msgMasterBean); + } + + /**유저 전체 메세지 디테일*/ + public MsgMasterBean selectMsgTextDetail(MsgMasterBean msgMasterBean) { + msgMasterBean.setBaseImgUrl(URL_IMG_SHOP); + return msgMasterDao.selectMsgTextDetail(msgMasterBean); + } + + /**유저 통지 메세지 디테일*/ + public MsgMasterBean selectNoitMsgDetail(MsgMasterBean msgMasterBean) { + return msgMasterDao.selectNoitMsgDetail(msgMasterBean); + } + + /**즐겨찾기한 상점의 메세지리스트*/ + public List selectShopMsgList(MsgMasterBean msgMasterBean)throws Exception{ + msgMasterBean.setBaseImgUrl(URL_IMG_SHOP); + return msgMasterDao.selectShopMsgList(msgMasterBean); + } + + /**즐겨찾기한 상점이 보내준 메세지 상세내용*/ + public List selectShopMsgDetail(MsgMasterBean msgMasterBean)throws Exception{ + msgMasterBean.setBaseImgUrl(URL_IMG_SHOP); + return msgMasterDao.selectShopMsgDetail(msgMasterBean); + } + + /**오시라세 디테일 확인시 seen컬럼 1로 업데이트*/ + public int updateMsgSeen(MsgMasterBean msgMasterBean)throws Exception{ + return msgMasterDao.updateMsgSeen(msgMasterBean); + } + + /**msgType : 1인 메세지의 상세내용*/ + public List selectMegDeltail(MsgMasterBean msgMasterBean)throws Exception{ + msgMasterBean.setBaseImgUrl(URL_IMG_SHOP); + return msgMasterDao.selectMegDeltail(msgMasterBean); + } + + /**유저 읽지 않은 통지 메세지 개수 반환*/ + public MsgMasterBean selectNotReadNotice(MsgMasterBean msgMasterBean)throws Exception{ + return msgMasterDao.selectNotReadNotice(msgMasterBean); + } + + /**유저 읽지 않은 오시라세 메세지 개수 반환*/ + public MsgMasterBean selectNotReadShopMsg(MsgMasterBean msgMasterBean)throws Exception{ + return msgMasterDao.selectNotReadShopMsg(msgMasterBean); + } + + /**통지 상세보기 읽음처리*/ + public int updateNoticSeen(MsgMasterBean msgMasterBean)throws Exception{ + return msgMasterDao.updateNoticSeen(msgMasterBean); + } +} diff --git a/src/main/java/com/loglog/api/commons/modules/service/noti/NotiService.java b/src/main/java/com/loglog/api/commons/modules/service/noti/NotiService.java new file mode 100644 index 0000000..d968596 --- /dev/null +++ b/src/main/java/com/loglog/api/commons/modules/service/noti/NotiService.java @@ -0,0 +1,45 @@ +package com.loglog.api.commons.modules.service.noti; + +import java.util.List; + +import com.loglog.api.commons.beans.NotiAttachBean; +import com.loglog.api.commons.beans.NotiBean; +import com.loglog.api.commons.beans.PagingBean; +import com.loglog.api.commons.interfaces.CommonInterface; + + + +/** + * noti Service + * @author "JIK" + * + */ +public interface NotiService extends CommonInterface { + + /** 공지사항 SelectNotiList */ + List selectNotiList(PagingBean pagingBean) throws Exception; + + /** 공지사항 InsertNoti */ + int insertNoti(NotiBean notiBean, String[] attach_type, String[] attach_file, String[] attach_file_name) throws Exception; + + /** 공지사항 SelectNoti */ + NotiBean selectNoti(NotiBean notiBean) throws Exception; + + /** 공지사항 UpdateNoti */ + int updateNoti(NotiBean notiBean, String[] attach_type, String[] attach_file, String[] attach_file_name) throws Exception; + + /** 공지사항 DeleteNoti */ + int deleteNoti(NotiBean notiBean) throws Exception; + + /** 공지사항 총 수 */ + int notiTotCnt(PagingBean pagingBean) throws Exception; + + /** 공지사항 IndexList */ + List selectNotiIndexList(PagingBean pagingBean) throws Exception; + + /** 공지사항 첨부파일 정보 조회 */ + public List selectNotiAttach(String notiId) throws Exception; + + /** 공지사항 첨부파일 다운로드 정보 조회 */ + public NotiAttachBean selectNotiAttachInfo(String notiAttachId) throws Exception; +} diff --git a/src/main/java/com/loglog/api/commons/modules/service/noti/NotiServiceImpl.java b/src/main/java/com/loglog/api/commons/modules/service/noti/NotiServiceImpl.java new file mode 100644 index 0000000..3b76ba1 --- /dev/null +++ b/src/main/java/com/loglog/api/commons/modules/service/noti/NotiServiceImpl.java @@ -0,0 +1,433 @@ +package com.loglog.api.commons.modules.service.noti; + +import java.io.File; +import java.util.ArrayList; +import java.util.List; + +import org.apache.commons.io.FileUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; + +import com.loglog.api.commons.beans.NotiAttachBean; +import com.loglog.api.commons.beans.NotiBean; +import com.loglog.api.commons.beans.PagingBean; +import com.loglog.api.commons.daos.NotiAttachDao; +import com.loglog.api.commons.daos.NotiDao; + + +/** + * Noti ServiceImpl + * @author "JIK" + * + */ +@Service +public class NotiServiceImpl implements NotiService { + + // 서버 키 + @Value("${server}") + private String SERVER; + // 이미지 서버 URL + private String SERVER_URL_IMG; + + // 사용자 레파지토리 경로 + @Value("${repository.path}") + private String REPOSITORY_PATH; + // 다음 에디터 이미지 임시 폴더 경로 + @Value("${upload.daum.editor.image.temp.path}") + private String UPLOAD_DAUM_EDITOR_IMAGE_TEMP_PATH; + // 노티 이미지 실경로 + @Value("${upload.noti.image.path}") + private String UPLOAD_NOTI_IMAGE_PATH; + // 다음 에디터 파일 임시 폴더 + @Value("${upload.daum.editor.file.temp.path}") + private String UPLOAD_DAUM_EDITOR_FILE_TEMP_PATH; + // 노티 파일 실경로 + @Value("${upload.noti.file.path}") + private String UPLOAD_NOTI_FILE_PATH; + // 판매자 공지사항 다운로드 url 경로 + @Value("${download.url.noti}") + private String DOWNLOAD_URL_NOTI; + + + @Autowired + private NotiDao notiDao; + + @Autowired + private NotiAttachDao notiAttachDao; + + + @Value("${server.url.img.mycard}") + public void setServerUrlImg(String serverUrlImg) { + SERVER_URL_IMG = serverUrlImg; + } + + /** 공지사항 SelectNotiList */ + public List selectNotiList(PagingBean pagingBean) throws Exception { + return notiDao.selectNotiList(pagingBean); + } + + /** 공지사항 InsertNoti */ + public int insertNoti( + NotiBean notiBean, + String[] attach_type, + String[] attach_file, + String[] attach_file_name + ) throws Exception { + // 공지사항 내용 공백제거 + notiBean.setNotiCont(notiBean.getNotiCont().trim()); + + // 공지사항 등록 + notiDao.insertNoti(notiBean); + + // 공지사항 첨부파일 정보 담을 빈 생성 + NotiAttachBean notiAttachBean = new NotiAttachBean(); + + // 삭제 할 템프파일 리스트 + List deleteFileList = new ArrayList(); + + // 첨부파일 정보 등록 + if(attach_file != null){ + for(int i = 0; i < attach_file.length; i++){ + // 파일 일때 + if(attach_type[i].equals("F")){ + // 템프 파일 + File notiFileTempFile = new File(REPOSITORY_PATH + attach_file[i].replace(SERVER_URL_IMG, "")); + // 실경로 + String notiFilePath = UPLOAD_NOTI_FILE_PATH + "/" + notiBean.getNotiId() + "/" + notiFileTempFile.getName(); + // 실경로 파일 + File notiFileFile = new File(REPOSITORY_PATH + notiFilePath); + + // 템프에서 실경로로 파일 복사 + FileUtils.copyFile(notiFileTempFile, notiFileFile); + + // 템프에서 실경로로 옮겼을시 공지사항 첨부파일 정보 등록 + notiAttachBean.setNotiId(notiBean.getNotiId()); + notiAttachBean.setOrd(String.valueOf(i+1)); + notiAttachBean.setFileType(attach_type[i]); + notiAttachBean.setFileName(attach_file_name[i]); + notiAttachBean.setFilePath(notiFilePath); + notiAttachBean.setFileSize(Long.toString(notiFileTempFile.length())); + notiAttachDao.insertNotiAttach(notiAttachBean); + + notiBean.setNotiCont(notiBean.getNotiCont().replace(attach_file[i], DOWNLOAD_URL_NOTI+notiAttachBean.getNotiAttachId())); + + +// http://localhost/up_imgs/daum_editor_temp/20160215/561b3b59-4269-49b2-98fe-025134c2a67a.gif +// http://localhost/up_imgs/noti/68/561b3b59-4269-49b2-98fe-025134c2a67a.gif + + // 복사한 템프파일 삭제 목록에 추가 + deleteFileList.add(notiFileTempFile); + + // 이미지 업로드 일때 + }else{ + // 템프 파일 + File notiImgTempFile = new File(REPOSITORY_PATH + attach_file[i].replace(SERVER_URL_IMG, "")); + // 실경로 + String notiImgPath = UPLOAD_NOTI_IMAGE_PATH + "/" + notiBean.getNotiId() + "/" + notiImgTempFile.getName(); + // 실경로 파일 + File notiImgFile = new File(REPOSITORY_PATH + notiImgPath); + + // 템프에서 실경로로 파일 복사 + FileUtils.copyFile(notiImgTempFile, notiImgFile); + + // 템프에서 실경로로 옮겼을시 공지사항 첨부이미지 정보 등록 + notiAttachBean.setNotiId(notiBean.getNotiId()); + notiAttachBean.setOrd(String.valueOf(i+1)); + notiAttachBean.setFileType(attach_type[i]); + notiAttachBean.setFileName(attach_file_name[i]); + notiAttachBean.setFilePath(notiImgPath); + notiAttachBean.setFileSize(Long.toString(notiImgTempFile.length())); + notiAttachDao.insertNotiAttach(notiAttachBean); + + notiBean.setNotiCont(notiBean.getNotiCont().replace(attach_file[i], notiImgPath)); + +// http://localhost/up_imgs/daum_editor_temp/20160215/561b3b59-4269-49b2-98fe-025134c2a67a.gif +// http://localhost/up_imgs/noti/68/561b3b59-4269-49b2-98fe-025134c2a67a.gif + + // 복사한 템프파일 삭제 목록에 추가 + deleteFileList.add(notiImgTempFile); + + + + } + }// end for + }// end if + + if(attach_file != null){ + // 실경로로 내용 업데이트 + notiDao.updateNoti(notiBean); + + // 템프 파일 삭제 + for ( File deleteFile : deleteFileList ){ + try { + deleteFile.delete(); + } catch ( Exception e ){ + e.getMessage(); + } + } + }// end if + return Integer.parseInt( notiBean.getNotiId() ); + } + + /** 공지사항 SelectNoti */ + public NotiBean selectNoti(NotiBean notiBean) throws Exception { + notiBean = notiDao.selectNoti(notiBean); + // 조회수 올리기 + notiDao.updateHit(notiBean); + return notiBean; + } + + /** 공지사항 UpdateNoti */ + public int updateNoti( + NotiBean notiBean, + String[] attach_type, + String[] attach_file, + String[] attach_file_name + ) throws Exception { + + // 수정 전 첨부파일 정보 리스트 + List beforeNotiAttachList = new ArrayList(); + // 추가 할 첨부파일 정보 리스트 + List addNotiAttachList = new ArrayList(); + // 지워야 할 첨부파일 정보 리스트 + List deleteNotiAttachList = new ArrayList(); + // 첨부된 파일 있을 경우 빈생성 + NotiAttachBean notiAttachBean = new NotiAttachBean(); + // 추가인지 지워야할 것인지 비교값 + Boolean compare = true; + // 추가된게 있을시 ord 마지막값 이어가기 위한 값 + int lastOrd = 0; + + // 공지사항 내용 공백제거 + notiBean.setNotiCont(notiBean.getNotiCont().trim()); + + // 전에 있던 첨부파일 목록 조회 + beforeNotiAttachList = notiAttachDao.selectNotiAttach(notiBean.getNotiId(), SERVER_URL_IMG); + + // 전에 첨부파일 있을 경우만 ord 제일 높은수 넣어줌 + if(!beforeNotiAttachList.isEmpty()){ + lastOrd = Integer.parseInt(beforeNotiAttachList.get(beforeNotiAttachList.size()-1).getOrd()); + } + // 삭제 할 템프파일 리스트 + List deleteFileList = new ArrayList(); + + // 바뀐 이미지나 파일 있을 때 + if(attach_file != null && !beforeNotiAttachList.isEmpty()){ + // 추가 할 첨부파일 찾기 + for (int i = 0; i < attach_type.length; i++) { + for (int j = 0; j < beforeNotiAttachList.size(); j++) { + // 끝자리 첨부파일 고유번호로 비교 같지 않은 것만 추가리스트에 추가 (새로 추가된건 url이 아예 달라서 바로 무시하고 추가됨) + if(attach_type[i].equals("F")){ + if(attach_file[i].substring(attach_file[i].lastIndexOf("=")+1).equals(beforeNotiAttachList.get(j).getNotiAttachId())){ + // 같은값이 있으면 compare값 false 줘서 추가안하기 + compare = false; + } + // 이미지 업로드는 파일이름으로 비교 + }else{ + if(attach_file[i].substring(attach_file[i].lastIndexOf("/")+1).equals( + beforeNotiAttachList.get(j).getFilePath().substring(beforeNotiAttachList.get(j).getFilePath().lastIndexOf("/")+1))){ + // 같은값이 있으면 compare값 false 줘서 추가안하기 + compare = false; + } + }// end if + }// end for + + // 추가된 첨부파일 addAttachList에 담기 + if(compare){ + // 추가 할 첨부파일 정보 + NotiAttachBean addNotiAttachBean = new NotiAttachBean(); + addNotiAttachBean.setFileName(attach_file_name[i]); + addNotiAttachBean.setFilePath(attach_file[i]); + addNotiAttachBean.setFileType(attach_type[i]); + addNotiAttachList.add(addNotiAttachBean); + } + + // 값이 있어서 false로 바뀌었을시 다시 true로 초기화 + compare = true; + + }// end for + + // 삭제 할 첨부파일 찾기 + for (int i = 0; i < beforeNotiAttachList.size(); i++) { + for (int j = 0; j < attach_type.length; j++) { + + // 끝자리 첨부파일 고유번호로 비교 같지 않은 것만 삭제 리스트에 추가 + if(beforeNotiAttachList.get(i).getFileType().equals("F")){ + if(attach_file[j].substring(attach_file[j].lastIndexOf("=")+1).equals(beforeNotiAttachList.get(i).getNotiAttachId())){ + // 같은값이 있으면 compare값 false 줘서 추가안하기 + compare = false; + } + // 이미지 업로드는 파일이름으로 비교 + }else{ + if(attach_file[j].substring(attach_file[j].lastIndexOf("/")+1).equals( + beforeNotiAttachList.get(i).getFilePath().replace(UPLOAD_NOTI_IMAGE_PATH+"/"+notiBean.getNotiId()+"/", ""))){ + // 같은값이 있으면 compare값 false 줘서 추가안하기 + compare = false; + } + }// end if + }// end for + + // 삭제된 첨부파일 deleteAttachList에 담기 + if(compare){ + // 추가 할 첨부파일 정보 + NotiAttachBean addNotiAttachBean = new NotiAttachBean(); + addNotiAttachBean.setNotiAttachId(beforeNotiAttachList.get(i).getNotiAttachId()); + addNotiAttachBean.setFileName(beforeNotiAttachList.get(i).getFileName()); + addNotiAttachBean.setFilePath(beforeNotiAttachList.get(i).getFilePath()); + addNotiAttachBean.setFileType(beforeNotiAttachList.get(i).getFileType()); + deleteNotiAttachList.add(addNotiAttachBean); + } + + // 값이 있어서 false로 바뀌었을시 다시 true로 초기화 + compare = true; + + }// end for + + // 첨부파일 모두 삭제했을 경우 + } else if(attach_file == null && !beforeNotiAttachList.isEmpty()){ + deleteNotiAttachList = beforeNotiAttachList; + + // 있던 것은 없었는데 추가했을 경우 + } else if(attach_file != null && beforeNotiAttachList.isEmpty()){ + for (int i = 0; i < attach_file.length; i++) { + // 추가 할 첨부파일 정보 + NotiAttachBean addNotiAttachBean = new NotiAttachBean(); + addNotiAttachBean.setFileName(attach_file_name[i]); + addNotiAttachBean.setFilePath(attach_file[i]); + addNotiAttachBean.setFileType(attach_type[i]); + addNotiAttachList.add(addNotiAttachBean); + } + }// end if(첨부파일 비교) + + + // 추가 된 이미지, 파일 추가하기 + if(!addNotiAttachList.isEmpty()){ + for(int i = 0; i < addNotiAttachList.size(); i++){ + // 첨부된 파일 + if(addNotiAttachList.get(i).getFileType().equals("F")){ + // 템프 파일 + File notiFileTempFile = new File(REPOSITORY_PATH + addNotiAttachList.get(i).getFilePath().replace(SERVER_URL_IMG, "")); + // 실경로 + String notiFilePath = UPLOAD_NOTI_FILE_PATH + "/" + notiBean.getNotiId() + "/" + notiFileTempFile.getName(); + // 실경로 파일 + File notiFileFile = new File(REPOSITORY_PATH + notiFilePath); + + // 템프에서 실경로로 파일 복사 + FileUtils.copyFile(notiFileTempFile, notiFileFile); + + // 템프에서 실경로로 옮겼을시 공지사항 첨부파일 정보 등록 + notiAttachBean.setNotiId(notiBean.getNotiId()); + notiAttachBean.setOrd(String.valueOf(i+1+lastOrd)); + notiAttachBean.setFileType(addNotiAttachList.get(i).getFileType()); + notiAttachBean.setFileName(addNotiAttachList.get(i).getFileName()); + notiAttachBean.setFilePath(notiFilePath); + notiAttachBean.setFileSize(Long.toString(notiFileTempFile.length())); + notiAttachDao.insertNotiAttach(notiAttachBean); + + notiBean.setNotiCont(notiBean.getNotiCont().replace(addNotiAttachList.get(i).getFilePath(), DOWNLOAD_URL_NOTI+notiAttachBean.getNotiAttachId())); + + +// http://localhost/up_imgs/daum_editor_temp/20160215/561b3b59-4269-49b2-98fe-025134c2a67a.gif +// http://localhost/up_imgs/noti/68/561b3b59-4269-49b2-98fe-025134c2a67a.gif + + // 복사한 템프파일 삭제 목록에 추가 + deleteFileList.add(notiFileTempFile); + + } else {// 첨부된 이미지 업로드 + // 템프 파일 + File notiImgTempFile = new File(REPOSITORY_PATH + addNotiAttachList.get(i).getFilePath().replace(SERVER_URL_IMG, "")); + // 실경로 + String notiImgPath = UPLOAD_NOTI_IMAGE_PATH + "/" + notiBean.getNotiId() + "/" + notiImgTempFile.getName(); + // 실경로 파일 + File notiImgFile = new File(REPOSITORY_PATH + notiImgPath); + + // 템프에서 실경로로 파일 복사 + FileUtils.copyFile(notiImgTempFile, notiImgFile); + + // 템프에서 실경로로 옮겼을시 공지사항 첨부이미지 정보 등록 + notiAttachBean.setNotiId(notiBean.getNotiId()); + notiAttachBean.setOrd(String.valueOf(i+1+lastOrd)); + notiAttachBean.setFileType(addNotiAttachList.get(i).getFileType()); + notiAttachBean.setFileName(addNotiAttachList.get(i).getFileName()); + notiAttachBean.setFilePath(notiImgPath); + notiAttachBean.setFileSize(Long.toString(notiImgTempFile.length())); + notiAttachDao.insertNotiAttach(notiAttachBean); + + notiBean.setNotiCont(notiBean.getNotiCont().replace(addNotiAttachList.get(i).getFilePath(), notiImgPath)); + +// http://localhost/up_imgs/daum_editor_temp/20160215/561b3b59-4269-49b2-98fe-025134c2a67a.gif +// http://localhost/up_imgs/noti/68/561b3b59-4269-49b2-98fe-025134c2a67a.gif + + // 복사한 템프파일 삭제 목록에 추가 + deleteFileList.add(notiImgTempFile); + }// end if(이미지인지 파일인지 구분) + }// end for + }// end if + + // 삭제할 파일이 있다면 삭제 목록에 추가하고 DB에서 삭제하기 + if(!deleteNotiAttachList.isEmpty()){ + for (int i = 0; i < deleteNotiAttachList.size(); i++) { + // 실경로 파일 + File notiFileFile = new File(REPOSITORY_PATH + deleteNotiAttachList.get(i).getFilePath()); + // 삭제 목록에 추가 + deleteFileList.add(notiFileFile); + notiAttachDao.deleteNotiAttach(deleteNotiAttachList.get(i).getNotiAttachId()); + } + } + + // 템프, 수정된 파일 삭제 + if(!deleteFileList.isEmpty()){ + for ( File deleteFile : deleteFileList ){ + try { + deleteFile.delete(); + } catch ( Exception e ){ + e.getMessage(); + } + } + } + return notiDao.updateNoti(notiBean); + } + + /** 공지사항 DeleteNoti */ + public int deleteNoti(NotiBean notiBean) throws Exception { + + // 삭제 할 첨부파일 정보 리스트 + List deleteNotiAttachList = new ArrayList(); + // 삭제 할 첨부파일 정보 조회 + deleteNotiAttachList = notiAttachDao.selectNotiAttach(notiBean.getNotiId(), SERVER_URL_IMG); + + // 삭제할 파일이 있다면 삭제하고 DB에서 삭제하기 + if(!deleteNotiAttachList.isEmpty()){ + for (int i = 0; i < deleteNotiAttachList.size(); i++) { + // 파일 + File notiFileFile = new File(REPOSITORY_PATH + deleteNotiAttachList.get(i).getFilePath()); + // 파일 삭제 + notiFileFile.delete(); + notiAttachDao.deleteNotiAttach(deleteNotiAttachList.get(i).getNotiAttachId()); + } + } + + return notiDao.deleteNoti(notiBean); + } + + /** 공지사항 총 수 */ + public int notiTotCnt(PagingBean pagingBean) throws Exception { + return notiDao.notiTotCnt(pagingBean); + } + + /** 공지사항 IndexList */ + public List selectNotiIndexList(PagingBean pagingBean) throws Exception { + return notiDao.selectNotiIndexList(pagingBean); + } + + /** 공지사항 첨부파일 정보 조회 */ + public List selectNotiAttach(String notiId) throws Exception { + return notiAttachDao.selectNotiAttach(notiId, SERVER_URL_IMG); + } + + /** 공지사항 첨부파일 다운로드 정보 조회 */ + public NotiAttachBean selectNotiAttachInfo(String notiAttachId) { + return notiAttachDao.selectNotiAttachInfo(notiAttachId); + } +} diff --git a/src/main/java/com/loglog/api/commons/modules/service/shop/ShopMasterService.java b/src/main/java/com/loglog/api/commons/modules/service/shop/ShopMasterService.java new file mode 100644 index 0000000..fc90380 --- /dev/null +++ b/src/main/java/com/loglog/api/commons/modules/service/shop/ShopMasterService.java @@ -0,0 +1,44 @@ +package com.loglog.api.commons.modules.service.shop; + +import java.util.List; +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; + +import com.loglog.api.commons.beans.PagingBean; +import com.loglog.api.commons.beans.ShopDetailBean; +import com.loglog.api.commons.beans.ShopMasterBean; +import com.loglog.api.commons.beans.UserBean; +import com.loglog.api.commons.beans.CardMasterBean; +import com.loglog.api.commons.beans.CouponPublicBean; +import com.loglog.api.commons.beans.CouponUserListBean; + +public interface ShopMasterService { + + /**상점 상세정보*/ + public ShopDetailBean selectShopDetail(ShopDetailBean shopDetailBean) throws Exception; + + /**유저 주위의 상점 리스트 출력*/ + public List selectProxShopList(ShopMasterBean shopMasterBean)throws Exception; + + /**room 생성하기 전 중복체크*/ + public int selectCheckRoom(ShopMasterBean shopMasterBean)throws Exception; + + /**상점 즐겨찾기*/ + public int insertLikeShop(ShopMasterBean shopMasterBean)throws Exception; + + /**상점 즐겨찾기 - tempo_liked 추가*/ + public int insertLikeTempo(ShopMasterBean shopMasterBean)throws Exception; + + /**상점 즐겨찾기 취소*/ + public int calcelLikeShop(ShopMasterBean shopMasterBean)throws Exception; + + /**상점 즐겨찾기 취소 - tempo_liked*/ + public int deleteLikeTempo(ShopMasterBean shopMasterBean)throws Exception; + + /**즐겨찾기한 상점 리스트 출력*/ + public List selectShopList(ShopDetailBean shopDetailBean)throws Exception; + + /**상점이름으로 검색 출력 리스트*/ + public List selectSearchShopList(ShopDetailBean shopDetailBean)throws Exception; +} diff --git a/src/main/java/com/loglog/api/commons/modules/service/shop/ShopMasterServiceImpl.java b/src/main/java/com/loglog/api/commons/modules/service/shop/ShopMasterServiceImpl.java new file mode 100644 index 0000000..9fddb78 --- /dev/null +++ b/src/main/java/com/loglog/api/commons/modules/service/shop/ShopMasterServiceImpl.java @@ -0,0 +1,73 @@ +package com.loglog.api.commons.modules.service.shop; + +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; + +import com.loglog.api.commons.beans.ShopDetailBean; +import com.loglog.api.commons.beans.ShopMasterBean; +import com.loglog.api.commons.daos.CardMasterDao; +import com.loglog.api.commons.daos.ShopMasterDao; + +@Service +public class ShopMasterServiceImpl implements ShopMasterService { + + @Value("${server.url.img.shop}") + private String URL_IMG_SHOP; + + @Autowired + private ShopMasterDao shopMasterDao; + + @Override + public ShopDetailBean selectShopDetail(ShopDetailBean shopDetailBean) throws Exception { + // TODO Auto-generated method stub + shopDetailBean.setBaseImgUrl(URL_IMG_SHOP); + return shopMasterDao.selectShopDetail(shopDetailBean) ; + } + + /**유저 주위의 상점 리스트 출력*/ + public List selectProxShopList(ShopMasterBean shopMasterBean)throws Exception{ + shopMasterBean.setBaseImgUrl(URL_IMG_SHOP); + return shopMasterDao.selectProxShopList(shopMasterBean) ; + } + + /**room 생성하기 전 중복체크*/ + public int selectCheckRoom(ShopMasterBean shopMasterBean)throws Exception{ + return shopMasterDao.selectCheckRoom(shopMasterBean); + } + + /**상점 즐겨찾기*/ + public int insertLikeShop(ShopMasterBean shopMasterBean)throws Exception{ + return shopMasterDao.insertLikeShop(shopMasterBean); + } + + /**상점 즐겨찾기 - tempo_liked 추가*/ + public int insertLikeTempo(ShopMasterBean shopMasterBean)throws Exception{ + return shopMasterDao.insertLikeTempo(shopMasterBean); + } + + /**상점 즐겨찾기 취소*/ + public int calcelLikeShop(ShopMasterBean shopMasterBean)throws Exception{ + return shopMasterDao.calcelLikeShop(shopMasterBean); + } + + /**상점 즐겨찾기 취소 - tempo_liked*/ + public int deleteLikeTempo(ShopMasterBean shopMasterBean)throws Exception{ + return shopMasterDao.deleteLikeTempo(shopMasterBean); + } + + /**즐겨찾기한 상점 리스트 출력*/ + public List selectShopList(ShopDetailBean shopDetailBean)throws Exception{ + shopDetailBean.setBaseImgUrl(URL_IMG_SHOP); + return shopMasterDao.selectShopList(shopDetailBean) ; + } + + /**상점이름으로 검색 출력 리스트*/ + public List selectSearchShopList(ShopDetailBean shopDetailBean)throws Exception{ + shopDetailBean.setBaseImgUrl(URL_IMG_SHOP); + return shopMasterDao.selectSearchShopList(shopDetailBean); + } + +} diff --git a/src/main/java/com/loglog/api/commons/modules/service/user/UserService.java b/src/main/java/com/loglog/api/commons/modules/service/user/UserService.java new file mode 100644 index 0000000..57b0821 --- /dev/null +++ b/src/main/java/com/loglog/api/commons/modules/service/user/UserService.java @@ -0,0 +1,125 @@ +package com.loglog.api.commons.modules.service.user; + +import java.util.List; +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; + +import com.loglog.api.commons.beans.PagingBean; +import com.loglog.api.commons.beans.UserBean; + +public interface UserService { + /**회원가입*/ + public int insertUser(UserBean userBean) throws Exception; + + /** UserCd값 가져오기 */ + public String selectUserCdStr(UserBean userBean) throws Exception; + + /**아이디 중복체크 */ + public int chkUserId(UserBean userBean) throws Exception; + + /**닉네임 중복체크 */ + public int chkNickName(UserBean userBean) throws Exception; + + /**userCd 조회 */ + public int selectUserCd(UserBean userBean) throws Exception; + + /**로그인한 회원 정보 찾기 */ + public UserBean selectUser(UserBean userBean) throws Exception; + + /**로그인한 회원 정보 찾기 */ + public UserBean selectUserDetail(UserBean userBean) throws Exception; + + /** 세션쿠키로 로그인한 회원 정보 찾기 */ + public UserBean selectUserBySessionId(HttpServletRequest request) throws Exception; + + /**세션아이디로 로그인한 회원 정보 찾기 */ + public UserBean selectUserBySessionId(String sessionId) throws Exception; + + /** 이전 세션쿠키로 로그인한 회원 확인 */ + public UserBean selectUserByBeforeSessionId(HttpServletRequest request) throws Exception; + + /** ID와 PW가 일치하는 회원 정보 찾기 */ + public UserBean selectUserPW(UserBean userBean) throws Exception; + + /**아이디 찾기 - JSON */ + public String findUserId(UserBean userBean) throws Exception; + + /**이메일 체크 - JSON */ + public String findUserEmail(UserBean userBean) throws Exception; + + /**회원 비밀번호 찾을시 해당 정보 회원있는지 확인*/ + public int findUser(UserBean userBean) throws Exception; + + /**db에 새 비밀번호 세팅*/ + public String updateUserPw(UserBean userBean, HttpServletRequest request) throws Exception; + + /**최종 로그인 일자 update*/ + public int updLastLoginDt(UserBean userBean) throws Exception; + + /**회원 정보 수정*/ + public int updateUser(UserBean userBean) throws Exception; + + /**사용자가 입력한 비밀번호로 업데이트*/ + public void updEnterdPw(HttpServletRequest request, String newEncodePw) throws Exception; + + /**회원 계좌 정보 수정*/ + public int updateAccount(UserBean userBean) throws Exception; + + /**사용자가 입력한 인출 비밀번호로 업데이트*/ + public void updEnteredAccountPw(HttpServletRequest request, String newEncodePw) throws Exception; + + /**user table에 네이버 아이디 있는지 확인*/ + public int searchNaverIdInUserTable(UserBean userBean) throws Exception; + + /**사용자 총 수 */ + public int userTotCnt(PagingBean pagingBean) throws Exception; + + /**사용자 목록 조회*/ + public List selectUserList(Map parameter) throws Exception; + + /**사용자 목록 조회*/ + public List selectUserList(PagingBean pagingBean) throws Exception; + + /** 사용자 상태 변경(정지 or 정상) */ + public int updateUserStatusCd(UserBean userBean) throws Exception; + + /**푸시알림, 자동로그인 설정값 변경*/ + public int updateUserSetting(UserBean userBean) throws Exception; + + /**사용자 답변 확인*/ + public int userAnswerChk(UserBean userBean) throws Exception; + + /**회원 탈퇴*/ + public int deleteUser(UserBean userBean) throws Exception; + + /**회원 비밀번호 찾을시 해당 정보 회원있는지 확인 (이름 -> 이메일로 대체)*/ + public int findUserL(UserBean userBean) throws Exception; + + /**db에 새 비밀번호 세팅 ( 이름 -> 이메일로 대체)*/ + public String updateUserPwL(UserBean userBean, HttpServletRequest request) throws Exception; + + /** 사용자 목록 조회 정보 개수*/ + public int countUserList(PagingBean pagingBean) throws Exception; + + /** 회원 등급 수정 */ + public void updateUserLevel(Map parameter) throws Exception; + + /** 회원 탈퇴 */ + public UserBean userDelete(UserBean userBean) throws Exception; + + /** 회원 이름 조회 */ + public UserBean userName(UserBean userBean) throws Exception; + + /**QR 로그인*/ + public UserBean qRLogin(UserBean userBean)throws Exception; + + /**비밀번호 수정 - 이메일을 모르고 UserCd를 아는 경우*/ + public int selectKnowUserCd(UserBean userBean)throws Exception; + + /** 사용자 이메일이 있는지 확인*/ + public int selectCheckEmail(UserBean userBean)throws Exception; + + /**이메일로 임시비밀번호를 보내면 비밀번호 업데이트*/ + public int updatetempPw(UserBean userBean)throws Exception; +} diff --git a/src/main/java/com/loglog/api/commons/modules/service/user/UserServiceImpl.java b/src/main/java/com/loglog/api/commons/modules/service/user/UserServiceImpl.java new file mode 100644 index 0000000..8e7c25a --- /dev/null +++ b/src/main/java/com/loglog/api/commons/modules/service/user/UserServiceImpl.java @@ -0,0 +1,249 @@ +package com.loglog.api.commons.modules.service.user; + +import java.util.List; +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import com.loglog.api.commons.beans.PagingBean; +import com.loglog.api.commons.beans.UserBean; +import com.loglog.api.commons.daos.UserDao; +import com.loglog.api.commons.utils.CommonUtils; +import com.loglog.api.commons.utils.SessionUtil; + + +@Service +public class UserServiceImpl implements UserService { + + @Autowired + private UserDao userDao; + + /** 회원가입 */ + public int insertUser(UserBean userBean) throws Exception { + return userDao.insertUser(userBean); + } + + /**아이디 찾기 - JSON */ + public String selectUserCdStr(UserBean userBean) throws Exception { + return userDao.selectUserCdStr(userBean); + } + + /**아이디 중복 체크*/ + public int chkUserId(UserBean userBean) throws Exception { + return userDao.chkUserId(userBean); + } + + /**닉네임 중복체크*/ + public int selectUserCd(UserBean userBean) throws Exception { + return userDao.selectUserCd(userBean); + } + + /**닉네임 중복체크*/ + public int chkNickName(UserBean userBean) throws Exception { + return userDao.chkNickName(userBean); + } + + /**로그인한 회원 정보 찾기 */ + public UserBean selectUser(UserBean userBean) throws Exception { + return userDao.selectUser(userBean); + } + + /**로그인한 회원 정보 찾기 */ + public UserBean selectUserDetail(UserBean userBean) throws Exception { + return userDao.selectUserDetail(userBean); + } + + /**로그인한 회원 정보 찾기 */ + public UserBean selectUserBySessionId(HttpServletRequest request) throws Exception { + String sessionId = request.getHeader("Authorization"); + System.out.println("check Authorization :: " + sessionId); + return userDao.selectUserBySessionId(sessionId); + } + + /** 세션쿠키로 로그인한 회원 정보 찾기 */ + public UserBean selectUserBySessionId(String sessionId) throws Exception { + return userDao.selectUserBySessionId(sessionId); + } + + /**로그인한 회원 정보 찾기 */ + public UserBean selectUserByBeforeSessionId(HttpServletRequest request) throws Exception { + String sessionId = request.getHeader("Authorization"); + System.out.println("check Authorization :: " + sessionId); + return userDao.selectUserByBeforeSessionId(sessionId); + } + + /** ID와 PW가 일치하는 회원 정보 찾기 */ + public UserBean selectUserPW(UserBean userBean) throws Exception { + return userDao.selectUserPW(userBean); + } + + /**아이디 찾기 - JSON */ + public String findUserId(UserBean userBean) throws Exception { + return userDao.findUserId(userBean); + } + + /**회원 비밀번호 찾을시 해당 정보 회원있는지 확인*/ + public int findUser(UserBean userBean) throws Exception { + return userDao.findUser(userBean); + } + + /**db에 새 비밀번호 세팅*/ + public String updateUserPw(UserBean userBean, HttpServletRequest request) throws Exception { + //있다면 db에 넣을 새로운 비밀번호 10자 만들기 + String newPw = CommonUtils.random(10); + + //만든 비밀번호를 암호화 + String encodingPw = CommonUtils.encode(newPw); + + //db에 새 비밀번호 세팅 + userBean.setUserPw(encodingPw); + + userDao.updateUserPw(userBean); + + return newPw; + } + + /**최종 로그인 일자 update*/ + public int updLastLoginDt(UserBean userBean) throws Exception { + return userDao.updLastLoginDt(userBean); + } + + /**회원 정보 수정*/ + public int updateUser(UserBean userBean) throws Exception { + return userDao.updateUser(userBean); + } + + /**사용자가 입력한 비밀번호로 업데이트*/ + public void updEnterdPw(HttpServletRequest request, String newEncodePw) throws Exception { + + UserBean userBean = new UserBean(); + + userBean = SessionUtil.getUserBean(request); + + userBean.setUserPw(newEncodePw); + + userDao.updateUserPw(userBean); + } + + /**회원 계좌 정보 수정*/ + public int updateAccount(UserBean userBean) throws Exception { + return userDao.updateAccount(userBean); + } + + + /**user table에 네이버 아이디 있는지 확인*/ + public int searchNaverIdInUserTable(UserBean userBean) throws Exception { + return userDao.searchNaverIdInUserTable(userBean); + } + + /**사용자 총 수*/ + public int userTotCnt(PagingBean pagingBean) throws Exception { + return userDao.userTotCnt(pagingBean); + } + + /**사용자 목록 조회*/ + public List selectUserList(Map parameter) throws Exception { + return userDao.selectUserList(parameter); + } + + /**사용자 목록 조회*/ + public List selectUserList(PagingBean pagingBean) throws Exception { + return userDao.selectUserListByPagingBean(pagingBean); + } + + /**사용자 상태 변경*/ + public int updateUserStatusCd(UserBean userBean) throws Exception { + return userDao.updateUserStatusCd(userBean); + } + + + /**푸시알림, 자동로그인 설정값 변경*/ + public int updateUserSetting(UserBean userBean) throws Exception { + return userDao.updateUserSetting(userBean); + } + + /**사용자 답변 확인*/ + public int userAnswerChk(UserBean userBean) throws Exception { + return userDao.userAnswerChk(userBean); + } + + /** 회원탈퇴 */ + public int deleteUser(UserBean userBean) throws Exception { + return userDao.deleteUser(userBean); + } + + /**회원 비밀번호 찾을시 해당 정보 회원있는지 확인 -> (이름 -> 이메일로 대체)*/ + public int findUserL(UserBean userBean) throws Exception { + return userDao.findUserL(userBean); + } + + /**db에 새 비밀번호 세팅 ( 이름 -> 이메일로 대체)*/ + public String updateUserPwL(UserBean userBean, HttpServletRequest request) throws Exception { + //있다면 db에 넣을 새로운 비밀번호 10자 만들기 + String newPw = CommonUtils.random(10); + + //만든 비밀번호를 암호화 + String encodingPw = CommonUtils.encode(newPw); + + //db에 새 비밀번호 세팅 + userBean.setUserPw(encodingPw); + + userDao.updateUserPwL(userBean); + + return newPw; + } + + /**이메일 체크 - JSON */ + public String findUserEmail(UserBean userBean) throws Exception { + return userDao.findUserEmail(userBean); + } + + /** 사용자 목록 조회 정보 개수*/ + public int countUserList(PagingBean pagingBean) throws Exception { + return userDao.countUserList(pagingBean); + } + + /** 회원 등급 수정 */ + public void updateUserLevel(Map parameter) throws Exception { + userDao.updateUserLevel(parameter); + } + + @Override + public void updEnteredAccountPw(HttpServletRequest request, String newEncodePw) throws Exception { + // TODO Auto-generated method stub + + } + + @Override + public UserBean userDelete(UserBean userBean) throws Exception { + return userDao.userDelete(userBean); + } + + @Override + public UserBean userName(UserBean userBean) throws Exception { + return userDao.userName(userBean); + } + + /**QR 로그인*/ + public UserBean qRLogin(UserBean userBean)throws Exception{ + return userDao.qRLogin(userBean); + } + + /**비밀번호 수정 - 이메일을 모르고 UserCd를 아는 경우*/ + public int selectKnowUserCd(UserBean userBean)throws Exception{ + return userDao.selectKnowUserCd(userBean); + } + + /** 사용자 이메일이 있는지 확인*/ + public int selectCheckEmail(UserBean userBean)throws Exception{ + return userDao.selectCheckEmail(userBean); + } + + /**이메일로 임시비밀번호를 보내면 비밀번호 업데이트*/ + public int updatetempPw(UserBean userBean)throws Exception{ + return userDao.updatetempPw(userBean); + } +} diff --git a/src/main/java/com/loglog/api/commons/utils/BCrypt.java b/src/main/java/com/loglog/api/commons/utils/BCrypt.java new file mode 100644 index 0000000..6733630 --- /dev/null +++ b/src/main/java/com/loglog/api/commons/utils/BCrypt.java @@ -0,0 +1,752 @@ +package com.loglog.api.commons.utils; + +// Copyright (c) 2006 Damien Miller +// +// Permission to use, copy, modify, and distribute this software for any +// purpose with or without fee is hereby granted, provided that the above +// copyright notice and this permission notice appear in all copies. +// +// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +import java.io.UnsupportedEncodingException; + +import java.security.SecureRandom; + +/** + * BCrypt implements OpenBSD-style Blowfish password hashing using + * the scheme described in "A Future-Adaptable Password Scheme" by + * Niels Provos and David Mazieres. + *

+ * This password hashing system tries to thwart off-line password + * cracking using a computationally-intensive hashing algorithm, + * based on Bruce Schneier's Blowfish cipher. The work factor of + * the algorithm is parameterised, so it can be increased as + * computers get faster. + *

+ * Usage is really simple. To hash a password for the first time, + * call the hashpw method with a random salt, like this: + *

+ * + * String pw_hash = BCrypt.hashpw(plain_password, BCrypt.gensalt());
+ *
+ *

+ * To check whether a plaintext password matches one that has been + * hashed previously, use the checkpw method: + *

+ * + * if (BCrypt.checkpw(candidate_password, stored_hash))
+ *     System.out.println("It matches");
+ * else
+ *     System.out.println("It does not match");
+ *
+ *

+ * The gensalt() method takes an optional parameter (log_rounds) + * that determines the computational complexity of the hashing: + *

+ * + * String strong_salt = BCrypt.gensalt(10)
+ * String stronger_salt = BCrypt.gensalt(12)
+ *
+ *

+ * The amount of work increases exponentially (2**log_rounds), so + * each increment is twice as much work. The default log_rounds is + * 10, and the valid range is 4 to 31. + * + * @author Damien Miller + * @version 0.2 + */ +public class BCrypt { + // BCrypt parameters + private static final int GENSALT_DEFAULT_LOG2_ROUNDS = 10; + private static final int BCRYPT_SALT_LEN = 16; + + // Blowfish parameters + private static final int BLOWFISH_NUM_ROUNDS = 16; + + // Initial contents of key schedule + private static final int P_orig[] = { + 0x243f6a88, 0x85a308d3, 0x13198a2e, 0x03707344, + 0xa4093822, 0x299f31d0, 0x082efa98, 0xec4e6c89, + 0x452821e6, 0x38d01377, 0xbe5466cf, 0x34e90c6c, + 0xc0ac29b7, 0xc97c50dd, 0x3f84d5b5, 0xb5470917, + 0x9216d5d9, 0x8979fb1b + }; + private static final int S_orig[] = { + 0xd1310ba6, 0x98dfb5ac, 0x2ffd72db, 0xd01adfb7, + 0xb8e1afed, 0x6a267e96, 0xba7c9045, 0xf12c7f99, + 0x24a19947, 0xb3916cf7, 0x0801f2e2, 0x858efc16, + 0x636920d8, 0x71574e69, 0xa458fea3, 0xf4933d7e, + 0x0d95748f, 0x728eb658, 0x718bcd58, 0x82154aee, + 0x7b54a41d, 0xc25a59b5, 0x9c30d539, 0x2af26013, + 0xc5d1b023, 0x286085f0, 0xca417918, 0xb8db38ef, + 0x8e79dcb0, 0x603a180e, 0x6c9e0e8b, 0xb01e8a3e, + 0xd71577c1, 0xbd314b27, 0x78af2fda, 0x55605c60, + 0xe65525f3, 0xaa55ab94, 0x57489862, 0x63e81440, + 0x55ca396a, 0x2aab10b6, 0xb4cc5c34, 0x1141e8ce, + 0xa15486af, 0x7c72e993, 0xb3ee1411, 0x636fbc2a, + 0x2ba9c55d, 0x741831f6, 0xce5c3e16, 0x9b87931e, + 0xafd6ba33, 0x6c24cf5c, 0x7a325381, 0x28958677, + 0x3b8f4898, 0x6b4bb9af, 0xc4bfe81b, 0x66282193, + 0x61d809cc, 0xfb21a991, 0x487cac60, 0x5dec8032, + 0xef845d5d, 0xe98575b1, 0xdc262302, 0xeb651b88, + 0x23893e81, 0xd396acc5, 0x0f6d6ff3, 0x83f44239, + 0x2e0b4482, 0xa4842004, 0x69c8f04a, 0x9e1f9b5e, + 0x21c66842, 0xf6e96c9a, 0x670c9c61, 0xabd388f0, + 0x6a51a0d2, 0xd8542f68, 0x960fa728, 0xab5133a3, + 0x6eef0b6c, 0x137a3be4, 0xba3bf050, 0x7efb2a98, + 0xa1f1651d, 0x39af0176, 0x66ca593e, 0x82430e88, + 0x8cee8619, 0x456f9fb4, 0x7d84a5c3, 0x3b8b5ebe, + 0xe06f75d8, 0x85c12073, 0x401a449f, 0x56c16aa6, + 0x4ed3aa62, 0x363f7706, 0x1bfedf72, 0x429b023d, + 0x37d0d724, 0xd00a1248, 0xdb0fead3, 0x49f1c09b, + 0x075372c9, 0x80991b7b, 0x25d479d8, 0xf6e8def7, + 0xe3fe501a, 0xb6794c3b, 0x976ce0bd, 0x04c006ba, + 0xc1a94fb6, 0x409f60c4, 0x5e5c9ec2, 0x196a2463, + 0x68fb6faf, 0x3e6c53b5, 0x1339b2eb, 0x3b52ec6f, + 0x6dfc511f, 0x9b30952c, 0xcc814544, 0xaf5ebd09, + 0xbee3d004, 0xde334afd, 0x660f2807, 0x192e4bb3, + 0xc0cba857, 0x45c8740f, 0xd20b5f39, 0xb9d3fbdb, + 0x5579c0bd, 0x1a60320a, 0xd6a100c6, 0x402c7279, + 0x679f25fe, 0xfb1fa3cc, 0x8ea5e9f8, 0xdb3222f8, + 0x3c7516df, 0xfd616b15, 0x2f501ec8, 0xad0552ab, + 0x323db5fa, 0xfd238760, 0x53317b48, 0x3e00df82, + 0x9e5c57bb, 0xca6f8ca0, 0x1a87562e, 0xdf1769db, + 0xd542a8f6, 0x287effc3, 0xac6732c6, 0x8c4f5573, + 0x695b27b0, 0xbbca58c8, 0xe1ffa35d, 0xb8f011a0, + 0x10fa3d98, 0xfd2183b8, 0x4afcb56c, 0x2dd1d35b, + 0x9a53e479, 0xb6f84565, 0xd28e49bc, 0x4bfb9790, + 0xe1ddf2da, 0xa4cb7e33, 0x62fb1341, 0xcee4c6e8, + 0xef20cada, 0x36774c01, 0xd07e9efe, 0x2bf11fb4, + 0x95dbda4d, 0xae909198, 0xeaad8e71, 0x6b93d5a0, + 0xd08ed1d0, 0xafc725e0, 0x8e3c5b2f, 0x8e7594b7, + 0x8ff6e2fb, 0xf2122b64, 0x8888b812, 0x900df01c, + 0x4fad5ea0, 0x688fc31c, 0xd1cff191, 0xb3a8c1ad, + 0x2f2f2218, 0xbe0e1777, 0xea752dfe, 0x8b021fa1, + 0xe5a0cc0f, 0xb56f74e8, 0x18acf3d6, 0xce89e299, + 0xb4a84fe0, 0xfd13e0b7, 0x7cc43b81, 0xd2ada8d9, + 0x165fa266, 0x80957705, 0x93cc7314, 0x211a1477, + 0xe6ad2065, 0x77b5fa86, 0xc75442f5, 0xfb9d35cf, + 0xebcdaf0c, 0x7b3e89a0, 0xd6411bd3, 0xae1e7e49, + 0x00250e2d, 0x2071b35e, 0x226800bb, 0x57b8e0af, + 0x2464369b, 0xf009b91e, 0x5563911d, 0x59dfa6aa, + 0x78c14389, 0xd95a537f, 0x207d5ba2, 0x02e5b9c5, + 0x83260376, 0x6295cfa9, 0x11c81968, 0x4e734a41, + 0xb3472dca, 0x7b14a94a, 0x1b510052, 0x9a532915, + 0xd60f573f, 0xbc9bc6e4, 0x2b60a476, 0x81e67400, + 0x08ba6fb5, 0x571be91f, 0xf296ec6b, 0x2a0dd915, + 0xb6636521, 0xe7b9f9b6, 0xff34052e, 0xc5855664, + 0x53b02d5d, 0xa99f8fa1, 0x08ba4799, 0x6e85076a, + 0x4b7a70e9, 0xb5b32944, 0xdb75092e, 0xc4192623, + 0xad6ea6b0, 0x49a7df7d, 0x9cee60b8, 0x8fedb266, + 0xecaa8c71, 0x699a17ff, 0x5664526c, 0xc2b19ee1, + 0x193602a5, 0x75094c29, 0xa0591340, 0xe4183a3e, + 0x3f54989a, 0x5b429d65, 0x6b8fe4d6, 0x99f73fd6, + 0xa1d29c07, 0xefe830f5, 0x4d2d38e6, 0xf0255dc1, + 0x4cdd2086, 0x8470eb26, 0x6382e9c6, 0x021ecc5e, + 0x09686b3f, 0x3ebaefc9, 0x3c971814, 0x6b6a70a1, + 0x687f3584, 0x52a0e286, 0xb79c5305, 0xaa500737, + 0x3e07841c, 0x7fdeae5c, 0x8e7d44ec, 0x5716f2b8, + 0xb03ada37, 0xf0500c0d, 0xf01c1f04, 0x0200b3ff, + 0xae0cf51a, 0x3cb574b2, 0x25837a58, 0xdc0921bd, + 0xd19113f9, 0x7ca92ff6, 0x94324773, 0x22f54701, + 0x3ae5e581, 0x37c2dadc, 0xc8b57634, 0x9af3dda7, + 0xa9446146, 0x0fd0030e, 0xecc8c73e, 0xa4751e41, + 0xe238cd99, 0x3bea0e2f, 0x3280bba1, 0x183eb331, + 0x4e548b38, 0x4f6db908, 0x6f420d03, 0xf60a04bf, + 0x2cb81290, 0x24977c79, 0x5679b072, 0xbcaf89af, + 0xde9a771f, 0xd9930810, 0xb38bae12, 0xdccf3f2e, + 0x5512721f, 0x2e6b7124, 0x501adde6, 0x9f84cd87, + 0x7a584718, 0x7408da17, 0xbc9f9abc, 0xe94b7d8c, + 0xec7aec3a, 0xdb851dfa, 0x63094366, 0xc464c3d2, + 0xef1c1847, 0x3215d908, 0xdd433b37, 0x24c2ba16, + 0x12a14d43, 0x2a65c451, 0x50940002, 0x133ae4dd, + 0x71dff89e, 0x10314e55, 0x81ac77d6, 0x5f11199b, + 0x043556f1, 0xd7a3c76b, 0x3c11183b, 0x5924a509, + 0xf28fe6ed, 0x97f1fbfa, 0x9ebabf2c, 0x1e153c6e, + 0x86e34570, 0xeae96fb1, 0x860e5e0a, 0x5a3e2ab3, + 0x771fe71c, 0x4e3d06fa, 0x2965dcb9, 0x99e71d0f, + 0x803e89d6, 0x5266c825, 0x2e4cc978, 0x9c10b36a, + 0xc6150eba, 0x94e2ea78, 0xa5fc3c53, 0x1e0a2df4, + 0xf2f74ea7, 0x361d2b3d, 0x1939260f, 0x19c27960, + 0x5223a708, 0xf71312b6, 0xebadfe6e, 0xeac31f66, + 0xe3bc4595, 0xa67bc883, 0xb17f37d1, 0x018cff28, + 0xc332ddef, 0xbe6c5aa5, 0x65582185, 0x68ab9802, + 0xeecea50f, 0xdb2f953b, 0x2aef7dad, 0x5b6e2f84, + 0x1521b628, 0x29076170, 0xecdd4775, 0x619f1510, + 0x13cca830, 0xeb61bd96, 0x0334fe1e, 0xaa0363cf, + 0xb5735c90, 0x4c70a239, 0xd59e9e0b, 0xcbaade14, + 0xeecc86bc, 0x60622ca7, 0x9cab5cab, 0xb2f3846e, + 0x648b1eaf, 0x19bdf0ca, 0xa02369b9, 0x655abb50, + 0x40685a32, 0x3c2ab4b3, 0x319ee9d5, 0xc021b8f7, + 0x9b540b19, 0x875fa099, 0x95f7997e, 0x623d7da8, + 0xf837889a, 0x97e32d77, 0x11ed935f, 0x16681281, + 0x0e358829, 0xc7e61fd6, 0x96dedfa1, 0x7858ba99, + 0x57f584a5, 0x1b227263, 0x9b83c3ff, 0x1ac24696, + 0xcdb30aeb, 0x532e3054, 0x8fd948e4, 0x6dbc3128, + 0x58ebf2ef, 0x34c6ffea, 0xfe28ed61, 0xee7c3c73, + 0x5d4a14d9, 0xe864b7e3, 0x42105d14, 0x203e13e0, + 0x45eee2b6, 0xa3aaabea, 0xdb6c4f15, 0xfacb4fd0, + 0xc742f442, 0xef6abbb5, 0x654f3b1d, 0x41cd2105, + 0xd81e799e, 0x86854dc7, 0xe44b476a, 0x3d816250, + 0xcf62a1f2, 0x5b8d2646, 0xfc8883a0, 0xc1c7b6a3, + 0x7f1524c3, 0x69cb7492, 0x47848a0b, 0x5692b285, + 0x095bbf00, 0xad19489d, 0x1462b174, 0x23820e00, + 0x58428d2a, 0x0c55f5ea, 0x1dadf43e, 0x233f7061, + 0x3372f092, 0x8d937e41, 0xd65fecf1, 0x6c223bdb, + 0x7cde3759, 0xcbee7460, 0x4085f2a7, 0xce77326e, + 0xa6078084, 0x19f8509e, 0xe8efd855, 0x61d99735, + 0xa969a7aa, 0xc50c06c2, 0x5a04abfc, 0x800bcadc, + 0x9e447a2e, 0xc3453484, 0xfdd56705, 0x0e1e9ec9, + 0xdb73dbd3, 0x105588cd, 0x675fda79, 0xe3674340, + 0xc5c43465, 0x713e38d8, 0x3d28f89e, 0xf16dff20, + 0x153e21e7, 0x8fb03d4a, 0xe6e39f2b, 0xdb83adf7, + 0xe93d5a68, 0x948140f7, 0xf64c261c, 0x94692934, + 0x411520f7, 0x7602d4f7, 0xbcf46b2e, 0xd4a20068, + 0xd4082471, 0x3320f46a, 0x43b7d4b7, 0x500061af, + 0x1e39f62e, 0x97244546, 0x14214f74, 0xbf8b8840, + 0x4d95fc1d, 0x96b591af, 0x70f4ddd3, 0x66a02f45, + 0xbfbc09ec, 0x03bd9785, 0x7fac6dd0, 0x31cb8504, + 0x96eb27b3, 0x55fd3941, 0xda2547e6, 0xabca0a9a, + 0x28507825, 0x530429f4, 0x0a2c86da, 0xe9b66dfb, + 0x68dc1462, 0xd7486900, 0x680ec0a4, 0x27a18dee, + 0x4f3ffea2, 0xe887ad8c, 0xb58ce006, 0x7af4d6b6, + 0xaace1e7c, 0xd3375fec, 0xce78a399, 0x406b2a42, + 0x20fe9e35, 0xd9f385b9, 0xee39d7ab, 0x3b124e8b, + 0x1dc9faf7, 0x4b6d1856, 0x26a36631, 0xeae397b2, + 0x3a6efa74, 0xdd5b4332, 0x6841e7f7, 0xca7820fb, + 0xfb0af54e, 0xd8feb397, 0x454056ac, 0xba489527, + 0x55533a3a, 0x20838d87, 0xfe6ba9b7, 0xd096954b, + 0x55a867bc, 0xa1159a58, 0xcca92963, 0x99e1db33, + 0xa62a4a56, 0x3f3125f9, 0x5ef47e1c, 0x9029317c, + 0xfdf8e802, 0x04272f70, 0x80bb155c, 0x05282ce3, + 0x95c11548, 0xe4c66d22, 0x48c1133f, 0xc70f86dc, + 0x07f9c9ee, 0x41041f0f, 0x404779a4, 0x5d886e17, + 0x325f51eb, 0xd59bc0d1, 0xf2bcc18f, 0x41113564, + 0x257b7834, 0x602a9c60, 0xdff8e8a3, 0x1f636c1b, + 0x0e12b4c2, 0x02e1329e, 0xaf664fd1, 0xcad18115, + 0x6b2395e0, 0x333e92e1, 0x3b240b62, 0xeebeb922, + 0x85b2a20e, 0xe6ba0d99, 0xde720c8c, 0x2da2f728, + 0xd0127845, 0x95b794fd, 0x647d0862, 0xe7ccf5f0, + 0x5449a36f, 0x877d48fa, 0xc39dfd27, 0xf33e8d1e, + 0x0a476341, 0x992eff74, 0x3a6f6eab, 0xf4f8fd37, + 0xa812dc60, 0xa1ebddf8, 0x991be14c, 0xdb6e6b0d, + 0xc67b5510, 0x6d672c37, 0x2765d43b, 0xdcd0e804, + 0xf1290dc7, 0xcc00ffa3, 0xb5390f92, 0x690fed0b, + 0x667b9ffb, 0xcedb7d9c, 0xa091cf0b, 0xd9155ea3, + 0xbb132f88, 0x515bad24, 0x7b9479bf, 0x763bd6eb, + 0x37392eb3, 0xcc115979, 0x8026e297, 0xf42e312d, + 0x6842ada7, 0xc66a2b3b, 0x12754ccc, 0x782ef11c, + 0x6a124237, 0xb79251e7, 0x06a1bbe6, 0x4bfb6350, + 0x1a6b1018, 0x11caedfa, 0x3d25bdd8, 0xe2e1c3c9, + 0x44421659, 0x0a121386, 0xd90cec6e, 0xd5abea2a, + 0x64af674e, 0xda86a85f, 0xbebfe988, 0x64e4c3fe, + 0x9dbc8057, 0xf0f7c086, 0x60787bf8, 0x6003604d, + 0xd1fd8346, 0xf6381fb0, 0x7745ae04, 0xd736fccc, + 0x83426b33, 0xf01eab71, 0xb0804187, 0x3c005e5f, + 0x77a057be, 0xbde8ae24, 0x55464299, 0xbf582e61, + 0x4e58f48f, 0xf2ddfda2, 0xf474ef38, 0x8789bdc2, + 0x5366f9c3, 0xc8b38e74, 0xb475f255, 0x46fcd9b9, + 0x7aeb2661, 0x8b1ddf84, 0x846a0e79, 0x915f95e2, + 0x466e598e, 0x20b45770, 0x8cd55591, 0xc902de4c, + 0xb90bace1, 0xbb8205d0, 0x11a86248, 0x7574a99e, + 0xb77f19b6, 0xe0a9dc09, 0x662d09a1, 0xc4324633, + 0xe85a1f02, 0x09f0be8c, 0x4a99a025, 0x1d6efe10, + 0x1ab93d1d, 0x0ba5a4df, 0xa186f20f, 0x2868f169, + 0xdcb7da83, 0x573906fe, 0xa1e2ce9b, 0x4fcd7f52, + 0x50115e01, 0xa70683fa, 0xa002b5c4, 0x0de6d027, + 0x9af88c27, 0x773f8641, 0xc3604c06, 0x61a806b5, + 0xf0177a28, 0xc0f586e0, 0x006058aa, 0x30dc7d62, + 0x11e69ed7, 0x2338ea63, 0x53c2dd94, 0xc2c21634, + 0xbbcbee56, 0x90bcb6de, 0xebfc7da1, 0xce591d76, + 0x6f05e409, 0x4b7c0188, 0x39720a3d, 0x7c927c24, + 0x86e3725f, 0x724d9db9, 0x1ac15bb4, 0xd39eb8fc, + 0xed545578, 0x08fca5b5, 0xd83d7cd3, 0x4dad0fc4, + 0x1e50ef5e, 0xb161e6f8, 0xa28514d9, 0x6c51133c, + 0x6fd5c7e7, 0x56e14ec4, 0x362abfce, 0xddc6c837, + 0xd79a3234, 0x92638212, 0x670efa8e, 0x406000e0, + 0x3a39ce37, 0xd3faf5cf, 0xabc27737, 0x5ac52d1b, + 0x5cb0679e, 0x4fa33742, 0xd3822740, 0x99bc9bbe, + 0xd5118e9d, 0xbf0f7315, 0xd62d1c7e, 0xc700c47b, + 0xb78c1b6b, 0x21a19045, 0xb26eb1be, 0x6a366eb4, + 0x5748ab2f, 0xbc946e79, 0xc6a376d2, 0x6549c2c8, + 0x530ff8ee, 0x468dde7d, 0xd5730a1d, 0x4cd04dc6, + 0x2939bbdb, 0xa9ba4650, 0xac9526e8, 0xbe5ee304, + 0xa1fad5f0, 0x6a2d519a, 0x63ef8ce2, 0x9a86ee22, + 0xc089c2b8, 0x43242ef6, 0xa51e03aa, 0x9cf2d0a4, + 0x83c061ba, 0x9be96a4d, 0x8fe51550, 0xba645bd6, + 0x2826a2f9, 0xa73a3ae1, 0x4ba99586, 0xef5562e9, + 0xc72fefd3, 0xf752f7da, 0x3f046f69, 0x77fa0a59, + 0x80e4a915, 0x87b08601, 0x9b09e6ad, 0x3b3ee593, + 0xe990fd5a, 0x9e34d797, 0x2cf0b7d9, 0x022b8b51, + 0x96d5ac3a, 0x017da67d, 0xd1cf3ed6, 0x7c7d2d28, + 0x1f9f25cf, 0xadf2b89b, 0x5ad6b472, 0x5a88f54c, + 0xe029ac71, 0xe019a5e6, 0x47b0acfd, 0xed93fa9b, + 0xe8d3c48d, 0x283b57cc, 0xf8d56629, 0x79132e28, + 0x785f0191, 0xed756055, 0xf7960e44, 0xe3d35e8c, + 0x15056dd4, 0x88f46dba, 0x03a16125, 0x0564f0bd, + 0xc3eb9e15, 0x3c9057a2, 0x97271aec, 0xa93a072a, + 0x1b3f6d9b, 0x1e6321f5, 0xf59c66fb, 0x26dcf319, + 0x7533d928, 0xb155fdf5, 0x03563482, 0x8aba3cbb, + 0x28517711, 0xc20ad9f8, 0xabcc5167, 0xccad925f, + 0x4de81751, 0x3830dc8e, 0x379d5862, 0x9320f991, + 0xea7a90c2, 0xfb3e7bce, 0x5121ce64, 0x774fbe32, + 0xa8b6e37e, 0xc3293d46, 0x48de5369, 0x6413e680, + 0xa2ae0810, 0xdd6db224, 0x69852dfd, 0x09072166, + 0xb39a460a, 0x6445c0dd, 0x586cdecf, 0x1c20c8ae, + 0x5bbef7dd, 0x1b588d40, 0xccd2017f, 0x6bb4e3bb, + 0xdda26a7e, 0x3a59ff45, 0x3e350a44, 0xbcb4cdd5, + 0x72eacea8, 0xfa6484bb, 0x8d6612ae, 0xbf3c6f47, + 0xd29be463, 0x542f5d9e, 0xaec2771b, 0xf64e6370, + 0x740e0d8d, 0xe75b1357, 0xf8721671, 0xaf537d5d, + 0x4040cb08, 0x4eb4e2cc, 0x34d2466a, 0x0115af84, + 0xe1b00428, 0x95983a1d, 0x06b89fb4, 0xce6ea048, + 0x6f3f3b82, 0x3520ab82, 0x011a1d4b, 0x277227f8, + 0x611560b1, 0xe7933fdc, 0xbb3a792b, 0x344525bd, + 0xa08839e1, 0x51ce794b, 0x2f32c9b7, 0xa01fbac9, + 0xe01cc87e, 0xbcc7d1f6, 0xcf0111c3, 0xa1e8aac7, + 0x1a908749, 0xd44fbd9a, 0xd0dadecb, 0xd50ada38, + 0x0339c32a, 0xc6913667, 0x8df9317c, 0xe0b12b4f, + 0xf79e59b7, 0x43f5bb3a, 0xf2d519ff, 0x27d9459c, + 0xbf97222c, 0x15e6fc2a, 0x0f91fc71, 0x9b941525, + 0xfae59361, 0xceb69ceb, 0xc2a86459, 0x12baa8d1, + 0xb6c1075e, 0xe3056a0c, 0x10d25065, 0xcb03a442, + 0xe0ec6e0e, 0x1698db3b, 0x4c98a0be, 0x3278e964, + 0x9f1f9532, 0xe0d392df, 0xd3a0342b, 0x8971f21e, + 0x1b0a7441, 0x4ba3348c, 0xc5be7120, 0xc37632d8, + 0xdf359f8d, 0x9b992f2e, 0xe60b6f47, 0x0fe3f11d, + 0xe54cda54, 0x1edad891, 0xce6279cf, 0xcd3e7e6f, + 0x1618b166, 0xfd2c1d05, 0x848fd2c5, 0xf6fb2299, + 0xf523f357, 0xa6327623, 0x93a83531, 0x56cccd02, + 0xacf08162, 0x5a75ebb5, 0x6e163697, 0x88d273cc, + 0xde966292, 0x81b949d0, 0x4c50901b, 0x71c65614, + 0xe6c6c7bd, 0x327a140a, 0x45e1d006, 0xc3f27b9a, + 0xc9aa53fd, 0x62a80f00, 0xbb25bfe2, 0x35bdd2f6, + 0x71126905, 0xb2040222, 0xb6cbcf7c, 0xcd769c2b, + 0x53113ec0, 0x1640e3d3, 0x38abbd60, 0x2547adf0, + 0xba38209c, 0xf746ce76, 0x77afa1c5, 0x20756060, + 0x85cbfe4e, 0x8ae88dd8, 0x7aaaf9b0, 0x4cf9aa7e, + 0x1948c25c, 0x02fb8a8c, 0x01c36ae4, 0xd6ebe1f9, + 0x90d4f869, 0xa65cdea0, 0x3f09252d, 0xc208e69f, + 0xb74e6132, 0xce77e25b, 0x578fdfe3, 0x3ac372e6 + }; + + // bcrypt IV: "OrpheanBeholderScryDoubt" + static private final int bf_crypt_ciphertext[] = { + 0x4f727068, 0x65616e42, 0x65686f6c, + 0x64657253, 0x63727944, 0x6f756274 + }; + + // Table for Base64 encoding + static private final char base64_code[] = { + '.', '/', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', + 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', + 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', + 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', + 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', + '6', '7', '8', '9' + }; + + // Table for Base64 decoding + static private final byte index_64[] = { + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 0, 1, 54, 55, + 56, 57, 58, 59, 60, 61, 62, 63, -1, -1, + -1, -1, -1, -1, -1, 2, 3, 4, 5, 6, + 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, + -1, -1, -1, -1, -1, -1, 28, 29, 30, + 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, + 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, + 51, 52, 53, -1, -1, -1, -1, -1 + }; + + // Expanded Blowfish key + private int P[]; + private int S[]; + + /** + * Encode a byte array using bcrypt's slightly-modified base64 + * encoding scheme. Note that this is *not* compatible with + * the standard MIME-base64 encoding. + * + * @param d the byte array to encode + * @param len the number of bytes to encode + * @return base64-encoded string + * @exception IllegalArgumentException if the length is invalid + */ + private static String encode_base64(byte d[], int len) + throws IllegalArgumentException { + int off = 0; + StringBuffer rs = new StringBuffer(); + int c1, c2; + + if (len <= 0 || len > d.length) + throw new IllegalArgumentException ("Invalid len"); + + while (off < len) { + c1 = d[off++] & 0xff; + rs.append(base64_code[(c1 >> 2) & 0x3f]); + c1 = (c1 & 0x03) << 4; + if (off >= len) { + rs.append(base64_code[c1 & 0x3f]); + break; + } + c2 = d[off++] & 0xff; + c1 |= (c2 >> 4) & 0x0f; + rs.append(base64_code[c1 & 0x3f]); + c1 = (c2 & 0x0f) << 2; + if (off >= len) { + rs.append(base64_code[c1 & 0x3f]); + break; + } + c2 = d[off++] & 0xff; + c1 |= (c2 >> 6) & 0x03; + rs.append(base64_code[c1 & 0x3f]); + rs.append(base64_code[c2 & 0x3f]); + } + return rs.toString(); + } + + /** + * Look up the 3 bits base64-encoded by the specified character, + * range-checking againt conversion table + * @param x the base64-encoded value + * @return the decoded value of x + */ + private static byte char64(char x) { + if ((int)x < 0 || (int)x > index_64.length) + return -1; + return index_64[(int)x]; + } + + /** + * Decode a string encoded using bcrypt's base64 scheme to a + * byte array. Note that this is *not* compatible with + * the standard MIME-base64 encoding. + * @param s the string to decode + * @param maxolen the maximum number of bytes to decode + * @return an array containing the decoded bytes + * @throws IllegalArgumentException if maxolen is invalid + */ + private static byte[] decode_base64(String s, int maxolen) + throws IllegalArgumentException { + StringBuffer rs = new StringBuffer(); + int off = 0, slen = s.length(), olen = 0; + byte ret[]; + byte c1, c2, c3, c4, o; + + if (maxolen <= 0) + throw new IllegalArgumentException ("Invalid maxolen"); + + while (off < slen - 1 && olen < maxolen) { + c1 = char64(s.charAt(off++)); + c2 = char64(s.charAt(off++)); + if (c1 == -1 || c2 == -1) + break; + o = (byte)(c1 << 2); + o |= (c2 & 0x30) >> 4; + rs.append((char)o); + if (++olen >= maxolen || off >= slen) + break; + c3 = char64(s.charAt(off++)); + if (c3 == -1) + break; + o = (byte)((c2 & 0x0f) << 4); + o |= (c3 & 0x3c) >> 2; + rs.append((char)o); + if (++olen >= maxolen || off >= slen) + break; + c4 = char64(s.charAt(off++)); + o = (byte)((c3 & 0x03) << 6); + o |= c4; + rs.append((char)o); + ++olen; + } + + ret = new byte[olen]; + for (off = 0; off < olen; off++) + ret[off] = (byte)rs.charAt(off); + return ret; + } + + /** + * Blowfish encipher a single 64-bit block encoded as + * two 32-bit halves + * @param lr an array containing the two 32-bit half blocks + * @param off the position in the array of the blocks + */ + private final void encipher(int lr[], int off) { + int i, n, l = lr[off], r = lr[off + 1]; + + l ^= P[0]; + for (i = 0; i <= BLOWFISH_NUM_ROUNDS - 2;) { + // Feistel substitution on left word + n = S[(l >> 24) & 0xff]; + n += S[0x100 | ((l >> 16) & 0xff)]; + n ^= S[0x200 | ((l >> 8) & 0xff)]; + n += S[0x300 | (l & 0xff)]; + r ^= n ^ P[++i]; + + // Feistel substitution on right word + n = S[(r >> 24) & 0xff]; + n += S[0x100 | ((r >> 16) & 0xff)]; + n ^= S[0x200 | ((r >> 8) & 0xff)]; + n += S[0x300 | (r & 0xff)]; + l ^= n ^ P[++i]; + } + lr[off] = r ^ P[BLOWFISH_NUM_ROUNDS + 1]; + lr[off + 1] = l; + } + + /** + * Cycically extract a word of key material + * @param data the string to extract the data from + * @param offp a "pointer" (as a one-entry array) to the + * current offset into data + * @return the next word of material from data + */ + private static int streamtoword(byte data[], int offp[]) { + int i; + int word = 0; + int off = offp[0]; + + for (i = 0; i < 4; i++) { + word = (word << 8) | (data[off] & 0xff); + off = (off + 1) % data.length; + } + + offp[0] = off; + return word; + } + + /** + * Initialise the Blowfish key schedule + */ + private void init_key() { + P = (int[])P_orig.clone(); + S = (int[])S_orig.clone(); + } + + /** + * Key the Blowfish cipher + * @param key an array containing the key + */ + private void key(byte key[]) { + int i; + int koffp[] = { 0 }; + int lr[] = { 0, 0 }; + int plen = P.length, slen = S.length; + + for (i = 0; i < plen; i++) + P[i] = P[i] ^ streamtoword(key, koffp); + + for (i = 0; i < plen; i += 2) { + encipher(lr, 0); + P[i] = lr[0]; + P[i + 1] = lr[1]; + } + + for (i = 0; i < slen; i += 2) { + encipher(lr, 0); + S[i] = lr[0]; + S[i + 1] = lr[1]; + } + } + + /** + * Perform the "enhanced key schedule" step described by + * Provos and Mazieres in "A Future-Adaptable Password Scheme" + * http://www.openbsd.org/papers/bcrypt-paper.ps + * @param data salt information + * @param key password information + */ + private void ekskey(byte data[], byte key[]) { + int i; + int koffp[] = { 0 }, doffp[] = { 0 }; + int lr[] = { 0, 0 }; + int plen = P.length, slen = S.length; + + for (i = 0; i < plen; i++) + P[i] = P[i] ^ streamtoword(key, koffp); + + for (i = 0; i < plen; i += 2) { + lr[0] ^= streamtoword(data, doffp); + lr[1] ^= streamtoword(data, doffp); + encipher(lr, 0); + P[i] = lr[0]; + P[i + 1] = lr[1]; + } + + for (i = 0; i < slen; i += 2) { + lr[0] ^= streamtoword(data, doffp); + lr[1] ^= streamtoword(data, doffp); + encipher(lr, 0); + S[i] = lr[0]; + S[i + 1] = lr[1]; + } + } + + /** + * Perform the central password hashing step in the + * bcrypt scheme + * @param password the password to hash + * @param salt the binary salt to hash with the password + * @param log_rounds the binary logarithm of the number + * of rounds of hashing to apply + * @return an array containing the binary hashed password + */ + private byte[] crypt_raw(byte password[], byte salt[], int log_rounds) { + int rounds, i, j; + int cdata[] = (int[])bf_crypt_ciphertext.clone(); + int clen = cdata.length; + byte ret[]; + + if (log_rounds < 4 || log_rounds > 31) + throw new IllegalArgumentException ("Bad number of rounds"); + rounds = 1 << log_rounds; + if (salt.length != BCRYPT_SALT_LEN) + throw new IllegalArgumentException ("Bad salt length"); + + init_key(); + ekskey(salt, password); + for (i = 0; i < rounds; i++) { + key(password); + key(salt); + } + + for (i = 0; i < 64; i++) { + for (j = 0; j < (clen >> 1); j++) + encipher(cdata, j << 1); + } + + ret = new byte[clen * 4]; + for (i = 0, j = 0; i < clen; i++) { + ret[j++] = (byte)((cdata[i] >> 24) & 0xff); + ret[j++] = (byte)((cdata[i] >> 16) & 0xff); + ret[j++] = (byte)((cdata[i] >> 8) & 0xff); + ret[j++] = (byte)(cdata[i] & 0xff); + } + return ret; + } + + /** + * Hash a password using the OpenBSD bcrypt scheme + * @param password the password to hash + * @param salt the salt to hash with (perhaps generated + * using BCrypt.gensalt) + * @return the hashed password + */ + public static String hashpw(String password, String salt) { + BCrypt B; + String real_salt; + byte passwordb[], saltb[], hashed[]; + char minor = (char)0; + int rounds, off = 0; + StringBuffer rs = new StringBuffer(); + + if (salt.charAt(0) != '$' || salt.charAt(1) != '2') + throw new IllegalArgumentException ("Invalid salt version"); + if (salt.charAt(2) == '$') + off = 3; + else { + minor = salt.charAt(2); + if (minor != 'a' || salt.charAt(3) != '$') + throw new IllegalArgumentException ("Invalid salt revision"); + off = 4; + } + + // Extract number of rounds + if (salt.charAt(off + 2) > '$') + throw new IllegalArgumentException ("Missing salt rounds"); + rounds = Integer.parseInt(salt.substring(off, off + 2)); + + real_salt = salt.substring(off + 3, off + 25); + try { + passwordb = (password + (minor >= 'a' ? "\000" : "")).getBytes("UTF-8"); + } catch (UnsupportedEncodingException uee) { + throw new AssertionError("UTF-8 is not supported"); + } + + saltb = decode_base64(real_salt, BCRYPT_SALT_LEN); + + B = new BCrypt(); + hashed = B.crypt_raw(passwordb, saltb, rounds); + + rs.append("$2"); + if (minor >= 'a') + rs.append(minor); + rs.append("$"); + if (rounds < 10) + rs.append("0"); + rs.append(Integer.toString(rounds)); + rs.append("$"); + rs.append(encode_base64(saltb, saltb.length)); + rs.append(encode_base64(hashed, + bf_crypt_ciphertext.length * 4 - 1)); + return rs.toString(); + } + + /** + * Generate a salt for use with the BCrypt.hashpw() method + * @param log_rounds the log2 of the number of rounds of + * hashing to apply - the work factor therefore increases as + * 2**log_rounds. + * @param random an instance of SecureRandom to use + * @return an encoded salt value + */ + public static String gensalt(int log_rounds, SecureRandom random) { + StringBuffer rs = new StringBuffer(); + byte rnd[] = new byte[BCRYPT_SALT_LEN]; + + random.nextBytes(rnd); + + rs.append("$2a$"); + if (log_rounds < 10) + rs.append("0"); + rs.append(Integer.toString(log_rounds)); + rs.append("$"); + rs.append(encode_base64(rnd, rnd.length)); + return rs.toString(); + } + + /** + * Generate a salt for use with the BCrypt.hashpw() method + * @param log_rounds the log2 of the number of rounds of + * hashing to apply - the work factor therefore increases as + * 2**log_rounds. + * @return an encoded salt value + */ + public static String gensalt(int log_rounds) { + return gensalt(log_rounds, new SecureRandom()); + } + + /** + * Generate a salt for use with the BCrypt.hashpw() method, + * selecting a reasonable default for the number of hashing + * rounds to apply + * @return an encoded salt value + */ + public static String gensalt() { + return gensalt(GENSALT_DEFAULT_LOG2_ROUNDS); + } + + /** + * Check that a plaintext password matches a previously hashed + * one + * @param plaintext the plaintext password to verify + * @param hashed the previously-hashed password + * @return true if the passwords match, false otherwise + */ + public static boolean checkpw(String plaintext, String hashed) { + return (hashed.compareTo(hashpw(plaintext, hashed)) == 0); + } +} diff --git a/src/main/java/com/loglog/api/commons/utils/BoardUtils.java b/src/main/java/com/loglog/api/commons/utils/BoardUtils.java new file mode 100644 index 0000000..f880ac6 --- /dev/null +++ b/src/main/java/com/loglog/api/commons/utils/BoardUtils.java @@ -0,0 +1,25 @@ +package com.loglog.api.commons.utils; + +import org.apache.commons.lang3.StringUtils; + +import com.loglog.api.commons.beans.BoardBean; + +public class BoardUtils { + + /** + * 비밀글 이면서 본인의 비밀글이 맞는지를 확인한다. + * @param boardBean + * @return 위의 조건2개를 다 만족하면 true, 아니면 false + */ + public static boolean getIsSecretBdMine(String writerId, BoardBean boardBean) { + + if(boardBean != null && StringUtils.equals(boardBean.getBdSecretYn(), "Y")) { + if( StringUtils.equals(writerId, boardBean.getBdWriterId()) ) { + return true; + } + } + + return false; + } + +} diff --git a/src/main/java/com/loglog/api/commons/utils/CommonUtils.java b/src/main/java/com/loglog/api/commons/utils/CommonUtils.java new file mode 100644 index 0000000..6f7655a --- /dev/null +++ b/src/main/java/com/loglog/api/commons/utils/CommonUtils.java @@ -0,0 +1,271 @@ +package com.loglog.api.commons.utils; + +import java.net.HttpURLConnection; +import java.net.URL; +import java.net.URLConnection; +import java.util.Random; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import javax.servlet.http.HttpServletRequest; + +import org.apache.commons.lang3.StringUtils; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; + +/** + * 공통사용 Util + * + * @author PCH + */ +public class CommonUtils { + + /** + * 자릿수만큼 랜덤숫자 생성 반환한다. + * + * @author PCH + * @param loopCount 자릿수 + * @return 자릿수만큼 랜덤숫자 생성 반환 + */ + public static String getRandomNum(int loopCount){ + String str = ""; + int d = 0; + for (int i = 1; i <= loopCount; i++){ + Random r = new Random(); + d = r.nextInt(9); + str = str + Integer.toString(d); + } + return str; + } + + private static final char[] chars; + + static { + StringBuilder buffer = new StringBuilder(); + for (char ch = '0'; ch <= '9'; ++ch) + buffer.append(ch); + for (char ch = 'a'; ch <= 'z'; ++ch) + buffer.append(ch); + for (char ch = 'A'; ch <= 'Z'; ++ch) + buffer.append(ch); + chars = buffer.toString().toCharArray(); + } + + /** + * 자릿수만큼 랜덤 문자열(숫자포함) 생성 및 반환한다 + * @param length 자릿수 + * @return 자릿수만큼 랜덤 문자열 반환 + */ + public static String random(int length) { + if (length < 1) + throw new IllegalArgumentException("length < 1: " + length); + + StringBuilder randomString = new StringBuilder(); + Random random = new Random(); + + for (int i = 0; i < length; i++) { + randomString.append(chars[random.nextInt(chars.length)]); + } + return randomString.toString(); + } + + /**userId/sellerId 특수문자로 변경*/ + public static String convertEmail(String email) throws Exception{ + String str = ""; + int flag = email.indexOf('@'); + + for (int i = 0; i < email.length(); i++) { + if (i<3) { + str += email.charAt(i); + }else{ + if (i model, + HttpServletRequest request, HttpServletResponse response) + throws Exception { + File file = (File) model.get("downloadFile"); + String fileName = (String)model.get("fileName"); + + if ( StringUtils.isEmpty( fileName ) ){ + fileName = file.getName(); + } + + response.setContentType(getContentType()); + response.setContentLength((int) file.length()); + + +// String userAgent = request.getHeader("User-Agent"); +// boolean ie = userAgent.indexOf("MSIE") > -1; + String browser = request.getHeader("User-Agent"); + //파일 인코딩 + if(browser.contains("MSIE") || browser.contains("Trident") || browser.contains("Chrome")){ + fileName = URLEncoder.encode(fileName,"UTF-8").replaceAll("\\+", "%20"); + } else { + fileName = new String(fileName.getBytes("UTF-8"), "ISO-8859-1"); + } + + response.setHeader("Content-Disposition", "attachment; filename=\"" + fileName + "\";"); + response.setHeader("Content-Transfer-Encoding", "binary"); + OutputStream out = response.getOutputStream(); + FileInputStream fis = null; + try { + fis = new FileInputStream(file); + FileCopyUtils.copy(fis, out); + } finally { + if (fis != null) + try { + fis.close(); + } catch (IOException ex) { + } + } + out.flush(); + } + +} diff --git a/src/main/java/com/loglog/api/commons/utils/EncryptUtil.java b/src/main/java/com/loglog/api/commons/utils/EncryptUtil.java new file mode 100644 index 0000000..300ec47 --- /dev/null +++ b/src/main/java/com/loglog/api/commons/utils/EncryptUtil.java @@ -0,0 +1,54 @@ +package com.loglog.api.commons.utils; + +import java.security.MessageDigest; + +/** 암호화 유틸 */ +public class EncryptUtil { + /** + * 문자열을 SHA-256 방식으로 암호화 + * @param txt 암호화 하려하는 문자열 + * @return String + * @throws Exception + */ + public String getEncSHA256(String txt) throws Exception{ + StringBuffer sbuf = new StringBuffer(); + + MessageDigest mDigest = MessageDigest.getInstance("SHA-256"); + mDigest.update(txt.getBytes()); + + byte[] msgStr = mDigest.digest() ; + + for(int i=0; i < msgStr.length; i++){ + byte tmpStrByte = msgStr[i]; + String tmpEncTxt = Integer.toString((tmpStrByte & 0xff) + 0x100, 16).substring(1); + sbuf.append(tmpEncTxt) ; + } + + return sbuf.toString(); + } + + + /** + * 문자열을 MD-5 방식으로 암호화 + * @param txt 암호화 하려하는 문자열 + * @return String + * @throws Exception + */ + public String getEncMD5(String txt) throws Exception { + + StringBuffer sbuf = new StringBuffer(); + + MessageDigest mDigest = MessageDigest.getInstance("MD5"); + mDigest.update(txt.getBytes()); + + byte[] msgStr = mDigest.digest(); + + for(int i=0; i < msgStr.length; i++){ + String tmpEncTxt = Integer.toHexString((int)msgStr[i] & 0x00ff); + sbuf.append(tmpEncTxt); + } + return sbuf.toString() ; + } + + +} diff --git a/src/main/java/com/loglog/api/commons/utils/FileProductImgUtil.java b/src/main/java/com/loglog/api/commons/utils/FileProductImgUtil.java new file mode 100644 index 0000000..49bff2f --- /dev/null +++ b/src/main/java/com/loglog/api/commons/utils/FileProductImgUtil.java @@ -0,0 +1,235 @@ +package com.loglog.api.commons.utils; + +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +import org.apache.commons.io.FileUtils; +import org.apache.commons.lang3.StringUtils; +import org.springframework.web.multipart.MultipartFile; + +/** + * 상품 마스터 이미지 파일 유틸 함수 + * @author martin + * + */ +public class FileProductImgUtil { + + /** + * 파일목록들을 폴더로 이동 처리 + * upload경로path 리턴 + */ + // repositoryPath : /Users/martin/Documents/workspaceMeatoB/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps/MeatToBAdmin + // tempFolder : /product_img_temp + // targetFilePaths : /product_img_temp/20160728/9e2783fe-0593-4bd9-9111-48bf0ce19f78.jpg + + public static List moveTempFileToUploadFolder(String repositoryPath , String uploadFolderPath + , String subUploadFolderName , List targetFilePathList) throws IOException{ + + List uploadFiles = new ArrayList(); + String moveFilePath = ""; + + for(int i = 0 ; i < targetFilePathList.size() ; ++i){ + moveFilePath = moveFileFolder(repositoryPath, uploadFolderPath, subUploadFolderName, targetFilePathList.get(i)); + + if(moveFilePath != null){ + uploadFiles.add(moveFilePath); + } + + }//for i + + return uploadFiles; + } + + /** + * 파일을 업로드 폴더로 이동 처리 원본 삭제 + * upload경로path 리턴 + */ + public static String moveFileFolder(String repositoryPath , String uploadFolderPath + , String subUploadFolderName , String targetFilePath) throws IOException{ + + File fileTemp = null; + String fullTempFilePath = ""; + + File fileMove = null; + String moveFilePath = ""; + String fullMoveFilePath = ""; + + fullTempFilePath = repositoryPath + targetFilePath; + fileTemp = new File(fullTempFilePath); + moveFilePath = uploadFolderPath + "/"+ subUploadFolderName + "/"+fileTemp.getName(); + fullMoveFilePath = repositoryPath + moveFilePath; + + fileMove = new File( fullMoveFilePath); + + if(fileTemp.exists() == false) return null; + + FileUtils.copyFile(fileTemp, fileMove); + fileTemp.delete(); + + return moveFilePath; + + } + + /** + * 상품마스터 이미지 파일을 상품 이미지 폴더로 복사 처리 + * 복사된 경로 리턴 + */ + public static String copyMasterImgFileToProductFolder(String masterImgFullPath , + String productRepositoryPath , + String productFolderPath , + String productId) throws IOException{ + String fullTargetPath = ""; + String targetPath = ""; + File fileMaster = new File(masterImgFullPath); + File fileProduct = null; + + if(fileMaster.exists() == false) return null; + + targetPath = productFolderPath +"/"+ productId+ "/" + fileMaster.getName(); + fullTargetPath = productRepositoryPath + targetPath; + fileProduct = new File(fullTargetPath); + + FileUtils.copyFile(fileMaster, fileProduct); + + return targetPath; + + } + + + + /** + * 파일 갱신 + */ + public static void updateUploadFile(String repositoryPath ,String uploadFolderPath,String subUploadFolderName,List targetFilePaths){ + String fullUploadPath = repositoryPath + uploadFolderPath + "/" +subUploadFolderName; + + if(StringUtils.isEmpty(subUploadFolderName)) return; + + File folder = new File(fullUploadPath); + if(! folder.exists()){ + return; + } + + String[] fnameList = folder.list(); + int fCnt = fnameList.length; + String childPath = ""; + boolean isExist = false; + + for(int i = 0; i < fCnt; i++) { + childPath = fullUploadPath+"/"+fnameList[i]; + File f = new File(childPath); + + if(f.isDirectory()) continue; //folder 라면 skip + isExist = false; + + for(int j = 0 ; j < targetFilePaths.size() ; ++j){ + //targetFilePaths 목록에 파일명이 존재 여부 체크 + if( targetFilePaths.get(j).indexOf(f.getName()) >= 0){ + isExist = true; + break; + } + + }//for j + + //targetFilePaths 목록에 없는 파일 이면 삭제 + if(isExist == false){ + f.delete(); + } + + }//for i + + + } + + + /** + * 파일 삭제 + * @param imgFiles + */ + // targetFilePaths : /1/20160728/9e2783fe-0593-4bd9-9111-48bf0ce19f78.jpg + public static void deleteUploadFile(String repositoryPath ,List targetFilePaths){ + + String tempImgPath = ""; + String fullPath = ""; + File fileDelete = null; + + for(int i = 0 ; i < targetFilePaths.size() ; ++i){ + tempImgPath = targetFilePaths.get(i); + fullPath = repositoryPath + tempImgPath; + fileDelete = new File(fullPath); + if(fileDelete.exists() == false) continue; + fileDelete.delete(); + }//for i + + } + + /** + * 업로드 폴더 삭제 + * @param repositoryPath + * @param uploadFolderPath + * @param subUploadFolderName + */ + public static void deleteUploadFolder(String repositoryPath,String uploadFolderPath,String subUploadFolderName) throws Exception { + + if(StringUtils.isEmpty(subUploadFolderName)) return; + + String fullUploadPath = repositoryPath + uploadFolderPath + "/" +subUploadFolderName; + File folder = new File(fullUploadPath); + if (folder.exists()){ + deleteFolder(fullUploadPath); + } + } + + /** 자식 요소 삭제후 폴더 삭제 */ + public static void deleteFolder(String parentPath) throws Exception { + File file = new File(parentPath); + String[] fnameList = file.list(); + int fCnt = fnameList.length; + String childPath = ""; + + for(int i = 0; i < fCnt; i++) { + childPath = parentPath+"/"+fnameList[i]; + File f = new File(childPath); + if( ! f.isDirectory()) { + f.delete(); //파일이면 바로 삭제 + } else { + deleteFolder(childPath); + } + } + + File f = new File(parentPath); + f.delete(); //폴더는 맨 나중에 삭제 + } + + + /** 파일 등록*/ + public static void multipartFileUpload(MultipartFile mf, String fileDir, String fileName) { + + File dir = new File(fileDir); + if (!dir.isDirectory()) { + dir.mkdirs(); + } + if (mf != null && !mf.getOriginalFilename().equals("")) { + + //본래 파일명 + String originalfileName = mf.getOriginalFilename(); + System.out.println("원래 이름" + originalfileName); + //저장되는 파일 이름 + if (!originalfileName.equals("")) { + File uploadFile = new File(fileDir+"/"+fileName); + try { + //파일 저장 + mf.transferTo(uploadFile); + } catch (IllegalStateException | IOException e) { + e.printStackTrace(); + } + } + + }//end if + + } + + +} diff --git a/src/main/java/com/loglog/api/commons/utils/HttpUtil.java b/src/main/java/com/loglog/api/commons/utils/HttpUtil.java new file mode 100644 index 0000000..619aefe --- /dev/null +++ b/src/main/java/com/loglog/api/commons/utils/HttpUtil.java @@ -0,0 +1,180 @@ +package com.loglog.api.commons.utils; + +import java.io.BufferedInputStream; +import java.io.InputStream; +import java.io.OutputStream; +import java.net.HttpURLConnection; +import java.net.URL; +import java.net.URLEncoder; +import java.util.Iterator; + +import javax.servlet.http.HttpServletRequest; + +import org.apache.commons.lang3.StringUtils; +import org.json.JSONObject; + +import com.google.gson.Gson; + + +public class HttpUtil { + + + /** + * 객체를 JSON 문자열로 POST 방식으로 전송한다. + * @param url + * @param object + */ + public static void sendObject2Json(String url, Object object) { + + try { + URL u = new URL(url); + HttpURLConnection httpCon = (HttpURLConnection) u.openConnection(); + httpCon.setRequestProperty("Content-Type", "application/json; charset=EUC-KR"); + httpCon.setDoOutput(true); + httpCon.setDoInput(true); + httpCon.setRequestMethod("POST"); + OutputStream raw = httpCon.getOutputStream(); + //OutputStream buffered = new BufferedOutputStream(raw); + //OutputStreamWriter out = new OutputStreamWriter(buffered,"UTF-8"); + //OutputStreamWriter out = new OutputStreamWriter(buffered); + //Object -> JSON + String jsonStr = new Gson().toJson(object); + System.out.println("ready to send : " + url); + System.out.println("converted json data: \n" + jsonStr); + //전송 + raw.write(jsonStr.getBytes("EUC-KR")); + raw.flush(); + raw.close(); + + // read the response + System.out.println(httpCon.getResponseCode()); + System.out.println(httpCon.getResponseMessage()); + + InputStream in = new BufferedInputStream(httpCon.getInputStream()); + String result = org.apache.commons.io.IOUtils.toString(in, "UTF-8"); + System.out.println(result); + in.close(); + httpCon.disconnect(); + + } catch(Exception e) { + e.printStackTrace(); + } + + } + + /** + * 객체를 GET 파라미터 형식의 POST 방식으로 전송한다. + * @param url + * @param object + */ + public static void sendObject2Post(String url, Object object) { + + try { + URL u = new URL(url); + HttpURLConnection httpCon = (HttpURLConnection) u.openConnection(); + httpCon.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); + httpCon.setDoOutput(true); + httpCon.setDoInput(true); + httpCon.setRequestMethod("POST"); + OutputStream raw = httpCon.getOutputStream(); + //OutputStream buffered = new BufferedOutputStream(raw); + //OutputStreamWriter out = new OutputStreamWriter(buffered,"UTF-8"); + //OutputStreamWriter out = new OutputStreamWriter(buffered); + //Object -> JSON + String jsonStr = new Gson().toJson(object); + System.out.println("ready to send : " + url); + System.out.println("converted json data: \n" + jsonStr); + + StringBuilder sb = new StringBuilder(); + JSONObject json = new JSONObject(jsonStr); + Iterator keys = json.keys(); + //sb.append("?"); //start of query args + while (keys.hasNext()) { + String key = keys.next(); + sb.append(key); + sb.append("="); + sb.append( URLEncoder.encode((String)json.get(key), "EUC-KR") ); + sb.append("&"); //To allow for another argument. + } + String queryStr = sb.toString(); + + System.out.println( "json to query :" + queryStr ); + + //전송 + raw.write(queryStr.getBytes("EUC-KR")); + raw.flush(); + raw.close(); + + // read the response + System.out.println(httpCon.getResponseCode()); + System.out.println(httpCon.getResponseMessage()); + + InputStream in = new BufferedInputStream(httpCon.getInputStream()); + String result = org.apache.commons.io.IOUtils.toString(in, "UTF-8"); + System.out.println(result); + in.close(); + httpCon.disconnect(); + + } catch(Exception e) { + e.printStackTrace(); + } + + } + + + /** + * 객체를 GET 파라미터 형식의 POST 방식으로 전송한다. + * @param url + * @param object + */ + public static void send2PostOrderId(String url, String moduleId, String orderId, String userId) { + + try { + URL u = new URL(url); + HttpURLConnection httpCon = (HttpURLConnection) u.openConnection(); + httpCon.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); + httpCon.setDoOutput(true); + httpCon.setDoInput(true); + httpCon.setRequestMethod("POST"); + OutputStream raw = httpCon.getOutputStream(); + System.out.println("ready to send : " + url); + + String queryStr = "moduleId=" + moduleId + "&" + "orderId=" + orderId + "&" + "userId=" + userId; + + System.out.println( "json to query :" + queryStr ); + + //전송 + raw.write(queryStr.getBytes("EUC-KR")); + raw.flush(); + raw.close(); + + // read the response + System.out.println(httpCon.getResponseCode()); + System.out.println(httpCon.getResponseMessage()); + + InputStream in = new BufferedInputStream(httpCon.getInputStream()); + String result = org.apache.commons.io.IOUtils.toString(in, "UTF-8"); + System.out.println(result); + in.close(); + httpCon.disconnect(); + + } catch(Exception e) { + e.printStackTrace(); + } + + } + + + /** 클라이언트 ip 추출 + PROXY SERVER 또는 LOAD BALANCER를 거치는 경우 ip가 접속하기 직전의 ip로 들어오게 된다. + PROXY SERVER 또는 LOAD BALANCER를 거칠 경우 reuqest header의 HTTP_X_FORWARDED_FOR 키워드에 정보를 남김으로 + 먼저 확인 후 없을 경우 request.getRemoteAddr()로 ip를 추출한다. */ + public static String getClientIp(HttpServletRequest request) throws Exception { + String ip = request.getHeader("HTTP_X_FORWARDED_FOR"); + if ( StringUtils.isEmpty( ip ) ) { + ip = request.getRemoteAddr(); + } + return ip; + } + +}//end class \ No newline at end of file diff --git a/src/main/java/com/loglog/api/commons/utils/JwtTokenHelper.java b/src/main/java/com/loglog/api/commons/utils/JwtTokenHelper.java new file mode 100644 index 0000000..43dc195 --- /dev/null +++ b/src/main/java/com/loglog/api/commons/utils/JwtTokenHelper.java @@ -0,0 +1,110 @@ +package com.loglog.api.commons.utils; + +import java.security.Key; +import java.util.Date; + +import javax.crypto.spec.SecretKeySpec; +import javax.xml.bind.DatatypeConverter; + +import io.jsonwebtoken.Claims; +import io.jsonwebtoken.ExpiredJwtException; +import io.jsonwebtoken.Jws; +import io.jsonwebtoken.JwtBuilder; +import io.jsonwebtoken.Jwts; +import io.jsonwebtoken.MalformedJwtException; +import io.jsonwebtoken.SignatureAlgorithm; +import io.jsonwebtoken.SignatureException; +import io.jsonwebtoken.UnsupportedJwtException; + + +/** + * Provides static methods for creating and verifying access tokens and such. + * JWT 토큰을 생성하고 검증하는 클래스 + * + * @author SJW + * @version 1.0 + * @since 2015-11-03 + * + * @see https://stormpath.com/blog/jwt-java-create-verify/ + * @see https://github.com/jwtk/jjwt + */ +public class JwtTokenHelper { + + public static final String SUBJECT_SNS_URL = "forSnSUrl"; + public static final String SUBJECT_LOGIN = "forLogined"; + public static final String SUBJECT_COUPON = "forCoupon"; + public static final String SUBJECT_AUTH_EMAIL = "forAuthEmail"; + + public static final String ISSUER = "AnissSoft"; + + private static final String SIGNING_KEY = "LongAndHardToGuessValueWithSpecialCharacters@^($%*$%"; + public static String AUDIENCE; + + + public static String createJWT(String id, String issuer, String subject, long ttlMillis) { + + //The JWT signature algorithm we will be using to sign the token + SignatureAlgorithm signatureAlgorithm = SignatureAlgorithm.HS256; + + long nowMillis = System.currentTimeMillis(); + Date now = new Date(nowMillis); + + //We will sign our JWT with our ApiKey secret + byte[] apiKeySecretBytes = DatatypeConverter.parseBase64Binary(SIGNING_KEY); + Key signingKey = new SecretKeySpec(apiKeySecretBytes, signatureAlgorithm.getJcaName()); + + //Let's set the JWT Claims + JwtBuilder builder = Jwts.builder().setId(id) + .setIssuedAt(now) + .setSubject(subject) + .setIssuer(issuer) + .signWith(signatureAlgorithm, signingKey); + + //if it has been specified, let's add the expiration + if (ttlMillis >= 0) { + long expMillis = nowMillis + ttlMillis; + Date exp = new Date(expMillis); + builder.setExpiration(exp); + } + + //Builds the JWT and serializes it to a compact, URL-safe string + return builder.compact(); + } + + + //Sample method to validate and read the JWT + public static Claims parseJWT(String token) { + //This line will throw an exception if it is not a signed JWS (as expected) + Claims claims = Jwts.parser() + .setSigningKey(DatatypeConverter.parseBase64Binary(SIGNING_KEY)) + .parseClaimsJws(token).getBody(); + System.out.println("ID: " + claims.getId()); + System.out.println("Subject: " + claims.getSubject()); + System.out.println("Issuer: " + claims.getIssuer()); + System.out.println("Expiration: " + claims.getExpiration()); + + return claims; + } + + + /** + * Parses and validates JWT Token signature. + * + * @throws BadCredentialsException + * @throws JwtExpiredTokenException + * + */ + public static Jws parseClaims(String token) { + try { + return Jwts.parser().setSigningKey(DatatypeConverter.parseBase64Binary(SIGNING_KEY)).parseClaimsJws(token); + } catch (UnsupportedJwtException | MalformedJwtException | IllegalArgumentException | SignatureException ex) { + //throw new JwtException("Invalid JWT token: ", ex); + throw ex; + } catch (ExpiredJwtException expiredEx) { + //throw new JwtException("JWT Token expired", expiredEx); + throw expiredEx; + } + } + + +} \ No newline at end of file diff --git a/src/main/java/com/loglog/api/commons/utils/SessionUtil.java b/src/main/java/com/loglog/api/commons/utils/SessionUtil.java new file mode 100644 index 0000000..d82706b --- /dev/null +++ b/src/main/java/com/loglog/api/commons/utils/SessionUtil.java @@ -0,0 +1,140 @@ +package com.loglog.api.commons.utils; + +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; + +import com.loglog.api.commons.beans.UserBean; +import com.loglog.api.commons.constants.Constants; + +/** + * 세션 Util + * + * @author SJG + */ +public class SessionUtil { + + /** + * 세션에서 adminBean을 제거한다 + */ + public static void removeAdminBean(HttpServletRequest request){ + request.getSession().removeAttribute(Constants.SESSION_ADMIN_BEAN); + } + + + /** + * 세션에서 sellerBean을 제거한다 + */ + public static void removeSellerBean(HttpServletRequest request){ + request.getSession().removeAttribute(Constants.SESSION_SELLER_BEAN); + } + + /** + * 세션에 userBean을 셋팅한다. + */ + public static void setUserBean(HttpServletRequest request, UserBean userBean){ + request.getSession().setAttribute(Constants.SESSION_USER_BEAN, userBean); + } + + /** + * 세션에서 userBean을 가져온다. + */ + public static UserBean getUserBean(HttpServletRequest request){ + return (UserBean)request.getSession().getAttribute(Constants.SESSION_USER_BEAN); + } + + /** + * 세션에서 userId를 가져온다. + */ + public static String getUserId(HttpServletRequest request){ + UserBean userBean = (UserBean)request.getSession().getAttribute(Constants.SESSION_USER_BEAN); + String userId = null; + if ( userBean != null ){ + userId = userBean.getUserPhone(); + } + return userId; + } + + /** + * 세션에서 userName를 가져온다. + */ + public static String getUserName(HttpServletRequest request){ + UserBean userBean = (UserBean)request.getSession().getAttribute(Constants.SESSION_USER_BEAN); + String userName = null; + if ( userBean != null ){ + userName = userBean.getUserNm(); + } + return userName; + } + + /** + * 세션에서 userBean을 제거한다 + */ + public static void removeUserBean(HttpServletRequest request){ + request.getSession().removeAttribute(Constants.SESSION_USER_BEAN); + } + + + /** + * 세션에서 orderBean을 제거한다 + */ + public static void removeOrderBean(HttpServletRequest request){ + request.getSession().removeAttribute(Constants.SESSION_ORDER_BEAN); + } + + /////// + /** + * 세션에 userBean을 셋팅한다. + */ + public static void setUpdateFlag(HttpServletRequest request, boolean updateFlag){ + request.getSession().setAttribute(Constants.UPDATE_FLAG, updateFlag); + } + + /** + * 세션에서 userBean을 가져온다. + */ + public static boolean getUpdateFlag(HttpServletRequest request){ + Object val = request.getSession().getAttribute(Constants.UPDATE_FLAG); + if(val == null) { + return false; + } + return (boolean) val; + } + + /** + * 세션에 공유자 아이디를 셋팅한다. TODO DELETE + */ + public static void setRecommenderId(HttpServletRequest request, String recommenderId){ + request.getSession().setAttribute(Constants.SESSION_RECOMMENDER_ID, recommenderId); + } + + /** + * 세션에서 공유자 아이디를 가져온다. TODO DELETE + */ + public static String getRecommenderId(HttpServletRequest request){ + return (String)request.getSession().getAttribute(Constants.SESSION_RECOMMENDER_ID); + } + + + /** + * 세션에 공유자 Map을 셋팅한다. + */ + public static void setSnsMap(HttpServletRequest request, Map snsMap){ + request.getSession().setAttribute(Constants.SESSION_SNS_MAP, snsMap); + } + + /** + * 세션에서 공유자 Map을 가져온다. + */ + public static Map getSnsMap(HttpServletRequest request){ + return (Map)request.getSession().getAttribute(Constants.SESSION_SNS_MAP); + } + + /** + * 세션에서 공유자 Map을 제거한다 + */ + public static void removeSnsMap(HttpServletRequest request){ + request.getSession().removeAttribute(Constants.SESSION_SNS_MAP); + } + +} diff --git a/src/main/java/com/loglog/api/commons/utils/UAgentInfo.java b/src/main/java/com/loglog/api/commons/utils/UAgentInfo.java new file mode 100644 index 0000000..a4ad327 --- /dev/null +++ b/src/main/java/com/loglog/api/commons/utils/UAgentInfo.java @@ -0,0 +1,1313 @@ +/* ******************************************* +// Copyright 2010-2015, Anthony Hand +// +// +// File version 2015.05.13 (May 13, 2015) +// Updates: +// - Moved MobileESP to GitHub. https://github.com/ahand/mobileesp +// - Opera Mobile/Mini browser has the same UA string on multiple platforms and doesn't differentiate phone vs. tablet. +// - Removed DetectOperaAndroidPhone(). This method is no longer reliable. +// - Removed DetectOperaAndroidTablet(). This method is no longer reliable. +// - Added support for Windows Phone 10: variable and DetectWindowsPhone10() +// - Updated DetectWindowsPhone() to include WP10. +// - Added support for Firefox OS. +// - A variable plus DetectFirefoxOS(), DetectFirefoxOSPhone(), DetectFirefoxOSTablet() +// - NOTE: Firefox doesn't add UA tokens to definitively identify Firefox OS vs. their browsers on other mobile platforms. +// - Added support for Sailfish OS. Not enough info to add a tablet detection method at this time. +// - A variable plus DetectSailfish(), DetectSailfishPhone() +// - Added support for Ubuntu Mobile OS. +// - DetectUbuntu(), DetectUbuntuPhone(), DetectUbuntuTablet() +// - Added support for 2 smart TV OSes. They lack browsers but do have WebViews for use by HTML apps. +// - One variable for Samsung Tizen TVs, plus DetectTizenTV() +// - One variable for LG WebOS TVs, plus DetectWebOSTV() +// - Updated DetectTizen(). Now tests for "mobile" to disambiguate from Samsung Smart TVs +// - Removed variables for obsolete devices: deviceHtcFlyer, deviceXoom. +// - Updated DetectAndroid(). No longer has a special test case for the HTC Flyer tablet. +// - Updated DetectAndroidPhone(). +// - Updated internal detection code for Android. +// - No longer has a special test case for the HTC Flyer tablet. +// - Checks against DetectOperaMobile() on Android and reports here if relevant. +// - Updated DetectAndroidTablet(). +// - No longer has a special test case for the HTC Flyer tablet. +// - Checks against DetectOperaMobile() on Android to exclude it from here. +// - DetectMeego(): Changed definition for this method. Now detects any Meego OS device, not just phones. +// - DetectMeegoPhone(): NEW. For Meego phones. Ought to detect Opera browsers on Meego, as well. +// - DetectTierIphone(): Added support for phones running Sailfish, Ubuntu and Firefox Mobile. +// - DetectTierTablet(): Added support for tablets running Ubuntu and Firefox Mobile. +// - DetectSmartphone(): Added support for Meego phones. +// - Refactored the detection logic in DetectMobileQuick() and DetectMobileLong(). +// - Moved a few detection tests for older browsers to Long. +// +// +// +// LICENSE INFORMATION +// 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. +// +// +// ABOUT THIS PROJECT +// Project Owner: Anthony Hand +// Email: anthony.hand@gmail.com +// Web Site: http://www.mobileesp.com +// Source Files: https://github.com/ahand/mobileesp +// +// Versions of this code are available for: +// PHP, JavaScript, Java, ASP.NET (C#), and Ruby +// +// ******************************************* + */ +package com.loglog.api.commons.utils; + +/** + * The DetectSmartPhone class encapsulates information about + * a browser's connection to your web site. + * You can use it to find out whether the browser asking for + * your site's content is probably running on a mobile device. + * The methods were written so you can be as granular as you want. + * For example, enquiring whether it's as specific as an iPod Touch or + * as general as a smartphone class device. + * The object's methods return true, or false. + */ +public class UAgentInfo { + // User-Agent and Accept HTTP request headers + + private String userAgent = ""; + private String httpAccept = ""; + + // Let's store values for quickly accessing the same info multiple times. + public boolean initCompleted = false; + public boolean isWebkit = false; //Stores the result of DetectWebkit() + public boolean isMobilePhone = false; //Stores the result of DetectMobileQuick() + public boolean isIphone = false; //Stores the result of DetectIphone() + public boolean isAndroid = false; //Stores the result of DetectAndroid() + public boolean isAndroidPhone = false; //Stores the result of DetectAndroidPhone() + public boolean isTierTablet = false; //Stores the result of DetectTierTablet() + public boolean isTierIphone = false; //Stores the result of DetectTierIphone() + public boolean isTierRichCss = false; //Stores the result of DetectTierRichCss() + public boolean isTierGenericMobile = false; //Stores the result of DetectTierOtherPhones() + + // Initialize some initial smartphone string variables. + public static final String engineWebKit = "webkit"; + + public static final String deviceIphone = "iphone"; + public static final String deviceIpod = "ipod"; + public static final String deviceIpad = "ipad"; + public static final String deviceMacPpc = "macintosh"; //Used for disambiguation + + public static final String deviceAndroid = "android"; + public static final String deviceGoogleTV = "googletv"; + + public static final String deviceWinPhone7 = "windows phone os 7"; + public static final String deviceWinPhone8 = "windows phone 8"; + public static final String deviceWinPhone10 = "windows phone 10"; + public static final String deviceWinMob = "windows ce"; + public static final String deviceWindows = "windows"; + public static final String deviceIeMob = "iemobile"; + public static final String devicePpc = "ppc"; //Stands for PocketPC + public static final String enginePie = "wm5 pie"; //An old Windows Mobile + + public static final String deviceBB = "blackberry"; + public static final String deviceBB10 = "bb10"; //For the new BB 10 OS + public static final String vndRIM = "vnd.rim"; //Detectable when BB devices emulate IE or Firefox + public static final String deviceBBStorm = "blackberry95"; //Storm 1 and 2 + public static final String deviceBBBold = "blackberry97"; //Bold 97x0 (non-touch) + public static final String deviceBBBoldTouch = "blackberry 99"; //Bold 99x0 (touchscreen) + public static final String deviceBBTour = "blackberry96"; //Tour + public static final String deviceBBCurve = "blackberry89"; //Curve 2 + public static final String deviceBBCurveTouch = "blackberry 938"; //Curve Touch 9380 + public static final String deviceBBTorch = "blackberry 98"; //Torch + public static final String deviceBBPlaybook = "playbook"; //PlayBook tablet + + public static final String deviceSymbian = "symbian"; + public static final String deviceS60 = "series60"; + public static final String deviceS70 = "series70"; + public static final String deviceS80 = "series80"; + public static final String deviceS90 = "series90"; + + public static final String devicePalm = "palm"; + public static final String deviceWebOS = "webos"; //For Palm devices + public static final String deviceWebOStv = "web0s"; //For LG TVs + public static final String deviceWebOShp = "hpwos"; //For HP's line of WebOS devices + + public static final String deviceNuvifone = "nuvifone"; //Garmin Nuvifone + public static final String deviceBada = "bada"; //Samsung's Bada OS + public static final String deviceTizen = "tizen"; //Tizen OS + public static final String deviceMeego = "meego"; //Meego OS + public static final String deviceSailfish = "sailfish"; //Sailfish OS + public static final String deviceUbuntu = "ubuntu"; //Ubuntu Mobile OS + + public static final String deviceKindle = "kindle"; //Amazon Kindle, eInk one + public static final String engineSilk = "silk-accelerated"; //Amazon's accelerated Silk browser for Kindle Fire + + public static final String engineBlazer = "blazer"; //Old Palm + public static final String engineXiino = "xiino"; //Another old Palm + + //Initialize variables for mobile-specific content. + public static final String vndwap = "vnd.wap"; + public static final String wml = "wml"; + + //Initialize variables for other random devices and mobile browsers. + public static final String deviceTablet = "tablet"; //Generic term for slate and tablet devices + public static final String deviceBrew = "brew"; + public static final String deviceDanger = "danger"; + public static final String deviceHiptop = "hiptop"; + public static final String devicePlaystation = "playstation"; + public static final String devicePlaystationVita = "vita"; + public static final String deviceNintendoDs = "nitro"; + public static final String deviceNintendo = "nintendo"; + public static final String deviceWii = "wii"; + public static final String deviceXbox = "xbox"; + public static final String deviceArchos = "archos"; + + public static final String engineFirefox = "firefox"; //For Firefox OS + public static final String engineOpera = "opera"; //Popular browser + public static final String engineNetfront = "netfront"; //Common embedded OS browser + public static final String engineUpBrowser = "up.browser"; //common on some phones + public static final String engineOpenWeb = "openweb"; //Transcoding by OpenWave server + public static final String deviceMidp = "midp"; //a mobile Java technology + public static final String uplink = "up.link"; + public static final String engineTelecaQ = "teleca q"; //a modern feature phone browser + public static final String devicePda = "pda"; //some devices report themselves as PDAs + public static final String mini = "mini"; //Some mobile browsers put "mini" in their names. + public static final String mobile = "mobile"; //Some mobile browsers put "mobile" in their user agent strings. + public static final String mobi = "mobi"; //Some mobile browsers put "mobi" in their user agent strings. + + //Smart TV strings + public static final String smartTV1 = "smart-tv"; //Samsung Tizen smart TVs + public static final String smartTV2 = "smarttv"; //LG WebOS smart TVs + + //Use Maemo, Tablet, and Linux to test for Nokia"s Internet Tablets. + public static final String maemo = "maemo"; + public static final String linux = "linux"; + public static final String qtembedded = "qt embedded"; //for Sony Mylo + public static final String mylocom2 = "com2"; //for Sony Mylo also + + //In some UserAgents, the only clue is the manufacturer. + public static final String manuSonyEricsson = "sonyericsson"; + public static final String manuericsson = "ericsson"; + public static final String manuSamsung1 = "sec-sgh"; + public static final String manuSony = "sony"; + public static final String manuHtc = "htc"; //Popular Android and WinMo manufacturer + + //In some UserAgents, the only clue is the operator. + public static final String svcDocomo = "docomo"; + public static final String svcKddi = "kddi"; + public static final String svcVodafone = "vodafone"; + + //Disambiguation strings. + public static final String disUpdate = "update"; //pda vs. update + + + public UAgentInfo() { + + } + + /** + * Initialize the userAgent and httpAccept variables + * + * @param userAgent the User-Agent header + * @param httpAccept the Accept header + */ + public UAgentInfo(String userAgent, String httpAccept) { + setUAgentInfo(userAgent, httpAccept); + } + + public void setUAgentInfo(String userAgent, String httpAccept) { + if (userAgent != null) { + this.userAgent = userAgent.toLowerCase(); + } + if (httpAccept != null) { + this.httpAccept = httpAccept.toLowerCase(); + } + + //Intialize key stored values. + initDeviceScan(); + } + + /** + * Return the lower case HTTP_USER_AGENT + * @return userAgent + */ + public String getUserAgent() { + return userAgent; + } + + /** + * Return the lower case HTTP_ACCEPT + * @return httpAccept + */ + public String getHttpAccept() { + return httpAccept; + } + + /** + * Return whether the device is an Iphone or iPod Touch + * @return isIphone + */ + public boolean getIsIphone() { + return isIphone; + } + + /** + * Return whether the device is in the Tablet Tier. + * @return isTierTablet + */ + public boolean getIsTierTablet() { + return isTierTablet; + } + + /** + * Return whether the device is in the Iphone Tier. + * @return isTierIphone + */ + public boolean getIsTierIphone() { + return isTierIphone; + } + + /** + * Return whether the device is in the 'Rich CSS' tier of mobile devices. + * @return isTierRichCss + */ + public boolean getIsTierRichCss() { + return isTierRichCss; + } + + /** + * Return whether the device is a generic, less-capable mobile device. + * @return isTierGenericMobile + */ + public boolean getIsTierGenericMobile() { + return isTierGenericMobile; + } + + /** + * Initialize Key Stored Values. + */ + public void initDeviceScan() { + //Save these properties to speed processing + this.isWebkit = detectWebkit(); + this.isIphone = detectIphone(); + this.isAndroid = detectAndroid(); + this.isAndroidPhone = detectAndroidPhone(); + + //Generally, these tiers are the most useful for web development + this.isMobilePhone = detectMobileQuick(); + this.isTierTablet = detectTierTablet(); + this.isTierIphone = detectTierIphone(); + + //Optional: Comment these out if you NEVER use them + this.isTierRichCss = detectTierRichCss(); + this.isTierGenericMobile = detectTierOtherPhones(); + + this.initCompleted = true; + } + + /** + * Detects if the current device is an iPhone. + * @return detection of an iPhone + */ + public boolean detectIphone() { + // The iPad and iPod touch say they're an iPhone! So let's disambiguate. + if (userAgent.indexOf(deviceIphone) != -1 && + !detectIpad() && + !detectIpod()) { + return true; + } + return false; + } + + /** + * Detects if the current device is an iPod Touch. + * @return detection of an iPod Touch + */ + public boolean detectIpod() { + if (userAgent.indexOf(deviceIpod) != -1) { + return true; + } + return false; + } + + /** + * Detects if the current device is an iPad tablet. + * @return detection of an iPad + */ + public boolean detectIpad() { + if (userAgent.indexOf(deviceIpad) != -1 + && detectWebkit()) { + return true; + } + return false; + } + + /** + * Detects if the current device is an iPhone or iPod Touch. + * @return detection of an iPhone or iPod Touch + */ + public boolean detectIphoneOrIpod() { + //We repeat the searches here because some iPods may report themselves as an iPhone, which would be okay. + if (userAgent.indexOf(deviceIphone) != -1 + || userAgent.indexOf(deviceIpod) != -1) { + return true; + } + return false; + } + + /** + * Detects *any* iOS device: iPhone, iPod Touch, iPad. + * @return detection of an Apple iOS device + */ + public boolean detectIos() { + if (detectIphoneOrIpod() || detectIpad()) { + return true; + } + return false; + } + + + /** + * Detects *any* Android OS-based device: phone, tablet, and multi-media player. + * Also detects Google TV. + * @return detection of an Android device + */ + public boolean detectAndroid() { + if ((userAgent.indexOf(deviceAndroid) != -1) || + detectGoogleTV()) + return true; + + return false; + } + + /** + * Detects if the current device is a (small-ish) Android OS-based device + * used for calling and/or multi-media (like a Samsung Galaxy Player). + * Google says these devices will have 'Android' AND 'mobile' in user agent. + * Ignores tablets (Honeycomb and later). + * @return detection of an Android phone + */ + public boolean detectAndroidPhone() { + //First, let's make sure we're on an Android device. + if (!detectAndroid()) + return false; + + //If it's Android and has 'mobile' in it, Google says it's a phone. + if (userAgent.indexOf(mobile) != -1) + return true; + + //Special check for Android devices with Opera Mobile/Mini. They should report here. + if (detectOperaMobile()) + return true; + + return false; + } + + /** + * Detects if the current device is a (self-reported) Android tablet. + * Google says these devices will have 'Android' and NOT 'mobile' in their user agent. + * @return detection of an Android tablet + */ + public boolean detectAndroidTablet() { + //First, let's make sure we're on an Android device. + if (!detectAndroid()) + return false; + + //Special check for Android devices with Opera Mobile/Mini. They should NOT report here. + if (detectOperaMobile()) + return false; + + //Otherwise, if it's Android and does NOT have 'mobile' in it, Google says it's a tablet. + if ((userAgent.indexOf(mobile) > -1)) + return false; + else + return true; + } + + /** + * Detects if the current device is an Android OS-based device and + * the browser is based on WebKit. + * @return detection of an Android WebKit browser + */ + public boolean detectAndroidWebKit() { + if (detectAndroid() && detectWebkit()) { + return true; + } + return false; + } + + /** + * Detects if the current device is a GoogleTV. + * @return detection of GoogleTV + */ + public boolean detectGoogleTV() { + if (userAgent.indexOf(deviceGoogleTV) != -1) { + return true; + } + return false; + } + + /** + * Detects if the current browser is based on WebKit. + * @return detection of a WebKit browser + */ + public boolean detectWebkit() { + if (userAgent.indexOf(engineWebKit) != -1) { + return true; + } + return false; + } + + /** + * Detects if the current browser is the Symbian S60 Open Source Browser. + * @return detection of Symbian S60 Browser + */ + public boolean detectS60OssBrowser() { + //First, test for WebKit, then make sure it's either Symbian or S60. + if (detectWebkit() + && (userAgent.indexOf(deviceSymbian) != -1 + || userAgent.indexOf(deviceS60) != -1)) { + return true; + } + return false; + } + + /** + * + * Detects if the current device is any Symbian OS-based device, + * including older S60, Series 70, Series 80, Series 90, and UIQ, + * or other browsers running on these devices. + * @return detection of SymbianOS + */ + public boolean detectSymbianOS() { + if (userAgent.indexOf(deviceSymbian) != -1 + || userAgent.indexOf(deviceS60) != -1 + || userAgent.indexOf(deviceS70) != -1 + || userAgent.indexOf(deviceS80) != -1 + || userAgent.indexOf(deviceS90) != -1) { + return true; + } + return false; + } + + /** + * Detects if the current browser is a Windows Phone 7.x, 8, or 10 device + * @return detection of Windows Phone 7.x OR 8 + */ + public boolean detectWindowsPhone() { + if (detectWindowsPhone7() + || detectWindowsPhone8() + || detectWindowsPhone10()) { + return true; + } + return false; + } + + /** + * Detects a Windows Phone 7 device (in mobile browsing mode). + * @return detection of Windows Phone 7 + */ + public boolean detectWindowsPhone7() { + if (userAgent.indexOf(deviceWinPhone7) != -1) { + return true; + } + return false; + } + + /** + * Detects a Windows Phone 8 device (in mobile browsing mode). + * @return detection of Windows Phone 8 + */ + public boolean detectWindowsPhone8() { + if (userAgent.indexOf(deviceWinPhone8) != -1) { + return true; + } + return false; + } + + /** + * Detects a Windows Phone 10 device (in mobile browsing mode). + * @return detection of Windows Phone 10 + */ + public boolean detectWindowsPhone10() { + if (userAgent.indexOf(deviceWinPhone10) != -1) { + return true; + } + return false; + } + + /** + * Detects if the current browser is a Windows Mobile device. + * Excludes Windows Phone 7.x and 8 devices. + * Focuses on Windows Mobile 6.xx and earlier. + * @return detection of Windows Mobile + */ + public boolean detectWindowsMobile() { + if (detectWindowsPhone()) { + return false; + } + //Most devices use 'Windows CE', but some report 'iemobile' + // and some older ones report as 'PIE' for Pocket IE. + // We also look for instances of HTC and Windows for many of their WinMo devices. + if (userAgent.indexOf(deviceWinMob) != -1 + || userAgent.indexOf(deviceWinMob) != -1 + || userAgent.indexOf(deviceIeMob) != -1 + || userAgent.indexOf(enginePie) != -1 + || (userAgent.indexOf(manuHtc) != -1 && userAgent.indexOf(deviceWindows) != -1) + || (detectWapWml() && userAgent.indexOf(deviceWindows) != -1)) { + return true; + } + + //Test for Windows Mobile PPC but not old Macintosh PowerPC. + if (userAgent.indexOf(devicePpc) != -1 && + !(userAgent.indexOf(deviceMacPpc) != -1)) + return true; + + return false; + } + + /** + * Detects if the current browser is any BlackBerry. + * Includes BB10 OS, but excludes the PlayBook. + * @return detection of Blackberry + */ + public boolean detectBlackBerry() { + if (userAgent.indexOf(deviceBB) != -1 || + httpAccept.indexOf(vndRIM) != -1) + return true; + + if (detectBlackBerry10Phone()) + return true; + + return false; + } + + /** + * Detects if the current browser is a BlackBerry 10 OS phone. + * Excludes tablets. + * @return detection of a Blackberry 10 device + */ + public boolean detectBlackBerry10Phone() { + if (userAgent.indexOf(deviceBB10) != -1 && + userAgent.indexOf(mobile) != -1) { + return true; + } + return false; + } + + /** + * Detects if the current browser is on a BlackBerry tablet device. + * Example: PlayBook + * @return detection of a Blackberry Tablet + */ + public boolean detectBlackBerryTablet() { + if (userAgent.indexOf(deviceBBPlaybook) != -1) { + return true; + } + return false; + } + + /** + * Detects if the current browser is a BlackBerry device AND uses a + * WebKit-based browser. These are signatures for the new BlackBerry OS 6. + * Examples: Torch. Includes the Playbook. + * @return detection of a Blackberry device with WebKit browser + */ + public boolean detectBlackBerryWebKit() { + if (detectBlackBerry() && + userAgent.indexOf(engineWebKit) != -1) { + return true; + } + return false; + } + + /** + * Detects if the current browser is a BlackBerry Touch + * device, such as the Storm, Torch, and Bold Touch. Excludes the Playbook. + * @return detection of a Blackberry touchscreen device + */ + public boolean detectBlackBerryTouch() { + if (detectBlackBerry() && + (userAgent.indexOf(deviceBBStorm) != -1 || + userAgent.indexOf(deviceBBTorch) != -1 || + userAgent.indexOf(deviceBBBoldTouch) != -1 || + userAgent.indexOf(deviceBBCurveTouch) != -1 )) { + return true; + } + return false; + } + + /** + * Detects if the current browser is a BlackBerry device AND + * has a more capable recent browser. Excludes the Playbook. + * Examples, Storm, Bold, Tour, Curve2 + * Excludes the new BlackBerry OS 6 and 7 browser!! + * @return detection of a Blackberry device with a better browser + */ + public boolean detectBlackBerryHigh() { + //Disambiguate for BlackBerry OS 6 or 7 (WebKit) browser + if (detectBlackBerryWebKit()) + return false; + if (detectBlackBerry()) { + if (detectBlackBerryTouch() + || userAgent.indexOf(deviceBBBold) != -1 + || userAgent.indexOf(deviceBBTour) != -1 + || userAgent.indexOf(deviceBBCurve) != -1) { + return true; + } else { + return false; + } + } else { + return false; + } + } + + /** + * Detects if the current browser is a BlackBerry device AND + * has an older, less capable browser. + * Examples: Pearl, 8800, Curve1 + * @return detection of a Blackberry device with a poorer browser + */ + public boolean detectBlackBerryLow() { + if (detectBlackBerry()) { + //Assume that if it's not in the High tier, then it's Low + if (detectBlackBerryHigh() + || detectBlackBerryWebKit()) { + return false; + } else { + return true; + } + } else { + return false; + } + } + + /** + * Detects if the current browser is on a PalmOS device. + * @return detection of a PalmOS device + */ + public boolean detectPalmOS() { + //Most devices nowadays report as 'Palm', but some older ones reported as Blazer or Xiino. + if (userAgent.indexOf(devicePalm) != -1 + || userAgent.indexOf(engineBlazer) != -1 + || userAgent.indexOf(engineXiino) != -1) { + //Make sure it's not WebOS first + if (detectPalmWebOS()) { + return false; + } else { + return true; + } + } + return false; + } + + /** + * Detects if the current browser is on a Palm device + * running the new WebOS. + * @return detection of a Palm WebOS device + */ + public boolean detectPalmWebOS() { + if (userAgent.indexOf(deviceWebOS) != -1) { + return true; + } + return false; + } + + /** + * Detects if the current browser is on an HP tablet running WebOS. + * @return detection of an HP WebOS tablet + */ + public boolean detectWebOSTablet() { + if (userAgent.indexOf(deviceWebOShp) != -1 && + userAgent.indexOf(deviceTablet) != -1) { + return true; + } + return false; + } + + /** + * Detects if the current browser is on a WebOS smart TV. + * @return detection of a WebOS smart TV + */ + public boolean detectWebOSTV() { + if (userAgent.indexOf(deviceWebOStv) != -1 && + userAgent.indexOf(smartTV2) != -1) { + return true; + } + return false; + } + + /** + * Detects Opera Mobile or Opera Mini. + * @return detection of an Opera browser for a mobile device + */ + public boolean detectOperaMobile() { + if (userAgent.indexOf(engineOpera) != -1 + && (userAgent.indexOf(mini) != -1 + || userAgent.indexOf(mobi) != -1)) { + return true; + } + return false; + } + + /** + * Detects if the current device is an Amazon Kindle (eInk devices only). + * Note: For the Kindle Fire, use the normal Android methods. + * @return detection of a Kindle + */ + public boolean detectKindle() { + if (userAgent.indexOf(deviceKindle)!= -1 && + !detectAndroid()) { + return true; + } + return false; + } + + /** + * Detects if the current Amazon device is using the Silk Browser. + * Note: Typically used by the the Kindle Fire. + * @return detection of an Amazon Kindle Fire in Silk mode. + */ + public boolean detectAmazonSilk() { + if (userAgent.indexOf(engineSilk) != -1) { + return true; + } + return false; + } + + /** + * Detects if the current browser is a + * Garmin Nuvifone. + * @return detection of a Garmin Nuvifone + */ + public boolean detectGarminNuvifone() { + if (userAgent.indexOf(deviceNuvifone) != -1) { + return true; + } + return false; + } + + /** + * Detects a device running the Bada OS from Samsung. + * @return detection of a Bada device + */ + public boolean detectBada() { + if (userAgent.indexOf(deviceBada) != -1) { + return true; + } + return false; + } + + /** + * Detects a device running the Tizen smartphone OS. + * @return detection of a Tizen device + */ + public boolean detectTizen() { + if (userAgent.indexOf(deviceTizen) != -1 && + userAgent.indexOf(mobile) != -1) { + return true; + } + return false; + } + + /** + * Detects if the current browser is on a Tizen smart TV. + * @return detection of a Tizen smart TV + */ + public boolean detectTizenTV() { + if (userAgent.indexOf(deviceTizen) != -1 && + userAgent.indexOf(smartTV1) != -1) { + return true; + } + return false; + } + + /** + * Detects a device running the Meego OS. + * @return detection of a Meego device + */ + public boolean detectMeego() { + if (userAgent.indexOf(deviceMeego) != -1) { + return true; + } + return false; + } + + /** + * Detects a phone running the Meego OS. + * @return detection of a Meego phone + */ + public boolean detectMeegoPhone() { + if (userAgent.indexOf(deviceMeego) != -1 && + userAgent.indexOf(mobi) != -1) { + return true; + } + return false; + } + + /** + * Detects a mobile device (probably) running the Firefox OS. + * @return detection of a Firefox OS mobile device + */ + public boolean detectFirefoxOS() { + if (detectFirefoxOSPhone() || detectFirefoxOSTablet()) + return true; + + return false; + } + + /** + * Detects a phone (probably) running the Firefox OS. + * @return detection of a Firefox OS phone + */ + public boolean detectFirefoxOSPhone() { + //First, let's make sure we're NOT on another major mobile OS. + if (detectIos() + || detectAndroid() + || detectSailfish()) + return false; + + if ((userAgent.indexOf(engineFirefox) != -1) + && (userAgent.indexOf(mobile) != -1)) + return true; + + return false; + } + + /** + * Detects a tablet (probably) running the Firefox OS. + * @return detection of a Firefox OS tablet + */ + public boolean detectFirefoxOSTablet() { + //First, let's make sure we're NOT on another major mobile OS. + if (detectIos() + || detectAndroid() + || detectSailfish()) + return false; + + if ((userAgent.indexOf(engineFirefox) != -1) + && (userAgent.indexOf(deviceTablet) != -1)) + return true; + + return false; + } + + /** + * Detects a device running the Sailfish OS. + * @return detection of a Sailfish device + */ + public boolean detectSailfish() { + if (userAgent.indexOf(deviceSailfish) != -1) { + return true; + } + return false; + } + + /** + * Detects a phone running the Sailfish OS. + * @return detection of a Sailfish phone + */ + public boolean detectSailfishPhone() { + if (detectSailfish() && (userAgent.indexOf(mobile) != -1)) + return true; + + return false; + } + + /** + * Detects a mobile device running the Ubuntu Mobile OS. + * @return detection of an Ubuntu Mobile OS mobile device + */ + public boolean detectUbuntu() { + if (detectUbuntuPhone() || detectUbuntuTablet()) + return true; + + return false; + } + + /** + * Detects a phone running the Ubuntu Mobile OS. + * @return detection of an Ubuntu Mobile OS phone + */ + public boolean detectUbuntuPhone() { + if ((userAgent.indexOf(deviceUbuntu) != -1) + && (userAgent.indexOf(mobile) != -1)) + return true; + + return false; + } + + /** + * Detects a tablet running the Ubuntu Mobile OS. + * @return detection of an Ubuntu Mobile OS tablet + */ + public boolean detectUbuntuTablet() { + if ((userAgent.indexOf(deviceUbuntu) != -1) + && (userAgent.indexOf(deviceTablet) != -1)) + return true; + + return false; + } + + + /** + * Detects the Danger Hiptop device. + * @return detection of a Danger Hiptop + */ + public boolean detectDangerHiptop() { + if (userAgent.indexOf(deviceDanger) != -1 + || userAgent.indexOf(deviceHiptop) != -1) { + return true; + } + return false; + } + + /** + * Detects if the current browser is a Sony Mylo device. + * @return detection of a Sony Mylo device + */ + public boolean detectSonyMylo() { + if (userAgent.indexOf(manuSony) != -1 + && (userAgent.indexOf(qtembedded) != -1 + || userAgent.indexOf(mylocom2) != -1)) { + return true; + } + return false; + } + + /** + * Detects if the current device is on one of the Maemo-based Nokia Internet Tablets. + * @return detection of a Maemo OS tablet + */ + public boolean detectMaemoTablet() { + if (userAgent.indexOf(maemo) != -1) { + return true; + } else if (userAgent.indexOf(linux) != -1 + && userAgent.indexOf(deviceTablet) != -1 + && !detectWebOSTablet() + && !detectAndroid()) { + return true; + } + return false; + } + + /** + * Detects if the current device is an Archos media player/Internet tablet. + * @return detection of an Archos media player + */ + public boolean detectArchos() { + if (userAgent.indexOf(deviceArchos) != -1) { + return true; + } + return false; + } + + /** + * Detects if the current device is an Internet-capable game console. + * Includes many handheld consoles. + * @return detection of any Game Console + */ + public boolean detectGameConsole() { + if (detectSonyPlaystation() + || detectNintendo() + || detectXbox()) { + return true; + } + return false; + } + + /** + * Detects if the current device is a Sony Playstation. + * @return detection of Sony Playstation + */ + public boolean detectSonyPlaystation() { + if (userAgent.indexOf(devicePlaystation) != -1) { + return true; + } + return false; + } + + /** + * Detects if the current device is a handheld gaming device with + * a touchscreen and modern iPhone-class browser. Includes the Playstation Vita. + * @return detection of a handheld gaming device + */ + public boolean detectGamingHandheld() { + if ((userAgent.indexOf(devicePlaystation) != -1) && + (userAgent.indexOf(devicePlaystationVita) != -1)) { + return true; + } + return false; + } + + /** + * Detects if the current device is a Nintendo game device. + * @return detection of Nintendo + */ + public boolean detectNintendo() { + if (userAgent.indexOf(deviceNintendo) != -1 + || userAgent.indexOf(deviceWii) != -1 + || userAgent.indexOf(deviceNintendoDs) != -1) { + return true; + } + return false; + } + + /** + * Detects if the current device is a Microsoft Xbox. + * @return detection of Xbox + */ + public boolean detectXbox() { + if (userAgent.indexOf(deviceXbox) != -1) { + return true; + } + return false; + } + + /** + * Detects whether the device is a Brew-powered device. + * @return detection of a Brew device + */ + public boolean detectBrewDevice() { + if (userAgent.indexOf(deviceBrew) != -1) { + return true; + } + return false; + } + + /** + * Detects whether the device supports WAP or WML. + * @return detection of a WAP- or WML-capable device + */ + public boolean detectWapWml() { + if (httpAccept.indexOf(vndwap) != -1 + || httpAccept.indexOf(wml) != -1) { + return true; + } + return false; + } + + /** + * Detects if the current device supports MIDP, a mobile Java technology. + * @return detection of a MIDP mobile Java-capable device + */ + public boolean detectMidpCapable() { + if (userAgent.indexOf(deviceMidp) != -1 + || httpAccept.indexOf(deviceMidp) != -1) { + return true; + } + return false; + } + + + + //***************************** + // Device Classes + //***************************** + + /** + * Check to see whether the device is any device + * in the 'smartphone' category. + * @return detection of a general smartphone device + */ + public boolean detectSmartphone() { + //Exclude duplicates from TierIphone + return (detectTierIphone() + || detectS60OssBrowser() + || detectSymbianOS() + || detectWindowsMobile() + || detectBlackBerry() + || detectMeegoPhone() + || detectPalmOS()); + } + + /** + * Detects if the current device is a mobile device. + * This method catches most of the popular modern devices. + * Excludes Apple iPads and other modern tablets. + * @return detection of any mobile device using the quicker method + */ + public boolean detectMobileQuick() { + //Let's exclude tablets + if (isTierTablet) { + return false; + } + //Most mobile browsing is done on smartphones + if (detectSmartphone()) { + return true; + } + + //Catch-all for many mobile devices + if (userAgent.indexOf(mobile) != -1) { + return true; + } + + if (detectOperaMobile()) { + return true; + } + + //We also look for Kindle devices + if (detectKindle() + || detectAmazonSilk()) { + return true; + } + + if (detectWapWml() + || detectMidpCapable() + || detectBrewDevice()) { + return true; + } + + if ((userAgent.indexOf(engineNetfront) != -1) + || (userAgent.indexOf(engineUpBrowser) != -1)) { + return true; + } + + return false; + } + + /** + * The longer and more thorough way to detect for a mobile device. + * Will probably detect most feature phones, + * smartphone-class devices, Internet Tablets, + * Internet-enabled game consoles, etc. + * This ought to catch a lot of the more obscure and older devices, also -- + * but no promises on thoroughness! + * @return detection of any mobile device using the more thorough method + */ + public boolean detectMobileLong() { + if (detectMobileQuick() + || detectGameConsole()) { + return true; + } + + if (detectDangerHiptop() + || detectMaemoTablet() + || detectSonyMylo() + || detectArchos()) { + return true; + } + + if ((userAgent.indexOf(devicePda) != -1) && + (userAgent.indexOf(disUpdate) < 0)) //no index found + { + return true; + } + + //Detect older phones from certain manufacturers and operators. + if ((userAgent.indexOf(uplink) != -1) + || (userAgent.indexOf(engineOpenWeb) != -1) + || (userAgent.indexOf(manuSamsung1) != -1) + || (userAgent.indexOf(manuSonyEricsson) != -1) + || (userAgent.indexOf(manuericsson) != -1) + || (userAgent.indexOf(svcDocomo) != -1) + || (userAgent.indexOf(svcKddi) != -1) + || (userAgent.indexOf(svcVodafone) != -1)) + { + return true; + } + + return false; + } + + //***************************** + // For Mobile Web Site Design + //***************************** + + /** + * The quick way to detect for a tier of devices. + * This method detects for the new generation of + * HTML 5 capable, larger screen tablets. + * Includes iPad, Android (e.g., Xoom), BB Playbook, WebOS, etc. + * @return detection of any device in the Tablet Tier + */ + public boolean detectTierTablet() { + if (detectIpad() + || detectAndroidTablet() + || detectBlackBerryTablet() + || detectFirefoxOSTablet() + || detectUbuntuTablet() + || detectWebOSTablet()) { + return true; + } + return false; + } + + /** + * The quick way to detect for a tier of devices. + * This method detects for devices which can + * display iPhone-optimized web content. + * Includes iPhone, iPod Touch, Android, Windows Phone 7 and 8, BB10, WebOS, Playstation Vita, etc. + * @return detection of any device in the iPhone/Android/Windows Phone/BlackBerry/WebOS Tier + */ + public boolean detectTierIphone() { + if (detectIphoneOrIpod() + || detectAndroidPhone() + || detectWindowsPhone() + || detectBlackBerry10Phone() + || (detectBlackBerryWebKit() + && detectBlackBerryTouch()) + || detectPalmWebOS() + || detectBada() + || detectTizen() + || detectFirefoxOSPhone() + || detectSailfishPhone() + || detectUbuntuPhone() + || detectGamingHandheld()) { + return true; + } + return false; + } + + /** + * The quick way to detect for a tier of devices. + * This method detects for devices which are likely to be capable + * of viewing CSS content optimized for the iPhone, + * but may not necessarily support JavaScript. + * Excludes all iPhone Tier devices. + * @return detection of any device in the 'Rich CSS' Tier + */ + public boolean detectTierRichCss() { + boolean result = false; + //The following devices are explicitly ok. + //Note: 'High' BlackBerry devices ONLY + if (detectMobileQuick()) { + + //Exclude iPhone Tier and e-Ink Kindle devices. + if (!detectTierIphone() && !detectKindle()) { + + //The following devices are explicitly ok. + //Note: 'High' BlackBerry devices ONLY + //Older Windows 'Mobile' isn't good enough for iPhone Tier. + if (detectWebkit() + || detectS60OssBrowser() + || detectBlackBerryHigh() + || detectWindowsMobile() + || userAgent.indexOf(engineTelecaQ) != -1) { + result= true; + } // if detectWebkit() + } //if !detectTierIphone() + } //if detectMobileQuick() + return result; + } + + /** + * The quick way to detect for a tier of devices. + * This method detects for all other types of phones, + * but excludes the iPhone and RichCSS Tier devices. + * @return detection of a mobile device in the less capable tier + */ + public boolean detectTierOtherPhones() { + //Exclude devices in the other 2 categories + if (detectMobileLong() + && !detectTierIphone() + && !detectTierRichCss()) { + return true; + } + return false; + } +} diff --git a/src/main/java/com/loglog/api/config/CacheControlFilter.java b/src/main/java/com/loglog/api/config/CacheControlFilter.java new file mode 100644 index 0000000..7a9bc01 --- /dev/null +++ b/src/main/java/com/loglog/api/config/CacheControlFilter.java @@ -0,0 +1,39 @@ +package com.loglog.api.config; + +import java.io.IOException; + +import javax.servlet.Filter; +import javax.servlet.FilterChain; +import javax.servlet.FilterConfig; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletResponse; + +public class CacheControlFilter implements Filter { + + @Override + public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) + throws IOException, ServletException { + + HttpServletResponse resp = (HttpServletResponse) response; + resp.setHeader("Cache-Control", "no-store, no-cache, must-revalidate, max-age=0, post-check=0, pre-check=0"); + resp.setHeader("Pragma", "no-cache"); + + chain.doFilter(request, response); + } + + @Override + public void init(FilterConfig filterConfig) throws ServletException { + // TODO Auto-generated method stub + + } + + @Override + public void destroy() { + // TODO Auto-generated method stub + + } + + +} diff --git a/src/main/java/com/loglog/api/config/DataAccessConfig.java b/src/main/java/com/loglog/api/config/DataAccessConfig.java new file mode 100644 index 0000000..a9093d2 --- /dev/null +++ b/src/main/java/com/loglog/api/config/DataAccessConfig.java @@ -0,0 +1,50 @@ +package com.loglog.api.config; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +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.context.ApplicationContext; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.core.io.Resource; +import org.springframework.core.io.support.PathMatchingResourcePatternResolver; +import org.springframework.jdbc.datasource.DataSourceTransactionManager; +import org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy; +import org.springframework.transaction.PlatformTransactionManager; +import org.springframework.transaction.annotation.EnableTransactionManagement; + +@EnableTransactionManagement +@Configuration +@MapperScan(basePackages = "com.loglog.api.commons.daos") +public class DataAccessConfig { + + @Bean + public SqlSessionFactory sqlSessionFactory(LazyConnectionDataSourceProxy dataSource, ApplicationContext applicationContext) throws Exception { + SqlSessionFactoryBean sessionFactory = new SqlSessionFactoryBean(); + sessionFactory.setDataSource(dataSource); + + Resource[] mapperLocations = new PathMatchingResourcePatternResolver().getResources("classpath*:com/loglog/api/commons/daos/mapper/*.xml"); + List resourceList = new ArrayList<>(Arrays.asList(mapperLocations)); + + sessionFactory.setMapperLocations(resourceList.toArray(new Resource[0])); + return sessionFactory.getObject(); + } + + @Bean + public SqlSessionTemplate sqlSessionTemplate(SqlSessionFactory sqlSessionFactory) { + return new SqlSessionTemplate(sqlSessionFactory); + } + + @Bean + public PlatformTransactionManager transactionManager(LazyConnectionDataSourceProxy dataSource) { + DataSourceTransactionManager transactionManager = new DataSourceTransactionManager(); + transactionManager.setDataSource(dataSource); + return transactionManager; + } + +} \ No newline at end of file diff --git a/src/main/java/com/loglog/api/config/DataSourceConfig.java b/src/main/java/com/loglog/api/config/DataSourceConfig.java new file mode 100644 index 0000000..115a8cd --- /dev/null +++ b/src/main/java/com/loglog/api/config/DataSourceConfig.java @@ -0,0 +1,74 @@ +package com.loglog.api.config; + +import java.util.HashMap; +import java.util.Map; + +import javax.sql.DataSource; + +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.boot.jdbc.DataSourceBuilder; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.DependsOn; +import org.springframework.context.annotation.Primary; +import org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy; + +import com.zaxxer.hikari.HikariDataSource; + +import lombok.RequiredArgsConstructor; + + +//@Configuration(proxyBeanMethods = false) +@Configuration +@RequiredArgsConstructor +public class DataSourceConfig { + + public static final String MASTER_DATASOURCE = "masterDataSource"; + public static final String SLAVE_DATASOURCE = "slaveDataSource"; + + @Bean(MASTER_DATASOURCE) + @ConfigurationProperties(prefix = "spring.datasource.master.hikari") + public DataSource masterDataSource() { + HikariDataSource ds = DataSourceBuilder.create() + .type(HikariDataSource.class) + .build(); + ds.setReadOnly(false); + return ds; + } + + @Bean(SLAVE_DATASOURCE) + @ConfigurationProperties(prefix = "spring.datasource.slave.hikari") + public DataSource slaveDataSource() { + HikariDataSource ds = DataSourceBuilder.create() + .type(HikariDataSource.class) + .build(); + ds.setReadOnly(true); + return ds; + } + + @Bean + @Primary + @DependsOn({MASTER_DATASOURCE, SLAVE_DATASOURCE}) + public DataSource routingDataSource( + @Qualifier(MASTER_DATASOURCE) DataSource masterDataSource, + @Qualifier(SLAVE_DATASOURCE) DataSource slaveDataSource) { + + RoutingDataSource routingDataSource = new RoutingDataSource(); + + Map datasourceMap = new HashMap<>(); + datasourceMap.put("master", new LazyConnectionDataSourceProxy(masterDataSource)); + datasourceMap.put("slave", new LazyConnectionDataSourceProxy(slaveDataSource)); + + routingDataSource.setTargetDataSources(datasourceMap); + routingDataSource.setDefaultTargetDataSource(masterDataSource); + + return routingDataSource; + } + + @Bean + @DependsOn("routingDataSource") + public LazyConnectionDataSourceProxy dataSource(DataSource routingDataSource){ + return new LazyConnectionDataSourceProxy(routingDataSource); + } +} \ No newline at end of file diff --git a/src/main/java/com/loglog/api/config/ErrorMessage.java b/src/main/java/com/loglog/api/config/ErrorMessage.java new file mode 100644 index 0000000..03e0a1d --- /dev/null +++ b/src/main/java/com/loglog/api/config/ErrorMessage.java @@ -0,0 +1,37 @@ +package com.loglog.api.config; + +import java.util.Locale; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.MessageSource; +import org.springframework.context.annotation.Configuration; + + +@Configuration +public class ErrorMessage { + + private static final String PREFIX = "error."; + private static final String DEFAULT_MSG = "wtf"; + + @Autowired + private MessageSource messageSource; + + + public String getMsg(int code) { + + String ret = DEFAULT_MSG; + + try { + + ret = messageSource.getMessage(PREFIX + code, null, Locale.getDefault()); + if (ret == null) { + ret = DEFAULT_MSG; + } + + } catch (Exception ex) { + ret = DEFAULT_MSG; + } + + return ret; + } +} \ No newline at end of file diff --git a/src/main/java/com/loglog/api/config/RoutingDataSource.java b/src/main/java/com/loglog/api/config/RoutingDataSource.java new file mode 100644 index 0000000..84108db --- /dev/null +++ b/src/main/java/com/loglog/api/config/RoutingDataSource.java @@ -0,0 +1,20 @@ +package com.loglog.api.config; + +import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource; +import org.springframework.transaction.support.TransactionSynchronizationManager; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class RoutingDataSource extends AbstractRoutingDataSource { + private static final Logger LOG = LoggerFactory.getLogger(RoutingDataSource.class); + + @Override + protected Object determineCurrentLookupKey() { + boolean isReadOnly = TransactionSynchronizationManager.isCurrentTransactionReadOnly(); + String ms = isReadOnly ? "slave" : "master"; + LOG.debug("DB Connection isReadOnly::: " + isReadOnly + ", determineCurrentLookupKey::: " + ms); + return ms; + } + +} diff --git a/src/main/java/com/loglog/api/config/TaskScheduleConfig.java b/src/main/java/com/loglog/api/config/TaskScheduleConfig.java new file mode 100644 index 0000000..97f0674 --- /dev/null +++ b/src/main/java/com/loglog/api/config/TaskScheduleConfig.java @@ -0,0 +1,10 @@ +package com.loglog.api.config; + +import org.springframework.context.annotation.Configuration; +import org.springframework.scheduling.annotation.EnableScheduling; + +@Configuration +@EnableScheduling +public class TaskScheduleConfig { + +} diff --git a/src/main/java/com/loglog/api/config/WebMvcConfig.java b/src/main/java/com/loglog/api/config/WebMvcConfig.java new file mode 100644 index 0000000..5be5561 --- /dev/null +++ b/src/main/java/com/loglog/api/config/WebMvcConfig.java @@ -0,0 +1,132 @@ +package com.loglog.api.config; + +import java.util.Arrays; +import java.util.List; +import java.util.Properties; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.web.server.WebServerFactoryCustomizer; +import org.springframework.boot.web.servlet.FilterRegistrationBean; +import org.springframework.boot.web.servlet.server.ConfigurableServletWebServerFactory; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.core.Ordered; +import org.springframework.http.MediaType; +import org.springframework.http.converter.HttpMessageConverter; +import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; +import org.springframework.mail.javamail.JavaMailSender; +import org.springframework.mail.javamail.JavaMailSenderImpl; +import org.springframework.web.multipart.MultipartResolver; +import org.springframework.web.multipart.commons.CommonsMultipartResolver; +import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer; +import org.springframework.web.servlet.config.annotation.InterceptorRegistry; +import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; + +import com.google.gson.Gson; +import com.loglog.api.commons.filter.CORSFilter; +import com.loglog.api.config.intercepter.CommonInterceptor; +import com.loglog.api.config.intercepter.TokenCheckInterceptor; + + +@Configuration +public class WebMvcConfig implements WebMvcConfigurer { + + @Value("${version.build.date}") + private String versionBuildDate; + + @Value("${mail.id}") + private String mailId; + @Value("${mail.pw}") + private String mailPw; + + @Autowired + private CORSFilter cosFilter; + + + @Override + public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) { + configurer.enable(); + } + + @Bean + public FilterRegistrationBean getFilterRegistrationBean() { + + FilterRegistrationBean registrationBean = new FilterRegistrationBean<>(); + registrationBean.setFilter(cosFilter); + registrationBean.setOrder(Ordered.LOWEST_PRECEDENCE - 1); + registrationBean.addUrlPatterns("/*"); + return registrationBean; + } + + @Override + public void addResourceHandlers(ResourceHandlerRegistry registry) { + registry.addResourceHandler("/resources/**").addResourceLocations("/resources/"); + } + + @Bean + public WebServerFactoryCustomizer enableDefaultServlet() { + return (factory) -> factory.setRegisterDefaultServlet(true); + } + + @Override + public void configureMessageConverters(List> messageConverters) { + MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter(); + converter.setSupportedMediaTypes(Arrays.asList(MediaType.ALL)); + messageConverters.add(converter); + } + + @Override + public void addInterceptors(InterceptorRegistry registry) { + registry.addInterceptor(new CommonInterceptor(versionBuildDate)) + .addPathPatterns("/**"); + + //정상적인 로그인된 토큰을 체크하는 URL 정의 + registry.addInterceptor(new TokenCheckInterceptor()) + .addPathPatterns("/**") + .excludePathPatterns("/test/**") + .excludePathPatterns("/user/joinUserAjax") + .excludePathPatterns("/user/loginUserAjax") + .excludePathPatterns("resources/**") + .excludePathPatterns("up_imgs/board_img/**") + .excludePathPatterns("/up_files/**") + .excludePathPatterns("/card/CardListAjax*") + .excludePathPatterns("/user/qRLoginUserAjax") + ; + } + + @Bean + public JavaMailSender getJavaMailSender() { + JavaMailSenderImpl mailSender = new JavaMailSenderImpl(); + mailSender.setHost("smtp.gmail.com"); + mailSender.setPort(465); + mailSender.setDefaultEncoding("UTF-8"); + mailSender.setUsername(mailId); + mailSender.setPassword(mailPw); + + Properties props = mailSender.getJavaMailProperties(); + props.put("mail.transport.protocol", "smtp"); + props.put("mail.smtp.auth", "true"); + props.put("mail.smtp.starttls.enable", "true"); + props.put("mail.smtp.ssl.enable", "true"); + props.put("mail.debug", "true"); + props.put("mail.smtp.timeout", 300000); + + return mailSender; + } + + @Bean + public MultipartResolver configureMultipart() { + CommonsMultipartResolver resolver = new CommonsMultipartResolver(); + resolver.setMaxUploadSize(500000000); + return resolver; + } + + @Bean(name="gson") + public Gson gson() { + Gson gson = new Gson(); + return gson; + } + +} diff --git a/src/main/java/com/loglog/api/config/intercepter/CommonInterceptor.java b/src/main/java/com/loglog/api/config/intercepter/CommonInterceptor.java new file mode 100644 index 0000000..eca4e8c --- /dev/null +++ b/src/main/java/com/loglog/api/config/intercepter/CommonInterceptor.java @@ -0,0 +1,40 @@ +package com.loglog.api.config.intercepter; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.springframework.web.servlet.ModelAndView; +import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; + +import com.loglog.api.commons.constants.Constants; + + + + +public class CommonInterceptor extends HandlerInterceptorAdapter { + + private String VERSION_BUILD_DATE; + + public CommonInterceptor(String versionBuildDate) { + this.VERSION_BUILD_DATE = versionBuildDate; + } + + @Override + public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { + + request.getSession().setAttribute(Constants.VER_BUILD_DATE, VERSION_BUILD_DATE); + + return true; + } + + @Override + public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception { + + } + + @Override + public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception { + + } + +} \ No newline at end of file diff --git a/src/main/java/com/loglog/api/config/intercepter/TokenCheckInterceptor.java b/src/main/java/com/loglog/api/config/intercepter/TokenCheckInterceptor.java new file mode 100644 index 0000000..89df578 --- /dev/null +++ b/src/main/java/com/loglog/api/config/intercepter/TokenCheckInterceptor.java @@ -0,0 +1,105 @@ +package com.loglog.api.config.intercepter; + +import java.io.PrintWriter; +import java.util.Date; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.springframework.http.HttpHeaders; +import org.springframework.web.servlet.ModelAndView; +import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; + +import com.loglog.api.commons.constants.Constants; +import com.loglog.api.commons.utils.JwtTokenHelper; + +import io.jsonwebtoken.Claims; +import io.jsonwebtoken.ExpiredJwtException; +import io.jsonwebtoken.MalformedJwtException; +import io.jsonwebtoken.SignatureException; +import io.jsonwebtoken.UnsupportedJwtException; +import io.micrometer.core.instrument.util.StringUtils; + +public class TokenCheckInterceptor extends HandlerInterceptorAdapter { + + @Override + public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { + //return true; + //정상적인 토큰인지를 체크한다. + response.setContentType("application/json; charset=UTF-8"); + + String result = ""; + String resultMsg = ""; + String authToken = ""; + + String REQUEST_URL = request.getRequestURI(); + //String hostName = request.getHeader("Host"); + System.out.println(REQUEST_URL); + + if(REQUEST_URL.equals("/error")) { + result = Constants.FAIL; + resultMsg = "요청에 실패하였습니다."; + } else if(/**hostName.equals("/error") && */REQUEST_URL.equals("/main/requestSellerAjax")) { + result = Constants.OK; + } else { + result = Constants.FAIL; + resultMsg = "유효하지 않은 토큰 입니다."; + authToken = request.getHeader(HttpHeaders.AUTHORIZATION); + + if(StringUtils.isNotBlank(authToken)) { + authToken = authToken.replace("Bearer ", ""); + + System.out.println("TokenCheckInterceptor - 조회된 token: " + authToken); + + if( StringUtils.isNotEmpty(authToken) ) { + try { + Claims claims = JwtTokenHelper.parseClaims(authToken).getBody(); + String id = claims.getId(); + String issuer = claims.getIssuer(); + String subject = claims.getSubject(); + Date expiration = claims.getExpiration(); + + System.out.println("ID: " + id); + System.out.println("Issuer: " + issuer); + System.out.println("Subject: " + subject); + System.out.println("Expiration: " + expiration); + + result = Constants.OK; + resultMsg = "유효한 토큰 입니다."; + } catch (UnsupportedJwtException | MalformedJwtException | IllegalArgumentException | SignatureException ex) { + System.out.println(ex.getMessage()); + resultMsg = "토큰형식이 유효하지 않습니다."; + } catch (ExpiredJwtException expiredEx) { + System.out.println(expiredEx.getMessage()); + resultMsg = "유효기간이 만료된 토큰 입니다."; + } + } + } + } + + if(result.equals(Constants.OK)) { + return true; + } else { + PrintWriter writer = response.getWriter(); + + String jsonMsg = "{\"" + Constants.RESULT + "\" : \"" + result + "\", \"" + Constants.RESULT_MSG + "\" : \"" + resultMsg + "\" , \"" + Constants.AUTH_TOKEN + "\" : \"" + authToken + "\"}"; + response.sendError(401, jsonMsg); + writer.write(jsonMsg); + writer.flush(); + writer.close(); + return false; + } + + } + + @Override + public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception { + + } + + @Override + public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception { + + } + +} \ No newline at end of file diff --git a/src/main/java/com/loglog/api/controller/board/BoardController.java b/src/main/java/com/loglog/api/controller/board/BoardController.java new file mode 100644 index 0000000..4aa7d7f --- /dev/null +++ b/src/main/java/com/loglog/api/controller/board/BoardController.java @@ -0,0 +1,747 @@ +package com.loglog.api.controller.board; + + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; + +import org.apache.commons.lang3.ArrayUtils; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.MediaType; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.validation.BindingResult; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.ResponseBody; + +import com.loglog.api.commons.beans.BoardBean; +import com.loglog.api.commons.beans.BoardFileBean; +import com.loglog.api.commons.beans.BoardImgBean; +import com.loglog.api.commons.beans.BoardReplyBean; +import com.loglog.api.commons.beans.PagingBean; +import com.loglog.api.commons.beans.UserBean; +import com.loglog.api.commons.constants.Constants; +import com.loglog.api.commons.modules.service.board.BoardReplyService; +import com.loglog.api.commons.modules.service.board.BoardService; +import com.loglog.api.commons.utils.SessionUtil; + + +//@RestController +@Controller +@RequestMapping(produces = MediaType.APPLICATION_JSON_VALUE) +public class BoardController { + + @Autowired + private BoardService boardService; + @Autowired + private BoardReplyService boardReplyService; + + + /** + * TBL_BOARD 게시판 리스트 + * @return map + */ + @RequestMapping(value = "/youtube/editor", method = RequestMethod.GET) + public String youtubeEditor(String bdTypeCd, HttpServletRequest request, HttpServletResponse response, Model model) throws Exception { + model.addAttribute("bdTypeCd", bdTypeCd); + return "youtube/editor"; + } + + /** + * TBL_BOARD 게시판 리스트 + * @return map + */ + @RequestMapping(value = "/youtube/update", method = RequestMethod.GET) + public String youtubeUpdate(String bdNo,HttpServletRequest request, HttpServletResponse response, Model model) throws Exception { + model.addAttribute("bdNo", bdNo); + return "youtube/update"; + } + + /** + * TBL_BOARD 게시판 리스트 + * @return map + */ + @RequestMapping(value = "/youtube/list", method = RequestMethod.GET) + @ResponseBody + public Map getYoutubeList(PagingBean pagingBean, HttpSession session, HttpServletRequest request, HttpServletResponse response) throws Exception { + + Map map = new HashMap(); + try { + + + UserBean userBean = SessionUtil.getUserBean(request); + + if(userBean != null) { + pagingBean.setUserId(userBean.getUserCd()); + } + + pagingBean.setBdTypeCd("99"); + // 전체 글 갯수 구함 + int totCount = boardService.selectBoardCount(pagingBean); + + // 페이징 계산 , 가져올 데이터 시작위치 끝위치 계산 + pagingBean.calcPage(totCount); + + List boardList = boardService.boardList(pagingBean); + + map.put("totCount", totCount); + map.put("boardList", boardList); + map.put("pagingBean", pagingBean); + + } catch (Exception e) { + e.printStackTrace(); + } + + return map; + } + + /** + * TBL_BOARD 게시판 리스트 + * @return map + */ + @RequestMapping(value = "/news/editor", method = RequestMethod.GET) + public String newsEditor(String bdTypeCd, HttpServletRequest request, HttpServletResponse response, Model model) throws Exception { + model.addAttribute("bdTypeCd", bdTypeCd); + return "news/editor"; + } + + /** + * TBL_BOARD 게시판 리스트 + * @return map + */ + @RequestMapping(value = "/news/update", method = RequestMethod.GET) + public String newsUpdate(String bdNo,HttpServletRequest request, HttpServletResponse response, Model model) throws Exception { + model.addAttribute("bdNo", bdNo); + return "news/update"; + } + /** + * TBL_BOARD 게시판 리스트 + * @return map + */ + + @RequestMapping(value = "/news/list", method = RequestMethod.GET) + @ResponseBody + public Map getNewsList(PagingBean pagingBean, HttpSession session, HttpServletRequest request, HttpServletResponse response) throws Exception { + + Map map = new HashMap(); + try { + + + UserBean userBean = SessionUtil.getUserBean(request); + + if(userBean != null) { + pagingBean.setUserId(userBean.getUserCd()); + } + + pagingBean.setBdTypeCd("01"); + // 전체 글 갯수 구함 + int totCount = boardService.selectBoardCount(pagingBean); + + // 페이징 계산 , 가져올 데이터 시작위치 끝위치 계산 + pagingBean.calcPage(totCount); + + List boardList = boardService.boardList(pagingBean); + + map.put("totCount", totCount); + map.put("boardList", boardList); + map.put("pagingBean", pagingBean); + + } catch (Exception e) { + e.printStackTrace(); + } + + return map; + } + /** + * TBL_BOARD 게시판 리스트 + * @return map + */ + @RequestMapping(value = "/notice/editor", method = RequestMethod.GET) + public String noticeEditor(String bdTypeCd, HttpServletRequest request, HttpServletResponse response, Model model) throws Exception { + model.addAttribute("bdTypeCd", bdTypeCd); + return "notice/editor"; + } + + /** + * TBL_BOARD 게시판 리스트 + * @return map + */ + @RequestMapping(value = "/notice/update", method = RequestMethod.GET) + public String noticeUpdate(String bdNo,HttpServletRequest request, HttpServletResponse response, Model model) throws Exception { + model.addAttribute("bdNo", bdNo); + return "notice/update"; + } + + /** + * TBL_BOARD 게시판 리스트 + * @return map + */ + @RequestMapping(value = "/gallery/editor", method = RequestMethod.GET) + public String galleryEditor(String bdTypeCd, HttpServletRequest request, HttpServletResponse response, Model model) throws Exception { + model.addAttribute("bdTypeCd", bdTypeCd); + return "gallery/editor"; + } + + /** + * TBL_BOARD 게시판 리스트 + * @return map + */ + @RequestMapping(value = "/gallery/update", method = RequestMethod.GET) + public String galleryUpdate(String bdNo,HttpServletRequest request, HttpServletResponse response, Model model) throws Exception { + model.addAttribute("bdNo", bdNo); + return "gallery/update"; + } + + /** + * TBL_BOARD 게시판 리스트 + * @return map + */ + @RequestMapping(value = "/gallery/list", method = RequestMethod.GET) + @ResponseBody + public Map getGalleryList(PagingBean pagingBean, HttpSession session, HttpServletRequest request, HttpServletResponse response) throws Exception { + + Map map = new HashMap(); + try { + + + UserBean userBean = SessionUtil.getUserBean(request); + + if(userBean != null) { + pagingBean.setUserId(userBean.getUserCd()); + } + + pagingBean.setBdTypeCd("12"); + pagingBean.setCountPerPage(14); + + // 전체 글 갯수 구함 + int totCount = boardService.selectBoardCount(pagingBean); + + // 페이징 계산 , 가져올 데이터 시작위치 끝위치 계산 + pagingBean.calcPage(totCount); + + List boardList = boardService.boardList(pagingBean); + + map.put("totCount", totCount); + map.put("boardList", boardList); + map.put("pagingBean", pagingBean); + + } catch (Exception e) { + e.printStackTrace(); + } + + return map; + } + + /** + * TBL_BOARD 게시판 리스트 + * @return map + */ + @RequestMapping(value = "/notice/list", method = RequestMethod.GET) + @ResponseBody + public Map getNoticeList(PagingBean pagingBean, HttpSession session, HttpServletRequest request, HttpServletResponse response) throws Exception { + + Map map = new HashMap(); + try { + + + UserBean userBean = SessionUtil.getUserBean(request); + + if(userBean != null) { + pagingBean.setUserId(userBean.getUserCd()); + } + + pagingBean.setBdTypeCd("00"); + // 전체 글 갯수 구함 + int totCount = boardService.selectBoardCount(pagingBean); + + // 페이징 계산 , 가져올 데이터 시작위치 끝위치 계산 + pagingBean.calcPage(totCount); + + List boardList = boardService.boardList(pagingBean); + + map.put("totCount", totCount); + map.put("boardList", boardList); + map.put("pagingBean", pagingBean); + + } catch (Exception e) { + e.printStackTrace(); + } + + return map; + } + @RequestMapping(value = "/reply/list", method = RequestMethod.GET) + @ResponseBody + public Map getreplyList(BoardBean boardBean, PagingBean pagingBean, HttpSession session, HttpServletRequest request, HttpServletResponse response) throws Exception { + + Map map = new HashMap(); + try { + + + UserBean userBean = SessionUtil.getUserBean(request); + + if(userBean != null) { + pagingBean.setUserId(userBean.getUserCd()); + } + pagingBean.setBdNo(boardBean.getBdNo()); + List boardreplyList = boardReplyService.replyList(pagingBean); + map.put("boardReplyList", boardreplyList); + + } catch (Exception e) { + e.printStackTrace(); + } + + return map; + } + + @RequestMapping(value = "/reply/insertReply", method = RequestMethod.POST) + public Map insertReply(@RequestBody BoardReplyBean boardReplyBean, BoardBean boardBean, HttpServletRequest request ) { + Map map = new HashMap(); + String result = Constants.FAIL; + String resultMsg = "댓글 저장에 실패하였습니다."; + + //UserBean userBean = SessionUtil.getUserBean(request); -> vue에서 테스트할떄 주석풀기 + UserBean userBean = new UserBean();//SessionUtil.getUserBean(request); + try { + if( userBean != null ) { + //로그인한 ID와 게시판 등록 ID가 같거나, 관리자일 경우에는 그냥 삭제한다. +// if( StringUtils.equals(boardBean.getBdWriterId(), userBean.getUserCd()) || +// StringUtils.equals(userBean.getAdminYn(), "Y") ) +// { + //boardReplyBean.setBdNo() + boardReplyService.insertReplyBoard(boardReplyBean, boardBean); + + result = Constants.OK; + resultMsg = "댓글이 저장 되었습니다."; +// } + } else { + resultMsg = "로그인 후 이용 하세요"; + } + } catch (Exception e) { + e.printStackTrace(); + } + + map.put("result",result); + map.put("resultMsg", resultMsg); + + return map; + } + + @RequestMapping(value = "/reply/updateReply", method = RequestMethod.POST) + public Map updateReply(@RequestBody BoardReplyBean boardReplyBean, HttpServletRequest request ) { + Map map = new HashMap(); + String result = Constants.FAIL; + String resultMsg = "댓글 수정에 실패하였습니다."; + + //UserBean userBean = SessionUtil.getUserBean(request);// -> vue에서 테스트할떄 주석풀기 + //System.out.println("유저ID" + userBean.getUserCd()); + UserBean userBean = new UserBean();//SessionUtil.getUserBean(request); + try { + if( userBean != null ) { + System.out.println("유저ID : " + userBean.getUserCd()); + System.out.println("게시판 저장된ID : " + boardReplyBean.getReplyWriterId()); + //로그인한 ID와 게시판 등록 ID가 같거나, 관리자일 경우에는 그냥 삭제한다. +// if( StringUtils.equals(boardBean.getBdWriterId(), userBean.getUserCd()) || +// StringUtils.equals(userBean.getAdminYn(), "Y") ) +// { + //boardReplyBean.setBdNo() + int res = boardReplyService.updateReplyBoard(boardReplyBean); + System.out.println("res" + res); + result = Constants.OK; + resultMsg = "댓글이 수정 되었습니다."; +// } + } else { + resultMsg = "로그인 후 이용 하세요"; + } + } catch (Exception e) { + e.printStackTrace(); + } + + map.put("result",result); + map.put("resultMsg", resultMsg); + + return map; + } + + @RequestMapping(value = "/reply/deleteReply", method = RequestMethod.DELETE) + public Map deleteReply(@RequestBody BoardReplyBean boardReplyBean,BoardBean boardBean, HttpServletRequest request ) { + Map map = new HashMap(); + String result = Constants.FAIL; + String resultMsg = "댓글 삭제에 실패하였습니다."; + + //UserBean userBean = SessionUtil.getUserBean(request); -> vue에서 테스트할떄 주석풀기 + UserBean userBean = new UserBean();//SessionUtil.getUserBean(request); + try { + if( userBean != null ) { + //로그인한 ID와 게시판 등록 ID가 같거나, 관리자일 경우에는 그냥 삭제한다. +// if( StringUtils.equals(boardBean.getBdWriterId(), userBean.getUserCd()) || +// StringUtils.equals(userBean.getAdminYn(), "Y") ) +// { + //int res = boardReplyService.deleteReplyBoard(boardReplyBean,boardBean); + //System.out.println("res" + res); + boardReplyService.deleteReplyBoard(boardReplyBean,boardBean); + result = Constants.OK; + resultMsg = "댓글이 삭제 되었습니다."; +// } + } else { + resultMsg = "로그인 후 이용 하세요"; + } + } catch (Exception e) { + e.printStackTrace(); + } + + map.put("result",result); + map.put("resultMsg", resultMsg); + + return map; + } + + /** + * TBL_BOARD 게시판 상세 + * @return map + */ + @RequestMapping(value = "/board/detail", method = RequestMethod.GET) + @ResponseBody + public Map getNoticeDetail(BoardBean boardBean, HttpSession session, HttpServletRequest request, HttpServletResponse response) throws Exception { + + Map map = new HashMap(); + try { + + UserBean userBean = SessionUtil.getUserBean(request); + if(userBean != null) { + boardBean.setBdWriterId(userBean.getUserCd()); + } +// boardBean.setBdTypeCd("6"); + BoardBean selectBean = boardService.selectInBoard(boardBean); + + map.put("detail", selectBean); + + } catch (Exception e) { + e.printStackTrace(); + } + + return map; + } + + /** + * 게시판 입력 (로그인만 가능) + */ + @RequestMapping(value = "/board/create", method = RequestMethod.POST) + @ResponseBody + public Map boardCreate(BoardBean boardBean, + HttpServletRequest request) throws Exception { + return boardInsertAjax(boardBean, request, boardBean.getImgPath(), + boardBean.getImgOriginName(), boardBean.getImgSize(), + boardBean.getFilePath(), boardBean.getFileOriginName(), + boardBean.getFileSize()); + } + + + /** + * 게시판 수정 (비로그인) + * + * @param boardBean + * @param request + * @param imgPath + * @param imgOriginName + * @param imgSize + * @param filePath + * @param fileOriginName + * @param fileSize + * @return + * @throws Exception + */ + @RequestMapping(value = "/board/update", method = RequestMethod.POST) + @ResponseBody + public Map boardUpdate(BoardBean boardBean, + BindingResult bindingResult, + HttpServletRequest request) throws Exception { + + Map map = new HashMap(); + String result = Constants.FAIL; + String resultMsg = "게시물 수정에 실패 하였습니다."; + + map.put(Constants.RESULT, result); + map.put(Constants.RESULT_MSG, resultMsg); + + //업데이트를 하기위한 체크를 한다. +// if( StringUtils.isNotEmpty(boardBean.getBdPass()) ) { + BoardBean selInBoardBean = boardService.selectInBoard(boardBean); + + //로그인한 ID와 게시판 등록 ID가 같거나, 관리자일 경우에는 그냥 삭제한다. +// if( StringUtils.equals(boardBean.getBdPass(), selInBoardBean.getBdPass()) ) +// { + //업데이트 기본동작 수행 + map = boardUpdateAjax(boardBean, bindingResult, request, boardBean.getImgPath(), + boardBean.getImgOriginName(), boardBean.getImgSize(), + boardBean.getFilePath(), boardBean.getFileOriginName(), + boardBean.getFileSize()); +// } else { +// resultMsg = "게시물 비밀번호가 일치하지 않습니다."; +// map.put(Constants.RESULT_MSG, resultMsg); +// } +// } + + return map; + } + + + /** + * 게시판 삭제 (비로그인) + * @param boardBean + * @param request + * @return + * @throws Exception + */ + @RequestMapping(value = "/board/delete", method = RequestMethod.DELETE) + @ResponseBody + public Map deleteNotice(@RequestBody BoardBean boardBean, HttpServletRequest request) throws Exception { + Map map = new HashMap(); + String result = Constants.FAIL; + String resultMsg = "게시글 삭제에 실패하였습니다."; + +// UserBean userBean = SessionUtil.getUserBean(request); + + try { +// if( userBean != null ) { + //로그인한 ID와 게시판 등록 ID가 같거나, 관리자일 경우에는 그냥 삭제한다. +// if( StringUtils.equals(boardBean.getBdWriterId(), userBean.getUserCd()) || +// StringUtils.equals(userBean.getAdminYn(), "Y") ) +// { + boardService.deleteBoard(boardBean); + + result = Constants.OK; + resultMsg = "게시글이 삭제 되었습니다."; +// } +// } else { +// resultMsg = "로그인 후 이용 하세요"; +// } + } catch (Exception e) { + e.printStackTrace(); + } + + map.put("result",result); + map.put("resultMsg", resultMsg); + + return map; + } + + public Map boardInsertAjax(BoardBean boardBean, + HttpServletRequest request, String[] imgPath, // 게시글 이미지 + String[] imgOriginName, // 게시글 이미지 원본이름 + String[] imgSize, // 게시글 이미지 원본 사이즈 + String[] filePath, // 게시글 파일 + String[] fileOriginName, // 게시글 파일 원본이름 + String[] fileSize // 게시글 파일 원본 사이즈 + ) throws Exception { + Map map = new HashMap(); + String result = Constants.FAIL; + String resultMsg = "게시물을 다시 작성해 주세요."; + + UserBean userBean = SessionUtil.getUserBean(request); + + //비밀글표시와 비밀번호가 있다면 로그인 없이도 글쓰기 가능하게 한다. + if( StringUtils.isNotEmpty(boardBean.getBdPass()) ) { + //로그인없이도 글쓰기 가능하게 한다. + } +// else if(userBean == null) { +// resultMsg = "로그인 후 이용해 주세요"; +// map.put("result", result); +// map.put("resultMsg", resultMsg); +// return map; +// } + + try { + // 딜 이미지 파라미터 셋팅 + List boardImgList = null; + List boardFileList = null; + + if (ArrayUtils.isNotEmpty(imgPath)) { + boardImgList = new ArrayList(); + + for (int i = 0; i < imgPath.length; i++) { + if (!imgPath[i].isEmpty()) { + BoardImgBean inquirySellerImgBean = new BoardImgBean(); + // 정렬순서 + // 이미지 경로 셋팅 + inquirySellerImgBean.setImgPath(imgPath[i]); + // 이미지 원본이름 세팅 + inquirySellerImgBean.setImgOriginName(imgOriginName[i]); + // 이미지 크기 세팅 + inquirySellerImgBean.setImgSize(imgSize[i]); + + boardImgList.add(inquirySellerImgBean); + } + } + } + + if (ArrayUtils.isNotEmpty(filePath)) { + boardFileList = new ArrayList(); + + for (int i = 0; i < filePath.length; i++) { + if (!filePath[i].isEmpty()) { + BoardFileBean inquirySellerFileBean = new BoardFileBean(); + // 정렬순서 + // 이미지 경로 셋팅 + inquirySellerFileBean.setFilePath(filePath[i]); + // 이미지 원본이름 세팅 + inquirySellerFileBean.setFileOriginName(fileOriginName[i]); + // 이미지 크기 세팅 + inquirySellerFileBean.setFileSize(fileSize[i]); + + boardFileList.add(inquirySellerFileBean); + } + } + } + + // 게시글 insert + boardService.insertBoard(boardBean, boardImgList, boardFileList); + + result = Constants.OK; + resultMsg = "성공적으로 등록 되었습니다."; + + map.put("bdNo", boardBean.getBdNo()); + + } catch (Exception e) { + e.printStackTrace(); + result = Constants.FAIL; + resultMsg = "시스템 에러"; + } + + map.put("result", result); + map.put("resultMsg", resultMsg); + + return map; + + } + + + /** + * 게시판 수정 + * + * @param boardBean + * @param request + * @param imgPath + * @param imgOriginName + * @param imgSize + * @param filePath + * @param fileOriginName + * @param fileSize + * @return + * @throws Exception + */ + public Map boardUpdateAjax(BoardBean boardBean, + BindingResult bindingResult, + HttpServletRequest request, String[] imgPath, // 게시글 이미지 + String[] imgOriginName, // 게시글 이미지 원본이름 + String[] imgSize, // 게시글 이미지 원본 사이즈 + String[] filePath, // 게시글 파일 + String[] fileOriginName, // 게시글 파일 원본이름 + String[] fileSize // 게시글 파일 원본 사이즈 + ) throws Exception { + Map map = new HashMap(); + String result = Constants.FAIL; + String resultMsg = "게시물을 수정에 실패 하였습니다."; + UserBean userBean = SessionUtil.getUserBean(request); + + if(bindingResult.hasErrors()){ + if(bindingResult.getFieldError().getField().equals("thumbImgFile1")){ + // Have FileImage Path Problem. [input file] can not set Value, Because of Security Strategy. Bono + } + } + + //비밀번호가 있다면 로그인 없이도 글쓰기 가능하게 한다. + if( StringUtils.isNotEmpty(boardBean.getBdPass()) ) { + //로그인없이도 글쓰기 가능하게 한다. + } + //로그인한 아이디와 게시물 작성한 아이디가 같는지 체크. +// else if(userBean == null) { +// resultMsg = "로그인 후 이용 해주세요."; +// map.put("result", result); +// map.put("resultMsg", resultMsg); +// return map; +// }else { +// if( !StringUtils.equals(userBean.getUserCd() , boardBean.getBdWriterId()) ) { +// resultMsg = "글쓴이의 ID와 일치하지 않습니다."; +// map.put("result", result); +// map.put("resultMsg", resultMsg); +// return map; +// } +// } + + try { + // 딜 이미지 파라미터 셋팅 + List boardImgList = null; + List boardFileList = null; + + if (ArrayUtils.isNotEmpty(imgPath)) { + boardImgList = new ArrayList(); + + for (int i = 0; i < imgPath.length; i++) { + if (!imgPath[i].isEmpty()) { + BoardImgBean inquirySellerImgBean = new BoardImgBean(); + // 정렬순서 + // 이미지 경로 셋팅 + inquirySellerImgBean.setImgPath(imgPath[i]); + // 이미지 원본이름 세팅 + inquirySellerImgBean.setImgOriginName(imgOriginName[i]); + // 이미지 크기 세팅 + inquirySellerImgBean.setImgSize(imgSize[i]); + + boardImgList.add(inquirySellerImgBean); + } + } + } + + if (ArrayUtils.isNotEmpty(filePath)) { + boardFileList = new ArrayList(); + + for (int i = 0; i < filePath.length; i++) { + if (!filePath[i].isEmpty()) { + BoardFileBean inquirySellerFileBean = new BoardFileBean(); + // 정렬순서 + // 이미지 경로 셋팅 + inquirySellerFileBean.setFilePath(filePath[i]); + // 이미지 원본이름 세팅 + inquirySellerFileBean.setFileOriginName(fileOriginName[i]); + // 이미지 크기 세팅 + inquirySellerFileBean.setFileSize(fileSize[i]); + + boardFileList.add(inquirySellerFileBean); + } + } + } + + // 게시글 insert + int res = boardService.updateBoard(boardBean, boardImgList, boardFileList); + + if (res > 0) { + result = Constants.OK; + resultMsg = "성공적으로 수정 되었습니다."; + } else { + result = Constants.FAIL; + resultMsg = "수정에 실패하였습니다."; + } + + map.put("bdNo", boardBean.getBdNo()); + + } catch (Exception e) { + e.printStackTrace(); + result = Constants.FAIL; + resultMsg = "시스템 에러"; + } + + map.put("result", result); + map.put("resultMsg", resultMsg); + + return map; + } + +} diff --git a/src/main/java/com/loglog/api/controller/calender/CalenderController.java b/src/main/java/com/loglog/api/controller/calender/CalenderController.java new file mode 100644 index 0000000..9c4c2ef --- /dev/null +++ b/src/main/java/com/loglog/api/controller/calender/CalenderController.java @@ -0,0 +1,274 @@ +package com.loglog.api.controller.calender; + + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +import javax.servlet.http.HttpServletRequest; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.dao.DuplicateKeyException; +import org.springframework.http.MediaType; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestPart; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.multipart.MultipartFile; + +import com.loglog.api.commons.beans.CalenderBean; +import com.loglog.api.commons.beans.CouponUserListBean; +import com.loglog.api.commons.constants.CodeConstant; +import com.loglog.api.commons.constants.Constants; +import com.loglog.api.commons.modules.service.calender.CalenderService; +import com.loglog.api.commons.utils.CommonUtils; +import com.loglog.api.commons.utils.JwtTokenHelper; +import com.loglog.api.commons.utils.SessionUtil; + + +@Controller +@RequestMapping(produces = MediaType.APPLICATION_JSON_VALUE) +public class CalenderController { + + @Autowired + private CalenderService calenderService; + + @ResponseBody + @RequestMapping(value="/calender/insertCalenderAjax", method = RequestMethod.POST) + public Map insetCaelender(@RequestBody CalenderBean calenderBean, HttpServletRequest request){ + + Map map = new HashMap<>(); + int checkShop; + int insertCal; + map.put(Constants.RESULT, Constants.FAIL); + map.put(Constants.RESULT_MSG, "来店情報の保存に失敗しました"); + + try { + checkShop = calenderService.selectShopInfo(calenderBean); + if(checkShop == 0) { + map.put(Constants.RESULT, Constants.FAIL); + map.put(Constants.RESULT_MSG, "店舗情報が正しくありません."); + }else { + UUID calenderId = UUID.randomUUID(); + calenderBean.setInsuserCd(calenderId.toString()); + insertCal = calenderService.insertCalender(calenderBean); + CalenderBean calenderUserBean = new CalenderBean(); + calenderUserBean.setUserCd(calenderBean.getUserCd()); + calenderUserBean.setInsuserCd(calenderBean.getInsuserCd()); + calenderUserBean = calenderService.selectCalenderId(calenderUserBean); + // selectCalenderId + if(insertCal != 0) { + map.put(Constants.RESULT, Constants.OK); + map.put(Constants.RESULT_MSG, "来店情報の保存に成功しました"); +// map.put("insuserCd", calenderBean.getInsuserCd()); // 내점정보 저장후 고유ID생성 출력 +// map.put("raitenTime", calenderBean.getRaitenTime()); // 내점정보 저장후 내점시간 출력 +// map.put("shopNm", calenderBean.getShopNm()); // 내점정보 저장후 상점이름 출력 + map.put("data", calenderUserBean); + }else { + map.put(Constants.RESULT, Constants.FAIL); + map.put(Constants.RESULT_MSG, "来店情報の保存に失敗しました"); + } + } + } catch (Exception e) { + e.printStackTrace(); + map.put(Constants.RESULT, Constants.FAIL); + map.put(Constants.RESULT_MSG, "予期しないエラーが原因で店舗の詳細を取得できませんでした."); + } + return map; + } + + @ResponseBody + @RequestMapping(value="/calender/getCalenderListAjax", method = RequestMethod.GET) + public Map selectCalender(CalenderBean calenderBean, HttpServletRequest request){ + System.out.println("asdasdasd"); + Map map = new HashMap<>(); + map.put(Constants.RESULT, Constants.FAIL); + map.put(Constants.RESULT_MSG, "ログインに失敗しました。 ID/パスワードを確認してください"); + List result = new ArrayList(); + try { + result = calenderService.selectCalenderMon(calenderBean); + map.put("data", result); + map.put(Constants.RESULT, Constants.OK); + map.put(Constants.RESULT_MSG, "カレンダーの閲覧に成功しました."); + } catch (Exception e) { + e.printStackTrace(); + map.put(Constants.RESULT, Constants.FAIL); + map.put(Constants.RESULT_MSG, "予期しないエラーが原因でカレンダー情報を取得できませんでした"); + } + return map; + } + + @ResponseBody + @RequestMapping(value="/calender/insertScheduleAjax", method = RequestMethod.POST) + public Map insertScheule(@RequestBody CalenderBean calenderBean, HttpServletRequest request){ + Map map = new HashMap<>(); + int insertSch; + map.put(Constants.RESULT, Constants.FAIL); + map.put(Constants.RESULT_MSG, "スケジュールの保存に失敗しました"); + String startSche = calenderBean.getRaitenTime(); + System.out.println("스케줄 입력 :: " + startSche); + try { + insertSch = calenderService.insertSchedule(calenderBean); + if(insertSch != 0) { + map.put(Constants.RESULT, Constants.OK); + map.put(Constants.RESULT_MSG, "スケジュールの保存に成功しました"); + } + + } catch (Exception e) { + e.printStackTrace(); + map.put(Constants.RESULT, Constants.FAIL); + map.put(Constants.RESULT_MSG, "予期しないエラーのため、スケジュールの保存に失敗しました"); + } + return map; + } + + @ResponseBody + @RequestMapping(value="/calender/getCalenderDetailAjax", method = RequestMethod.GET) + public Map selectCalenderDayDetail(CalenderBean calenderBean, HttpServletRequest request){ + + Map map = new HashMap<>(); + map.put(Constants.RESULT, Constants.FAIL); + map.put(Constants.RESULT_MSG, "ログインに失敗しました。 ID/パスワードを確認してください"); + List result = new ArrayList(); + try { + result = calenderService.selectCalenderDay(calenderBean); + map.put("data", result); + map.put(Constants.RESULT, Constants.OK); + map.put(Constants.RESULT_MSG, "カレンダー毎日検索に成功しました"); + } catch (Exception e) { + e.printStackTrace(); + map.put(Constants.RESULT, Constants.FAIL); + map.put(Constants.RESULT_MSG, "予期しないエラーが原因でカレンダー情報を取得できませんでした"); + } + return map; + } + + @ResponseBody + @RequestMapping(value="/calender/updateCalenderAjax", method = RequestMethod.POST) + public Map updateCalender(@RequestBody CalenderBean calenderBean, HttpServletRequest request){ + + Map map = new HashMap<>(); + map.put(Constants.RESULT, Constants.FAIL); + map.put(Constants.RESULT_MSG, "予期しないエラーが原因でカレンダー情報を取得できませんでした"); + int result; + try { + result = calenderService.updateCalender(calenderBean); + if(result == 1) { + map.put("data", result); + map.put(Constants.RESULT, Constants.OK); + map.put(Constants.RESULT_MSG, "カレンダーの編集に成功しました"); + }else { + map.put(Constants.RESULT, Constants.FAIL); + map.put(Constants.RESULT_MSG, "カレンダー情報が正しくありません"); + } + } catch (Exception e) { + e.printStackTrace(); + map.put(Constants.RESULT, Constants.FAIL); + map.put(Constants.RESULT_MSG, "予期しないエラーが原因でカレンダー情報を取得できませんでした"); + } + return map; + } + + @ResponseBody + @RequestMapping(value="/calender/updateVisitCalenderAjax", method = RequestMethod.POST) + public Map updateVisitCalender(CalenderBean calenderBean, + @RequestPart(value="thumFileList", required=false) List thumFileList, + HttpServletRequest request){ + + Map map = new HashMap<>(); + map.put(Constants.RESULT, Constants.FAIL); + map.put(Constants.RESULT_MSG, "来店情報の修正に失敗しました"); + int result; + try { + + result = calenderService.updateCalenderthum(calenderBean, thumFileList); + + if(result == 1) { + calenderBean = calenderService.selectUpdateId(calenderBean); // 업데이트후 Response에 값 출력 + map.put("data", calenderBean); + map.put(Constants.RESULT, Constants.OK); + map.put(Constants.RESULT_MSG, "来店情報の修正に成功しました"); + }else { + map.put(Constants.RESULT, Constants.FAIL); + map.put(Constants.RESULT_MSG, "来店情報の修正に失敗しました"); + } + } catch (Exception e) { + e.printStackTrace(); + map.put(Constants.RESULT, Constants.FAIL); + map.put(Constants.RESULT_MSG, "来店情報の修正に失敗しました"); + } + return map; + } + + @ResponseBody + @RequestMapping(value="/calender/deleteCalenderAjax", method = RequestMethod.POST) + public Map deleteCalender(@RequestBody CalenderBean calenderBean, HttpServletRequest request){ + + Map map = new HashMap<>(); + map.put(Constants.RESULT, Constants.FAIL); + map.put(Constants.RESULT_MSG, "来歴履歴の削除に失敗しました"); + int result; + try { + result = calenderService.deleteVisitCalender(calenderBean); + if(result == 1) { + map.put(Constants.RESULT, Constants.OK); + map.put(Constants.RESULT_MSG, "来店履歴の削除に成功しました"); + }else { + map.put(Constants.RESULT, Constants.FAIL); + map.put(Constants.RESULT_MSG, "来歴履歴の削除に失敗しました"); + } + } catch (Exception e) { + e.printStackTrace(); + map.put(Constants.RESULT, Constants.FAIL); + map.put(Constants.RESULT_MSG, "予期しないエラーが原因でカレンダー情報を取得できませんでした"); + } + return map; + } + + @ResponseBody + @RequestMapping(value="/calender/getVisitCalenderListAjax", method = RequestMethod.GET) + public Map getVisitCalenderList(CalenderBean calenderBean, HttpServletRequest request){ + + Map map = new HashMap<>(); + map.put(Constants.RESULT, Constants.FAIL); + map.put(Constants.RESULT_MSG, "店舗固有の来歴履歴の照会に失敗しました"); + List result = new ArrayList(); + try { + result = calenderService.selectVisitList(calenderBean); + map.put("data", result); + map.put(Constants.RESULT, Constants.OK); + map.put(Constants.RESULT_MSG, "店舗別来店履歴の照会に成功しました"); + } catch (Exception e) { + e.printStackTrace(); + map.put(Constants.RESULT, Constants.FAIL); + map.put(Constants.RESULT_MSG, "店舗固有の来歴履歴の照会に失敗しました"); + } + return map; + } + + @ResponseBody + @RequestMapping(value="/calender/getVisitCalenderDetailAjax", method = RequestMethod.GET) + public Map getVisitCalenderDetail(CalenderBean calenderBean, HttpServletRequest request){ + + Map map = new HashMap<>(); + map.put(Constants.RESULT, Constants.FAIL); + map.put(Constants.RESULT_MSG, "店舗別来店履歴詳細照会に失敗しました"); + try { + CalenderBean visitCalenderDetail = calenderService.selectUpdateId(calenderBean); + map.put("data", visitCalenderDetail); + map.put(Constants.RESULT, Constants.OK); + map.put(Constants.RESULT_MSG, "店舗別来店履歴詳細照会に成功しました"); + } catch (Exception e) { + e.printStackTrace(); + map.put(Constants.RESULT, Constants.FAIL); + map.put(Constants.RESULT_MSG, "店舗別来店履歴詳細照会に失敗しました"); + } + return map; + } + +} diff --git a/src/main/java/com/loglog/api/controller/card/CardController.java b/src/main/java/com/loglog/api/controller/card/CardController.java new file mode 100644 index 0000000..14d3b9e --- /dev/null +++ b/src/main/java/com/loglog/api/controller/card/CardController.java @@ -0,0 +1,347 @@ +package com.loglog.api.controller.card; + + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.dao.DuplicateKeyException; +import org.springframework.http.MediaType; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestPart; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.multipart.MultipartFile; + +import com.loglog.api.commons.beans.CardImgBean; +import com.loglog.api.commons.beans.CardMasterBean; +import com.loglog.api.commons.beans.ShopMasterBean; +import com.loglog.api.commons.constants.Constants; +import com.loglog.api.commons.modules.service.card.CardMasterService; + + +@Controller +@RequestMapping(produces = MediaType.APPLICATION_JSON_VALUE) +public class CardController { + + @Autowired + private CardMasterService cardMasterService; + + + /** 사용자 설정 업데이트 (자동로그인, 푸시알림) */ + @RequestMapping(value = "/card/getCardListAjax", method = RequestMethod.POST) + @ResponseBody + public Map CardList(@RequestBody CardMasterBean cardMasterBean,HttpServletRequest request) throws Exception{ + Map map = new HashMap(); + String result = Constants.FAIL; + String resultMsg = "ユーザーカードリストの検索に失敗しました"; + List resultList = new ArrayList(); + try { + resultList = cardMasterService.selectCardList(cardMasterBean); + + if(cardMasterBean != null) { + map.put("data", resultList); + result = Constants.OK; + resultMsg = "ユーザーカードリストの検索に成功しました"; + } + + } catch (Exception e) { + e.printStackTrace(); + result = Constants.FAIL; + resultMsg = "システムエラー発生."; + } + + map.put("resultMsg", resultMsg); + map.put("result", result); + + return map; + } + + /** + * 회원가입 signup + * @ASIS API name signup + * @param + * @param request body + * @return + * @throws Exception + */ + @RequestMapping(value = "/card/insertCardAjax", method = RequestMethod.POST) + @ResponseBody + public Map CardInsert(CardMasterBean cardMasterBean, + @RequestPart(value="", required=false) MultipartFile cardImageFile, + HttpServletRequest request) throws Exception{ + Map map = new HashMap(); + int resultCnt = 0; + int checkCardNm = 0; + String result = null; + String resultMsg = null; + List boardImgList = null; + checkCardNm = cardMasterService.checkCardNm(cardMasterBean); + if(checkCardNm < 1) { + try { + resultCnt = cardMasterService.insertCard(cardMasterBean,cardImageFile); + + if(resultCnt == 1){ + result = Constants.OK; + resultMsg = "カード登録に成功しました"; + map.put("cardNm", cardMasterBean.getCardNm()); + map.put("janNo", cardMasterBean.getJanNo()); + map.put("userCd", cardMasterBean.getUserCd()); + map.put("userCd", cardMasterBean.getUserCd()); + }else { + result = Constants.FAIL; + resultMsg = "カード登録に失敗しました"; + } + } catch (Exception e) { + e.printStackTrace(); + result = Constants.FAIL; + + if(e instanceof DuplicateKeyException) { + resultMsg = "同じ名前のカードが存在します"; + } + else { + resultMsg = "システムエラー"; + } + } + }else { + result = Constants.FAIL; + resultMsg = "同じ名前のカードが存在します"; + } + + map.put("result", result); + map.put("resultMsg", resultMsg); + + return map; + + } + + /** 사용자 설정 업데이트 (자동로그인, 푸시알림) */ + @RequestMapping(value = "/card/updateCardtAjax", method = RequestMethod.POST) + @ResponseBody + public Map CardUpdate(CardMasterBean cardMasterBean, + @RequestPart(value="", required=false) MultipartFile cardImageFile, + HttpServletRequest request) throws Exception{ + Map map = new HashMap(); + String result = Constants.FAIL; + String resultMsg = "ユーザー設定の設定に失敗しました."; + int rtnVal = 0; + try { + if(cardImageFile != null) { + rtnVal = cardMasterService.updateCard(cardMasterBean,cardImageFile); + }else { + System.out.println("카드 이미지 없음"); + rtnVal = cardMasterService.updateCardNoimg(cardMasterBean); + } + System.out.println("체크" + rtnVal); + if(rtnVal >= 1) { + map.put("cardNm", cardMasterBean.getChanCardNm()); + map.put("janNo", cardMasterBean.getChanJanNo()); + map.put("userCd", cardMasterBean.getUserCd()); + result = Constants.OK; + resultMsg = "カード情報が変更されました"; + } + + } catch (Exception e) { + e.printStackTrace(); + result = Constants.FAIL; + resultMsg = "システムエラー"; + } + + map.put("resultMsg", resultMsg); + map.put("result", result); + + return map; + } + + @RequestMapping(value="/card/deletetCardAjax", method = RequestMethod.DELETE) + @ResponseBody + public Map CardDelete(@RequestBody CardMasterBean cardMasterBean, HttpServletRequest request) throws Exception{ + + Map map = new HashMap<>(); + map.put(Constants.RESULT, Constants.FAIL); + + try { + int rtnVal = cardMasterService.deleteCard(cardMasterBean); + if(rtnVal >= 1) { + map.put(Constants.RESULT, Constants.OK); + map.put(Constants.RESULT_MSG, "カードの削除が完了しました"); + }else { + map.put(Constants.RESULT, Constants.FAIL); + map.put(Constants.RESULT_MSG, "カードの削除中にエラーが発生しました"); + } + + + } catch (Exception e) { + e.printStackTrace(); + map.put(Constants.RESULT, Constants.FAIL); + map.put(Constants.RESULT_MSG, "予期しないエラーのため、カードの削除に失敗しました。しばらくしてからもう一度お試しください"); + } + return map; + } + + @RequestMapping(value="/card/detailCardtAjax", method = RequestMethod.POST) + @ResponseBody + public Map CardDetail(@RequestBody CardMasterBean cardMasterBean,HttpServletRequest request){ + + Map map = new HashMap<>(); + map.put(Constants.RESULT, Constants.FAIL); + + try { + cardMasterBean = cardMasterService.detailCard(cardMasterBean); + if(cardMasterBean != null) { + map.put("data", cardMasterBean); + map.put(Constants.RESULT, Constants.OK); + map.put(Constants.RESULT_MSG, "カード詳細の照会に成功しました"); + + } + } catch (Exception e) { + e.printStackTrace(); + map.put(Constants.RESULT, Constants.FAIL); + map.put(Constants.RESULT_MSG, "カード情報が正しくありません"); + } + return map; + } + + @RequestMapping(value="/card/updatePointAjax", method = RequestMethod.POST) + @ResponseBody + public Map PointUpdate(@RequestBody CardMasterBean cardMasterBean,HttpServletRequest request) throws Exception{ + Map map = new HashMap<>(); + map.put(Constants.RESULT, Constants.FAIL); + int nowpoint = cardMasterService.selectPoint(cardMasterBean); + if(nowpoint == 0) { + int zeroPoint = cardMasterService.changZeroPoint(cardMasterBean); + } + try { + int point = cardMasterService.updatePoint(cardMasterBean); + int nowpoint2 = cardMasterService.selectPoint(cardMasterBean); + if(point >= 1) { + map.put(Constants.RESULT_MSG, "포인트가" + cardMasterBean.getPoint() + "증가했습니다." + + "현재 포인트" + nowpoint2 + "입니다." ); + map.put(Constants.RESULT, Constants.OK); + + } + } catch (Exception e) { + e.printStackTrace(); + map.put(Constants.RESULT, Constants.FAIL); + map.put(Constants.RESULT_MSG, "카드정보가 올바르지 않습니다."); + } + return map; + } + + @RequestMapping(value="/card/deletePointAjax", method = RequestMethod.POST) + @ResponseBody + public Map PointDelete(@RequestBody CardMasterBean cardMasterBean,HttpServletRequest request){ + Map map = new HashMap<>(); + map.put(Constants.RESULT, Constants.FAIL); + + try { + int point = cardMasterService.deletePoint(cardMasterBean); + int nowpoint2 = cardMasterService.selectPoint(cardMasterBean); + if(point >= 1) { + map.put(Constants.RESULT_MSG, "포인트가" + cardMasterBean.getPoint() + "감소했습니다." + + "현재 포인트" + nowpoint2 + "입니다." ); + map.put(Constants.RESULT, Constants.OK); + + } + } catch (Exception e) { + e.printStackTrace(); + map.put(Constants.RESULT, Constants.FAIL); + map.put(Constants.RESULT_MSG, "카드정보가 올바르지 않습니다."); + } + return map; + } + + + /** 사용자 설정 업데이트 (자동로그인, 푸시알림) */ + @RequestMapping(value = "/card/getLikeCardListAjax", method = RequestMethod.POST) + @ResponseBody + public Map LikeCardList(@RequestBody CardMasterBean cardMasterBean,HttpServletRequest request) throws Exception{ + Map map = new HashMap(); + String result = Constants.FAIL; + String resultMsg = "ユーザー設定の設定に失敗しました"; + List resultList = new ArrayList(); + try { + resultList = cardMasterService.selectLikeCardList(cardMasterBean); + + if(cardMasterBean != null) { + map.put("data", resultList); + result = Constants.OK; + resultMsg = "ユーザーカードリストの検索に成功しました"; + } + + } catch (Exception e) { + e.printStackTrace(); + result = Constants.FAIL; + resultMsg = "システムエラー発生"; + } + + map.put("resultMsg", resultMsg); + map.put("result", result); + + return map; + } + + @RequestMapping(value="/card/insertCardLikeAjax", method = RequestMethod.POST) + @ResponseBody + public Map cardLike(@RequestBody CardMasterBean cardMasterBean,HttpServletRequest request) throws Exception{ + Map map = new HashMap<>(); + String result = Constants.FAIL; + String resultMsg = "ユーザー設定の設定に失敗しました"; + int like; + String custCd = cardMasterBean.getCustCd(); + try { + if(custCd.equals("1")) { // 카드 좋아요 + like = cardMasterService.likeCard(cardMasterBean); + result = Constants.OK; + resultMsg = "カードいいね設定に成功しました"; + }else { + like = cardMasterService.unlikeCard(cardMasterBean); + result = Constants.OK; + resultMsg = "カードのいいねをキャンセルしました."; + } + + } catch (Exception e) { + e.printStackTrace(); + map.put(Constants.RESULT, Constants.FAIL); + map.put(Constants.RESULT_MSG, "カード情報が正しくありません"); + } + map.put("resultMsg", resultMsg); + map.put("result", result); + return map; + } + + /** 사용자 설정 업데이트 (자동로그인, 푸시알림) */ + @RequestMapping(value = "/card/getNotRegisCardListAjax", method = RequestMethod.GET) + @ResponseBody + public Map getNotRegisCardList(CardMasterBean cardMasterBean,HttpServletRequest request) throws Exception{ + Map map = new HashMap(); + String result = Constants.FAIL; + String resultMsg = "マイカードとして登録されていない店舗照会に失敗しました "; + List resultList = new ArrayList(); + try { + resultList = cardMasterService.selectNotRegisShopList(cardMasterBean); + + if(resultList != null) { + map.put("data", resultList); + result = Constants.OK; + resultMsg = "マイカードとして登録されていない店舗照会に成功しました "; + } + + } catch (Exception e) { + e.printStackTrace(); + result = Constants.FAIL; + resultMsg = "システムエラー発生"; + } + + map.put("resultMsg", resultMsg); + map.put("result", result); + + return map; + } +} diff --git a/src/main/java/com/loglog/api/controller/coupon/CouponController.java b/src/main/java/com/loglog/api/controller/coupon/CouponController.java new file mode 100644 index 0000000..60a026f --- /dev/null +++ b/src/main/java/com/loglog/api/controller/coupon/CouponController.java @@ -0,0 +1,258 @@ +package com.loglog.api.controller.coupon; + + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.http.MediaType; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.ResponseBody; + +import com.loglog.api.commons.beans.CouponMasterBean; +import com.loglog.api.commons.beans.CouponPublicBean; +import com.loglog.api.commons.beans.CouponUserListBean; +import com.loglog.api.commons.beans.GeolocationBean; +import com.loglog.api.commons.beans.PagingBean; +import com.loglog.api.commons.beans.CategoryBean; +import com.loglog.api.commons.constants.Constants; +import com.loglog.api.commons.modules.service.coupon.CouponMasterService; +import com.loglog.api.commons.modules.service.coupon.CouponPublicService; + + +@Controller +@RequestMapping(produces = MediaType.APPLICATION_JSON_VALUE) +public class CouponController { + + @Value("${server.url.img.coupon}") + private String URL_IMG_COUPON; + + @Autowired + private CouponPublicService couponPublicService; + @Autowired + private CouponMasterService couponMasterService; + /** + * 로그인 + * @param CouponPublicBean + * @param request + * @return CouponUserListBean + */ + @RequestMapping(value="/coupon/getCouponListAjax", method = RequestMethod.GET) + @ResponseBody + public Map getcoupon(CouponPublicBean couponPublicBean,PagingBean pagingBean,GeolocationBean geolocationBean, CategoryBean categoryBean,HttpServletRequest request){ + + Map map = new HashMap<>(); + map.put(Constants.RESULT, Constants.FAIL); + String typeCheck = couponPublicBean.getType(); + List result = new ArrayList(); + try { + int pagecount = pagingBean.getCountPerRecord(); + pagingBean.setCountPerRecord(pagecount); + int totalCount = couponPublicService.selectCouponCount(couponPublicBean, pagingBean); + int totalCount2 = couponPublicService.selectSeenCouponCount(couponPublicBean, pagingBean); + // 페이징 계산 , 가져올 데이터 시작위치 끝위치 계산 + pagingBean.calcPage(totalCount); + List CategoryResult = couponPublicService.selectCategoryList(categoryBean); + if(typeCheck.equals("1")) { + result = couponPublicService.selectGetCoupons(couponPublicBean,pagingBean); + map.put("totCount", totalCount); + map.put(Constants.RESULT_MSG, "全体クーポン照会に成功しました"); + }else if(typeCheck.equals("2")) { + System.out.println("위도 : " + geolocationBean.getLatitude()); + System.out.println("경도 : " + geolocationBean.getLongtitude()); + result = couponPublicService.selectGeoGetCoupons(couponPublicBean,geolocationBean,pagingBean); + map.put("totCount", totalCount); + map.put(Constants.RESULT_MSG, "ユーザーの周辺の利用可能なクーポン照会に成功しました."); + }else if(typeCheck.equals("3")){ + pagingBean.calcPage(totalCount2); // 사용한 쿠폰조회는 페이징 다시 계산 + result = couponPublicService.selectSeenCoupons(couponPublicBean,pagingBean); + map.put("totCount", totalCount2); + map.put(Constants.RESULT_MSG, "詳細表示したクーポン検索に成功しました"); + } + + if(result != null) { + + map.put("pagingBean", pagingBean); + map.put("categoryList", CategoryResult); + map.put("couponList", result); + map.put(Constants.RESULT, Constants.OK); + + } + } catch (Exception e) { + e.printStackTrace(); + map.put(Constants.RESULT, Constants.FAIL); + map.put(Constants.RESULT_MSG, "予期しないエラーのためログインに失敗しました。しばらくしてからもう一度お試しください"); + } + return map; + } + + /** + * 로그인 + * @param userBean + * @param request + * @return + */ + @RequestMapping(value="/coupon/getCouponDetailAjax", method = RequestMethod.GET) + @ResponseBody + public Map detail(CouponMasterBean couponMasterBean, HttpServletRequest request){ + + Map map = new HashMap<>(); + map.put(Constants.RESULT, Constants.FAIL); + + try { + couponMasterBean = couponMasterService.selectCouponDetail(couponMasterBean); + if(couponMasterBean != null) { + map.put("data", couponMasterBean); + map.put(Constants.RESULT, Constants.OK); + map.put(Constants.RESULT_MSG, "クーポン詳細照会に成功しました"); + + } + } catch (Exception e) { + e.printStackTrace(); + map.put(Constants.RESULT, Constants.FAIL); + map.put(Constants.RESULT_MSG, "予期しないエラーでクーポン情報を取得できませんでした"); + } + return map; + } + + @RequestMapping(value="/coupon/getLikeCouponListAjax", method = RequestMethod.GET) + @ResponseBody + public Map getLikecoupon(CouponPublicBean couponPublicBean,PagingBean pagingBean, HttpServletRequest request){ + + Map map = new HashMap<>(); + map.put(Constants.RESULT, Constants.FAIL); + + try { + int pagecount = pagingBean.getCountPerRecord(); + System.out.println(pagecount); + pagingBean.setCountPerRecord(pagecount); + + int totalCount = couponPublicService.selectLikeCouponCount(couponPublicBean, pagingBean); + // 페이징 계산 , 가져올 데이터 시작위치 끝위치 계산 + pagingBean.calcPage(totalCount); + System.out.println("시작 로우번호" + pagingBean.getStartRow()); + System.out.println("보여줄 갯수" + pagingBean.getCountPerRecord()); + + List result = couponPublicService.selectGetLikeCoupons(couponPublicBean,pagingBean); + if(couponPublicBean != null) { + map.put("totCount", totalCount); + map.put("data", result); + map.put("pagingBean", pagingBean); + map.put(Constants.RESULT, Constants.OK); + map.put(Constants.RESULT_MSG, "ユーザーのクーポンリストの検索に成功しました"); + } + } catch (Exception e) { + e.printStackTrace(); + map.put(Constants.RESULT, Constants.FAIL); + map.put(Constants.RESULT_MSG, "予期しないエラーのためクーポン照会に失敗しました。しばらくしてからもう一度お試しください"); + } + return map; + } + + @RequestMapping(value = "/coupon/insertLikeCouponAjax", method = RequestMethod.POST) + @ResponseBody + public Map likeCoupon(CouponPublicBean couponPublicBean, HttpServletRequest request) throws Exception{ + Map map = new HashMap(); + int likeCheck = couponPublicBean.getLiked(); + map.put(Constants.RESULT, Constants.FAIL); + map.put(Constants.RESULT_MSG, "クーポンのいいねに失敗しました"); + int result; + System.out.println("즐겨찾기 유무 체크" + likeCheck); + try { + if(likeCheck == 1) { + System.out.println("쿠폰 좋아요"); + result = couponPublicService.insertCouponLike(couponPublicBean); + map.put(Constants.RESULT, Constants.OK); + map.put(Constants.RESULT_MSG, "ユーザーがクーポンをお気に入りに追加しました"); + }else { + System.out.println("쿠폰 좋아요 취소"); + result = couponPublicService.insertCouponUnLike(couponPublicBean); + map.put(Constants.RESULT, Constants.OK); + map.put(Constants.RESULT_MSG, "ユーザーがクーポンのお気に入りをキャンセルしました"); + } + + } catch (Exception e) { + e.printStackTrace(); + map.put(Constants.RESULT, Constants.FAIL); + map.put(Constants.RESULT_MSG, "予期しないエラーが発生したため、クーポンが好きで失敗しました。しばらくしてからもう一度お試しください"); + } + return map; + } + + @RequestMapping(value = "/coupon/insertUseCouponAjax", method = RequestMethod.POST) + @ResponseBody + public Map UseCoupon(CouponPublicBean couponPublicBean, HttpServletRequest request) throws Exception{ + Map map = new HashMap(); + map.put(Constants.RESULT, Constants.FAIL); + map.put(Constants.RESULT_MSG, "クーポンの使用に失敗しました"); + + try { + int couponCheck = couponPublicService.selectCouponCheck(couponPublicBean); + if(couponCheck < 1) { + map.put(Constants.RESULT, Constants.FAIL); + map.put(Constants.RESULT_MSG, "存在しないクーポンコードです"); + }else { + int usedCheck = couponPublicService.selectUsedCouponCheck(couponPublicBean); + if(usedCheck > 0) { + map.put(Constants.RESULT, Constants.FAIL); + map.put(Constants.RESULT_MSG, "すでに使用したクーポンコードです"); + }else { + int result = couponPublicService.insertUseCoupon(couponPublicBean); + if(result > 0) { + map.put(Constants.RESULT, Constants.OK); + map.put(Constants.RESULT_MSG, "クーポンの使用に成功しました"); + } + } + } + + } catch (Exception e) { + e.printStackTrace(); + map.put(Constants.RESULT, Constants.FAIL); + map.put(Constants.RESULT_MSG, "予期しないエラーのため、クーポンの使用に失敗しました。しばらくしてからもう一度お試しください"); + } + return map; + } + + @RequestMapping(value = "/coupon/insertSeenCouponAjax", method = RequestMethod.POST) + @ResponseBody + public Map SeenCoupon(CouponPublicBean couponPublicBean, HttpServletRequest request) throws Exception{ + Map map = new HashMap(); + map.put(Constants.RESULT, Constants.FAIL); + map.put(Constants.RESULT_MSG, "クーポンの確認に失敗しました"); + + try { + // 일단 있는 쿠폰인지 확인 + int couponCheck = couponPublicService.selectCouponCheck(couponPublicBean); + if(couponCheck < 1) { + map.put(Constants.RESULT, Constants.FAIL); + map.put(Constants.RESULT_MSG, "存在しないクーポンコードです"); + }else { + // coupon_seen에 데이터가 있는지 확인(중복으로 들어가면 안됨) + int couponSeenCheck = couponPublicService.selectSeenCheck(couponPublicBean); + if(couponSeenCheck > 0) { + map.put(Constants.RESULT, Constants.FAIL); + map.put(Constants.RESULT_MSG, "一度確認したクーポンです"); + }else { + int couponSeen = couponPublicService.insertSeenCoupon(couponPublicBean); + if(couponSeen > 0) { + map.put(Constants.RESULT, Constants.OK); + map.put(Constants.RESULT_MSG, "クーポン詳細ページで確認しました"); + } + } + } + + } catch (Exception e) { + e.printStackTrace(); + map.put(Constants.RESULT, Constants.FAIL); + map.put(Constants.RESULT_MSG, "予期しないエラーのため、クーポン詳細の確認に失敗しました。しばらくしてからもう一度お試しください"); + } + return map; + } +} diff --git a/src/main/java/com/loglog/api/controller/development/DevelopmentController.java b/src/main/java/com/loglog/api/controller/development/DevelopmentController.java new file mode 100644 index 0000000..90bd02c --- /dev/null +++ b/src/main/java/com/loglog/api/controller/development/DevelopmentController.java @@ -0,0 +1,119 @@ +package com.loglog.api.controller.development; + + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.MediaType; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.ResponseBody; + +import com.loglog.api.commons.beans.BoardBean; +import com.loglog.api.commons.beans.PagingBean; +import com.loglog.api.commons.beans.UserBean; +import com.loglog.api.commons.modules.service.board.BoardService; +import com.loglog.api.commons.utils.SessionUtil; + + +@Controller +@RequestMapping(produces = MediaType.APPLICATION_JSON_VALUE) +public class DevelopmentController { + + @Autowired + private BoardService boardService; + + /** + * TBL_BOARD 게시판 리스트 + * @return map + */ + @RequestMapping(value = "/development/editor", method = RequestMethod.GET) + public String daumEditor(String bdTypeCd, HttpServletRequest request, HttpServletResponse response, Model model) throws Exception { + model.addAttribute("bdTypeCd", bdTypeCd); + return "development/editor"; + } + + /** + * TBL_BOARD 게시판 리스트 + * @return map + */ + @RequestMapping(value = "/development/update", method = RequestMethod.GET) + public String daumUpdate(String bdNo,HttpServletRequest request, HttpServletResponse response, Model model) throws Exception { + model.addAttribute("bdNo", bdNo); + return "development/update"; + } + + /** + * TBL_BOARD 게시판 리스트 + * @return map + */ + @RequestMapping(value = "/development/list", method = RequestMethod.GET) + @ResponseBody + public Map getdevelopmentList(PagingBean pagingBean, HttpSession session, HttpServletRequest request, HttpServletResponse response) throws Exception { + + Map map = new HashMap(); + try { + + + UserBean userBean = SessionUtil.getUserBean(request); + + if(userBean != null) { + pagingBean.setUserId(userBean.getUserCd()); + } + + pagingBean.setBdTypeCd("2"); + // 전체 글 갯수 구함 + int totCount = boardService.selectBoardCount(pagingBean); + + // 페이징 계산 , 가져올 데이터 시작위치 끝위치 계산 + pagingBean.calcPage(totCount); + + List boardList = boardService.boardList(pagingBean); + + map.put("totCount", totCount); + map.put("boardList", boardList); + map.put("pagingBean", pagingBean); + + } catch (Exception e) { + e.printStackTrace(); + } + + return map; + } + + /** + * TBL_BOARD 게시판 상세 + * @return map + */ + @RequestMapping(value = "/development/detail", method = RequestMethod.GET) + @ResponseBody + public Map getdevelopmentDetail(BoardBean boardBean, HttpSession session, HttpServletRequest request, HttpServletResponse response) throws Exception { + + Map map = new HashMap(); + try { + + UserBean userBean = SessionUtil.getUserBean(request); + if(userBean != null) { + boardBean.setBdWriterId(userBean.getUserCd()); + } + boardBean.setBdTypeCd("2"); + BoardBean selectBean = boardService.selectInBoard(boardBean); + + map.put("detail", selectBean); + + } catch (Exception e) { + e.printStackTrace(); + } + + return map; + } + +} diff --git a/src/main/java/com/loglog/api/controller/event/EventController.java b/src/main/java/com/loglog/api/controller/event/EventController.java new file mode 100644 index 0000000..2ddc9f5 --- /dev/null +++ b/src/main/java/com/loglog/api/controller/event/EventController.java @@ -0,0 +1,119 @@ +package com.loglog.api.controller.event; + + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.MediaType; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.ResponseBody; + +import com.loglog.api.commons.beans.BoardBean; +import com.loglog.api.commons.beans.PagingBean; +import com.loglog.api.commons.beans.UserBean; +import com.loglog.api.commons.modules.service.board.BoardService; +import com.loglog.api.commons.utils.SessionUtil; + + +@Controller +@RequestMapping(produces = MediaType.APPLICATION_JSON_VALUE) +public class EventController { + + @Autowired + private BoardService boardService; + + /** + * TBL_BOARD 게시판 리스트 + * @return map + */ + @RequestMapping(value = "/event/editor", method = RequestMethod.GET) + public String daumEditor(String bdTypeCd, HttpServletRequest request, HttpServletResponse response, Model model) throws Exception { + model.addAttribute("bdTypeCd", bdTypeCd); + return "event/editor"; + } + + /** + * TBL_BOARD 게시판 리스트 + * @return map + */ + @RequestMapping(value = "/event/update", method = RequestMethod.GET) + public String daumUpdate(String bdNo,HttpServletRequest request, HttpServletResponse response, Model model) throws Exception { + model.addAttribute("bdNo", bdNo); + return "event/update"; + } + + /** + * TBL_BOARD 게시판 리스트 + * @return map + */ + @RequestMapping(value = "/event/list", method = RequestMethod.GET) + @ResponseBody + public Map getEventList(PagingBean pagingBean, HttpSession session, HttpServletRequest request, HttpServletResponse response) throws Exception { + + Map map = new HashMap(); + try { + + + UserBean userBean = SessionUtil.getUserBean(request); + + if(userBean != null) { + pagingBean.setUserId(userBean.getUserCd()); + } + + pagingBean.setBdTypeCd("1"); + // 전체 글 갯수 구함 + int totCount = boardService.selectBoardCount(pagingBean); + + // 페이징 계산 , 가져올 데이터 시작위치 끝위치 계산 + pagingBean.calcPage(totCount); + + List boardList = boardService.boardList(pagingBean); + + map.put("totCount", totCount); + map.put("boardList", boardList); + map.put("pagingBean", pagingBean); + + } catch (Exception e) { + e.printStackTrace(); + } + + return map; + } + + /** + * TBL_BOARD 게시판 상세 + * @return map + */ + @RequestMapping(value = "/event/detail", method = RequestMethod.GET) + @ResponseBody + public Map getEventDetail(BoardBean boardBean, HttpSession session, HttpServletRequest request, HttpServletResponse response) throws Exception { + + Map map = new HashMap(); + try { + + UserBean userBean = SessionUtil.getUserBean(request); + if(userBean != null) { + boardBean.setBdWriterId(userBean.getUserCd()); + } + boardBean.setBdTypeCd("1"); + BoardBean selectBean = boardService.selectInBoard(boardBean); + + map.put("detail", selectBean); + + } catch (Exception e) { + e.printStackTrace(); + } + + return map; + } + +} diff --git a/src/main/java/com/loglog/api/controller/main/MainController.java b/src/main/java/com/loglog/api/controller/main/MainController.java new file mode 100644 index 0000000..9cac4f9 --- /dev/null +++ b/src/main/java/com/loglog/api/controller/main/MainController.java @@ -0,0 +1,73 @@ +package com.loglog.api.controller.main; + + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.MediaType; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.ResponseBody; + +import com.loglog.api.commons.beans.BoardBean; +import com.loglog.api.commons.beans.PagingBean; +import com.loglog.api.commons.modules.service.board.BoardService; + + +@Controller +@RequestMapping(produces = MediaType.APPLICATION_JSON_VALUE) +public class MainController { + + @Autowired + private BoardService boardService; + + /** + * TBL_BOARD 게시판 리스트 + * @return map + */ + @RequestMapping(value = "/main", method = RequestMethod.GET) + @ResponseBody + public Map main(PagingBean pagingBean, HttpSession session, HttpServletRequest request, HttpServletResponse response) throws Exception { + + Map map = new HashMap(); + try { + + //대회정보(Festival) + pagingBean.setBdTypeCd("1"); + pagingBean.setCountPerRecord(4); + int eventCount = boardService.selectBoardCount(pagingBean); + pagingBean.calcPage(eventCount); + List eventList = boardService.boardList(pagingBean); + + //공지사항 + pagingBean.setBdTypeCd("6"); + int noticeCount = boardService.selectBoardCount(pagingBean); + pagingBean.calcPage(noticeCount); + List noticeList = boardService.boardList(pagingBean); + + //갤러리 + pagingBean.setBdTypeCd("12"); + pagingBean.setCountPerRecord(14); + int galeryCount = boardService.selectBoardCount(pagingBean); + pagingBean.calcPage(galeryCount); + List galeryList = boardService.boardList(pagingBean); + + map.put("eventList", eventList); + map.put("noticeList", noticeList); + map.put("galeryList", galeryList); + + } catch (Exception e) { + e.printStackTrace(); + } + + return map; + } + +} diff --git a/src/main/java/com/loglog/api/controller/message/MsgController.java b/src/main/java/com/loglog/api/controller/message/MsgController.java new file mode 100644 index 0000000..01a6abc --- /dev/null +++ b/src/main/java/com/loglog/api/controller/message/MsgController.java @@ -0,0 +1,251 @@ +package com.loglog.api.controller.message; + + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +import javax.servlet.http.HttpServletRequest; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.dao.DuplicateKeyException; +import org.springframework.http.MediaType; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.ResponseBody; + +import com.loglog.api.commons.beans.UserBean; +import com.loglog.api.commons.beans.CardMasterBean; +import com.loglog.api.commons.beans.CouponPublicBean; +import com.loglog.api.commons.beans.CouponUserListBean; +import com.loglog.api.commons.beans.GeolocationBean; +import com.loglog.api.commons.beans.MsgMasterBean; +import com.loglog.api.commons.beans.ShopMasterBean; +import com.loglog.api.commons.constants.CodeConstant; +import com.loglog.api.commons.constants.Constants; +import com.loglog.api.commons.modules.service.user.UserService; +import com.loglog.api.commons.modules.service.message.MsgMasterService; +import com.loglog.api.commons.modules.service.coupon.CouponMasterService; +import com.loglog.api.commons.utils.CommonUtils; +import com.loglog.api.commons.utils.JwtTokenHelper; +import com.loglog.api.commons.utils.SessionUtil; + + +@Controller +@RequestMapping(produces = MediaType.APPLICATION_JSON_VALUE) +public class MsgController { + + @Autowired + private MsgMasterService msgMasterService; + + @RequestMapping(value="/message/getMessageListAjax", method = RequestMethod.GET) + @ResponseBody + public Map getMessageList(MsgMasterBean msgMasterBean, HttpServletRequest request){ + + Map map = new HashMap<>(); + map.put(Constants.RESULT, Constants.FAIL); + String msgType = msgMasterBean.getMsgType(); + List result = new ArrayList(); + try { + if(msgType.equals("1")) { + System.out.println("전체 메세지 출력"); + result = msgMasterService.selectMsgText(msgMasterBean); + map.put(Constants.RESULT_MSG, "ユーザーのフルセージリストの照会に成功しました"); + }else if(msgType.equals("2")) { + result = msgMasterService.selectNoitMsg(msgMasterBean); + System.out.println("공지사항 출력"); + map.put(Constants.RESULT_MSG, "ユーザーの通知リストの照会に成功しました"); + }else if(msgType.equals("3")) { + result = msgMasterService.selectShopMsgList(msgMasterBean); + System.out.println("상점 메세지 출력"); + map.put(Constants.RESULT_MSG, "ユーザーのお気に入りの店が送ったメッセージ照会に成功しました"); + } + + if(result != null) { + map.put("data", result); + map.put(Constants.RESULT, Constants.OK); + }else { + map.put(Constants.RESULT, Constants.FAIL); + map.put(Constants.RESULT_MSG, "ユーザーからのメッセージはありません"); + } + } catch (Exception e) { + e.printStackTrace(); + map.put(Constants.RESULT, Constants.FAIL); + map.put(Constants.RESULT_MSG, "予期しないエラーのためログインに失敗しました。しばらくしてからもう一度お試しください"); + } + return map; + } + + @RequestMapping(value="/message/getNotiMsgDetailAjax", method = RequestMethod.GET) + @ResponseBody + public Map getMessageDetail(MsgMasterBean msgMasterBean, HttpServletRequest request){ + + Map map = new HashMap<>(); + map.put(Constants.RESULT, Constants.FAIL); + String msgGrn = msgMasterBean.getMsgType(); + MsgMasterBean result = msgMasterBean; + try { + + result = msgMasterService.selectMsgTextDetail(msgMasterBean); + + if(result != null) { + map.put("data", result); + map.put(Constants.RESULT, Constants.OK); + map.put(Constants.RESULT_MSG, "ユーザーのメッセージリストの照会に成功しました"); + }else { + map.put(Constants.RESULT, Constants.FAIL); + map.put(Constants.RESULT_MSG, "ユーザーからのメッセージはありません"); + } + } catch (Exception e) { + e.printStackTrace(); + map.put(Constants.RESULT, Constants.FAIL); + map.put(Constants.RESULT_MSG, "予期しないエラーのため、メッセージの確認に失敗しました。しばらくしてからもう一度お試しください"); + } + return map; + } + + @RequestMapping(value="/message/getShopMsgListAjax", method = RequestMethod.GET) + @ResponseBody + public Map getLikeShopMessage(MsgMasterBean msgMasterBean, HttpServletRequest request){ + + Map map = new HashMap<>(); + map.put(Constants.RESULT, Constants.FAIL); + map.put(Constants.RESULT_MSG, "お気に入りの店舗のメッセージリストの検索に失敗しました"); + System.out.println("유저코드" + msgMasterBean.getUserCd()); + try { + List resultList = msgMasterService.selectShopMsgList(msgMasterBean); + if(resultList != null) { + map.put("data", resultList); + map.put(Constants.RESULT, Constants.OK); + map.put(Constants.RESULT_MSG, "お気に入りの店舗のメッセージリストの検索に成功しました"); + } + } catch (Exception e) { + e.printStackTrace(); + map.put(Constants.RESULT, Constants.FAIL); + map.put(Constants.RESULT_MSG, "予期しないエラーのため、メッセージの確認に失敗しました。しばらくしてからもう一度お試しください"); + } + return map; + } + + @RequestMapping(value="/message/getShopMsgDetailAjax", method = RequestMethod.GET) + @ResponseBody + public Map getLikeShopMessageDetail(MsgMasterBean msgMasterBean, HttpServletRequest request){ + + Map map = new HashMap<>(); + map.put(Constants.RESULT, Constants.FAIL); + map.put(Constants.RESULT_MSG, "お気に入りの店舗の詳細メッセージの照会に失敗しました"); + System.out.println("유저코드" + msgMasterBean.getUserCd()); + try { + List resultList = msgMasterService.selectShopMsgDetail(msgMasterBean); + if(resultList != null) { + map.put("data", resultList); + map.put(Constants.RESULT, Constants.OK); + map.put(Constants.RESULT_MSG, "お気に入りの店舗の詳細メッセージリストの照会に成功しました"); + } + } catch (Exception e) { + e.printStackTrace(); + map.put(Constants.RESULT, Constants.FAIL); + map.put(Constants.RESULT_MSG, "予期しないエラーのため、メッセージの確認に失敗しました。しばらくしてからもう一度お試しください"); + } + return map; + } + + @RequestMapping(value = "/message/updateMsgSeenAjax", method = RequestMethod.POST) + @ResponseBody + public Map updateMsgSeen(@RequestBody MsgMasterBean msgMasterBean, HttpServletRequest request) throws Exception{ + Map map = new HashMap(); + map.put(Constants.RESULT, Constants.FAIL); + map.put(Constants.RESULT_MSG, "ッセージの確認に失敗しました"); + + try { + int result = 0; + result = msgMasterService.updateMsgSeen(msgMasterBean); + if(result > 0) { + map.put(Constants.RESULT, Constants.OK); + map.put(Constants.RESULT_MSG, "メッセージの確認に成功しました"); + } + + } catch (Exception e) { + e.printStackTrace(); + map.put(Constants.RESULT, Constants.FAIL); + map.put(Constants.RESULT_MSG, "予期しないエラーのため、ストアのお気に入りに失敗しました。しばらくしてからもう一度お試しください"); + } + return map; + } + + + @RequestMapping(value="/message/getMsgDetailAjax", method = RequestMethod.GET) + @ResponseBody + public Map getpMessageDetail(MsgMasterBean msgMasterBean, HttpServletRequest request){ + + Map map = new HashMap<>(); + map.put(Constants.RESULT, Constants.FAIL); + map.put(Constants.RESULT_MSG, "詳細メッセージの照会に失敗しました"); + System.out.println("유저코드" + msgMasterBean.getUserCd()); + try { + List resultList = msgMasterService.selectMegDeltail(msgMasterBean); + if(resultList != null) { + map.put("data", resultList); + map.put(Constants.RESULT, Constants.OK); + map.put(Constants.RESULT_MSG, "詳細メッセージの照会に成功しました。"); + } + } catch (Exception e) { + e.printStackTrace(); + map.put(Constants.RESULT, Constants.FAIL); + map.put(Constants.RESULT_MSG, "予期しないエラーのため、ストアのお気に入りに失敗しました。しばらくしてからもう一度お試しください"); + } + return map; + } + + @RequestMapping(value="/message/getNotReadMsgCountAjax", method = RequestMethod.GET) + @ResponseBody + public Map getNotReadMsgCount(MsgMasterBean msgMasterBean, HttpServletRequest request){ + + Map map = new HashMap<>(); + map.put(Constants.RESULT, Constants.FAIL); + map.put(Constants.RESULT_MSG, "未読メッセージ数の返却に失敗しました"); + try { + MsgMasterBean notReadNoticeBean = msgMasterService.selectNotReadNotice(msgMasterBean); // 읽지않은 통지 메세지 개수 + MsgMasterBean notReadShopMsgBean = msgMasterService.selectNotReadShopMsg(msgMasterBean); // 읽지않은 오시라세 메세지 개수 + if(notReadNoticeBean != null && notReadShopMsgBean != null) { + map.put("notReadNotice", notReadNoticeBean); + map.put("notReadShopMsg", notReadShopMsgBean); + map.put(Constants.RESULT, Constants.OK); + map.put(Constants.RESULT_MSG, "未読メッセージ数の返却に成功しました"); + } + } catch (Exception e) { + e.printStackTrace(); + map.put(Constants.RESULT, Constants.FAIL); + map.put(Constants.RESULT_MSG, "予期しないエラーのため、ストアのお気に入りに失敗しました。しばらくしてからもう一度お試しください"); + } + return map; + } + + @RequestMapping(value = "/message/updateNoticSeenAjax", method = RequestMethod.POST) + @ResponseBody + public Map updateNoticSeen(@RequestBody MsgMasterBean msgMasterBean, HttpServletRequest request) throws Exception{ + Map map = new HashMap(); + map.put(Constants.RESULT, Constants.FAIL); + map.put(Constants.RESULT_MSG, "通知の確認に失敗しました"); + + try { + int result = 0; + result = msgMasterService.updateNoticSeen(msgMasterBean); + if(result > 0) { + map.put(Constants.RESULT, Constants.OK); + map.put(Constants.RESULT_MSG, "通知確認に成功しました."); + } + + } catch (Exception e) { + e.printStackTrace(); + map.put(Constants.RESULT, Constants.FAIL); + map.put(Constants.RESULT_MSG, "予期しないエラーのため、ストアのお気に入りに失敗しました。しばらくしてからもう一度お試しください"); + } + return map; + } +} diff --git a/src/main/java/com/loglog/api/controller/shop/ShopController.java b/src/main/java/com/loglog/api/controller/shop/ShopController.java new file mode 100644 index 0000000..328509f --- /dev/null +++ b/src/main/java/com/loglog/api/controller/shop/ShopController.java @@ -0,0 +1,179 @@ +package com.loglog.api.controller.shop; + + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +import javax.servlet.http.HttpServletRequest; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.dao.DuplicateKeyException; +import org.springframework.http.MediaType; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.ResponseBody; + +import com.loglog.api.commons.beans.UserBean; +import com.loglog.api.commons.beans.CardMasterBean; +import com.loglog.api.commons.beans.CouponPublicBean; +import com.loglog.api.commons.beans.CouponUserListBean; +import com.loglog.api.commons.beans.ShopDetailBean; +import com.loglog.api.commons.beans.ShopMasterBean; +import com.loglog.api.commons.constants.CodeConstant; +import com.loglog.api.commons.constants.Constants; +import com.loglog.api.commons.modules.service.user.UserService; +import com.loglog.api.commons.modules.service.shop.ShopMasterService; +import com.loglog.api.commons.modules.service.coupon.CouponMasterService; +import com.loglog.api.commons.utils.CommonUtils; +import com.loglog.api.commons.utils.JwtTokenHelper; +import com.loglog.api.commons.utils.SessionUtil; + + +@Controller +@RequestMapping(produces = MediaType.APPLICATION_JSON_VALUE) +public class ShopController { + + @Autowired + private ShopMasterService shopMasterService; + + @ResponseBody + @RequestMapping(value="/shop/getDetailShopAjax", method = RequestMethod.GET) + public Map login(ShopDetailBean shopDetailBean, HttpServletRequest request){ + + Map map = new HashMap<>(); + map.put(Constants.RESULT, Constants.FAIL); + map.put(Constants.RESULT_MSG, "クーポンの詳細情報を取得できませんでした"); + + try { + shopDetailBean = shopMasterService.selectShopDetail(shopDetailBean); + if(shopDetailBean != null) { + + map.put(Constants.RESULT, Constants.OK); + map.put(Constants.RESULT_MSG, "店舗の詳細を取得することに成功しました"); + map.put("data", shopDetailBean); + } + } catch (Exception e) { + e.printStackTrace(); + map.put(Constants.RESULT, Constants.FAIL); + map.put(Constants.RESULT_MSG, "予期しないエラーが原因で店舗の詳細を取得できませんでした"); + } + return map; + } + + @ResponseBody + @RequestMapping(value="/shop/getProxShopListAjax", method = RequestMethod.GET) + public Map getProxShopListAjax (ShopMasterBean shopMasterBean, HttpServletRequest request){ + + Map map = new HashMap<>(); + map.put(Constants.RESULT, Constants.FAIL); + map.put(Constants.RESULT_MSG, "周辺の店舗の場所を取得できませんでした"); + + try { + List resultList = shopMasterService.selectProxShopList(shopMasterBean); + if(shopMasterBean != null) { + map.put(Constants.RESULT, Constants.OK); + map.put(Constants.RESULT_MSG, "周辺の店舗の場所を取得することに成功しました"); + map.put("data", resultList); + } + } catch (Exception e) { + e.printStackTrace(); + map.put(Constants.RESULT, Constants.FAIL); + map.put(Constants.RESULT_MSG, "予期しないエラーが原因で店舗の詳細を取得できませんでした"); + } + return map; + } + + @RequestMapping(value = "/shop/insertLikeShopAjax", method = RequestMethod.POST) + @ResponseBody + public Map insertLikeShop(ShopMasterBean shopMasterBean, HttpServletRequest request) throws Exception{ + Map map = new HashMap(); + map.put(Constants.RESULT, Constants.FAIL); + map.put(Constants.RESULT_MSG, "ストアのお気に入りロジックに失敗しました"); + + try { + int result = 0; + int resultTempo = 0; + String liked = shopMasterBean.getLiked(); + if(liked.equals("1")) { + UUID one = UUID.randomUUID(); + shopMasterBean.setId(one.toString()); + int checkRoom = shopMasterService.selectCheckRoom(shopMasterBean); + resultTempo = shopMasterService.insertLikeTempo(shopMasterBean); + // rooms가 존재하면 rooms추가하지 않도록 제작 + if(checkRoom == 0) { + System.out.println("room이 없은 상점"); + result = shopMasterService.insertLikeShop(shopMasterBean); + } + if(resultTempo > 0) { + map.put(Constants.RESULT, Constants.OK); + map.put(Constants.RESULT_MSG, "ストアのお気に入りを追加しました"); + } + }else { + result = shopMasterService.deleteLikeTempo(shopMasterBean); + map.put(Constants.RESULT, Constants.OK); + map.put(Constants.RESULT_MSG, "ストアのお気に入りのキャンセルに成功しました"); + } + if(result > 0) { + map.put(Constants.RESULT, Constants.OK); + } + + } catch (Exception e) { + e.printStackTrace(); + map.put(Constants.RESULT, Constants.FAIL); + map.put(Constants.RESULT_MSG, "予期しないエラーのため、ストアのお気に入りに失敗しました。しばらくしてからもう一度お試しください"); + } + return map; + } + + @ResponseBody + @RequestMapping(value="/shop/getLikeShopListAjax", method = RequestMethod.GET) + public Map getLikeShopList (ShopDetailBean shopDetailBean, HttpServletRequest request){ + + Map map = new HashMap<>(); + map.put(Constants.RESULT, Constants.FAIL); + map.put(Constants.RESULT_MSG, "お気に入りの店舗リストの検索に失敗しました"); + + try { + List resultList = shopMasterService.selectShopList(shopDetailBean); + if(resultList != null) { + map.put(Constants.RESULT, Constants.OK); + map.put(Constants.RESULT_MSG, "お気に入りのショップのリスト照会に成功しました."); + map.put("data", resultList); + } + } catch (Exception e) { + e.printStackTrace(); + map.put(Constants.RESULT, Constants.FAIL); + map.put(Constants.RESULT_MSG, "予期しないエラーが原因で店舗の詳細を取得できませんでした"); + } + return map; + } + + @ResponseBody + @RequestMapping(value="/shop/getSearchShopListAjax", method = RequestMethod.GET) + public Map getSrarchShopList (ShopDetailBean shopDetailBean, HttpServletRequest request){ + + Map map = new HashMap<>(); + map.put(Constants.RESULT, Constants.FAIL); + map.put(Constants.RESULT_MSG, "検索したストアリストの検索に失敗しました"); + + try { + List resultList = shopMasterService.selectSearchShopList(shopDetailBean); + if(resultList != null) { + map.put(Constants.RESULT, Constants.OK); + map.put(Constants.RESULT_MSG, "検索した店舗リストの検索に成功しました"); + map.put("data", resultList); + } + } catch (Exception e) { + e.printStackTrace(); + map.put(Constants.RESULT, Constants.FAIL); + map.put(Constants.RESULT_MSG, "予期しないエラーが原因で店舗検索に失敗しました"); + } + return map; + } +} diff --git a/src/main/java/com/loglog/api/controller/test/EmailTester.java b/src/main/java/com/loglog/api/controller/test/EmailTester.java new file mode 100644 index 0000000..5ab3c7d --- /dev/null +++ b/src/main/java/com/loglog/api/controller/test/EmailTester.java @@ -0,0 +1,40 @@ +package com.loglog.api.controller.test; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.mail.SimpleMailMessage; +import org.springframework.mail.javamail.JavaMailSender; + +public class EmailTester { + + private static final Log log = LogFactory.getLog(EmailTester.class); + + @Autowired + private JavaMailSender emailSender; + + public static void main(String[] args) { + + try { + log.info("...............preparing email......."); + SimpleMailMessage message = new SimpleMailMessage(); + message.setFrom("admin@loglog.co.jp"); + message.setTo("itbong@aniss.kr"); + message.setSubject("loglog mail title"); + String text = + "loglog test contents \n\n" + +"loglog test contents"; + + message.setText(text); + + EmailTester tester = new EmailTester(); + tester.emailSender.send(message); + log.info("...............email sent......."); + + } catch (Exception e) { + e.printStackTrace(); + } + + } + +} diff --git a/src/main/java/com/loglog/api/controller/user/UserController.java b/src/main/java/com/loglog/api/controller/user/UserController.java new file mode 100644 index 0000000..c5ddda4 --- /dev/null +++ b/src/main/java/com/loglog/api/controller/user/UserController.java @@ -0,0 +1,451 @@ +package com.loglog.api.controller.user; + + +import java.security.SecureRandom; +import java.util.HashMap; +import java.util.Map; +import java.util.regex.Pattern; +import java.util.Date; + +import javax.servlet.http.HttpServletRequest; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.MediaType; +import org.springframework.mail.SimpleMailMessage; +import org.springframework.mail.javamail.JavaMailSender; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.ResponseBody; + +import com.google.gson.Gson; +import com.loglog.api.commons.beans.UserBean; +import com.loglog.api.commons.constants.Constants; +import com.loglog.api.commons.modules.service.user.UserService; +import com.loglog.api.commons.utils.JwtTokenHelper; +import com.loglog.api.commons.utils.SessionUtil; + + +@Controller +@RequestMapping(produces = MediaType.APPLICATION_JSON_VALUE) +public class UserController { + + private static final Log log = LogFactory.getLog(UserController.class); + + + @Autowired + private UserService userService; + private Gson gson = new Gson(); + + @Autowired + private JavaMailSender emailSender; + + + /** + * 회원가입 signup + * @ASIS API name signup + * @param userNm,userPw,userPhone(폰번호가 아이디가 됨) + * @param request body + * @return + * @throws Exception + */ + @RequestMapping(value = "/user/joinUserAjax", method = RequestMethod.POST) + @ResponseBody + public Map join(@RequestBody UserBean userBean, Model model, HttpServletRequest request) throws Exception{ + Map map = new HashMap(); + int resultCnt = 0; + int checkId = 0; + String result = null; + String resultMsg = null; + checkId = userService.chkUserId(userBean); + + String pattern2 = "^[0-9a-zA-Z]([-_.]?[0-9a-zA-Z])*@[0-9a-zA-Z]([-_.]?[0-9a-zA-Z])*.[a-zA-Z]{2,3}$"; + String userEmail = userBean.getUserMail(); + if(Pattern.matches(pattern2, userEmail)) { + if(checkId < 1) { + try { + + //userBean.setUserCd(CodeConstant.USER_STATUS_CD_1000); + resultCnt = userService.insertUser(userBean); + + if(resultCnt == 1){ + String userCdStr = userService.selectUserCdStr(userBean); + result = Constants.OK; + resultMsg = "会員登録成功しました"; + System.out.println("가입된 유저 cd : " + userCdStr); + userBean.setUserCd(userCdStr); + }else { + result = Constants.FAIL; + resultMsg = "등록 실패!"; + } + resultMsg = "正常に登録されました"; + map.put("userPhone", userBean.getUserPhone()); + map.put("userNm", userBean.getUserNm()); + map.put("userMail", userBean.getUserMail()); + map.put("userCd", userBean.getUserCd()); + + UserBean newBean = new UserBean(); + newBean.setUserCd( userBean.getUserCd() ); + newBean.setUserMail( userBean.getUserMail() ); + newBean.setUserNm( userBean.getUserNm() ); + String loginInfoJson = gson.toJson(newBean); + + String userCd = newBean.getUserCd(); + String userEmail1 = newBean.getUserMail(); + String authToken = JwtTokenHelper.createJWT( + userCd, + userEmail1, + loginInfoJson, 2592000000L * 3); + map.put("accessToken", authToken); + } catch (Exception e) { + e.printStackTrace(); + result = Constants.FAIL; + } + }else { + result = Constants.FAIL; + resultMsg = "すでに登録されているメールです"; + } + } else { + result = Constants.FAIL; + resultMsg = "正しいメール形式ではありません "; + } + + map.put("result", result); + map.put("resultMsg", resultMsg); + + return map; + + } + + + /** 사용자 설정 업데이트 (자동로그인, 푸시알림) */ + @RequestMapping(value = "/user/updateUserInfoAjax", method = RequestMethod.POST) + @ResponseBody + public Map update(@RequestBody UserBean userBean,HttpServletRequest request) throws Exception{ + Map map = new HashMap(); + String result = Constants.FAIL; + String resultMsg = "ユーザー設定の設定に失敗しました"; + + try { + // userBean.setUserId(userBean.getUserId()); + + int rtnVal = userService.updateUser(userBean); + + if(rtnVal >= 1) { + map.put("data", userBean); + result = Constants.OK; + resultMsg = "ユーザー設定の設定に成功しました"; + } + + } catch (Exception e) { + e.printStackTrace(); + result = Constants.FAIL; + resultMsg = "ステムエラー発生."; + } + + map.put("resultMsg", resultMsg); + map.put("result", result); + + return map; + } + + + /** + * 로그인 + * @param userBean + * @param request + * @return + */ + @ResponseBody + @RequestMapping(value="/user/loginUserAjax", method = RequestMethod.POST) + public Map login(@RequestBody UserBean userBean, HttpServletRequest request){ + + Map map = new HashMap<>(); + map.put(Constants.RESULT, Constants.FAIL); + map.put(Constants.RESULT_MSG, "ログインに失敗しました。 ID/パスワードを確認してください"); + + try { + userBean = userService.selectUser(userBean); + if(userBean != null) { + //userService.updLastLoginDt(userBean.getUserPhone()); //마지막 로그인 날짜 갱신 + SessionUtil.setUserBean(request, userBean); + map.put(Constants.RESULT, Constants.OK); + map.put(Constants.RESULT_MSG, "ログインに成功しました"); + map.put("userNm", userBean.getUserNm()); + map.put("userMail", userBean.getUserMail()); + map.put("userPhone", userBean.getUserPhone()); + map.put("userCd", userBean.getUserCd()); + + //필요 정보만 받아서 TOken 생성 + UserBean newBean = new UserBean(); + newBean.setUserCd( userBean.getUserCd() ); + newBean.setUserMail( userBean.getUserMail() ); + newBean.setUserNm( userBean.getUserNm() ); + String loginInfoJson = gson.toJson(newBean); + + String userCd = newBean.getUserCd(); + String userEmail = newBean.getUserMail(); + String authToken = JwtTokenHelper.createJWT( + userCd, + userEmail, + loginInfoJson, 2592000000L * 3); + map.put("authToken", authToken); + } + } catch (Exception e) { + e.printStackTrace(); + map.put(Constants.RESULT, Constants.FAIL); + map.put(Constants.RESULT_MSG, "予期しないエラーのためログインに失敗しました。しばらくしてからもう一度お試しください"); + } + return map; + } + + /** + * 로그인 + * @param userBean + * @param request + * @return + */ + @RequestMapping(value="/user/detailUserAjax", method = RequestMethod.GET) + @ResponseBody + public Map detail(UserBean userBean, HttpServletRequest request){ + + Map map = new HashMap<>(); + map.put(Constants.RESULT, Constants.FAIL); + map.put(Constants.RESULT_MSG, "ユーザー詳細の照会に失敗しました"); + try { + userBean = userService.selectUserDetail(userBean); + if(userBean != null) { + map.put("data", userBean); + map.put(Constants.RESULT, Constants.OK); + map.put(Constants.RESULT_MSG, "ユーザー詳細の照会に成功した"); + } + } catch (Exception e) { + e.printStackTrace(); + map.put(Constants.RESULT, Constants.FAIL); + map.put(Constants.RESULT_MSG, "予期しないエラーのためログインに失敗しました。しばらくしてからもう一度お試しください"); + } + return map; + } + + /** + * 로그인 + * @param userBean + * @param request + * @return + */ + @RequestMapping(value="/user/getUserNameAjax", method = RequestMethod.GET) + @ResponseBody + public Map userName(UserBean userBean, HttpServletRequest request){ + + Map map = new HashMap<>(); + map.put(Constants.RESULT, Constants.FAIL); + + try { + userBean = userService.userName(userBean); + //userBean = userService.selectUserDetail(userBean); + System.out.println("1111" + userBean); + if(userBean != null) { + map.put("userNm", userBean.getUserNm()); + map.put("userKn", userBean.getUserKn()); + map.put(Constants.RESULT, Constants.OK); + + } + } catch (Exception e) { + e.printStackTrace(); + map.put(Constants.RESULT, Constants.FAIL); + map.put(Constants.RESULT_MSG, "予期しないエラーのためログインに失敗しました。しばらくしてからもう一度お試しください"); + } + return map; + } + + /** + * 로그인 + * @param userBean + * @param request + * @return + * @throws Exception + */ + @RequestMapping(value="/user/deleteUserAjax", method = RequestMethod.DELETE) + @ResponseBody + public Map UserDelete(@RequestBody UserBean userBean, HttpServletRequest request) throws Exception{ + + Map map = new HashMap<>(); + map.put(Constants.RESULT, Constants.FAIL); + + try { + int rtnVal = userService.selectUserCd(userBean); + if(rtnVal >= 1) { + userBean = userService.userDelete(userBean); + map.put("detail", userBean); + map.put(Constants.RESULT, Constants.OK); + map.put(Constants.RESULT_MSG, "会員脱退が完了しました"); + }else { + map.put(Constants.RESULT, Constants.FAIL); + map.put(Constants.RESULT_MSG, "会員脱退に失敗しました"); + } + + + } catch (Exception e) { + e.printStackTrace(); + map.put(Constants.RESULT, Constants.FAIL); + map.put(Constants.RESULT_MSG, "予期しないエラーのためログインに失敗しました。しばらくしてからもう一度お試しください"); + } + return map; + } + + /** + * 로그인 + * @param userBean + * @param request + * @return + * @throws Exception + */ + @RequestMapping(value="/user/qRLoginUserAjax", method = RequestMethod.POST) + @ResponseBody + public Map qRLoginUser(@RequestBody UserBean userBean, HttpServletRequest request) throws Exception{ + + Map map = new HashMap<>(); + map.put(Constants.RESULT, Constants.FAIL); + map.put(Constants.RESULT_MSG, "簡単なログインに失敗しました"); + + try { + String CustCd = userBean.getCustCd(); + String[] result = CustCd.split(","); + userBean.setCustCd1(result[0]); + userBean.setCustCd2(result[1]); + userBean.setCustCd3(result[2]); + userBean = userService.qRLogin(userBean); + //userBean = userService.selectUser(userBean); + if(userBean != null) { + SessionUtil.setUserBean(request, userBean); + map.put(Constants.RESULT, Constants.OK); + map.put(Constants.RESULT_MSG, "簡単ログインに成功しました"); + map.put("userNm", userBean.getUserNm()); + map.put("userMail", userBean.getUserMail()); + map.put("userPhone", userBean.getUserPhone()); + map.put("userCd", userBean.getUserCd()); + + //필요 정보만 받아서 TOken 생성 + UserBean newBean = new UserBean(); + newBean.setUserCd( userBean.getUserCd() ); + newBean.setUserMail( userBean.getUserMail() ); + newBean.setUserNm( userBean.getUserNm() ); + String loginInfoJson = gson.toJson(newBean); + + String userCd = newBean.getUserCd(); + String userEmail = newBean.getUserMail(); + String authToken = JwtTokenHelper.createJWT( + userCd, + userEmail, + loginInfoJson, 2592000000L * 3); + map.put("authToken", authToken); + map.put("data", userBean); + } + } catch (Exception e) { + e.printStackTrace(); + map.put(Constants.RESULT, Constants.FAIL); + map.put(Constants.RESULT_MSG, "予期しないエラーのためログインに失敗しました。しばらくしてからもう一度お試しください"); + } + return map; + } + + /** 사용자 설정 업데이트 (자동로그인, 푸시알림) */ + @RequestMapping(value = "/user/updateUserPwUserCdAjax", method = RequestMethod.POST) + @ResponseBody + public Map updateUserPwUserCd(@RequestBody UserBean userBean, HttpServletRequest request) throws Exception{ + Map map = new HashMap(); + String result = Constants.FAIL; + String resultMsg = "ユーザー設定の設定に失敗しました"; + String password = userBean.getUserPw(); + String checkPw = userBean.getCheckPw(); + + try { + System.out.println("원래 비밀번호" + password); + System.out.println("바뀔 비밀번호" + checkPw); + if(password.equals(checkPw)) { + int rtnVal = userService.selectKnowUserCd(userBean); + if(rtnVal >= 1) { + map.put("data", userBean); + result = Constants.OK; + resultMsg = "ユーザー設定の設定に成功しました"; + } + } + + } catch (Exception e) { + e.printStackTrace(); + result = Constants.FAIL; + resultMsg = "ユーザー設定の設定に失敗しました"; + } + + map.put("resultMsg", resultMsg); + map.put("result", result); + + return map; + } + + + /** 테스트 메일 발송 */ + @RequestMapping(value = "/user/tempPasswordMailSend", method = RequestMethod.POST) + @ResponseBody + public Map testMailSend(@RequestBody UserBean userBean, HttpServletRequest request) throws Exception{ + Map map = new HashMap(); + String result = Constants.FAIL; + String resultMsg = "회원 정보에 등록되지 않은 이메일입니다."; + + try { + int userEmailCheck = userService.selectCheckEmail(userBean); + if(userEmailCheck > 0) { + log.info("...............preparing email......."); + SimpleMailMessage message = new SimpleMailMessage(); + message.setFrom("admin@loglog.co.jp"); + message.setTo(userBean.getUserMail()); // 받는사람 + message.setSubject("loglog 임시 비밀번호 보내드립니다."); // 메세지 제목 + char[] charSet = new char[] { + '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', + 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', + 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', + '!', '@', '#', '$', '%', '^', '&' }; + + StringBuffer sb = new StringBuffer(); + SecureRandom sr = new SecureRandom(); + sr.setSeed(new Date().getTime()); + + int idx = 0; + int len = charSet.length; + for (int i=0; i<10; i++) { + // idx = (int) (len * Math.random()); + idx = sr.nextInt(len); // 강력한 난수를 발생시키기 위해 SecureRandom을 사용한다. + sb.append(charSet[idx]); + } + String text = + "임시 비밀번호 : " // 메세지 내용 + + sb.toString(); + message.setText(text); + emailSender.send(message); + log.info("...............email sent......."); + + userBean.setUserPw(sb.toString()); + int updateTempPw = userService.updatetempPw(userBean); + if(updateTempPw > 0) { + result = Constants.OK; + resultMsg = "사용자에게 임시 비밀번호를 보냈습니다."; + } + + } + + } catch (Exception e) { + e.printStackTrace(); + result = Constants.FAIL; + resultMsg = "시스템 에러발생."; + } + + map.put("resultMsg", resultMsg); + map.put("result", result); + + return map; + } +} diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties new file mode 100644 index 0000000..5000bab --- /dev/null +++ b/src/main/resources/application.properties @@ -0,0 +1,109 @@ +version.build.date=202111261500 + +#Master DB +spring.datasource.master.hikari.maximum-pool-size=5 +spring.datasource.master.hikari.driver-class-name=org.postgresql.Driver +spring.datasource.master.hikari.jdbc-url=jdbc:postgresql://leejk0523.com:5433/loglog +spring.datasource.master.hikari.read-only=false +spring.datasource.master.hikari.username=leejk0523 +spring.datasource.master.hikari.password=Ghtkssk0325 +spring.datasource.master.hikari.schema=public + +#Slave DB +spring.datasource.slave.hikari.maximum-pool-size=10 +spring.datasource.slave.hikari.driver-class-name=org.postgresql.Driver +spring.datasource.slave.hikari.jdbc-url=jdbc:postgresql://leejk0523.com:5433/loglog +spring.datasource.slave.hikari.read-only=false +spring.datasource.slave.hikari.username=leejk0523 +spring.datasource.slave.hikari.password=Ghtkssk0325 +spring.datasource.slave.hikari.schema=public + + + +##### SERVER +#U : user server +#S : seller server +#A : admin server +#M : mobile server +server=U + +#BASE URL +#MyCard +server.url.img.mycard=https://api.leejk0523.com +#Shop +server.url.img.shop=https://loglog.biz/loglog/webroot/img/Home +#Coupon +server.url.img.coupon=http://loglog.biz/loglog/webroot/img/Coupon +#Message +server.url.img.message=https://loglog.biz/loglog/webroot/img/Message + + + +# Server +server.port=8081 +server.tomcat.max-http-form-post-size=500000000 +server.tomcat.max-swallow-size=500000000 +server.tomcat.additional-tld-skip-patterns=*.jar + +##### Servlet +spring.main.web-environment=false +# MVC +spring.mvc.view.prefix=/WEB-INF/views/ +spring.mvc.view.suffix=.jsp +spring.mvc.static-path-pattern=/resources/** +spring.web.resources.static-locations=/home/ec2-user/webapps/LogLogAPI + +# Encoding +server.servlet.encoding.charset=UTF-8 +server.servlet.encoding.enabled=true +server.servlet.encoding.force=true +# Multipoart +spring.servlet.multipart.max-file-size=500MB +spring.servlet.multipart.max-request-size=500MB +spring.servlet.multipart.enabled=true +spring.servlet.multipart.location=${java.io.tmpdir} + + +# Mybatis +mybatis.type-aliases-package=com.loglog.api.commons.daos +mybatis.mapper-locations=classpath*:com/loglog/api/commons/daos/mapper/*.xml +mybatis.configuration.cache-enabled=true +mybatis.configuration.default-statement-timeout=3000 +mybatis.configuration.return-instance-for-empty-row=false +mybatis.configuration.jdbc-type-for-null=varchar +mybatis.configuration.map-underscore-to-camel-case=true + +# logging +logging.config=classpath:logback-config.xml + +# encoding +# locale [ko, jp, en, cha] +spring.profile.default.locale=kr +spring.mvc.locale=kr + +# Etc +spring.profile.value=local +spring.devtools.restart.enabled=true + + +##### Mail ##### +mail.id=help@aniss.kr +mail.pw=helpvotmdnjemdbcnfgkwlak&7 + + +#repository path +#repository.path=C:/DEV/WORKS/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps/OffGoRacingAPI +#repository.path = C:/DEV/WORKS/loglog_project/SRC/LogLogAPI/src/main/webapp +repository.path=/usr/local/soft/tomcat/webapps/loglog + +#image upload path +upload.board.path=/up_imgs/board_img +upload.visit.path=/up_imgs/visit_img +upload.daum.editor.file.temp.path=/up_files/daum_editor_temp +upload.daum.editor.image.temp.path=/up_imgs/daum_editor_temp +upload.board.file.path=/up_files/board_file + +upload.noti.image.path=/up_imgs/noti +upload.noti.file.path=/up_files/noti + +download.url.noti=/cs/noti/download.ans?notiAttachId= \ No newline at end of file diff --git a/src/main/resources/logback-config.xml b/src/main/resources/logback-config.xml new file mode 100644 index 0000000..f62af1a --- /dev/null +++ b/src/main/resources/logback-config.xml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + %-5level %d{HH:mm:ss.SSS} [%thread %F:%L] %method - %msg%n + + + + + + + ${LOG_PATH} + + + %-5level %d{HH:mm:ss.SSS} [%thread %F:%L] %method - %msg%n + + + + + + ${LOG_DIR}/app_%d{yyyy-MM-dd}_%i.log.gz + + + + 10MB + + + 60 + + + + + + + + + + + + diff --git a/src/main/resources/mybatis_config.xml b/src/main/resources/mybatis_config.xml new file mode 100644 index 0000000..0632673 --- /dev/null +++ b/src/main/resources/mybatis_config.xml @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/webapp/up_imgs/category_img/icon_beuty.png b/src/main/webapp/up_imgs/category_img/icon_beuty.png new file mode 100644 index 0000000..8a31e43 Binary files /dev/null and b/src/main/webapp/up_imgs/category_img/icon_beuty.png differ diff --git a/src/main/webapp/up_imgs/category_img/icon_clinic.png b/src/main/webapp/up_imgs/category_img/icon_clinic.png new file mode 100644 index 0000000..b724407 Binary files /dev/null and b/src/main/webapp/up_imgs/category_img/icon_clinic.png differ diff --git a/src/main/webapp/up_imgs/category_img/icon_entertaiment.png b/src/main/webapp/up_imgs/category_img/icon_entertaiment.png new file mode 100644 index 0000000..2ead273 Binary files /dev/null and b/src/main/webapp/up_imgs/category_img/icon_entertaiment.png differ diff --git a/src/main/webapp/up_imgs/category_img/icon_other.png b/src/main/webapp/up_imgs/category_img/icon_other.png new file mode 100644 index 0000000..5a00571 Binary files /dev/null and b/src/main/webapp/up_imgs/category_img/icon_other.png differ diff --git a/src/main/webapp/up_imgs/category_img/icon_restaurant.png b/src/main/webapp/up_imgs/category_img/icon_restaurant.png new file mode 100644 index 0000000..63bb405 Binary files /dev/null and b/src/main/webapp/up_imgs/category_img/icon_restaurant.png differ diff --git a/src/main/webapp/up_imgs/category_img/icon_shop.png b/src/main/webapp/up_imgs/category_img/icon_shop.png new file mode 100644 index 0000000..50db754 Binary files /dev/null and b/src/main/webapp/up_imgs/category_img/icon_shop.png differ