commit b5ce19a335f1065370ca0930a4b4922a6664c69d Author: mohammedThaqi Date: Wed Apr 3 17:13:23 2024 +0530 first-commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..549e00a --- /dev/null +++ b/.gitignore @@ -0,0 +1,33 @@ +HELP.md +target/ +!.mvn/wrapper/maven-wrapper.jar +!**/src/main/**/target/ +!**/src/test/**/target/ + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +build/ +!**/src/main/**/build/ +!**/src/test/**/build/ + +### VS Code ### +.vscode/ diff --git a/.mvn/wrapper/maven-wrapper.jar b/.mvn/wrapper/maven-wrapper.jar new file mode 100644 index 0000000..cb28b0e Binary files /dev/null and b/.mvn/wrapper/maven-wrapper.jar differ diff --git a/.mvn/wrapper/maven-wrapper.properties b/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000..5f0536e --- /dev/null +++ b/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1,2 @@ +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.5/apache-maven-3.9.5-bin.zip +wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar diff --git a/communityHallDocuments/Celebration/3_reconsileReportimg-2.png b/communityHallDocuments/Celebration/3_reconsileReportimg-2.png new file mode 100644 index 0000000..52c0b25 Binary files /dev/null and b/communityHallDocuments/Celebration/3_reconsileReportimg-2.png differ diff --git a/communityHallDocuments/Celebration/4_reconsileReportimg-2.png b/communityHallDocuments/Celebration/4_reconsileReportimg-2.png new file mode 100644 index 0000000..52c0b25 Binary files /dev/null and b/communityHallDocuments/Celebration/4_reconsileReportimg-2.png differ diff --git a/communityHallDocuments/Celebration/5_reconsileReportimg-2.png b/communityHallDocuments/Celebration/5_reconsileReportimg-2.png new file mode 100644 index 0000000..52c0b25 Binary files /dev/null and b/communityHallDocuments/Celebration/5_reconsileReportimg-2.png differ diff --git a/communityHallDocuments/Mariage/8_Screenshot 2023-10-05 155117.png b/communityHallDocuments/Mariage/8_Screenshot 2023-10-05 155117.png new file mode 100644 index 0000000..1a500eb Binary files /dev/null and b/communityHallDocuments/Mariage/8_Screenshot 2023-10-05 155117.png differ diff --git a/communityHallDocuments/Mariage/8_reconsileReportimg-2.png b/communityHallDocuments/Mariage/8_reconsileReportimg-2.png new file mode 100644 index 0000000..52c0b25 Binary files /dev/null and b/communityHallDocuments/Mariage/8_reconsileReportimg-2.png differ diff --git a/communityHallDocuments/hallImages/onlineTransactionTable.png b/communityHallDocuments/hallImages/onlineTransactionTable.png new file mode 100644 index 0000000..2e5d857 Binary files /dev/null and b/communityHallDocuments/hallImages/onlineTransactionTable.png differ diff --git a/communityHallDocuments/hallImages/payment_refund_process.png b/communityHallDocuments/hallImages/payment_refund_process.png new file mode 100644 index 0000000..c1876d3 Binary files /dev/null and b/communityHallDocuments/hallImages/payment_refund_process.png differ diff --git a/mvnw b/mvnw new file mode 100644 index 0000000..66df285 --- /dev/null +++ b/mvnw @@ -0,0 +1,308 @@ +#!/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. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Apache Maven Wrapper startup batch script, version 3.2.0 +# +# Required ENV vars: +# ------------------ +# JAVA_HOME - location of a JDK home dir +# +# Optional ENV vars +# ----------------- +# 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 /usr/local/etc/mavenrc ] ; then + . /usr/local/etc/mavenrc + fi + + 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 + JAVA_HOME="$(/usr/libexec/java_home)"; export JAVA_HOME + else + JAVA_HOME="/Library/Java/Home"; export JAVA_HOME + fi + fi + ;; +esac + +if [ -z "$JAVA_HOME" ] ; then + if [ -r /etc/gentoo-release ] ; then + JAVA_HOME=$(java-config --jre-home) + fi +fi + +# For Cygwin, ensure paths are in UNIX format before anything is touched +if $cygwin ; then + [ -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 "$JAVA_HOME" ] && [ -d "$JAVA_HOME" ] && + JAVA_HOME="$(cd "$JAVA_HOME" || (echo "cannot cd into $JAVA_HOME."; exit 1); 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="$(\unset -f command 2>/dev/null; \command -v 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 + +# 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/.." || exit 1; pwd) + fi + # end of workaround + done + printf '%s' "$(cd "$basedir" || exit 1; pwd)" +} + +# concatenates all lines of a file +concat_lines() { + if [ -f "$1" ]; then + # Remove \r in case we run on Windows within Git Bash + # and check out the repository with auto CRLF management + # enabled. Otherwise, we may read lines that are delimited with + # \r\n and produce $'-Xarg\r' rather than -Xarg due to word + # splitting rules. + tr -s '\r\n' ' ' < "$1" + fi +} + +log() { + if [ "$MVNW_VERBOSE" = true ]; then + printf '%s\n' "$1" + fi +} + +BASE_DIR=$(find_maven_basedir "$(dirname "$0")") +if [ -z "$BASE_DIR" ]; then + exit 1; +fi + +MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}; export MAVEN_PROJECTBASEDIR +log "$MAVEN_PROJECTBASEDIR" + +########################################################################################## +# 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. +########################################################################################## +wrapperJarPath="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" +if [ -r "$wrapperJarPath" ]; then + log "Found $wrapperJarPath" +else + log "Couldn't find $wrapperJarPath, downloading it ..." + + if [ -n "$MVNW_REPOURL" ]; then + wrapperUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar" + else + wrapperUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar" + fi + while IFS="=" read -r key value; do + # Remove '\r' from value to allow usage on windows as IFS does not consider '\r' as a separator ( considers space, tab, new line ('\n'), and custom '=' ) + safeValue=$(echo "$value" | tr -d '\r') + case "$key" in (wrapperUrl) wrapperUrl="$safeValue"; break ;; + esac + done < "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.properties" + log "Downloading from: $wrapperUrl" + + if $cygwin; then + wrapperJarPath=$(cygpath --path --windows "$wrapperJarPath") + fi + + if command -v wget > /dev/null; then + log "Found wget ... using wget" + [ "$MVNW_VERBOSE" = true ] && QUIET="" || QUIET="--quiet" + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + wget $QUIET "$wrapperUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath" + else + wget $QUIET --http-user="$MVNW_USERNAME" --http-password="$MVNW_PASSWORD" "$wrapperUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath" + fi + elif command -v curl > /dev/null; then + log "Found curl ... using curl" + [ "$MVNW_VERBOSE" = true ] && QUIET="" || QUIET="--silent" + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + curl $QUIET -o "$wrapperJarPath" "$wrapperUrl" -f -L || rm -f "$wrapperJarPath" + else + curl $QUIET --user "$MVNW_USERNAME:$MVNW_PASSWORD" -o "$wrapperJarPath" "$wrapperUrl" -f -L || rm -f "$wrapperJarPath" + fi + else + log "Falling back to using Java to download" + javaSource="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/MavenWrapperDownloader.java" + javaClass="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/MavenWrapperDownloader.class" + # For Cygwin, switch paths to Windows format before running javac + if $cygwin; then + javaSource=$(cygpath --path --windows "$javaSource") + javaClass=$(cygpath --path --windows "$javaClass") + fi + if [ -e "$javaSource" ]; then + if [ ! -e "$javaClass" ]; then + log " - Compiling MavenWrapperDownloader.java ..." + ("$JAVA_HOME/bin/javac" "$javaSource") + fi + if [ -e "$javaClass" ]; then + log " - Running MavenWrapperDownloader.java ..." + ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$wrapperUrl" "$wrapperJarPath") || rm -f "$wrapperJarPath" + fi + fi + fi +fi +########################################################################################## +# End of extension +########################################################################################## + +# If specified, validate the SHA-256 sum of the Maven wrapper jar file +wrapperSha256Sum="" +while IFS="=" read -r key value; do + case "$key" in (wrapperSha256Sum) wrapperSha256Sum=$value; break ;; + esac +done < "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.properties" +if [ -n "$wrapperSha256Sum" ]; then + wrapperSha256Result=false + if command -v sha256sum > /dev/null; then + if echo "$wrapperSha256Sum $wrapperJarPath" | sha256sum -c > /dev/null 2>&1; then + wrapperSha256Result=true + fi + elif command -v shasum > /dev/null; then + if echo "$wrapperSha256Sum $wrapperJarPath" | shasum -a 256 -c > /dev/null 2>&1; then + wrapperSha256Result=true + fi + else + echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available." + echo "Please install either command, or disable validation by removing 'wrapperSha256Sum' from your maven-wrapper.properties." + exit 1 + fi + if [ $wrapperSha256Result = false ]; then + echo "Error: Failed to validate Maven wrapper SHA-256, your Maven wrapper might be compromised." >&2 + echo "Investigate or delete $wrapperJarPath to attempt a clean download." >&2 + echo "If you updated your Maven version, you need to update the specified wrapperSha256Sum property." >&2 + exit 1 + fi +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 "$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 + +# shellcheck disable=SC2086 # safe args +exec "$JAVACMD" \ + $MAVEN_OPTS \ + $MAVEN_DEBUG_OPTS \ + -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ + "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ + ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/mvnw.cmd b/mvnw.cmd new file mode 100644 index 0000000..95ba6f5 --- /dev/null +++ b/mvnw.cmd @@ -0,0 +1,205 @@ +@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 Apache Maven Wrapper startup batch script, version 3.2.0 +@REM +@REM Required ENV vars: +@REM JAVA_HOME - location of a JDK home dir +@REM +@REM Optional ENV vars +@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 keystroke 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 "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %* +if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\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 WRAPPER_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar" + +FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( + IF "%%A"=="wrapperUrl" SET WRAPPER_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 WRAPPER_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar" + ) + if "%MVNW_VERBOSE%" == "true" ( + echo Couldn't find %WRAPPER_JAR%, downloading it ... + echo Downloading from: %WRAPPER_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('%WRAPPER_URL%', '%WRAPPER_JAR%')"^ + "}" + if "%MVNW_VERBOSE%" == "true" ( + echo Finished downloading %WRAPPER_JAR% + ) +) +@REM End of extension + +@REM If specified, validate the SHA-256 sum of the Maven wrapper jar file +SET WRAPPER_SHA_256_SUM="" +FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( + IF "%%A"=="wrapperSha256Sum" SET WRAPPER_SHA_256_SUM=%%B +) +IF NOT %WRAPPER_SHA_256_SUM%=="" ( + powershell -Command "&{"^ + "$hash = (Get-FileHash \"%WRAPPER_JAR%\" -Algorithm SHA256).Hash.ToLower();"^ + "If('%WRAPPER_SHA_256_SUM%' -ne $hash){"^ + " Write-Output 'Error: Failed to validate Maven wrapper SHA-256, your Maven wrapper might be compromised.';"^ + " Write-Output 'Investigate or delete %WRAPPER_JAR% to attempt a clean download.';"^ + " Write-Output 'If you updated your Maven version, you need to update the specified wrapperSha256Sum property.';"^ + " exit 1;"^ + "}"^ + "}" + if ERRORLEVEL 1 goto error +) + +@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 "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat" +if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\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% + +cmd /C exit /B %ERROR_CODE% diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..87daa34 --- /dev/null +++ b/pom.xml @@ -0,0 +1,60 @@ + + + 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + 3.2.3 + + + com.gcc + communityHall + 0.0.1-SNAPSHOT + communityHall + Community Hall Project developed by GCC + + 17 + + + + org.springframework.boot + spring-boot-starter-data-jpa + + + org.springframework.boot + spring-boot-starter-thymeleaf + + + org.springframework.boot + spring-boot-starter-web + + + + com.mysql + mysql-connector-j + runtime + + + org.springframework.boot + spring-boot-starter-test + test + + + + com.google.code.gson + gson + 2.10.1 + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + diff --git a/src/main/java/com/gcc/communityHall/CommunityHallApplication.java b/src/main/java/com/gcc/communityHall/CommunityHallApplication.java new file mode 100644 index 0000000..baa5713 --- /dev/null +++ b/src/main/java/com/gcc/communityHall/CommunityHallApplication.java @@ -0,0 +1,13 @@ +package com.gcc.communityHall; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class CommunityHallApplication { + + public static void main(String[] args) { + SpringApplication.run(CommunityHallApplication.class, args); + } + +} diff --git a/src/main/java/com/gcc/communityHall/component/UserSessionInterceptor.java b/src/main/java/com/gcc/communityHall/component/UserSessionInterceptor.java new file mode 100644 index 0000000..c830a79 --- /dev/null +++ b/src/main/java/com/gcc/communityHall/component/UserSessionInterceptor.java @@ -0,0 +1,58 @@ +package com.gcc.communityHall.component; + + +import com.gcc.communityHall.others.AppConfig; +import com.gcc.communityHall.others.UserSession; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.web.servlet.HandlerInterceptor; + +import java.util.Arrays; +import java.util.List; + +@Component +public class UserSessionInterceptor implements HandlerInterceptor { + + @Autowired + private UserSession userSession; + @Autowired + private AppConfig appConfig; + private static final List EXCLUDED_URLS = Arrays.asList("/login", "/"); + @Override + public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { + // Get the current request URL + String requestUrl = request.getRequestURI(); + + // Exclude static resources from the check + if (requestUrl.startsWith("/assets/") || requestUrl.startsWith("/css/") || requestUrl.startsWith("/js/") || requestUrl.startsWith("/images/") || requestUrl.startsWith("/api/")) { + return true; // Allow the request to proceed without checking the login status + } + + // Exclude the login page from the check + // Exclude specific URLs from the check + if (EXCLUDED_URLS.contains(requestUrl)) { + return true; // Allow the request to proceed without checking the login status + } + // Check if the user is logged in + // If logged in, add the userSession to the model + // Return true to allow the request to proceed + //if (isLoggedIn()) { + if(userSession.getUserId() != null && userSession.getUserType() != null) { + request.setAttribute("userSession", userSession); + } else { + request.setAttribute("title", "Login"); + request.setAttribute("baseURL", appConfig.getBaseUrl()); + response.sendRedirect("/login"); + return false; // Stop further processing of the request + } + return true; // Allow the request to proceed + } + + private boolean isLoggedIn() { + // Implement your login check logic here + // For example, check if the userSession contains the necessary information + return userSession.getUserId() != null && userSession.getUserType() != null; + } +} diff --git a/src/main/java/com/gcc/communityHall/configuration/WebConfig.java b/src/main/java/com/gcc/communityHall/configuration/WebConfig.java new file mode 100644 index 0000000..818847f --- /dev/null +++ b/src/main/java/com/gcc/communityHall/configuration/WebConfig.java @@ -0,0 +1,80 @@ +package com.gcc.communityHall.configuration; + + +import com.gcc.communityHall.component.UserSessionInterceptor; +import com.gcc.communityHall.entity.ReasonMaster; +import com.gcc.communityHall.repository.ReasonMasterRepository; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Configuration; +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 java.io.File; +import java.util.List; + +@Configuration +public class WebConfig implements WebMvcConfigurer { + private final String uploadDirectory; + private final String hallImageUploadDirectory; + + @Autowired + private ReasonMasterRepository reasonMasterRepository; + + @Autowired + public WebConfig( + @Value("${file.upload.directory}") String uploadDirectory, + @Value("${file.hall.upload.directory}") String hallImageUploadDirectory + ) + { + this.hallImageUploadDirectory=hallImageUploadDirectory; + this.uploadDirectory = uploadDirectory; + } + @Autowired + private UserSessionInterceptor userSessionInterceptor; + @Override + public void addInterceptors(InterceptorRegistry registry) { + registry.addInterceptor(userSessionInterceptor); + } + + + + + @Override + public void addResourceHandlers(ResourceHandlerRegistry registry) { + System.out.println(uploadDirectory); + File f = new File(uploadDirectory); + File imgDir = new File(hallImageUploadDirectory); + List reasonMasters =reasonMasterRepository.findAll(); + + if(!f.exists()) { + f.mkdirs(); + if(!imgDir.exists()){ + imgDir.mkdirs(); + } + for (ReasonMaster reason: reasonMasters ) { + File sf = new File(uploadDirectory+"/"+reason.getReason()); + if(!sf.exists()){ + sf.mkdirs(); + } + + } + + } + else if(!imgDir.exists()){ + imgDir.mkdirs(); + } + + for (ReasonMaster reason: reasonMasters ) { + File sf = new File(uploadDirectory+"/"+reason.getReason()); + if(!sf.exists()){ + sf.mkdirs(); + } + registry.addResourceHandler("/images/"+reason.getReason().toLowerCase()+"/**").addResourceLocations("file:" + uploadDirectory+"/"+reason.getReason() +"/"); + } + registry.addResourceHandler("/images/hall/**").addResourceLocations("file:" + hallImageUploadDirectory +"/"); + + } + +} diff --git a/src/main/java/com/gcc/communityHall/controller/AdminAPIController.java b/src/main/java/com/gcc/communityHall/controller/AdminAPIController.java new file mode 100644 index 0000000..4ce4d5d --- /dev/null +++ b/src/main/java/com/gcc/communityHall/controller/AdminAPIController.java @@ -0,0 +1,9 @@ +package com.gcc.communityHall.controller; + +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping("/admin/api") +public class AdminAPIController { +} diff --git a/src/main/java/com/gcc/communityHall/controller/CareTakerController.java b/src/main/java/com/gcc/communityHall/controller/CareTakerController.java new file mode 100644 index 0000000..c765ecb --- /dev/null +++ b/src/main/java/com/gcc/communityHall/controller/CareTakerController.java @@ -0,0 +1,9 @@ +package com.gcc.communityHall.controller; + +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; + +@Controller +@RequestMapping("/careTaker") +public class CareTakerController { +} diff --git a/src/main/java/com/gcc/communityHall/controller/OfficerController.java b/src/main/java/com/gcc/communityHall/controller/OfficerController.java new file mode 100644 index 0000000..35e483c --- /dev/null +++ b/src/main/java/com/gcc/communityHall/controller/OfficerController.java @@ -0,0 +1,9 @@ +package com.gcc.communityHall.controller; + +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; + +@Controller +@RequestMapping("/officer") +public class OfficerController { +} diff --git a/src/main/java/com/gcc/communityHall/controller/RestAPIController.java b/src/main/java/com/gcc/communityHall/controller/RestAPIController.java new file mode 100644 index 0000000..29ef50a --- /dev/null +++ b/src/main/java/com/gcc/communityHall/controller/RestAPIController.java @@ -0,0 +1,9 @@ +package com.gcc.communityHall.controller; + +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping("/api") +public class RestAPIController { +} diff --git a/src/main/java/com/gcc/communityHall/controller/TestController.java b/src/main/java/com/gcc/communityHall/controller/TestController.java new file mode 100644 index 0000000..81411a8 --- /dev/null +++ b/src/main/java/com/gcc/communityHall/controller/TestController.java @@ -0,0 +1,192 @@ +package com.gcc.communityHall.controller; + +import com.gcc.communityHall.entity.HallDetails; +import com.gcc.communityHall.entity.ReasonMaster; +import com.gcc.communityHall.entity.Users; +import com.gcc.communityHall.others.UserSession; +import com.gcc.communityHall.service.Impl.BookingServiceImpl; +import com.gcc.communityHall.service.Impl.HallDetailServiceImpl; +import com.gcc.communityHall.service.Impl.UserServiceImpl; +import com.gcc.communityHall.service.ReasonMasterService; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.Part; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.multipart.MultipartHttpServletRequest; + +import java.util.*; + +@RestController +@RequestMapping("/api/test") +public class TestController { + + @Autowired + UserServiceImpl userService; + + @Autowired + BookingServiceImpl bookingService; + + @Autowired + HallDetailServiceImpl hallDetailService; + + @Autowired + ReasonMasterService reasonMasterService; + + @Autowired + private UserSession userSession; + + @PostMapping("/saveUser") + public ResponseEntity saveUser(@RequestBody Users users){ + return ResponseEntity.ok(userService.user(users)); + } + @GetMapping("/getUser") + public ResponseEntity getUserByID(@RequestParam int userId){ + return ResponseEntity.ok(userService.getUserById(userId)); + } + @GetMapping("/getUserByStatus") + public ResponseEntity getUserByStatus(@RequestParam Users.userStatus userStatus){ + return ResponseEntity.ok(userService.getUserByStatus(userStatus)); + } + @GetMapping("/getUserByType") + public ResponseEntity getUserByType(@RequestParam Users.userType userType){ + return ResponseEntity.ok(userService.getUserByType(userType)); + } + + @GetMapping("/updateUserByStatus") + public ResponseEntity getUserStatus(@RequestParam int userId,Users.userStatus userStatus,@RequestParam String comments){ + return ResponseEntity.ok(userService.updateUserStatus(userId,userStatus,comments)); + } + + @PostMapping("/saveHallDetails") + public ResponseEntity saveHall( + @RequestParam String hallName, + @RequestParam float depositAmount, + @RequestParam float halfDayAmt,@RequestParam float fullDayAmt, + @RequestParam float gst ,@RequestParam float hallArea,@RequestParam String ebNumber, + @RequestParam int parkingCapacity,@RequestParam int seatingCapacity, + @RequestParam String doorNo,@RequestParam String street, + @RequestParam String area,@RequestParam String zone, + @RequestParam String division, @RequestParam(required = false) String landMark, + @RequestParam String city, + @RequestParam int pinCode, @RequestParam(required = false) String latitude, + @RequestParam(required = false) String longitude,@RequestParam String hallInchargeName, + @RequestParam long hallInchargeNo, @RequestParam(required = false) HallDetails.HallStatus status, + @RequestParam String updatedId, + @RequestParam MultipartFile hallImages[]){ + System.out.println(hallImages.length); + // System.out.println(hallDetails); + // hallDetailService.saveHallDetails(hallDetails,hallImages); + hallDetailService.saveHall(hallName,depositAmount,halfDayAmt,fullDayAmt,gst,hallArea,ebNumber,parkingCapacity,seatingCapacity,doorNo, + street,area,zone,division,landMark,city,pinCode,latitude,longitude,hallInchargeName,hallInchargeNo,status, updatedId,hallImages); + return ResponseEntity.ok(""); + } + + @GetMapping("/getHall") + public ResponseEntity getHallByID(@RequestParam int hallId){ + return ResponseEntity.ok(hallDetailService.getHallById(hallId)); + } + + @PostMapping("/saveReason") + public ResponseEntity saveReason(@RequestBody ReasonMaster reasaon){ + return ResponseEntity.ok(reasonMasterService.saveTheReason(reasaon)); + } + + @GetMapping("/getReason") + public ResponseEntity getReasonByID(@RequestParam int reasonId){ + return ResponseEntity.ok(reasonMasterService.getReasonById(reasonId)); + } + +@PostMapping(path = "/saveTheRequest", consumes = { "multipart/form-data" }) +public ResponseEntity saveTheBookingDetails(HttpServletRequest request) { + + MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; + Map> formData = new HashMap<>(); + + + // Iterate through the request parameters + Enumeration parameterNames = multipartRequest.getParameterNames(); + while (parameterNames.hasMoreElements()) { + String paramName = parameterNames.nextElement(); + String[] paramValues = multipartRequest.getParameterValues(paramName); + formData.put(paramName, Arrays.asList(paramValues)); + } + + // Iterate through the request parts (files) + try { + Map fileMap = multipartRequest.getFileMap(); + for (Map.Entry entry : fileMap.entrySet()) { + MultipartFile file = entry.getValue(); + if (!file.isEmpty()) { + // It's a file + System.out.println("file key name :-"+entry.getKey()); + List files = formData.getOrDefault("files", new ArrayList<>()); + files.add(file); + formData.put(entry.getKey(), files); + } + } + } catch (Exception e) { + e.printStackTrace(); // Handle the exception according to your needs + } + + for (Map.Entry> entry : formData.entrySet()) { + System.out.println("Key: " + entry.getKey()); + for (Object value : entry.getValue()) { + if (value instanceof MultipartFile) { + MultipartFile file = (MultipartFile) value; + System.out.println("File Name: " + file.getOriginalFilename()); + } else { + System.out.println("Value: " + value); + } + } + } + + return ResponseEntity.ok().build(); +} + + + @PostMapping(path = "/saveTheRequest2", consumes = { "multipart/form-data" }) + public ResponseEntity saveTheBookingDetails2(HttpServletRequest request) { + userSession.setUserId(1); + MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; + Map bookingDetails = splitFormData(multipartRequest); + bookingService.saveBookingDetails(bookingDetails); + return ResponseEntity.ok().build(); + } + + @GetMapping("/getBooking") + public ResponseEntity getBookingByID(@RequestParam int bookingId){ + return ResponseEntity.ok(bookingService.getBookingsById(bookingId)); + } + + public Map splitFormData(MultipartHttpServletRequest multipartRequest){ + Map formData = new HashMap<>(); + + // Iterate through the request parameters + Enumeration parameterNames = multipartRequest.getParameterNames(); + while (parameterNames.hasMoreElements()) { + String paramName = parameterNames.nextElement(); + String paramValues = multipartRequest.getParameter(paramName); + formData.put(paramName, paramValues); + } + + // Iterate through the request parts (files) + try { + Map fileMap = multipartRequest.getFileMap(); + for (Map.Entry entry : fileMap.entrySet()) { + MultipartFile file = entry.getValue(); + if (!file.isEmpty()) { + formData.put(entry.getKey(), file); + } + } + } catch (Exception e) { + e.printStackTrace(); // Handle the exception according to your needs + } + return formData; + } + + + +} diff --git a/src/main/java/com/gcc/communityHall/controller/UserController.java b/src/main/java/com/gcc/communityHall/controller/UserController.java new file mode 100644 index 0000000..8e5eb89 --- /dev/null +++ b/src/main/java/com/gcc/communityHall/controller/UserController.java @@ -0,0 +1,13 @@ +package com.gcc.communityHall.controller; + +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; + +@Controller +@RequestMapping("/user") +public class UserController { + + + + +} diff --git a/src/main/java/com/gcc/communityHall/dto/SaveBooking.java b/src/main/java/com/gcc/communityHall/dto/SaveBooking.java new file mode 100644 index 0000000..85a381e --- /dev/null +++ b/src/main/java/com/gcc/communityHall/dto/SaveBooking.java @@ -0,0 +1,21 @@ +package com.gcc.communityHall.dto; + +import org.springframework.web.multipart.MultipartFile; + +import java.util.List; +import java.util.Map; + +public class SaveBooking { + + private int hallId; + private int userId; + private int reasonId; + private Map bookingDetails; + + private MultipartFile file; + private Object obj = file; + public void check(){ + MultipartFile mf= (MultipartFile) obj; + } + +} diff --git a/src/main/java/com/gcc/communityHall/entity/ApplicationLogs.java b/src/main/java/com/gcc/communityHall/entity/ApplicationLogs.java new file mode 100644 index 0000000..830f20d --- /dev/null +++ b/src/main/java/com/gcc/communityHall/entity/ApplicationLogs.java @@ -0,0 +1,23 @@ +package com.gcc.communityHall.entity; + +import jakarta.persistence.Column; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; + +import java.util.Date; + +public class ApplicationLogs { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long logId; + + private String logType; + private int bookingId; + private int loginId; + private String comments; + + @Column(name = "cdate",nullable = false, columnDefinition = "DATETIME DEFAULT CURRENT_TIMESTAMP") + private Date cdate = new Date(); + +} diff --git a/src/main/java/com/gcc/communityHall/entity/BookingCalendar.java b/src/main/java/com/gcc/communityHall/entity/BookingCalendar.java new file mode 100644 index 0000000..76bfaf1 --- /dev/null +++ b/src/main/java/com/gcc/communityHall/entity/BookingCalendar.java @@ -0,0 +1,26 @@ +package com.gcc.communityHall.entity; + +import jakarta.persistence.*; + +import java.util.Date; + +@Entity +public class BookingCalendar { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Integer id; + private Date date; + private boolean morningSlot; + private boolean eveningSlot; + private String bookingId_1; + private String bookingId_2; + private boolean is_active; + private boolean is_delete; + private int is_booked; + + + private int hallId; + + +} diff --git a/src/main/java/com/gcc/communityHall/entity/BookingDetails.java b/src/main/java/com/gcc/communityHall/entity/BookingDetails.java new file mode 100644 index 0000000..d5e03c3 --- /dev/null +++ b/src/main/java/com/gcc/communityHall/entity/BookingDetails.java @@ -0,0 +1,264 @@ +package com.gcc.communityHall.entity; + +import jakarta.persistence.*; + +import java.time.LocalDate; +import java.util.List; + +@Entity +public class BookingDetails { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private int bookingId; + public enum BookingStatus { + PENDING, APPROVED, REJECTED,CANCELED,PAYMENT_FAILURE,GCC_BLOCKED + } + public enum RefundStatus { + APPROVED, WAITING, INITIATED + } + @Column(name="no_of_days") + private int noOfDays; + @Column(name="start_date") + private String startDate; + @Column(name="end_date") + private String endDate; + @Column(name="starting_slot") + private int startingSlot; + @Column(name="ending_slot") + private int endingSlot; + @Column(name="booking_date") + private LocalDate bookingDate; + @Column(name="booking_status") + @Enumerated(EnumType.STRING) + private BookingStatus bookingStatus = BookingStatus.PENDING; + @Column(name="deposit_amount") + private double depositAmount; + @Column(name="hall_amount") + private double hallAmount; + @Column(name="amount_received") + private double amountReceived; + private double gst; + @Column(name="approved_by") + private String approvedBy; + @Column(name="refund_status") + @Enumerated(EnumType.STRING) + private RefundStatus refundStatus; + @Column(name="updated_date") + private String updatedDate; + private String reason; + @ManyToOne(cascade = CascadeType.ALL,fetch = FetchType.EAGER) + private Users users; + @ManyToOne(cascade = CascadeType.ALL,fetch = FetchType.EAGER) + private HallDetails hallDetails; + + @OneToMany(cascade = CascadeType.ALL,fetch = FetchType.LAZY,mappedBy = "bookingDetails") + List bookingHistories; + @OneToMany(cascade = CascadeType.ALL,fetch = FetchType.LAZY,mappedBy = "bookingDetails") + List bookingDocumentsList; + @OneToOne(cascade = CascadeType.ALL,fetch = FetchType.LAZY,mappedBy = "bookingDetails") + private Settlement settlement; + @OneToOne(cascade = CascadeType.ALL,fetch = FetchType.LAZY,mappedBy = "bookingDetails") + private EbDetails ebDetails; + + @OneToMany(cascade = CascadeType.ALL,fetch = FetchType.LAZY,mappedBy = "bookingDetails") + private List damageList; + + @OneToOne(cascade = CascadeType.ALL,fetch = FetchType.LAZY,mappedBy = "bookingDetails") + private Payments payments; + @OneToOne(cascade = CascadeType.ALL,fetch = FetchType.LAZY,mappedBy = "bookingDetails") + private RefundTransaction refundTransaction; + + + public int getBookingId() { + return bookingId; + } + + public void setBookingId(int bookingId) { + this.bookingId = bookingId; + } + + public int getNoOfDays() { + return noOfDays; + } + + public void setNoOfDays(int noOfDays) { + this.noOfDays = noOfDays; + } + + public String getStartDate() { + return startDate; + } + + public void setStartDate(String startDate) { + this.startDate = startDate; + } + + public String getEndDate() { + return endDate; + } + + public void setEndDate(String endDate) { + this.endDate = endDate; + } + + public int getStartingSlot() { + return startingSlot; + } + + public void setStartingSlot(int startingSlot) { + this.startingSlot = startingSlot; + } + + public int getEndingSlot() { + return endingSlot; + } + + public void setEndingSlot(int endingSlot) { + this.endingSlot = endingSlot; + } + + public LocalDate getBookingDate() { + return bookingDate; + } + + public void setBookingDate(LocalDate bookingDate) { + this.bookingDate = bookingDate; + } + + public BookingStatus getBookingStatus() { + return bookingStatus; + } + + public void setBookingStatus(BookingStatus bookingStatus) { + this.bookingStatus = bookingStatus; + } + + public double getDepositAmount() { + return depositAmount; + } + + public void setDepositAmount(double depositAmount) { + this.depositAmount = depositAmount; + } + + public double getHallAmount() { + return hallAmount; + } + + public void setHallAmount(double hallAmount) { + this.hallAmount = hallAmount; + } + + public double getAmountReceived() { + return amountReceived; + } + + public void setAmountReceived(double amountReceived) { + this.amountReceived = amountReceived; + } + + public double getGst() { + return gst; + } + + public void setGst(double gst) { + this.gst = gst; + } + + public String getApprovedBy() { + return approvedBy; + } + + public void setApprovedBy(String approvedBy) { + this.approvedBy = approvedBy; + } + + public RefundStatus getRefundStatus() { + return refundStatus; + } + + public void setRefundStatus(RefundStatus refundStatus) { + this.refundStatus = refundStatus; + } + + public String getUpdatedDate() { + return updatedDate; + } + + public void setUpdatedDate(String updatedDate) { + this.updatedDate = updatedDate; + } + + public String getReason() { + return reason; + } + + public void setReason(String reason) { + this.reason = reason; + } + + public Users getUsers() { + return users; + } + + public void setUsers(Users users) { + this.users = users; + } + + public HallDetails getHallDetails() { + return hallDetails; + } + + public void setHallDetails(HallDetails hallDetails) { + this.hallDetails = hallDetails; + } + + public List getBookingDocumentsList() { + return bookingDocumentsList; + } + + public void setBookingDocumentsList(List bookingDocumentsList) { + this.bookingDocumentsList = bookingDocumentsList; + } + + public Settlement getSettlement() { + return settlement; + } + + public void setSettlement(Settlement settlement) { + this.settlement = settlement; + } + + public EbDetails getEbDetails() { + return ebDetails; + } + + public void setEbDetails(EbDetails ebDetails) { + this.ebDetails = ebDetails; + } + + public List getDamageList() { + return damageList; + } + + public void setDamageList(List damageList) { + this.damageList = damageList; + } + + public Payments getPayments() { + return payments; + } + + public void setPayments(Payments payments) { + this.payments = payments; + } + + public RefundTransaction getRefundTransaction() { + return refundTransaction; + } + + public void setRefundTransaction(RefundTransaction refundTransaction) { + this.refundTransaction = refundTransaction; + } +} diff --git a/src/main/java/com/gcc/communityHall/entity/BookingDocuments.java b/src/main/java/com/gcc/communityHall/entity/BookingDocuments.java new file mode 100644 index 0000000..5556bc7 --- /dev/null +++ b/src/main/java/com/gcc/communityHall/entity/BookingDocuments.java @@ -0,0 +1,76 @@ +package com.gcc.communityHall.entity; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import jakarta.persistence.*; + +@Entity +public class BookingDocuments { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private int bookingDocId; + private String bookingDocUrl; + private String documentName; + private String documentType; + private String name; + private String booking_label; + @ManyToOne(cascade = CascadeType.ALL,fetch = FetchType.EAGER) + @JsonIgnore + private BookingDetails bookingDetails; + + public int getBookingDocId() { + return bookingDocId; + } + + public void setBookingDocId(int bookingDocId) { + this.bookingDocId = bookingDocId; + } + + public String getBookingDocUrl() { + return bookingDocUrl; + } + + public void setBookingDocUrl(String bookingDocUrl) { + this.bookingDocUrl = bookingDocUrl; + } + + public String getDocumentName() { + return documentName; + } + + public void setDocumentName(String documentName) { + this.documentName = documentName; + } + + public String getDocumentType() { + return documentType; + } + + public void setDocumentType(String documentType) { + this.documentType = documentType; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getBooking_label() { + return booking_label; + } + + public void setBooking_label(String booking_label) { + this.booking_label = booking_label; + } + + public BookingDetails getBookingDetails() { + return bookingDetails; + } + + public void setBookingDetails(BookingDetails bookingDetails) { + this.bookingDetails = bookingDetails; + } +} diff --git a/src/main/java/com/gcc/communityHall/entity/BookingHistory.java b/src/main/java/com/gcc/communityHall/entity/BookingHistory.java new file mode 100644 index 0000000..e59cc3c --- /dev/null +++ b/src/main/java/com/gcc/communityHall/entity/BookingHistory.java @@ -0,0 +1,26 @@ +package com.gcc.communityHall.entity; + +import jakarta.persistence.*; + +import java.util.Date; + +@Entity +public class BookingHistory { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private int HistoryId; + private Date cdate; + + public enum BookingStatus { + PENDING, APPROVED, REJECTED, CANCELED, PAYMENT_FAILURE,GCC_BLOCKED + } + @Column(name="booking_status") + @Enumerated(EnumType.STRING) + private BookingDetails.BookingStatus bookingStatus; + + private String comments; + private String updatedBy; + @ManyToOne(cascade = CascadeType.ALL,fetch = FetchType.EAGER) + private BookingDetails bookingDetails; +} diff --git a/src/main/java/com/gcc/communityHall/entity/Damage.java b/src/main/java/com/gcc/communityHall/entity/Damage.java new file mode 100644 index 0000000..25c908c --- /dev/null +++ b/src/main/java/com/gcc/communityHall/entity/Damage.java @@ -0,0 +1,32 @@ +package com.gcc.communityHall.entity; + +import jakarta.persistence.*; + +import java.time.LocalDate; + +@Entity +public class Damage { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private int damageId; + + private LocalDate cdate; + @Column(name = "asset_name") + private String assetName; + private String comments; + private String damageImageUrl; + private int quantity; + private double assetAmount; + private String updatedBy; + @ManyToOne(cascade = CascadeType.ALL,fetch = FetchType.LAZY) + private HallDetails hallDetails; + @ManyToOne(cascade = CascadeType.ALL,fetch = FetchType.EAGER) + private BookingDetails bookingDetails; + +// @ManyToOne(cascade = CascadeType.ALL,fetch = FetchType.EAGER) +// private Settlement settlement; + + + + +} diff --git a/src/main/java/com/gcc/communityHall/entity/EbDetails.java b/src/main/java/com/gcc/communityHall/entity/EbDetails.java new file mode 100644 index 0000000..58dec0e --- /dev/null +++ b/src/main/java/com/gcc/communityHall/entity/EbDetails.java @@ -0,0 +1,27 @@ +package com.gcc.communityHall.entity; + +import jakarta.persistence.*; + +import java.util.Date; + +@Entity +public class EbDetails { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private int ebId; + + @OneToOne(cascade = CascadeType.ALL,fetch = FetchType.LAZY) + private BookingDetails bookingDetails; + + private double startingReading; + private double endingReading; + private float usedUnit; + private double ebAmount; + + private Date cdate; + private Date updatedDate; + + + +} diff --git a/src/main/java/com/gcc/communityHall/entity/GccBlockingDate.java b/src/main/java/com/gcc/communityHall/entity/GccBlockingDate.java new file mode 100644 index 0000000..a2f3d48 --- /dev/null +++ b/src/main/java/com/gcc/communityHall/entity/GccBlockingDate.java @@ -0,0 +1,27 @@ +package com.gcc.communityHall.entity; + +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; + +import java.time.LocalDateTime; +import java.util.Date; + +@Entity +public class GccBlockingDate { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private int blockingId; + private Date startDate; + private Date endDate; + private int startingSlot; + private int endingSlot; + private Date cdate; + private String updatedBy; + private int hallId; + + + + +} diff --git a/src/main/java/com/gcc/communityHall/entity/HallDetails.java b/src/main/java/com/gcc/communityHall/entity/HallDetails.java new file mode 100644 index 0000000..df4a363 --- /dev/null +++ b/src/main/java/com/gcc/communityHall/entity/HallDetails.java @@ -0,0 +1,285 @@ +package com.gcc.communityHall.entity; + +import jakarta.persistence.*; + +import java.util.Date; +import java.time.LocalDate; +import java.util.List; + +@Entity +public class HallDetails { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private int hallId; + private String hallName; + private String doorNo; + private String street; + private String area; + private int pinCode; + private String division; + private String zone; + @Column(name="land_mark") + private String landMark; + @Column(name="latitude") + private String latitude; + @Column(name="longitude") + private String longitude; + private float hallArea; + @Column(name="seating_capacity") + private int seatingCapacity; + @Column(name="parking_capacity") + private String parkingCapacity; + @OneToMany(cascade = CascadeType.ALL,fetch = FetchType.EAGER,mappedBy = "hallDetails") + private List hallImagesList; + + @Column(name="hall_Incharge_no",nullable=false) + private long hallInchargeMobno; + + @Column(name="hall_Incharge_name",nullable=false) + private String hallInchargeName; + + @Column(name = "deposit_amount", nullable = false) + private float depositAmount; + @Column(name="full_day_rent",nullable=false) + private float fullDayRent; + @Column(name="half_day_rent",nullable=false) + private float halfDayRent; + private float gst; + public enum HallStatus { + LIVE('L'), BLOCK('B'), ACTIVE('A'), DEACTIVE('D'); + private final char code; + HallStatus(char code) { + this.code = code; + } + public char getCode() { + return code; + } + } + @Column(name="hall_status") + @Enumerated(EnumType.STRING) + private HallDetails.HallStatus hallStatus = HallStatus.ACTIVE; + @Column(name="c_date") + private LocalDate createddate; + @Column(name=" updated_id") + private String updatedId; + @Column(name="update_date") + private Date updatedDate = new Date(); + private String ebNumber; + private String city; + + public int getHallId() { + return hallId; + } + + public void setHallId(int hallId) { + this.hallId = hallId; + } + + public String getHallName() { + return hallName; + } + + public void setHallName(String hallName) { + this.hallName = hallName; + } + + public String getDoorNo() { + return doorNo; + } + + public void setDoorNo(String doorNo) { + this.doorNo = doorNo; + } + + public String getStreet() { + return street; + } + + public void setStreet(String street) { + this.street = street; + } + + public String getArea() { + return area; + } + + public void setArea(String area) { + this.area = area; + } + + public int getPinCode() { + return pinCode; + } + + public void setPinCode(int pinCode) { + this.pinCode = pinCode; + } + + public String getDivision() { + return division; + } + + public void setDivision(String division) { + this.division = division; + } + + public String getZone() { + return zone; + } + + public void setZone(String zone) { + this.zone = zone; + } + + public String getLandMark() { + return landMark; + } + + public void setLankMark(String landMark) { + this.landMark = landMark; + } + + public String getLatitude() { + return latitude; + } + + public void setLatitude(String latitude) { + this.latitude = latitude; + } + + public String getLongitude() { + return longitude; + } + + public void setLongitude(String longitude) { + this.longitude = longitude; + } + + public float getHallArea() { + return hallArea; + } + + public void setHallArea(float hallArea) { + this.hallArea = hallArea; + } + + public int getSeatingCapacity() { + return seatingCapacity; + } + + public void setSeatingCapacity(int seatingCapacity) { + this.seatingCapacity = seatingCapacity; + } + + public String getParkingCapacity() { + return parkingCapacity; + } + + public void setParkingCapacity(String parkingCapacity) { + this.parkingCapacity = parkingCapacity; + } + + public List getHallImagesList() { + return hallImagesList; + } + + public void setHallImagesList(List hallImagesList) { + this.hallImagesList = hallImagesList; + } + + public long getHallInchargeMobno() { + return hallInchargeMobno; + } + + public void setHallInchargeMobno(long hallInchargeMobno) { + this.hallInchargeMobno = hallInchargeMobno; + } + + public String getHallInchargeName() { + return hallInchargeName; + } + + public void setHallInchargeName(String hallInchargeName) { + this.hallInchargeName = hallInchargeName; + } + + public float getDepositAmount() { + return depositAmount; + } + + public void setDepositAmount(float depositAmount) { + this.depositAmount = depositAmount; + } + + public float getFullDayRent() { + return fullDayRent; + } + + public void setFullDayRent(float fullDayRent) { + this.fullDayRent = fullDayRent; + } + + public float getHalfDayRent() { + return halfDayRent; + } + + public void setHalfDayRent(float halfDayRent) { + this.halfDayRent = halfDayRent; + } + + public float getGst() { + return gst; + } + + public void setGst(float gst) { + this.gst = gst; + } + + public HallStatus getHallStatus() { + return hallStatus; + } + + public void setHallStatus(HallStatus hallStatus) { + this.hallStatus = hallStatus; + } + + public LocalDate getCreateddate() { + return createddate; + } + + public void setCreateddate(LocalDate createddate) { + this.createddate = createddate; + } + + public String getUpdatedId() { + return updatedId; + } + + public void setUpdatedId(String updatedId) { + this.updatedId = updatedId; + } + + public Date getUpdatedDate() { + return updatedDate; + } + + public void setUpdatedDate(Date updatedDate) { + this.updatedDate = updatedDate; + } + + public String getEbNumber() { + return ebNumber; + } + + public void setEbNumber(String ebNumber) { + this.ebNumber = ebNumber; + } + + public String getCity() { + return city; + } + + public void setCity(String city) { + this.city = city; + } +} diff --git a/src/main/java/com/gcc/communityHall/entity/HallImages.java b/src/main/java/com/gcc/communityHall/entity/HallImages.java new file mode 100644 index 0000000..ae601bf --- /dev/null +++ b/src/main/java/com/gcc/communityHall/entity/HallImages.java @@ -0,0 +1,42 @@ +package com.gcc.communityHall.entity; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import jakarta.persistence.*; + +@Entity +public class HallImages { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private int hallImageId; + + @Column(name = "hall_Image_url") + private String hallImage; + @ManyToOne(cascade = CascadeType.PERSIST,fetch = FetchType.LAZY) + @JsonIgnore + private HallDetails hallDetails; + + public int getHallImageId() { + return hallImageId; + } + + public void setHallImageId(int hallImageId) { + this.hallImageId = hallImageId; + } + + public String getHallImage() { + return hallImage; + } + + public void setHallImage(String hallImage) { + this.hallImage = hallImage; + } + + public HallDetails getHallDetails() { + return hallDetails; + } + + public void setHallDetails(HallDetails hallDetails) { + this.hallDetails = hallDetails; + } +} diff --git a/src/main/java/com/gcc/communityHall/entity/Login.java b/src/main/java/com/gcc/communityHall/entity/Login.java new file mode 100644 index 0000000..78f3cd5 --- /dev/null +++ b/src/main/java/com/gcc/communityHall/entity/Login.java @@ -0,0 +1,76 @@ +package com.gcc.communityHall.entity; + + +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; + +@Entity +public class Login { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private int id; + private int hallId; + private String name; + private long mobileNumber; + private String password; + private String employeeId; + private String userType; + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public int getHallId() { + return hallId; + } + + public void setHallId(int hallId) { + this.hallId = hallId; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public long getMobileNumber() { + return mobileNumber; + } + + public void setMobileNumber(long mobileNumber) { + this.mobileNumber = mobileNumber; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getEmployeeId() { + return employeeId; + } + + public void setEmployeeId(String employeeId) { + this.employeeId = employeeId; + } + + public String getUserType() { + return userType; + } + + public void setUserType(String userType) { + this.userType = userType; + } +} diff --git a/src/main/java/com/gcc/communityHall/entity/Payments.java b/src/main/java/com/gcc/communityHall/entity/Payments.java new file mode 100644 index 0000000..9f3fa22 --- /dev/null +++ b/src/main/java/com/gcc/communityHall/entity/Payments.java @@ -0,0 +1,22 @@ +package com.gcc.communityHall.entity; + +import jakarta.persistence.*; + +import java.util.Date; + +@Entity +public class Payments { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private int paymentId; + private double amountReceived; + private String TransactionId; + private String paymentType; + private String paymentStatus; + private Date cdate; + @OneToOne(cascade = CascadeType.ALL,fetch = FetchType.EAGER) + private BookingDetails bookingDetails; + + +} diff --git a/src/main/java/com/gcc/communityHall/entity/ReasonDocumentMaster.java b/src/main/java/com/gcc/communityHall/entity/ReasonDocumentMaster.java new file mode 100644 index 0000000..9554c0e --- /dev/null +++ b/src/main/java/com/gcc/communityHall/entity/ReasonDocumentMaster.java @@ -0,0 +1,67 @@ +package com.gcc.communityHall.entity; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import jakarta.persistence.*; + +@Entity +public class ReasonDocumentMaster { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private int reasonDocId; + private String fieldName; + private boolean addTextField; + private String docFieldName; + private boolean addDocumentField; + @ManyToOne(fetch = FetchType.EAGER) + @JoinColumn(name = "reason_id") + @JsonIgnore + private ReasonMaster reasonMaster; + + public int getReasonDocId() { + return reasonDocId; + } + + public void setReasonDocId(int reasonDocId) { + this.reasonDocId = reasonDocId; + } + + public String getFieldName() { + return fieldName; + } + + public void setFieldName(String fieldName) { + this.fieldName = fieldName; + } + + public boolean isAddTextField() { + return addTextField; + } + + public void setAddTextField(boolean addTextField) { + this.addTextField = addTextField; + } + + public String getDocFieldName() { + return docFieldName; + } + + public void setDocFieldName(String docFieldName) { + this.docFieldName = docFieldName; + } + + public boolean isAddDocumentField() { + return addDocumentField; + } + + public void setAddDocumentField(boolean addDocumentField) { + this.addDocumentField = addDocumentField; + } + + public ReasonMaster getReasonMaster() { + return reasonMaster; + } + + public void setReasonMaster(ReasonMaster reasonMaster) { + this.reasonMaster = reasonMaster; + } +} diff --git a/src/main/java/com/gcc/communityHall/entity/ReasonMaster.java b/src/main/java/com/gcc/communityHall/entity/ReasonMaster.java new file mode 100644 index 0000000..358fa1d --- /dev/null +++ b/src/main/java/com/gcc/communityHall/entity/ReasonMaster.java @@ -0,0 +1,60 @@ +package com.gcc.communityHall.entity; + +import jakarta.persistence.*; + +import java.time.LocalDate; +import java.util.List; + +@Entity +public class ReasonMaster { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private int reasonId; + private String reason; + + private LocalDate cdate = LocalDate.now(); + private String updatedBy; + + @OneToMany(mappedBy = "reasonMaster",fetch = FetchType.LAZY,cascade = CascadeType.ALL) + private List reasonDocumentMasterList; + + public int getReasonId() { + return reasonId; + } + + public void setReasonId(int reasonId) { + this.reasonId = reasonId; + } + + public String getReason() { + return reason; + } + + public void setReason(String reason) { + this.reason = reason; + } + + public LocalDate getCdate() { + return cdate; + } + + public void setCdate(LocalDate cdate) { + this.cdate = cdate; + } + + public String getUpdatedBy() { + return updatedBy; + } + + public void setUpdatedBy(String updatedBy) { + this.updatedBy = updatedBy; + } + + public List getReasonDocumentMasterList() { + return reasonDocumentMasterList; + } + + public void setReasonDocumentMasterList(List reasonDocumentMasterList) { + this.reasonDocumentMasterList = reasonDocumentMasterList; + } +} diff --git a/src/main/java/com/gcc/communityHall/entity/RefundTransaction.java b/src/main/java/com/gcc/communityHall/entity/RefundTransaction.java new file mode 100644 index 0000000..95e58e0 --- /dev/null +++ b/src/main/java/com/gcc/communityHall/entity/RefundTransaction.java @@ -0,0 +1,18 @@ +package com.gcc.communityHall.entity; + +import jakarta.persistence.*; + +import java.util.Date; + +@Entity +public class RefundTransaction { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private int refundId; + private double amountRefunded; + private String TransactionId; + private String refundStatus; + private Date cdate; + @OneToOne(cascade = CascadeType.ALL,fetch = FetchType.EAGER) + private BookingDetails bookingDetails; +} diff --git a/src/main/java/com/gcc/communityHall/entity/Settlement.java b/src/main/java/com/gcc/communityHall/entity/Settlement.java new file mode 100644 index 0000000..c5f3e5a --- /dev/null +++ b/src/main/java/com/gcc/communityHall/entity/Settlement.java @@ -0,0 +1,27 @@ +package com.gcc.communityHall.entity; + +import jakarta.persistence.*; + +import java.time.LocalDate; +import java.util.Date; +import java.util.List; + +@Entity +public class Settlement { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private int settlementId; + private String comments; + private LocalDate cdate; + private double damageAmount; + private double ebAmount; + private double depositAmount; + private double refundedAmount; + private Date updatedDate; + private String updatedId; + @OneToOne(fetch = FetchType.EAGER,cascade = CascadeType.ALL) + private BookingDetails bookingDetails; + + +} diff --git a/src/main/java/com/gcc/communityHall/entity/SmsSender.java b/src/main/java/com/gcc/communityHall/entity/SmsSender.java new file mode 100644 index 0000000..60fb816 --- /dev/null +++ b/src/main/java/com/gcc/communityHall/entity/SmsSender.java @@ -0,0 +1,64 @@ +package com.gcc.communityHall.entity; + +import jakarta.persistence.*; + +import java.util.Date; + +@Entity +public class SmsSender { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private int id; + + @Column(name = "phone",nullable = false) + private Long phone; + + @Column(name = "purpose",nullable = false) + private String purpose; + @Column(name = "bodyMsg",nullable = false) + private String bodyMsg; + @Column(name = "cdate",nullable = false, columnDefinition = "DATETIME DEFAULT CURRENT_TIMESTAMP") + private Date cdate; + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + + + public Long getPhone() { + return phone; + } + + public void setPhone(Long phone) { + this.phone = phone; + } + + public String getPurpose() { + return purpose; + } + + public void setPurpose(String purpose) { + this.purpose = purpose; + } + + public String getBodyMsg() { + return bodyMsg; + } + + public void setBodyMsg(String bodyMsg) { + this.bodyMsg = bodyMsg; + } + + public Date getCdate() { + return cdate; + } + + public void setCdate(Date cdate) { + this.cdate = cdate; + } +} diff --git a/src/main/java/com/gcc/communityHall/entity/UserHistory.java b/src/main/java/com/gcc/communityHall/entity/UserHistory.java new file mode 100644 index 0000000..ba5a9ef --- /dev/null +++ b/src/main/java/com/gcc/communityHall/entity/UserHistory.java @@ -0,0 +1,74 @@ +package com.gcc.communityHall.entity; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import jakarta.persistence.*; + +import java.util.Date; + +@Entity +public class UserHistory { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private int userHisId; + + private Date cdate ; + + @Column(name="user_status", columnDefinition = "VARCHAR(20) DEFAULT 'APPROVED'") + @Enumerated(EnumType.STRING) + private Users.userStatus userstatus = Users.userStatus.APPROVED ; + + private String comments; + private String updatedBy; + @ManyToOne(cascade = CascadeType.ALL,fetch = FetchType.EAGER) + @JsonIgnore + private Users users; + + public int getUserHisId() { + return userHisId; + } + + public void setUserHisId(int userHisId) { + this.userHisId = userHisId; + } + + public Date getCdate() { + return cdate; + } + + public void setCdate(Date cdate) { + this.cdate = cdate; + } + + public Users.userStatus getUserstatus() { + return userstatus; + } + + public void setUserstatus(Users.userStatus userstatus) { + this.userstatus = userstatus; + } + + public String getComments() { + return comments; + } + + public void setComments(String comments) { + this.comments = comments; + } + + public String getUpdatedBy() { + return updatedBy; + } + + public void setUpdatedBy(String updatedBy) { + this.updatedBy = updatedBy; + } + + public Users getUsers() { + return users; + } + + public void setUsers(Users users) { + this.users = users; + } +} diff --git a/src/main/java/com/gcc/communityHall/entity/Users.java b/src/main/java/com/gcc/communityHall/entity/Users.java new file mode 100644 index 0000000..42ccb02 --- /dev/null +++ b/src/main/java/com/gcc/communityHall/entity/Users.java @@ -0,0 +1,187 @@ +package com.gcc.communityHall.entity; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import jakarta.persistence.*; + +import java.util.Date; +import java.util.List; + +@Entity +public class Users { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private int userId; + public enum userStatus { + PENDING, APPROVED, REJECTED + } + + public enum userType { + PENSIONER, EMPLOYEE, COUNSELLOR,PUBLIC + } + + @Column(name="user_status", columnDefinition = "VARCHAR(20) DEFAULT 'APPROVED'") + @Enumerated(EnumType.STRING) + private Users.userStatus userstatus = userStatus.APPROVED ; + + @Column(name="usertype", columnDefinition = "VARCHAR(20) DEFAULT 'PUBLIC'") + @Enumerated(EnumType.STRING) + private Users.userType usertype = userType.PUBLIC ; + + @Column(name = "name", nullable = false) + private String name; + @Column(name = "mobile_no", nullable = false) + private long mobileNo; + @Column(name = "email", nullable = false) + private String email; + @Column(name = "doorno", nullable = false) + private String doorNo; + @Column(name = "street", nullable = false) + private String street; + @Column(name = "area", nullable = false) + private String area; + @Column(name = "location", nullable = false) + private String location; + @Column(name = "pin_code", nullable = false) + private int pinCode; + + private String governmentId; + @Column(nullable = false,columnDefinition = "BOOLEAN DEFAULT true") + private boolean isActive =true; + + @Column(name = "cdate",nullable = false, columnDefinition = "DATETIME DEFAULT CURRENT_TIMESTAMP") + private Date cdate = new Date(); + @OneToMany(fetch = FetchType.LAZY,mappedBy = "users") + @JsonIgnore + List bookingDetailsList; + + @OneToMany(fetch = FetchType.LAZY,mappedBy = "users") + List userHistories; + + public int getUserId() { + return userId; + } + + public void setUserId(int userId) { + this.userId = userId; + } + + public userStatus getUserstatus() { + return userstatus; + } + + public void setUserstatus(userStatus userstatus) { + this.userstatus = userstatus; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public long getMobileNo() { + return mobileNo; + } + + public void setMobileNo(long mobileNo) { + this.mobileNo = mobileNo; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public String getDoorNo() { + return doorNo; + } + + public void setDoorNo(String doorNo) { + this.doorNo = doorNo; + } + + public String getStreet() { + return street; + } + + public void setStreet(String street) { + this.street = street; + } + + public String getArea() { + return area; + } + + public void setArea(String area) { + this.area = area; + } + + public String getLocation() { + return location; + } + + public void setLocation(String location) { + this.location = location; + } + + public int getPinCode() { + return pinCode; + } + + public void setPinCode(int pinCode) { + this.pinCode = pinCode; + } + + public userType getUsertype() { + return usertype; + } + + public void setUsertype(userType usertype) { + this.usertype = usertype; + } + + public String getGovernmentId() { + return governmentId; + } + + public void setGovernmentId(String governmentId) { + this.governmentId = governmentId; + } + + public boolean isActive() { + return isActive; + } + + public void setActive(boolean active) { + this.isActive = active; + } + + public Date getCdate() { + return cdate; + } + + public void setCdate(Date cdate) { + this.cdate = cdate; + } + + public List getBookingDetailsList() { + return bookingDetailsList; + } + + public void setBookingDetailsList(List bookingDetailsList) { + this.bookingDetailsList = bookingDetailsList; + } + + public List getUserHistories() { + return userHistories; + } + + public void setUserHistories(List userHistories) { + this.userHistories = userHistories; + } +} diff --git a/src/main/java/com/gcc/communityHall/others/AppConfig.java b/src/main/java/com/gcc/communityHall/others/AppConfig.java new file mode 100644 index 0000000..306f407 --- /dev/null +++ b/src/main/java/com/gcc/communityHall/others/AppConfig.java @@ -0,0 +1,47 @@ +package com.gcc.communityHall.others; + +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.stereotype.Component; + +@Component +@ConfigurationProperties(prefix = "app") +public class AppConfig { + + private String title; + private String baseUrl; + private String getOtpUrl; + private String erpUrl; + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public String getBaseUrl() { + return baseUrl; + } + + public void setBaseUrl(String baseUrl) { + this.baseUrl = baseUrl; + } + + public String getGetOtpUrl() { + return getOtpUrl; + } + + public void setGetOtpUrl(String getOtpUrl) { + this.getOtpUrl = getOtpUrl; + } + + public String getErpUrl() { + return erpUrl; + } + + public void setErpUrl(String erpUrl) { + this.erpUrl = erpUrl; + } + +} diff --git a/src/main/java/com/gcc/communityHall/others/UserSession.java b/src/main/java/com/gcc/communityHall/others/UserSession.java new file mode 100644 index 0000000..e91d100 --- /dev/null +++ b/src/main/java/com/gcc/communityHall/others/UserSession.java @@ -0,0 +1,50 @@ +package com.gcc.communityHall.others; + +import org.springframework.context.annotation.Scope; +import org.springframework.context.annotation.ScopedProxyMode; +import org.springframework.stereotype.Component; +import org.springframework.web.context.WebApplicationContext; + +@Component +@Scope(value = WebApplicationContext.SCOPE_SESSION, proxyMode = ScopedProxyMode.TARGET_CLASS) +public class UserSession { + private Integer userId; + private String userType; + private String dispayName; + private Long mobileno; + + public Integer getUserId() { + return userId; + } + + public void setUserId(Integer userId) { + this.userId = userId; + } + + public String getUserType() { + return userType; + } + + public void setUserType(String userType) { + this.userType = userType; + } + + public String getDispayName() { + return dispayName; + } + + public void setDispayName(String dispayName) { + this.dispayName = dispayName; + } + + public Long getMobileno() { + return mobileno; + } + + public void setMobileno(Long mobileno) { + this.mobileno = mobileno; + } + + + +} diff --git a/src/main/java/com/gcc/communityHall/paymentService/DTO/Merchant.java b/src/main/java/com/gcc/communityHall/paymentService/DTO/Merchant.java new file mode 100644 index 0000000..5a357ed --- /dev/null +++ b/src/main/java/com/gcc/communityHall/paymentService/DTO/Merchant.java @@ -0,0 +1,20 @@ +package com.gcc.communityHall.paymentService.DTO; + +import org.springframework.stereotype.Component; + +@Component +public class Merchant { + + + private String identifier; + + + public String getIdentifier() { + return identifier; + } + + public void setIdentifier(String identifier) { + this.identifier = identifier; + } + +} diff --git a/src/main/java/com/gcc/communityHall/paymentService/DTO/RefundRequest.java b/src/main/java/com/gcc/communityHall/paymentService/DTO/RefundRequest.java new file mode 100644 index 0000000..a8833d3 --- /dev/null +++ b/src/main/java/com/gcc/communityHall/paymentService/DTO/RefundRequest.java @@ -0,0 +1,25 @@ +package com.gcc.communityHall.paymentService.DTO; + +import java.util.HashMap; + +public class RefundRequest { + + private HashMap merchant; + private HashMap transaction; + + public HashMap getMerchant() { + return merchant; + } + public void setMerchant(HashMap merchant) { + this.merchant = merchant; + } + public HashMap getTransaction() { + return transaction; + } + public void setTransaction(HashMap transaction) { + this.transaction = transaction; + } + + + +} diff --git a/src/main/java/com/gcc/communityHall/paymentService/DTO/Transaction.java b/src/main/java/com/gcc/communityHall/paymentService/DTO/Transaction.java new file mode 100644 index 0000000..80b0b31 --- /dev/null +++ b/src/main/java/com/gcc/communityHall/paymentService/DTO/Transaction.java @@ -0,0 +1,57 @@ +package com.gcc.communityHall.paymentService.DTO; + +import org.springframework.stereotype.Component; + +@Component +public class Transaction { + + private String amount; + private String identifier; + private String dateTime; + private String requestType; + private String token; + private String reference; + + + + + + public String getAmount() { + return amount; + } + public void setAmount(String amount) { + this.amount = amount; + } + public String getIdentifier() { + return identifier; + } + public void setIdentifier(String identifier) { + this.identifier = identifier; + } + public String getDateTime() { + return dateTime; + } + public void setDateTime(String dateTime) { + this.dateTime = dateTime; + } + public String getRequestType() { + return requestType; + } + public void setRequestType(String requestType) { + this.requestType = requestType; + } + public String getToken() { + return token; + } + public void setToken(String token) { + this.token = token; + } + public String getReference() { + return reference; + } + public void setReference(String reference) { + this.reference = reference; + } + + +} diff --git a/src/main/java/com/gcc/communityHall/paymentService/DTO/TransactionData.java b/src/main/java/com/gcc/communityHall/paymentService/DTO/TransactionData.java new file mode 100644 index 0000000..819417f --- /dev/null +++ b/src/main/java/com/gcc/communityHall/paymentService/DTO/TransactionData.java @@ -0,0 +1,23 @@ +package com.gcc.communityHall.paymentService.DTO; + +public class TransactionData { + + private Merchant merchant; + private Transaction transaction; + + public Merchant getMerchant() { + return merchant; + } + public void setMerchant(Merchant merchant) { + this.merchant = merchant; + } + public Transaction getTransaction() { + return transaction; + } + public void setTransaction(Transaction transaction) { + this.transaction = transaction; + } + + + +} diff --git a/src/main/java/com/gcc/communityHall/paymentService/config/PaymentConfig.java b/src/main/java/com/gcc/communityHall/paymentService/config/PaymentConfig.java new file mode 100644 index 0000000..a2b392d --- /dev/null +++ b/src/main/java/com/gcc/communityHall/paymentService/config/PaymentConfig.java @@ -0,0 +1,100 @@ +package com.gcc.communityHall.paymentService.config; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.PropertySource; + +@Configuration +@PropertySource("classpath:paymentConfig.properties") +public class PaymentConfig { + + @Value("${payment.worldline.merchantId}") + private String merchantId; + + @Value("${payment.worldline.encryptionKey}") + private String encryptionKey; + + @Value("${payment.worldline.encryptionIV}") + private String encryptionIV; + + @Value("${payment.worldline.schemeCode}") + private String schemeCode; + + @Value("${payment.worldline.merchantName}") + private String merchantName; + + @Value("${payment.worldline.transactionSuccessCode}") + private String transactionSuccessCode; + + @Value("${payment.worldline.refundSuccessCode}") + private String refundSuccessCode; + + + public String getMerchantId() { + return merchantId; + } + + public void setMerchantId(String merchantId) { + this.merchantId = merchantId; + } + + public String getEncryptionKey() { + return encryptionKey; + } + public byte[] getEncryptionKeyByte() { + return encryptionKey.getBytes(); + } + + public void setEncryptionKey(String encryptionKey) { + this.encryptionKey = encryptionKey; + } + + public String getEncryptionIV() { + return encryptionIV; + } + + public byte[] getEncryptionIVByte() { + return encryptionIV.getBytes(); + } + + public void setEncryptionIV(String encryptionIV) { + this.encryptionIV = encryptionIV; + } + + public String getSchemeCode() { + return schemeCode; + } + + public void setSchemeCode(String schemeCode) { + this.schemeCode = schemeCode; + } + + public String getMerchantName() { + return merchantName; + } + + public void setMerchantName(String merchantName) { + this.merchantName = merchantName; + } + + public String getTransactionSuccessCode() { + return transactionSuccessCode; + } + + public void setTransactionSuccessCode(String transactionSuccessCode) { + this.transactionSuccessCode = transactionSuccessCode; + } + + public String getRefundSuccessCode() { + return refundSuccessCode; + } + + public void setRefundSuccessCode(String refundSuccessCode) { + this.refundSuccessCode = refundSuccessCode; + } + + + + + +} diff --git a/src/main/java/com/gcc/communityHall/paymentService/controller/PaymentAPIController.java b/src/main/java/com/gcc/communityHall/paymentService/controller/PaymentAPIController.java new file mode 100644 index 0000000..201fecb --- /dev/null +++ b/src/main/java/com/gcc/communityHall/paymentService/controller/PaymentAPIController.java @@ -0,0 +1,157 @@ +package com.gcc.communityHall.paymentService.controller; + + +import com.gcc.communityHall.entity.BookingDetails; +import com.gcc.communityHall.entity.Users; +import com.gcc.communityHall.paymentService.DTO.Merchant; +import com.gcc.communityHall.paymentService.DTO.Transaction; +import com.gcc.communityHall.paymentService.DTO.TransactionData; +import com.gcc.communityHall.paymentService.config.PaymentConfig; +import com.gcc.communityHall.paymentService.entity.RefundResponse; +import com.gcc.communityHall.paymentService.entity.TransactionResponse; +import com.gcc.communityHall.paymentService.refund.DTO.TransactionRefundResponse; +import com.gcc.communityHall.paymentService.service.PaymentGatewayService; +import com.gcc.communityHall.paymentService.service.TransactionNumberGenerator; +import com.gcc.communityHall.repository.BookingDetailsRepository; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.google.gson.Gson; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.ResponseEntity; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.client.RestTemplate; + +import java.security.NoSuchAlgorithmException; +import java.util.HashMap; +import java.util.Optional; + + +@RestController +@RequestMapping("/payment/api") +public class PaymentAPIController { + + @Autowired + PaymentGatewayService paymentService; + + @Autowired + private PaymentConfig paymentConfig; + + @Autowired + private BookingDetailsRepository bookRepo; + + @Autowired + private TransactionNumberGenerator transactionNumber; + + + @GetMapping(value="/refund") + public ResponseEntity refundAmount(Model model,@RequestParam int bookingId) throws Exception { + System.out.println("Refund Api call.......working on it"); + TransactionResponse transactionRes = this.paymentService.getTransactionResponseByBookingIdAndStatusCode(bookingId,this.paymentConfig.getTransactionSuccessCode()); + RefundResponse recordRefundResponse = new RefundResponse(); + + Merchant merchant = new Merchant(); + merchant.setIdentifier(this.paymentConfig.getMerchantId()); + + Transaction transaction = new Transaction(); + transaction.setAmount(transactionRes.getAmount());//Amount given here + transaction.setIdentifier(""); + transaction.setDateTime(transactionRes.getDate()); //At what date transaction happens + transaction.setRequestType("R"); + transaction.setToken(""); + transaction.setReference(transactionRes.getTpslTxnId()); //tpsl refer number + + + TransactionData transactionData = new TransactionData(); + transactionData.setMerchant(merchant); + transactionData.setTransaction(transaction); + + // Serialize TransactionData object to JSON string + Gson gson = new Gson(); + String json = gson.toJson(transactionData); + System.out.println(json); + + String encryptHxRefund = this.paymentService.encryptHxRefund(json); + RestTemplate resttemplate = new RestTemplate(); + String Url ="https://www.tpsl-india.in/PaymentGateway/merchant2.pg/"+this.paymentConfig.getMerchantId(); + ResponseEntity postForEntity = resttemplate.postForEntity(Url, encryptHxRefund, String.class); + + String decryptHxTRefund = this.paymentService.decryptHxTRefund(postForEntity.getBody()); + recordRefundResponse.setResponse(decryptHxTRefund); + recordRefundResponse.setUserId("2");//make it dynamic + recordRefundResponse.setBookingId(bookingId); + try { + ObjectMapper objectMapper = new ObjectMapper(); + + TransactionRefundResponse myObject = objectMapper.readValue(decryptHxTRefund, TransactionRefundResponse.class); + System.out.println(myObject.toString()); + + if(myObject.getPaymentMethod().getPaymentTransaction().getStatusCode().equals(this.paymentConfig.getRefundSuccessCode())) { + System.out.println("Refund Process complete........"+bookingId); + recordRefundResponse.setAmount(myObject.getPaymentMethod().getPaymentTransaction().getAmount()); + recordRefundResponse.setBalaceAmount(myObject.getPaymentMethod().getPaymentTransaction().getBalanceAmount()); + } + recordRefundResponse.setStatusCode(myObject.getPaymentMethod().getPaymentTransaction().getStatusCode()); + recordRefundResponse.setTxansactionId(myObject.getMerchantTransactionIdentifier()); + + this.paymentService.recordRefund(recordRefundResponse); + return ResponseEntity.ok(myObject); + + } catch (Exception e) { + e.printStackTrace(); + } + return ResponseEntity.ok(decryptHxTRefund); + + } + + @PostMapping(value = {"/payment-request"}) + public HashMap startPayment(int userId,int bookingId) throws NoSuchAlgorithmException { + + System.out.println("I entered payment Service......"+bookingId+ "User Id :- "+userId); + HashMap hs = new HashMap<>(); + Optional findById = bookRepo.findById(bookingId); + + if(findById.isPresent()) { + System.out.println("Success in finding booking Id"); + BookingDetails booking = findById.get(); + Users user = booking.getUsers(); + int findUserId=user.getUserId(); + System.out.println("Merchant ID:-"+this.paymentConfig.getMerchantId()); + + String txnId="CHB"+transactionNumber.generateTransactionNumber()+String.format("%05d", findUserId); //create transaction Id unique from our side + String totalAmt = String.valueOf(booking.getAmountReceived()); //Amount of Community Hall from our side + + TransactionResponse response = new TransactionResponse(); + response.setTxansactionId(txnId); + // response.setBookingId(bookingId);//make it dynamic + response.setHallId(booking.getHallDetails().getHallId()); + response.setUserId(String.valueOf(findUserId));//make it dynamic + response.setStatusCode("temp"); + response.setBookingId(bookingId); + this.paymentService.recordResponse(response); + + + String merchantId = this.paymentConfig.getMerchantId(); //This is Test Merchant ID from worldLine + String consumerId=String.format("%05d", findUserId); // Replace consumer ID in c964634 from our side + String consumerMobileNo=String.valueOf(user.getMobileNo()); //Replace consumer Mobile no in 9879879870 from our side + String consumerEmailId=user.getEmail(); //replace consumer email Id + + + String encryptedtoken = this.paymentService.getToken(merchantId+"|", txnId+"|", totalAmt+"|", "|", consumerId+"|", consumerMobileNo+"|", consumerEmailId+"|", "|", "|", "|", "|", "|", "|", "|", "|", "|", this.paymentConfig.getEncryptionKey()); + + hs.put("txansactionId",txnId); + hs.put("token",encryptedtoken); + hs.put("amount",totalAmt); + hs.put("merchantId",merchantId); + hs.put("consumerMobileNo",consumerMobileNo); + hs.put("consumerEmailId",consumerEmailId); + hs.put("consumerId",consumerId); + hs.put("error", false); + } + else { + hs.put("error", true); + } + + return hs; + } + +} diff --git a/src/main/java/com/gcc/communityHall/paymentService/controller/PaymentController.java b/src/main/java/com/gcc/communityHall/paymentService/controller/PaymentController.java new file mode 100644 index 0000000..ade5c88 --- /dev/null +++ b/src/main/java/com/gcc/communityHall/paymentService/controller/PaymentController.java @@ -0,0 +1,139 @@ +package com.gcc.communityHall.paymentService.controller; + +import com.gcc.communityHall.entity.BookingDetails; +import com.gcc.communityHall.paymentService.config.PaymentConfig; +import com.gcc.communityHall.paymentService.entity.TransactionResponse; +import com.gcc.communityHall.paymentService.repository.TransactionResponseRepository; +import com.gcc.communityHall.paymentService.service.PaymentGatewayService; +import com.gcc.communityHall.service.Impl.BookingServiceImpl; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; + +import java.security.NoSuchAlgorithmException; + + + + + + +@Controller +@RequestMapping("/payment") +public class PaymentController { + + @Autowired + PaymentGatewayService paymentService; + + @Autowired + private PaymentConfig paymentConfig; + + @Autowired + private BookingServiceImpl bookser; + + @Autowired + private TransactionResponseRepository transactionResRepo; + + + @PostMapping(value = "/response") + public String response(Model model, @RequestParam(required = false) String msg) throws NoSuchAlgorithmException{ + + System.out.println("......"); + String salt = this.paymentConfig.getEncryptionKey(); + + String confirmToken=""; + String status = this.paymentConfig.getTransactionSuccessCode(); + String s = new String(msg); + String c = new String(); + String res[] =s.split("\\|"); + + TransactionResponse response = this.paymentService.getTransactionResponseByTxansactionId(res[3],"temp"); + + for(int i=0;i1 && startingSlot ==1 && endingSlot ==2 ){ + fromStartingSlot =1; + fromEndingSlot=1; + toStartingSlot =1; + toEndingSlot =1; + }else if(noOfDays>1 && startingSlot ==1 && endingSlot==1){ + fromStartingSlot=1; + fromEndingSlot=1; + toStartingSlot =1; + } + else if(noOfDays>1 && startingSlot ==2 && endingSlot==1){ + fromEndingSlot=1; + toStartingSlot =1; + } + else if(noOfDays>1 && startingSlot ==2 && endingSlot==2){ + fromEndingSlot=1; + toStartingSlot =1; + toEndingSlot =1; + } + + String bookingStatus=bookser.confirmTheDateAndSlot(bookingsById.getStartDate(), bookingsById.getEndDate(), noOfDays, fromStartingSlot, fromEndingSlot, toStartingSlot, toEndingSlot, bookingsById.getBookingId(),bookingsById.getUsers().getUserId()); + System.out.println("booking Status ="+bookingStatus); + System.out.println(response.getId()); + System.out.println(response.toString()); + } + System.out.println(response.toString()); + + TransactionResponse save = transactionResRepo.save(response); + System.out.println(save.toString()); + // this.paymentService.recordResponse(response); + //model.addAttribute("msg",msg); + return "redirect:/viewhistory"; + } + + + + +} diff --git a/src/main/java/com/gcc/communityHall/paymentService/entity/RefundResponse.java b/src/main/java/com/gcc/communityHall/paymentService/entity/RefundResponse.java new file mode 100644 index 0000000..dbc0715 --- /dev/null +++ b/src/main/java/com/gcc/communityHall/paymentService/entity/RefundResponse.java @@ -0,0 +1,81 @@ +package com.gcc.communityHall.paymentService.entity; + +import jakarta.persistence.*; + +@Entity +public class RefundResponse { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Integer id; + private String userId; + private int bookingId; + private String txansactionId; + private String statusCode; +// private String tpslTxnId; + @Column(name = "date", columnDefinition = "DATETIME NULL DEFAULT CURRENT_TIMESTAMP") + private String date; + + @Column(length = 5000) + private String response; + private String Amount; + private String balaceAmount; + + public Integer getId() { + return id; + } + public void setId(Integer id) { + this.id = id; + } + public String getUserId() { + return userId; + } + public void setUserId(String userId) { + this.userId = userId; + } + public int getBookingId() { + return bookingId; + } + public void setBookingId(int bookingId) { + this.bookingId = bookingId; + } + public String getTxansactionId() { + return txansactionId; + } + public void setTxansactionId(String txansactionId) { + this.txansactionId = txansactionId; + } + public String getStatusCode() { + return statusCode; + } + public void setStatusCode(String statusCode) { + this.statusCode = statusCode; + } + public String getDate() { + return date; + } + public void setDate(String date) { + this.date = date; + } + public String getResponse() { + return response; + } + public void setResponse(String response) { + this.response = response; + } + public String getAmount() { + return Amount; + } + public void setAmount(String amount) { + Amount = amount; + } + public String getBalaceAmount() { + return balaceAmount; + } + public void setBalaceAmount(String balaceAmount) { + this.balaceAmount = balaceAmount; + } + + + +} diff --git a/src/main/java/com/gcc/communityHall/paymentService/entity/TransactionResponse.java b/src/main/java/com/gcc/communityHall/paymentService/entity/TransactionResponse.java new file mode 100644 index 0000000..98ac262 --- /dev/null +++ b/src/main/java/com/gcc/communityHall/paymentService/entity/TransactionResponse.java @@ -0,0 +1,115 @@ +package com.gcc.communityHall.paymentService.entity; + +import jakarta.persistence.*; + +@Entity +public class TransactionResponse { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Integer id; + private String userId; + private int bookingId; + private int hallId; + + private String txansactionId; + private String statusCode; + private String tpslTxnId; + private String date; + + @Column(length = 5000) + private String response; + private String Amount; + + public TransactionResponse() { + + } + + public TransactionResponse(Integer id, String userId, int bookingId,int hallId, String txansactionId, String statusCode, + String tpslTxnId, String date, String response, String amount) { + super(); + this.id = id; + this.userId = userId; + this.bookingId = bookingId; + this.hallId=hallId; + this.txansactionId = txansactionId; + this.statusCode = statusCode; + this.tpslTxnId = tpslTxnId; + this.date = date; + this.response = response; + Amount = amount; + } + public Integer getId() { + return id; + } + public void setId(Integer id) { + this.id = id; + } + public String getUserId() { + return userId; + } + public void setUserId(String userId) { + this.userId = userId; + } + public int getBookingId() { + return bookingId; + } + public void setBookingId(int bookingId) { + this.bookingId = bookingId; + } + public String getTxansactionId() { + return txansactionId; + } + public void setTxansactionId(String txansactionId) { + this.txansactionId = txansactionId; + } + public String getStatusCode() { + return statusCode; + } + public void setStatusCode(String statusCode) { + this.statusCode = statusCode; + } + public String getTpslTxnId() { + return tpslTxnId; + } + public void setTpslTxnId(String tpslTxnId) { + this.tpslTxnId = tpslTxnId; + } + public String getDate() { + return date; + } + public void setDate(String date) { + this.date = date; + } + public String getResponse() { + return response; + } + public void setResponse(String response) { + this.response = response; + } + public String getAmount() { + return Amount; + } + public void setAmount(String amount) { + Amount = amount; + } + + public int getHallId() { + return hallId; + } + + public void setHallId(int hallId) { + this.hallId = hallId; + } + + @Override + public String toString() { + return "TransactionResponse [id=" + id + ", userId=" + userId + ", bookingId=" + bookingId + ", hallId=" + + hallId + ", txansactionId=" + txansactionId + ", statusCode=" + statusCode + ", tpslTxnId=" + + tpslTxnId + ", date=" + date + ", response=" + response + ", Amount=" + Amount + "]"; + } + + + + + +} diff --git a/src/main/java/com/gcc/communityHall/paymentService/refund/DTO/ErrorDetails.java b/src/main/java/com/gcc/communityHall/paymentService/refund/DTO/ErrorDetails.java new file mode 100644 index 0000000..32a9559 --- /dev/null +++ b/src/main/java/com/gcc/communityHall/paymentService/refund/DTO/ErrorDetails.java @@ -0,0 +1,31 @@ +package com.gcc.communityHall.paymentService.refund.DTO; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class ErrorDetails { + + @JsonProperty("code") + private String errorCode; + + @JsonProperty("desc") + private String errorDescription; + + public String getErrorCode() { + return errorCode; + } + + public void setErrorCode(String errorCode) { + this.errorCode = errorCode; + } + + public String getErrorDescription() { + return errorDescription; + } + + public void setErrorDescription(String errorDescription) { + this.errorDescription = errorDescription; + } + + + +} diff --git a/src/main/java/com/gcc/communityHall/paymentService/refund/DTO/PaymentMethod.java b/src/main/java/com/gcc/communityHall/paymentService/refund/DTO/PaymentMethod.java new file mode 100644 index 0000000..4f8019d --- /dev/null +++ b/src/main/java/com/gcc/communityHall/paymentService/refund/DTO/PaymentMethod.java @@ -0,0 +1,99 @@ +package com.gcc.communityHall.paymentService.refund.DTO; + +public class PaymentMethod { + + private String token; + private String instrumentAliasName; + private String instrumentToken; + private String bankSelectionCode; + private PaymentTransaction paymentTransaction; + private Object authentication; + private ErrorDetails error; + private Object desItc; + private Object walletDetails; + + + private Object paymentMode; + private Object aCS; + private Object oTP; + + public String getToken() { + return token; + } + public void setToken(String token) { + this.token = token; + } + public String getInstrumentAliasName() { + return instrumentAliasName; + } + public void setInstrumentAliasName(String instrumentAliasName) { + this.instrumentAliasName = instrumentAliasName; + } + public String getInstrumentToken() { + return instrumentToken; + } + public void setInstrumentToken(String instrumentToken) { + this.instrumentToken = instrumentToken; + } + public String getBankSelectionCode() { + return bankSelectionCode; + } + public void setBankSelectionCode(String bankSelectionCode) { + this.bankSelectionCode = bankSelectionCode; + } + public PaymentTransaction getPaymentTransaction() { + return paymentTransaction; + } + public void setPaymentTransaction(PaymentTransaction paymentTransaction) { + this.paymentTransaction = paymentTransaction; + } + public Object getAuthentication() { + return authentication; + } + public void setAuthentication(Object authentication) { + this.authentication = authentication; + } + public ErrorDetails getError() { + return error; + } + public void setError(ErrorDetails error) { + this.error = error; + } + public Object getDesItc() { + return desItc; + } + public void setDesItc(Object desItc) { + this.desItc = desItc; + } + public Object getWalletDetails() { + return walletDetails; + } + public void setWalletDetails(Object walletDetails) { + this.walletDetails = walletDetails; + } + public Object getPaymentMode() { + return paymentMode; + } + public void setPaymentMode(Object paymentMode) { + this.paymentMode = paymentMode; + } + public Object getaCS() { + return aCS; + } + public void setaCS(Object aCS) { + this.aCS = aCS; + } + public Object getoTP() { + return oTP; + } + public void setoTP(Object oTP) { + this.oTP = oTP; + } + + + + + + + +} diff --git a/src/main/java/com/gcc/communityHall/paymentService/refund/DTO/PaymentTransaction.java b/src/main/java/com/gcc/communityHall/paymentService/refund/DTO/PaymentTransaction.java new file mode 100644 index 0000000..3a11dd0 --- /dev/null +++ b/src/main/java/com/gcc/communityHall/paymentService/refund/DTO/PaymentTransaction.java @@ -0,0 +1,172 @@ +package com.gcc.communityHall.paymentService.refund.DTO; + +public class PaymentTransaction { + + private String amount; + private String balanceAmount; + private String bankReferenceIdentifier; + private String dateTime; + private String errorMessage; + private String identifier; + private String refundIdentifier; + private String statusCode; + private String statusMessage; + + private Object instruction; + private String reference; + private Object refundDdetails; + private Object otherDetails; + private Object rrnNumber; + private Object authCode; + private Object retTranStatus; + private Object paymentDate; + private Object bankName; + private Object paymentModeCode; + private Object cardType; + private Object cardExpiry; + private Object mandateId; + private Object cardTokenStatus; + + public String getAmount() { + return amount; + } + public void setAmount(String amount) { + this.amount = amount; + } + public String getBalanceAmount() { + return balanceAmount; + } + public void setBalanceAmount(String balanceAmount) { + this.balanceAmount = balanceAmount; + } + public String getBankReferenceIdentifier() { + return bankReferenceIdentifier; + } + public void setBankReferenceIdentifier(String bankReferenceIdentifier) { + this.bankReferenceIdentifier = bankReferenceIdentifier; + } + public String getDateTime() { + return dateTime; + } + public void setDateTime(String dateTime) { + this.dateTime = dateTime; + } + public String getErrorMessage() { + return errorMessage; + } + public void setErrorMessage(String errorMessage) { + this.errorMessage = errorMessage; + } + public String getIdentifier() { + return identifier; + } + public void setIdentifier(String identifier) { + this.identifier = identifier; + } + public String getRefundIdentifier() { + return refundIdentifier; + } + public void setRefundIdentifier(String refundIdentifier) { + this.refundIdentifier = refundIdentifier; + } + public String getStatusCode() { + return statusCode; + } + public void setStatusCode(String statusCode) { + this.statusCode = statusCode; + } + public String getStatusMessage() { + return statusMessage; + } + public void setStatusMessage(String statusMessage) { + this.statusMessage = statusMessage; + } + public Object getInstruction() { + return instruction; + } + public void setInstruction(Object instruction) { + this.instruction = instruction; + } + public String getReference() { + return reference; + } + public void setReference(String reference) { + this.reference = reference; + } + public Object getRefundDdetails() { + return refundDdetails; + } + public void setRefundDdetails(Object refundDdetails) { + this.refundDdetails = refundDdetails; + } + public Object getOtherDetails() { + return otherDetails; + } + public void setOtherDetails(Object otherDetails) { + this.otherDetails = otherDetails; + } + public Object getRrnNumber() { + return rrnNumber; + } + public void setRrnNumber(Object rrnNumber) { + this.rrnNumber = rrnNumber; + } + public Object getAuthCode() { + return authCode; + } + public void setAuthCode(Object authCode) { + this.authCode = authCode; + } + public Object getRetTranStatus() { + return retTranStatus; + } + public void setRetTranStatus(Object retTranStatus) { + this.retTranStatus = retTranStatus; + } + public Object getPaymentDate() { + return paymentDate; + } + public void setPaymentDate(Object paymentDate) { + this.paymentDate = paymentDate; + } + public Object getBankName() { + return bankName; + } + public void setBankName(Object bankName) { + this.bankName = bankName; + } + public Object getPaymentModeCode() { + return paymentModeCode; + } + public void setPaymentModeCode(Object paymentModeCode) { + this.paymentModeCode = paymentModeCode; + } + public Object getCardType() { + return cardType; + } + public void setCardType(Object cardType) { + this.cardType = cardType; + } + public Object getCardExpiry() { + return cardExpiry; + } + public void setCardExpiry(Object cardExpiry) { + this.cardExpiry = cardExpiry; + } + public Object getMandateId() { + return mandateId; + } + public void setMandateId(Object mandateId) { + this.mandateId = mandateId; + } + public Object getCardTokenStatus() { + return cardTokenStatus; + } + public void setCardTokenStatus(Object cardTokenStatus) { + this.cardTokenStatus = cardTokenStatus; + } + + + + +} diff --git a/src/main/java/com/gcc/communityHall/paymentService/refund/DTO/TransactionRefundResponse.java b/src/main/java/com/gcc/communityHall/paymentService/refund/DTO/TransactionRefundResponse.java new file mode 100644 index 0000000..6a24f19 --- /dev/null +++ b/src/main/java/com/gcc/communityHall/paymentService/refund/DTO/TransactionRefundResponse.java @@ -0,0 +1,82 @@ +package com.gcc.communityHall.paymentService.refund.DTO; + +public class TransactionRefundResponse { + + private String merchantCode; + private String merchantTransactionIdentifier; + private String merchantTransactionRequestType; + private String responseType; + private String transactionState; + private PaymentMethod paymentMethod; + private ErrorDetails error; + + // @JsonIgnoreProperties("merchantAdditionalDetails") + private Object merchantAdditionalDetails; + + + public String getMerchantCode() { + return merchantCode; + } + public void setMerchantCode(String merchantCode) { + this.merchantCode = merchantCode; + } + public String getMerchantTransactionIdentifier() { + return merchantTransactionIdentifier; + } + public void setMerchantTransactionIdentifier(String merchantTransactionIdentifier) { + this.merchantTransactionIdentifier = merchantTransactionIdentifier; + } + public String getMerchantTransactionRequestType() { + return merchantTransactionRequestType; + } + public void setMerchantTransactionRequestType(String merchantTransactionRequestType) { + this.merchantTransactionRequestType = merchantTransactionRequestType; + } + public String getResponseType() { + return responseType; + } + public void setResponseType(String responseType) { + this.responseType = responseType; + } + public String getTransactionState() { + return transactionState; + } + public void setTransactionState(String transactionState) { + this.transactionState = transactionState; + } + public PaymentMethod getPaymentMethod() { + return paymentMethod; + } + public void setPaymentMethod(PaymentMethod paymentMethod) { + this.paymentMethod = paymentMethod; + } + public ErrorDetails getError() { + return error; + } + public void setError(ErrorDetails error) { + this.error = error; + } + + + + public Object getMerchantAdditionalDetails() { + return merchantAdditionalDetails; + } + public void setMerchantAdditionalDetails(Object merchantAdditionalDetails) { + this.merchantAdditionalDetails = merchantAdditionalDetails; + } + @Override + public String toString() { + return "MyClass{" + + "merchantCode='" + merchantCode + '\'' + + ", merchantTransactionIdentifier='" + merchantTransactionIdentifier + '\'' + + ", merchantTransactionRequestType='" + merchantTransactionRequestType + '\'' + + ", responseType='" + responseType + '\'' + + ", transactionState='" + transactionState + '\'' + + ", paymentMethod=" + paymentMethod + + ", error=" + error + + '}'; + } + + +} diff --git a/src/main/java/com/gcc/communityHall/paymentService/repository/TransRefundResRepository.java b/src/main/java/com/gcc/communityHall/paymentService/repository/TransRefundResRepository.java new file mode 100644 index 0000000..006d010 --- /dev/null +++ b/src/main/java/com/gcc/communityHall/paymentService/repository/TransRefundResRepository.java @@ -0,0 +1,14 @@ +package com.gcc.communityHall.paymentService.repository; + +import com.gcc.communityHall.paymentService.entity.RefundResponse; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + + + + + +@Repository +public interface TransRefundResRepository extends JpaRepository{ + +} diff --git a/src/main/java/com/gcc/communityHall/paymentService/repository/TransactionResponseRepository.java b/src/main/java/com/gcc/communityHall/paymentService/repository/TransactionResponseRepository.java new file mode 100644 index 0000000..f6b4531 --- /dev/null +++ b/src/main/java/com/gcc/communityHall/paymentService/repository/TransactionResponseRepository.java @@ -0,0 +1,35 @@ +package com.gcc.communityHall.paymentService.repository; + +import com.gcc.communityHall.paymentService.entity.TransactionResponse; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +import java.util.Optional; + + + + + +@Repository +public interface TransactionResponseRepository extends JpaRepository{ + + Optional findByBookingId(int bookingId); + Optional findByTxansactionId(String txansactionId ); + + Optional findByTxansactionIdAndStatusCode(String txansactionId,String statusCode ); + Optional findByBookingIdAndStatusCode(int bookingId,String statusCode); + +// @Transactional +// @Query (value = "UPDATE transaction_response SET amount = :amount, booking_id =:booking_id , date = :date, hall_id = :hall_id, response = :response, status_code = :status_code, tpsl_txn_id = :tpsl_txn_id, txansaction_id = :txansaction_id, user_id = :user_id WHERE (id = :id)",nativeQuery = true) +// void updateTransactionResponse ( @Param("id") Integer id, @Param("amount") String amount, @Param("booking_id") int booking_id ,@Param("date" ) String date,@Param("hall_id" ) int hall_id ,@Param("response")String response,@Param("status_code")String status_code,@Param("tpsl_txn_id")String tpsl_txn_id,@Param("txansaction_id")String txansaction_id,@Param("user_id")String user_id ); + +// TransactionResponse saveTransactionResponse(Integer id, String amount, int bookingId, String date, int hallId, String response, +// String statusCode, String tpslTxnId, String txansactionId, String userId); + +// @Query(value = "INSERT INTO transaction_response ('id','amount','booking_id','date','hall_id','response','status_code','tpsl_txn_id','txansaction_id','user_id') VALUES (:id, :amount, :booking_id, :date, :hall_id, :response, :status_code, :tpsl_txn_id, :txansaction_id, :user_id)", nativeQuery = true) +// void saveTransactionResponse(@Param("id") int id, @Param("amount") String amount, @Param("booking_id") int booking_id ,@Param("date" ) String date,@Param("hall_id" ) int hall_id ,@Param("response")String response,@Param("status_code")String status_code,@Param("tpsl_txn_id")String tpsl_txn_id,@Param("txansaction_id")String txansaction_id,@Param("user_id")String user_id ); +// + //@Query (value = "UPDATE transaction_response SET 'amount' = :amount, 'booking_id' =:booking_id , 'date' = :date, 'hall_id' = :hall_id, 'response' = :response, 'status_code' = :status_code, 'tpsl_txn_id' = :tpsl_txn_id, 'txansaction_id' = :txansaction_id, 'user_id' = :user_id WHERE ('id' = :id)", nativeQuery = true) + + +} diff --git a/src/main/java/com/gcc/communityHall/paymentService/service/PaymentGatewayService.java b/src/main/java/com/gcc/communityHall/paymentService/service/PaymentGatewayService.java new file mode 100644 index 0000000..b6c51e3 --- /dev/null +++ b/src/main/java/com/gcc/communityHall/paymentService/service/PaymentGatewayService.java @@ -0,0 +1,38 @@ +package com.gcc.communityHall.paymentService.service; + +import com.gcc.communityHall.paymentService.entity.RefundResponse; +import com.gcc.communityHall.paymentService.entity.TransactionResponse; + +import java.security.NoSuchAlgorithmException; + + + + +public interface PaymentGatewayService { + + public String getToken(String merchantId, String txnId, String totalAmt, String accountNo, String consumerId, + String consumerMobileNo, String consumerEmailId, String debitStartDate, String debitEndDate, + String maxAmount, String amountType, String frequency, String cardNumber, String expMonth, String expYear, + String cvvCode, String salt + + ) throws NoSuchAlgorithmException; + + public String generateToken(String token)throws NoSuchAlgorithmException; + public String encryptHxRefund(String text) throws Exception; + public String ToHexStrRefund(byte[] dataBuf); + public String decryptHxTRefund(String hxstrr) throws Exception; + public byte[] FromHexStr (String hxStr); + + public TransactionResponse recordResponse(TransactionResponse transactionResponse); + public RefundResponse recordRefund(RefundResponse refundReponse); + + public TransactionResponse getTransactionResponseByBookingId(int bookingId); + public TransactionResponse getTransactionResponseByTxansactionId(String txansactionId,String statusCode); + public TransactionResponse getTransactionResponseByBookingIdAndStatusCode(int bookingId,String statusCode); + + public String refundTheAmount(int bookingId,int userId) throws Exception; + + public String refundTheDepositAmount(int bookingId,int userId,double amount) throws Exception; + + +} diff --git a/src/main/java/com/gcc/communityHall/paymentService/service/PaymentGatewayServiceImpl.java b/src/main/java/com/gcc/communityHall/paymentService/service/PaymentGatewayServiceImpl.java new file mode 100644 index 0000000..7afd7ca --- /dev/null +++ b/src/main/java/com/gcc/communityHall/paymentService/service/PaymentGatewayServiceImpl.java @@ -0,0 +1,300 @@ +package com.gcc.communityHall.paymentService.service; + + +import com.gcc.communityHall.paymentService.DTO.Merchant; +import com.gcc.communityHall.paymentService.DTO.Transaction; +import com.gcc.communityHall.paymentService.DTO.TransactionData; +import com.gcc.communityHall.paymentService.config.PaymentConfig; +import com.gcc.communityHall.paymentService.entity.RefundResponse; +import com.gcc.communityHall.paymentService.entity.TransactionResponse; +import com.gcc.communityHall.paymentService.refund.DTO.TransactionRefundResponse; +import com.gcc.communityHall.paymentService.repository.TransRefundResRepository; +import com.gcc.communityHall.paymentService.repository.TransactionResponseRepository; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.google.gson.Gson; +import org.apache.commons.codec.binary.Hex; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Service; +import org.springframework.web.client.RestTemplate; + +import javax.crypto.Cipher; +import javax.crypto.spec.IvParameterSpec; +import javax.crypto.spec.SecretKeySpec; +import java.math.BigInteger; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.util.Optional; + + +@Service +public class PaymentGatewayServiceImpl implements PaymentGatewayService { + + @Autowired + private PaymentConfig paymentConfig; + + @Autowired + private TransactionResponseRepository transactionResRepo; + + @Autowired + private TransRefundResRepository refundResRepo; + + @Override + public String generateToken(String token) throws NoSuchAlgorithmException { + System.out.println("Token:-" + token); + MessageDigest md = MessageDigest.getInstance("SHA-512"); + md.update(token.getBytes()); + + byte[] bytes = md.digest(); + + BigInteger bigInt = new BigInteger(1, bytes); + String encryptedtoken = bigInt.toString(16); + + while (encryptedtoken.length() < 128) { + encryptedtoken = "0" + encryptedtoken; + } + System.out.println("Encryption :- " + encryptedtoken); + return encryptedtoken; + } + +//The process of encryption for refund API + @Override + public String encryptHxRefund(String text) throws Exception { + Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); + SecretKeySpec keySpec = new SecretKeySpec(this.paymentConfig.getEncryptionKeyByte(), "AES"); + IvParameterSpec ivSpec = new IvParameterSpec(this.paymentConfig.getEncryptionIVByte()); + cipher.init(1, keySpec, ivSpec); + byte[] results = cipher.doFinal(text.getBytes("UTF-8")); + String hxencstr = ToHexStrRefund(results); + return hxencstr; + } + + @Override + public String ToHexStrRefund(byte[] dataBuf) { + String hxstr = null; + Hex hx = new Hex(); + hxstr = new String(hx.encode(dataBuf)); + return hxstr; + } + +//The process of decryption for refund API + @Override + public String decryptHxTRefund(String hxstrr) throws Exception{ + Cipher cipher = Cipher.getInstance("AES/CBC/NoPadding"); + + SecretKeySpec keySpec = new SecretKeySpec(this.paymentConfig.getEncryptionKeyByte(), "AES"); + IvParameterSpec ivSpec = new IvParameterSpec(this.paymentConfig.getEncryptionIVByte()); + cipher.init(Cipher.DECRYPT_MODE, keySpec, ivSpec); + + byte[] decbytes = FromHexStr(hxstrr); + + byte[] results = cipher.doFinal(decbytes); + return new String(results, "UTF-8").trim(); + } + + @Override + public byte[] FromHexStr(String hxStr) { + byte[] charArray = hxStr.getBytes(); + byte[] bufstr = null; + Hex hxx = new Hex(); + + try { + bufstr = hxx.decode(charArray); + } catch (Exception e) { + e.printStackTrace(); + } + + return bufstr; + } + + @Override + public TransactionResponse recordResponse( TransactionResponse transactionResponse) { + // TODO Auto-generated method stub + System.out.println("====================================="); + System.out.println(transactionResponse.toString()); + return transactionResRepo.save(transactionResponse); + //transactionResRepo.updateTransactionResponse(transactionResponse.getId(), transactionResponse.getAmount(), transactionResponse.getBookingId(), transactionResponse.getDate(), transactionResponse.getHallId(), transactionResponse.getResponse(), transactionResponse.getStatusCode(), transactionResponse.getTpslTxnId(), transactionResponse.getTxansactionId(), transactionResponse.getUserId()); + //return transactionResponse; + } + + @Override + public RefundResponse recordRefund(RefundResponse refundReponse) { + // TODO Auto-generated method stub + return this.refundResRepo.save(refundReponse); + } + + @Override + public TransactionResponse getTransactionResponseByBookingId(int bookingId) { + // TODO Auto-generated method stub + Optional findByBookingId = this.transactionResRepo.findByBookingId(bookingId); + if(findByBookingId.isPresent()) { + return findByBookingId.get(); + } + else { + return new TransactionResponse(); + } + } + + @Override + public TransactionResponse getTransactionResponseByTxansactionId(String txansactionId,String statusCode) { + // TODO Auto-generated method stub + Optional findByTxansactionId=this.transactionResRepo.findByTxansactionIdAndStatusCode(txansactionId,statusCode); + if(findByTxansactionId.isPresent()) { + return findByTxansactionId.get(); + } + else { + return new TransactionResponse(); + } + } + + @Override + public TransactionResponse getTransactionResponseByBookingIdAndStatusCode(int bookingId, String statusCode) { + Optional findByTxansactionId=this.transactionResRepo .findByBookingIdAndStatusCode(bookingId,statusCode); + if(findByTxansactionId.isPresent()) { + return findByTxansactionId.get(); + } + else { + return new TransactionResponse(); + } + } + + @Override + public String getToken(String merchantId, String txnId, String totalAmt, String accountNo, String consumerId, + String consumerMobileNo, String consumerEmailId, String debitStartDate, String debitEndDate, + String maxAmount, String amountType, String frequency, String cardNumber, String expMonth, String expYear, + String cvvCode, String salt) throws NoSuchAlgorithmException { + String token=merchantId+txnId+totalAmt+accountNo+consumerId+consumerMobileNo+ + consumerEmailId+debitStartDate+debitEndDate+maxAmount+amountType+ + frequency+cardNumber+expMonth+expYear+cvvCode+salt; + + return generateToken(token); + } + + @Override + public String refundTheAmount(int bookingId,int userId) throws Exception { + System.out.println("Refund Api call.......working on it"); + TransactionResponse transactionRes = this.getTransactionResponseByBookingIdAndStatusCode(bookingId,this.paymentConfig.getTransactionSuccessCode()); + RefundResponse recordRefundResponse = new RefundResponse(); + + Merchant merchant = new Merchant(); + merchant.setIdentifier(this.paymentConfig.getMerchantId()); + + Transaction transaction = new Transaction(); + transaction.setAmount(transactionRes.getAmount());//Amount given here + transaction.setIdentifier(""); + transaction.setDateTime(transactionRes.getDate()); //At what date transaction happens + transaction.setRequestType("R"); + transaction.setToken(""); + transaction.setReference(transactionRes.getTpslTxnId()); //tpsl refer number + + + TransactionData transactionData = new TransactionData(); + transactionData.setMerchant(merchant); + transactionData.setTransaction(transaction); + + // Serialize TransactionData object to JSON string + Gson gson = new Gson(); + String json = gson.toJson(transactionData); + System.out.println(json); + + String encryptHxRefund = this.encryptHxRefund(json); + RestTemplate resttemplate = new RestTemplate(); + String Url ="https://www.tpsl-india.in/PaymentGateway/merchant2.pg/"+this.paymentConfig.getMerchantId(); + ResponseEntity postForEntity = resttemplate.postForEntity(Url, encryptHxRefund, String.class); + + String decryptHxTRefund = this.decryptHxTRefund(postForEntity.getBody()); + recordRefundResponse.setResponse(decryptHxTRefund); + recordRefundResponse.setUserId(String.valueOf(userId));//make it dynamic + recordRefundResponse.setBookingId(bookingId); + try { + ObjectMapper objectMapper = new ObjectMapper(); + + TransactionRefundResponse myObject = objectMapper.readValue(decryptHxTRefund, TransactionRefundResponse.class); + System.out.println(myObject.toString()); + +// if(myObject.getPaymentMethod().getPaymentTransaction().getStatusCode().equals(this.paymentConfig.getRefundSuccessCode())) { +// System.out.println("Refund Process complete........"+bookingId); +// recordRefundResponse.setAmount(myObject.getPaymentMethod().getPaymentTransaction().getAmount()); +// recordRefundResponse.setBalaceAmount(myObject.getPaymentMethod().getPaymentTransaction().getBalanceAmount()); +// } + recordRefundResponse.setStatusCode(myObject.getPaymentMethod().getPaymentTransaction().getStatusCode()); + recordRefundResponse.setTxansactionId(myObject.getMerchantTransactionIdentifier()); + if(myObject.getPaymentMethod().getPaymentTransaction().getStatusCode().equals(this.paymentConfig.getRefundSuccessCode())) { + System.out.println("Refund Process complete........"+bookingId); + recordRefundResponse.setAmount(myObject.getPaymentMethod().getPaymentTransaction().getAmount()); + recordRefundResponse.setBalaceAmount(myObject.getPaymentMethod().getPaymentTransaction().getBalanceAmount()); + this.recordRefund(recordRefundResponse); + return "Refunded"; + } + this.recordRefund(recordRefundResponse); + return "Error"; + + } catch (Exception e) { + e.printStackTrace(); + } + return "Error"; + + } + + @Override + public String refundTheDepositAmount(int bookingId, int userId,double amount) throws Exception { + System.out.println("Refund Api call.......working on it"); + TransactionResponse transactionRes = this.getTransactionResponseByBookingIdAndStatusCode(bookingId,this.paymentConfig.getTransactionSuccessCode()); + RefundResponse recordRefundResponse = new RefundResponse(); + + Merchant merchant = new Merchant(); + merchant.setIdentifier(this.paymentConfig.getMerchantId()); + + Transaction transaction = new Transaction(); + transaction.setAmount(String.valueOf(amount));//Amount given here + transaction.setIdentifier(""); + transaction.setDateTime(transactionRes.getDate()); //At what date transaction happens + transaction.setRequestType("R"); + transaction.setToken(""); + transaction.setReference(transactionRes.getTpslTxnId()); //tpsl refer number + + + TransactionData transactionData = new TransactionData(); + transactionData.setMerchant(merchant); + transactionData.setTransaction(transaction); + + // Serialize TransactionData object to JSON string + Gson gson = new Gson(); + String json = gson.toJson(transactionData); + System.out.println(json); + + String encryptHxRefund = this.encryptHxRefund(json); + RestTemplate resttemplate = new RestTemplate(); + String Url ="https://www.tpsl-india.in/PaymentGateway/merchant2.pg/"+this.paymentConfig.getMerchantId(); + ResponseEntity postForEntity = resttemplate.postForEntity(Url, encryptHxRefund, String.class); + + String decryptHxTRefund = this.decryptHxTRefund(postForEntity.getBody()); + recordRefundResponse.setResponse(decryptHxTRefund); + recordRefundResponse.setUserId(String.valueOf(userId));//make it dynamic + recordRefundResponse.setBookingId(bookingId); + try { + ObjectMapper objectMapper = new ObjectMapper(); + + TransactionRefundResponse myObject = objectMapper.readValue(decryptHxTRefund, TransactionRefundResponse.class); + System.out.println(myObject.toString()); + + recordRefundResponse.setStatusCode(myObject.getPaymentMethod().getPaymentTransaction().getStatusCode()); + recordRefundResponse.setTxansactionId(myObject.getMerchantTransactionIdentifier()); + if(myObject.getPaymentMethod().getPaymentTransaction().getStatusCode().equals(this.paymentConfig.getRefundSuccessCode())) { + System.out.println("Refund Process complete........"+bookingId); + recordRefundResponse.setAmount(myObject.getPaymentMethod().getPaymentTransaction().getAmount()); + recordRefundResponse.setBalaceAmount(myObject.getPaymentMethod().getPaymentTransaction().getBalanceAmount()); + this.recordRefund(recordRefundResponse); + return "Refunded"; + } + this.recordRefund(recordRefundResponse); + return "Error"; + + } catch (Exception e) { + e.printStackTrace(); + } + return "Error"; + } + + +} diff --git a/src/main/java/com/gcc/communityHall/paymentService/service/TransactionNumberGenerator.java b/src/main/java/com/gcc/communityHall/paymentService/service/TransactionNumberGenerator.java new file mode 100644 index 0000000..612a624 --- /dev/null +++ b/src/main/java/com/gcc/communityHall/paymentService/service/TransactionNumberGenerator.java @@ -0,0 +1,37 @@ +package com.gcc.communityHall.paymentService.service; + +import org.springframework.stereotype.Service; + +import java.util.Random; + +@Service +public class TransactionNumberGenerator { + + public String generateTransactionNumber() { + // Define the length of the transaction number + int length = 12; + + // Define characters to be used in the transaction number + String characters = "0123456789"; + + // Create a StringBuilder to store the transaction number + StringBuilder sb = new StringBuilder(); + + // Create an instance of Random class + Random random = new Random(); + + // Generate the transaction number + for (int i = 0; i < length; i++) { + // Generate a random index within the range of characters + int randomIndex = random.nextInt(characters.length()); + + // Append the character at the random index to the transaction number + sb.append(characters.charAt(randomIndex)); + } + + + // Convert StringBuilder to String and return + return sb.toString(); + } + +} diff --git a/src/main/java/com/gcc/communityHall/repository/BookingCalendarRepository.java b/src/main/java/com/gcc/communityHall/repository/BookingCalendarRepository.java new file mode 100644 index 0000000..bd9d007 --- /dev/null +++ b/src/main/java/com/gcc/communityHall/repository/BookingCalendarRepository.java @@ -0,0 +1,9 @@ +package com.gcc.communityHall.repository; + +import com.gcc.communityHall.entity.BookingCalendar; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +@Repository +public interface BookingCalendarRepository extends JpaRepository { +} diff --git a/src/main/java/com/gcc/communityHall/repository/BookingDetailsRepository.java b/src/main/java/com/gcc/communityHall/repository/BookingDetailsRepository.java new file mode 100644 index 0000000..3aa247b --- /dev/null +++ b/src/main/java/com/gcc/communityHall/repository/BookingDetailsRepository.java @@ -0,0 +1,9 @@ +package com.gcc.communityHall.repository; + +import com.gcc.communityHall.entity.BookingDetails; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +@Repository +public interface BookingDetailsRepository extends JpaRepository { +} diff --git a/src/main/java/com/gcc/communityHall/repository/BookingDocumentsRepository.java b/src/main/java/com/gcc/communityHall/repository/BookingDocumentsRepository.java new file mode 100644 index 0000000..77a4ef4 --- /dev/null +++ b/src/main/java/com/gcc/communityHall/repository/BookingDocumentsRepository.java @@ -0,0 +1,9 @@ +package com.gcc.communityHall.repository; + +import com.gcc.communityHall.entity.BookingDocuments; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +@Repository +public interface BookingDocumentsRepository extends JpaRepository { +} diff --git a/src/main/java/com/gcc/communityHall/repository/BookingHistoryRepository.java b/src/main/java/com/gcc/communityHall/repository/BookingHistoryRepository.java new file mode 100644 index 0000000..b3116fa --- /dev/null +++ b/src/main/java/com/gcc/communityHall/repository/BookingHistoryRepository.java @@ -0,0 +1,9 @@ +package com.gcc.communityHall.repository; + +import com.gcc.communityHall.entity.BookingHistory; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +@Repository +public interface BookingHistoryRepository extends JpaRepository { +} diff --git a/src/main/java/com/gcc/communityHall/repository/DamageRepository.java b/src/main/java/com/gcc/communityHall/repository/DamageRepository.java new file mode 100644 index 0000000..9a8dacc --- /dev/null +++ b/src/main/java/com/gcc/communityHall/repository/DamageRepository.java @@ -0,0 +1,9 @@ +package com.gcc.communityHall.repository; + +import com.gcc.communityHall.entity.Damage; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +@Repository +public interface DamageRepository extends JpaRepository { +} diff --git a/src/main/java/com/gcc/communityHall/repository/EbDetailsRepository.java b/src/main/java/com/gcc/communityHall/repository/EbDetailsRepository.java new file mode 100644 index 0000000..4dce238 --- /dev/null +++ b/src/main/java/com/gcc/communityHall/repository/EbDetailsRepository.java @@ -0,0 +1,10 @@ +package com.gcc.communityHall.repository; + +import com.gcc.communityHall.entity.BookingDocuments; +import com.gcc.communityHall.entity.EbDetails; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +@Repository +public interface EbDetailsRepository extends JpaRepository { +} diff --git a/src/main/java/com/gcc/communityHall/repository/GccBlockingDateRepository.java b/src/main/java/com/gcc/communityHall/repository/GccBlockingDateRepository.java new file mode 100644 index 0000000..3c3ccd1 --- /dev/null +++ b/src/main/java/com/gcc/communityHall/repository/GccBlockingDateRepository.java @@ -0,0 +1,10 @@ +package com.gcc.communityHall.repository; + +import com.gcc.communityHall.entity.BookingDocuments; +import com.gcc.communityHall.entity.GccBlockingDate; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +@Repository +public interface GccBlockingDateRepository extends JpaRepository { +} diff --git a/src/main/java/com/gcc/communityHall/repository/HallDetailsRepository.java b/src/main/java/com/gcc/communityHall/repository/HallDetailsRepository.java new file mode 100644 index 0000000..2744c31 --- /dev/null +++ b/src/main/java/com/gcc/communityHall/repository/HallDetailsRepository.java @@ -0,0 +1,10 @@ +package com.gcc.communityHall.repository; + + +import com.gcc.communityHall.entity.HallDetails; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +@Repository +public interface HallDetailsRepository extends JpaRepository { +} diff --git a/src/main/java/com/gcc/communityHall/repository/HallImagesRepository.java b/src/main/java/com/gcc/communityHall/repository/HallImagesRepository.java new file mode 100644 index 0000000..58d6c46 --- /dev/null +++ b/src/main/java/com/gcc/communityHall/repository/HallImagesRepository.java @@ -0,0 +1,10 @@ +package com.gcc.communityHall.repository; + + +import com.gcc.communityHall.entity.HallImages; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +@Repository +public interface HallImagesRepository extends JpaRepository { +} diff --git a/src/main/java/com/gcc/communityHall/repository/LoginRepository.java b/src/main/java/com/gcc/communityHall/repository/LoginRepository.java new file mode 100644 index 0000000..d28ccef --- /dev/null +++ b/src/main/java/com/gcc/communityHall/repository/LoginRepository.java @@ -0,0 +1,10 @@ +package com.gcc.communityHall.repository; + + +import com.gcc.communityHall.entity.Login; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +@Repository +public interface LoginRepository extends JpaRepository { +} diff --git a/src/main/java/com/gcc/communityHall/repository/PaymentsRepository.java b/src/main/java/com/gcc/communityHall/repository/PaymentsRepository.java new file mode 100644 index 0000000..d05d524 --- /dev/null +++ b/src/main/java/com/gcc/communityHall/repository/PaymentsRepository.java @@ -0,0 +1,10 @@ +package com.gcc.communityHall.repository; + + +import com.gcc.communityHall.entity.Payments; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +@Repository +public interface PaymentsRepository extends JpaRepository { +} diff --git a/src/main/java/com/gcc/communityHall/repository/ReasonDocMasterRepository.java b/src/main/java/com/gcc/communityHall/repository/ReasonDocMasterRepository.java new file mode 100644 index 0000000..1545eee --- /dev/null +++ b/src/main/java/com/gcc/communityHall/repository/ReasonDocMasterRepository.java @@ -0,0 +1,9 @@ +package com.gcc.communityHall.repository; + +import com.gcc.communityHall.entity.ReasonDocumentMaster; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +@Repository +public interface ReasonDocMasterRepository extends JpaRepository { +} diff --git a/src/main/java/com/gcc/communityHall/repository/ReasonMasterRepository.java b/src/main/java/com/gcc/communityHall/repository/ReasonMasterRepository.java new file mode 100644 index 0000000..c3b624f --- /dev/null +++ b/src/main/java/com/gcc/communityHall/repository/ReasonMasterRepository.java @@ -0,0 +1,9 @@ +package com.gcc.communityHall.repository; + +import com.gcc.communityHall.entity.ReasonMaster; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +@Repository +public interface ReasonMasterRepository extends JpaRepository { +} diff --git a/src/main/java/com/gcc/communityHall/repository/RefundTransactionRepository.java b/src/main/java/com/gcc/communityHall/repository/RefundTransactionRepository.java new file mode 100644 index 0000000..c453ad3 --- /dev/null +++ b/src/main/java/com/gcc/communityHall/repository/RefundTransactionRepository.java @@ -0,0 +1,10 @@ +package com.gcc.communityHall.repository; + + +import com.gcc.communityHall.entity.RefundTransaction; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +@Repository +public interface RefundTransactionRepository extends JpaRepository { +} diff --git a/src/main/java/com/gcc/communityHall/repository/SettlementRepository.java b/src/main/java/com/gcc/communityHall/repository/SettlementRepository.java new file mode 100644 index 0000000..761e901 --- /dev/null +++ b/src/main/java/com/gcc/communityHall/repository/SettlementRepository.java @@ -0,0 +1,9 @@ +package com.gcc.communityHall.repository; + +import com.gcc.communityHall.entity.Settlement; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +@Repository +public interface SettlementRepository extends JpaRepository { +} diff --git a/src/main/java/com/gcc/communityHall/repository/SmsSenderRepository.java b/src/main/java/com/gcc/communityHall/repository/SmsSenderRepository.java new file mode 100644 index 0000000..1187679 --- /dev/null +++ b/src/main/java/com/gcc/communityHall/repository/SmsSenderRepository.java @@ -0,0 +1,9 @@ +package com.gcc.communityHall.repository; + +import com.gcc.communityHall.entity.SmsSender; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +@Repository +public interface SmsSenderRepository extends JpaRepository { +} diff --git a/src/main/java/com/gcc/communityHall/repository/UserHistoryRepository.java b/src/main/java/com/gcc/communityHall/repository/UserHistoryRepository.java new file mode 100644 index 0000000..17f58d9 --- /dev/null +++ b/src/main/java/com/gcc/communityHall/repository/UserHistoryRepository.java @@ -0,0 +1,9 @@ +package com.gcc.communityHall.repository; + +import com.gcc.communityHall.entity.UserHistory; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +@Repository +public interface UserHistoryRepository extends JpaRepository { +} diff --git a/src/main/java/com/gcc/communityHall/repository/UsersRepository.java b/src/main/java/com/gcc/communityHall/repository/UsersRepository.java new file mode 100644 index 0000000..563c5ca --- /dev/null +++ b/src/main/java/com/gcc/communityHall/repository/UsersRepository.java @@ -0,0 +1,14 @@ +package com.gcc.communityHall.repository; + +import com.gcc.communityHall.entity.Users; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +import java.util.List; + +@Repository +public interface UsersRepository extends JpaRepository { + + List findByUserstatus(Users.userStatus userStatus); + List findByUsertype(Users.userType userType); +} diff --git a/src/main/java/com/gcc/communityHall/service/BookingService.java b/src/main/java/com/gcc/communityHall/service/BookingService.java new file mode 100644 index 0000000..b79ea76 --- /dev/null +++ b/src/main/java/com/gcc/communityHall/service/BookingService.java @@ -0,0 +1,14 @@ +package com.gcc.communityHall.service; + +import com.gcc.communityHall.entity.BookingDetails; + +import java.util.Map; + +public interface BookingService { + BookingDetails getBookingsById(int BookingId); + BookingDetails updateBookingHistory(BookingDetails bd); + public String confirmTheDateAndSlot(String fromDate, String toDate, int days, int fromStartingSlot, int fromEndingSlot, int toStartingSlot, int toEndingSlot, int bookingId,int userId); + + public String saveBookingDetails(Map formData); + +} diff --git a/src/main/java/com/gcc/communityHall/service/CalendarService.java b/src/main/java/com/gcc/communityHall/service/CalendarService.java new file mode 100644 index 0000000..3b65e11 --- /dev/null +++ b/src/main/java/com/gcc/communityHall/service/CalendarService.java @@ -0,0 +1,4 @@ +package com.gcc.communityHall.service; + +public interface CalendarService { +} diff --git a/src/main/java/com/gcc/communityHall/service/HallDetailService.java b/src/main/java/com/gcc/communityHall/service/HallDetailService.java new file mode 100644 index 0000000..a681098 --- /dev/null +++ b/src/main/java/com/gcc/communityHall/service/HallDetailService.java @@ -0,0 +1,31 @@ +package com.gcc.communityHall.service; + +import com.gcc.communityHall.entity.HallDetails; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.multipart.MultipartFile; + +import java.util.List; + +public interface HallDetailService { + + HallDetails saveHallDetails(HallDetails hallDetails, List hallImages); + HallDetails getHallById(int hallId); + HallDetails deActivateHallById(int hallId); + + HallDetails saveHall( + String hallName, + float depositAmount, + float halfDayAmt, float fullDayAmt, + float gst ,float hallArea, String ebNumber, + int parkingCapacity, int seatingCapacity, + String doorNo, String street, + String area, String zone, + String division, String landMark, + String city, + int pinCode,String latitude, + String longitude, String hallInchargeName, + long hallInchargeNo, HallDetails.HallStatus status, + String updatedId, + MultipartFile hallImages[] ); + +} diff --git a/src/main/java/com/gcc/communityHall/service/Impl/BookingServiceImpl.java b/src/main/java/com/gcc/communityHall/service/Impl/BookingServiceImpl.java new file mode 100644 index 0000000..babbc84 --- /dev/null +++ b/src/main/java/com/gcc/communityHall/service/Impl/BookingServiceImpl.java @@ -0,0 +1,149 @@ +package com.gcc.communityHall.service.Impl; + +import com.gcc.communityHall.entity.*; +import com.gcc.communityHall.others.UserSession; +import com.gcc.communityHall.repository.BookingDetailsRepository; +import com.gcc.communityHall.repository.BookingDocumentsRepository; +import com.gcc.communityHall.repository.ReasonDocMasterRepository; +import com.gcc.communityHall.service.BookingService; +import com.gcc.communityHall.service.HallDetailService; +import com.gcc.communityHall.service.ReasonMasterService; +import com.gcc.communityHall.service.UserService; +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 java.io.FileOutputStream; +import java.time.LocalDate; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@Service +public class BookingServiceImpl implements BookingService { + + @Autowired + private BookingDetailsRepository bookingDetailsRepository; + @Autowired + private BookingDocumentsRepository bookingDocumentsRepository; + + @Autowired + private ReasonMasterService reasonMasterService; + @Autowired + private HallDetailService hallDetailService; + + @Autowired + private UserService userService; + + @Autowired + private UserSession userSession; + + @Value("${file.upload.directory}") + private String uploadDirectory; + + @Value("${file.fullpath}") + private String serverPath; + + + @Override + public BookingDetails getBookingsById(int BookingId) { + return bookingDetailsRepository.findById(BookingId).get(); + } + + @Override + public BookingDetails updateBookingHistory(BookingDetails bd) { + return null; + } + + @Override + public String confirmTheDateAndSlot(String fromDate, String toDate, int days, int fromStartingSlot, int fromEndingSlot, int toStartingSlot, int toEndingSlot, int bookingId, int userId) { + return null; + } + + @Override + public String saveBookingDetails(Map formData) { + System.out.println(formData); + ReasonMaster reasonMaster=reasonMasterService.getReasonById(Integer.parseInt(formData.get("reasonId").toString())); + HallDetails hallDetails = hallDetailService.getHallById(Integer.parseInt(formData.get("hallId").toString())); + Users user=userService.getUserById(userSession.getUserId()); + BookingDetails bookingDetails = new BookingDetails(); + if(user!=null) { + bookingDetails.setUsers(user); + if (hallDetails != null) { + bookingDetails.setHallDetails(hallDetails); + bookingDetails.setDepositAmount(hallDetails.getDepositAmount()); + String startDate =formData.get("startDate").toString(); + String endDate =formData.get("endDate").toString(); + int days = Integer.parseInt(formData.get("days").toString()); + int startingSlot = Integer.parseInt(formData.get("startingSlot").toString()); + int endingSlot = Integer.parseInt(formData.get("endingSlot").toString()); + double hallAmount =calcHallAmount(hallDetails,days,startingSlot,endingSlot); + double gstAmount = (hallAmount*hallDetails.getGst())/100; + bookingDetails.setHallAmount(hallAmount); + bookingDetails.setGst(gstAmount); + bookingDetails.setNoOfDays(days); + bookingDetails.setStartingSlot(startingSlot); + bookingDetails.setEndingSlot(endingSlot); + bookingDetails.setStartDate(startDate); + bookingDetails.setEndDate(endDate); + bookingDetails.setBookingDate(LocalDate.now()); + bookingDetails.setReason(reasonMaster.getReason()); + bookingDetails = bookingDetailsRepository.save(bookingDetails); + } + if (reasonMaster != null) { + List reasonDocMaster = reasonMaster.getReasonDocumentMasterList(); + for (ReasonDocumentMaster rm : reasonDocMaster) { + BookingDocuments bd = new BookingDocuments(); + bd.setBookingDetails(bookingDetails); + if (rm.isAddTextField()) { + String name= formData.get(rm.getFieldName()).toString(); + bd.setName(name); + bd.setBooking_label(rm.getFieldName().toString()); + } + if (rm.isAddDocumentField()) { + MultipartFile file = (MultipartFile)formData.get(rm.getDocFieldName()); + bd.setBookingDocUrl(serverPath+"images/"+reasonMaster.getReason().toLowerCase()+"/"+bookingDetails.getBookingId()+"_"+file.getOriginalFilename()); + String filePath =uploadDirectory+"/"+reasonMaster.getReason()+"/"+bookingDetails.getBookingId()+"_"+file.getOriginalFilename(); + bd.setDocumentName(file.getOriginalFilename()); + bd.setDocumentType(file.getContentType()); + try(FileOutputStream fos = new FileOutputStream(filePath)){ + byte [] bytes = file.getBytes(); + fos.write(bytes); + } catch (Exception e) { + throw new RuntimeException(e); + } + bookingDocumentsRepository.save(bd); + + + } + } + + } + } + return null; + } + + private double calcHallAmount(HallDetails hallDetails,int days,int startingSlot,int endingSlot){ + double hallAmount = 0; + if(days==1 && startingSlot==1 && endingSlot==2){ //full day + hallAmount =hallDetails.getFullDayRent(); + + } else if (days==1 && (startingSlot==1 && endingSlot==1)|| (startingSlot==2 && endingSlot==2) ) { // half day + hallAmount =hallDetails.getHalfDayRent(); + } else if (days>1) { + if(startingSlot==2 && endingSlot==1){ + hallAmount =hallDetails.getHalfDayRent()*2; + days=days-2; + } else if (startingSlot==2 || endingSlot==1) { + hallAmount =hallDetails.getHalfDayRent(); + days=days-1; + } + for(int i=0;i hallImages) { + if(hallImages.size()>0){ + + } + return null; + } + + @Override + public HallDetails getHallById(int hallId) { + Optional hallDetails = hallDetailsRepository.findById(hallId); + if(hallDetails.isPresent()){ + return hallDetails.get(); + } + + return null; + } + + @Override + public HallDetails deActivateHallById(int hallId) { + return null; + } + + @Override + public HallDetails saveHall( + String hallName,float depositAmount, float halfDayAmt, + float fullDayAmt, float gst,float hallArea, String ebNumber, + int parkingCapacity, int seatingCapacity, + String doorNo, String street, String area, String zone, + String division, String landMark, String city, int pinCode, + String latitude, String longitude, String hallInchargeName, + long hallInchargeNo, HallDetails.HallStatus status,String updatedId, MultipartFile[] hallImages) { + HallDetails hall = new HallDetails(); + hall.setHallName(hallName); + hall.setDoorNo(doorNo); + hall.setHallArea(hallArea); + hall.setStreet(street); + hall.setArea(area); + hall.setCity(city); + hall.setPinCode(pinCode); + hall.setDivision(division); + hall.setZone(zone); + hall.setEbNumber(ebNumber); + hall.setFullDayRent(fullDayAmt); + hall.setHalfDayRent(halfDayAmt); + hall.setDepositAmount(depositAmount); + hall.setGst(gst); + hall.setHallInchargeName(hallInchargeName); + hall.setHallInchargeMobno(hallInchargeNo); + hall.setSeatingCapacity(seatingCapacity); + hall.setHallStatus(status); + hall.setLatitude(latitude); + hall.setLongitude(longitude); + hall.setLankMark(landMark); + hall.setUpdatedId(updatedId); + hall.setCreateddate(LocalDate.now()); + HallDetails hallDetails = hallDetailsRepository.save(hall); + if(hallImages!=null && hallImages.length>0){ + for (int i=0;i reasonDocumentMasterList =reasonMaster.getReasonDocumentMasterList(); + reasonMaster.setReasonDocumentMasterList(null); + ReasonMaster resMaster =reasonMasterRepository.save(reasonMaster); + if(reasonDocumentMasterList!=null) { + for (int i = 0; i < reasonDocumentMasterList.size(); i++) { + ReasonDocumentMaster reasonDocMaster = reasonDocumentMasterList.get(i); + reasonDocMaster.setReasonMaster(resMaster); + reasonDocMasterRepository.save(reasonDocMaster); + + } + } + + return "Success"; + } + + @Override + public ReasonMaster getReasonById(int reasonId) { + return reasonMasterRepository.findById(reasonId).get(); + } +} diff --git a/src/main/java/com/gcc/communityHall/service/Impl/TransactionServiceImpl.java b/src/main/java/com/gcc/communityHall/service/Impl/TransactionServiceImpl.java new file mode 100644 index 0000000..101de00 --- /dev/null +++ b/src/main/java/com/gcc/communityHall/service/Impl/TransactionServiceImpl.java @@ -0,0 +1,4 @@ +package com.gcc.communityHall.service.Impl; + +public class TransactionServiceImpl { +} diff --git a/src/main/java/com/gcc/communityHall/service/Impl/UserServiceImpl.java b/src/main/java/com/gcc/communityHall/service/Impl/UserServiceImpl.java new file mode 100644 index 0000000..f0f7fc0 --- /dev/null +++ b/src/main/java/com/gcc/communityHall/service/Impl/UserServiceImpl.java @@ -0,0 +1,80 @@ +package com.gcc.communityHall.service.Impl; + +import com.gcc.communityHall.entity.UserHistory; +import com.gcc.communityHall.entity.Users; +import com.gcc.communityHall.repository.UserHistoryRepository; +import com.gcc.communityHall.repository.UsersRepository; +import com.gcc.communityHall.service.UserService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.Date; +import java.util.List; +import java.util.Optional; + +@Service +public class UserServiceImpl implements UserService { + + @Autowired + UsersRepository usersRepository; + + @Autowired + UserHistoryRepository userHistoryRepository; + public UserServiceImpl(UsersRepository userRepo){ + this.usersRepository=userRepo; + } + + public UserServiceImpl(){ + + } + @Override + public Users user(Users user) { + System.out.println(user.getUsertype()); + if(user.getUsertype()==null || !user.getUsertype().equals(Users.userType.PUBLIC)){ + user.setUserstatus(Users.userStatus.PENDING); + } + + return usersRepository.save(user); + } + + @Override + public Users getUserById(int userId) { + Optional user= usersRepository.findById(userId); + if(user.isPresent()){ + return user.get(); + } + return null; + } + + @Override + public List getUserByStatus(Users.userStatus status) { + return usersRepository.findByUserstatus(status); + } + + @Override + public List getUserByType(Users.userType userType) { + return usersRepository.findByUsertype(userType); + } + + @Override + public Users updateUserStatus(int userId, Users.userStatus status, String comments) { + Optional user= usersRepository.findById(userId); + if(user.isPresent()){ + Users usr = user.get(); + + UserHistory userHistory = new UserHistory(); + userHistory.setUsers(usr); + userHistory.setUserstatus(status); + userHistory.setComments(comments); + userHistory.setCdate(new Date()); + userHistoryRepository.save(userHistory); + + usr.setUserstatus(status); + Users users = usersRepository.save(usr); + return users; + + + } + return null; + } +} diff --git a/src/main/java/com/gcc/communityHall/service/LoginService.java b/src/main/java/com/gcc/communityHall/service/LoginService.java new file mode 100644 index 0000000..5e8a6d0 --- /dev/null +++ b/src/main/java/com/gcc/communityHall/service/LoginService.java @@ -0,0 +1,4 @@ +package com.gcc.communityHall.service; + +public interface LoginService { +} diff --git a/src/main/java/com/gcc/communityHall/service/ReasonMasterService.java b/src/main/java/com/gcc/communityHall/service/ReasonMasterService.java new file mode 100644 index 0000000..4afcdd7 --- /dev/null +++ b/src/main/java/com/gcc/communityHall/service/ReasonMasterService.java @@ -0,0 +1,9 @@ +package com.gcc.communityHall.service; + +import com.gcc.communityHall.entity.ReasonMaster; + +public interface ReasonMasterService { + + String saveTheReason(ReasonMaster reasonMaster); + ReasonMaster getReasonById(int reasonId); +} diff --git a/src/main/java/com/gcc/communityHall/service/TransactionService.java b/src/main/java/com/gcc/communityHall/service/TransactionService.java new file mode 100644 index 0000000..134bf1f --- /dev/null +++ b/src/main/java/com/gcc/communityHall/service/TransactionService.java @@ -0,0 +1,4 @@ +package com.gcc.communityHall.service; + +public interface TransactionService { +} diff --git a/src/main/java/com/gcc/communityHall/service/UserService.java b/src/main/java/com/gcc/communityHall/service/UserService.java new file mode 100644 index 0000000..8096e7f --- /dev/null +++ b/src/main/java/com/gcc/communityHall/service/UserService.java @@ -0,0 +1,16 @@ +package com.gcc.communityHall.service; + +import com.gcc.communityHall.entity.Users; + +import java.util.List; + +public interface UserService { + + public Users user(Users user); + public Users getUserById(int userId); + public List getUserByStatus(Users.userStatus status); + public List getUserByType(Users.userType userType); + public Users updateUserStatus(int userId,Users.userStatus status,String comments); + + +} diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties new file mode 100644 index 0000000..8cc76ef --- /dev/null +++ b/src/main/resources/application.properties @@ -0,0 +1,25 @@ +spring.application.name=communityHall + +spring.datasource.url=jdbc:mysql://localhost:3306/communityhall +spring.datasource.username=root +spring.datasource.password=root +spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver +spring.jpa.hibernate.ddl-auto=update +spring.jpa.properties.hibernate.dialect= org.hibernate.dialect.MySQL8Dialect +#logging.level.org.hibernate.SQL=DEBUG +#logging.level.org.hibernate.type=TRACE +spring.jpa.properties.hibernate.format_sql=true + +spring.jpa.driverClassName= com.mysql.cj.jdbc.Driver +employee.api.url=https://erp.chennaicorporation.gov.in/pgr/external/mobileservice + +server.address=0.0.0.0 + +#fileHanding +file.upload.directory=${user.dir}/communityHallDocuments +file.hall.upload.directory=${user.dir}/communityHallDocuments/hallImages + + +file.fullpath=http://localhost:8080/ +file.hall.fullpath=http://localhost:8080/images/ +#file.fullpath=http://117.232.67.158:8067 \ No newline at end of file diff --git a/src/main/resources/paymentConfig.properties b/src/main/resources/paymentConfig.properties new file mode 100644 index 0000000..e7f9dd6 --- /dev/null +++ b/src/main/resources/paymentConfig.properties @@ -0,0 +1,7 @@ +payment.worldline.merchantId=T955031 +payment.worldline.encryptionKey=1025180466GPADTD +payment.worldline.encryptionIV=3232693456UWOWHC +payment.worldline.schemeCode=FIRST +payment.worldline.merchantName=Greater Chennai Corporation +payment.worldline.transactionSuccessCode=0300 +payment.worldline.refundSuccessCode=0400 \ No newline at end of file diff --git a/src/main/resources/templates/index.html b/src/main/resources/templates/index.html new file mode 100644 index 0000000..291ddd0 --- /dev/null +++ b/src/main/resources/templates/index.html @@ -0,0 +1,59 @@ + + + + + + Community Hall Booking + + + + + +
+
+ Loading... +
+
+ +
+

Community Hall Booking

+
+
+ + +
+
+ + +
+
+ + +
+
+ +
+
+
+ + + + + + \ No newline at end of file diff --git a/src/test/java/com/gcc/communityHall/CommunityHallApplicationTests.java b/src/test/java/com/gcc/communityHall/CommunityHallApplicationTests.java new file mode 100644 index 0000000..88bd0a7 --- /dev/null +++ b/src/test/java/com/gcc/communityHall/CommunityHallApplicationTests.java @@ -0,0 +1,13 @@ +package com.gcc.communityHall; + +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; + +@SpringBootTest +class CommunityHallApplicationTests { + + @Test + void contextLoads() { + } + +}