Commit 798038fe by neel

Initial commit

parents
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="test" value="true"/>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>
/target
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>iRecruit</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
</natures>
</projectDescription>
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry excluding="**/bower_components/*|**/node_modules/*|**/*.min.js" kind="src" path="src/main/webapp"/>
<classpathentry kind="src" path="target/m2e-wtp/web-resources"/>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.WebProject">
<attributes>
<attribute name="hide" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.baseBrowserLibrary"/>
<classpathentry kind="output" path=""/>
</classpath>
eclipse.preferences.version=1
encoding//src/main/java=UTF-8
encoding//src/main/resources=UTF-8
encoding//src/test/java=UTF-8
encoding/<project>=UTF-8
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.source=1.8
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="iRecruit-0.0.1-SNAPSHOT">
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
<property name="context-root" value="iRecruit"/>
<property name="java-output-path" value="/iRecruit/target/classes"/>
<property name="component.exclusion.patterns"/>
</wb-module>
</project-modules>
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<fixed facet="wst.jsdt.web"/>
<installed facet="java" version="1.8"/>
<installed facet="wst.jsdt.web" version="1.0"/>
<installed facet="jst.web" version="4.0"/>
</faceted-project>
org.eclipse.wst.jsdt.launching.baseBrowserLibrary
\ No newline at end of file
Window
\ No newline at end of file
disabled=06target
eclipse.preferences.version=1
# Getting Started
### Reference Documentation
For further reference, please consider the following sections:
* [Official Apache Maven documentation](https://maven.apache.org/guides/index.html)
* [Spring Boot Maven Plugin Reference Guide](https://docs.spring.io/spring-boot/docs/2.2.1.RELEASE/maven-plugin/)
* [Spring Web](https://docs.spring.io/spring-boot/docs/2.2.1.RELEASE/reference/htmlsingle/#boot-features-developing-web-applications)
* [Spring Data JPA](https://docs.spring.io/spring-boot/docs/2.2.1.RELEASE/reference/htmlsingle/#boot-features-jpa-and-spring-data)
* [Spring Security](https://docs.spring.io/spring-boot/docs/2.2.1.RELEASE/reference/htmlsingle/#boot-features-security)
### Guides
The following guides illustrate how to use some features concretely:
* [Building a RESTful Web Service](https://spring.io/guides/gs/rest-service/)
* [Serving Web Content with Spring MVC](https://spring.io/guides/gs/serving-web-content/)
* [Building REST services with Spring](https://spring.io/guides/tutorials/bookmarks/)
* [Accessing Data with JPA](https://spring.io/guides/gs/accessing-data-jpa/)
* [Securing a Web Application](https://spring.io/guides/gs/securing-web/)
* [Spring Boot and OAuth2](https://spring.io/guides/tutorials/spring-boot-oauth2/)
* [Authenticating a User with LDAP](https://spring.io/guides/gs/authenticating-ldap/)
**Edit a file, create a new file, and clone from Bitbucket in under 2 minutes**
When you're done, you can delete the content in this README and update the file with details for others getting started with your repository.
*We recommend that you open this README in another tab as you perform the tasks below. You can [watch our video](https://youtu.be/0ocf7u76WSo) for a full demo of all the steps in this tutorial. Open the video in a new tab to avoid leaving Bitbucket.*
---
## Edit a file
You’ll start by editing this README file to learn how to edit a file in Bitbucket.
1. Click **Source** on the left side.
2. Click the README.md link from the list of files.
3. Click the **Edit** button.
4. Delete the following text: *Delete this line to make a change to the README from Bitbucket.*
5. After making your change, click **Commit** and then **Commit** again in the dialog. The commit page will open and you’ll see the change you just made.
6. Go back to the **Source** page.
---
## Create a file
Next, you’ll add a new file to this repository.
1. Click the **New file** button at the top of the **Source** page.
2. Give the file a filename of **contributors.txt**.
3. Enter your name in the empty file space.
4. Click **Commit** and then **Commit** again in the dialog.
5. Go back to the **Source** page.
Before you move on, go ahead and explore the repository. You've already seen the **Source** page, but check out the **Commits**, **Branches**, and **Settings** pages.
---
## Clone a repository
Use these steps to clone from SourceTree, our client for using the repository command-line free. Cloning allows you to work on your files locally. If you don't yet have SourceTree, [download and install first](https://www.sourcetreeapp.com/). If you prefer to clone from the command line, see [Clone a repository](https://confluence.atlassian.com/x/4whODQ).
1. You’ll see the clone button under the **Source** heading. Click that button.
2. Now click **Check out in SourceTree**. You may need to create a SourceTree account or log in.
3. When you see the **Clone New** dialog in SourceTree, update the destination path and name if you’d like to and then click **Clone**.
4. Open the directory you just created to see your repository’s files.
Now that you're more familiar with your Bitbucket repository, go ahead and add a new file locally. You can [push your change back to Bitbucket with SourceTree](https://confluence.atlassian.com/x/iqyBMg), or you can [add, commit,](https://confluence.atlassian.com/x/8QhODQ) and [push from the command line](https://confluence.atlassian.com/x/NQ0zDQ).
## New SQl file for schema
1) If you get new 1.0 initial file for tenant then you have to take data(inserts) backup of all society schemas.Except table (schema_version,tbl_blocks,tbl_document_list,tbl_properties_type,tbl_roles)
2) Remove society schemas
3) start server (It will create new schemas)
4) Dump your data backup to society schemas.
## Steps to call a service with authorization (for invoice)
1. Login with the admin credentials
2. Add a column **notificationId** with datatype **varchar** in **tbl_users** table
3. Sign in with the admin user(9033882640:nirav123) in swagger-ui and follow below activities in swagger ui only
4. Authorise with the returned token like **Bearer <TOKEN>**
5. Create a society of your choice
6. Update admin tenant(for input field **id**, please see database entry in table **tenants** that is created when you registered the new society)
7. Use the response Bearer token to authorise all society related requests in swagger ui as well as in your code
8. create builder
9. add users for builder and register user.
10. create property (provide name in property type)
11. add member and owners to property and register them
12. If you login with builder/owner/member you don't need to change tenant only if user is not in multiple tenant.
13. You can use all society related service using token.
\ No newline at end of file
#!/bin/sh
# ----------------------------------------------------------------------------
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
# ----------------------------------------------------------------------------
# ----------------------------------------------------------------------------
# Maven2 Start Up Batch script
#
# Required ENV vars:
# ------------------
# JAVA_HOME - location of a JDK home dir
#
# Optional ENV vars
# -----------------
# M2_HOME - location of maven2's installed home dir
# MAVEN_OPTS - parameters passed to the Java VM when running Maven
# e.g. to debug Maven itself, use
# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
# MAVEN_SKIP_RC - flag to disable loading of mavenrc files
# ----------------------------------------------------------------------------
if [ -z "$MAVEN_SKIP_RC" ] ; then
if [ -f /etc/mavenrc ] ; then
. /etc/mavenrc
fi
if [ -f "$HOME/.mavenrc" ] ; then
. "$HOME/.mavenrc"
fi
fi
# OS specific support. $var _must_ be set to either true or false.
cygwin=false;
darwin=false;
mingw=false
case "`uname`" in
CYGWIN*) cygwin=true ;;
MINGW*) mingw=true;;
Darwin*) darwin=true
# Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
# See https://developer.apple.com/library/mac/qa/qa1170/_index.html
if [ -z "$JAVA_HOME" ]; then
if [ -x "/usr/libexec/java_home" ]; then
export JAVA_HOME="`/usr/libexec/java_home`"
else
export JAVA_HOME="/Library/Java/Home"
fi
fi
;;
esac
if [ -z "$JAVA_HOME" ] ; then
if [ -r /etc/gentoo-release ] ; then
JAVA_HOME=`java-config --jre-home`
fi
fi
if [ -z "$M2_HOME" ] ; then
## resolve links - $0 may be a link to maven's home
PRG="$0"
# need this for relative symlinks
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG="`dirname "$PRG"`/$link"
fi
done
saveddir=`pwd`
M2_HOME=`dirname "$PRG"`/..
# make it fully qualified
M2_HOME=`cd "$M2_HOME" && pwd`
cd "$saveddir"
# echo Using m2 at $M2_HOME
fi
# For Cygwin, ensure paths are in UNIX format before anything is touched
if $cygwin ; then
[ -n "$M2_HOME" ] &&
M2_HOME=`cygpath --unix "$M2_HOME"`
[ -n "$JAVA_HOME" ] &&
JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
[ -n "$CLASSPATH" ] &&
CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
fi
# For Mingw, ensure paths are in UNIX format before anything is touched
if $mingw ; then
[ -n "$M2_HOME" ] &&
M2_HOME="`(cd "$M2_HOME"; pwd)`"
[ -n "$JAVA_HOME" ] &&
JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
fi
if [ -z "$JAVA_HOME" ]; then
javaExecutable="`which javac`"
if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
# readlink(1) is not available as standard on Solaris 10.
readLink=`which readlink`
if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
if $darwin ; then
javaHome="`dirname \"$javaExecutable\"`"
javaExecutable="`cd \"$javaHome\" && pwd -P`/javac"
else
javaExecutable="`readlink -f \"$javaExecutable\"`"
fi
javaHome="`dirname \"$javaExecutable\"`"
javaHome=`expr "$javaHome" : '\(.*\)/bin'`
JAVA_HOME="$javaHome"
export JAVA_HOME
fi
fi
fi
if [ -z "$JAVACMD" ] ; then
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
else
JAVACMD="`which java`"
fi
fi
if [ ! -x "$JAVACMD" ] ; then
echo "Error: JAVA_HOME is not defined correctly." >&2
echo " We cannot execute $JAVACMD" >&2
exit 1
fi
if [ -z "$JAVA_HOME" ] ; then
echo "Warning: JAVA_HOME environment variable is not set."
fi
CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
# traverses directory structure from process work directory to filesystem root
# first directory with .mvn subdirectory is considered project base directory
find_maven_basedir() {
if [ -z "$1" ]
then
echo "Path not specified to find_maven_basedir"
return 1
fi
basedir="$1"
wdir="$1"
while [ "$wdir" != '/' ] ; do
if [ -d "$wdir"/.mvn ] ; then
basedir=$wdir
break
fi
# workaround for JBEAP-8937 (on Solaris 10/Sparc)
if [ -d "${wdir}" ]; then
wdir=`cd "$wdir/.."; pwd`
fi
# end of workaround
done
echo "${basedir}"
}
# concatenates all lines of a file
concat_lines() {
if [ -f "$1" ]; then
echo "$(tr -s '\n' ' ' < "$1")"
fi
}
BASE_DIR=`find_maven_basedir "$(pwd)"`
if [ -z "$BASE_DIR" ]; then
exit 1;
fi
##########################################################################################
# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
# This allows using the maven wrapper in projects that prohibit checking in binary data.
##########################################################################################
if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then
if [ "$MVNW_VERBOSE" = true ]; then
echo "Found .mvn/wrapper/maven-wrapper.jar"
fi
else
if [ "$MVNW_VERBOSE" = true ]; then
echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..."
fi
if [ -n "$MVNW_REPOURL" ]; then
jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.5/maven-wrapper-0.5.5.jar"
else
jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.5/maven-wrapper-0.5.5.jar"
fi
while IFS="=" read key value; do
case "$key" in (wrapperUrl) jarUrl="$value"; break ;;
esac
done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties"
if [ "$MVNW_VERBOSE" = true ]; then
echo "Downloading from: $jarUrl"
fi
wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar"
if $cygwin; then
wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"`
fi
if command -v wget > /dev/null; then
if [ "$MVNW_VERBOSE" = true ]; then
echo "Found wget ... using wget"
fi
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
wget "$jarUrl" -O "$wrapperJarPath"
else
wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath"
fi
elif command -v curl > /dev/null; then
if [ "$MVNW_VERBOSE" = true ]; then
echo "Found curl ... using curl"
fi
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
curl -o "$wrapperJarPath" "$jarUrl" -f
else
curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f
fi
else
if [ "$MVNW_VERBOSE" = true ]; then
echo "Falling back to using Java to download"
fi
javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java"
# For Cygwin, switch paths to Windows format before running javac
if $cygwin; then
javaClass=`cygpath --path --windows "$javaClass"`
fi
if [ -e "$javaClass" ]; then
if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
if [ "$MVNW_VERBOSE" = true ]; then
echo " - Compiling MavenWrapperDownloader.java ..."
fi
# Compiling the Java class
("$JAVA_HOME/bin/javac" "$javaClass")
fi
if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
# Running the downloader
if [ "$MVNW_VERBOSE" = true ]; then
echo " - Running MavenWrapperDownloader.java ..."
fi
("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR")
fi
fi
fi
fi
##########################################################################################
# End of extension
##########################################################################################
export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}
if [ "$MVNW_VERBOSE" = true ]; then
echo $MAVEN_PROJECTBASEDIR
fi
MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
# For Cygwin, switch paths to Windows format before running java
if $cygwin; then
[ -n "$M2_HOME" ] &&
M2_HOME=`cygpath --path --windows "$M2_HOME"`
[ -n "$JAVA_HOME" ] &&
JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
[ -n "$CLASSPATH" ] &&
CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
[ -n "$MAVEN_PROJECTBASEDIR" ] &&
MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
fi
# Provide a "standardized" way to retrieve the CLI args that will
# work with both Windows and non-Windows executions.
MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@"
export MAVEN_CMD_LINE_ARGS
WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
exec "$JAVACMD" \
$MAVEN_OPTS \
-classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
"-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"
@REM ----------------------------------------------------------------------------
@REM Licensed to the Apache Software Foundation (ASF) under one
@REM or more contributor license agreements. See the NOTICE file
@REM distributed with this work for additional information
@REM regarding copyright ownership. The ASF licenses this file
@REM to you under the Apache License, Version 2.0 (the
@REM "License"); you may not use this file except in compliance
@REM with the License. You may obtain a copy of the License at
@REM
@REM https://www.apache.org/licenses/LICENSE-2.0
@REM
@REM Unless required by applicable law or agreed to in writing,
@REM software distributed under the License is distributed on an
@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@REM KIND, either express or implied. See the License for the
@REM specific language governing permissions and limitations
@REM under the License.
@REM ----------------------------------------------------------------------------
@REM ----------------------------------------------------------------------------
@REM Maven2 Start Up Batch script
@REM
@REM Required ENV vars:
@REM JAVA_HOME - location of a JDK home dir
@REM
@REM Optional ENV vars
@REM M2_HOME - location of maven2's installed home dir
@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending
@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
@REM e.g. to debug Maven itself, use
@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
@REM ----------------------------------------------------------------------------
@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
@echo off
@REM set title of command window
title %0
@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on'
@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
@REM set %HOME% to equivalent of $HOME
if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
@REM Execute a user defined script before this one
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
@REM check for pre script, once with legacy .bat ending and once with .cmd ending
if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat"
if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd"
:skipRcPre
@setlocal
set ERROR_CODE=0
@REM To isolate internal variables from possible post scripts, we use another setlocal
@setlocal
@REM ==== START VALIDATION ====
if not "%JAVA_HOME%" == "" goto OkJHome
echo.
echo Error: JAVA_HOME not found in your environment. >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error
:OkJHome
if exist "%JAVA_HOME%\bin\java.exe" goto init
echo.
echo Error: JAVA_HOME is set to an invalid directory. >&2
echo JAVA_HOME = "%JAVA_HOME%" >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error
@REM ==== END VALIDATION ====
:init
@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
@REM Fallback to current working directory if not found.
set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
set EXEC_DIR=%CD%
set WDIR=%EXEC_DIR%
:findBaseDir
IF EXIST "%WDIR%"\.mvn goto baseDirFound
cd ..
IF "%WDIR%"=="%CD%" goto baseDirNotFound
set WDIR=%CD%
goto findBaseDir
:baseDirFound
set MAVEN_PROJECTBASEDIR=%WDIR%
cd "%EXEC_DIR%"
goto endDetectBaseDir
:baseDirNotFound
set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
cd "%EXEC_DIR%"
:endDetectBaseDir
IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
@setlocal EnableExtensions EnableDelayedExpansion
for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
:endReadAdditionalConfig
SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.5/maven-wrapper-0.5.5.jar"
FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B
)
@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
@REM This allows using the maven wrapper in projects that prohibit checking in binary data.
if exist %WRAPPER_JAR% (
if "%MVNW_VERBOSE%" == "true" (
echo Found %WRAPPER_JAR%
)
) else (
if not "%MVNW_REPOURL%" == "" (
SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.5/maven-wrapper-0.5.5.jar"
)
if "%MVNW_VERBOSE%" == "true" (
echo Couldn't find %WRAPPER_JAR%, downloading it ...
echo Downloading from: %DOWNLOAD_URL%
)
powershell -Command "&{"^
"$webclient = new-object System.Net.WebClient;"^
"if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
"$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
"}"^
"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^
"}"
if "%MVNW_VERBOSE%" == "true" (
echo Finished downloading %WRAPPER_JAR%
)
)
@REM End of extension
@REM Provide a "standardized" way to retrieve the CLI args that will
@REM work with both Windows and non-Windows executions.
set MAVEN_CMD_LINE_ARGS=%*
%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
if ERRORLEVEL 1 goto error
goto end
:error
set ERROR_CODE=1
:end
@endlocal & set ERROR_CODE=%ERROR_CODE%
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost
@REM check for post script, once with legacy .bat ending and once with .cmd ending
if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat"
if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd"
:skipRcPost
@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
if "%MAVEN_BATCH_PAUSE%" == "on" pause
if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%
exit /B %ERROR_CODE%
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.1.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com</groupId>
<artifactId>iRecruit</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>iRecruit</name>
<description>Demo project for Spring Boot</description>
<packaging>war</packaging>
<properties>
<!--<start-class>com.iRecruit.IRecruitApplication</start-class>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>-->
<maven.test.skip>true</maven.test.skip>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-mail</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.16.18</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc6</artifactId>
<version>11.2.0.3</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.projectlombok/lombok -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<dependency>
<groupId>com.lmax</groupId>
<artifactId>disruptor</artifactId>
<version>3.3.6</version>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt</artifactId>
<version>0.9.0</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.12</version>
</dependency>
<!-- For Java 8 Date/Time Support -->
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.9.2</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.9.2</version>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20190722</version>
</dependency>
<dependency>
<groupId>com.google.firebase</groupId>
<artifactId>firebase-admin</artifactId>
<version>6.8.1</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>5.4.12.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.0-api</artifactId>
<version>1.0.0.Final</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.imgscalr</groupId>
<artifactId>imgscalr-lib</artifactId>
<version>4.2</version>
</dependency>
<dependency>
<groupId>org.thymeleaf</groupId>
<artifactId>thymeleaf-spring4</artifactId>
<version>2.1.5.RELEASE</version>
</dependency>
<dependency>
<groupId>org.thymeleaf</groupId>
<artifactId>thymeleaf</artifactId>
<version>2.1.5.RELEASE</version>
</dependency>
<dependency>
<groupId>nz.net.ultraq.thymeleaf</groupId>
<artifactId>thymeleaf-layout-dialect</artifactId>
<version>2.1.2</version>
</dependency>
<dependency>
<groupId>org.xhtmlrenderer</groupId>
<artifactId>flying-saucer-pdf-itext5</artifactId>
<version>9.1.6</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>net.sf.jtidy</groupId>
<artifactId>jtidy</artifactId>
<version>r938</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.xhtmlrenderer</groupId>
<artifactId>flying-saucer-core</artifactId>
<version>9.1.6</version>
<scope>compile</scope>
</dependency>
</dependencies>
<repositories>
<repository>
<id>spring-releases</id>
<url>https://repo.spring.io/libs-release</url>
</repository>
<repository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>http://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>http://repo.spring.io/milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
<build>
<directory>target</directory>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<outputDirectory>spring</outputDirectory>
<skipTests>true</skipTests>
<mainClass>com.iRecruit.IRecruitApplication</mainClass>
</configuration>
</plugin>
</plugins>
</build>
</project>
\ No newline at end of file
package com.iRecruit;
import java.util.TimeZone;
import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean;
import org.springframework.data.domain.AuditorAware;
import org.springframework.data.jpa.convert.threeten.Jsr310JpaConverters;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
import org.springframework.scheduling.annotation.EnableScheduling;
import com.iRecruit.audit.SpringSecurityAuditorAware;
import com.iRecruit.constant.DBConfig;
import com.iRecruit.constant.TemplateConfig;
//@EnableAutoConfiguration(exclude = { DataSourceAutoConfiguration.class, MultipartAutoConfiguration.class })
@SpringBootApplication
@EnableCaching
@EnableJpaAuditing(auditorAwareRef = "auditorAware")
public class IRecruitApplication {
@PostConstruct
void init() {
TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
}
@Autowired
DBConfig DBConfig;
@Autowired
TemplateConfig TemplateConfig;
@Bean
public AuditorAware<String> auditorAware() {
return new SpringSecurityAuditorAware();
}
/*@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(IRecruitApplication.class);
}*/
public static void main(String[] args) {
SpringApplication.run(IRecruitApplication.class, args);
}
}
\ No newline at end of file
package com.iRecruit.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
public @interface AuditLogs {
public boolean isResponse() default true;
public boolean isRequest() default true;
public String service() default "";
}
\ No newline at end of file
package com.iRecruit.aspect;
import java.io.IOException;
import java.lang.reflect.Method;
import java.sql.Timestamp;
import java.util.Date;
import java.util.Set;
import javax.servlet.http.HttpServletRequest;
import javax.validation.ConstraintViolation;
import javax.validation.Validation;
import javax.validation.Validator;
import javax.validation.ValidatorFactory;
import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.reflect.MethodSignature;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import com.fasterxml.jackson.core.JsonEncoding;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.iRecruit.annotation.AuditLogs;
import com.iRecruit.constant.StatusCode;
import com.iRecruit.modules.auth.payload.AuditLogsDto;
import com.iRecruit.modules.auth.payload.request.ApiResponse;
import com.iRecruit.modules.auth.payload.request.LoginRequest;
import com.iRecruit.modules.auth.service.AuditLogsService;
import com.iRecruit.security.UserPrincipal;
@Aspect
@Component
public class ServiceVersionAspect {
@Autowired
AuditLogsService auditLogsService;
@Around("@annotation(com.iRecruit.annotation.AuditLogs)")
public ResponseEntity<?> auditLog(ProceedingJoinPoint joinPoint) throws Throwable {
long startTime = System.currentTimeMillis();
ResponseEntity re = null;
if(joinPoint.getArgs().length > 0) {
ValidatorFactory validatorFactory = Validation.buildDefaultValidatorFactory();
Validator validator = validatorFactory.usingContext().getValidator();
Set<ConstraintViolation<Object>> constrains = validator.validate(joinPoint.getArgs()[0]);
if(constrains.size() > 0) {
String message = "";
for (ConstraintViolation constrain : constrains) {
message += "[" + constrain.getPropertyPath() + ":" + constrain.getMessage() + "]";
}
re = new ResponseEntity(new ApiResponse(StatusCode.INVALID_ARGUMENT, true, message, null),HttpStatus.BAD_REQUEST);
}else {
re = (ResponseEntity)joinPoint.proceed();
}
}else {
re = (ResponseEntity)joinPoint.proceed();
}
long timeTaken = System.currentTimeMillis() - startTime;
ApiResponse ar = (ApiResponse)re.getBody();
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes()).getRequest();
String remoteAddr = "";
if (request != null) {
remoteAddr = request.getHeader("X-FORWARDED-FOR");
if (remoteAddr == null || "".equals(remoteAddr)) {
remoteAddr = request.getRemoteAddr();
}
}
UserPrincipal userPrincipal;
if(SecurityContextHolder.getContext().getAuthentication().getPrincipal() instanceof String) {
userPrincipal = new UserPrincipal();
try {
LoginRequest loginRequest = (LoginRequest)joinPoint.getArgs()[0];
userPrincipal.setBrowserInfo(loginRequest.getBrowserInfo());
userPrincipal.setDeviceInfo(loginRequest.getDeviceInfo());
userPrincipal.setOS(loginRequest.getOS());
userPrincipal.setUsername(loginRequest.getUsername());
}catch(Exception e) {
userPrincipal.setBrowserInfo(getClientBrowser(request));
userPrincipal.setDeviceInfo(null);
userPrincipal.setOS(getClientOS(request));
userPrincipal.setUsername("NA");
}
}else {
userPrincipal = (UserPrincipal)SecurityContextHolder.getContext().getAuthentication().getPrincipal();
}
String header = request.getHeader("Authorization");
Method method = MethodSignature.class.cast(joinPoint.getSignature()).getMethod();
if(method.isAnnotationPresent(AuditLogs.class)) {
AuditLogs name = method.getAnnotation(AuditLogs.class);
Timestamp timestamp = new Timestamp(System.currentTimeMillis());
com.iRecruit.modules.auth.model.AuditLogs auditLogs = new com.iRecruit.modules.auth.model.AuditLogs(null, name.service(), remoteAddr,
userPrincipal.getDeviceInfo(), userPrincipal.getBrowserInfo(), userPrincipal.getUsername(), userPrincipal.getOS(),
ar.getCode(), ar.getMessage(), timeTaken, joinPoint.getArgs().length>0?joinPoint.getArgs()[0].toString():null , ar.getMessage(),new Date());
AuditLogsDto auditLogsDto = new AuditLogsDto(auditLogs);
if(!name.isRequest()) {
auditLogsDto.setRequestObj(null);
}
if(!name.isResponse()) {
auditLogsDto.setResponseObj(null);
}
auditLogsService.save(auditLogsDto);
// if(name.isResponse()==false) {
// return null;
// }
// else {
// return re;
// }
}
//Annotation[] parametersAnnotations = method.getAnnotations();
return re;
}
private String getValue(Object result) {
String returnValue = null;
if (null != result) {
if (result.toString().endsWith("@" + Integer.toHexString(result.hashCode()))) {
returnValue = ReflectionToStringBuilder.toString(result);
} else {
returnValue = result.toString();
}
}
return returnValue;
}
private ObjectMapper beanToJSON(Object bean){
JsonGenerator jsonGenerator = null;
ObjectMapper objectMapper = null;
objectMapper = new ObjectMapper();
try{
jsonGenerator = objectMapper.getJsonFactory().createJsonGenerator(System.out, JsonEncoding.UTF8);
jsonGenerator.writeObject(bean);
objectMapper.writeValue(System.out, bean);
jsonGenerator.flush();
jsonGenerator.close();
}catch (IOException e) {
e.printStackTrace();
}
return objectMapper;
}
public String getReferer(HttpServletRequest request) {
final String referer = request.getHeader("referer");
return referer;
}
public String getFullURL(HttpServletRequest request) {
final StringBuffer requestURL = request.getRequestURL();
final String queryString = request.getQueryString();
final String result = queryString == null ? requestURL.toString() : requestURL.append('?')
.append(queryString)
.toString();
return result;
}
//http://stackoverflow.com/a/18030465/1845894
public String getClientIpAddr(HttpServletRequest request) {
String ip = request.getHeader("X-Forwarded-For");
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("Proxy-Client-IP");
}
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("WL-Proxy-Client-IP");
}
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("HTTP_CLIENT_IP");
}
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("HTTP_X_FORWARDED_FOR");
}
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getRemoteAddr();
}
return ip;
}
//http://stackoverflow.com/a/18030465/1845894
public String getClientOS(HttpServletRequest request) {
final String browserDetails = request.getHeader("User-Agent");
//=================OS=======================
final String lowerCaseBrowser = browserDetails.toLowerCase();
if (lowerCaseBrowser.contains("windows")) {
return "Windows";
} else if (lowerCaseBrowser.contains("mac")) {
return "Mac";
} else if (lowerCaseBrowser.contains("x11")) {
return "Unix";
} else if (lowerCaseBrowser.contains("android")) {
return "Android";
} else if (lowerCaseBrowser.contains("iphone")) {
return "IPhone";
} else {
return "UnKnown, More-Info: " + browserDetails;
}
}
//http://stackoverflow.com/a/18030465/1845894
public String getClientBrowser(HttpServletRequest request) {
final String browserDetails = request.getHeader("User-Agent");
final String user = browserDetails.toLowerCase();
String browser = "";
//===============Browser===========================
if (user.contains("msie")) {
String substring = browserDetails.substring(browserDetails.indexOf("MSIE")).split(";")[0];
browser = substring.split(" ")[0].replace("MSIE", "IE") + "-" + substring.split(" ")[1];
} else if (user.contains("safari") && user.contains("version")) {
browser = (browserDetails.substring(browserDetails.indexOf("Safari")).split(" ")[0]).split(
"/")[0] + "-" + (browserDetails.substring(
browserDetails.indexOf("Version")).split(" ")[0]).split("/")[1];
} else if (user.contains("opr") || user.contains("opera")) {
if (user.contains("opera"))
browser = (browserDetails.substring(browserDetails.indexOf("Opera")).split(" ")[0]).split(
"/")[0] + "-" + (browserDetails.substring(
browserDetails.indexOf("Version")).split(" ")[0]).split("/")[1];
else if (user.contains("opr"))
browser = ((browserDetails.substring(browserDetails.indexOf("OPR")).split(" ")[0]).replace("/",
"-")).replace(
"OPR", "Opera");
} else if (user.contains("chrome")) {
browser = (browserDetails.substring(browserDetails.indexOf("Chrome")).split(" ")[0]).replace("/", "-");
} else if ((user.indexOf("mozilla/7.0") > -1) || (user.indexOf("netscape6") != -1) || (user.indexOf(
"mozilla/4.7") != -1) || (user.indexOf("mozilla/4.78") != -1) || (user.indexOf(
"mozilla/4.08") != -1) || (user.indexOf("mozilla/3") != -1)) {
//browser=(userAgent.substring(userAgent.indexOf("MSIE")).split(" ")[0]).replace("/", "-");
browser = "Netscape-?";
} else if (user.contains("firefox")) {
browser = (browserDetails.substring(browserDetails.indexOf("Firefox")).split(" ")[0]).replace("/", "-");
} else if (user.contains("rv")) {
browser = "IE";
} else {
browser = "UnKnown, More-Info: " + browserDetails;
}
return browser;
}
public String getUserAgent(HttpServletRequest request) {
return request.getHeader("User-Agent");
}
}
package com.iRecruit.audit;
import java.util.Optional;
import org.springframework.data.domain.AuditorAware;
import org.springframework.security.authentication.AnonymousAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import com.iRecruit.security.UserPrincipal;
public class SpringSecurityAuditorAware implements AuditorAware<String> {
@Override
public Optional<String> getCurrentAuditor() {
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
if (authentication == null ||
!authentication.isAuthenticated() ||
authentication instanceof AnonymousAuthenticationToken) {
return Optional.empty();
}
UserPrincipal userPrincipal = (UserPrincipal) authentication.getPrincipal();
return Optional.ofNullable(userPrincipal.getUsername());
}
}
\ No newline at end of file
package com.iRecruit.config;
import java.util.Date;
import javax.validation.ConstraintViolationException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.support.DefaultMessageSourceResolvable;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.FieldError;
import org.springframework.validation.ObjectError;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.context.request.WebRequest;
import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler;
import com.iRecruit.modules.auth.model.AuditLogs;
import com.iRecruit.modules.auth.payload.AuditLogsDto;
import com.iRecruit.modules.auth.payload.request.ApiResponse;
import com.iRecruit.modules.auth.service.AuditLogsService;
import com.iRecruit.security.UserPrincipal;
import lombok.extern.slf4j.Slf4j;
@Slf4j
@ControllerAdvice
public class APIExceptionHandler extends ResponseEntityExceptionHandler {
/*
* private Object request;
*
* @ModelAttribute public void setRequest(@RequestBody Object request) {
* this.request = request; }
*/
@Autowired
AuditLogsService auditLogsService;
/*@Override
protected ResponseEntity handleMethodArgumentNotValid(MethodArgumentNotValidException ex, HttpHeaders headers, HttpStatus status, WebRequest request) {
log.error(ex.getMessage(), ex);
String error = "";
for(ObjectError oe : ex.getBindingResult().getAllErrors()) {
DefaultMessageSourceResolvable dmsr = null;
for(Object a : oe.getArguments()) {
if(a instanceof DefaultMessageSourceResolvable) {
dmsr = (DefaultMessageSourceResolvable)a;
break;
}
}
if(dmsr != null) {
error += dmsr.getDefaultMessage()+" = " + oe.getDefaultMessage()+",";
}else {
error += oe.getDefaultMessage()+",";
}
}
FieldError fieldError = ex.getBindingResult().getFieldError();
ApiResponse responseDTO = new ApiResponse(status.value(), true, error, null);
String remoteAddr = "";
if (headers != null) {
remoteAddr = request.getHeader("X-FORWARDED-FOR");
if (remoteAddr == null || "".equals(remoteAddr)) {
remoteAddr = request.getHeader("REMOTE_ADDR");
}
}
UserPrincipal userPrincipal = (UserPrincipal)request.getUserPrincipal();
log.info(userPrincipal.toString());
AuditLogs auditLogs = new AuditLogs(null, ex.getBindingResult().getNestedPath(), remoteAddr,
userPrincipal.getDeviceInfo(), userPrincipal.getBrowserInfo(), userPrincipal.getUsername(), userPrincipal.getOS(),
status.value(), error, 1L, "" , ex.getMessage(),new Date());
AuditLogsDto auditLogsDto = new AuditLogsDto(auditLogs);
auditLogsService.save(auditLogsDto);
return ResponseEntity.badRequest().body(responseDTO);
}*/
@ExceptionHandler(ConstraintViolationException.class)
public final ResponseEntity<Object> handleConstraintViolationException(Exception ex, WebRequest request) {
log.error(ex.getMessage(), ex);
ApiResponse responseDTO = new ApiResponse(HttpStatus.BAD_REQUEST.value(), true, ex.getMessage(), null);
return ResponseEntity.badRequest().body(responseDTO);
}
}
package com.iRecruit.config;
import java.util.HashMap;
import javax.sql.DataSource;
import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource;
public class CommonRoutingDataSource extends AbstractRoutingDataSource {
@Override
protected Object determineCurrentLookupKey() {
return DataSourceContextHolder.getDataSourceName();
}
public void initDataSources(final DataSource dataSource1, final DataSource dataSource2,
final String defaultDataSourceKey) {
final java.util.Map<Object, Object> dataSourceMap = new HashMap<Object, Object>();
dataSourceMap.put("iRecruitSchemaDataSource", dataSource1);
dataSourceMap.put("NAAFSchemaDataSource", dataSource2);
this.setDefaultTargetDataSource(dataSourceMap.get("iRecruitSchemaDataSource"));
this.setTargetDataSources(dataSourceMap);
}
}
package com.iRecruit.config;
import org.hibernate.boot.model.naming.Identifier;
import org.hibernate.boot.model.naming.PhysicalNamingStrategy;
import org.hibernate.engine.jdbc.env.spi.JdbcEnvironment;
public class CustomPhysicalNamingStrategy implements PhysicalNamingStrategy {
@Override
public Identifier toPhysicalCatalogName(final Identifier identifier, final JdbcEnvironment jdbcEnv) {
return identifier;
}
@Override
public Identifier toPhysicalColumnName(final Identifier identifier, final JdbcEnvironment jdbcEnv) {
return convertToSnakeCase(identifier);
}
@Override
public Identifier toPhysicalSchemaName(final Identifier identifier, final JdbcEnvironment jdbcEnv) {
return identifier;
}
@Override
public Identifier toPhysicalSequenceName(final Identifier identifier, final JdbcEnvironment jdbcEnv) {
return convertToSnakeCase(identifier);
}
@Override
public Identifier toPhysicalTableName(final Identifier identifier, final JdbcEnvironment jdbcEnv) {
return convertToSnakeCase(identifier);
}
private Identifier convertToSnakeCase(final Identifier identifier) {
final String regex = "([a-z])([A-Z])";
final String replacement = "$1_$2";
final String newName = identifier.getText()
.replaceAll(regex, replacement)
.toLowerCase();
return Identifier.toIdentifier(newName);
}
}
package com.iRecruit.config;
public class DataSourceContextHolder {
private static final ThreadLocal<String> contextHolder = new ThreadLocal<>();
private DataSourceContextHolder() {
// private no-op constructor
}
public static final void setDataSourceName(final String dataSourceName) {
contextHolder.set(dataSourceName);
}
public static final String getDataSourceName() {
return contextHolder.get();
}
public static final void clearDataSourceName() {
contextHolder.remove();
}
}
\ No newline at end of file
package com.iRecruit.config;
import java.util.HashMap;
import javax.persistence.EntityManagerFactory;
import javax.sql.DataSource;
import org.hibernate.cfg.AvailableSettings;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.jdbc.DataSourceBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.context.annotation.PropertySource;
import org.springframework.core.env.Environment;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.orm.jpa.JpaTransactionManager;
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.annotation.EnableTransactionManagement;
@Configuration
@PropertySource("classpath:application.properties")
@EnableTransactionManagement
@EnableJpaRepositories(
entityManagerFactoryRef = "iRecruitSchemaEntityManagerFactory",
transactionManagerRef = "iRecruitSchemaTransactionManager",
basePackages = {
"com.iRecruit.modules.auth.repository",
})
//@Resource(name="jdbc/", type=javax.sql.DataSource.class, lookup="jdbc/fileUploadDS")
public class IRecruitSchemaConfig {
@Autowired
Environment environment;
//@Value("${irecruit.datasource.jndi-name}")
//private static String JNDI_NAME;
private static final String JNDI_NAME = "jdbc/irecruit";
@Primary
@Bean(name = "iRecruitSchemaDataSource")
//@ConfigurationProperties(prefix = "irecruit.datasource")
//@Resource(name = JNDI_NAME)
public DataSource iRecruitSchemaDataSource() {
//HikariDataSource dataSource = new HikariDataSource();
DataSourceBuilder dataSourceBuilder = DataSourceBuilder.create();
dataSourceBuilder.driverClassName(environment.getProperty("irecruit.datasource.driver-class-name"));
dataSourceBuilder.url(environment.getProperty("spring.datasource.url"));
dataSourceBuilder.username(environment.getProperty("irecruit.datasource.username"));
dataSourceBuilder.password(environment.getProperty("irecruit.datasource.password"));
return dataSourceBuilder.build();
//dataSource.setDataSourceJNDI(environment.getProperty("irecruit.datasource.jndi-name"));
/*dataSource.setDriverClassName(environment.getProperty("irecruit.datasource.driver-class-name"));
dataSource.setJdbcUrl(environment.getProperty("spring.datasource.url"));
dataSource.setUsername(environment.getProperty("irecruit.datasource.username"));
dataSource.setPassword(environment.getProperty("irecruit.datasource.password"));
dataSource.setCatalog("irecruitCat");
/*dataSource.setConnectionTimeout(Long.parseLong(environment.getProperty("spring.datasource.hikari.connectionTimeout")));
dataSource.setValidationTimeout(Long.parseLong(environment.getProperty("spring.datasource.hikari.validationTimeout")));
dataSource.setMaximumPoolSize(Integer.parseInt(environment.getProperty("spring.datasource.hikari.maximumPoolSize")));
dataSource.setMaxLifetime(Long.parseLong(environment.getProperty("spring.datasource.hikari.maxLifetime")));
dataSource.setIdleTimeout(Long.parseLong(environment.getProperty("spring.datasource.hikari.idleTimeout")));
dataSource.setMinimumIdle(Integer.parseInt(environment.getProperty("spring.datasource.hikari.minimumIdle")));
return dataSource;*/
/*JndiDataSourceLookup jndiDataSourceLookup = new JndiDataSourceLookup();
jndiDataSourceLookup.setResourceRef(true);
return jndiDataSourceLookup.getDataSource(JNDI_NAME);
*/
//return DataSourceBuilder.create().build();
}
@Primary
@Bean(name = "iRecruitSchemaEntityManagerFactory")
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();
em.setDataSource(iRecruitSchemaDataSource());
em.setPersistenceUnitName("iRecruitSchema");
em.setPackagesToScan(new String[] { "com.iRecruit.modules.auth.model",
});
HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
em.setJpaVendorAdapter(vendorAdapter);
HashMap<String, Object> properties = new HashMap<>();
properties.put(AvailableSettings.HBM2DDL_AUTO, environment.getProperty("irecruit.jpa.hibernate.ddl-auto"));
properties.put(AvailableSettings.GLOBALLY_QUOTED_IDENTIFIERS, environment.getProperty("irecruit.jpa.hibernate.globally_quoted_identifiers"));
properties.put(AvailableSettings.PHYSICAL_NAMING_STRATEGY, CustomPhysicalNamingStrategy.class.getName());
em.setJpaPropertyMap(properties);
return em;
}
@Primary
@Bean(name = "iRecruitSchemaTransactionManager")
public PlatformTransactionManager iRecruitSchemaTransactionManager(
@Qualifier("iRecruitSchemaEntityManagerFactory") EntityManagerFactory iRecruitSchemaEntityManagerFactory) {
JpaTransactionManager transactionManager = new JpaTransactionManager();
transactionManager.setEntityManagerFactory(entityManagerFactory().getObject());
return transactionManager;
//return new JpaTransactionManager(iRecruitSchemaEntityManagerFactory);
}
}
\ No newline at end of file
package com.iRecruit.config;
import java.io.Serializable;
import java.util.Properties;
import org.hibernate.HibernateException;
import org.hibernate.boot.MappingException;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.id.enhanced.SequenceStyleGenerator;
import org.hibernate.internal.util.config.ConfigurationHelper;
import org.hibernate.service.ServiceRegistry;
import org.hibernate.type.LongType;
import org.hibernate.type.Type;
public class IdGenerator extends SequenceStyleGenerator {
public static final String VALUE_PREFIX_PARAMETER = "valuePrefix";
public static final String VALUE_PREFIX_DEFAULT = "";
private String valuePrefix;
public static final String NUMBER_FORMAT_PARAMETER = "numberFormat";
public static final String NUMBER_FORMAT_DEFAULT = "%d";
private String numberFormat;
@Override
public Serializable generate(SharedSessionContractImplementor session,
Object object) throws HibernateException {
return valuePrefix + String.format(numberFormat, super.generate(session, object));
}
@Override
public void configure(Type type, Properties params,
ServiceRegistry serviceRegistry) throws MappingException {
super.configure(LongType.INSTANCE, params, serviceRegistry);
valuePrefix = ConfigurationHelper.getString(VALUE_PREFIX_PARAMETER,
params, VALUE_PREFIX_DEFAULT);
numberFormat = ConfigurationHelper.getString(NUMBER_FORMAT_PARAMETER,
params, NUMBER_FORMAT_DEFAULT);
}
}
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
package com.iRecruit.config;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Predicate;
import javax.persistence.criteria.Root;
import org.springframework.data.jpa.domain.Specification;
import com.iRecruit.modules.auth.payload.request.Condition;
public class QuerySpecification {
public static Specification<?> generateQuery(List<Condition> conditions) {
return (root, query, cb) ->{
List<Predicate> predicates = getPredicate(conditions,root,query,cb);
return cb.and(predicates.toArray(new Predicate[predicates.size()]));
};
}
public static List<Condition> getConditionByKey(List<Condition> conditions,String key ) {
List<Condition> conditionArr = new ArrayList<Condition>();
for(int cnt=0;cnt<conditions.size();cnt++) {
Condition condition = conditions.get(cnt);
if(condition.getIsGroup()) {
conditionArr.addAll(getConditionByKey(condition.getGroupConditions(),key));
}else {
if(condition.getKey().equalsIgnoreCase(key)) {
conditionArr.add(condition);
}
}
}
return conditionArr;
}
public static List<Predicate> getPredicate(List<Condition> conditions,Root<?> root, CriteriaQuery<?> query, CriteriaBuilder criteriaBuilder){
List<Predicate> predicates = new ArrayList<>();
for(int cnt=0;cnt<conditions.size();cnt++) {
Condition condition = conditions.get(cnt);
if(condition.getIsGroup()) {
List<Predicate> predicatesGroup = getPredicate(condition.getGroupConditions(),root,query,criteriaBuilder);
if(condition.getGroupCondition().equalsIgnoreCase("AND")) {
predicates.add(criteriaBuilder.and(predicatesGroup.toArray(new Predicate[predicatesGroup.size()])));
}else {
predicates.add(criteriaBuilder.or(predicatesGroup.toArray(new Predicate[predicatesGroup.size()])));
}
}else {
if(condition.getCriteria().equalsIgnoreCase("like")) {
predicates.add(criteriaBuilder.like(root.get(condition.getKey()), "%" + (String)condition.getValue() + "%"));
}else if(condition.getCriteria().equalsIgnoreCase("=")) {
predicates.add(criteriaBuilder.equal(root.get(condition.getKey()),condition.getValue()));
}else if(condition.getCriteria().equalsIgnoreCase(">")) {
predicates.add(criteriaBuilder.gt(root.get(condition.getKey()),(Number)condition.getValue()));
}else if(condition.getCriteria().equalsIgnoreCase(">=")) {
predicates.add(criteriaBuilder.ge(root.get(condition.getKey()),(Number)condition.getValue()));
}else if(condition.getCriteria().equalsIgnoreCase("<")) {
predicates.add(criteriaBuilder.lt(root.get(condition.getKey()),(Number)condition.getValue()));
}else if(condition.getCriteria().equalsIgnoreCase("<=")) {
predicates.add(criteriaBuilder.le(root.get(condition.getKey()),(Number)condition.getValue()));
}else if(condition.getCriteria().equalsIgnoreCase("in")) {
predicates.add(root.get(condition.getKey()).in(condition.getValue()));
}else if(condition.getCriteria().equalsIgnoreCase("notin")) {
predicates.add(root.get(condition.getKey()).in(condition.getValue()).not());
}else if(condition.getCriteria().equalsIgnoreCase("isNull")) {
predicates.add(root.get(condition.getKey()).isNull());
}else if(condition.getCriteria().equalsIgnoreCase("isNotNull")) {
predicates.add(root.get(condition.getKey()).isNotNull());
}
}
}
return predicates;
}
}
\ No newline at end of file
package com.iRecruit.config;
import java.util.Arrays;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.authentication.AuthenticationProvider;
import org.springframework.security.authentication.ProviderManager;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.config.http.SessionCreationPolicy;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
import com.iRecruit.security.AuthProvider;
import com.iRecruit.security.CustomUserDetailsService;
import com.iRecruit.security.JwtAuthenticationEntryPoint;
import com.iRecruit.security.JwtAuthenticationFilter;
@Configuration
@EnableWebSecurity
@EnableGlobalMethodSecurity(
securedEnabled = true,
jsr250Enabled = true,
prePostEnabled = true
)
public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Autowired
CustomUserDetailsService customUserDetailsService;
@Autowired
private JwtAuthenticationEntryPoint unauthorizedHandler;
@Bean
public JwtAuthenticationFilter jwtAuthenticationFilter() {
return new JwtAuthenticationFilter();
}
public SecurityConfig() {
super(false);
}
@Override
public void configure(AuthenticationManagerBuilder authenticationManagerBuilder) throws Exception {
authenticationManagerBuilder
.userDetailsService(customUserDetailsService)
.passwordEncoder(passwordEncoder());
}
@Override
protected AuthenticationManager authenticationManager() throws Exception {
return new ProviderManager(Arrays.asList((AuthenticationProvider) new AuthProvider()));
}
@Bean
public PasswordEncoder passwordEncoder() {
return new BCryptPasswordEncoder();
}
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.cors()
.and()
.csrf()
.disable()
.exceptionHandling()
.authenticationEntryPoint(unauthorizedHandler)
.and()
.sessionManagement()
.sessionCreationPolicy(SessionCreationPolicy.STATELESS)
.and()
.authorizeRequests()
.antMatchers("/",
"/favicon.ico",
"/**/*.png",
"/**/*.gif",
"/**/*.svg",
"/**/*.jpg",
"/**/*.html",
"/**/*.css",
"/**/*.js")
.permitAll()
.antMatchers("/api/v1/configurations/**","/api/v1/auth/signin/**","/api/v1/msamapping/**","/api/v1/mdbmapping/**","/api/v1/l1salbsmapping/**","/api/v1/ngpatongplCalculation/**","/api/v1/ngpaCalculation/**","/api/v1/l2salbsmapping/**","/api/v1/mpbmapping/**","/api/v1/leaderCalculation/**","/api/v1/fycmapping/**","/api/v1/auth/P100Login","/api/v1/auth/SendOTP","/v2/api-docs","/api/v1/auth/ValidateOTP", "/configuration/ui", "/swagger-resources/**", "/configuration/security", "/swagger-ui.html", "/webjars/**")
.permitAll()
.antMatchers("/api/userPhoto", "/api/user/checkEmailAvailability")
.permitAll()
//.antMatchers("/api/users/**")
// .permitAll()
.anyRequest()
.authenticated();
// Add our custom JWT security filter
http.addFilterBefore(jwtAuthenticationFilter(), UsernamePasswordAuthenticationFilter.class);
}
}
\ No newline at end of file
package com.iRecruit.config;
import static springfox.documentation.builders.PathSelectors.regex;
import java.util.Collections;
import java.util.List;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import com.google.common.collect.Lists;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.ApiKey;
import springfox.documentation.service.AuthorizationScope;
import springfox.documentation.service.Contact;
import springfox.documentation.service.SecurityReference;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spi.service.contexts.SecurityContext;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
@Configuration
@EnableSwagger2
public class SwaggerConfig {
@Bean
public Docket productApi() {
return new Docket(DocumentationType.SWAGGER_2).select()
.apis(RequestHandlerSelectors.basePackage("com.iRecruit")).paths(regex("/api.*"))
.build().apiInfo(apiInfo()).securitySchemes(Lists.newArrayList(apiKey()))
.securityContexts(Lists.newArrayList(securityContext()));
}
private ApiKey apiKey() {
return new ApiKey("JWT", "Authorization", "header");
}
private SecurityContext securityContext() {
return SecurityContext.builder().securityReferences(defaultAuth()).forPaths(PathSelectors.regex("/api/.*"))
.build();
}
List<SecurityReference> defaultAuth() {
AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything");
AuthorizationScope[] authorizationScopes = new AuthorizationScope[1];
authorizationScopes[0] = authorizationScope;
return Lists.newArrayList(new SecurityReference("JWT", authorizationScopes));
}
private ApiInfo apiInfo() {
return new ApiInfo("Tata AIA IRecruit Rest API", "IRecruit Rest API.", "API TOS", "Terms of service",
new Contact("ADMIN", "http://test.tech", "info@test.tech"), "License of API", "API license URL",
Collections.emptyList());
}
}
\ No newline at end of file
package com.iRecruit.config;
import java.net.URI;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.Random;
import javax.servlet.http.HttpServletRequest;
import org.json.JSONObject;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.web.client.HttpStatusCodeException;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.util.UriComponentsBuilder;
public class Utility {
public static String generatorOTP(int length)
{
Random obj = new Random();
String OTP = "";
for (int i=0; i<length; i++)
{
OTP += (char)(obj.nextInt(10)+48);
}
return OTP;
}
public static ResponseEntity proxyPostRequest(String body,HttpServletRequest request,JSONObject newHeaders) throws Exception{
String requestUrl = request.getRequestURI();
//System.out.println(request.getServerName()+" "+request.getLocalAddr());
URI uri = new URI("http", null, request.getServerName(), request.getServerPort(), null, null, null);
uri = UriComponentsBuilder.fromUri(uri)
.path(requestUrl)
.query(request.getQueryString())
.build(true).toUri();
HttpHeaders headers = new HttpHeaders();
Enumeration<String> headerNames = request.getHeaderNames();
while (headerNames.hasMoreElements()) {
String headerName = headerNames.nextElement();
if(newHeaders.has(headerName)) {
headers.set(headerName,(String)newHeaders.get(headerName));
newHeaders.remove(headerName);
}else {
headers.set(headerName, request.getHeader(headerName));
}
}
Iterator<String> keys = newHeaders.keys();
while(keys.hasNext()) {
String key = keys.next();
headers.set(key, (String)newHeaders.get(key));
}
HttpEntity<String> httpEntity = new HttpEntity<>(body, headers);
RestTemplate restTemplate = new RestTemplate();
try {
return restTemplate.exchange(uri,HttpMethod.valueOf(request.getMethod()), httpEntity, String.class);
} catch(HttpStatusCodeException e) {
return ResponseEntity.status(e.getRawStatusCode())
.headers(e.getResponseHeaders())
.body(e.getResponseBodyAsString());
}
}
}
package com.iRecruit.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {
private final long MAX_AGE_SECS = 3600;
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**")
.allowedOrigins("*")
.allowedMethods("HEAD", "OPTIONS", "GET", "POST", "PUT", "PATCH", "DELETE")
.maxAge(MAX_AGE_SECS);
}
/*
@Autowired
TenantInterceptor tenantInterceptor;
@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(tenantInterceptor);
}*/
}
package com.iRecruit.constant;
public enum BooleanType {
Y,N
}
\ No newline at end of file
package com.iRecruit.constant;
import java.util.List;
import javax.annotation.PostConstruct;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.iRecruit.modules.auth.model.Configurations;
import com.iRecruit.modules.auth.service.ConfigurationsService;
import groovy.util.logging.Log;
@Service
public class DBConfig {
private static JSONObject configs;
private static final Logger LOG = LoggerFactory.getLogger(DBConfig.class);
@Autowired
ConfigurationsService configurationsService;
@PostConstruct
public void init() {
refreshConfig();
}
public void refreshConfig() {
List<Configurations> configurations = configurationsService.findAll();
configs = new JSONObject();
for(Configurations configuration : configurations) {
System.out.println("configurations");
System.out.println(configurations);
configs.put(configuration.getConfig(), configuration.getValue());
System.out.println("configs");
System.out.println(configs);
}
}
public String getValue(String key) {
System.out.println(configs);
return configs.getString(key);
}
public void setValue(String key,String value) {
if(configs.has(key)) {
configs.put(key,value);
}
}
}
\ No newline at end of file
package com.iRecruit.constant;
public class GlobalConstants {
public static final int ROLE_USER = 1;
public static final int ROLE_ADMIN = 2;
public static final String ROLE_ADMIN_STR = "Admin";
public static final int Mobile = 1;
public static final int Mail = 2;
public static final int MobileAndMail = 3;
public static final int OTPFailed = 4;
public static final int OTPSuccess = 5;
}
package com.iRecruit.constant;
import java.util.List;
import javax.annotation.PostConstruct;
import org.json.JSONArray;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.iRecruit.modules.auth.model.FycMapping;
import com.iRecruit.modules.auth.model.L1slabsMapping;
import com.iRecruit.modules.auth.model.L2slabsMapping;
import com.iRecruit.modules.auth.model.MDBMapping;
import com.iRecruit.modules.auth.model.MpbMapping;
import com.iRecruit.modules.auth.model.MsaMapping;
import com.iRecruit.modules.auth.model.Templates;
import com.iRecruit.modules.auth.service.FycMappingService;
import com.iRecruit.modules.auth.service.L1slabsMappingService;
import com.iRecruit.modules.auth.service.L2slabsMappingService;
import com.iRecruit.modules.auth.service.MDBMappingService;
import com.iRecruit.modules.auth.service.MpbMappingService;
import com.iRecruit.modules.auth.service.MsaMappingService;
import com.iRecruit.modules.auth.service.TemplatesService;
@Service
public class LeaderCalcConfig {
private static JSONObject LeaderMpbMappingJSon;
private static JSONArray jarray;
private static JSONArray jarraympbconfig;
private static JSONArray jarrayfycconfig;
private static JSONArray jarrayl1slabsconfig;
private static JSONArray jarrayl2slabsconfig;
private static JSONObject LeaderFycMapping;
private static JSONObject LeaderL1SlabsMapping;
private static JSONObject LeaderL2SlabsMapping;
private static JSONArray jarrayfyc;
private static JSONArray jarrayMsa;
private static JSONObject LeaderMdbMapping;
private static JSONObject LeaderMsaMapping;
private static JSONArray jarrayl1slabs;
private static JSONArray jarrayMdbslabs;
private static JSONArray jarrayl2slabs;
private static JSONArray jarrayMDBconfig;
private static final Logger LOG = LoggerFactory.getLogger(LeaderCalcConfig.class);
@Autowired
MpbMappingService mpbMappingService;
@Autowired
FycMappingService fycMappingService;
@Autowired
L1slabsMappingService l1slabsMappingService;
@Autowired
L2slabsMappingService l2slabsMappingService;
@Autowired
MDBMappingService mdbMappingService;
@Autowired
MsaMappingService msaMappingService;
@PostConstruct
public void init() {
refreshConfig();
}
public void refreshConfig() {
List<MpbMapping> templatesmpb = mpbMappingService.findAll();
List<FycMapping> templatesfyc = fycMappingService.findAll();
List<L1slabsMapping> templatesl1slabs = l1slabsMappingService.findAll();
List<L2slabsMapping> templatesl2slabs = l2slabsMappingService.findAll();
List<MDBMapping> templatesmdb = mdbMappingService.findAll();
List<MsaMapping> templatesmsa = msaMappingService.findAll();
LeaderMpbMappingJSon = new JSONObject();
LeaderFycMapping = new JSONObject();
LeaderL1SlabsMapping = new JSONObject();
LeaderL2SlabsMapping = new JSONObject();
LeaderMdbMapping = new JSONObject();
LeaderMsaMapping = new JSONObject();
for (MpbMapping mpbMapping : templatesmpb) {
jarray = new JSONArray(templatesmpb);
}
for (FycMapping fycMapping : templatesfyc) {
jarrayfyc = new JSONArray(templatesfyc);
}
for (L1slabsMapping l1slabsMapping : templatesl1slabs) {
jarrayl1slabs = new JSONArray(templatesl1slabs);
}
for (L2slabsMapping l2slabsMapping : templatesl2slabs) {
jarrayl2slabs = new JSONArray(templatesl2slabs);
}
for (MDBMapping mdbMapping : templatesmdb) {
jarrayMdbslabs = new JSONArray(templatesmdb);
}
for (MsaMapping msaMapping : templatesmsa) {
jarrayMsa = new JSONArray(templatesmsa);
}
System.out.println("jarrayMsa");
System.out.println(jarrayMsa);
LeaderMpbMappingJSon.put("LeaderMpbMapping", jarray);
LeaderFycMapping.put("LeaderFycMapping", jarrayfyc);
LeaderL1SlabsMapping.put("LeaderL1SlabsMapping", jarrayl1slabs);
LeaderL2SlabsMapping.put("LeaderL2SlabsMapping", jarrayl2slabs);
LeaderMdbMapping.put("MPBMapping", jarrayMdbslabs);
jarraympbconfig = new JSONArray();
jarrayfycconfig = new JSONArray();
jarrayl1slabsconfig = new JSONArray();
jarrayl2slabsconfig = new JSONArray();
jarrayMDBconfig = new JSONArray();
jarraympbconfig = LeaderMpbMappingJSon.getJSONArray("LeaderMpbMapping");
jarrayfycconfig = LeaderFycMapping.getJSONArray("LeaderFycMapping");
jarrayl1slabsconfig = LeaderL1SlabsMapping.getJSONArray("LeaderL1SlabsMapping");
jarrayl2slabsconfig = LeaderL2SlabsMapping.getJSONArray("LeaderL2SlabsMapping");
jarrayMDBconfig = LeaderMdbMapping.getJSONArray("MPBMapping");
System.out.println(jarraympbconfig);
System.out.println(jarrayfycconfig);
System.out.println(jarrayl1slabsconfig);
System.out.println(jarrayMDBconfig);
}
public JSONArray getValue(String key) {
if (key.equalsIgnoreCase("mpb")) {
return jarraympbconfig;
} else if (key.equalsIgnoreCase("fyc")) {
return jarrayfycconfig;
}
else if (key.equalsIgnoreCase("l1slabs")) {
return jarrayl1slabsconfig;
}
else if (key.equalsIgnoreCase("l2slabs")) {
return jarrayl2slabsconfig;
}
else if (key.equalsIgnoreCase("mdb")) {
return jarrayMDBconfig;
}
else if (key.equalsIgnoreCase("msa")) {
return jarrayMsa;
}else {
return null;
}
}
}
package com.iRecruit.constant;
public enum PaymentMode {
CREDIT,DEBIT,DISCOUNT
}
\ No newline at end of file
package com.iRecruit.constant;
public enum PaymentType {
CASH,CHECK,ONLINE,PAYTM,PHONEPAY,DD
}
\ No newline at end of file
package com.iRecruit.constant;
public enum PenaltyType {
FixedAmount,FixedRate
}
\ No newline at end of file
package com.iRecruit.constant;
public enum QuestionType {
RADIO,CHECKBOX,TEXT,DROPDOWN
}
\ No newline at end of file
package com.iRecruit.constant;
public enum RequestType {
BOOKING,MEETING,PROBLEM,GENERAL
}
\ No newline at end of file
package com.iRecruit.constant;
public enum RolesConstant {
LEADER,PANALIST,FINAL_INTERVIEWER,REMO,BRANCH_MANAGER
}
\ No newline at end of file
package com.iRecruit.constant;
public enum SchedulerType {
HOURLY,DAILY,WEEKLY,MONTHLY,YEARLY,ONETIME
}
\ No newline at end of file
package com.iRecruit.constant;
public enum Stages {
TBC,LIP,LPEDP,LCDP,LFDP,LEDP,LPRDP,LADP,LDUP,LP100P,LPTP,LPP,LDOPSP,PAIP,PAIW,FIIP,FIIW,REDP,URNP,TRAINP,EXAMP,AGP,LREJ,RREJ,PAREJ,FIREJ,BMREJ,CPP
}
\ No newline at end of file
package com.iRecruit.constant;
public enum Status {
INIT,LOCK,DISABLED,ACTIVE,INACTIVE,DELETED,SENT,SUCCESS
}
\ No newline at end of file
package com.iRecruit.constant;
public class StatusCode {
public static final int INVALID_USER = 100;
public static final int INVALID_CREDENTIAL = 101;
public static final int RESOURCE_NOT_FOUND = 102;
public static final int RESOURCE_EXIST = 103;
public static final int INVALID_ARGUMENT = 104;
public static final int UNEXPECTED_ERROR = 105;
public static final int DEPENDANCY_EXIST = 106;
public static final int VOTING_NOT_STARTED = 107;
public static final int INVALID_ARGUMENT1 = 103;
public static final int INVALID_ARGUMENT11 = 103;
}
\ No newline at end of file
package com.iRecruit.constant;
import java.util.List;
import javax.annotation.PostConstruct;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.iRecruit.modules.auth.model.Templates;
import com.iRecruit.modules.auth.service.TemplatesService;
@Service
public class TemplateConfig {
private static JSONObject configs;
private static final Logger LOG = LoggerFactory.getLogger(TemplateConfig.class);
@Autowired
TemplatesService templatesService;
@PostConstruct
public void init() {
refreshConfig();
}
public void refreshConfig() {
List<Templates> templates = templatesService.findAll();
configs = new JSONObject();
for(Templates configuration : templates) {
configs.put(configuration.getConfig(), configuration.getValue());
}
}
public String getValue(String key) {
return configs.getString(key);
}
public void setValue(String key,String value) {
if(configs.has(key)) {
configs.put(key,value);
}
}
}
\ No newline at end of file
package com.iRecruit.constant;
public enum TemplateType {
MAIL,PDF,SMS,NOTIFICATION
}
\ No newline at end of file
package com.iRecruit.constant;
public enum VehicalType {
CAR,BYKE,SCOOTER,BYCYCLE
}
\ No newline at end of file
package com.iRecruit.exception;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
public class AppException extends RuntimeException {
public AppException(String message) {
super(message);
}
public AppException(String message, Throwable cause) {
super(message, cause);
}
}
package com.iRecruit.exception;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;
@ResponseStatus(HttpStatus.NOT_FOUND)
public class FileNotFoundException extends RuntimeException {
private static final long serialVersionUID = 1L;
public FileNotFoundException(String message) {
super(message);
}
public FileNotFoundException(String message, Throwable cause) {
super(message, cause);
}
}
\ No newline at end of file
package com.iRecruit.exception;
public class FileStorageException extends RuntimeException {
private static final long serialVersionUID = 1L;
public FileStorageException(String message) {
super(message);
}
public FileStorageException(String message, Throwable cause) {
super(message, cause);
}
}
\ No newline at end of file
package com.iRecruit.exception;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;
import lombok.Getter;
import lombok.Setter;
@ResponseStatus(value = HttpStatus.NOT_FOUND)
@Getter
@Setter
public class InvalidArgument extends RuntimeException {
private String message;
public InvalidArgument( String message) {
super(String.format("%s",message));
this.message = message;
}
}
\ No newline at end of file
package com.iRecruit.exception;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;
@ResponseStatus(value = HttpStatus.NOT_FOUND)
public class InvalidOTPOrRef extends RuntimeException {
private String userID;
private String OTP;
public InvalidOTPOrRef( String userId, String OTP) {
super(String.format("%s is not valid OTP for %s", OTP, userId));
this.userID = userId;
this.OTP = OTP;
}
}
\ No newline at end of file
package com.iRecruit.exception;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;
@ResponseStatus(value = HttpStatus.NOT_FOUND)
public class OTPExpire extends RuntimeException {
private String userID;
private String OTP;
public OTPExpire( String userId, String OTP) {
super(String.format("%s OTP is expire for %s", OTP, userId));
this.userID = userId;
this.OTP = OTP;
}
}
\ No newline at end of file
package com.iRecruit.exception;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
public class ResourceAlreadyExist extends RuntimeException {
private String resourceName;
private String fieldName;
private Object fieldValue;
public ResourceAlreadyExist( String resourceName, String fieldName, Object fieldValue) {
super(String.format("%s not found with %s : '%s'", resourceName, fieldName, fieldValue));
this.resourceName = resourceName;
this.fieldName = fieldName;
this.fieldValue = fieldValue;
}
public String getResourceName() {
return resourceName;
}
public String getFieldName() {
return fieldName;
}
public Object getFieldValue() {
return fieldValue;
}
}
package com.iRecruit.exception;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;
@ResponseStatus(value = HttpStatus.NOT_FOUND)
public class ResourceNotFoundException extends RuntimeException {
private String resourceName;
private String fieldName;
private Object fieldValue;
public ResourceNotFoundException( String resourceName, String fieldName, Object fieldValue) {
super(String.format("%s not found with %s : '%s'", resourceName, fieldName, fieldValue));
this.resourceName = resourceName;
this.fieldName = fieldName;
this.fieldValue = fieldValue;
}
public String getResourceName() {
return resourceName;
}
public String getFieldName() {
return fieldName;
}
public Object getFieldValue() {
return fieldValue;
}
}
\ No newline at end of file
package com.iRecruit.exception;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;
@ResponseStatus(HttpStatus.NOT_FOUND)
public class TenantNotSelectedException extends RuntimeException {
private static final long serialVersionUID = 1L;
public TenantNotSelectedException(String message) {
super(message);
}
public TenantNotSelectedException(String message, Throwable cause) {
super(message, cause);
}
}
\ No newline at end of file
package com.iRecruit.exception;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;
@ResponseStatus(value = HttpStatus.UNAUTHORIZED)
public class WrongUsernamePassword extends RuntimeException {
private String resourceName;
private String fieldName;
private Object fieldValue;
public WrongUsernamePassword( String resourceName, String fieldName, Object fieldValue) {
super(String.format("%s not found with %s : '%s'", resourceName, fieldName, fieldValue));
this.resourceName = resourceName;
this.fieldName = fieldName;
this.fieldValue = fieldValue;
}
public String getResourceName() {
return resourceName;
}
public String getFieldName() {
return fieldName;
}
public Object getFieldValue() {
return fieldValue;
}
}
\ No newline at end of file
package com.iRecruit.firebase;
import java.io.IOException;
import javax.annotation.PostConstruct;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.ClassPathResource;
import org.springframework.stereotype.Service;
import com.google.auth.oauth2.GoogleCredentials;
import com.google.firebase.FirebaseApp;
import com.google.firebase.FirebaseOptions;
@Service
public class FCMInitializer {
@Value("${app.firebase-configuration-file}")
private String firebaseConfigPath;
Logger logger = LoggerFactory.getLogger(FCMInitializer.class);
@PostConstruct
public void initialize() {
try {
FirebaseOptions options = new FirebaseOptions.Builder()
.setCredentials(GoogleCredentials.fromStream(new ClassPathResource(firebaseConfigPath).getInputStream())).build();
if (FirebaseApp.getApps().isEmpty()) {
FirebaseApp.initializeApp(options);
logger.info("Firebase application has been initialized");
}
} catch (IOException e) {
logger.error(e.getMessage());
}
}
}
package com.iRecruit.firebase;
import java.time.Duration;
import java.util.Map;
import java.util.concurrent.ExecutionException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import com.google.firebase.messaging.AndroidConfig;
import com.google.firebase.messaging.AndroidNotification;
import com.google.firebase.messaging.ApnsConfig;
import com.google.firebase.messaging.Aps;
import com.google.firebase.messaging.FirebaseMessaging;
import com.google.firebase.messaging.Message;
import com.google.firebase.messaging.Notification;
import com.iRecruit.modules.auth.model.PushNotificationRequest;
@Service
public class FCMService {
private Logger logger = LoggerFactory.getLogger(FCMService.class);
public void sendMessage(Map<String, String> data, PushNotificationRequest request)
throws InterruptedException, ExecutionException {
Message message = getPreconfiguredMessageWithData(data, request);
String response = sendAndGetResponse(message);
logger.info("Sent message with data. Topic: " + request.getTopic() + ", " + response);
}
public void sendMessageWithoutData(PushNotificationRequest request)
throws InterruptedException, ExecutionException {
Message message = getPreconfiguredMessageWithoutData(request);
String response = sendAndGetResponse(message);
logger.info("Sent message without data. Topic: " + request.getTopic() + ", " + response);
}
public void sendMessageToToken(PushNotificationRequest request)
throws InterruptedException, ExecutionException {
Message message = getPreconfiguredMessageToToken(request);
String response = sendAndGetResponse(message);
logger.info("Sent message to token. Device token: " + request.getToken() + ", " + response);
}
private String sendAndGetResponse(Message message) throws InterruptedException, ExecutionException {
return FirebaseMessaging.getInstance().sendAsync(message).get();
}
private AndroidConfig getAndroidConfig(String topic) {
return AndroidConfig.builder()
.setTtl(Duration.ofMinutes(2).toMillis()).setCollapseKey(topic)
.setPriority(AndroidConfig.Priority.HIGH)
.setNotification(AndroidNotification.builder().setSound(NotificationParameter.SOUND.getValue())
.setColor(NotificationParameter.COLOR.getValue()).setTag(topic).build()).build();
}
private ApnsConfig getApnsConfig(String topic) {
return ApnsConfig.builder()
.setAps(Aps.builder().setCategory(topic).setThreadId(topic).build()).build();
}
private Message getPreconfiguredMessageToToken(PushNotificationRequest request) {
return getPreconfiguredMessageBuilder(request).setToken(request.getToken())
.build();
}
private Message getPreconfiguredMessageWithoutData(PushNotificationRequest request) {
return getPreconfiguredMessageBuilder(request).setTopic(request.getTopic())
.build();
}
private Message getPreconfiguredMessageWithData(Map<String, String> data, PushNotificationRequest request) {
return getPreconfiguredMessageBuilder(request).putAllData(data).setTopic(request.getTopic())
.build();
}
private Message.Builder getPreconfiguredMessageBuilder(PushNotificationRequest request) {
AndroidConfig androidConfig = getAndroidConfig(request.getTopic());
ApnsConfig apnsConfig = getApnsConfig(request.getTopic());
return Message.builder()
.setApnsConfig(apnsConfig).setAndroidConfig(androidConfig).setNotification(
new Notification(request.getTitle(), request.getMessage()));
}
}
package com.iRecruit.firebase;
public enum NotificationParameter {
SOUND("default"),
COLOR("#FFFF00");
private String value;
NotificationParameter(String value) {
this.value = value;
}
public String getValue() {
return this.value;
}
}
package com.iRecruit.modules.auth.controller;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.json.JSONException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.authentication.BadCredentialsException;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.iRecruit.annotation.AuditLogs;
import com.iRecruit.constant.StatusCode;
import com.iRecruit.exception.ResourceNotFoundException;
import com.iRecruit.modules.auth.model.User;
import com.iRecruit.modules.auth.payload.P100LoginResponse;
import com.iRecruit.modules.auth.payload.UserDto;
import com.iRecruit.modules.auth.payload.UserOTPDto;
import com.iRecruit.modules.auth.payload.request.ApiResponse;
import com.iRecruit.modules.auth.payload.request.JwtAuthenticationResponse;
import com.iRecruit.modules.auth.payload.request.LoginRequest;
import com.iRecruit.modules.auth.payload.request.OTPRequest;
import com.iRecruit.modules.auth.payload.request.OTPValidateRequest;
import com.iRecruit.modules.auth.payload.request.P100LoginRequest;
import com.iRecruit.modules.auth.service.UserService;
import com.iRecruit.security.AuthProvider;
import com.iRecruit.security.JwtTokenProvider;
import com.iRecruit.security.UserPrincipal;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@RestController
@RequestMapping("/api/v1/auth")
@Api(description = "Set of endpoints for Creating, Retrieving, Updating and Deleting of Persons.")
public class AuthController {
@Autowired
AuthProvider authenticationManager;
@Autowired
UserService userService;
@Autowired
JwtTokenProvider tokenProvider;
private static final Logger LOG = LoggerFactory.getLogger(AuthController.class);
@PostMapping("/signin")
@ApiOperation("Sign-in user by userid and password")
@AuditLogs(service="login",isResponse=true)
public ResponseEntity<ApiResponse> authenticateUser (@RequestBody LoginRequest loginRequest,
HttpServletRequest request, HttpServletResponse response) {
//DataSourceContextHolder.setDataSourceName("iRecruitSchemaDataSource");
Map<String, Object> returnUserObject = new HashMap<>();
String jwt;
try {
UsernamePasswordAuthenticationToken authenticationObj = new UsernamePasswordAuthenticationToken(loginRequest.getUsername(), loginRequest.getPassword());
authenticationObj.setDetails(loginRequest);
Authentication authentication = authenticationManager.authenticate(authenticationObj);
SecurityContextHolder.getContext().setAuthentication(authentication);
//if (authentication.getAuthorities().stream().anyMatch(r -> r.getAuthority().equals(loginRequest.getRoleType()))) {
jwt = tokenProvider.generateToken(authentication);
UserPrincipal userPrincipal = (UserPrincipal) authentication.getPrincipal();
User user = userService.findById(userPrincipal.getUsername());
if(loginRequest.getNotificationId() != null) {
user.setNotificationId(loginRequest.getNotificationId());
userService.save(user);
}
returnUserObject.put("userDetail", new UserDto(user));
returnUserObject.put("tokenDetail", new JwtAuthenticationResponse(jwt));
LOG.info("Login Success");
return new ResponseEntity(new ApiResponse(HttpStatus.OK.value(), true, "LOGIN_SUCCESS", returnUserObject), HttpStatus.OK);
} catch (ResourceNotFoundException e) {
//LOG.error("Exception while Json processing: ", e);
return new ResponseEntity(new ApiResponse(StatusCode.RESOURCE_NOT_FOUND, true, "Tenant not found", null), HttpStatus.UNAUTHORIZED);
} catch (UsernameNotFoundException e) {
//LOG.error("Exception while Json processing: ", e);
return new ResponseEntity(new ApiResponse(StatusCode.RESOURCE_NOT_FOUND, true, "Username not found", null), HttpStatus.UNAUTHORIZED);
}catch (BadCredentialsException e) {
LOG.error("Wrong password: ");
return new ResponseEntity(new ApiResponse(StatusCode.INVALID_CREDENTIAL, true, "Wrong username or password", null), HttpStatus.UNAUTHORIZED);
}catch (JSONException e) {
System.out.println(e);
LOG.error("Exception while Json processing: ", e);
return new ResponseEntity(new ApiResponse(StatusCode.UNEXPECTED_ERROR, true, "JSON_PROCESSING_EXCEPTION", null), HttpStatus.UNAUTHORIZED);
}catch (Exception e) {
System.out.println(e);
LOG.error("Exception while Json processing: ", e);
return new ResponseEntity(new ApiResponse(StatusCode.UNEXPECTED_ERROR, true, "JSON_PROCESSING_EXCEPTION", null), HttpStatus.UNAUTHORIZED);
}
}
/*
* @PostMapping("/P100Login")
*
* @ApiOperation("P100 Login")
*
* @AuditLogs(isRequest = true, isResponse = true, service = "P100Login") public
* ResponseEntity<?> P100Login(@RequestBody P100LoginRequest p100LoginRequest) {
* try { P100LoginResponse p100LoginResponse =
* p100LoginService.p100Login(p100LoginRequest); return new ResponseEntity(new
* ApiResponse(HttpStatus.OK.value(), true, "P100 Login",
* p100LoginResponse),HttpStatus.OK); }catch (Exception e) { return new
* ResponseEntity(new ApiResponse(StatusCode.UNEXPECTED_ERROR,
* true,"Error in P100 Login", null), HttpStatus.UNAUTHORIZED); } }
*/
/*@PostMapping("/SendOTP")
@ApiOperation("Send OTP")
@AuditLogs(isRequest = true, isResponse = true, service = "SendOTP")
public ResponseEntity<?> sendOTP(@RequestBody OTPRequest otpRequest) {
try {
UserOTPDto userOTPDto = userOTPService.create(otpRequest.getLeadId(),otpRequest.getMobileNo(),otpRequest.getEmailId(),otpRequest.getServiceName() );
return new ResponseEntity(new ApiResponse(HttpStatus.OK.value(), true, "P100 Login", userOTPDto),HttpStatus.OK);
}catch (Exception e) {
return new ResponseEntity(new ApiResponse(StatusCode.UNEXPECTED_ERROR, true,"Error while OTP sending", null), HttpStatus.UNAUTHORIZED);
}
}
@PostMapping("/ValidateOTP")
@ApiOperation("Validate OTP")
@AuditLogs(isRequest = true, isResponse = true, service = "ValidateOTP")
public ResponseEntity<?> validateOTP(@RequestBody OTPValidateRequest otpValidateRequest) {
try {
UserOTPDto userOTPDto = userOTPService.validateOTP(otpValidateRequest.getId(),otpValidateRequest.getLeadId(),otpValidateRequest.getOtp() );
return new ResponseEntity(new ApiResponse(HttpStatus.OK.value(), true, "P100 Login", userOTPDto),HttpStatus.OK);
}catch (Exception e) {
return new ResponseEntity(new ApiResponse(StatusCode.UNEXPECTED_ERROR, true,"Error while OTP sending", null), HttpStatus.UNAUTHORIZED);
}
}*/
}
package com.iRecruit.modules.auth.controller;
import javax.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.iRecruit.annotation.AuditLogs;
import com.iRecruit.constant.DBConfig;
import com.iRecruit.constant.StatusCode;
import com.iRecruit.exception.ResourceNotFoundException;
import com.iRecruit.modules.auth.model.Configurations;
import com.iRecruit.modules.auth.payload.ConfigurationsDto;
import com.iRecruit.modules.auth.payload.request.ApiResponse;
import com.iRecruit.modules.auth.service.ConfigurationsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@RestController
@RequestMapping("/api/v1")
@Api(description = "Configurations management API")
public class ConfigurationsController {
@Autowired
ConfigurationsService configurationsService;
@Autowired
DBConfig DBConfig;
@PostMapping("/configurations/get")
@ApiOperation("Get all configurations list")
@AuditLogs(isRequest = true, isResponse = true,service="Get Config")
public ResponseEntity<?> getAllConfigurations( ){
return new ResponseEntity(new ApiResponse(HttpStatus.OK.value(), true, "Configurations List", configurationsService.findAll().stream().map(configurations -> new ConfigurationsDto(configurations))), HttpStatus.OK);
}
@PostMapping("/configurations/refresh")
@ApiOperation("to Refresh all configurations list")
@AuditLogs(isRequest = true, isResponse = true,service="Refresh Config")
public ResponseEntity<?> refreshConfigurations( ){
DBConfig.refreshConfig();
return new ResponseEntity(new ApiResponse(HttpStatus.OK.value(), true, "Configurations has been refreshed", null), HttpStatus.OK);
}
@PostMapping("/configurations/create")
@ApiOperation("Create configurations")
@AuditLogs(isRequest = true, isResponse = true,service="Create Config")
public ResponseEntity<?> createConfigurations(@RequestBody ConfigurationsDto configurations) {
System.out.println("in configuration");
Configurations config = null;
try {
config = configurationsService.save(configurations,true);
}catch(ResourceNotFoundException e) {
e.printStackTrace();
return new ResponseEntity(new ApiResponse(StatusCode.RESOURCE_NOT_FOUND, true, "Configurations Not found", configurations.getKey()), HttpStatus.NOT_FOUND);
}catch(Exception e) {
e.printStackTrace();
return new ResponseEntity(new ApiResponse(StatusCode.UNEXPECTED_ERROR, true, "Configurations creation failed", configurations.getKey()), HttpStatus.BAD_REQUEST);
}
return new ResponseEntity(new ApiResponse(HttpStatus.OK.value(), true, "Configurations added successfully", new ConfigurationsDto(config)), HttpStatus.OK);
//return new ResponseEntity(new ApiResponse(StatusCode.RESOURCE_EXIST, true, "USER_Already_Exist", null), HttpStatus.NOT_FOUND);
}
@PostMapping("/configurations/update")
@ApiOperation("Update configurations")
@AuditLogs(isRequest = true, isResponse = true,service="Update Config")
public ResponseEntity<?> updateConfigurations(@RequestBody ConfigurationsDto configurations) {
try {
Configurations newUSer = configurationsService.save(configurations,false);
return new ResponseEntity(new ApiResponse(HttpStatus.OK.value(), true, "Configurations updated successfully", new ConfigurationsDto(newUSer)), HttpStatus.OK);
}catch(DataIntegrityViolationException e) {
return new ResponseEntity(new ApiResponse(StatusCode.RESOURCE_EXIST, true, "Configurations data already exist", null), HttpStatus.ALREADY_REPORTED);
}catch(ResourceNotFoundException e) {
return new ResponseEntity(new ApiResponse(StatusCode.INVALID_USER, true, "Configurations record not found", null), HttpStatus.NOT_FOUND);
}catch(Exception e) {
return new ResponseEntity(new ApiResponse(StatusCode.UNEXPECTED_ERROR, true, "Configurations updation failed", null), HttpStatus.BAD_REQUEST);
}
//return new ResponseEntity(new ApiResponse(StatusCode.DEPENDANCY_EXIST, true, "USER_Already_Exist", null), HttpStatus.NOT_FOUND);
}
}
package com.iRecruit.modules.auth.controller;
import javax.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.iRecruit.annotation.AuditLogs;
import com.iRecruit.constant.DBConfig;
import com.iRecruit.constant.StatusCode;
import com.iRecruit.exception.ResourceNotFoundException;
import com.iRecruit.modules.auth.model.Configurations;
import com.iRecruit.modules.auth.model.FycMapping;
import com.iRecruit.modules.auth.payload.ConfigurationsDto;
import com.iRecruit.modules.auth.payload.fycDto;
import com.iRecruit.modules.auth.payload.request.ApiResponse;
import com.iRecruit.modules.auth.service.ConfigurationsService;
import com.iRecruit.modules.auth.service.FycMappingService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@RestController
@RequestMapping("/api/v1")
@Api(description = "Configurations management API")
public class FycMappingController {
@Autowired
FycMappingService fycMappingService;
@Autowired
DBConfig DBConfig;
@PostMapping("/fycmapping/get")
@ApiOperation("Get all fyc mapping list")
@AuditLogs(isRequest = true, isResponse = true,service="Get fyc")
public ResponseEntity<?> getAllFycMappings(){
return new ResponseEntity(new ApiResponse(HttpStatus.OK.value(), true, "Fyc List", fycMappingService.findAll().stream().map(FycMapping -> new fycDto(FycMapping))), HttpStatus.OK);
}
@PostMapping("/fycmapping/create")
@ApiOperation("Create fycmapping")
@AuditLogs(isRequest = true, isResponse = true,service="Create fycmapping")
public ResponseEntity<?> createFycmapping(@RequestBody fycDto fycMapping) {
System.out.println("in fyc contrroler");
System.out.println("in fycmapping");
FycMapping fyc = null;
try {
fyc = fycMappingService.save(fycMapping,true);
}catch(ResourceNotFoundException e) {
e.printStackTrace();
return new ResponseEntity(new ApiResponse(StatusCode.RESOURCE_NOT_FOUND, true, "fycmapping Not found", fyc.getId()), HttpStatus.NOT_FOUND);
}catch(Exception e) {
e.printStackTrace();
return new ResponseEntity(new ApiResponse(StatusCode.UNEXPECTED_ERROR, true, "fycmapping creation failed", fyc.getId()), HttpStatus.BAD_REQUEST);
}
return new ResponseEntity(new ApiResponse(HttpStatus.OK.value(), true, "Configurations added successfully", new fycDto(fyc)), HttpStatus.OK);
//return new ResponseEntity(new ApiResponse(StatusCode.RESOURCE_EXIST, true, "USER_Already_Exist", null), HttpStatus.NOT_FOUND);
}
@PostMapping("/fycmapping/update")
@ApiOperation("update fycmapping")
@AuditLogs(isRequest = true, isResponse = true,service="Create fycmapping")
public ResponseEntity<?> updateFycmapping(@RequestBody fycDto fycMapping) {
System.out.println("in fyc contrroler");
System.out.println("in fycmapping");
FycMapping fycupdate = null;
try {
fycupdate = fycMappingService.save(fycMapping,false);
}catch(ResourceNotFoundException e) {
e.printStackTrace();
return new ResponseEntity(new ApiResponse(StatusCode.RESOURCE_NOT_FOUND, true, "fycmapping Not found", fycupdate.getId()), HttpStatus.NOT_FOUND);
}catch(Exception e) {
e.printStackTrace();
return new ResponseEntity(new ApiResponse(StatusCode.UNEXPECTED_ERROR, true, "fycmapping creation failed", fycupdate.getId()), HttpStatus.BAD_REQUEST);
}
return new ResponseEntity(new ApiResponse(HttpStatus.OK.value(), true, "Configurations added successfully", new fycDto(fycupdate)), HttpStatus.OK);
//return new ResponseEntity(new ApiResponse(StatusCode.RESOURCE_EXIST, true, "USER_Already_Exist", null), HttpStatus.NOT_FOUND);
}
}
package com.iRecruit.modules.auth.controller;
import javax.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.iRecruit.annotation.AuditLogs;
import com.iRecruit.constant.LeaderCalcConfig;
import com.iRecruit.constant.StatusCode;
import com.iRecruit.exception.ResourceNotFoundException;
import com.iRecruit.modules.auth.model.L1slabsMapping;
import com.iRecruit.modules.auth.model.MpbMapping;
import com.iRecruit.modules.auth.payload.L1slabsDto;
import com.iRecruit.modules.auth.payload.mpbDto;
import com.iRecruit.modules.auth.payload.request.ApiResponse;
import com.iRecruit.modules.auth.service.L1slabsMappingService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@RestController
@RequestMapping("/api/v1")
@Api(description = "L1 Slabs maping management API")
public class L1slabsMappingController {
@Autowired
L1slabsMappingService l1slabsMappingService;
LeaderCalcConfig LeaderCalcConfig;
@PostMapping("/l1salbsmapping/get")
@ApiOperation("Get all l1slabs mapping list")
@AuditLogs(isRequest = true, isResponse = true,service="Get l1slabs")
public ResponseEntity<?> getAllL1slabsMappings( ){
return new ResponseEntity(new ApiResponse(HttpStatus.OK.value(), true, "l1 slabs List", l1slabsMappingService.findAll().stream().map(L1slabsMapping -> new L1slabsDto(L1slabsMapping))), HttpStatus.OK);
}
@PostMapping("/l1salbsmapping/create")
@ApiOperation("Create l1salbsmapping")
@AuditLogs(isRequest = true, isResponse = true,service="Create l1salbsmapping")
public ResponseEntity<?> createL1slabsmapping(@RequestBody L1slabsDto l1slabsmapping) {
System.out.println("in l1salbsmapping contrroler");
System.out.println("in l1salbsmapping");
L1slabsMapping l1 = null;
try {
l1 = l1slabsMappingService.save(l1slabsmapping,true);
}catch(ResourceNotFoundException e) {
e.printStackTrace();
return new ResponseEntity(new ApiResponse(StatusCode.RESOURCE_NOT_FOUND, true, "l1mapping Not found", l1.getId()), HttpStatus.NOT_FOUND);
}catch(Exception e) {
e.printStackTrace();
return new ResponseEntity(new ApiResponse(StatusCode.UNEXPECTED_ERROR, true, "l1mapping creation failed", l1.getId()), HttpStatus.BAD_REQUEST);
}
return new ResponseEntity(new ApiResponse(HttpStatus.OK.value(), true, "l1mapping added successfully", new L1slabsDto(l1)), HttpStatus.OK);
//return new ResponseEntity(new ApiResponse(StatusCode.RESOURCE_EXIST, true, "USER_Already_Exist", null), HttpStatus.NOT_FOUND);
}
@PostMapping("/l1salbsmapping/update")
@ApiOperation("update l1salbsmapping")
@AuditLogs(isRequest = true, isResponse = true,service="Create l1salbsmapping")
public ResponseEntity<?> updateL1slabsmapping(@RequestBody L1slabsDto l1slabsmapping) {
System.out.println("in l1salbsmapping contrroler");
System.out.println("in l1salbsmapping");
L1slabsMapping l1 = null;
try {
l1 = l1slabsMappingService.save(l1slabsmapping,false);
}catch(ResourceNotFoundException e) {
e.printStackTrace();
return new ResponseEntity(new ApiResponse(StatusCode.RESOURCE_NOT_FOUND, true, "l1mapping Not found", l1.getId()), HttpStatus.NOT_FOUND);
}catch(Exception e) {
e.printStackTrace();
return new ResponseEntity(new ApiResponse(StatusCode.UNEXPECTED_ERROR, true, "l1mapping creation failed", l1.getId()), HttpStatus.BAD_REQUEST);
}
return new ResponseEntity(new ApiResponse(HttpStatus.OK.value(), true, "l1mapping added successfully", new L1slabsDto(l1)), HttpStatus.OK);
//return new ResponseEntity(new ApiResponse(StatusCode.RESOURCE_EXIST, true, "USER_Already_Exist", null), HttpStatus.NOT_FOUND);
}
}
package com.iRecruit.modules.auth.controller;
import javax.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.iRecruit.annotation.AuditLogs;
import com.iRecruit.constant.LeaderCalcConfig;
import com.iRecruit.constant.StatusCode;
import com.iRecruit.exception.ResourceNotFoundException;
import com.iRecruit.modules.auth.model.L1slabsMapping;
import com.iRecruit.modules.auth.model.L2slabsMapping;
import com.iRecruit.modules.auth.payload.L1slabsDto;
import com.iRecruit.modules.auth.payload.L2slabsDto;
import com.iRecruit.modules.auth.payload.request.ApiResponse;
import com.iRecruit.modules.auth.service.L2slabsMappingService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@RestController
@RequestMapping("/api/v1")
@Api(description = "L2 Slabs maping management API")
public class L2slabsMappingController {
@Autowired
L2slabsMappingService l2slabsMappingService;
LeaderCalcConfig LeaderCalcConfig;
@PostMapping("/l2salbsmapping/get")
@ApiOperation("Get all l2slabs mapping list")
@AuditLogs(isRequest = true, isResponse = true,service="Get l2slabs")
public ResponseEntity<?> getAllL1slabsMappings( ){
return new ResponseEntity(new ApiResponse(HttpStatus.OK.value(), true, "l2 slabs List", l2slabsMappingService.findAll().stream().map(L2slabsMapping -> new L2slabsDto(L2slabsMapping))), HttpStatus.OK);
}
@PostMapping("/l2salbsmapping/create")
@ApiOperation("Create l2salbsmapping")
@AuditLogs(isRequest = true, isResponse = true,service="Create l2salbsmapping")
public ResponseEntity<?> createL1slabsmapping(@RequestBody L2slabsDto l2slabsmapping) {
System.out.println("in l2salbsmapping contrroler");
System.out.println("in l2salbsmapping");
L2slabsMapping l2 = null;
try {
l2 = l2slabsMappingService.save(l2slabsmapping,true);
}catch(ResourceNotFoundException e) {
e.printStackTrace();
return new ResponseEntity(new ApiResponse(StatusCode.RESOURCE_NOT_FOUND, true, "l2mapping Not found", l2.getId()), HttpStatus.NOT_FOUND);
}catch(Exception e) {
e.printStackTrace();
return new ResponseEntity(new ApiResponse(StatusCode.UNEXPECTED_ERROR, true, "l2mapping creation failed", l2.getId()), HttpStatus.BAD_REQUEST);
}
return new ResponseEntity(new ApiResponse(HttpStatus.OK.value(), true, "l2mapping added successfully", new L2slabsDto(l2)), HttpStatus.OK);
//return new ResponseEntity(new ApiResponse(StatusCode.RESOURCE_EXIST, true, "USER_Already_Exist", null), HttpStatus.NOT_FOUND);
}
@PostMapping("/l2salbsmapping/update")
@ApiOperation("update l2salbsmapping")
@AuditLogs(isRequest = true, isResponse = true,service="Create l2salbsmapping")
public ResponseEntity<?> updateL1slabsmapping(@RequestBody L2slabsDto l2slabsmapping) {
System.out.println("in l2salbsmapping contrroler");
System.out.println("in l2salbsmapping");
L2slabsMapping l2 = null;
try {
l2 = l2slabsMappingService.save(l2slabsmapping,false);
}catch(ResourceNotFoundException e) {
e.printStackTrace();
return new ResponseEntity(new ApiResponse(StatusCode.RESOURCE_NOT_FOUND, true, "l2mapping Not found", l2.getId()), HttpStatus.NOT_FOUND);
}catch(Exception e) {
e.printStackTrace();
return new ResponseEntity(new ApiResponse(StatusCode.UNEXPECTED_ERROR, true, "l2mapping updation failed", l2.getId()), HttpStatus.BAD_REQUEST);
}
return new ResponseEntity(new ApiResponse(HttpStatus.OK.value(), true, "l2mapping added successfully", new L2slabsDto(l2)), HttpStatus.OK);
//return new ResponseEntity(new ApiResponse(StatusCode.RESOURCE_EXIST, true, "USER_Already_Exist", null), HttpStatus.NOT_FOUND);
}
}
package com.iRecruit.modules.auth.controller;
import java.util.Map;
import javax.validation.Valid;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.iRecruit.annotation.AuditLogs;
import com.iRecruit.constant.LeaderCalcConfig;
import com.iRecruit.constant.StatusCode;
import com.iRecruit.exception.ResourceNotFoundException;
import com.iRecruit.modules.auth.model.L1slabsMapping;
import com.iRecruit.modules.auth.model.MpbMapping;
import com.iRecruit.modules.auth.payload.L1slabsDto;
import com.iRecruit.modules.auth.payload.mpbDto;
import com.iRecruit.modules.auth.payload.request.ApiResponse;
import com.iRecruit.modules.auth.payload.request.Apiresponse1;
import com.iRecruit.modules.auth.service.L1slabsMappingService;
import com.iRecruit.modules.auth.service.LeaderCalcService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@RestController
@RequestMapping("/api/v1")
@Api(description = "Leader Calc API")
public class LeaderCalc {
@Autowired
LeaderCalcService leaderCalcService;
LeaderCalcConfig LeaderCalcConfig;
@PostMapping(value = "/leaderCalculation", headers = "Accept=application/json")
@ApiOperation("Create leadercalc")
// @AuditLogs(isRequest = true, isResponse = true,service="Create leadercalc")
public ResponseEntity<?> Calculate(@RequestBody Map<String, Object> lookupRequestObject) throws JsonProcessingException {
System.out.println("in fyc contrroler");
System.out.println("in fycmapping");
ObjectMapper mapper = new ObjectMapper();
String data = mapper.writeValueAsString(lookupRequestObject);
JSONObject calc = null;
try {
System.out.println("in try");
calc = leaderCalcService.calculate(data);
System.out.println("after operation calc");
System.out.println(calc);
}catch(ResourceNotFoundException e) {
System.out.println(e);
e.printStackTrace();
return new ResponseEntity(new ApiResponse(StatusCode.RESOURCE_NOT_FOUND, true, "calculation failed", null), HttpStatus.NOT_FOUND);
}catch(Exception e) {
e.printStackTrace();
System.out.println(e);
return new ResponseEntity(new ApiResponse(StatusCode.UNEXPECTED_ERROR, true, "calculation failed", null), HttpStatus.BAD_REQUEST);
}
return new ResponseEntity(new ApiResponse(HttpStatus.OK.value(), true, "calculation done successfully", calc.toString()), HttpStatus.OK);
//return new ResponseEntity(new ApiResponse(StatusCode.RESOURCE_EXIST, true, "USER_Already_Exist", null), HttpStatus.NOT_FOUND);
}
}
package com.iRecruit.modules.auth.controller;
import javax.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.iRecruit.annotation.AuditLogs;
import com.iRecruit.constant.LeaderCalcConfig;
import com.iRecruit.constant.StatusCode;
import com.iRecruit.exception.ResourceNotFoundException;
import com.iRecruit.modules.auth.model.L1slabsMapping;
import com.iRecruit.modules.auth.model.L2slabsMapping;
import com.iRecruit.modules.auth.model.MDBMapping;
import com.iRecruit.modules.auth.model.MpbMapping;
import com.iRecruit.modules.auth.payload.L1slabsDto;
import com.iRecruit.modules.auth.payload.L2slabsDto;
import com.iRecruit.modules.auth.payload.MDBDto;
import com.iRecruit.modules.auth.payload.mpbDto;
import com.iRecruit.modules.auth.payload.request.ApiResponse;
import com.iRecruit.modules.auth.service.MDBMappingService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@RestController
@RequestMapping("/api/v1")
@Api(description = "MDB maping management API")
public class MDBMappingController {
@Autowired
MDBMappingService mdbMappingService;
LeaderCalcConfig LeaderCalcConfig;
@PostMapping("/mdbmapping/get")
@ApiOperation("Get all mdb mapping list")
@AuditLogs(isRequest = true, isResponse = true,service="Get mdb")
public ResponseEntity<?> getAllMDBMappings( ){
return new ResponseEntity(new ApiResponse(HttpStatus.OK.value(), true, "MDB List", mdbMappingService.findAll().stream().map(MDBMapping -> new MDBDto(MDBMapping))), HttpStatus.OK);
}
@PostMapping("/mdbmapping/create")
@ApiOperation("Create mdbmapping")
@AuditLogs(isRequest = true, isResponse = true,service="Create mdbmapping")
public ResponseEntity<?> createmdbsmapping(@RequestBody MDBDto mdbmapping) {
System.out.println("in mdb contrroler");
System.out.println("in mdbmapping");
MDBMapping mdb = null;
try {
mdb = mdbMappingService.save(mdbmapping,true);
}catch(ResourceNotFoundException e) {
e.printStackTrace();
return new ResponseEntity(new ApiResponse(StatusCode.RESOURCE_NOT_FOUND, true, "mdbmapping Not found", mdb.getId()), HttpStatus.NOT_FOUND);
}catch(Exception e) {
e.printStackTrace();
return new ResponseEntity(new ApiResponse(StatusCode.UNEXPECTED_ERROR, true, "mdbmapping creation failed", mdb.getId()), HttpStatus.BAD_REQUEST);
}
return new ResponseEntity(new ApiResponse(HttpStatus.OK.value(), true, "l2mapping added successfully", new MDBDto(mdb)), HttpStatus.OK);
//return new ResponseEntity(new ApiResponse(StatusCode.RESOURCE_EXIST, true, "USER_Already_Exist", null), HttpStatus.NOT_FOUND);
}
@PostMapping("/mdbmapping/update")
@ApiOperation("update mdbmapping")
@AuditLogs(isRequest = true, isResponse = true,service="Create mdbmapping")
public ResponseEntity<?> updatemdbsmapping(@RequestBody MDBDto mdbmapping) {
System.out.println("in mdb contrroler");
System.out.println("in mdbmapping");
MDBMapping mdb = null;
try {
mdb = mdbMappingService.save(mdbmapping,false);
}catch(ResourceNotFoundException e) {
e.printStackTrace();
return new ResponseEntity(new ApiResponse(StatusCode.RESOURCE_NOT_FOUND, true, "mdbmapping Not found", mdb.getId()), HttpStatus.NOT_FOUND);
}catch(Exception e) {
e.printStackTrace();
return new ResponseEntity(new ApiResponse(StatusCode.UNEXPECTED_ERROR, true, "mdbmapping updation failed", mdb.getId()), HttpStatus.BAD_REQUEST);
}
return new ResponseEntity(new ApiResponse(HttpStatus.OK.value(), true, "l2mapping added successfully", new MDBDto(mdb)), HttpStatus.OK);
//return new ResponseEntity(new ApiResponse(StatusCode.RESOURCE_EXIST, true, "USER_Already_Exist", null), HttpStatus.NOT_FOUND);
}
}
package com.iRecruit.modules.auth.controller;
import javax.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.iRecruit.annotation.AuditLogs;
import com.iRecruit.constant.LeaderCalcConfig;
import com.iRecruit.constant.StatusCode;
import com.iRecruit.exception.ResourceNotFoundException;
import com.iRecruit.modules.auth.payload.fycDto;
import com.iRecruit.modules.auth.payload.mpbDto;
import com.iRecruit.modules.auth.payload.request.ApiResponse;
import com.iRecruit.modules.auth.service.FycMappingService;
import com.iRecruit.modules.auth.service.MpbMappingService;
import com.iRecruit.modules.auth.model.FycMapping;
import com.iRecruit.modules.auth.model.MpbMapping;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@RestController
@RequestMapping("/api/v1")
@Api(description = "MPB maping management API")
public class MpbMappingController {
@Autowired
MpbMappingService mpbMappingService;
LeaderCalcConfig LeaderCalcConfig;
@PostMapping("/mpbmapping/get")
@ApiOperation("Get all mpb mapping list")
@AuditLogs(isRequest = true, isResponse = true,service="Get mpb")
public ResponseEntity<?> getAllMpbMappings( ){
return new ResponseEntity(new ApiResponse(HttpStatus.OK.value(), true, "Mpb List", mpbMappingService.findAll().stream().map(MpbMapping -> new mpbDto(MpbMapping))), HttpStatus.OK);
}
@PostMapping("/mpbmapping/create")
@ApiOperation("Create mpbmapping")
@AuditLogs(isRequest = true, isResponse = true,service="Create mpbmapping")
public ResponseEntity<?> createMpbmapping(@RequestBody mpbDto mpbMapping) {
System.out.println("in mpb contrroler");
System.out.println("in mpbmapping");
MpbMapping mpb = null;
try {
mpb = mpbMappingService.save(mpbMapping,true);
}catch(ResourceNotFoundException e) {
e.printStackTrace();
return new ResponseEntity(new ApiResponse(StatusCode.RESOURCE_NOT_FOUND, true, "mpbmapping Not found", mpb.getId()), HttpStatus.NOT_FOUND);
}catch(Exception e) {
e.printStackTrace();
return new ResponseEntity(new ApiResponse(StatusCode.UNEXPECTED_ERROR, true, "mpbmapping creation failed", mpb.getId()), HttpStatus.BAD_REQUEST);
}
return new ResponseEntity(new ApiResponse(HttpStatus.OK.value(), true, "mpb mapping added successfully", new mpbDto(mpb)), HttpStatus.OK);
//return new ResponseEntity(new ApiResponse(StatusCode.RESOURCE_EXIST, true, "USER_Already_Exist", null), HttpStatus.NOT_FOUND);
}
@PostMapping("/mpbmapping/update")
@ApiOperation("update mpbmapping")
@AuditLogs(isRequest = true, isResponse = true,service="update mpbmapping")
public ResponseEntity<?> updateMpbmapping(@RequestBody mpbDto mpbMapping) {
System.out.println("in mpb contrroler");
System.out.println("in mpbmapping");
MpbMapping mpb = null;
try {
mpb = mpbMappingService.save(mpbMapping,false);
}catch(ResourceNotFoundException e) {
e.printStackTrace();
return new ResponseEntity(new ApiResponse(StatusCode.RESOURCE_NOT_FOUND, true, "mpbmapping Not found", mpb.getId()), HttpStatus.NOT_FOUND);
}catch(Exception e) {
e.printStackTrace();
return new ResponseEntity(new ApiResponse(StatusCode.UNEXPECTED_ERROR, true, "mpbmapping creation failed", mpb.getId()), HttpStatus.BAD_REQUEST);
}
return new ResponseEntity(new ApiResponse(HttpStatus.OK.value(), true, "mpb mapping updated successfully", new mpbDto(mpb)), HttpStatus.OK);
//return new ResponseEntity(new ApiResponse(StatusCode.RESOURCE_EXIST, true, "USER_Already_Exist", null), HttpStatus.NOT_FOUND);
}
}
package com.iRecruit.modules.auth.controller;
import javax.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.iRecruit.annotation.AuditLogs;
import com.iRecruit.constant.LeaderCalcConfig;
import com.iRecruit.constant.StatusCode;
import com.iRecruit.exception.ResourceNotFoundException;
import com.iRecruit.modules.auth.model.L1slabsMapping;
import com.iRecruit.modules.auth.model.L2slabsMapping;
import com.iRecruit.modules.auth.model.MDBMapping;
import com.iRecruit.modules.auth.model.MpbMapping;
import com.iRecruit.modules.auth.model.MsaMapping;
import com.iRecruit.modules.auth.payload.L1slabsDto;
import com.iRecruit.modules.auth.payload.L2slabsDto;
import com.iRecruit.modules.auth.payload.MDBDto;
import com.iRecruit.modules.auth.payload.MsaDto;
import com.iRecruit.modules.auth.payload.mpbDto;
import com.iRecruit.modules.auth.payload.request.ApiResponse;
import com.iRecruit.modules.auth.service.MDBMappingService;
import com.iRecruit.modules.auth.service.MsaMappingService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@RestController
@RequestMapping("/api/v1")
@Api(description = "MSA maping management API")
public class MsaMappingController {
@Autowired
MsaMappingService msaMappingService;
LeaderCalcConfig LeaderCalcConfig;
@PostMapping("/msamapping/get")
@ApiOperation("Get all msa mapping list")
@AuditLogs(isRequest = true, isResponse = true,service="Get msa")
public ResponseEntity<?> getAllMDBMappings( ){
return new ResponseEntity(new ApiResponse(HttpStatus.OK.value(), true, "MSA List", msaMappingService.findAll().stream().map(MSAMapping -> new MsaDto(MSAMapping))), HttpStatus.OK);
}
@PostMapping("/msamapping/create")
@ApiOperation("Create msamapping")
@AuditLogs(isRequest = true, isResponse = true,service="Create msamapping")
public ResponseEntity<?> createMsamapping(@RequestBody MsaDto msaMapping) {
System.out.println("in mpb contrroler");
System.out.println("in mpbmapping");
MsaMapping msa = null;
try {
msa = msaMappingService.save(msaMapping,true);
}catch(ResourceNotFoundException e) {
e.printStackTrace();
return new ResponseEntity(new ApiResponse(StatusCode.RESOURCE_NOT_FOUND, true, "msamapping Not found", msa.getId()), HttpStatus.NOT_FOUND);
}catch(Exception e) {
e.printStackTrace();
return new ResponseEntity(new ApiResponse(StatusCode.UNEXPECTED_ERROR, true, "msamapping creation failed", msa.getId()), HttpStatus.BAD_REQUEST);
}
return new ResponseEntity(new ApiResponse(HttpStatus.OK.value(), true, "msa mapping added successfully", new MsaDto(msa)), HttpStatus.OK);
//return new ResponseEntity(new ApiResponse(StatusCode.RESOURCE_EXIST, true, "USER_Already_Exist", null), HttpStatus.NOT_FOUND);
}
@PostMapping("/msamapping/update")
@ApiOperation("Create msamapping")
@AuditLogs(isRequest = true, isResponse = true,service="update msamapping")
public ResponseEntity<?>updateMsamapping(@RequestBody MsaDto msaMapping) {
System.out.println("in mpb contrroler");
System.out.println("in mpbmapping");
MsaMapping msa = null;
try {
msa = msaMappingService.save(msaMapping,false);
}catch(ResourceNotFoundException e) {
e.printStackTrace();
return new ResponseEntity(new ApiResponse(StatusCode.RESOURCE_NOT_FOUND, true, "msamapping Not found", msa.getId()), HttpStatus.NOT_FOUND);
}catch(Exception e) {
e.printStackTrace();
return new ResponseEntity(new ApiResponse(StatusCode.UNEXPECTED_ERROR, true, "msamapping updation failed", msa.getId()), HttpStatus.BAD_REQUEST);
}
return new ResponseEntity(new ApiResponse(HttpStatus.OK.value(), true, "msa mapping updated successfully", new MsaDto(msa)), HttpStatus.OK);
//return new ResponseEntity(new ApiResponse(StatusCode.RESOURCE_EXIST, true, "USER_Already_Exist", null), HttpStatus.NOT_FOUND);
}
}
package com.iRecruit.modules.auth.controller;
import java.util.HashMap;
import java.util.Map;
import javax.validation.Valid;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.iRecruit.annotation.AuditLogs;
import com.iRecruit.constant.LeaderCalcConfig;
import com.iRecruit.constant.StatusCode;
import com.iRecruit.exception.ResourceNotFoundException;
import com.iRecruit.modules.auth.model.L1slabsMapping;
import com.iRecruit.modules.auth.model.MpbMapping;
import com.iRecruit.modules.auth.payload.L1slabsDto;
import com.iRecruit.modules.auth.payload.mpbDto;
import com.iRecruit.modules.auth.payload.request.ApiResponse;
import com.iRecruit.modules.auth.service.L1slabsMappingService;
import com.iRecruit.modules.auth.service.LeaderCalcService;
import com.iRecruit.modules.auth.service.NGPACalcService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@RestController
@RequestMapping("/api/v1")
@Api(description = "NGPA Calc API")
public class NGPACalc {
@Autowired
NGPACalcService nGPACalcService;
LeaderCalcConfig LeaderCalcConfig;
@PostMapping(value = "/ngpaCalculation", headers = "Accept=application/json")
@ApiOperation("Create ngpacalc")
// @AuditLogs(isRequest = true, isResponse = true,service="Create leadercalc")
@JsonSerialize
public ResponseEntity<?> CalculateNGPA(@RequestBody Map<String, Object> lookupRequestObject) throws JsonProcessingException {
System.out.println("in ngpa contrroler");
ObjectMapper mapper = new ObjectMapper();
String data = mapper.writeValueAsString(lookupRequestObject);
JSONObject requestJSON = new JSONObject(data);
HashMap<String,Object> result = null;
JSONObject calc = null;
try {
System.out.println("in try");
calc = nGPACalcService.prepareAllFormula(requestJSON);
System.out.println("after operation calc");
System.out.println(calc);
result =new HashMap<String, Object>();
result.put("response", calc);
System.out.println(result);
}catch(ResourceNotFoundException e) {
e.printStackTrace();
// return new ResponseEntity(new ApiResponse(StatusCode.RESOURCE_NOT_FOUND, true, "fycmapping Not found", fyc.getId()), HttpStatus.NOT_FOUND);
}catch(Exception e) {
e.printStackTrace();
//return new ResponseEntity(new ApiResponse(StatusCode.UNEXPECTED_ERROR, true, "fycmapping creation failed", fyc.getId()), HttpStatus.BAD_REQUEST);
}
return new ResponseEntity(new ApiResponse(HttpStatus.OK.value(), true, "calculation done successfully", calc.toString()), HttpStatus.OK);
//return new ResponseEntity(new ApiResponse(StatusCode.RESOURCE_EXIST, true, "USER_Already_Exist", null), HttpStatus.NOT_FOUND);
}
}
package com.iRecruit.modules.auth.controller;
import java.util.HashMap;
import java.util.Map;
import javax.validation.Valid;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.iRecruit.annotation.AuditLogs;
import com.iRecruit.constant.LeaderCalcConfig;
import com.iRecruit.constant.StatusCode;
import com.iRecruit.exception.ResourceNotFoundException;
import com.iRecruit.modules.auth.model.L1slabsMapping;
import com.iRecruit.modules.auth.model.MpbMapping;
import com.iRecruit.modules.auth.payload.L1slabsDto;
import com.iRecruit.modules.auth.payload.mpbDto;
import com.iRecruit.modules.auth.payload.request.ApiResponse;
import com.iRecruit.modules.auth.service.L1slabsMappingService;
import com.iRecruit.modules.auth.service.LeaderCalcService;
import com.iRecruit.modules.auth.service.NGPAtoNGPLCalcService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@RestController
@RequestMapping("/api/v1")
@Api(description = "NGPL Calc API")
public class NGPAtoNGPLCalc {
@Autowired
NGPAtoNGPLCalcService nGPAtoNGPLCalcService;
LeaderCalcConfig LeaderCalcConfig;
@PostMapping(value = "/ngpatongplCalculation", headers = "Accept=application/json")
@ApiOperation("Create ngplcalc")
// @AuditLogs(isRequest = true, isResponse = true,service="Create leadercalc")
@JsonSerialize
public ResponseEntity<?> CalculateNGPL(@RequestBody Map<String, Object> lookupRequestObject) throws JsonProcessingException {
System.out.println("in ngpl contrroler");
ObjectMapper mapper = new ObjectMapper();
String data = mapper.writeValueAsString(lookupRequestObject);
JSONObject requestJSON = new JSONObject(data);
HashMap<String,Object> result = null;
JSONObject calc = null;
try {
System.out.println("in try");
calc = nGPAtoNGPLCalcService.prepareAllFormula(requestJSON);
System.out.println("after operation calc");
System.out.println(calc);
result =new HashMap<String, Object>();
result.put("response", calc);
System.out.println(result);
}catch(ResourceNotFoundException e) {
e.printStackTrace();
// return new ResponseEntity(new ApiResponse(StatusCode.RESOURCE_NOT_FOUND, true, "fycmapping Not found", fyc.getId()), HttpStatus.NOT_FOUND);
}catch(Exception e) {
e.printStackTrace();
//return new ResponseEntity(new ApiResponse(StatusCode.UNEXPECTED_ERROR, true, "fycmapping creation failed", fyc.getId()), HttpStatus.BAD_REQUEST);
}
return new ResponseEntity(new ApiResponse(HttpStatus.OK.value(), true, "calculation done successfully", calc.toString()), HttpStatus.OK);
//return new ResponseEntity(new ApiResponse(StatusCode.RESOURCE_EXIST, true, "USER_Already_Exist", null), HttpStatus.NOT_FOUND);
}
}
package com.iRecruit.modules.auth.controller;
import javax.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.iRecruit.annotation.AuditLogs;
import com.iRecruit.constant.DBConfig;
import com.iRecruit.constant.StatusCode;
import com.iRecruit.exception.ResourceNotFoundException;
import com.iRecruit.modules.auth.model.Templates;
import com.iRecruit.modules.auth.payload.TemplatesDto;
import com.iRecruit.modules.auth.payload.request.ApiResponse;
import com.iRecruit.modules.auth.service.TemplatesService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@RestController
@RequestMapping("/api/v1")
@Api(description = "Templates management API")
public class TemplatesController {
@Autowired
TemplatesService templatesService;
@Autowired
DBConfig DBConfig;
@PostMapping("/templates/get")
@ApiOperation("Get all templates list")
@AuditLogs(isRequest = true, isResponse = true,service="Get Template")
public ResponseEntity<?> getAllTemplates( ){
return new ResponseEntity(new ApiResponse(HttpStatus.OK.value(), true, "Templates List", templatesService.findAll().stream().map(templates -> new TemplatesDto(templates))), HttpStatus.OK);
}
@PostMapping("/templates/refresh")
@ApiOperation("to Refresh all templates list")
@AuditLogs(isRequest = true, isResponse = true,service="Refresh Template")
public ResponseEntity<?> refreshTemplates( ){
DBConfig.refreshConfig();
return new ResponseEntity(new ApiResponse(HttpStatus.OK.value(), true, "Templates has been refreshed", null), HttpStatus.OK);
}
@PostMapping("/templates/create")
@ApiOperation("Create templates")
@AuditLogs(isRequest = true, isResponse = true,service="Create Template")
public ResponseEntity<?> createTemplates(@RequestBody TemplatesDto templates) {
Templates template = null;
try {
template = templatesService.save(templates,true);
}catch(ResourceNotFoundException e) {
return new ResponseEntity(new ApiResponse(StatusCode.RESOURCE_NOT_FOUND, true, "Templates Not found", templates.getKey()), HttpStatus.NOT_FOUND);
}catch(Exception e) {
return new ResponseEntity(new ApiResponse(StatusCode.UNEXPECTED_ERROR, true, "Templates creation failed", templates.getKey()), HttpStatus.BAD_REQUEST);
}
return new ResponseEntity(new ApiResponse(HttpStatus.OK.value(), true, "Templates added successfully", new TemplatesDto(template)), HttpStatus.OK);
//return new ResponseEntity(new ApiResponse(StatusCode.RESOURCE_EXIST, true, "USER_Already_Exist", null), HttpStatus.NOT_FOUND);
}
@PostMapping("/templates/update")
@ApiOperation("Update templates")
@AuditLogs(isRequest = true, isResponse = true,service="Update Template")
public ResponseEntity<?> updateTemplates(@RequestBody TemplatesDto templates) {
try {
Templates newUSer = templatesService.save(templates,false);
return new ResponseEntity(new ApiResponse(HttpStatus.OK.value(), true, "Templates updated successfully", new TemplatesDto(newUSer)), HttpStatus.OK);
}catch(DataIntegrityViolationException e) {
return new ResponseEntity(new ApiResponse(StatusCode.RESOURCE_EXIST, true, "Templates data already exist", null), HttpStatus.ALREADY_REPORTED);
}catch(ResourceNotFoundException e) {
return new ResponseEntity(new ApiResponse(StatusCode.INVALID_USER, true, "Templates record not found", null), HttpStatus.NOT_FOUND);
}catch(Exception e) {
return new ResponseEntity(new ApiResponse(StatusCode.UNEXPECTED_ERROR, true, "Templates updation failed", null), HttpStatus.BAD_REQUEST);
}
//return new ResponseEntity(new ApiResponse(StatusCode.DEPENDANCY_EXIST, true, "USER_Already_Exist", null), HttpStatus.NOT_FOUND);
}
}
package com.iRecruit.modules.auth.controller;
import javax.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.iRecruit.annotation.AuditLogs;
import com.iRecruit.constant.StatusCode;
import com.iRecruit.exception.ResourceNotFoundException;
import com.iRecruit.modules.auth.model.User;
import com.iRecruit.modules.auth.payload.UserDto;
import com.iRecruit.modules.auth.payload.request.ApiResponse;
import com.iRecruit.modules.auth.service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
//@RestController
@RequestMapping("/api/v1")
@Api(description = "User management API")
public class UserController {
@Autowired
UserService userService;
@GetMapping("/user")
@ApiOperation("Get all user list with pagination")
@AuditLogs
public ResponseEntity<?> getAllUsers( @RequestParam(defaultValue = "0") Integer pageNo,
@RequestParam(defaultValue = "10") Integer pageSize,
@RequestParam(defaultValue = "id") String sortBy) {
Pageable paging = PageRequest.of(pageNo, pageSize, Sort.by(sortBy));
return new ResponseEntity(new ApiResponse(HttpStatus.OK.value(), true, "User List", userService.findAll(paging).map(user -> new UserDto(user)).getContent()), HttpStatus.OK);
}
@PostMapping("/user")
@ApiOperation("Create user")
public ResponseEntity<?> createUser(@RequestBody UserDto user) {
User newUSer = null;
try {
if(user.getId() == null || userService.findById(user.getId()) != null) {
newUSer = userService.save(user);
}
}catch(ResourceNotFoundException e) {
return new ResponseEntity(new ApiResponse(StatusCode.RESOURCE_NOT_FOUND, true, "User Not found", user.getId()), HttpStatus.NOT_FOUND);
}catch(Exception e) {
return new ResponseEntity(new ApiResponse(StatusCode.UNEXPECTED_ERROR, true, "User creation failed", user.getId()), HttpStatus.BAD_REQUEST);
}
return new ResponseEntity(new ApiResponse(HttpStatus.OK.value(), true, "User added successfully", new UserDto(newUSer)), HttpStatus.OK);
//return new ResponseEntity(new ApiResponse(StatusCode.RESOURCE_EXIST, true, "USER_Already_Exist", null), HttpStatus.NOT_FOUND);
}
@PutMapping("/user")
@ApiOperation("Update user")
public ResponseEntity<?> updateUser(@RequestBody UserDto user) {
try {
User newUSer = userService.save(user);
return new ResponseEntity(new ApiResponse(HttpStatus.OK.value(), true, "User updated successfully", new UserDto(newUSer)), HttpStatus.OK);
}catch(DataIntegrityViolationException e) {
return new ResponseEntity(new ApiResponse(StatusCode.RESOURCE_EXIST, true, "User data already exist", null), HttpStatus.ALREADY_REPORTED);
}catch(ResourceNotFoundException e) {
return new ResponseEntity(new ApiResponse(StatusCode.INVALID_USER, true, "User record not found", null), HttpStatus.NOT_FOUND);
}catch(Exception e) {
return new ResponseEntity(new ApiResponse(StatusCode.UNEXPECTED_ERROR, true, "User updation failed", null), HttpStatus.BAD_REQUEST);
}
//return new ResponseEntity(new ApiResponse(StatusCode.DEPENDANCY_EXIST, true, "USER_Already_Exist", null), HttpStatus.NOT_FOUND);
}
}
package com.iRecruit.modules.auth.model;
import java.util.Date;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import com.iRecruit.modules.auth.payload.AuditLogsDto;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
@Entity
@Table(name = "tbl_audit_log")
@Getter
@Setter
@AllArgsConstructor
public class AuditLogs {
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE)
private Long id;
private String service;
private String sourceIp;
private String deviceInfo;
private String browserInfo;
private String username;
private String OS;
private int statusCode;
private String errorMsg;
private Long timeTaken;
private String requestObj;
private String responseObj;
private Date createdDate;
public AuditLogs(AuditLogsDto audtiLogsDTO) {
this.id = audtiLogsDTO.getId();
this.service = audtiLogsDTO.getService();
this.sourceIp = audtiLogsDTO.getSourceIp();
this.username = audtiLogsDTO.getUsername();
this.statusCode = audtiLogsDTO.getStatus();
this.errorMsg = audtiLogsDTO.getErrorMsg();
this.timeTaken = audtiLogsDTO.getTimeTaken();
this.requestObj = audtiLogsDTO.getRequestObj();
this.responseObj = audtiLogsDTO.getResponseObj();
this.deviceInfo = audtiLogsDTO.getDeviceInfo();
this.browserInfo = audtiLogsDTO.getBrowserInfo();
this.OS = audtiLogsDTO.getOS();
this.createdDate = new Date();
}
}
package com.iRecruit.modules.auth.model;
import static javax.persistence.TemporalType.TIMESTAMP;
import java.util.Date;
import javax.persistence.EntityListeners;
import javax.persistence.MappedSuperclass;
import javax.persistence.Temporal;
import org.springframework.data.annotation.CreatedBy;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedBy;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import lombok.Getter;
import lombok.Setter;
@SuppressWarnings("hiding")
@Setter
@Getter
@MappedSuperclass
@EntityListeners(AuditingEntityListener.class)
public abstract class Auditable<String> {
@CreatedBy
protected String createdUserId;
@CreatedDate
@Temporal(TIMESTAMP)
protected Date createdTs;
@LastModifiedBy
protected String updatedUserId;
@LastModifiedDate
@Temporal(TIMESTAMP)
protected Date updatedTs;
}
package com.iRecruit.modules.auth.model;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.NotBlank;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@Entity
@Table(name = "tbl_configs")
@Setter
@Getter
@NoArgsConstructor
@AllArgsConstructor
public class Configurations{
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE)
private Long id;
@NotBlank
@Column(length=50)
private String config;
@NotBlank
@Column(length=500)
private String value;
private String description;
}
package com.iRecruit.modules.auth.model;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.NotBlank;
import com.google.firebase.database.annotations.NotNull;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@Entity
@Table(name = "tbl_fyc_mapping")
@Setter
@Getter
public class FycMapping {
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE)
private Long id;
@NotNull
@Column(length=500)
private int maxval;
@NotNull
@Column(length=500)
private int minval;
private int per;
}
package com.iRecruit.modules.auth.model;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.NotBlank;
import com.google.firebase.database.annotations.NotNull;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@Entity
@Table(name = "tbl_l1_slabs_mapping")
@Setter
@Getter
public class L1slabsMapping {
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE)
private Long id;
@NotNull
@Column(length=500)
private int minval;
@NotNull
@Column(length=500)
private int maxval;
private int BA;
private int SBA;
private int CBA;
private int Partner;
private int Senior_Partner;
}
package com.iRecruit.modules.auth.model;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.NotBlank;
import com.google.firebase.database.annotations.NotNull;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@Entity
@Table(name = "tbl_l2_slabs_mapping")
@Setter
@Getter
public class L2slabsMapping {
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE)
private Long id;
@NotNull
@Column(length=500)
private int minval;
@NotNull
@Column(length=500)
private int maxval;
private int SBA;
private int CBA;
private int Partner;
private int Senior_Partner;
}
package com.iRecruit.modules.auth.model;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.NotBlank;
import com.google.firebase.database.annotations.NotNull;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@Entity
@Table(name = "tbl_mdb_mapping")
@Setter
@Getter
public class MDBMapping {
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE)
private Long id;
@NotNull
@Column(length=500)
private int monthly_ep_18;
@NotNull
@Column(length=500)
private int monthly_ep_36;
private int monthly_ep_72;
private int monthly_ep_144;
private int MDB;
}
package com.iRecruit.modules.auth.model;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.NotBlank;
import com.google.firebase.database.annotations.NotNull;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@Entity
@Table(name = "tbl_mpb_mapping")
@Setter
@Getter
public class MpbMapping {
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE)
private Long id;
@NotNull
@Column(length=500)
private int mapping_DT_minimum_fyc;
@NotNull
@Column(length=500)
private int DT;
private int L1;
private int L2;
private String Designation;
}
package com.iRecruit.modules.auth.model;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.NotBlank;
import com.google.firebase.database.annotations.NotNull;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@Entity
@Table(name = "tbl_msa_mapping")
@Setter
@Getter
public class MsaMapping {
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE)
private Long id;
private int MSA_1;
private int MSA_2;
private int MSA_3;
private int MSA_4;
}
package com.iRecruit.modules.auth.model;
public class PushNotificationRequest {
private String title;
private String message;
private String topic;
private String token;
public PushNotificationRequest() {
}
public PushNotificationRequest(String title, String messageBody, String topicName) {
this.title = title;
this.message = messageBody;
this.topic = topicName;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public String getTopic() {
return topic;
}
public void setTopic(String topic) {
this.topic = topic;
}
public String getToken() {
return token;
}
public void setToken(String token) {
this.token = token;
}
}
package com.iRecruit.modules.auth.model;
public class PushNotificationResponse {
private int status;
private String message;
public PushNotificationResponse() {
}
public PushNotificationResponse(int status, String message) {
this.status = status;
this.message = message;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
}
package com.iRecruit.modules.auth.model;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.Table;
import javax.validation.constraints.NotBlank;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import com.iRecruit.constant.TemplateType;
import lombok.Getter;
import lombok.Setter;
@Entity
@Table(name = "tbl_templates")
@Setter
@Getter
public class Templates{
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE)
private Long id;
@NotBlank
@Column(length=50)
private String config;
@NotBlank
@Lob
private String value;
@Enumerated(EnumType.STRING)
private TemplateType type;
}
package com.iRecruit.modules.auth.model;
import java.sql.Timestamp;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.Id;
import javax.persistence.Table;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import com.iRecruit.constant.RolesConstant;
import com.iRecruit.constant.Status;
import lombok.Getter;
import lombok.Setter;
@Entity
@Table(name = "naaf_user_detail")
@Setter
@Getter
@EntityListeners(AuditingEntityListener.class)
public class User {
@Id
@Column(length=10)
private String id;
@Column(length=11)
private String userId;
@Column(length=200)
private String firstName;
@Column(length=200)
private String lastName;
@Column(length=30)
private String userRole;
@Column(length=100)
private String emailId;
@Column(length=40)
private String mobileNo;
@Column(length=11)
private String managerUserId;
@Column(length=11)
private String adoaId;
@Column(length=11)
private String doaId;
@Column(length=1)
private String isActive;
@Column(length=8)
private Timestamp createDate;
@Column(length=8)
private Timestamp modifiedDate;
@Column(length=11)
private String level1NtId;
@Column(length=11)
private String level5NtId;
@Column(length=3)
private String level1DesignationCode;
@Column(length=5)
private String branchCode;
@Column(length=100)
private String officeName;
@Column(length=63)
private String userRole1;
@Column(length=30)
private String branchCdLevel1;
@Column(length=63)
private String userRole2;
@Column(length=30)
private String level2DesignationC0de;
@Column(length=30)
private String branchCdLevel2;
@Column(length=63)
private String userRole3;
@Column(length=30)
private String level3DesignationC0de;
@Column(length=30)
private String branchCdLevel3;
@Column(length=63)
private String userRole4;
@Column(length=30)
private String level4DesignationC0de;
@Column(length=30)
private String branchCdLevel4;
@Column(length=63)
private String userRole5;
@Column(length=30)
private String level5DesignationC0de;
@Column(length=30)
private String branchCdLevel5;
@Column(length=10)
private String baType;
private Long baRank;
@Column(length=1)
private String gender;
@Column(length=20)
private String dob;
@Column(length=50)
private String branchName;
@Column(length=20)
private String middleName;
@Column(length=5)
private String designation;
@Column(length=10)
private String pan;
@Column(length=1)
private String agentStatus;
@Enumerated(EnumType.STRING)
protected Status status = Status.ACTIVE;
@Enumerated(EnumType.STRING)
private RolesConstant role = RolesConstant.LEADER;
private String notificationId;
private int failedAttemptLogin = 0;
public User(){}
// Getters and Setters ... (Omitted for brevity)
}
\ No newline at end of file
package com.iRecruit.modules.auth.model;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Parameter;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import com.iRecruit.config.IdGenerator;
import com.iRecruit.constant.Status;
import lombok.Getter;
import lombok.Setter;
@Entity
@Table(name = "tbl_userOTP")
@EntityListeners(AuditingEntityListener.class)
@Setter
@Getter
public class UserOTP extends Auditable<Long>{
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "user_otp_seq")
@GenericGenerator(
name = "user_otp_seq",
strategy = "com.iRecruit.config.IdGenerator",
parameters = {
@Parameter(name = IdGenerator.INCREMENT_PARAM, value = "1"),
@Parameter(name = IdGenerator.VALUE_PREFIX_PARAMETER, value = "UO"),
@Parameter(name = IdGenerator.NUMBER_FORMAT_PARAMETER, value = "%08d")})
@Column(length=10)
private String id;
@NotNull
// @OneToOne(cascade = CascadeType.ALL,fetch = FetchType.LAZY)
// @JoinColumn(name = "user_id")
private String userId;
@NotBlank
private String OTP;
@Enumerated(EnumType.STRING)
protected Status status = Status.INIT;
public Status getStatus() {
return status;
}
}
package com.iRecruit.modules.auth.payload;
import com.iRecruit.modules.auth.model.AuditLogs;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
@Setter
@Getter
@ToString
@NoArgsConstructor
@AllArgsConstructor
public class AuditLogsDto {
private Long id;
private String service;
private String sourceIp;
private String deviceInfo;
private String browserInfo;
private String username;
private int status;
private String errorMsg;
private Long timeTaken;
private String requestObj;
private String responseObj;
private String OS;
public AuditLogsDto (AuditLogs audioLogs){
this.id = audioLogs.getId();
this.service = audioLogs.getService();
this.sourceIp = audioLogs.getSourceIp();
this.deviceInfo = audioLogs.getDeviceInfo();
this.browserInfo = audioLogs.getBrowserInfo();
this.username = audioLogs.getUsername();
this.status = audioLogs.getStatusCode();
this.errorMsg = audioLogs.getErrorMsg();
this.timeTaken = audioLogs.getTimeTaken();
this.requestObj = audioLogs.getRequestObj();
this.responseObj = audioLogs.getResponseObj();
this.OS = audioLogs.getOS();
}
}
package com.iRecruit.modules.auth.payload;
import javax.validation.constraints.NotBlank;
import com.iRecruit.modules.auth.model.Configurations;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
@Setter
@Getter
@ToString
@NoArgsConstructor
@AllArgsConstructor
public class ConfigurationsDto{
@NotBlank
private String key;
@NotBlank
private String value;
private String description;
public ConfigurationsDto(Configurations configurations) {
this.key = configurations.getConfig();
this.value = configurations.getValue();
this.description = configurations.getDescription();
}
}
package com.iRecruit.modules.auth.payload;
import lombok.Getter;
import lombok.Setter;
@Setter
@Getter
public class IdDto {
private String id;
}
package com.iRecruit.modules.auth.payload;
import javax.validation.constraints.NotBlank;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.iRecruit.constant.RolesConstant;
import com.iRecruit.constant.Status;
import com.iRecruit.modules.auth.model.Configurations;
import com.iRecruit.modules.auth.model.FycMapping;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.iRecruit.modules.auth.model.MpbMapping;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.iRecruit.modules.auth.model.L1slabsMapping;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
@Setter
@Getter
@Builder
@NoArgsConstructor
@AllArgsConstructor
@JsonInclude(Include.NON_NULL)
public class L1slabsDto {
private Long Id;
private int maxval;
private int minval;
private int BA;
private int SBA;
private int CBA;
private int Partner;
private int Senior_Partner;
public L1slabsDto(L1slabsMapping l1slabsmapping) {
this.Id = l1slabsmapping.getId();
this.maxval = l1slabsmapping.getMaxval();
this.minval = l1slabsmapping.getMinval();
this.BA = l1slabsmapping.getBA();
this.SBA = l1slabsmapping.getSBA();
this.CBA = l1slabsmapping.getCBA();
this.Partner = l1slabsmapping.getPartner();
this.Senior_Partner = l1slabsmapping.getSenior_Partner();
}
}
package com.iRecruit.modules.auth.payload;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.iRecruit.modules.auth.model.L2slabsMapping;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
@Setter
@Getter
@Builder
@NoArgsConstructor
@AllArgsConstructor
@JsonInclude(Include.NON_NULL)
public class L2slabsDto {
private Long Id;
private int maxval;
private int minval;
private int SBA;
private int CBA;
private int Partner;
private int Senior_Partner;
public L2slabsDto(L2slabsMapping l2slabsmapping) {
this.Id = l2slabsmapping.getId();
this.maxval = l2slabsmapping.getMaxval();
this.minval = l2slabsmapping.getMinval();
this.SBA = l2slabsmapping.getSBA();
this.CBA = l2slabsmapping.getCBA();
this.Partner = l2slabsmapping.getPartner();
this.Senior_Partner = l2slabsmapping.getSenior_Partner();
}
}
package com.iRecruit.modules.auth.payload;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.iRecruit.modules.auth.model.MDBMapping;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
@Setter
@Getter
@Builder
@NoArgsConstructor
@AllArgsConstructor
@JsonInclude(Include.NON_NULL)
public class MDBDto {
private Long ID;
private int monthly_ep_18;
private int monthly_ep_36;
private int monthly_ep_72;
private int monthly_ep_144;
private int MDB;
public MDBDto(MDBMapping mdbmapping) {
this.ID = mdbmapping.getId();
this.monthly_ep_18 = mdbmapping.getMonthly_ep_18();
this.monthly_ep_36 = mdbmapping.getMonthly_ep_36();
this.monthly_ep_72 = mdbmapping.getMonthly_ep_72();
this.monthly_ep_144 = mdbmapping.getMonthly_ep_144();
this.MDB = mdbmapping.getMDB();
}
}
package com.iRecruit.modules.auth.payload;
import javax.validation.constraints.NotBlank;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.iRecruit.constant.RolesConstant;
import com.iRecruit.constant.Status;
import com.iRecruit.modules.auth.model.Configurations;
import com.iRecruit.modules.auth.model.FycMapping;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.iRecruit.modules.auth.model.MpbMapping;
import com.iRecruit.modules.auth.model.MsaMapping;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
@Setter
@Getter
@Builder
@NoArgsConstructor
@AllArgsConstructor
@JsonInclude(Include.NON_NULL)
public class MsaDto {
private Long Id;
private int MSA_1;
private int MSA_2;
private int MSA_3;
private int MSA_4;
public MsaDto(MsaMapping msaMapping) {
this.Id = msaMapping.getId();
this.MSA_1 = msaMapping.getMSA_1();
this.MSA_2 = msaMapping.getMSA_2();
this.MSA_3 = msaMapping.getMSA_3();
this.MSA_4 = msaMapping.getMSA_4();
}
}
package com.iRecruit.modules.auth.payload;
import lombok.Getter;
import lombok.Setter;
@Setter
@Getter
public class OTPResponse {
private String leadId;
private String mobileNo;
private String emailId;
private String serviceName;
private Boolean status;
}
package com.iRecruit.modules.auth.payload;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@Setter
@Getter
@NoArgsConstructor
@AllArgsConstructor
public class P100LoginResponse {
private String leadId;
private String mobileNo;
private String emailId;
private String serviceName;
private Boolean loginStatus;
public P100LoginResponse(Boolean loginStatus) {
this.loginStatus = loginStatus;
}
}
package com.iRecruit.modules.auth.payload;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
@Setter
@Getter
@ToString
@NoArgsConstructor
@AllArgsConstructor
public class RoleDto {
private Long id;
private String name;
}
package com.iRecruit.modules.auth.payload;
import javax.validation.constraints.NotBlank;
import com.iRecruit.constant.TemplateType;
import com.iRecruit.modules.auth.model.Templates;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
@Setter
@Getter
@ToString
@NoArgsConstructor
@AllArgsConstructor
public class TemplatesDto{
@NotBlank
private String key;
@NotBlank
private String value;
private TemplateType type;
public TemplatesDto(Templates template) {
this.key = template.getConfig();
this.value = template.getValue();
this.type = template.getType();
}
}
package com.iRecruit.modules.auth.payload;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.iRecruit.constant.RolesConstant;
import com.iRecruit.constant.Status;
import com.iRecruit.modules.auth.model.User;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
@Setter
@Getter
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ToString
@JsonInclude(Include.NON_NULL)
public class UserDto {
private String id;
@NotBlank
private String name;
@NotNull
@Pattern(regexp="^[0-9]{10}",message="length must be 10")
private String mobileNumber;
private String email;
@Enumerated(EnumType.STRING)
protected Status status = Status.ACTIVE;
@NotNull
@Enumerated(EnumType.STRING)
private RolesConstant role;
private String notificationId;
private int failedAttemptLogin = 0;
public UserDto(User user) {
this.id = user.getId();
// this.status = user.getStatus();
this.name = user.getFirstName();
this.mobileNumber = user.getMobileNo();
this.email = user.getEmailId();
this.notificationId = user.getNotificationId();
this.failedAttemptLogin = user.getFailedAttemptLogin();
this.role = user.getRole();
}
}
\ No newline at end of file
package com.iRecruit.modules.auth.payload;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.iRecruit.constant.Status;
import com.iRecruit.modules.auth.model.UserOTP;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
@Setter
@Getter
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ToString
@JsonInclude(Include.NON_NULL)
public class UserOTPDto {
private Long referenceId;
private String id;
private Status status;
public UserOTPDto(UserOTP userOTP){
this.id = userOTP.getId();
this.status = userOTP.getStatus();
}
}
\ No newline at end of file
package com.iRecruit.modules.auth.payload;
import javax.validation.constraints.NotBlank;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.iRecruit.constant.RolesConstant;
import com.iRecruit.constant.Status;
import com.iRecruit.modules.auth.model.Configurations;
import com.iRecruit.modules.auth.model.FycMapping;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
@Setter
@Getter
@Builder
@NoArgsConstructor
@AllArgsConstructor
@JsonInclude(Include.NON_NULL)
public class fycDto {
private int maxval;
private int mival;
private int per;
private Long Id;
public fycDto(FycMapping fycMapping) {
this.Id = fycMapping.getId();
this.maxval = fycMapping.getMaxval();
this.mival = fycMapping.getMinval();
this.per = fycMapping.getPer();
}
}
package com.iRecruit.modules.auth.payload;
import javax.validation.constraints.NotBlank;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.iRecruit.constant.RolesConstant;
import com.iRecruit.constant.Status;
import com.iRecruit.modules.auth.model.Configurations;
import com.iRecruit.modules.auth.model.FycMapping;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.iRecruit.modules.auth.model.MpbMapping;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
@Setter
@Getter
@Builder
@NoArgsConstructor
@AllArgsConstructor
@JsonInclude(Include.NON_NULL)
public class mpbDto {
private int mapping_DT_minimum_fyc;
private int DT;
private int L1;
private int L2;
private String Designation;
private Long Id;
public mpbDto(MpbMapping mpbMapping) {
this.Id = mpbMapping.getId();
this.mapping_DT_minimum_fyc = mpbMapping.getMapping_DT_minimum_fyc();
this.DT = mpbMapping.getDT();
this.L1 = mpbMapping.getL1();
this.L2 = mpbMapping.getL2();
this.Designation = mpbMapping.getDesignation();
}
}
package com.iRecruit.modules.auth.payload.request;
import com.iRecruit.modules.auth.model.FycMapping;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class ApiResponse {
private int code;
private Boolean success;
private String message;
private Object responseObj;
public ApiResponse(int code, Boolean success,String message,Object responseObj) {
super();
this.code = code;
this.success = success;
this.message = message;
this.responseObj = responseObj;
}
}
package com.iRecruit.modules.auth.payload.request;
import org.json.JSONObject;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class Apiresponse1 {
private int code;
private Boolean success;
private String message;
private JSONObject responseObj;
public Apiresponse1(int code, Boolean success,String message,JSONObject responseObj) {
super();
this.code = code;
this.success = success;
this.message = message;
this.responseObj = responseObj;
}
}
package com.iRecruit.modules.auth.payload.request;
import java.util.List;
import javax.validation.constraints.NotNull;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
@Setter
@Getter
@ToString
public class Condition {
@NotNull
private String key = "";
@NotNull
private String criteria = "";
@NotNull
private Object value ;
private Boolean isGroup = false;
private String groupCondition = "and";
List<Condition> groupConditions;
}
package com.iRecruit.modules.auth.payload.request;
import lombok.Getter;
import lombok.Setter;
@Setter
@Getter
public class JwtAuthenticationResponse {
private String accessToken;
private String tokenType = "Bearer";
public JwtAuthenticationResponse(String accessToken) {
this.accessToken = accessToken;
}
}
\ No newline at end of file
package com.iRecruit.modules.auth.payload.request;
/*
* package com.iRecruit.payload;
*
* import java.util.Set;
*
* import lombok.AllArgsConstructor; import lombok.Getter; import lombok.Setter;
* import lombok.ToString;
*
* @Setter
*
* @Getter
*
* @AllArgsConstructor
*
* @ToString public class JwtCustomPayload {
*
* private String username;
*
* private Set<String> roleType;
*
* private Long tenant;
*
*
* }
*/
package com.iRecruit.modules.auth.payload.request;
import javax.validation.constraints.NotBlank;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
@Setter
@Getter
@ToString
public class LoginRequest {
@NotBlank
private String username;
@NotBlank
private String password;
private String notificationId;
private String deviceInfo;
private String OS;
private String browserInfo;
}
package com.iRecruit.modules.auth.payload.request;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
@Setter
@Getter
@ToString
public class OTPRequest {
private String leadId;
private String mobileNo;
private String emailId;
private String serviceName;
}
package com.iRecruit.modules.auth.payload.request;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
@Setter
@Getter
@ToString
public class OTPValidateRequest {
private String id;
private String leadId;
private String otp;
}
package com.iRecruit.modules.auth.payload.request;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
@Setter
@Getter
@ToString
public class P100LoginRequest {
private String leadId;
private String password;
private String mobileNo;
private String emailId;
private String serviceName;
}
package com.iRecruit.modules.auth.payload.request;
import java.util.ArrayList;
import java.util.List;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
@Setter
@Getter
@ToString
public class PaginationRequest {
private int pageNo = 0;
private int pageSize = 200000;
private String sortBy = "id";
private List<Condition> query = new ArrayList<Condition>();
private String date;
}
package com.iRecruit.modules.auth.payload.request;
import javax.validation.constraints.Email;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
@Setter
@Getter
@ToString
public class SignUpRequest {
@NotNull
private String userId;
@NotNull
private String OTP;
@NotNull
private Long referenceId;
private String firstName;
private String middleName;
private String lastName;
@Size(max = 40)
@Email
private String email;
@Size(max = 100)
private String password;
}
package com.iRecruit.modules.auth.payload.request;
import javax.validation.constraints.NotNull;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
@Setter
@Getter
@ToString
public class UpdateTenantRequest {
@NotNull
private Long tenant;
}
package com.iRecruit.modules.auth.payload.request;
import javax.validation.constraints.NotNull;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
@Setter
@Getter
@ToString
public class setTenantRequest {
@NotNull
private Long tenant;
}
package com.iRecruit.modules.auth.repository;
import org.springframework.data.jpa.repository.JpaRepository;
import com.iRecruit.modules.auth.model.AuditLogs;
public interface AuditLogsRepository extends JpaRepository<AuditLogs, Long> {
}
package com.iRecruit.modules.auth.repository;
import java.util.Optional;
import org.springframework.data.jpa.repository.JpaRepository;
import com.iRecruit.modules.auth.model.Configurations;
public interface ConfigurationsRepository extends JpaRepository<Configurations, Long>{
Optional<Configurations> findByConfig(String key);
}
package com.iRecruit.modules.auth.repository;
import java.util.Optional;
import org.springframework.data.jpa.repository.JpaRepository;
import com.iRecruit.modules.auth.model.FycMapping;
public interface FycRepository extends JpaRepository<FycMapping, Long>{
Optional<FycMapping> findById(String key);
}
package com.iRecruit.modules.auth.repository;
import java.util.Optional;
import org.springframework.data.jpa.repository.JpaRepository;
import com.iRecruit.modules.auth.model.L1slabsMapping;
public interface L1slabsRepository extends JpaRepository<L1slabsMapping, Long> {
Optional<L1slabsMapping> findById(String key);
}
package com.iRecruit.modules.auth.repository;
import java.util.Optional;
import org.springframework.data.jpa.repository.JpaRepository;
import com.iRecruit.modules.auth.model.L2slabsMapping;
public interface L2slabsRepository extends JpaRepository<L2slabsMapping, Long> {
Optional<L2slabsMapping> findById(String key);
}
package com.iRecruit.modules.auth.repository;
import java.util.Optional;
import org.springframework.data.jpa.repository.JpaRepository;
import com.iRecruit.modules.auth.model.MDBMapping;
public interface MDBRepository extends JpaRepository<MDBMapping, Long> {
Optional<MDBMapping> findById(String key);
}
package com.iRecruit.modules.auth.repository;
import java.util.Optional;
import org.springframework.data.jpa.repository.JpaRepository;
import com.iRecruit.modules.auth.model.MpbMapping;
public interface MpbRepository extends JpaRepository<MpbMapping, Long> {
Optional<MpbMapping> findById(String key);
}
package com.iRecruit.modules.auth.repository;
import java.util.Optional;
import org.springframework.data.jpa.repository.JpaRepository;
import com.iRecruit.modules.auth.model.MsaMapping;
public interface MsaRepository extends JpaRepository<MsaMapping, Long>{
Optional<MsaMapping> findById(String key);
}
package com.iRecruit.modules.auth.repository;
import java.util.Optional;
import org.springframework.data.jpa.repository.JpaRepository;
import com.iRecruit.modules.auth.model.Templates;
public interface TemplatesRepository extends JpaRepository<Templates, Long>{
Optional<Templates> findByConfig(String key);
}
package com.iRecruit.modules.auth.repository;
import java.sql.Timestamp;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import com.iRecruit.modules.auth.model.UserOTP;
public interface UserOTPRepository extends JpaRepository<UserOTP, String>, JpaSpecificationExecutor<UserOTP>{
@Query("select createdTs FROM UserOTP where id = :id and userId = :userId and OTP = :OTP")
Timestamp validateOTP(@Param("id") String id, @Param("userId") String userId, @Param("OTP") String OTP);
}
package com.iRecruit.modules.auth.repository;
import java.util.List;
import java.util.Optional;
import org.springframework.data.jpa.repository.JpaRepository;
import com.iRecruit.modules.auth.model.User;
public interface UserRepository extends JpaRepository<User, String>{
// List<User> findAll();
/*List<User> findByName(String name);*/
Optional<User> findById(String id);
List<User> findByIdIn(List<Long> ids);
}
package com.iRecruit.modules.auth.service;
import com.iRecruit.modules.auth.model.AuditLogs;
import com.iRecruit.modules.auth.payload.AuditLogsDto;
public interface AuditLogsService {
public AuditLogs save(AuditLogsDto auditLogsDto);
}
package com.iRecruit.modules.auth.service;
import java.util.List;
import com.iRecruit.modules.auth.model.Configurations;
import com.iRecruit.modules.auth.payload.ConfigurationsDto;
public interface ConfigurationsService {
public Configurations save(ConfigurationsDto key,Boolean isCreate);
public List<Configurations> findAll();
public Configurations findByKey(String key);
}
package com.iRecruit.modules.auth.service;
import java.io.File;
import javax.mail.Message;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.FileSystemResource;
import org.springframework.mail.MailException;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.mail.javamail.MimeMessageHelper;
import org.springframework.mail.javamail.MimeMessagePreparator;
import org.springframework.stereotype.Service;
@Service("emailService")
public class EmailService
{
@Autowired
private JavaMailSender mailSender;
private SimpleMailMessage preConfiguredMessage;
/**
* This method will send compose and send the message
* */
public void sendMail(String to, String subject, String body)
{
SimpleMailMessage message = new SimpleMailMessage();
message.setTo(to);
message.setSubject(subject);
message.setText(body);
mailSender.send(message);
}
/**
* This method will send a pre-configured message
* */
public void sendPreConfiguredMail(String message)
{
SimpleMailMessage mailMessage = new SimpleMailMessage(preConfiguredMessage);
mailMessage.setText(message);
mailSender.send(mailMessage);
}
public void sendMailWithAttachment(String to, String subject, String body, String fileToAttach)
{
MimeMessagePreparator preparator = new MimeMessagePreparator()
{
public void prepare(MimeMessage mimeMessage) throws Exception
{
mimeMessage.setRecipient(Message.RecipientType.TO, new InternetAddress(to));
mimeMessage.setFrom(new InternetAddress("admin@gmail.com"));
mimeMessage.setSubject(subject);
mimeMessage.setText(body);
FileSystemResource file = new FileSystemResource(new File(fileToAttach));
MimeMessageHelper helper = new MimeMessageHelper(mimeMessage, true);
helper.addAttachment("logo.jpg", file);
}
};
try {
mailSender.send(preparator);
}
catch (MailException ex) {
// simply log it and go on...
System.err.println(ex.getMessage());
}
}
public void sendMailWithInlineResources(String to, String subject, String fileToAttach)
{
MimeMessagePreparator preparator = new MimeMessagePreparator()
{
public void prepare(MimeMessage mimeMessage) throws Exception
{
mimeMessage.setRecipient(Message.RecipientType.TO, new InternetAddress(to));
mimeMessage.setFrom(new InternetAddress("admin@gmail.com"));
mimeMessage.setSubject(subject);
MimeMessageHelper helper = new MimeMessageHelper(mimeMessage, true);
helper.setText("<html><body><img src='cid:identifier1234'></body></html>", true);
FileSystemResource res = new FileSystemResource(new File(fileToAttach));
helper.addInline("identifier1234", res);
}
};
try {
mailSender.send(preparator);
}
catch (MailException ex) {
// simply log it and go on...
System.err.println(ex.getMessage());
}
}
}
package com.iRecruit.modules.auth.service;
import java.util.List;
import com.iRecruit.modules.auth.model.FycMapping;
import com.iRecruit.modules.auth.payload.fycDto;
public interface FycMappingService {
public FycMapping save(fycDto fycMapping, Boolean isCreate);
public List<FycMapping> findAll();
}
package com.iRecruit.modules.auth.service;
import java.util.List;
import com.iRecruit.modules.auth.model.FycMapping;
import com.iRecruit.modules.auth.model.L1slabsMapping;
import com.iRecruit.modules.auth.model.MpbMapping;
import com.iRecruit.modules.auth.payload.L1slabsDto;
import com.iRecruit.modules.auth.payload.mpbDto;
public interface L1slabsMappingService {
public L1slabsMapping save(L1slabsDto l1slabsmapping,Boolean isCreate);
public List<L1slabsMapping> findAll();
}
package com.iRecruit.modules.auth.service;
import java.util.List;
import com.iRecruit.modules.auth.model.L2slabsMapping;
import com.iRecruit.modules.auth.payload.L2slabsDto;
public interface L2slabsMappingService {
public L2slabsMapping save(L2slabsDto l2slabsmapping,Boolean isCreate);
public List<L2slabsMapping> findAll();
}
package com.iRecruit.modules.auth.service;
import org.json.JSONObject;
import com.iRecruit.modules.auth.controller.LeaderCalc;
import com.iRecruit.modules.auth.model.FycMapping;
import com.iRecruit.modules.auth.payload.fycDto;
public interface LeaderCalcService {
public JSONObject calculate(String data);
}
package com.iRecruit.modules.auth.service;
import java.util.List;
import com.iRecruit.modules.auth.model.MDBMapping;
import com.iRecruit.modules.auth.payload.MDBDto;
public interface MDBMappingService {
public MDBMapping save(MDBDto mdbmapping,Boolean isCreate);
public List<MDBMapping> findAll();
}
package com.iRecruit.modules.auth.service;
import java.util.List;
import com.iRecruit.modules.auth.model.MpbMapping;
import com.iRecruit.modules.auth.payload.mpbDto;
public interface MpbMappingService {
public MpbMapping save(mpbDto mpbMapping,Boolean isCreate);
public List<MpbMapping> findAll();
}
package com.iRecruit.modules.auth.service;
import java.util.List;
import com.iRecruit.modules.auth.model.MsaMapping;
import com.iRecruit.modules.auth.payload.MsaDto;
public interface MsaMappingService {
public List<MsaMapping> findAll();
public MsaMapping save(MsaDto msaMapping,Boolean isCreate);
}
package com.iRecruit.modules.auth.service;
import org.json.JSONObject;
public interface NGPACalcService {
public JSONObject prepareAllFormula(JSONObject requestJSON);
}
package com.iRecruit.modules.auth.service;
import org.json.JSONObject;
public interface NGPAtoNGPLCalcService {
public JSONObject prepareAllFormula(JSONObject requestJSON);
}
package com.iRecruit.modules.auth.service;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ExecutionException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import com.iRecruit.firebase.FCMService;
import com.iRecruit.modules.auth.model.PushNotificationRequest;
@Service
public class PushNotificationService {
@Value("#{${app.notifications.defaults}}")
private Map<String, String> defaults;
private Logger logger = LoggerFactory.getLogger(PushNotificationService.class);
private FCMService fcmService;
public PushNotificationService(FCMService fcmService) {
this.fcmService = fcmService;
}
public void sendSamplePushNotification() {
try {
fcmService.sendMessageWithoutData(getSamplePushNotificationRequest());
} catch (InterruptedException | ExecutionException e) {
logger.error(e.getMessage());
}
}
public void sendPushNotification(PushNotificationRequest request) {
try {
fcmService.sendMessage(getSamplePayloadData(), request);
} catch (InterruptedException | ExecutionException e) {
logger.error(e.getMessage());
}
}
public void sendPushNotificationWithoutData(PushNotificationRequest request) {
try {
fcmService.sendMessageWithoutData(request);
} catch (InterruptedException | ExecutionException e) {
logger.error(e.getMessage());
}
}
public void sendPushNotificationToToken(PushNotificationRequest request) {
try {
fcmService.sendMessageToToken(request);
} catch (InterruptedException | ExecutionException e) {
logger.error(e.getMessage());
}
}
private Map<String, String> getSamplePayloadData() {
Map<String, String> pushData = new HashMap<String,String>();
pushData.put("messageId", defaults.get("payloadMessageId"));
pushData.put("text", defaults.get("payloadData") + " " + LocalDateTime.now());
return pushData;
}
private PushNotificationRequest getSamplePushNotificationRequest() {
PushNotificationRequest request = new PushNotificationRequest(defaults.get("title"),
defaults.get("message"),
defaults.get("topic"));
return request;
}
}
\ No newline at end of file
package com.iRecruit.modules.auth.service;
import java.util.List;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
@Service("smsService")
public class SMSService
{
@Value("${spring.sms.url}")
private String smsURL;
RestTemplate restTemplate = new RestTemplate();
public String sendSMS(List<Long> mobileNumber,String message) {
return this.restTemplate.getForObject(smsURL, String.class);
}
}
package com.iRecruit.modules.auth.service;
import java.util.List;
import com.iRecruit.modules.auth.model.Templates;
import com.iRecruit.modules.auth.payload.TemplatesDto;
public interface TemplatesService {
public Templates save(TemplatesDto key,Boolean isCreate);
public List<Templates> findAll();
public Templates findByKey(String key);
}
package com.iRecruit.modules.auth.service;
import java.util.List;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import com.iRecruit.modules.auth.model.User;
import com.iRecruit.modules.auth.payload.UserDto;
public interface UserService {
public Page<User> findAll(Pageable pageable);
public User findById(String id);
public User save(User user);
public User save(UserDto user);
public List<User> findByIds(List<Long> userIds);
}
\ No newline at end of file
package com.iRecruit.modules.auth.service.impl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.iRecruit.modules.auth.model.AuditLogs;
import com.iRecruit.modules.auth.payload.AuditLogsDto;
import com.iRecruit.modules.auth.repository.AuditLogsRepository;
import com.iRecruit.modules.auth.service.AuditLogsService;
@Service
public class AuditLogsServiceImpl implements AuditLogsService {
@Autowired
private AuditLogsRepository auditLogsRepository;
@Override
public AuditLogs save(AuditLogsDto auditLogsDto) {
return auditLogsRepository.save(new AuditLogs(auditLogsDto));
}
}
package com.iRecruit.modules.auth.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.iRecruit.constant.DBConfig;
import com.iRecruit.exception.ResourceNotFoundException;
import com.iRecruit.modules.auth.model.Configurations;
import com.iRecruit.modules.auth.payload.ConfigurationsDto;
import com.iRecruit.modules.auth.repository.ConfigurationsRepository;
import com.iRecruit.modules.auth.service.ConfigurationsService;
@Service
public class ConfigurationsServiceImpl implements ConfigurationsService {
@Autowired
ConfigurationsRepository configRepo;
@Autowired
DBConfig DBConfig;
public Configurations save(ConfigurationsDto dto,Boolean isCreate) {
Configurations configuration = null;
if(!isCreate) {
configRepo.findByConfig(dto.getKey()).orElseThrow(()->new ResourceNotFoundException("Config","key",dto.getKey()));
}else {
configuration = new Configurations();
configuration.setConfig(dto.getKey());
}
configuration.setValue(dto.getValue());
configuration.setDescription(dto.getDescription());
DBConfig.setValue(dto.getKey(), dto.getValue());
return configRepo.save(configuration);
}
public List<Configurations> findAll(){
return configRepo.findAll();
}
public Configurations findByKey(String key) {
return configRepo.findByConfig(key).orElseThrow(()->new ResourceNotFoundException("Config","key",key));
}
}
package com.iRecruit.modules.auth.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.iRecruit.constant.LeaderCalcConfig;
import com.iRecruit.exception.ResourceNotFoundException;
import com.iRecruit.modules.auth.model.FycMapping;
import com.iRecruit.modules.auth.payload.fycDto;
import com.iRecruit.modules.auth.repository.FycRepository;
import com.iRecruit.modules.auth.service.FycMappingService;
@Service
public class FycMappingServiceImpl implements FycMappingService {
@Autowired
FycRepository fycRepo;
@Autowired
LeaderCalcConfig LeaderCalcConfig;
public FycMapping save(fycDto dto,Boolean isCreate) {
if(!isCreate) {
fycRepo.findById(dto.getId()).orElseThrow(()->new ResourceNotFoundException("fyc","key",dto.getId()));
}
FycMapping fycMapping = null;
fycMapping = new FycMapping();
fycMapping.setId(dto.getId());
fycMapping.setMaxval(dto.getMaxval());
fycMapping.setMinval(dto.getMival());
fycMapping.setPer(dto.getPer());
// DBConfig.setValue(dto.getKey(), dto.getMaxval(), dto.getMaxval(), dto.getMaxval());
return fycRepo.save(fycMapping);
}
public List<FycMapping> findAll(){
return fycRepo.findAll();
}
}
package com.iRecruit.modules.auth.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.iRecruit.constant.LeaderCalcConfig;
import com.iRecruit.exception.ResourceNotFoundException;
import com.iRecruit.modules.auth.model.L1slabsMapping;
import com.iRecruit.modules.auth.model.MpbMapping;
import com.iRecruit.modules.auth.payload.L1slabsDto;
import com.iRecruit.modules.auth.payload.mpbDto;
import com.iRecruit.modules.auth.repository.L1slabsRepository;
import com.iRecruit.modules.auth.service.L1slabsMappingService;
@Service
public class L1slabsMappingServiceImpl implements L1slabsMappingService {
@Autowired
L1slabsRepository l1slabsRepo;
@Autowired
LeaderCalcConfig LeaderCalcConfig;
@Override
public List<L1slabsMapping> findAll() {
// TODO Auto-generated method stub
return l1slabsRepo.findAll();
}
public L1slabsMapping save(L1slabsDto dto,Boolean isCreate) {
if(!isCreate) {
l1slabsRepo.findById(dto.getId()).orElseThrow(()->new ResourceNotFoundException("l1slabs","key",dto.getId()));
}
L1slabsMapping l1slabsmapping = null;
l1slabsmapping = new L1slabsMapping();
l1slabsmapping.setId(dto.getId());
l1slabsmapping.setCBA(dto.getCBA());
l1slabsmapping.setBA(dto.getBA());
l1slabsmapping.setSBA(dto.getSBA());
l1slabsmapping.setMaxval(dto.getMaxval());
l1slabsmapping.setMinval(dto.getMinval());
l1slabsmapping.setPartner(dto.getPartner());
l1slabsmapping.setSenior_Partner(dto.getSenior_Partner());
return l1slabsRepo.save(l1slabsmapping);
}
}
package com.iRecruit.modules.auth.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.iRecruit.constant.LeaderCalcConfig;
import com.iRecruit.exception.ResourceNotFoundException;
import com.iRecruit.modules.auth.model.L2slabsMapping;
import com.iRecruit.modules.auth.payload.L2slabsDto;
import com.iRecruit.modules.auth.repository.L2slabsRepository;
import com.iRecruit.modules.auth.service.L2slabsMappingService;
@Service
public class L2slabsMappingServiceImpl implements L2slabsMappingService {
@Autowired
L2slabsRepository l2slabsRepo;
@Autowired
LeaderCalcConfig LeaderCalcConfig;
@Override
public List<L2slabsMapping> findAll() {
// TODO Auto-generated method stub
return l2slabsRepo.findAll();
}
public L2slabsMapping save(L2slabsDto dto,Boolean isCreate) {
if(!isCreate) {
l2slabsRepo.findById(dto.getId()).orElseThrow(()->new ResourceNotFoundException("l2slabs","key",dto.getId()));
}
L2slabsMapping l2slabsmapping = null;
l2slabsmapping = new L2slabsMapping();
l2slabsmapping.setId(dto.getId());
l2slabsmapping.setCBA(dto.getCBA());
l2slabsmapping.setSBA(dto.getSBA());
l2slabsmapping.setMaxval(dto.getMaxval());
l2slabsmapping.setMinval(dto.getMinval());
l2slabsmapping.setPartner(dto.getPartner());
l2slabsmapping.setSenior_Partner(dto.getSenior_Partner());
return l2slabsRepo.save(l2slabsmapping);
}
}
package com.iRecruit.modules.auth.service.impl;
import java.util.List;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.google.gson.JsonObject;
import com.iRecruit.constant.LeaderCalcConfig;
import com.iRecruit.constant.TemplateConfig;
import com.iRecruit.exception.ResourceNotFoundException;
import com.iRecruit.modules.auth.controller.LeaderCalc;
import com.iRecruit.modules.auth.service.FycMappingService;
import com.iRecruit.modules.auth.service.LeaderCalcService;
import com.iRecruit.constant.LeaderCalcConfig;
@Service
public class LeaderCalcServiceImpl implements LeaderCalcService {
@Autowired
LeaderCalcConfig leaderCalcConfig;
public JSONObject calculate(String data) {
JSONObject InputData = new JSONObject(data);
JSONObject Calc_JSON = InputData.getJSONObject("CALC_JSON");
String leader_code = Calc_JSON.getString("LEADER_CODE");
String leader_designation = Calc_JSON.getString("LEADER_DESIGNATION");
String leader_name = Calc_JSON.getString("LEADER_NAME");
String leader_firm_name = Calc_JSON.getString("LEADER_FIRM_NAME");
double ELIGIBLE_PREMIUM = Calc_JSON.getDouble("ELIGIBLE_PREMIUM");
double COMMISION_RATE = Calc_JSON.getDouble("COMMISION_RATE");
JSONObject NGPA_Inputs_DT = InputData.getJSONObject("CALC_JSON").getJSONObject("DT")
.getJSONObject("NGPA_INPUTS");
JSONObject NGPA_Inputs_L1 = InputData.getJSONObject("CALC_JSON").getJSONObject("L1")
.getJSONObject("NGPA_INPUTS");
JSONObject NGPA_Inputs_L2 = InputData.getJSONObject("CALC_JSON").getJSONObject("L2")
.getJSONObject("NGPA_INPUTS");
JSONObject BAU_Inputs_DT = InputData.getJSONObject("CALC_JSON").getJSONObject("DT").getJSONObject("BAU_INPUTS");
JSONObject BAU_Inputs_L1 = InputData.getJSONObject("CALC_JSON").getJSONObject("L1").getJSONObject("BAU_INPUTS");
JSONObject BAU_Inputs_L2 = InputData.getJSONObject("CALC_JSON").getJSONObject("L2").getJSONObject("BAU_INPUTS");
JSONObject BAU_Inputs2_DT = InputData.getJSONObject("CALC_JSON").getJSONObject("DT")
.getJSONObject("BAU_INPUTS_2");
JSONObject BAU_Inputs2_L1 = InputData.getJSONObject("CALC_JSON").getJSONObject("L1")
.getJSONObject("BAU_INPUTS_2");
JSONObject BAU_Inputs2_L2 = InputData.getJSONObject("CALC_JSON").getJSONObject("L2")
.getJSONObject("BAU_INPUTS_2");
double NGPA_Dt = NGPA_Inputs_DT.getDouble("NGPA_DT");
double NOP_NGPA_Dt = NGPA_Inputs_DT.getDouble("NOP_NGPA_DT");
double CASE_SIZE_PER_NOP_Dt = NGPA_Inputs_DT.getDouble("CASE_SIZE_PER_NOP_DT");
double NGPA_L1 = NGPA_Inputs_L1.getDouble("NGPA_L1");
double NOP_NGPA_L1 = NGPA_Inputs_L1.getDouble("NOP_NGPA_L1");
double CASE_SIZE_PER_NOP_L1 = NGPA_Inputs_L1.getDouble("CASE_SIZE_PER_NOP_L1");
double NGPA_L2 = NGPA_Inputs_L2.getDouble("NGPA_L2");
double NOP_NGPA_L2 = NGPA_Inputs_L2.getDouble("NOP_NGPA_L2");
double CASE_SIZE_PER_NOP_L2 = NGPA_Inputs_L2.getDouble("CASE_SIZE_PER_NOP_L2");
NGPA_Inputs_DT.put("TOTAL_NGPA_WNBP_DT", Multiplication(NGPA_Dt, NOP_NGPA_Dt, CASE_SIZE_PER_NOP_Dt));
NGPA_Inputs_L1.put("TOTAL_NGPA_WNBP_L1", Multiplication(NGPA_L1, NOP_NGPA_L1, CASE_SIZE_PER_NOP_L1));
NGPA_Inputs_L2.put("TOTAL_NGPA_WNBP_L2", Multiplication(NGPA_L2, NOP_NGPA_L2, CASE_SIZE_PER_NOP_L2));
double Total_NGPA_WNBP_Dt = NGPA_Inputs_DT.getDouble("TOTAL_NGPA_WNBP_DT");
double Total_NGPA_WNBP_L1 = NGPA_Inputs_L1.getDouble("TOTAL_NGPA_WNBP_L1");
double Total_NGPA_WNBP_L2 = NGPA_Inputs_L2.getDouble("TOTAL_NGPA_WNBP_L2");
NGPA_Inputs_DT.put("TOTAL_NGPA_EP_1.25_DT", Multiplication(Total_NGPA_WNBP_Dt, ELIGIBLE_PREMIUM, 1));
NGPA_Inputs_L1.put("TOTAL_NGPA_EP_1.25_L1", Multiplication(Total_NGPA_WNBP_L1, ELIGIBLE_PREMIUM, 1));
NGPA_Inputs_L2.put("TOTAL_NGPA_EP_1.25_L2", Multiplication(Total_NGPA_WNBP_L2, ELIGIBLE_PREMIUM, 1));
JSONObject Total = new JSONObject();
Calc_JSON.put("TOTAL", Total);
JSONObject NGPA_INPUTS = new JSONObject();
JSONObject BAU_INPUTS = new JSONObject();
JSONObject BAU_INPUTS_2 = new JSONObject();
JSONObject TOTAL = InputData.getJSONObject("CALC_JSON").getJSONObject("TOTAL");
TOTAL.put("NGPA_INPUTS", NGPA_INPUTS);
TOTAL.put("BAU_INPUTS", BAU_INPUTS);
TOTAL.put("BAU_INPUTS_2", BAU_INPUTS_2);
JSONObject NGPA_Inputs_TOTAL = TOTAL.getJSONObject("NGPA_INPUTS");
double TOTAL_NGPA_EP_125_DT = NGPA_Inputs_DT.getDouble("TOTAL_NGPA_EP_1.25_DT");
double TOTAL_NGPA_EP_125_L1 = NGPA_Inputs_L1.getDouble("TOTAL_NGPA_EP_1.25_L1");
double TOTAL_NGPA_EP_125_L2 = NGPA_Inputs_L2.getDouble("TOTAL_NGPA_EP_1.25_L2");
NGPA_Inputs_TOTAL.put("TOTAL_NGPA", Addition(NGPA_Dt, NGPA_L1, NGPA_L2));
NGPA_Inputs_TOTAL.put("TOTAL_NGPA_WNBP_TOTAL",
Addition(Total_NGPA_WNBP_Dt, Total_NGPA_WNBP_L1, Total_NGPA_WNBP_L2));
NGPA_Inputs_TOTAL.put("TOTAL_NGPA_EP_1.25_TOTAL",
Addition(TOTAL_NGPA_EP_125_DT, TOTAL_NGPA_EP_125_L1, TOTAL_NGPA_EP_125_L2));
NGPA_Inputs_TOTAL.put("TOTAL_CASE_SIZE_PER_NOP", Average(Double.valueOf(CASE_SIZE_PER_NOP_Dt),
Double.valueOf(CASE_SIZE_PER_NOP_L1), Double.valueOf(CASE_SIZE_PER_NOP_L2)));
double TOTAL_NGPA_WNBP_TOTAL = NGPA_Inputs_TOTAL.getDouble("TOTAL_NGPA_WNBP_TOTAL");
double TOTAL_CASE_SIZE_PER_NOP = NGPA_Inputs_TOTAL.getDouble("TOTAL_CASE_SIZE_PER_NOP");
NGPA_Inputs_TOTAL.put("TOTAL_NOP_NGPA",
Double.valueOf(TOTAL_NGPA_WNBP_TOTAL) / Double.valueOf(TOTAL_CASE_SIZE_PER_NOP));
// BAU table
double Active_Agent_BAU_Dt = BAU_Inputs_DT.getDouble("ACTIVE_AGENT_BAU_DT");
double NOP_NGPA_BAU_Dt = BAU_Inputs_DT.getDouble("NOP_AGENT_BAU_DT");
double CASE_SIZE_PER_NOP_BAU_Dt = BAU_Inputs_DT.getDouble("CASE_SIZE_PER_NOP_BAU_DT");
double Active_Agent_BAU_L1 = BAU_Inputs_L1.getDouble("ACTIVE_AGENT_BAU_L1");
double NOP_NGPA_BAU_L1 = BAU_Inputs_L1.getDouble("NOP_AGENT_BAU_L1");
double CASE_SIZE_PER_NOP_BAU_L1 = BAU_Inputs_L1.getDouble("CASE_SIZE_PER_NOP_BAU_L1");
double Active_Agent_BAU_L2 = BAU_Inputs_L2.getDouble("ACTIVE_AGENT_BAU_L2");
double NOP_NGPA_BAU_L2 = BAU_Inputs_L2.getDouble("NOP_AGENT_BAU_L2");
double CASE_SIZE_PER_NOP_BAU_L2 = BAU_Inputs_L2.getDouble("CASE_SIZE_PER_NOP_BAU_L2");
BAU_Inputs_DT.put("TOTAL_BAU_WNBP_DT",
Multiplication(Active_Agent_BAU_Dt, NOP_NGPA_BAU_Dt, CASE_SIZE_PER_NOP_BAU_Dt));
BAU_Inputs_L1.put("TOTAL_BAU_WNBP_L1",
Multiplication(Active_Agent_BAU_L1, NOP_NGPA_BAU_L1, CASE_SIZE_PER_NOP_BAU_L1));
BAU_Inputs_L2.put("TOTAL_BAU_WNBP_L2",
Multiplication(Active_Agent_BAU_L2, NOP_NGPA_BAU_L2, CASE_SIZE_PER_NOP_BAU_L2));
JSONObject BAU_Inputs_TOTAL = TOTAL.getJSONObject("BAU_INPUTS");
BAU_Inputs_TOTAL.put("TOTAL_ACTIVE_AGENT_BAU",
Addition(Active_Agent_BAU_Dt, NOP_NGPA_BAU_Dt, CASE_SIZE_PER_NOP_BAU_Dt));
double TOTAL_BAU_WNBP_DT = BAU_Inputs_DT.getDouble("TOTAL_BAU_WNBP_DT");
double TOTAL_BAU_WNBP_L1 = BAU_Inputs_L1.getDouble("TOTAL_BAU_WNBP_L1");
double TOTAL_BAU_WNBP_L2 = BAU_Inputs_L2.getDouble("TOTAL_BAU_WNBP_L2");
BAU_Inputs_TOTAL.put("TOTAL_BAU_WNBP_TOATL", Addition(TOTAL_BAU_WNBP_DT, TOTAL_BAU_WNBP_L1, TOTAL_BAU_WNBP_L2));
BAU_Inputs_TOTAL.put("TOTAL_CASE_SIZE_PER_NOP_BAU", Average(Double.valueOf(CASE_SIZE_PER_NOP_BAU_Dt),
Double.valueOf(CASE_SIZE_PER_NOP_BAU_L1), Double.valueOf(CASE_SIZE_PER_NOP_BAU_L2)));
double TOTAL_BAU_WNBP_TOATL = BAU_Inputs_TOTAL.getDouble("TOTAL_BAU_WNBP_TOATL");
double TOTAL_CASE_SIZE_PER_NOP_BAU = BAU_Inputs_TOTAL.getDouble("TOTAL_CASE_SIZE_PER_NOP_BAU");
BAU_Inputs_TOTAL.put("TOTAL_NOP_AGENT_BAU",
Double.valueOf(TOTAL_BAU_WNBP_TOATL) / Double.valueOf(TOTAL_CASE_SIZE_PER_NOP_BAU));
// BAU2 table
double ACTIVE_AGENT_LP_DT = BAU_Inputs2_DT.getDouble("ACTIVE_AGENT_LP_DT");
double WNBP_LP_DT = BAU_Inputs2_DT.getDouble("WNBP_LP_DT");
double PA_DT = BAU_Inputs2_DT.getDouble("PA_DT");
double WNBP_NLA_DT = BAU_Inputs2_DT.getDouble("WNBP_NLA_DT");
double ACTIVE_AGENT_LP_L1 = BAU_Inputs2_L1.getDouble("ACTIVE_AGENT_LP_L1");
double WNBP_LP_L1 = BAU_Inputs2_L1.getDouble("WNBP_LP_L1");
double PA_L1 = BAU_Inputs2_L1.getDouble("PA_L1");
double WNBP_NLA_L1 = BAU_Inputs2_L1.getDouble("WNBP_NLA_L1");
double ACTIVE_AGENT_LP_L2 = BAU_Inputs2_L2.getDouble("ACTIVE_AGENT_LP_L2");
double WNBP_LP_L2 = BAU_Inputs2_L2.getDouble("WNBP_LP_L2");
double PA_L2 = BAU_Inputs2_L2.getDouble("PA_L2");
double WNBP_NLA_L2 = BAU_Inputs2_L2.getDouble("WNBP_NLA_L2");
JSONObject BAU_Inputs_2_TOTAL = TOTAL.getJSONObject("BAU_INPUTS_2");
BAU_Inputs_2_TOTAL.put("TOTAL_WNBP_NLA", WNBP_NLA_DT);
BAU_Inputs_2_TOTAL.put("TOTAL_WNBP_LP", WNBP_LP_DT);
BAU_Inputs_2_TOTAL.put("TOTAL_ACTIVE_AGENT_LP",
Addition(ACTIVE_AGENT_LP_DT, ACTIVE_AGENT_LP_L1, ACTIVE_AGENT_LP_L2));
BAU_Inputs_2_TOTAL.put("TOTAL_PA", Addition(PA_DT, PA_L1, PA_L2));
// Earning table
JSONObject DT = InputData.getJSONObject("CALC_JSON").getJSONObject("DT");
JSONObject L1 = InputData.getJSONObject("CALC_JSON").getJSONObject("L1");
JSONObject L2 = InputData.getJSONObject("CALC_JSON").getJSONObject("L2");
// JSONObject L2
// =InputData.getJSONObject("CALC_JSON").getJSONObject("L2");
JSONObject EARNING_DT = new JSONObject();
JSONObject EARNING_L1 = new JSONObject();
JSONObject EARNING_L2 = new JSONObject();
JSONObject EARNING_TOTAL = new JSONObject();
DT.put("EARNING", EARNING_DT);
L1.put("EARNING_L1", EARNING_L1);
L2.put("EARNING_L2", EARNING_L2);
TOTAL.put("EARNING_TOTAL", EARNING_TOTAL);
EARNING_DT = DT.getJSONObject("EARNING");
EARNING_L1 = L1.getJSONObject("EARNING_L1");
EARNING_L2 = L2.getJSONObject("EARNING_L2");
EARNING_TOTAL = TOTAL.getJSONObject("EARNING_TOTAL");
EARNING_DT.put("AGENT_FYC_25_DT", calc(Total_NGPA_WNBP_Dt, TOTAL_BAU_WNBP_DT,COMMISION_RATE));
EARNING_L1.put("AGENT_FYC_25_L1", calc(Total_NGPA_WNBP_L1, TOTAL_BAU_WNBP_L1,COMMISION_RATE));
EARNING_L2.put("AGENT_FYC_25_L2", calc(Total_NGPA_WNBP_L2, TOTAL_BAU_WNBP_L2,COMMISION_RATE));
double AGENT_FYC_25_DT = EARNING_DT.getDouble("AGENT_FYC_25_DT");
double AGENT_FYC_25_L1 = EARNING_L1.getDouble("AGENT_FYC_25_L1");
double AGENT_FYC_25_L2 = EARNING_L2.getDouble("AGENT_FYC_25_L2");
EARNING_TOTAL.put("TOTAL_AGENT_FYC_25", Addition(AGENT_FYC_25_DT, AGENT_FYC_25_L1, AGENT_FYC_25_L2));
EARNING_TOTAL.put("TOTAL_FYC_CREDIT", 0);
JSONArray map = leaderCalcConfig.getValue("mpb");
double mappingDT = 0;
double mappingL1 = 0;
double mappingL2 = 0;
double mappingDT_minimum_fyc = 0;
for (int i = 0; i < map.length(); i++) {
String Desgination = map.getJSONObject(i).getString("designation");
if (leader_designation.equals(Desgination)) {
mappingDT = map.getJSONObject(i).getDouble("DT");
mappingL1 = map.getJSONObject(i).getDouble("l1");
mappingL2 = map.getJSONObject(i).getDouble("l2");
mappingDT_minimum_fyc = map.getJSONObject(i).getDouble("mapping_DT_minimum_fyc");
break;
}
}
;
EARNING_DT.put("FYC_CREDIT_DT", mappingDT);
EARNING_L1.put("FYC_CREDIT_L1", mappingL1 + "%");
EARNING_L2.put("FYC_CREDIT_L2", mappingL2 + "%");
if (Double.valueOf(AGENT_FYC_25_DT) > mappingDT_minimum_fyc) {
EARNING_DT.put("WFYC_DT", ((AGENT_FYC_25_DT) * mappingDT) / 100);
} else {
EARNING_DT.put("WFYC_DT", "0");
}
double WFYC_DT = EARNING_DT.getDouble("WFYC_DT");
double FYC_CREDIT_L1 = mappingL1;
double FYC_CREDIT_L2 = mappingL2;
if (WFYC_DT == 0) {
EARNING_L1.put("WFYC_L1", "0");
} else {
EARNING_L1.put("WFYC_L1", Multiplication(AGENT_FYC_25_L1, FYC_CREDIT_L1, 1));
}
double WFYC_L1 = EARNING_L1.getDouble("WFYC_L1");
if (WFYC_L1 == 0) {
EARNING_L2.put("WFYC_L2", "0");
} else {
EARNING_L2.put("WFYC_L2", Multiplication(AGENT_FYC_25_L2, FYC_CREDIT_L2, 1));
}
double WFYC_L2 = EARNING_L2.getDouble("WFYC_L2");
EARNING_TOTAL.put("TOTAL_WFYC", Addition(WFYC_DT, WFYC_L1, WFYC_L2));
// fyc start
JSONArray fycarrqay = leaderCalcConfig.getValue("fyc");
double TOTAL_WFYC = EARNING_TOTAL.getDouble("TOTAL_WFYC");
double val = TOTAL_WFYC;
double percentage = 0;
for (int i = 0; i < fycarrqay.length(); i++) {
double minval = fycarrqay.getJSONObject(i).getDouble("minval");
double maxval = fycarrqay.getJSONObject(i).getDouble("maxval");
double per = fycarrqay.getJSONObject(i).getDouble("per");
if (val >= minval && val <= maxval) {
percentage = per;
break;
}
}
EARNING_TOTAL.put("TOTAL_MONTHLY_PERFORMANCE_BONUS", Multiplication((val * percentage) / 100, TOTAL_WFYC, 1));
double TOTAL_MONTHLY_PERFORMANCE_BONUS = EARNING_TOTAL.getDouble("TOTAL_MONTHLY_PERFORMANCE_BONUS");
if (TOTAL_MONTHLY_PERFORMANCE_BONUS == 0) {
EARNING_DT.put("EXTRA_CREDIT_DT", 0);
EARNING_DT.put("PA_DEVELOPMENT_DT", 0);
EARNING_L1.put("PA_DEVELOPMENT_L1", 0);
} else {
EARNING_DT.put("EXTRA_CREDIT_DT", ((((WNBP_NLA_DT + WNBP_LP_DT) * 25) / 100) * 15) / 100);
EARNING_DT.put("PA_DEVELOPMENT_DT", Multiplication(PA_DT, 5000, 1));
if (leader_designation.equalsIgnoreCase("PBA")) {
EARNING_L1.put("PA_DEVELOPMENT_L1", 0);
} else {
EARNING_L1.put("PA_DEVELOPMENT_L1", Multiplication(PA_L1, 1500, 1));
}
}
double EXTRA_CREDIT_DT = EARNING_DT.getDouble("EXTRA_CREDIT_DT");
EARNING_L1.put("EXTRA_CREDIT_L1", 0);
EARNING_L2.put("EXTRA_CREDIT_L2", 0);
EARNING_TOTAL.put("TOTAL_EXTRA_CREDIT", EXTRA_CREDIT_DT);
if (TOTAL_MONTHLY_PERFORMANCE_BONUS == 0) {
EARNING_L2.put("PA_DEVELOPMENT_L2", 0);
} else {
if (leader_designation.equalsIgnoreCase("PBA") || leader_designation.equalsIgnoreCase("BA")) {
EARNING_L2.put("PA_DEVELOPMENT_L2", 0);
} else {
EARNING_L2.put("PA_DEVELOPMENT_L2", Multiplication(PA_L2, 1000, 1));
}
}
double PA_DEVELOPMENT_DT = EARNING_DT.getDouble("PA_DEVELOPMENT_DT");
double PA_DEVELOPMENT_L1 = EARNING_L1.getDouble("PA_DEVELOPMENT_L1");
double PA_DEVELOPMENT_L2 = EARNING_L2.getDouble("PA_DEVELOPMENT_L2");
EARNING_TOTAL.put("TOTAL_PA_DEVELOPMENT", Addition(PA_DEVELOPMENT_DT, PA_DEVELOPMENT_L1, PA_DEVELOPMENT_L2));
//MDB mappings
JSONArray mdb2array = leaderCalcConfig.getValue("mdb");
System.out.println("mdb2array");
System.out.println(mdb2array);
NGPA_Dt=2;
TOTAL_NGPA_EP_125_DT=1250000;
double monthly_ep_18=0;
double monthly_ep_36=0;
double monthly_ep_72=0;
double monthly_ep_144=0;
for (int i = 0; i < mdb2array.length(); i++) {
double MDB = mdb2array.getJSONObject(i).getDouble("MDB");
System.out.println(MDB);
System.out.println(NGPA_Dt);
// double maxval = fycarrqay.getJSONObject(i).getDouble("maxval");
// double per = fycarrqay.getJSONObject(i).getDouble("per");
if (NGPA_Dt == MDB) {
System.out.println("in if");
monthly_ep_18 = mdb2array.getJSONObject(i).getDouble("monthly_ep_18");
monthly_ep_36 = mdb2array.getJSONObject(i).getDouble("monthly_ep_36");
monthly_ep_72 = mdb2array.getJSONObject(i).getDouble("monthly_ep_72");
monthly_ep_144 = mdb2array.getJSONObject(i).getDouble("monthly_ep_144");
break;
}
}
System.out.println("val180000");
System.out.println(monthly_ep_18);
System.out.println(monthly_ep_36);
System.out.println(monthly_ep_72);
System.out.println(monthly_ep_144);
if (TOTAL_NGPA_EP_125_DT < 180000) {
EARNING_DT.put("MONTHLY_DEVELOPMENT_BONUS_DT", 0);
} else if(TOTAL_NGPA_EP_125_DT > 180000 && TOTAL_NGPA_EP_125_DT < 360000) {
EARNING_DT.put("MONTHLY_DEVELOPMENT_BONUS_DT", monthly_ep_18);
}
else if(TOTAL_NGPA_EP_125_DT > 360000 && TOTAL_NGPA_EP_125_DT < 720000) {
EARNING_DT.put("MONTHLY_DEVELOPMENT_BONUS_DT", monthly_ep_36);
}
else if(TOTAL_NGPA_EP_125_DT > 720000 && TOTAL_NGPA_EP_125_DT < 1400000) {
EARNING_DT.put("MONTHLY_DEVELOPMENT_BONUS_DT", monthly_ep_72);
}
else{
EARNING_DT.put("MONTHLY_DEVELOPMENT_BONUS_DT", monthly_ep_144);
}
// System.out.println("neel");
System.out.println(EARNING_DT.getDouble("MONTHLY_DEVELOPMENT_BONUS_DT"));
double MONTHLY_DEVELOPMENT_BONUS_DT = EARNING_DT.getDouble("MONTHLY_DEVELOPMENT_BONUS_DT");
EARNING_L1.put("MONTHLY_DEVELOPMENT_BONUS_L1", 0);
EARNING_L2.put("MONTHLY_DEVELOPMENT_BONUS_L2", 0);
EARNING_TOTAL.put("TOTAL_MONTHLY_DEVELOPMENT_BONUS", MONTHLY_DEVELOPMENT_BONUS_DT);
JSONArray l1array = leaderCalcConfig.getValue("l1slabs");
double multiplier = 0;
if (leader_designation.equalsIgnoreCase("PBA")) {
EARNING_L1.put("ACTIVATION_L1", 0);
} else if (Active_Agent_BAU_L1 < 4) {
EARNING_L1.put("ACTIVATION_L1", 0);
} else {
if (Active_Agent_BAU_L1 >= 51) {
multiplier = 500;
} else {
for (int i = 0; i < l1array.length(); i++) {
double minval = l1array.getJSONObject(i).getDouble("minval");
double maxval = l1array.getJSONObject(i).getDouble("maxval");
if (Active_Agent_BAU_L1 >= minval && Active_Agent_BAU_L1 <= maxval) {
multiplier = l1array.getJSONObject(i).getDouble(leader_designation);
break;
}
}
}
}
EARNING_L1.put("ACTIVATION_L1", (Active_Agent_BAU_L1 * multiplier) + (ACTIVE_AGENT_LP_L1 * 500));
JSONArray L2Slabsarray = leaderCalcConfig.getValue("l2slabs");
System.out.println("L2Slabsarray");
System.out.println(L2Slabsarray);
double multiplierL2 = 0;
if (leader_designation.equalsIgnoreCase("PBA") || leader_designation.equalsIgnoreCase("BA")) {
EARNING_L2.put("ACTIVATION_L2", 0);
} else if (Active_Agent_BAU_L2 < 11) {
EARNING_L2.put("ACTIVATION_L2", 0);
}
else {
if (Active_Agent_BAU_L2 >= 61) {
multiplierL2 = 500;
} else {
for (int i = 0; i < L2Slabsarray.length(); i++) {
double minval = L2Slabsarray.getJSONObject(i).getDouble("minval");
double maxval = L2Slabsarray.getJSONObject(i).getDouble("maxval");
if (Active_Agent_BAU_L2 >= minval && Active_Agent_BAU_L2 <= maxval) {
multiplierL2 = L2Slabsarray.getJSONObject(i).getDouble(leader_designation);
break;
}
}
}
EARNING_L2.put("ACTIVATION_L2", (Active_Agent_BAU_L2 * multiplierL2) + (PA_L2 * 500));
}
if (Active_Agent_BAU_Dt < 4) {
EARNING_DT.put("ACTIVATION_DT", 0);
} else {
EARNING_DT.put("ACTIVATION_DT", (ACTIVE_AGENT_LP_DT + Active_Agent_BAU_Dt) * 1000);
}
double ACTIVATION_L2 = EARNING_L2.getDouble("ACTIVATION_L2");
double ACTIVATION_DT = EARNING_DT.getDouble("ACTIVATION_DT");
double ACTIVATION_L1 = EARNING_L1.getDouble("ACTIVATION_L1");
EARNING_TOTAL.put("TOTAL_ACTIVATION", Addition(ACTIVATION_DT, ACTIVATION_L1, ACTIVATION_L2));
EARNING_DT.put("MONTHLY_PERFORMANCE_BONUS_DT", 0);
EARNING_L1.put("MONTHLY_PERFORMANCE_BONUS_L1", 0);
EARNING_L2.put("MONTHLY_PERFORMANCE_BONUS_L2", 0);
double MONTHLY_PERFORMANCE_BONUS_DT = EARNING_DT.getDouble("MONTHLY_PERFORMANCE_BONUS_DT");
double MONTHLY_PERFORMANCE_BONUS_L1 = EARNING_L1.getDouble("MONTHLY_PERFORMANCE_BONUS_L1");
double EXTRA_CREDIT_L1 = EARNING_L1.getDouble("EXTRA_CREDIT_L1");
double MONTHLY_DEVELOPMENT_BONUS_L1 = EARNING_L1.getDouble("MONTHLY_DEVELOPMENT_BONUS_L1");
double MONTHLY_PERFORMANCE_BONUS_L2 = EARNING_L2.getDouble("MONTHLY_PERFORMANCE_BONUS_L2");
double EXTRA_CREDIT_L2 = EARNING_L2.getDouble("EXTRA_CREDIT_L2");
double MONTHLY_DEVELOPMENT_BONUS_L2 = EARNING_L2.getDouble("MONTHLY_DEVELOPMENT_BONUS_L2");
EARNING_DT.put("TOTAL_EARNING_DT", (MONTHLY_PERFORMANCE_BONUS_DT + MONTHLY_DEVELOPMENT_BONUS_DT
+ EXTRA_CREDIT_DT + ACTIVATION_DT + PA_DEVELOPMENT_DT));
EARNING_L1.put("TOTAL_EARNING_L1", (MONTHLY_PERFORMANCE_BONUS_L1 + MONTHLY_DEVELOPMENT_BONUS_L1
+ EXTRA_CREDIT_L1 + ACTIVATION_L1 + PA_DEVELOPMENT_L1));
EARNING_L2.put("TOTAL_EARNING_L2", (MONTHLY_PERFORMANCE_BONUS_L2 + MONTHLY_DEVELOPMENT_BONUS_L2
+ EXTRA_CREDIT_L2 + ACTIVATION_L2 + PA_DEVELOPMENT_L2));
double TOTAL_MONTHLY_DEVELOPMENT_BONUS = EARNING_TOTAL.getDouble("TOTAL_MONTHLY_DEVELOPMENT_BONUS");
double TOTAL_EXTRA_CREDIT = EARNING_TOTAL.getDouble("TOTAL_EXTRA_CREDIT");
double TOTAL_ACTIVATION = EARNING_TOTAL.getDouble("TOTAL_ACTIVATION");
double TOTAL_PA_DEVELOPMENT = EARNING_TOTAL.getDouble("TOTAL_PA_DEVELOPMENT");
EARNING_TOTAL.put("TOTAL_EARNING_TOTAL", (TOTAL_MONTHLY_PERFORMANCE_BONUS + TOTAL_MONTHLY_DEVELOPMENT_BONUS
+ TOTAL_EXTRA_CREDIT + TOTAL_ACTIVATION + TOTAL_PA_DEVELOPMENT));
double TOTAL_EARNING_TOTAL = EARNING_TOTAL.getDouble("TOTAL_EARNING_TOTAL");
EARNING_TOTAL.put("TOTAL_ANNUALISED_EARNING", (TOTAL_EARNING_TOTAL * 12));
System.out.println(Calc_JSON);
return Calc_JSON;
}
private double Multiplication(double Str1, double Str2, double Str3) {
double result = Str1 * Str2 * Str3;
return result;
}
private double Addition(double Str1, double Str2, double Str3) {
Double d = Str1 + Str2 + Str3;
// String result = String.format("%f", d);
return d;
}
private double calc(double Str1, double Str2,double commision_rate) {
Double add = Str1 + Str2;
Double mul = (add * commision_rate) / 100;
// String result = String.format("%f", a);
return mul;
}
private double Average(double Str1, double Str2, double Str3) {
double values[] = { Str1, Str2, Str3 };
int sum = 0;
for (int i = 0; i < values.length; i++)
sum += values[i];
double average = ((double) sum) / values.length;
return average;
}
}
package com.iRecruit.modules.auth.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.iRecruit.constant.LeaderCalcConfig;
import com.iRecruit.exception.ResourceNotFoundException;
import com.iRecruit.modules.auth.model.L2slabsMapping;
import com.iRecruit.modules.auth.model.MDBMapping;
import com.iRecruit.modules.auth.payload.MDBDto;
import com.iRecruit.modules.auth.repository.MDBRepository;
import com.iRecruit.modules.auth.service.MDBMappingService;
@Service
public class MDBMappingServiceImpl implements MDBMappingService {
@Autowired
MDBRepository mdbrepo;
@Autowired
LeaderCalcConfig LeaderCalcConfig;
@Override
public List<MDBMapping> findAll() {
// TODO Auto-generated method stub
return mdbrepo.findAll();
}
@Override
public MDBMapping save(MDBDto dto,Boolean isCreate) {
if(!isCreate) {
mdbrepo.findById(dto.getID()).orElseThrow(()->new ResourceNotFoundException("mdb","key",dto.getID()));
}
MDBMapping mdbmapping = null;
mdbmapping = new MDBMapping();
mdbmapping.setId(dto.getID());
mdbmapping.setMDB(dto.getMDB());
mdbmapping.setMonthly_ep_144(dto.getMonthly_ep_144());
mdbmapping.setMonthly_ep_18(dto.getMonthly_ep_18());
mdbmapping.setMonthly_ep_36(dto.getMonthly_ep_36());
mdbmapping.setMonthly_ep_72(dto.getMonthly_ep_72());
return mdbrepo.save(mdbmapping);
}
}
package com.iRecruit.modules.auth.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.iRecruit.constant.LeaderCalcConfig;
import com.iRecruit.exception.ResourceNotFoundException;
import com.iRecruit.modules.auth.model.FycMapping;
import com.iRecruit.modules.auth.model.MpbMapping;
import com.iRecruit.modules.auth.payload.fycDto;
import com.iRecruit.modules.auth.payload.mpbDto;
import com.iRecruit.modules.auth.repository.MpbRepository;
import com.iRecruit.modules.auth.service.MpbMappingService;
@Service
public class MpbMappingServiceImpl implements MpbMappingService{
@Autowired
MpbRepository mpbrepository;
@Autowired
LeaderCalcConfig LeaderCalcConfig;
@Override
public List<MpbMapping> findAll() {
return mpbrepository.findAll();
}
public MpbMapping save(mpbDto dto,Boolean isCreate) {
if(!isCreate) {
mpbrepository.findById(dto.getId()).orElseThrow(()->new ResourceNotFoundException("mpb","key",dto.getId()));
}
MpbMapping mpbMapping = null;
mpbMapping = new MpbMapping();
//mpbMapping.setId(dto.getId());
mpbMapping.setDT(dto.getDT());
mpbMapping.setL1(dto.getL1());
mpbMapping.setL2(dto.getL2());
mpbMapping.setDesignation(dto.getDesignation());
mpbMapping.setMapping_DT_minimum_fyc(dto.getMapping_DT_minimum_fyc());
return mpbrepository.save(mpbMapping);
}
}
package com.iRecruit.modules.auth.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.iRecruit.constant.LeaderCalcConfig;
import com.iRecruit.exception.ResourceNotFoundException;
import com.iRecruit.modules.auth.model.FycMapping;
import com.iRecruit.modules.auth.model.MpbMapping;
import com.iRecruit.modules.auth.model.MsaMapping;
import com.iRecruit.modules.auth.payload.MsaDto;
import com.iRecruit.modules.auth.repository.MDBRepository;
import com.iRecruit.modules.auth.repository.MsaRepository;
import com.iRecruit.modules.auth.service.MsaMappingService;
@Service
public class MsaMappingServiceImpl implements MsaMappingService {
@Autowired
MsaRepository msarepo;
@Override
public List<MsaMapping> findAll() {
// TODO Auto-generated method stub
return msarepo.findAll();
}
@Override
public MsaMapping save(MsaDto dto, Boolean isCreate) {
if(!isCreate) {
msarepo.findById(dto.getId()).orElseThrow(()->new ResourceNotFoundException("msa","key",dto.getId()));
}
MsaMapping msaMapping = null;
msaMapping = new MsaMapping();
msaMapping.setId(dto.getId());
msaMapping.setMSA_1(dto.getMSA_1());
msaMapping.setMSA_2(dto.getMSA_2());
msaMapping.setMSA_3(dto.getMSA_3());
msaMapping.setMSA_4(dto.getMSA_4());
return msarepo.save(msaMapping);
}
}
package com.iRecruit.modules.auth.service.impl;
import java.util.List;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.google.gson.JsonObject;
import com.iRecruit.constant.LeaderCalcConfig;
import com.iRecruit.constant.TemplateConfig;
import com.iRecruit.exception.ResourceNotFoundException;
import com.iRecruit.modules.auth.controller.LeaderCalc;
import com.iRecruit.modules.auth.service.FycMappingService;
import com.iRecruit.modules.auth.service.LeaderCalcService;
import com.iRecruit.modules.auth.service.NGPACalcService;
import com.iRecruit.constant.LeaderCalcConfig;
@Service
public class NGPACalcSerivceImpl implements NGPACalcService {
@Autowired
LeaderCalcConfig leaderCalcConfig;
int i,j,counter;
double basicDoubleOperation;
String basicStringOperation;
JSONObject basicJSONOperation = new JSONObject();
JSONObject basicJSONOperation1 = new JSONObject();
String[] basicStringArrayOperation = new String[4];
double fycPersantage = 25;
final double rnrPersantageACP = 2.5;
JSONArray MSA_Value = new JSONArray();
double[][] mainTable = new double[4][6];
double[][] appointmentAndConversionTable = new double[4][2];
double[][] earningsTable = new double[4][4];
JSONObject Response_JSON = new JSONObject();
public void prepareMainTable(JSONObject requestJSON) throws JSONException {
basicJSONOperation = new JSONObject();
basicJSONOperation = requestJSON.getJSONObject("Per_Month").getJSONObject("Year_1");
mainTable[0][0] = ( ( basicJSONOperation.getString("Validations_Met").equalsIgnoreCase("Yes") ) ? 1 : 0 );
mainTable[0][1] = basicJSONOperation.getDouble("Customer_Appointments");
mainTable[0][2] = basicJSONOperation.getDouble("Customer_Meetings");
mainTable[0][3] = basicJSONOperation.getDouble("Conversion_(NOP#)");
mainTable[0][4] = basicJSONOperation.getDouble("Case_Size_(INR)");
mainTable[0][5] = mainTable[0][3] * mainTable[0][4];
basicStringOperation = requestJSON.getString("Annual_Year_1_Validations_Met");
mainTable[1][0] = ( ( basicStringOperation.equalsIgnoreCase("Yes") ) ? 1 : 0 );
mainTable[1][1] = mainTable[0][1] * 12;
mainTable[1][2] = mainTable[0][2] * 12;
mainTable[1][3] = mainTable[0][3] * 12;
mainTable[1][5] = mainTable[0][5] * 12;
mainTable[1][4] = mainTable[1][5] / mainTable[1][3];
basicJSONOperation = new JSONObject();
basicJSONOperation = requestJSON.getJSONObject("Per_Month").getJSONObject("Year_2");
mainTable[2][0] = ( ( basicJSONOperation.getString("Validations_Met").equalsIgnoreCase("Yes") ) ? 1 : 0 );
mainTable[2][1] = basicJSONOperation.getDouble("Customer_Appointments");
mainTable[2][2] = basicJSONOperation.getDouble("Customer_Meetings");
mainTable[2][3] = basicJSONOperation.getDouble("Conversion_(NOP#)");
mainTable[2][4] = basicJSONOperation.getDouble("Case_Size_(INR)");
mainTable[2][5] = mainTable[2][3] * mainTable[2][4];
basicStringOperation = requestJSON.getString("Annual_Year_2_Validations_Met");
mainTable[3][0] = ( ( basicStringOperation.equalsIgnoreCase("Yes") ) ? 1 : 0 );
mainTable[3][1] = mainTable[2][1] * 12;
mainTable[3][2] = mainTable[2][2] * 12;
mainTable[3][3] = mainTable[2][3] * 12;
mainTable[3][5] = mainTable[2][5] * 12;
mainTable[3][4] = mainTable[2][5] / mainTable[2][3];
}
public void prepareappointmentAndConversionTable(JSONObject requestJSON) {
for(i=0;i<4;i++) {
appointmentAndConversionTable[i][0] = Math.round( ( mainTable[i][2] / mainTable[i][1] ) * 100 );
appointmentAndConversionTable[i][1] = Math.round( ( mainTable[i][3] / mainTable[i][2] ) * 100 );
}
}
public void prepareEarningsTable(JSONObject requestJSON) throws JSONException {
basicJSONOperation = MSA_Value.getJSONObject(0);
basicStringOperation = requestJSON.getString("FS_Type");
basicDoubleOperation = basicJSONOperation.getDouble(basicStringOperation);
fycPersantage = requestJSON.getDouble("Commission_Rate");
for(i=0;i<4;i++) {
earningsTable[i][0] = Math.round( ( mainTable[i][5] * fycPersantage ) / 100 );
if( i == 0 || i == 2 ) {
earningsTable[i][1] = basicDoubleOperation;
} else {
earningsTable[i][1] = earningsTable[i-1][1] * 12;
earningsTable[i][2] = Math.round( ( mainTable[i][5] * rnrPersantageACP ) / 100 );
earningsTable[i-1][2] = earningsTable[i][2] / 12;
}
}
counter = 0;
for(i=0;i<4;i++) {
earningsTable[i][3] = earningsTable[i][counter] + earningsTable[i][counter+1] + earningsTable[i][counter+2];
}
}
@Override
public JSONObject prepareAllFormula(JSONObject requestJSON) throws JSONException {
MSA_Value= leaderCalcConfig.getValue("msa");
prepareMainTable(requestJSON);
prepareappointmentAndConversionTable(requestJSON);
prepareEarningsTable(requestJSON);
Response_JSON.put("FS_Type", requestJSON.getString("FS_Type"));
Response_JSON.put("Annual_Year_1_Validations_Met",requestJSON.getString("Annual_Year_1_Validations_Met"));
Response_JSON.put("Annual_Year_2_Validations_Met",requestJSON.getString("Annual_Year_2_Validations_Met"));
Response_JSON.put("Commission_Rate",requestJSON.getString("Commission_Rate"));
for( i=0;i<4;i++ ) {
basicJSONOperation1 = new JSONObject();
basicJSONOperation1.put("Validations_Met", ( ( mainTable[i][0] == 1 ) ? "Yes" : "No" ));
basicJSONOperation1.put("Customer_Appointments", mainTable[i][1]);
basicJSONOperation1.put("Customer_Meetings", mainTable[i][2]);
basicJSONOperation1.put("Conversion_(NOP#)", mainTable[i][3]);
basicJSONOperation1.put("Case_Size_(INR)", mainTable[i][4]);
basicJSONOperation1.put("WNBP_(INR)", mainTable[i][5]);
basicJSONOperation1.put("Meeting_To_Appointment", appointmentAndConversionTable[i][0]);
basicJSONOperation1.put("Conversion_To_Meeting", appointmentAndConversionTable[i][1]);
basicJSONOperation1.put("FYC_@_25%", earningsTable[i][0]);
basicJSONOperation1.put("Monthly_Allowance", earningsTable[i][1]);
basicJSONOperation1.put("Quarter_&_Annual_RnR", earningsTable[i][2]);
basicJSONOperation1.put("Total_Earnings", earningsTable[i][3]);
basicStringArrayOperation[i] = basicJSONOperation1.toString();
}
basicJSONOperation1 = new JSONObject();
basicJSONOperation = new JSONObject(basicStringArrayOperation[0]);
basicJSONOperation1.put("Year_1", basicJSONOperation);
basicJSONOperation = new JSONObject(basicStringArrayOperation[2]);
basicJSONOperation1.put("Year_2", basicJSONOperation);
Response_JSON.put("Per_Month", basicJSONOperation1 );
basicJSONOperation1 = new JSONObject();
basicJSONOperation = new JSONObject(basicStringArrayOperation[1]);
basicJSONOperation1.put("Year_1", basicJSONOperation);
basicJSONOperation = new JSONObject(basicStringArrayOperation[3]);
basicJSONOperation1.put("Year_2", basicJSONOperation);
Response_JSON.put("Annual", basicJSONOperation1 );
basicJSONOperation = new JSONObject();
basicJSONOperation.put("As_NGPA_Year_1", earningsTable[0][3]);
basicJSONOperation.put("As_NGPA_Year_2", earningsTable[2][3]);
basicJSONOperation.put("As_NGPA_Growth", Math.round( ( ( earningsTable[2][3] / earningsTable[0][3] ) - 1 ) * 100 ) );
Response_JSON.put("Summary of Income",basicJSONOperation);
return Response_JSON;
}
}
package com.iRecruit.modules.auth.service.impl;
import java.util.List;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.google.gson.JsonObject;
import com.iRecruit.constant.LeaderCalcConfig;
import com.iRecruit.constant.TemplateConfig;
import com.iRecruit.exception.ResourceNotFoundException;
import com.iRecruit.modules.auth.controller.LeaderCalc;
import com.iRecruit.modules.auth.service.FycMappingService;
import com.iRecruit.modules.auth.service.LeaderCalcService;
import com.iRecruit.modules.auth.service.NGPACalcService;
import com.iRecruit.constant.LeaderCalcConfig;
import com.iRecruit.modules.auth.service.NGPAtoNGPLCalcService;
@Service
public class NGPAtoNGPLCalcServiceImpl implements NGPAtoNGPLCalcService {
@Autowired
LeaderCalcConfig leaderCalcConfig;
int i,j,counter;
double basicDoubleOperation;
String basicStringOperation;
String[] basicStringArrayOperation = {"Year_1","Year_2","Total"};
String[] basicStringArrayOperation1 = {"Year_1_NGPA","Year_1_NGPL","Year_1_Total","Year_2_4_Validated_NGPAs"};
JSONObject basicJSONOperation = new JSONObject();
JSONObject basicJSONOperation1 = new JSONObject();
JSONArray basicJSONArrayOperation = new JSONArray();
double fycPersantage = 25;
final double rnrPersantageACP = 2.5;
final double MonthlyDevelopmentBonus_Year1_NGPL_Persantage1 = 1.7;
final double MonthlyDevelopmentBonus_Year1_NGPL_Persantage2 = 20;
double[] MonthlyDevelopmentBonus_Year1_NGPL = {0,0,0,0};
JSONArray MSA_Value = new JSONArray();
double [][] ngpaToLeaderCareerPathTable = new double[3][2];
double [][] metricsTable = new double[4][8];
double[][] appointmentAndConversionTable = new double[4][2];
double[][] earningsTable = new double[4][9];
JSONObject Response_JSON = new JSONObject();
public JSONObject calculateFYCCreditAndWFYC (String designation, Double FYC ) throws JSONException {
//basicStringOperation = "[{\"DT\":170,\"l1\":0,\"l2\":0,\"id\":1,\"designation\":\"PBA\",\"mapping_DT_minimum_fyc\":5000},{\"DT\":170,\"l1\":30,\"l2\":10,\"id\":107,\"designation\":\"BA\",\"mapping_DT_minimum_fyc\":10000},{\"DT\":170,\"l1\":50,\"l2\":25,\"id\":109,\"designation\":\"SBA\",\"mapping_DT_minimum_fyc\":15000},{\"DT\":170,\"l1\":50,\"l2\":25,\"id\":111,\"designation\":\"CBA\",\"mapping_DT_minimum_fyc\":15000},{\"DT\":170,\"l1\":50,\"l2\":30,\"id\":113,\"designation\":\"Partner\",\"mapping_DT_minimum_fyc\":20000},{\"DT\":170,\"l1\":50,\"l2\":30,\"id\":115,\"designation\":\"Senior_Partner\",\"mapping_DT_minimum_fyc\":20000},{\"DT\":170,\"l1\":0,\"l2\":10,\"id\":118,\"designation\":\"PBA\",\"mapping_DT_minimum_fyc\":5000}]";
basicJSONArrayOperation = leaderCalcConfig.getValue("mpb");
for( i=0;i<basicJSONArrayOperation.length();i++ ) {
basicJSONOperation = new JSONObject();
basicJSONOperation = basicJSONArrayOperation.getJSONObject(i);
if( basicJSONOperation.getString("designation").equalsIgnoreCase(designation) ) {
break;
}
}
basicJSONOperation1.put("WFYC",0);
if( FYC >= basicJSONOperation.getDouble("mapping_DT_minimum_fyc") ) {
basicJSONOperation1.put("WFYC", Math.round( ( basicJSONOperation.getDouble("DT") * FYC ) / 100 ) );
}
basicJSONOperation1.put("DT",basicJSONOperation.getDouble("DT"));
return basicJSONOperation1;
}
public double calculateMonthlyPerformanceBonus ( Double WFYC ) throws JSONException {
basicDoubleOperation = 0;
// basicStringOperation = ;
basicJSONArrayOperation = leaderCalcConfig.getValue("fyc");
for ( i = 0; i < basicJSONArrayOperation.length(); i++ ) {
if (WFYC >= basicJSONArrayOperation.getJSONObject(i).getDouble("minval") && WFYC <= basicJSONArrayOperation.getJSONObject(i).getDouble("maxval")) {
basicDoubleOperation = Math.round( ( WFYC * basicJSONArrayOperation.getJSONObject(i).getDouble("per") ) / 100 );
}
}
return basicDoubleOperation;
}
public void preparengpaToLeaderCareerPathTable(JSONObject requestJSON) throws JSONException {
for(i=0;i<2;i++) {
basicJSONOperation = new JSONObject();
basicJSONOperation = requestJSON.getJSONObject("NGPA_To_Leader_Career_Path").getJSONObject("Year_"+(i+1));
ngpaToLeaderCareerPathTable[i][0] = basicJSONOperation.getDouble("Conversion_To_Leader_In_Mth");
ngpaToLeaderCareerPathTable[i][1] = basicJSONOperation.getDouble("No_Of_Agents_Referred_Recruit");
}
ngpaToLeaderCareerPathTable[2][0] = ngpaToLeaderCareerPathTable[0][0] + ngpaToLeaderCareerPathTable[1][0];
ngpaToLeaderCareerPathTable[2][1] = ngpaToLeaderCareerPathTable[0][1] + ngpaToLeaderCareerPathTable[1][1];
}
public void preparemetricsTable(JSONObject requestJSON) throws JSONException {
for(i=0;i<4;i++) {
basicJSONOperation = new JSONObject();
if( i == 0 ) {
basicJSONOperation = requestJSON.getJSONObject("Metrics_MeetingConversion_Earnings").getJSONObject("Year_1_NGPA");
}
else if ( i == 1 ) {
basicJSONOperation = requestJSON.getJSONObject("Metrics_MeetingConversion_Earnings").getJSONObject("Year_1_NGPL");
}
else if ( i == 3 ) {
basicJSONOperation = requestJSON.getJSONObject("Metrics_MeetingConversion_Earnings").getJSONObject("Year_2_4_Validated_NGPAs");
}
if ( i != 2 ) {
basicDoubleOperation = ( ( i == 0 ) ? ngpaToLeaderCareerPathTable[0][0] : ( ( i == 1 ) ? ( 12 - ngpaToLeaderCareerPathTable[0][0] + 3 ) : 0 ) ) ;
metricsTable[i][0] = basicDoubleOperation;
metricsTable[i][1] = ( basicJSONOperation.getString("Validations_Met").equalsIgnoreCase("Yes") ? 1 : 0 );
metricsTable[i][2] = basicJSONOperation.getDouble("Customer_Appointments");
metricsTable[i][3] = basicJSONOperation.getDouble("Customer_Meetings");
metricsTable[i][4] = basicJSONOperation.getDouble("Conversion_(NOP#)");
metricsTable[i][5] = basicJSONOperation.getDouble("Case_Size_(INR)");
metricsTable[i][6] = metricsTable[i][4] * metricsTable[i][5];
}
else {
basicStringOperation = requestJSON.getString("Total_Validations_Met");
metricsTable[i][1] = ( basicStringOperation.equalsIgnoreCase("Yes") ? 1 : 0 );
metricsTable[i][2] = metricsTable[0][2] + metricsTable[1][2];
metricsTable[i][3] = metricsTable[0][3] + metricsTable[1][3];
metricsTable[i][4] = metricsTable[0][4] + metricsTable[1][4];
metricsTable[i][6] = metricsTable[0][6] + metricsTable[1][6];
metricsTable[i][5] = Math.round( metricsTable[i][6] / metricsTable[i][4] );
}
metricsTable[i][7] = Math.round( ( metricsTable[i][6] * requestJSON.getDouble("Eligible_Premium") ) / 12 );
}
}
public void prepareappointmentAndConversionTable(JSONObject requestJSON) throws JSONException {
for(i=0;i<4;i++) {
appointmentAndConversionTable[i][0] = Math.round( ( metricsTable[i][3] / metricsTable[i][2] ) * 100 );
appointmentAndConversionTable[i][1] = Math.round( ( metricsTable[i][4] / metricsTable[i][3] ) * 100 );
}
}
public void prepareearningsTable(JSONObject requestJSON) throws JSONException {
// basicStringOperation = "[{\"180000\":25000,\"360000\":25000,\"720000\":25000,\"1440000\":25000,\"MPB\":2},{\"180000\":25000,\"360000\":50000,\"720000\":50000,\"1440000\":50000,\"MPB\":3},{\"180000\":25000,\"360000\":50000,\"720000\":75000,\"1440000\":75000,\"MPB\":4},{\"180000\":25000,\"360000\":50000,\"720000\":75000,\"1440000\":100000,\"MPB\":5}]";
basicJSONArrayOperation = leaderCalcConfig.getValue("mdb");
for( i=0;i<basicJSONArrayOperation.length();i++ ) {
if ( basicJSONArrayOperation.getJSONObject(i).getDouble("MDB") == 4 ) {
basicJSONOperation1 = basicJSONArrayOperation.getJSONObject(i);
break;
}
}
for( i=0;i<4;i++ ) {
if( metricsTable[i][7] > 180000 && metricsTable[i][7] < 360000 ) {
MonthlyDevelopmentBonus_Year1_NGPL[i] = basicJSONOperation1.getDouble("monthly_ep_18");
} else if ( metricsTable[i][7] > 360000 && metricsTable[i][7] < 720000 ) {
MonthlyDevelopmentBonus_Year1_NGPL[i] = basicJSONOperation1.getDouble("monthly_ep_36");
} else if ( metricsTable[i][7] > 720000 && metricsTable[i][7] < 1400000 ) {
MonthlyDevelopmentBonus_Year1_NGPL[i] = basicJSONOperation1.getDouble("monthly_ep_72");
} else if ( metricsTable[i][7] > 1400000 ) {
MonthlyDevelopmentBonus_Year1_NGPL[i] = basicJSONOperation1.getDouble("monthly_ep_144");
}
}
basicJSONOperation = MSA_Value.getJSONObject(0);
basicStringOperation = requestJSON.getString("FS_Type");
basicDoubleOperation = basicJSONOperation.getDouble(basicStringOperation);
earningsTable[0][0] = Math.round( ( metricsTable[0][6] * fycPersantage ) / 100 );
basicJSONOperation1 = new JSONObject();
basicJSONOperation1 = calculateFYCCreditAndWFYC("BA",earningsTable[0][0]);
earningsTable[0][7] = basicJSONOperation1.getDouble("DT");
earningsTable[0][8] = basicJSONOperation1.getDouble("WFYC");
earningsTable[0][1] = Math.round( ( metricsTable[0][0] * basicDoubleOperation ));
earningsTable[0][2] = Math.round( ( metricsTable[0][6] * rnrPersantageACP ) / 100 );
earningsTable[0][3] = 0;
earningsTable[0][4] = 0;
earningsTable[0][5] = earningsTable[0][0] + earningsTable[0][1] + earningsTable[0][2];
earningsTable[0][6] = 0;
earningsTable[1][0] = Math.round( ( metricsTable[1][6] * fycPersantage ) / 100 );
basicJSONOperation1 = new JSONObject();
basicJSONOperation1 = calculateFYCCreditAndWFYC("BA",earningsTable[1][0]);
earningsTable[1][7] = basicJSONOperation1.getDouble("DT");
earningsTable[1][8] = basicJSONOperation1.getDouble("WFYC");
earningsTable[1][1] = 0;
earningsTable[1][2] = 0;
earningsTable[1][3] = ( earningsTable[1][8] != 0 ? calculateMonthlyPerformanceBonus(earningsTable[1][8]) : 0 );
earningsTable[1][4] = Math.round( MonthlyDevelopmentBonus_Year1_NGPL[1] * ( 12 - metricsTable[0][0] ) );
earningsTable[1][5] = earningsTable[1][3] + earningsTable[1][4];
earningsTable[1][6] = 0;
earningsTable[2][0] = earningsTable[0][0];
basicJSONOperation1 = new JSONObject();
basicJSONOperation1 = calculateFYCCreditAndWFYC("BA",earningsTable[2][0]);
earningsTable[2][7] = basicJSONOperation1.getDouble("DT");
earningsTable[2][8] = basicJSONOperation1.getDouble("WFYC");
earningsTable[2][1] = earningsTable[0][1];
earningsTable[2][2] = earningsTable[0][2];
earningsTable[2][3] = earningsTable[1][3];
earningsTable[2][4] = earningsTable[1][4];
earningsTable[2][5] = earningsTable[2][0] + earningsTable[2][1] + earningsTable[2][2] + earningsTable[2][3] + earningsTable[2][4];
earningsTable[2][6] = Math.round( earningsTable[2][5] / 12 );
earningsTable[3][0] = Math.round( ( metricsTable[3][6] * fycPersantage ) / 100 );
basicJSONOperation1 = new JSONObject();
basicJSONOperation1 = calculateFYCCreditAndWFYC("BA",earningsTable[3][0]);
earningsTable[3][7] = basicJSONOperation1.getDouble("DT");
earningsTable[3][8] = basicJSONOperation1.getDouble("WFYC");
earningsTable[3][1] = 0;
earningsTable[3][2] = 0;
earningsTable[3][3] = ( earningsTable[3][8] != 0 ? calculateMonthlyPerformanceBonus(earningsTable[3][8]) : 0 );
earningsTable[3][4] = Math.round( ngpaToLeaderCareerPathTable[2][1] * MonthlyDevelopmentBonus_Year1_NGPL[3] * 12 );
earningsTable[3][5] = earningsTable[3][3] + earningsTable[3][4];
earningsTable[3][6] = Math.round( earningsTable[3][5] / 12 );
}
public JSONObject prepareAllFormula(JSONObject requestJSON) throws JSONException {
MSA_Value= leaderCalcConfig.getValue("msa");
preparengpaToLeaderCareerPathTable(requestJSON);
preparemetricsTable(requestJSON);
prepareappointmentAndConversionTable(requestJSON);
prepareearningsTable(requestJSON);
Response_JSON.put("FS_Type", requestJSON.getString("FS_Type"));
Response_JSON.put("Total_Validations_Met", requestJSON.getString("Total_Validations_Met"));
Response_JSON.put("Eligible_Premium", requestJSON.getDouble("Eligible_Premium"));
basicJSONOperation1 = new JSONObject();
for(i=0;i<3;i++) {
basicJSONOperation = new JSONObject();
basicJSONOperation.put("Conversion_To_Leader_In_Mth", ngpaToLeaderCareerPathTable[i][0]);
basicJSONOperation.put("No_Of_Agents_Referred_Recruit", ngpaToLeaderCareerPathTable[i][1]);
basicJSONOperation1.put(basicStringArrayOperation[i], basicJSONOperation);
}
Response_JSON.put("NGPA_To_Leader_Career_Path", basicJSONOperation1);
basicJSONOperation = new JSONObject();
basicJSONOperation1 = new JSONObject();
for(i=0;i<4;i++) {
basicJSONOperation = new JSONObject();
basicJSONOperation.put("No_Of_Months", metricsTable[i][0]);
basicJSONOperation.put("Validations_Met", ( ( metricsTable[i][1] == 1 ) ? "Yes" : "No" ) );
basicJSONOperation.put("Customer_Appointments", metricsTable[i][2]);
basicJSONOperation.put("Customer_Meetings", metricsTable[i][3]);
basicJSONOperation.put("Conversion_(NOP#)", metricsTable[i][4]);
basicJSONOperation.put("Case_Size_(INR)", metricsTable[i][5]);
basicJSONOperation.put("WNBP_(INR)", metricsTable[i][6]);
basicJSONOperation.put("WNBP_(INR)@EP", metricsTable[i][7]);
basicJSONOperation.put("Meeting_To_Appointment", appointmentAndConversionTable[i][0]);
basicJSONOperation.put("Conversion_To_Meeting", appointmentAndConversionTable[i][1]);
basicJSONOperation.put("FYC_@_25%", earningsTable[i][0]);
basicJSONOperation.put("Monthly_Allowance", earningsTable[i][1] );
basicJSONOperation.put("Quarter_&_Annual_RnR", earningsTable[i][2]);
basicJSONOperation.put("Monthly_Performance_Bonus", earningsTable[i][3]);
basicJSONOperation.put("Monthly_Development_Bonus", earningsTable[i][4]);
basicJSONOperation.put("Total_Earnings", earningsTable[i][5]);
basicJSONOperation.put("Per_Month_Earning", earningsTable[i][6]);
basicJSONOperation.put("FYC_Credit", earningsTable[i][7]);
basicJSONOperation.put("WFYC", earningsTable[i][8]);
basicJSONOperation1.put(basicStringArrayOperation1[i], basicJSONOperation);
}
Response_JSON.put("Metrics_MeetingConversion_Earnings", basicJSONOperation1);
basicJSONOperation = new JSONObject();
basicJSONOperation.put("As_NGPA_Year_1", earningsTable[2][6]);
basicJSONOperation.put("As_NGPA_Year_2", earningsTable[3][6]);
basicJSONOperation.put("As_NGPA_Growth", Math.round( ( ( earningsTable[3][6] / earningsTable[2][6] ) - 1 ) * 100 ) );
Response_JSON.put("Summary of Income",basicJSONOperation);
return Response_JSON;
}
}
package com.iRecruit.modules.auth.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.iRecruit.constant.TemplateConfig;
import com.iRecruit.exception.ResourceNotFoundException;
import com.iRecruit.modules.auth.model.Templates;
import com.iRecruit.modules.auth.payload.TemplatesDto;
import com.iRecruit.modules.auth.repository.TemplatesRepository;
import com.iRecruit.modules.auth.service.TemplatesService;
@Service
public class TemplatesServiceImpl implements TemplatesService {
@Autowired
TemplatesRepository configRepo;
@Autowired
TemplateConfig templateConfig;
public Templates save(TemplatesDto dto,Boolean isCreate) {
Templates configuration = null;
if(!isCreate) {
configRepo.findByConfig(dto.getKey()).orElseThrow(()->new ResourceNotFoundException("Template","key",dto.getKey()));
}else {
configuration = new Templates();
configuration.setConfig(dto.getKey());
}
configuration.setValue(dto.getValue());
configuration.setType(dto.getType());
templateConfig.setValue(dto.getKey(), dto.getValue());
return configRepo.save(configuration);
}
public List<Templates> findAll(){
return configRepo.findAll();
}
public Templates findByKey(String key) {
return configRepo.findByConfig(key).orElseThrow(()->new ResourceNotFoundException("Template","key",key));
}
}
package com.iRecruit.modules.auth.service.impl;
import java.util.List;
import java.util.Optional;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import com.iRecruit.exception.ResourceNotFoundException;
import com.iRecruit.modules.auth.model.User;
import com.iRecruit.modules.auth.payload.UserDto;
import com.iRecruit.modules.auth.repository.UserRepository;
import com.iRecruit.modules.auth.service.UserService;
@Service
@Transactional(propagation = Propagation.REQUIRES_NEW)
public class UserServiceImpl implements UserService {
private static final Logger LOG = LoggerFactory.getLogger(UserServiceImpl.class);
@Autowired
private UserRepository userRepository;
@Override
public Page<User> findAll(Pageable pageable) {
return userRepository.findAll(pageable);
}
@Autowired
PasswordEncoder passwordEncoder;
public User save(UserDto userDto) {
User user = new User();
if(userDto.getId() != null) {
user = userRepository.findById(userDto.getId()).orElseThrow(()-> new ResourceNotFoundException("User", "id", userDto.getId()));
}
user.setFirstName(userDto.getName());
user.setEmailId(userDto.getEmail());
user.setMobileNo(userDto.getMobileNumber());
user.setRole(userDto.getRole());
user.setFailedAttemptLogin(0);
user.setNotificationId(userDto.getNotificationId());
user.setStatus(userDto.getStatus());
user = userRepository.save(user);
return user;
}
public List<User> findByIds(List<Long> userIds){
return userRepository.findByIdIn(userIds);
}
@Override
public User save(User user) {
return userRepository.save(user);
}
@Override
public User findById(String id) {
Optional<User> user = userRepository.findById(id);
LOG.info("user---user----user"+user.toString());
if(user.toString() == "Optional.empty") {
return null;
}
else {
return userRepository.findById(id).orElseThrow(()->new ResourceNotFoundException("User", "id", id));
}
//return userRepository.findById(id).orElseThrow(()->new ResourceNotFoundException("User", "id", id));
}
}
\ No newline at end of file
package com.iRecruit.pdf;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.thymeleaf.spring4.SpringTemplateEngine;
import org.thymeleaf.spring4.templateresolver.SpringResourceTemplateResolver;
import org.thymeleaf.templatemode.StandardTemplateModeHandlers;
import java.nio.charset.StandardCharsets;
@Configuration
public class PDFThymeleafConfiguration {
@Bean
public SpringTemplateEngine springTemplateEngine() {
SpringTemplateEngine templateEngine = new SpringTemplateEngine();
templateEngine.addTemplateResolver(htmlTemplateResolver());
return templateEngine;
}
@Bean
public SpringResourceTemplateResolver htmlTemplateResolver() {
SpringResourceTemplateResolver pdfTemplateResolver = new SpringResourceTemplateResolver();
pdfTemplateResolver.setPrefix("classpath:/templates/");
pdfTemplateResolver.setSuffix(".html");
pdfTemplateResolver.setTemplateMode(StandardTemplateModeHandlers.HTML5.getTemplateModeName());
pdfTemplateResolver.setCharacterEncoding(StandardCharsets.UTF_8.name());
return pdfTemplateResolver;
}
}
\ No newline at end of file
package com.iRecruit.schedule;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.TimeZone;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
@Service
public class InvoiceGeneratorScheduler {
@Scheduled(cron = "0 0 0 * * ?")
public void generateInvoice() {
long now = System.currentTimeMillis() / 1000;
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss");
LocalDateTime now1 = LocalDateTime.now();
System.out.println(dtf.format(now1));
TimeZone zone = TimeZone.getDefault();
System.out.println(zone.getDisplayName());
System.out.println(zone.getID());
// System.out.println("schedule tasks using cron jobs - " + now);
}
}
\ No newline at end of file
package com.iRecruit.security;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.authentication.AuthenticationProvider;
import org.springframework.security.authentication.BadCredentialsException;
import org.springframework.security.authentication.DisabledException;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Component;
import com.iRecruit.constant.RolesConstant;
import com.iRecruit.constant.Status;
import com.iRecruit.constant.StatusCode;
import com.iRecruit.modules.auth.model.User;
import com.iRecruit.modules.auth.payload.request.LoginRequest;
import com.iRecruit.modules.auth.service.UserService;
@Component
public class AuthProvider implements AuthenticationProvider {
private static final Logger LOG = LoggerFactory.getLogger(AuthProvider.class);
@Autowired
UserService userService;
@Autowired
PasswordEncoder passwordEncoder;
@Override
public Authentication authenticate(Authentication authentication) throws AuthenticationException {
String username = authentication.getPrincipal() + "";
String password = authentication.getCredentials() + "";
LoginRequest loginRequest = new LoginRequest();
loginRequest.setUsername(username);
loginRequest.setPassword(password);
LOG.info("login request for user "+username);
// LDAP Service Call
User user = null;
user = new User();
// user = userService.findById(username);
LOG.info("---------"+user);
user.setId("1");
user.setBranchCode("abc");
user.setFirstName("xyz");
user.setLastName("abc");
user.setGender("m");
user.setMobileNo("8238284225");
user.setBranchName("abc");
user.setMiddleName("pqr");
user.setEmailId("gosranineel4@gmail.com");
user.setDesignation("PBA");
user.setPan("pan");
user.setAgentStatus("1");
user.setRole(RolesConstant.LEADER);
userService.save(user);
LOG.info("user-----"+user);
List<String> roles = new ArrayList<String>();
roles.add("leader");
return new UsernamePasswordAuthenticationToken(UserPrincipal.create(user,(LoginRequest)authentication.getDetails()), password,roles.stream().map(x -> new SimpleGrantedAuthority("ROLE_"+x)).collect(Collectors.toList()));
}
@Override
public boolean supports(Class<?>aClass) {
return aClass.equals(UsernamePasswordAuthenticationToken.class);
}
}
\ No newline at end of file
package com.iRecruit.security;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
@Target({ElementType.PARAMETER, ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@AuthenticationPrincipal
public @interface CurrentUser {
}
package com.iRecruit.security;
import java.util.stream.Collectors;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.iRecruit.modules.auth.model.User;
import com.iRecruit.modules.auth.payload.request.LoginRequest;
import com.iRecruit.modules.auth.service.UserService;
@Service
public class CustomUserDetailsService implements UserDetailsService {
@Autowired
UserService userService;
@Override
@Transactional
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
// Let people login with either username
UserPrincipal principal = null;
User user = userService.findById(username);
//principal = UserPrincipal.create(user);
return principal;
}
@Transactional
public UserDetails loadUserById(String id,LoginRequest loginRequest) {
UserPrincipal principal = null;
User user = userService.findById(id);
principal = UserPrincipal.create(user,loginRequest);
return principal;
}
@Transactional
public UserDetails loadUserById(UserPrincipal userPrincipal) {
//userPrincipal.setAuthorities(userPrincipal.getRoleType().stream().map(x -> new SimpleGrantedAuthority("ROLE_"+x)).collect(Collectors.toList()));
return userPrincipal;
}
@Transactional
public UserDetails loadUserById(String id,String roleType) {
UserPrincipal principal = null;
User user = userService.findById(id);
//principal = UserPrincipal.create(user);
return principal;
}
}
\ No newline at end of file
package com.iRecruit.security;
import javax.crypto.Cipher;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import org.apache.commons.codec.binary.Base64;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
public class EncrypterDecrypter {
private static final Logger logger = LogManager.getLogger(EncrypterDecrypter.class);
public static String encrypt(String key, String initVector, String value) {
try {
IvParameterSpec iv = new IvParameterSpec(initVector.getBytes("UTF-8"));
SecretKeySpec skeySpec = new SecretKeySpec(key.getBytes("UTF-8"), "AES");
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5PADDING");
cipher.init(Cipher.ENCRYPT_MODE, skeySpec, iv);
byte[] encrypted = cipher.doFinal(value.getBytes());
return Base64.encodeBase64String(encrypted);
} catch (Exception ex) {
logger.error("Exception while encryption : ",ex);
}
return null;
}
public static String decrypt(String key, String initVector, String encrypted) {
try {
IvParameterSpec iv = new IvParameterSpec(initVector.getBytes("UTF-8"));
SecretKeySpec skeySpec = new SecretKeySpec(key.getBytes("UTF-8"), "AES");
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5PADDING");
cipher.init(Cipher.DECRYPT_MODE, skeySpec, iv);
byte[] original = cipher.doFinal(Base64.decodeBase64(encrypted));
return new String(original);
} catch (Exception ex) {
logger.error("Exception while decryption : ",ex);
}
return null;
}
}
package com.iRecruit.security;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.web.AuthenticationEntryPoint;
import org.springframework.stereotype.Component;
@Component
public class JwtAuthenticationEntryPoint implements AuthenticationEntryPoint {
private static final Logger logger = LoggerFactory.getLogger(JwtAuthenticationEntryPoint.class);
@Override
public void commence(HttpServletRequest httpServletRequest,
HttpServletResponse httpServletResponse,
AuthenticationException e) throws IOException, ServletException {
logger.error("Responding with unauthorized error. Message - {}", e.getMessage());
httpServletResponse.sendError(HttpServletResponse.SC_UNAUTHORIZED, e.getMessage());
}
}
\ No newline at end of file
package com.iRecruit.security;
import java.io.IOException;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.web.authentication.WebAuthenticationDetailsSource;
import org.springframework.util.StringUtils;
import org.springframework.web.filter.OncePerRequestFilter;
import com.iRecruit.constant.DBConfig;
public class JwtAuthenticationFilter extends OncePerRequestFilter {
@Autowired
private JwtTokenProvider tokenProvider;
@Autowired
private CustomUserDetailsService customUserDetailsService;
@Autowired
DBConfig DBConfig;
private static final Logger LOG = LoggerFactory.getLogger(JwtAuthenticationFilter.class);
@Override
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException {
try {
String jwt = getJwtFromRequest(request);
if (StringUtils.hasText(jwt) && tokenProvider.validateToken(jwt)) {
UserPrincipal jwtPayload = tokenProvider.getJWT(jwt);
UserDetails userDetails = customUserDetailsService.loadUserById(jwtPayload);
UsernamePasswordAuthenticationToken authentication = new UsernamePasswordAuthenticationToken(userDetails, null, userDetails.getAuthorities());
authentication.setDetails(new WebAuthenticationDetailsSource().buildDetails(request));
jwt = tokenProvider.generateToken(authentication);
response.setHeader("auth", jwt);
UserPrincipal userPrincipal = (UserPrincipal) authentication.getPrincipal();
SecurityContextHolder.getContext().setAuthentication(authentication);
}
} catch (Exception ex) {
LOG.error("Could not set user authentication in security context", ex);
}
filterChain.doFilter(request, response);
}
private String getJwtFromRequest(HttpServletRequest request) {
String bearerToken = request.getHeader("Authorization");
if (StringUtils.hasText(bearerToken) && bearerToken.startsWith("Bearer ")) {
return EncrypterDecrypter.decrypt(DBConfig.getValue("secureKey"), DBConfig.getValue("secureInitVector"),bearerToken.substring(7, bearerToken.length()));
}
return null;
}
}
package com.iRecruit.security;
import java.io.IOException;
import java.util.Date;
import java.util.Set;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.security.core.Authentication;
import org.springframework.stereotype.Component;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.iRecruit.constant.DBConfig;
import io.jsonwebtoken.Claims;
import io.jsonwebtoken.ExpiredJwtException;
import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.MalformedJwtException;
import io.jsonwebtoken.SignatureAlgorithm;
import io.jsonwebtoken.SignatureException;
import io.jsonwebtoken.UnsupportedJwtException;
@Component
public class JwtTokenProvider {
private static final Logger LOG = LoggerFactory.getLogger(JwtTokenProvider.class);
/*
* @Value("${app.jwtSecret}") private String jwtSecret;
*
* @Value("${app.jwtExpirationInMs}") private int jwtExpirationInMs;
*
* @Value("${secureKey}") private String key;
*
* @Value("${secureInitVector}") private String initVector;
*/
@Autowired
private ObjectMapper objectMapper;
@Autowired
DBConfig DBConfig;
public String generateToken(Authentication authentication) throws JsonProcessingException {
UserPrincipal userPrincipal = (UserPrincipal) authentication.getPrincipal();
Date now = new Date();
Date expiryDate = new Date(now.getTime() + Long.parseLong(DBConfig.getValue("app.jwtExpirationInMs")));
userPrincipal.setAuthorities(null);
//JwtCustomPayload jwtCustomPayload = new JwtCustomPayload(userPrincipal.getUsername(), userPrincipal.getRoleType() , userPrincipal.getTenant());
return EncrypterDecrypter.encrypt(DBConfig.getValue("secureKey"), DBConfig.getValue("secureInitVector"), Jwts.builder().setSubject(objectMapper.writeValueAsString(userPrincipal)).setIssuedAt(new Date()).setExpiration(expiryDate).signWith(SignatureAlgorithm.HS512, DBConfig.getValue("app.jwtSecret")).compact());
}
public String generateToken(UserPrincipal userPrincipal) throws JsonProcessingException {
//UserPrincipal userPrincipal = (UserPrincipal) authentication.getPrincipal();
Date now = new Date();
Date expiryDate = new Date(now.getTime() + Long.parseLong(DBConfig.getValue("app.jwtExpirationInMs")));
userPrincipal.setAuthorities(null);
//JwtCustomPayload jwtCustomPayload = new JwtCustomPayload(userPrincipal.getUsername(), userPrincipal.getRoleType(), userPrincipal.getTenant());
return EncrypterDecrypter.encrypt(DBConfig.getValue("secureKey"), DBConfig.getValue("secureInitVector"), Jwts.builder().setSubject(objectMapper.writeValueAsString(userPrincipal)).setIssuedAt(new Date()).setExpiration(expiryDate).signWith(SignatureAlgorithm.HS512, DBConfig.getValue("app.jwtSecret")).compact());
}
public UserPrincipal getJWT(String token) throws JsonParseException, JsonMappingException, IOException {
Claims claims = Jwts.parser().setSigningKey(DBConfig.getValue("app.jwtSecret")).parseClaimsJws(token).getBody();
UserPrincipal jwtCustomPayload = objectMapper.readValue(claims.getSubject(), UserPrincipal.class);
//SMSContextHolder.setCountryCode(jwtCustomPayload.getCountryCode());
LOG.info("Parse Token: {}.", jwtCustomPayload.getRole());
return jwtCustomPayload;
}
public String getRoleTypeFromJWT(String token) throws JsonParseException, JsonMappingException, IOException {
Claims claims = Jwts.parser().setSigningKey(DBConfig.getValue("app.jwtSecret")).parseClaimsJws(token).getBody();
UserPrincipal jwtCustomPayload = objectMapper.readValue(claims.getSubject(), UserPrincipal.class);
return jwtCustomPayload.getRole();
}
public boolean validateToken(String authToken) {
try {
Jwts.parser().setSigningKey(DBConfig.getValue("app.jwtSecret")).parseClaimsJws(authToken);
return true;
} catch (SignatureException ex) {
LOG.error("Invalid JWT signature");
} catch (MalformedJwtException ex) {
LOG.error("Invalid JWT token");
} catch (ExpiredJwtException ex) {
LOG.error("Expired JWT token");
} catch (UnsupportedJwtException ex) {
LOG.error("Unsupported JWT token");
} catch (IllegalArgumentException ex) {
LOG.error("JWT claims string is empty.");
}
return false;
}
}
package com.iRecruit.security;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;
import javax.transaction.Transactional;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;
import com.iRecruit.modules.auth.model.User;
import com.iRecruit.modules.auth.payload.request.LoginRequest;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
@Getter
@Setter
@ToString
public class UserPrincipal implements UserDetails {
private String name;
private String username;
private String role;
private String email;
private String deviceInfo;
private String browserInfo;
private String OS;
private String mobileno;
private Collection<? extends GrantedAuthority> authorities;
public UserPrincipal(String name, String username, String email,String deviceInfo,String OS,String browserInfo,String mobileno, Collection<? extends GrantedAuthority> authorities) {
this.name = name;
this.username = username;
this.email = email;
this.mobileno = mobileno;
this.OS = OS;
this.browserInfo = browserInfo;
this.deviceInfo = deviceInfo;
this.authorities = authorities;
}
public UserPrincipal(String name,String username, String email,String deviceInfo,String OS,String BrowserInfo,String mobileno, Collection<? extends GrantedAuthority> authorities, Set<String> roleType) {
this.name = name;
this.username = username;
this.email = email;
this.deviceInfo = deviceInfo;
this.mobileno = mobileno;
this.authorities = authorities;
this.OS = OS;
this.browserInfo = browserInfo;
}
public UserPrincipal() {}
@Transactional
public static UserPrincipal create(User user,LoginRequest loginRequest) {
List<String> roles = new ArrayList<String>();
roles.add(user.getRole().name());
List<GrantedAuthority> authorities = roles.stream().map(role ->
new SimpleGrantedAuthority("ROLE_"+role)
).collect(Collectors.toList());
return new UserPrincipal(user.getFirstName(), user.getId(), user.getEmailId(),loginRequest.getDeviceInfo(),loginRequest.getOS(),loginRequest.getBrowserInfo(), user.getMobileNo(), authorities);
}
/*public static UserPrincipal create(User user, Set<String> roleType) {
List<GrantedAuthority> authorities = user.getRoles().stream().map(role ->
new SimpleGrantedAuthority("ROLE_"+role.getName())
).collect(Collectors.toList());
return new UserPrincipal(
user.getId(),
user.getFName(),
user.getUserId(),
user.getEmail(),
user.getPassword(),
user.getMobileNumber(),
authorities,
roleType
);
}*/
public String getDeviceInfo() {
return this.deviceInfo;
}
public String getOS() {
return this.OS;
}
public String getBrowserInfo() {
return this.browserInfo;
}
@Override
public String getPassword() {
return null;
}
@Override
public Collection<? extends GrantedAuthority> getAuthorities() {
return authorities;
}
@Override
public boolean isAccountNonExpired() {
return true;
}
@Override
public boolean isAccountNonLocked() {
return true;
}
@Override
public boolean isCredentialsNonExpired() {
return true;
}
@Override
public boolean isEnabled() {
return true;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
UserPrincipal that = (UserPrincipal) o;
return Objects.equals(username, that.username);
}
@Override
public int hashCode() {
return Objects.hash(username);
}
@Override
public String getUsername() {
// TODO Auto-generated method stub
return username;
}
}
\ No newline at end of file
spring.datasource.url = jdbc:mysql://localhost:3306/imcalculator?useSSL=false&serverTimezone=UTC&useLegacyDatetimeCode=false
irecruit.datasource.url = jdbc:oracle:thin:@192.168.10.120:1521:orcl
irecruit.datasource.jndi-name=jdbc/irecruit
irecruit.jpa.hibernate.ddl-auto=update
irecruit.datasource.username = root
irecruit.datasource.password = P@ssw0rd
irecruit.datasource.initialization-mode=always
irecruit.datasource.driver-class-name=com.mysql.jdbc.Driver
irecruit.jpa.hibernate.globally_quoted_identifiers=true
irecruit.jpa.hibernate.physical_naming_strategy=com.iRecruit.config.CustomPhysicalNamingStrategy
#naaf.datasource.url = jdbc:oracle:thin:@192.168.10.210:1521:xe
#naaf.jpa.hibernate.ddl-auto=update
#naaf.datasource.username = FD_UAT
#naaf.datasource.password = FD_UAT
#naaf.datasource.initialization-mode=always
#naaf.datasource.driver-class-name=oracle.jdbc.driver.OracleDriver
naaf.datasource.url = jdbc:oracle:thin:@192.168.10.120:1521:orcl
naaf.jpa.hibernate.ddl-auto=update
naaf.datasource.username = SOUAT
naaf.datasource.password = tata
naaf.datasource.initialization-mode=always
naaf.datasource.driver-class-name=oracle.jdbc.driver.OracleDriver
spring.datasource.driver-class-name=oracle.jdbc.driver.OracleDriver
spring.datasource.hikari.connectionTimeout=30000
spring.datasource.hikari.validationTimeout=5000
spring.datasource.hikari.maximumPoolSize=10
spring.datasource.hikari.maxLifetime=1800000
spring.datasource.hikari.idleTimeout=600000
spring.datasource.hikari.minimumIdle=10
spring.datasource.hikari.poolName=startup-connection-pool
logging.level.org.hibernate.SQL= DEBUG
server.port=8082
spring.jackson.serialization.WRITE_DATES_AS_TIMESTAMPS= false
spring.jackson.time-zone= UTC
#app.jwtSecret= JWTSuperSecretKey
#app.jwtExpirationInMs = 604800000
#secureKey=Bar12345Bar12345
#secureInitVector=RandomInitVector
# 5 Minutes for forgot password reset session
#password.resetExpirationInMs = 604800000
# 1 Minutes for Generate Otp session
#mobileno.generateOtpExpirationInMs = 60000
logging.level.com.appsdeveloperblog.examples=DEBUG
logging.file = /data/Nirav/projects/SMS/service.log
management.endpoints.web.exposure.include=*
management.endpoints.web.exposure.exclude=
management.health.mongo.enabled=false
management.endpoint.health.show-details=always
management.security.enabled=true
security.basic.enabled=true
spring.security.user.name=actuator
spring.security.user.password=actuator
spring.security.user.roles=Admin
app.firebase-configuration-file=google/firebase-adminsdk.json
app.notifications.defaults={topic: 'common', title: 'Common topic - Hello', message: 'Sending test message \uD83D\uDE42', token: 'ss22t03wz208eg:APA2idkkow223FE_0v5yHxqCLTyxAQafj6nWaqi4QzwZTW004q1PUux63UsFN', payloadMessageId: '123', payloadData: 'Hello. This is payload content.'}
spring.mail.host=smtp.gmail.com
spring.mail.port=587
spring.mail.username=it2005nn@gmail.com
spring.mail.password=gmail111110
# Other properties
spring.mail.properties.mail.smtp.auth=true
spring.mail.properties.mail.smtp.connectiontimeout=5000
spring.mail.properties.mail.smtp.timeout=5000
spring.mail.properties.mail.smtp.writetimeout=5000
# TLS , port 587
spring.mail.properties.mail.smtp.starttls.enable=true
spring.sms.url= http://text160.in/otphttp.php?authkey=3TMBFENqamaHyaSSakB3&mobiles=##_numbers_##&message=##_message_##&sender=SMSAPP&route=4&country=91
\ No newline at end of file
CREATE TABLE `tbl_users` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`createdBy` bigint(20) DEFAULT NULL,
`createdDate` datetime DEFAULT NULL,
`lastModifiedBy` bigint(20) DEFAULT NULL,
`lastModifiedDate` datetime DEFAULT NULL,
`status` int(11) DEFAULT NULL,
`PAN` varchar(10) DEFAULT NULL,
`email` varchar(255) DEFAULT NULL,
`fName` varchar(255) DEFAULT NULL,
`isPrimary` bit(1) NOT NULL,
`lName` varchar(255) DEFAULT NULL,
`mName` varchar(255) DEFAULT NULL,
`mobileNumber` varchar(255) DEFAULT NULL,
`password` varchar(255) DEFAULT NULL,
`profilePicture` longtext,
`relation` varchar(255) DEFAULT NULL,
`userId` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `UK_gb4f9vy8o2r8y68dt1rx5p0rq` (`userId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
ALTER TABLE `tbl_users` ADD COLUMN `notificationId` VARCHAR(255) default null;
CREATE TABLE `tbl_roles` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`createdBy` bigint(20) DEFAULT NULL,
`createdDate` datetime DEFAULT NULL,
`lastModifiedBy` bigint(20) DEFAULT NULL,
`lastModifiedDate` datetime DEFAULT NULL,
`status` int(11) DEFAULT NULL,
`name` varchar(60) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `UK_7i2jhp8gaw6a1vjbtwide88vp` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `tbl_user_roles` (
`userId` bigint(20) NOT NULL,
`roleId` bigint(20) NOT NULL,
PRIMARY KEY (`userId`,`roleId`),
KEY `FK425h90jc6vygkqssxb1y10bol` (`roleId`),
CONSTRAINT `FK2uh8vv81vjsa46xnwvak5msxa` FOREIGN KEY (`userId`) REFERENCES `tbl_users` (`id`),
CONSTRAINT `FK425h90jc6vygkqssxb1y10bol` FOREIGN KEY (`roleId`) REFERENCES `tbl_roles` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `tenants` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`createdBy` bigint(20) DEFAULT NULL,
`createdDate` datetime DEFAULT NULL,
`lastModifiedBy` bigint(20) DEFAULT NULL,
`lastModifiedDate` datetime DEFAULT NULL,
`status` int(11) DEFAULT NULL,
`PAN` varchar(10) DEFAULT NULL,
`address` varchar(255) DEFAULT NULL,
`city` varchar(255) DEFAULT NULL,
`citySurveyNumber` varchar(255) DEFAULT NULL,
`email` varchar(255) DEFAULT NULL,
`name` varchar(255) DEFAULT NULL,
`phoneNumber` varchar(255) DEFAULT NULL,
`pincode` int(11) NOT NULL,
`profilePicture` longtext,
`schemaName` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `UK_538lm8mqtttyah8jxliglc2xq` (`PAN`),
UNIQUE KEY `UK_ribivgliwsaqa0clee1v4k7ol` (`citySurveyNumber`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `tbl_user_tenant` (
`id` varchar(255) NOT NULL,
`isDefault` bit(1) NOT NULL,
`userId` varchar(255) DEFAULT NULL,
`tenantId` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `FK8wcahi4unsun2j5c0n5cv0qjh` (`tenantId`),
CONSTRAINT `FK8wcahi4unsun2j5c0n5cv0qjh` FOREIGN KEY (`tenantId`) REFERENCES `tenants` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `tbl_group` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`createdBy` bigint(20) DEFAULT NULL,
`createdDate` datetime DEFAULT NULL,
`lastModifiedBy` bigint(20) DEFAULT NULL,
`lastModifiedDate` datetime DEFAULT NULL,
`status` int(11) DEFAULT NULL,
`name` varchar(60) DEFAULT NULL,
`type` varchar(60) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `UK_gkhqxoqotwe6ka9rnfxx2s35v` (`name`),
UNIQUE KEY `UK_38jc70cl58nj3ksye1xyhydum` (`type`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `tbl_user_group` (
`groupId` bigint(20) NOT NULL,
`userID` bigint(20) NOT NULL,
PRIMARY KEY (`userID`,`groupId`),
KEY `FKjb8fefkepb1l3xcrwyokxxjwo` (`groupId`),
CONSTRAINT `FKd7lu34k7qgfrv3d7sa0dh6vl4` FOREIGN KEY (`userID`) REFERENCES `tbl_users` (`id`),
CONSTRAINT `FKjb8fefkepb1l3xcrwyokxxjwo` FOREIGN KEY (`groupId`) REFERENCES `tbl_group` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `tbl_userOTP` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`createdBy` bigint(20) DEFAULT NULL,
`createdDate` datetime DEFAULT NULL,
`lastModifiedBy` bigint(20) DEFAULT NULL,
`lastModifiedDate` datetime DEFAULT NULL,
`OTP` varchar(255) DEFAULT NULL,
`status` int(11) NOT NULL,
`user` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `FK2qp5c0sw96io99abxai46qo9q` (`user`),
CONSTRAINT `FK2qp5c0sw96io99abxai46qo9q` FOREIGN KEY (`user`) REFERENCES `tbl_users` (`id`)
);
INSERT INTO `tbl_users` (`id`,`createdBy`,`createdDate`,`lastModifiedBy`,`lastModifiedDate`,`PAN`,`email`,`fName`,`isPrimary`,`lName`,`mName`,`mobileNumber`,`password`,`profilePicture`,`relation`,`userId`,status) VALUES (1,1,'2019-12-02 00:00:00',1,'2019-12-02 00:00:00','ANBPM2750K','it2005nn@gmail.com','nirav',1,'modi','narendrakumar','9033882640','$2a$10$KiLXrDn/BmxnYPogKWM03.OQ.t8nnwfPGlKrEueXQ5xkXgKa1vLVu',null,null,'9033882640',1);
INSERT INTO `tbl_user_tenant` VALUES ('1',0,'9033882640',NULL);
INSERT INTO `tbl_roles` VALUES (1,1,'2019-12-03 00:00:00',1,'2019-12-03 00:00:00',1,'Admin'),(2,1,'2019-12-03 00:00:00',1,'2019-12-03 00:00:00',1,'User');
INSERT INTO `tbl_user_roles` VALUES (1,1),(1,2);
CREATE TABLE `app_profile` (
`app_id` bigint(20) NOT NULL AUTO_INCREMENT,
`createdBy` bigint(20) DEFAULT NULL,
`createdDate` datetime DEFAULT NULL,
`lastModifiedBy` bigint(20) DEFAULT NULL,
`lastModifiedDate` datetime DEFAULT NULL,
`PAN` varchar(10) DEFAULT NULL,
`email` varchar(255) DEFAULT NULL,
`fName` varchar(255) DEFAULT NULL,
`lName` varchar(255) DEFAULT NULL,
`mName` varchar(255) DEFAULT NULL,
`mobileNumber` varchar(255) DEFAULT NULL,
`userId` varchar(255) DEFAULT NULL,
`password` varchar(255) DEFAULT NULL,
PRIMARY KEY (`app_id`),
UNIQUE KEY `UK_gb4f9vy8o2r8y68dt1rx5p0rq` (`userId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT INTO `app_profile` (`app_id`,`createdBy`,`createdDate`,`lastModifiedBy`,`lastModifiedDate`,`PAN`,`email`,`fName`,`lName`,`mName`,`mobileNumber`,`userId`,`password`) VALUES (1,1,'2019-12-02 00:00:00',1,'2019-12-02 00:00:00','ANBPM2750K','it2005nn@gmail.com','nirav','modi','narendrakumar','9033882640','9033882640','nirav123');
CREATE TABLE `Cart` (
`cart_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`cart_id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;
CREATE TABLE `Items` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(255) DEFAULT NULL,
`cart_id` int(11) unsigned NOT NULL,
PRIMARY KEY (`id`),
KEY `cart_id` (`cart_id`),
CONSTRAINT `items_ibfk_1` FOREIGN KEY (`cart_id`) REFERENCES `Cart` (`cart_id`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8;
\ No newline at end of file
CREATE TABLE `tbl_interview_steps` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`createdBy` bigint(20) DEFAULT NULL,
`createdDate` datetime DEFAULT NULL,
`lastModifiedBy` bigint(20) DEFAULT NULL,
`lastModifiedDate` datetime DEFAULT NULL,
`name` varchar(255) DEFAULT NULL,
`role` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8;
CREATE TABLE `tbl_interview_groups` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`createdBy` bigint(20) DEFAULT NULL,
`createdDate` datetime DEFAULT NULL,
`lastModifiedBy` bigint(20) DEFAULT NULL,
`lastModifiedDate` datetime DEFAULT NULL,
`name` varchar(255) DEFAULT NULL,
`step_id` int(11) unsigned NOT NULL,
PRIMARY KEY (`id`),
KEY `step_id_ibfk_1` (`step_id`),
CONSTRAINT `step_id_ibfk_1` FOREIGN KEY (`step_id`) REFERENCES `tbl_interview_steps` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8;
CREATE TABLE `tbl_interview_questions` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`createdBy` bigint(20) DEFAULT NULL,
`createdDate` datetime DEFAULT NULL,
`lastModifiedBy` bigint(20) DEFAULT NULL,
`lastModifiedDate` datetime DEFAULT NULL,
`question` varchar(255) DEFAULT NULL,
`type` varchar(255) DEFAULT NULL,
`isRemark` bit(1) NOT NULL,
`group_id` int(11) unsigned NOT NULL,
PRIMARY KEY (`id`),
KEY `group_id_ibfk_1` (`group_id`),
CONSTRAINT `group_id_ibfk_1` FOREIGN KEY (`group_id`) REFERENCES `tbl_interview_groups` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8;
CREATE TABLE `tbl_interview_question_options` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`createdBy` bigint(20) DEFAULT NULL,
`createdDate` datetime DEFAULT NULL,
`lastModifiedBy` bigint(20) DEFAULT NULL,
`lastModifiedDate` datetime DEFAULT NULL,
`option` varchar(255) DEFAULT NULL,
`lable` varchar(255) DEFAULT NULL,
`value` varchar(255) DEFAULT NULL,
`score` varchar(255) DEFAULT NULL,
`question_id` int(11) unsigned NOT NULL,
PRIMARY KEY (`id`),
KEY `question_id_ibfk_1` (`question_id`),
CONSTRAINT `question_id_ibfk_1` FOREIGN KEY (`question_id`) REFERENCES `tbl_interview_questions` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8;
CREATE TABLE `tbl_interview_question_results` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`user` varchar(255) DEFAULT NULL,
`type` varchar(255) DEFAULT NULL,
`account_id` int(11) unsigned NOT NULL,
`question_id` int(11) unsigned NOT NULL,
`result` varchar(255) DEFAULT NULL,
`score` varchar(255) DEFAULT NULL,
`remark` varchar(255) DEFAULT NULL,
`step_id` int(11) unsigned NOT NULL,
`group_id` int(11) unsigned NOT NULL,
PRIMARY KEY (`id`),
KEY `question_id_ibfk_2` (`question_id`),
CONSTRAINT `question_id_ibfk_2` FOREIGN KEY (`question_id`) REFERENCES `tbl_interview_questions` (`id`),
KEY `group_id_ibfk_2` (`group_id`),
CONSTRAINT `group_id_ibfk_2` FOREIGN KEY (`group_id`) REFERENCES `tbl_interview_groups` (`id`),
KEY `step_id_ibfk_2` (`step_id`),
CONSTRAINT `step_id_ibfk_2` FOREIGN KEY (`step_id`) REFERENCES `tbl_interview_steps` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8;
CREATE TABLE `tbl_interview_results` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`user` varchar(255) DEFAULT NULL,
`type` varchar(255) DEFAULT NULL,
`account_id` int(11) unsigned NOT NULL,
`remark` varchar(255) DEFAULT NULL,
`action` varchar(255) DEFAULT NULL,
`total_score` varchar(255) DEFAULT NULL,
`given_score` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8;
CREATE TABLE `tbl_audit_log` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`service` varchar(255) DEFAULT NULL,
`source_ip` varchar(255) DEFAULT NULL,
`username` varchar(255) DEFAULT NULL,
`status` varchar(255) DEFAULT NULL,
'error_msg' varchar(255) DEFAULT NULL,
'time_taken' bigint(20) DEFAULT NULL,
'time_stamp' TIMESTAMP DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8;
\ No newline at end of file
{
"type": "service_account",
"project_id": "societymanagementsystem-c0bd7",
"private_key_id": "bec455d67f5bb7c30661be8c12b94cb83d8302b1",
"private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQC9hJhmZdQmX9NU\nf6ku6HqGLTAp0JoJtM86pmgBNiqawxYg1CDgjSB6o8lCmVdCy86L3TL0ItRrV2k7\n75251BqblVNCc4TupvgwXfJLHEWC5bnHK/vrSt6/jzrRw/Nn2z9sLhDu0vYhfJUL\ndjM3Pjrswf9tKLWhCin00kr5lFj/0IJ/TJ4UYSJpPJ6dOQpLdwrvq4VX+iv6nYnE\nFDflC9Fksbk/kIl22OvPE8IIKd5c4Z2FaFO/vQBjYfjAHLn0oMokpvLx+WDDoVNx\n0Xi8oP3Yj+k9ds7sOjcaeUzusF+OqgCPFUgF0BqKeBjXCS6NGSnbEq9YXYYw8n4I\nxGim8sCVAgMBAAECggEAEAIEMW9bz8X7qWvYaYWU29fd9UTmeKK/d6UYrImGaGjJ\nagp2SyFV41C0WPNvgyKIlsMfYQRpduD88DrEKC8knuGqamGBkqWjLyAFrZcnaUVo\nP3eVTCxDIQvDHHbLDN8LE2Msu6TcH2X7h5VQrCjjJ0kXqdZsyREntsM7NqueJ4qw\nQsFJcbYjiMAMNDvPcEeg86WTcjakhSb1IEcbMrwmPayKcvzuxwUz6Q09+IADpCyZ\neLH+/SKKBunGJLedFlPyWy4HppaK1FuYQQN/V0nJvFk7smuBrKybn0tHqaXbUUFY\n/IKGbhKqTPS3Yxs1Ih4hurrKSoSrWxKGEI+B8D17XQKBgQDqbjvCf/6y5l5kOfME\n6VW+WwyJmrPzCsX+uTZgoLbFZXcP72RZWbHalQUpiM/ePF+d4QsYAy9MpJZfzdpj\n/iq93gwTHBNR3osS269BPIIWaEluQlwzzmDQNZ5bJPYg0BkQtRah2vS99vxej3as\nF3OkE2D7L5BGmmx3oaAKh4Pr2wKBgQDO9H3Za+xrxTwAMqdCgBgV59K+RfjZug08\nnVDFGYn71aobg+daxRYo+EX7PmCThK4SU7idH6YU2v+2rMdY2RvqIBR6KMMD/ExI\n+ZqbwV4DQbUc8ui3z7JTfaPClwyYOXDQ36TT3HdciC7l3dPT/ahtffxMAAfJIlw6\nZPkPCgRoTwKBgQC8LAGB7PWHqkxoDO/ZqGXv5uuYZHo/Aw3MmeRhCX/L0NcSDmkx\nI0MUnftHzI5152YktygNfTjxP0eI3RaIntK2Fs8AY8/KLmTZnUb+iVAuJkWS4Gdc\nGjMxzWgv5uo9imwkMgdZogRDm0YVrPhnyGdFc1ysIxCe64NXP3/UE9S7cwKBgQCB\n2NapNtSUXaCiwyU8TSBPhi8soLxc5yXs9Qs7TyXK8ykSsHTU97lKpVNLKrzvcZzB\n9PNs6fGLPkiYtdkxfq7L+6q9ZpvNAVxfoPQHa5Bv3Kck7adjxJWvWrIHojwNumR1\nOQyyvK3LScqbAM4qQQmPAS/uA0rfQIa7QKUfcXqIcwKBgF4A4amvUpOSjkeXkrZK\n2n/WyDnWilFSRX1LxO4oQUo6TrjsjHpy+kzgKdO0GGWXk19Asnt+N0WFrOzTGcf9\nUqJSxEwjB3JLRHsD6HslCzmKZb8+wu9e7Mi2oIF+9cM+OnxyEEaBLttoQbPuzM6t\n8faupMujLiHMp6eBh0sCkNIx\n-----END PRIVATE KEY-----\n",
"client_email": "firebase-adminsdk-tgs94@societymanagementsystem-c0bd7.iam.gserviceaccount.com",
"client_id": "114425315501899056441",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/firebase-adminsdk-tgs94%40societymanagementsystem-c0bd7.iam.gserviceaccount.com"
}
\ No newline at end of file
package com.iRecruit;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class SmsApplicationTests {
@Test
void contextLoads() {
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment