Browse Source

Enrolled, Punched List Done

master
sachinsavita 4 years ago
commit
77d8db8e4c
  1. 33
      .gitignore
  2. BIN
      .mvn/wrapper/maven-wrapper.jar
  3. 2
      .mvn/wrapper/maven-wrapper.properties
  4. 316
      mvnw
  5. 188
      mvnw.cmd
  6. 85
      pom.xml
  7. 21
      src/main/java/com/gcc/biometric/api/GccBioMetricApi/GccAttendanceApplication.java
  8. 24
      src/main/java/com/gcc/biometric/api/GccBioMetricApi/TestApp.java
  9. 54
      src/main/java/com/gcc/biometric/api/GccBioMetricApi/controller/ApiRespo.java
  10. 112
      src/main/java/com/gcc/biometric/api/GccBioMetricApi/controller/ApiResponse.java
  11. 95
      src/main/java/com/gcc/biometric/api/GccBioMetricApi/controller/CustomerRestController.java
  12. 79
      src/main/java/com/gcc/biometric/api/GccBioMetricApi/controller/DepartmentHQAbsenteesDataController.java
  13. 124
      src/main/java/com/gcc/biometric/api/GccBioMetricApi/controller/DeptHeadQuaterOfficeController.java
  14. 55
      src/main/java/com/gcc/biometric/api/GccBioMetricApi/controller/DeviceStatusRestController.java
  15. 69
      src/main/java/com/gcc/biometric/api/GccBioMetricApi/controller/EmployeeRestController.java
  16. 340
      src/main/java/com/gcc/biometric/api/GccBioMetricApi/controller/EnrolledEmpListDataController.java
  17. 125
      src/main/java/com/gcc/biometric/api/GccBioMetricApi/controller/FormatTestingController.java
  18. 308
      src/main/java/com/gcc/biometric/api/GccBioMetricApi/controller/HeadQuaterEntriesRestController.java
  19. 127
      src/main/java/com/gcc/biometric/api/GccBioMetricApi/controller/HeadQuaterOfficeController.java
  20. 53
      src/main/java/com/gcc/biometric/api/GccBioMetricApi/controller/MachineRawPunchRestController.java
  21. 501
      src/main/java/com/gcc/biometric/api/GccBioMetricApi/controller/PunchedEmpListDataController.java
  22. 79
      src/main/java/com/gcc/biometric/api/GccBioMetricApi/controller/RDCAbsenteesDataController.java
  23. 51
      src/main/java/com/gcc/biometric/api/GccBioMetricApi/controller/RealTimeUserInfoRestController.java
  24. 113
      src/main/java/com/gcc/biometric/api/GccBioMetricApi/controller/RegionalDeputyCommissionerController.java
  25. 284
      src/main/java/com/gcc/biometric/api/GccBioMetricApi/controller/ResultRestController.java
  26. 117
      src/main/java/com/gcc/biometric/api/GccBioMetricApi/controller/UserCountRestController.java
  27. 79
      src/main/java/com/gcc/biometric/api/GccBioMetricApi/controller/ZonalAbsenteesDataController.java
  28. 86
      src/main/java/com/gcc/biometric/api/GccBioMetricApi/controller/ZonalOfficeTotalDateController.java
  29. 48
      src/main/java/com/gcc/biometric/api/GccBioMetricApi/controller/ZoneDivMasterController.java
  30. 194
      src/main/java/com/gcc/biometric/api/GccBioMetricApi/controller/ZoneDivisionOfficeAbsenteesDataController.java
  31. 523
      src/main/java/com/gcc/biometric/api/GccBioMetricApi/controller/ZoneDivisionOfficeController.java
  32. 18
      src/main/java/com/gcc/biometric/api/GccBioMetricApi/dao/CustomerDAO.java
  33. 71
      src/main/java/com/gcc/biometric/api/GccBioMetricApi/dao/CustomerDAOImpl.java
  34. 59
      src/main/java/com/gcc/biometric/api/GccBioMetricApi/dao/CustomerDAOJpaImpl.java
  35. 12
      src/main/java/com/gcc/biometric/api/GccBioMetricApi/dao/DeviceStatusDAO.java
  36. 37
      src/main/java/com/gcc/biometric/api/GccBioMetricApi/dao/DeviceStatusDAOImpl.java
  37. 13
      src/main/java/com/gcc/biometric/api/GccBioMetricApi/dao/EmployeeDAO.java
  38. 59
      src/main/java/com/gcc/biometric/api/GccBioMetricApi/dao/EmployeeDAOImpl.java
  39. 10
      src/main/java/com/gcc/biometric/api/GccBioMetricApi/dao/MachineRawPunchDAO.java
  40. 36
      src/main/java/com/gcc/biometric/api/GccBioMetricApi/dao/MachineRawPunchDAOImpl.java
  41. 11
      src/main/java/com/gcc/biometric/api/GccBioMetricApi/dao/RealTimeUserInfoDAO.java
  42. 55
      src/main/java/com/gcc/biometric/api/GccBioMetricApi/dao/RealTimeUserInfoDAOImpl.java
  43. 91
      src/main/java/com/gcc/biometric/api/GccBioMetricApi/entity/Customer.java
  44. 84
      src/main/java/com/gcc/biometric/api/GccBioMetricApi/entity/DeviceStatus.java
  45. 214
      src/main/java/com/gcc/biometric/api/GccBioMetricApi/entity/Employee.java
  46. 53
      src/main/java/com/gcc/biometric/api/GccBioMetricApi/entity/HeadQuaterEntries.java
  47. 113
      src/main/java/com/gcc/biometric/api/GccBioMetricApi/entity/MachineRawPunchh.java
  48. 108
      src/main/java/com/gcc/biometric/api/GccBioMetricApi/entity/RealTimeUserInfo.java
  49. 44
      src/main/java/com/gcc/biometric/api/GccBioMetricApi/entity/ZoneDivMaster.java
  50. 37
      src/main/java/com/gcc/biometric/api/GccBioMetricApi/exception/CustomizedResponseEntityExceptionHandler.java
  51. 29
      src/main/java/com/gcc/biometric/api/GccBioMetricApi/exception/ExceptionResponse.java
  52. 12
      src/main/java/com/gcc/biometric/api/GccBioMetricApi/repo/CustomerRepository.java
  53. 21
      src/main/java/com/gcc/biometric/api/GccBioMetricApi/repo/DeptHQAbsenteesDataRepository.java
  54. 54
      src/main/java/com/gcc/biometric/api/GccBioMetricApi/repo/DeptHeadQuaterOfficeRepository.java
  55. 13
      src/main/java/com/gcc/biometric/api/GccBioMetricApi/repo/DeviceStatusRepository.java
  56. 49
      src/main/java/com/gcc/biometric/api/GccBioMetricApi/repo/EmployeeRepository.java
  57. 249
      src/main/java/com/gcc/biometric/api/GccBioMetricApi/repo/EnrolledEmpListDataRepository.java
  58. 324
      src/main/java/com/gcc/biometric/api/GccBioMetricApi/repo/HeadQuaterEntriesRepository.java
  59. 12
      src/main/java/com/gcc/biometric/api/GccBioMetricApi/repo/MachineRawPunchRepository.java
  60. 140
      src/main/java/com/gcc/biometric/api/GccBioMetricApi/repo/PunchedEmpListDataRepository.java
  61. 21
      src/main/java/com/gcc/biometric/api/GccBioMetricApi/repo/RDCAbsenteesDataRepository.java
  62. 13
      src/main/java/com/gcc/biometric/api/GccBioMetricApi/repo/RealTimeUserInfoRepository.java
  63. 338
      src/main/java/com/gcc/biometric/api/GccBioMetricApi/repo/RegionalDeputyCommissionerRepository.java
  64. 51
      src/main/java/com/gcc/biometric/api/GccBioMetricApi/repo/ZonalAbsenteesDataRepository.java
  65. 34
      src/main/java/com/gcc/biometric/api/GccBioMetricApi/repo/ZonalOfficeTotalDataRepository.java
  66. 93
      src/main/java/com/gcc/biometric/api/GccBioMetricApi/repo/ZoneDivisionOfficeAbsenteesDataRepository.java
  67. 262
      src/main/java/com/gcc/biometric/api/GccBioMetricApi/repo/ZoneDivisionOfficeRepository.java
  68. 17
      src/main/java/com/gcc/biometric/api/GccBioMetricApi/service/CustomerService.java
  69. 71
      src/main/java/com/gcc/biometric/api/GccBioMetricApi/service/CustomerServiceImpl.java
  70. 19
      src/main/java/com/gcc/biometric/api/GccBioMetricApi/service/DeviceStatusService.java
  71. 76
      src/main/java/com/gcc/biometric/api/GccBioMetricApi/service/DeviceStatusServiceImpl.java
  72. 29
      src/main/java/com/gcc/biometric/api/GccBioMetricApi/service/EmployeeService.java
  73. 75
      src/main/java/com/gcc/biometric/api/GccBioMetricApi/service/EmployeeServiceImpl.java
  74. 10
      src/main/java/com/gcc/biometric/api/GccBioMetricApi/service/HeadQuaterEntriesService.java
  75. 44
      src/main/java/com/gcc/biometric/api/GccBioMetricApi/service/HeadQuaterEntriesServiceImpl.java
  76. 17
      src/main/java/com/gcc/biometric/api/GccBioMetricApi/service/MachineRawPunchService.java
  77. 57
      src/main/java/com/gcc/biometric/api/GccBioMetricApi/service/MachineRawPunchServiceImpl.java
  78. 17
      src/main/java/com/gcc/biometric/api/GccBioMetricApi/service/RealTimeUserInfoService.java
  79. 56
      src/main/java/com/gcc/biometric/api/GccBioMetricApi/service/RealTimeUserInfoServiceImpl.java
  80. 12
      src/main/java/com/gcc/biometric/api/GccBioMetricApi/service/ZoneDivMasterService.java
  81. 40
      src/main/java/com/gcc/biometric/api/GccBioMetricApi/service/ZoneDivMasterServiceImpl.java
  82. 31
      src/main/java/com/gcc/biometric/api/GccBioMetricApi/swagger/SwaggerConfig.java
  83. 5
      src/main/resources/META-INF/additional-spring-configuration-metadata.json
  84. 70
      src/main/resources/application.properties
  85. 13
      src/test/java/com/gcc/biometric/api/GccBioMetricApi/GccAttendanceApplicationTests.java

33
.gitignore

@ -0,0 +1,33 @@
HELP.md
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/
### VS Code ###
.vscode/

BIN
.mvn/wrapper/maven-wrapper.jar

2
.mvn/wrapper/maven-wrapper.properties

@ -0,0 +1,2 @@
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.6/apache-maven-3.8.6-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar

316
mvnw

@ -0,0 +1,316 @@
#!/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.
# ----------------------------------------------------------------------------
# ----------------------------------------------------------------------------
# Maven 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 /usr/local/etc/mavenrc ] ; then
. /usr/local/etc/mavenrc
fi
if [ -f /etc/mavenrc ] ; then
. /etc/mavenrc
fi
if [ -f "$HOME/.mavenrc" ] ; then
. "$HOME/.mavenrc"
fi
fi
# OS specific support. $var _must_ be set to either true or false.
cygwin=false;
darwin=false;
mingw=false
case "`uname`" in
CYGWIN*) cygwin=true ;;
MINGW*) mingw=true;;
Darwin*) darwin=true
# Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
# See https://developer.apple.com/library/mac/qa/qa1170/_index.html
if [ -z "$JAVA_HOME" ]; then
if [ -x "/usr/libexec/java_home" ]; then
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="`\\unset -f command; \\command -v java`"
fi
fi
if [ ! -x "$JAVACMD" ] ; then
echo "Error: JAVA_HOME is not defined correctly." >&2
echo " We cannot execute $JAVACMD" >&2
exit 1
fi
if [ -z "$JAVA_HOME" ] ; then
echo "Warning: JAVA_HOME environment variable is not set."
fi
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/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
else
jarUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.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" || rm -f "$wrapperJarPath"
else
wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" || rm -f "$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 \
$MAVEN_DEBUG_OPTS \
-classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
"-Dmaven.home=${M2_HOME}" \
"-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"

188
mvnw.cmd

@ -0,0 +1,188 @@
@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 Maven 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 keystroke before ending
@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
@REM e.g. to debug Maven itself, use
@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
@REM ----------------------------------------------------------------------------
@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
@echo off
@REM set title of command window
title %0
@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on'
@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
@REM set %HOME% to equivalent of $HOME
if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
@REM Execute a user defined script before this one
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
@REM check for pre script, once with legacy .bat ending and once with .cmd ending
if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %*
if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %*
:skipRcPre
@setlocal
set ERROR_CODE=0
@REM To isolate internal variables from possible post scripts, we use another setlocal
@setlocal
@REM ==== START VALIDATION ====
if not "%JAVA_HOME%" == "" goto OkJHome
echo.
echo Error: JAVA_HOME not found in your environment. >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error
:OkJHome
if exist "%JAVA_HOME%\bin\java.exe" goto init
echo.
echo Error: JAVA_HOME is set to an invalid directory. >&2
echo JAVA_HOME = "%JAVA_HOME%" >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error
@REM ==== END VALIDATION ====
:init
@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
@REM Fallback to current working directory if not found.
set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
set EXEC_DIR=%CD%
set WDIR=%EXEC_DIR%
:findBaseDir
IF EXIST "%WDIR%"\.mvn goto baseDirFound
cd ..
IF "%WDIR%"=="%CD%" goto baseDirNotFound
set WDIR=%CD%
goto findBaseDir
:baseDirFound
set MAVEN_PROJECTBASEDIR=%WDIR%
cd "%EXEC_DIR%"
goto endDetectBaseDir
:baseDirNotFound
set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
cd "%EXEC_DIR%"
:endDetectBaseDir
IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
@setlocal EnableExtensions EnableDelayedExpansion
for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
:endReadAdditionalConfig
SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
FOR /F "usebackq 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%/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.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 "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat"
if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd"
:skipRcPost
@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
if "%MAVEN_BATCH_PAUSE%"=="on" pause
if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE%
cmd /C exit /B %ERROR_CODE%

85
pom.xml

@ -0,0 +1,85 @@
<?xml version="1.0" encoding="UTF-8"?>
<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.7.5</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<groupId>com.gcc.biometric.api</groupId>
<artifactId>GccBioMetricApi</artifactId>
<version>2.0.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>GccBioMetricApi</name>
<description>Spring Boot Api</description>
<properties>
<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-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>8.4.1.jre8</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<!--######################################### -->
<!--<dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-core</artifactId>
</dependency> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-entitymanager</artifactId>
</dependency> -->
<!--######################################### -->
<!-- https://mvnrepository.com/artifact/org.json/json -->
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20171018</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency> <!--$NO-MVN-MAN-VER$ -->
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
<defaultGoal>package</defaultGoal>
</build>
</project>

21
src/main/java/com/gcc/biometric/api/GccBioMetricApi/GccAttendanceApplication.java

@ -0,0 +1,21 @@
package com.gcc.biometric.api.GccBioMetricApi;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class GccAttendanceApplication{
public static void main(String[] args) {
SpringApplication.run(GccAttendanceApplication.class, args);
}
}

24
src/main/java/com/gcc/biometric/api/GccBioMetricApi/TestApp.java

@ -0,0 +1,24 @@
package com.gcc.biometric.api.GccBioMetricApi;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Vector;
import java.security.*;
public class TestApp {
public static void main(String[] args) {
for (Provider provider: Security.getProviders()) {
System.out.println(provider.getName());
for (String key: provider.stringPropertyNames())
System.out.println("\t" + key + "\t" + provider.getProperty(key));
}
}
}

54
src/main/java/com/gcc/biometric/api/GccBioMetricApi/controller/ApiRespo.java

@ -0,0 +1,54 @@
package com.gcc.biometric.api.GccBioMetricApi.controller;
//package com.gcc.biometric.api.GccBioMetricApi.rest;
//
//import java.io.Serializable;
//import java.util.HashSet;
//import java.util.Iterator;
//import java.util.LinkedHashSet;
//import java.util.List;
//
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.web.bind.annotation.GetMapping;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RestController;
//
//import com.gcc.biometric.api.GccBioMetricApi.entity.ZoneDivMaster;
//import com.gcc.biometric.api.GccBioMetricApi.service.ZoneDivMasterService;
//
//@RestController
//@RequestMapping("/gcc.com")
//public class ApiRespo implements Serializable{
//
// @Autowired
// private ZoneDivMasterController zoneDivMasterController;
//
// @Autowired
// UserCountRestController userCountRestController;
//
//
// Object[] finalResult = new Object[16];
//
// @GetMapping("/tempzone")
// public Object[] getZones()
// {
//
// //Getting Zone List
// HashSet<ZoneDivMaster> zoneList = ZoneDivMasterController.getZoneList();
// Object[] tempzoneList = zoneList.toArray();
// for(int i=0;i<tempzoneList.length;i++)
// {
// finalResult[i] = "Zone_"+tempzoneList[i];
// }
//
// //Getting emp per zone count
//// List empPerZone = userCountRestController.getEmpPerZoneCount();
//// Object[] epz = empPerZone.toArray();
//
//
//
//
//
// return finalResult;
// }
//
//}

112
src/main/java/com/gcc/biometric/api/GccBioMetricApi/controller/ApiResponse.java

@ -0,0 +1,112 @@
package com.gcc.biometric.api.GccBioMetricApi.controller;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/gcc.com")
public class ApiResponse implements Serializable {
@GetMapping("/testingformat1")
public List<List<String>> testingformat1()
{
List<String> myList = new ArrayList<>();
List<List<String>> myLinkedList = new LinkedList<>();
myList.add("Value1");
myList.add("Value2");
myList.add("Value3");
myList.add("Value4");
myLinkedList.add(myList);
return myLinkedList;
}
// [
// [
// "Value1",
// "Value2",
// "Value3",
// "Value4"
// ]
// ]
@GetMapping("/testingformat2")
public Map<ArrayList<String>, ArrayList<String>> testingformat2()
{
ArrayList<String> myListKey = new ArrayList<>();
ArrayList<String> myListValue = new ArrayList<>();
Map<ArrayList<String>,ArrayList<String>> myMap = new HashMap<>();
myListKey.add("Zone_1"); myListKey.add("Zone_2"); myListKey.add("Zone_3"); myListKey.add("Zone_4");
myListValue.add("East"); myListValue.add("West"); myListValue.add("North"); myListValue.add("South");
for(int i=0;i<myListKey.size();i++)
{
myMap.put(myListKey, myListValue);
}
return myMap;
}
@GetMapping("/testingformat3")
public List<ArrayList<String>> testingformat3()
{
ArrayList<String> myList = new ArrayList<>();
List<ArrayList<String>> myListValue = new ArrayList<>();
myList.add(0, "Zone_1");
myList.add(1, "East");
myList.add(2, "Zone_2");
myList.add(3, "West");
myListValue.add(myList);
return myListValue;
}
@GetMapping("/testingformat4")
public List<Map<String, String>> testingformat4()
{
List<Map<String, String>> listMap = new ArrayList<Map<String, String>>();
ArrayList<String> myListKey = new ArrayList<>();
ArrayList<String> myListValue = new ArrayList<>();
Map<String, String> map1 = new HashMap<>();
Map<String, String> map2 = new HashMap<>();
myListKey.add("Zone_1");
myListKey.add("Zone_2");
myListValue.add("East");
myListValue.add("West");
map1.put(myListKey.get(0), myListValue.get(0));
map1.put(myListKey.get(1), myListValue.get(1));
map2.put(myListKey.get(0), myListValue.get(0));
map2.put(myListKey.get(1), myListValue.get(1));
listMap.add(map1);
listMap.add(map2);
return listMap;
}
}

95
src/main/java/com/gcc/biometric/api/GccBioMetricApi/controller/CustomerRestController.java

@ -0,0 +1,95 @@
package com.gcc.biometric.api.GccBioMetricApi.controller;
//package com.gcc.biometric.api.GccBioMetricApi.rest;
//
//import java.util.List;
//
//
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.web.bind.annotation.DeleteMapping;
//import org.springframework.web.bind.annotation.GetMapping;
//import org.springframework.web.bind.annotation.PathVariable;
//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.RestController;
//import com.gcc.biometric.api.GccBioMetricApi.entity.Customer;
//import com.gcc.biometric.api.GccBioMetricApi.service.CustomerService;
//
//@RestController
//@RequestMapping("/api")
//public class CustomerRestController {
//
// // private CustomerDAO customerDAO; //commenting it since added service package
// // now we will use service classes to redirect the request
//
// private CustomerService customerService;
//
//
// // inject customer dao
// @Autowired
// public CustomerRestController(CustomerService theCustomerService) {
// customerService = theCustomerService;
// }
//
//
// // expose "/customer" and return list
// @GetMapping("/customer")
// public List<Customer> findAll() {
// return customerService.findAll();
// }
//
// // Getting customer by customerId
// @GetMapping("/customer/{customerId}")
// public Customer getCustomer(@PathVariable String customerId) {
// Customer theCustomer = customerService.findById(customerId);
// if (theCustomer == null) {
// throw new RuntimeException("Customer id not found- " + theCustomer);
// }
// return theCustomer;
// }
//
// // Post Request to Add/Save the customer data in db
//
// @PostMapping("/customer")
// public Customer addCustomer(@RequestBody Customer theCustomer) {
// theCustomer.setId(0);
//
// customerService.save(theCustomer);
//
// return theCustomer;
// }
//
// //Put Request to update customer data into the database
// @PutMapping("/customer")
// public Customer updateCustomer(@RequestBody Customer theCustomer)
// {
// customerService.save(theCustomer);
//
// return theCustomer;
// }
//
// //Delete Request to delete customer data into the database
// @DeleteMapping("/customer/{customerId}")
// public String deleteCustomer(@PathVariable String customerId)
// {
// Customer tempCustomer = customerService.findById(customerId);
// System.out.println("customer id found while deleting customer!");
// //throw exception if null
// if(tempCustomer==null)
// {
// throw new RuntimeException("Customer id is not found" +customerId);
// }
//
// System.out.println("Calling delete method from controller");
// customerService.deleteById(customerId);
//
// return "Deleted Customer Id is: "+customerId;
//
// }
//
// //#################### Getting Employees from GCCEmployee Table ###########################//
//
//
//
//}

79
src/main/java/com/gcc/biometric/api/GccBioMetricApi/controller/DepartmentHQAbsenteesDataController.java

@ -0,0 +1,79 @@
package com.gcc.biometric.api.GccBioMetricApi.controller;
import org.springframework.web.bind.annotation.GetMapping;
import java.util.Date;
import java.util.LinkedHashMap;
import java.util.ArrayList;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Map;
import java.util.List;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.beans.factory.annotation.Autowired;
import com.gcc.biometric.api.GccBioMetricApi.repo.DeptHQAbsenteesDataRepository;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController("departmentHQAbsenteesDataController")
@RequestMapping("/gcc.com")
public class DepartmentHQAbsenteesDataController
{
@Autowired
private DeptHQAbsenteesDataRepository deptHQAbsenteesDataRepository;
@Autowired
public DepartmentHQAbsenteesDataController(final DeptHQAbsenteesDataRepository theDeptHQAbsenteesDataRepository) {
this.deptHQAbsenteesDataRepository = theDeptHQAbsenteesDataRepository;
}
@GetMapping({ "/AbsenteesOfHQDeptOffices/{dept}/{tempDate}" })
public List<Map<String, String>> getDepartmentAbsetees(@PathVariable final String dept, @PathVariable final String tempDate) {
final String deptValue = dept;
Date date = null;
try {
date = new SimpleDateFormat("dd-MM-yyyy").parse(tempDate);
}
catch (ParseException e) {
e.printStackTrace();
}
System.out.println(deptValue);
System.out.println(date);
final ArrayList<String> AbsenteesUserId = (ArrayList<String>)this.deptHQAbsenteesDataRepository.deptHQAbsenteesUserId(deptValue, date);
final ArrayList<String> AbsenteesUserName = (ArrayList<String>)this.deptHQAbsenteesDataRepository.rdcAbsenteesUserName(deptValue, date);
final ArrayList<String> AbsenteesUserDesignation = (ArrayList<String>)this.deptHQAbsenteesDataRepository.rdcAbsenteesUserDesignation(deptValue, date);
System.out.println(AbsenteesUserId);
final List<Map<String, String>> listMap = new ArrayList<Map<String, String>>();
if (!AbsenteesUserId.isEmpty()) {
for (int i = 0; i < AbsenteesUserId.size(); ++i) {
final ArrayList<String> myListKey = new ArrayList<String>();
final ArrayList<String> myListValue = new ArrayList<String>();
myListKey.add("UserId");
myListValue.add(AbsenteesUserId.get(i));
myListKey.add("UserName");
myListValue.add(AbsenteesUserName.get(i));
myListKey.add("Designation");
myListValue.add(AbsenteesUserDesignation.get(i).trim());
final Map<String, String> map = new LinkedHashMap<String, String>();
for (int x = 0; x < myListKey.size(); ++x) {
map.put(myListKey.get(x), myListValue.get(x));
}
listMap.add(map);
}
return listMap;
}
final ArrayList<String> myListKey2 = new ArrayList<String>();
final ArrayList<String> myListValue2 = new ArrayList<String>();
myListKey2.add("UserId");
myListValue2.add("0");
myListKey2.add("UserName");
myListValue2.add("0");
myListKey2.add("Designation");
myListValue2.add("0");
final Map<String, String> map2 = new LinkedHashMap<String, String>();
for (int x2 = 0; x2 < myListKey2.size(); ++x2) {
map2.put(myListKey2.get(x2), myListValue2.get(x2));
}
listMap.add(map2);
System.out.println("Printed");
return listMap;
}
}

124
src/main/java/com/gcc/biometric/api/GccBioMetricApi/controller/DeptHeadQuaterOfficeController.java

@ -0,0 +1,124 @@
package com.gcc.biometric.api.GccBioMetricApi.controller;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.gcc.biometric.api.GccBioMetricApi.repo.DeptHeadQuaterOfficeRepository;
import com.gcc.biometric.api.GccBioMetricApi.repo.ZoneDivisionOfficeRepository;
@RestController
@RequestMapping("/gcc.com")
public class DeptHeadQuaterOfficeController {
@Autowired
private DeptHeadQuaterOfficeRepository deptHeadQuaterOfficeRepository;
@Autowired
public DeptHeadQuaterOfficeController(DeptHeadQuaterOfficeRepository theDeptHeadQuaterOfficeRepository) {
deptHeadQuaterOfficeRepository = theDeptHeadQuaterOfficeRepository;
}
@GetMapping("/HeadQuaterDepartmentOfficeData/{tempDate}")
public ResponseEntity<List<Map<String, String>>> getHeadQuaterDepartmentOfficeDate(@PathVariable String tempDate)
{
System.out.println("Inside getHeadQuaterDepartmentOfficeDate() method!");
//Department Office
System.out.println("for HQ Department Office Data");
Date date = null;
try {
date = new SimpleDateFormat("dd-MM-yyyy").parse(tempDate);
} catch (ParseException e) {
e.printStackTrace();
}
System.out.println(date);
ArrayList<String> allHQDepartments;
ArrayList<String> allHQDepartmentsAsperDate;
ArrayList<String> hqDepartmentsEnrolled;
ArrayList<String> hqDepartmentsPunched;
allHQDepartments = deptHeadQuaterOfficeRepository.getAllHQDepartmentOffices();
allHQDepartmentsAsperDate = deptHeadQuaterOfficeRepository.getHQDepartmentOfficesAsPerDate(date);
hqDepartmentsPunched = deptHeadQuaterOfficeRepository.getHQDepartmentOfficePunched(date);
System.out.println("All Departments: "+allHQDepartments);
System.out.println("All Departments as per date: "+allHQDepartmentsAsperDate);
hqDepartmentsEnrolled = deptHeadQuaterOfficeRepository.getHQDepartmentOfficeEnrolled();
System.out.println("Enrolled: "+hqDepartmentsEnrolled);
System.out.println("Punched: "+hqDepartmentsPunched);
String divAbsent = null;
String divPercentage = null;
Integer j = 0;
List<Map<String, String>> listMap = new ArrayList<Map<String, String>>();
for (int i = 0; i <allHQDepartments.size(); i++) {
ArrayList<String> myListKey = new ArrayList<>();
ArrayList<String> myListValue = new ArrayList<>();
myListKey.add("Department"); myListValue.add(allHQDepartments.get(i));
myListKey.add("Enrolled"); myListValue.add(hqDepartmentsEnrolled.get(i));
if (allHQDepartmentsAsperDate.contains(allHQDepartments.get(i)))
{
myListKey.add("Punched"); myListValue.add(hqDepartmentsPunched.get(j));
Integer xDivAbsent = Integer.parseInt(hqDepartmentsEnrolled.get(i)) - Integer.parseInt(hqDepartmentsPunched.get(j));
Integer xdivPercentage = ((Integer.parseInt((hqDepartmentsPunched.get(j))) *100)/ Integer.parseInt(hqDepartmentsEnrolled.get(i)));
divAbsent = xDivAbsent.toString();
divPercentage = xdivPercentage.toString();
j++;
}
else
{
myListKey.add("Punched"); myListValue.add("0");
divAbsent = hqDepartmentsEnrolled.get(i);
divPercentage = "0";
}
myListKey.add("Absent"); myListValue.add(divAbsent);
myListKey.add("Percentage"); myListValue.add(divPercentage);
Map<String, String> map = new LinkedHashMap<>();
for(int x=0;x<myListKey.size();x++)
{
map.put(myListKey.get(x), myListValue.get(x));
}
listMap.add(map);
divAbsent=null;
divPercentage=null;
}
return ResponseEntity.ok(listMap);
}
}

55
src/main/java/com/gcc/biometric/api/GccBioMetricApi/controller/DeviceStatusRestController.java

@ -0,0 +1,55 @@
package com.gcc.biometric.api.GccBioMetricApi.controller;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.gcc.biometric.api.GccBioMetricApi.entity.DeviceStatus;
import com.gcc.biometric.api.GccBioMetricApi.service.DeviceStatusService;
@RestController
@RequestMapping("/gcc.com")
public class DeviceStatusRestController {
private DeviceStatusService deviceStatusService;
// inject employee dao
@Autowired
public DeviceStatusRestController(DeviceStatusService theDeviceStatusService) {
deviceStatusService = theDeviceStatusService;
}
@GetMapping("/devices")
public List<DeviceStatus> getAllDevices() {
return deviceStatusService.findAll();
}
}

69
src/main/java/com/gcc/biometric/api/GccBioMetricApi/controller/EmployeeRestController.java

@ -0,0 +1,69 @@
package com.gcc.biometric.api.GccBioMetricApi.controller;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.gcc.biometric.api.GccBioMetricApi.entity.Employee;
import com.gcc.biometric.api.GccBioMetricApi.service.EmployeeService;
@RestController
@RequestMapping("/gcc.com")
public class EmployeeRestController {
@Autowired
private EmployeeService employeeService;
// @Autowired
// private JdbcTemplate jdbcTemplate;
// inject employee dao
@Autowired
public EmployeeRestController(EmployeeService theEmployeeService) {
employeeService = theEmployeeService;
}
@GetMapping("/employee")
public List<Employee> findAllEmployeesData() {
return employeeService.findAll();
}
// Getting employee by SSN
@GetMapping("/employee/{payCode}")
public Employee findById(@PathVariable String payCode) {
Employee theEmployee = employeeService.findById(payCode);
if (theEmployee == null) {
throw new RuntimeException("Employee payCode not found- " + theEmployee);
}
return theEmployee;
}
// @GetMapping("/allemployee")
// public List<Map<String, Object>> getNMR() {
// return jdbcTemplate.queryForList(
// "select SSN,ACTIVE,PAYCODE,EMPNAME,DateOFBIRTH,DateOFJOIN,PRESENTCARDNO from tblemployee");
// }
//////////////////////////////////////Doing it using JPA @Query Annotation////////////////////////////////////////
@GetMapping("/getEmpCountPerZone123")
public List<String> getEmpCountPerZone() {
return employeeService.getEmpCountPerZone();
}
@GetMapping("/getEmpCountPresentAbsent")
public List<String> getEmpCountPresentAbsent() {
return employeeService.getEmpCountPresentAbsent();
}
}

340
src/main/java/com/gcc/biometric/api/GccBioMetricApi/controller/EnrolledEmpListDataController.java

@ -0,0 +1,340 @@
package com.gcc.biometric.api.GccBioMetricApi.controller;
import org.springframework.web.bind.annotation.GetMapping;
import java.util.LinkedHashMap;
import java.util.ArrayList;
import java.util.Map;
import java.util.List;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.beans.factory.annotation.Autowired;
import com.gcc.biometric.api.GccBioMetricApi.repo.EnrolledEmpListDataRepository;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/gcc.com")
public class EnrolledEmpListDataController
{
@Autowired
private EnrolledEmpListDataRepository enrolledEmpListDataRepository;
@Autowired
public EnrolledEmpListDataController(EnrolledEmpListDataRepository theEnrolledEmpListDataRepository) {
enrolledEmpListDataRepository = theEnrolledEmpListDataRepository;
}
ArrayList<String> EnrolledUserId;
ArrayList<String> EnrolledUserName;
ArrayList<String> EnrolledUserDesignation;
// ----------------------Division office Enrolled-----------------------------------------
@GetMapping({ "/getDivEnrolledEmpList/{div}" })
public List<Map<String, String>> getDivEnrolledEmpList(@PathVariable String div) {
String divValue = div;
System.out.println(divValue);
EnrolledUserId = enrolledEmpListDataRepository.getEnrolledDivUserId(divValue);
EnrolledUserName = enrolledEmpListDataRepository.getEnrolledDivUserName(divValue);
EnrolledUserDesignation = enrolledEmpListDataRepository.getEnrolledDivDesignation(divValue);
System.out.println(EnrolledUserId.size());
List<Map<String, String>> listMap = new ArrayList<Map<String, String>>();
if (!EnrolledUserId.isEmpty()) {
for (int i = 0; i < EnrolledUserId.size(); ++i) {
final ArrayList<String> myListKey = new ArrayList<String>();
final ArrayList<String> myListValue = new ArrayList<String>();
myListKey.add("UserId");
myListValue.add(EnrolledUserId.get(i));
myListKey.add("UserName");
myListValue.add(EnrolledUserName.get(i));
myListKey.add("Designation");
myListValue.add(EnrolledUserDesignation.get(i).trim());
final Map<String, String> map = new LinkedHashMap<String, String>();
for (int x = 0; x < myListKey.size(); ++x) {
map.put(myListKey.get(x), myListValue.get(x));
}
listMap.add(map);
}
System.out.println("Printed");
return listMap;
}
final ArrayList<String> myListKey2 = new ArrayList<String>();
final ArrayList<String> myListValue2 = new ArrayList<String>();
myListKey2.add("UserId");
myListValue2.add("0");
myListKey2.add("UserName");
myListValue2.add("0");
myListKey2.add("Designation");
myListValue2.add("0");
final Map<String, String> map2 = new LinkedHashMap<String, String>();
for (int x2 = 0; x2 < myListKey2.size(); ++x2) {
map2.put(myListKey2.get(x2), myListValue2.get(x2));
}
listMap.add(map2);
System.out.println("Printed");
return listMap;
}
// ----------------------Unit office Enrolled-----------------------------------------
@GetMapping({ "/getUnitEnrolledEmpList/{unit}" })
public List<Map<String, String>> getUnitEnrolledEmpList(@PathVariable String unit) {
String unitValue = unit;
System.out.println(unitValue);
EnrolledUserId = enrolledEmpListDataRepository.getEnrolledUnitUserId(unitValue);
EnrolledUserName = enrolledEmpListDataRepository.getEnrolledUnitUserName(unitValue);
EnrolledUserDesignation = enrolledEmpListDataRepository.getEnrolledUnitDesignation(unitValue);
System.out.println(EnrolledUserId.size());
List<Map<String, String>> listMap = new ArrayList<Map<String, String>>();
if (!EnrolledUserId.isEmpty()) {
for (int i = 0; i < EnrolledUserId.size(); ++i) {
final ArrayList<String> myListKey = new ArrayList<String>();
final ArrayList<String> myListValue = new ArrayList<String>();
myListKey.add("UserId");
myListValue.add(EnrolledUserId.get(i));
myListKey.add("UserName");
myListValue.add(EnrolledUserName.get(i));
myListKey.add("Designation");
myListValue.add(EnrolledUserDesignation.get(i).trim());
final Map<String, String> map = new LinkedHashMap<String, String>();
for (int x = 0; x < myListKey.size(); ++x) {
map.put(myListKey.get(x), myListValue.get(x));
}
listMap.add(map);
}
System.out.println("Printed");
return listMap;
}
final ArrayList<String> myListKey2 = new ArrayList<String>();
final ArrayList<String> myListValue2 = new ArrayList<String>();
myListKey2.add("UserId");
myListValue2.add("0");
myListKey2.add("UserName");
myListValue2.add("0");
myListKey2.add("Designation");
myListValue2.add("0");
final Map<String, String> map2 = new LinkedHashMap<String, String>();
for (int x2 = 0; x2 < myListKey2.size(); ++x2) {
map2.put(myListKey2.get(x2), myListValue2.get(x2));
}
listMap.add(map2);
System.out.println("Printed");
return listMap;
}
// // ----------------------Lorry office Enrolled-----------------------------------------
@GetMapping({ "/getLorryEnrolledEmpList/{zone}" })
public List<Map<String, String>> getLorryEnrolledEmpList(@PathVariable Integer zone) {
Integer zoneValue = zone;
if(zoneValue==1 || zoneValue==2 || zoneValue==3)
{
zoneValue = 1;
}
System.out.println(zoneValue);
EnrolledUserId = enrolledEmpListDataRepository.getEnrolledLorryUserId(zoneValue);
EnrolledUserName = enrolledEmpListDataRepository.getEnrolledLorryUserName(zoneValue);
EnrolledUserDesignation = enrolledEmpListDataRepository.getEnrolledLorryDesignation(zoneValue);
System.out.println(EnrolledUserId.size());
List<Map<String, String>> listMap = new ArrayList<Map<String, String>>();
if (!EnrolledUserId.isEmpty()) {
for (int i = 0; i < EnrolledUserId.size(); ++i) {
final ArrayList<String> myListKey = new ArrayList<String>();
final ArrayList<String> myListValue = new ArrayList<String>();
myListKey.add("UserId");
myListValue.add(EnrolledUserId.get(i));
myListKey.add("UserName");
myListValue.add(EnrolledUserName.get(i));
myListKey.add("Designation");
myListValue.add(EnrolledUserDesignation.get(i).trim());
final Map<String, String> map = new LinkedHashMap<String, String>();
for (int x = 0; x < myListKey.size(); ++x) {
map.put(myListKey.get(x), myListValue.get(x));
}
listMap.add(map);
}
System.out.println("Printed");
return listMap;
}
final ArrayList<String> myListKey2 = new ArrayList<String>();
final ArrayList<String> myListValue2 = new ArrayList<String>();
myListKey2.add("UserId");
myListValue2.add("0");
myListKey2.add("UserName");
myListValue2.add("0");
myListKey2.add("Designation");
myListValue2.add("0");
final Map<String, String> map2 = new LinkedHashMap<String, String>();
for (int x2 = 0; x2 < myListKey2.size(); ++x2) {
map2.put(myListKey2.get(x2), myListValue2.get(x2));
}
listMap.add(map2);
System.out.println("Printed");
return listMap;
}
// // ----------------------zonal office Enrolled-----------------------------------------
@GetMapping({ "/getZonalEnrolledEmpList/{zone}" })
public List<Map<String, String>> getZonalEnrolledEmpList(@PathVariable Integer zone) {
Integer zoneValue = zone;
System.out.println(zoneValue);
EnrolledUserId = enrolledEmpListDataRepository.getEnrolledZonalUserId(zoneValue);
EnrolledUserName = enrolledEmpListDataRepository.getEnrolledZonalUserName(zoneValue);
EnrolledUserDesignation = enrolledEmpListDataRepository.getEnrolledZonalDesignation(zoneValue);
System.out.println(EnrolledUserId.size());
List<Map<String, String>> listMap = new ArrayList<Map<String, String>>();
if (!EnrolledUserId.isEmpty()) {
for (int i = 0; i < EnrolledUserId.size(); ++i) {
final ArrayList<String> myListKey = new ArrayList<String>();
final ArrayList<String> myListValue = new ArrayList<String>();
myListKey.add("UserId");
myListValue.add(EnrolledUserId.get(i));
myListKey.add("UserName");
myListValue.add(EnrolledUserName.get(i));
myListKey.add("Designation");
myListValue.add(EnrolledUserDesignation.get(i).trim());
final Map<String, String> map = new LinkedHashMap<String, String>();
for (int x = 0; x < myListKey.size(); ++x) {
map.put(myListKey.get(x), myListValue.get(x));
}
listMap.add(map);
}
System.out.println("Printed");
return listMap;
}
final ArrayList<String> myListKey2 = new ArrayList<String>();
final ArrayList<String> myListValue2 = new ArrayList<String>();
myListKey2.add("UserId");
myListValue2.add("0");
myListKey2.add("UserName");
myListValue2.add("0");
myListKey2.add("Designation");
myListValue2.add("0");
final Map<String, String> map2 = new LinkedHashMap<String, String>();
for (int x2 = 0; x2 < myListKey2.size(); ++x2) {
map2.put(myListKey2.get(x2), myListValue2.get(x2));
}
listMap.add(map2);
System.out.println("Printed");
return listMap;
}
// // ----------------------Department office Enrolled-----------------------------------------
@GetMapping({ "/getDeptEnrolledEmpList/{dept}" })
public List<Map<String, String>> getDeptEnrolledEmpList(@PathVariable String dept) {
String zoneValue = dept;
System.out.println(zoneValue);
EnrolledUserId = enrolledEmpListDataRepository.getEnrolledDeptUserId(zoneValue);
EnrolledUserName = enrolledEmpListDataRepository.getEnrolledDeptUserName(zoneValue);
EnrolledUserDesignation = enrolledEmpListDataRepository.getEnrolledDeptDesignation(zoneValue);
System.out.println(EnrolledUserId.size());
List<Map<String, String>> listMap = new ArrayList<Map<String, String>>();
if (!EnrolledUserId.isEmpty()) {
for (int i = 0; i < EnrolledUserId.size(); ++i) {
ArrayList<String> myListKey = new ArrayList<String>();
ArrayList<String> myListValue = new ArrayList<String>();
myListKey.add("UserId");
myListValue.add(EnrolledUserId.get(i));
myListKey.add("UserName");
myListValue.add(EnrolledUserName.get(i));
myListKey.add("Designation");
myListValue.add(EnrolledUserDesignation.get(i).trim());
Map<String, String> map = new LinkedHashMap<String, String>();
for (int x = 0; x < myListKey.size(); ++x) {
map.put(myListKey.get(x), myListValue.get(x));
}
listMap.add(map);
}
System.out.println("Printed");
return listMap;
}
ArrayList<String> myListKey2 = new ArrayList<String>();
ArrayList<String> myListValue2 = new ArrayList<String>();
myListKey2.add("UserId");
myListValue2.add("0");
myListKey2.add("UserName");
myListValue2.add("0");
myListKey2.add("Designation");
myListValue2.add("0");
Map<String, String> map2 = new LinkedHashMap<String, String>();
for (int x2 = 0; x2 < myListKey2.size(); ++x2) {
map2.put(myListKey2.get(x2), myListValue2.get(x2));
}
listMap.add(map2);
System.out.println("Printed");
return listMap;
}
// // ----------------------RDC office Enrolled-----------------------------------------
@GetMapping({ "/getRDCEnrolledEmpList/{zone}" })
public List<Map<String, String>> getRDCEnrolledEmpList(@PathVariable Integer zone) {
Integer zoneValue = zone;
System.out.println(zoneValue);
EnrolledUserId = enrolledEmpListDataRepository.getEnrolledRDCUserId(zoneValue);
EnrolledUserName = enrolledEmpListDataRepository.getEnrolledRDCUserName(zoneValue);
EnrolledUserDesignation = enrolledEmpListDataRepository.getEnrolledRDCDesignation(zoneValue);
System.out.println(EnrolledUserId.size());
List<Map<String, String>> listMap = new ArrayList<Map<String, String>>();
if (!EnrolledUserId.isEmpty()) {
for (int i = 0; i < EnrolledUserId.size(); ++i) {
ArrayList<String> myListKey = new ArrayList<String>();
ArrayList<String> myListValue = new ArrayList<String>();
myListKey.add("UserId");
myListValue.add(EnrolledUserId.get(i));
myListKey.add("UserName");
myListValue.add(EnrolledUserName.get(i));
myListKey.add("Designation");
myListValue.add(EnrolledUserDesignation.get(i).trim());
Map<String, String> map = new LinkedHashMap<String, String>();
for (int x = 0; x < myListKey.size(); ++x) {
map.put(myListKey.get(x), myListValue.get(x));
}
listMap.add(map);
}
System.out.println("Printed");
return listMap;
}
ArrayList<String> myListKey2 = new ArrayList<String>();
ArrayList<String> myListValue2 = new ArrayList<String>();
myListKey2.add("UserId");
myListValue2.add("0");
myListKey2.add("UserName");
myListValue2.add("0");
myListKey2.add("Designation");
myListValue2.add("0");
Map<String, String> map2 = new LinkedHashMap<String, String>();
for (int x2 = 0; x2 < myListKey2.size(); ++x2) {
map2.put(myListKey2.get(x2), myListValue2.get(x2));
}
listMap.add(map2);
System.out.println("Printed");
return listMap;
}
}

125
src/main/java/com/gcc/biometric/api/GccBioMetricApi/controller/FormatTestingController.java

@ -0,0 +1,125 @@
package com.gcc.biometric.api.GccBioMetricApi.controller;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.gcc.biometric.api.GccBioMetricApi.repo.ZoneDivisionOfficeRepository;
@RestController
@RequestMapping("/gcc.com")
public class FormatTestingController {
@Autowired
private ZoneDivisionOfficeRepository zoneDivMasterRepository;
@Autowired
public FormatTestingController(ZoneDivisionOfficeRepository theZoneDivMasterRepository) {
zoneDivMasterRepository = theZoneDivMasterRepository;
}
ArrayList<String> zoneDivisions;
ArrayList<String> zoneDivisionsOnDate;
ArrayList<String> divEnrolled;
ArrayList<String> divPunched;
@GetMapping("/FormatTesting/{zone}/{officeTypes}/{tempDate}")
public List<Map<String, String>> getDivEnrollPunchAbsentPercentage(@PathVariable Integer zone,
@PathVariable String officeTypes, @PathVariable String tempDate)
{
Integer zoneValue = zone;
String officeType = officeTypes;
if (officeType.equals("DO")) {
System.out.println("for zonalOfficeData");
Date date = null;
try {
date = new SimpleDateFormat("dd-MM-yyyy").parse(tempDate);
} catch (ParseException e) {
e.printStackTrace();
}
divPunched = zoneDivMasterRepository.getDivisionOfficePunchedPerDiv(zoneValue, date);
zoneDivisionsOnDate = zoneDivMasterRepository.getDivisionOfficeZoneDivAsPerDate(zoneValue, date);
zoneDivisions = zoneDivMasterRepository.getDivisionOfficeZoneDivisions(zoneValue);
Collections.sort(zoneDivisionsOnDate);
System.out.println("Divisions as Per Date: " + zoneDivisionsOnDate);
System.out.println("Divisions as per zones: " + zoneDivisions);
divEnrolled = zoneDivMasterRepository.getDivisionOfficeEnrolledPerDiv(zoneValue);
System.out.println("Enrolled: " + divEnrolled);
System.out.println("Punched: " + divPunched);
List<Map<String, String>> listMap = new ArrayList<Map<String, String>>();
ArrayList<String> myListKey = new ArrayList<>();
ArrayList<String> myListValue = new ArrayList<>();
Map<String, String> map = new LinkedHashMap<>();
for (int i = 0; i <1; i++) {
System.out.println("Printing for div_" + (zoneDivisions.get(i)));
myListKey.add("Division_" + (zoneDivisions.get(i)));
myListValue.add(zoneDivisions.get(i));
myListKey.add("Division_" + (zoneDivisions.get(i)) + "_enrolled");
myListValue.add(divEnrolled.get(i));
myListKey.add("Division_" + (zoneDivisions.get(i)) + "_punched");
myListValue.add(divPunched.get(i));
System.out.println(myListKey);
System.out.println(myListValue);
map.put(myListKey.get(0), myListValue.get(0)); //putting division
map.put(myListKey.get(1), myListValue.get(1)); //putting enrolled of particular zone
map.put(myListKey.get(2), myListValue.get(2)); //putting punched of particular zone
System.out.println(map);
listMap.add(map);
System.out.println("Added map into listMap: "+listMap+" ############ "+i);
myListKey.removeAll(myListKey);
myListValue.removeAll(myListValue);
map.clear();
System.out.println("Empty:::::::::::::::");
System.out.println(myListKey);
System.out.println(myListValue);
System.out.println(map);
}
System.out.println(listMap);
return listMap;
}
else if (officeType == "UO") {
System.out.println("for unitOfficeData");
} else if (officeType == "DO") {
System.out.println("for divisionOfficeData");
} else if (officeType == "LS") {
System.out.println("for larryStationData");
}
return null;
}
}

308
src/main/java/com/gcc/biometric/api/GccBioMetricApi/controller/HeadQuaterEntriesRestController.java

@ -0,0 +1,308 @@
package com.gcc.biometric.api.GccBioMetricApi.controller;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.LinkedHashMap;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.gcc.biometric.api.GccBioMetricApi.repo.HeadQuaterEntriesRepository;
import com.gcc.biometric.api.GccBioMetricApi.repo.ZoneDivisionOfficeRepository;
@RestController
@RequestMapping("/gcc.com")
public class HeadQuaterEntriesRestController {
@Autowired
private HeadQuaterEntriesRepository headQuaterEntriesRepository;
// inject employee dao
@Autowired
public HeadQuaterEntriesRestController(HeadQuaterEntriesRepository theHeadQuaterEntriesRepository) {
headQuaterEntriesRepository = theHeadQuaterEntriesRepository;
}
ArrayList<Integer> arrZoneEnroll;
ArrayList<Integer> arrZonePunched;
@GetMapping("/ZoneEmpCountPresentAbsentPercentage/{tempDate}")
public LinkedHashMap<String, Integer> getZoneEnrollPunchAbsentPercentage(@PathVariable String tempDate) //@RequestParam(value = "date")@DateTimeFormat(pattern="yyyy-MM-dd") LocalDate date
{
Date date = null;
try {
date = new SimpleDateFormat("dd-MM-yyyy").parse(tempDate);
} catch (ParseException e) {
e.printStackTrace();
}
System.out.println(date);
LinkedHashMap<String, Integer> map = new LinkedHashMap<>();
arrZoneEnroll = headQuaterEntriesRepository.getEnrolled();
arrZonePunched = headQuaterEntriesRepository.getPunched(date);
System.out.println("Enrolled: "+arrZoneEnroll);
System.out.println("Punched: "+arrZonePunched);
System.out.println(arrZonePunched.isEmpty());
Integer zoneAbsent=0;
Integer zonePercentage=0;
for(int i=0;i<arrZoneEnroll.size();i++)
{
System.out.println("Printing for zone_"+i);
if(arrZonePunched.isEmpty())
{
map.put("Zone_"+(i+1)+"", i+1);
map.put("Zone_"+(i+1)+"_enrolled", arrZoneEnroll.get(i));
map.put("Zone_"+(i+1)+"_punched", 0);
zoneAbsent = arrZoneEnroll.get(i) - 0;
zonePercentage =( (0 *100)/ arrZoneEnroll.get(i));
map.put("Absent_"+(i+1)+"", zoneAbsent);
map.put("Percentage_"+(i+1)+"", zonePercentage);
zoneAbsent=0;
zonePercentage=0;
}
else
{
map.put("Zone_"+(i+1)+"", i+1);
map.put("Zone_"+(i+1)+"_enrolled", arrZoneEnroll.get(i));
map.put("Zone_"+(i+1)+"_punched", arrZonePunched.get(i));
zoneAbsent = arrZoneEnroll.get(i) - arrZonePunched.get(i);
zonePercentage = ((arrZonePunched.get(i) *100)/ arrZoneEnroll.get(i));
map.put("Absent_"+(i+1)+"", zoneAbsent);
map.put("Percentage_"+(i+1)+"", zonePercentage);
zoneAbsent=0;
zonePercentage=0;
}
}
return map;
}
// @GetMapping("/enroll_2")
// public LinkedHashMap<String, Integer> getTheEnrolledAndPunchedAbsPer(@RequestParam(value = "date")@DateTimeFormat(iso = DateTimeFormat.ISO.DATE)String date) {
//
// arrEnroll = headQuaterEntriesRepository.getEnrolled();
// arrPunched = headQuaterEntriesRepository.getPunched(date);
// LinkedHashMap<String, Integer> map = new LinkedHashMap<>();
//
//
// Integer Absent_1 = arrEnroll.get(0) - arrPunched.get(0);
// Integer Absent_2 = arrEnroll.get(1) - arrPunched.get(1);
// Integer Absent_3 = arrEnroll.get(2) - arrPunched.get(2);
// Integer Absent_4 = arrEnroll.get(3) - arrPunched.get(3);
// Integer Absent_5 = arrEnroll.get(4) - arrPunched.get(4);
// Integer Absent_6 = arrEnroll.get(5) - arrPunched.get(5);
// Integer Absent_7 = arrEnroll.get(6) - arrPunched.get(6);
// Integer Absent_8 = arrEnroll.get(7) - arrPunched.get(7);
// Integer Absent_9 = arrEnroll.get(8) - arrPunched.get(8);
// Integer Absent_10 = arrEnroll.get(9) - arrPunched.get(9);
// Integer Absent_11 = arrEnroll.get(10) - arrPunched.get(10);
// Integer Absent_12 = arrEnroll.get(11) - arrPunched.get(11);
// Integer Absent_13 = arrEnroll.get(12) - arrPunched.get(12);
// Integer Absent_14 = arrEnroll.get(13) - arrPunched.get(13);
// Integer Absent_15 = arrEnroll.get(14) - arrPunched.get(14);
// Integer Absent_16 = arrEnroll.get(15) - arrPunched.get(15);
//
// Integer Percentage_1 = ((arrPunched.get(0) *100)/ arrEnroll.get(0));
// Integer Percentage_2 = ((arrPunched.get(1) *100)/ arrEnroll.get(1));
// Integer Percentage_3 = ((arrPunched.get(2) *100)/ arrEnroll.get(2));
// Integer Percentage_4 = ((arrPunched.get(3) *100)/ arrEnroll.get(3));
// Integer Percentage_5 = ((arrPunched.get(4) *100)/ arrEnroll.get(4));
// Integer Percentage_6 = ((arrPunched.get(5) *100)/ arrEnroll.get(5));
// Integer Percentage_7 = ((arrPunched.get(6) *100)/ arrEnroll.get(6));
// Integer Percentage_8 = ((arrPunched.get(7) *100)/ arrEnroll.get(7));
// Integer Percentage_9 = ((arrPunched.get(8) *100)/ arrEnroll.get(8));
// Integer Percentage_10 = ((arrPunched.get(9) *100)/ arrEnroll.get(9));
// Integer Percentage_11 = ((arrPunched.get(10) *100)/ arrEnroll.get(10));
// Integer Percentage_12 = ((arrPunched.get(11) *100)/ arrEnroll.get(11));
// Integer Percentage_13 = ((arrPunched.get(12) *100)/ arrEnroll.get(12));
// Integer Percentage_14 = ((arrPunched.get(13) *100)/ arrEnroll.get(13));
// Integer Percentage_15 = ((arrPunched.get(14) *100)/ arrEnroll.get(14));
// Integer Percentage_16 = ((arrPunched.get(15) *100)/ arrEnroll.get(15));
//
//
//
// map.put("Zone_1", 1);
// map.put("Zone_1_enrolled", arrEnroll.get(0));
// map.put("Zone_1_punched", arrPunched.get(0));
// map.put("Absent_1", Absent_1);
// map.put("Percentage_1", Percentage_1);
// map.put("Zone_2", 2);
// map.put("Zone_2_enrolled", arrEnroll.get(1));
// map.put("Zone_2_punched", arrPunched.get(1));
// map.put("Absent_2", Absent_2);
// map.put("Percentage_2", Percentage_2);
// map.put("Zone_3", 3);
// map.put("Zone_3_enrolled", arrEnroll.get(2));
// map.put("Zone_3_punched", arrPunched.get(2));
// map.put("Absent_3", Absent_3);
// map.put("Percentage_3", Percentage_3);
// map.put("Zone_4", 4);
// map.put("Zone_4_enrolled", arrEnroll.get(3));
// map.put("Zone_4_punched", arrPunched.get(0));
// map.put("Absent_4", Absent_4);
// map.put("Percentage_4", Percentage_4);
// map.put("Zone_5", 5);
// map.put("Zone_5_enrolled", arrEnroll.get(4));
// map.put("Zone_5_punched", arrPunched.get(4));
// map.put("Absent_5", Absent_5);
// map.put("Percentage_5", Percentage_5);
// map.put("Zone_6", 6);
// map.put("Zone_6_enrolled", arrEnroll.get(5));
// map.put("Zone_6_punched", arrPunched.get(5));
// map.put("Absent_6", Absent_6);
// map.put("Percentage_6", Percentage_6);
// map.put("Zone_7", 7);
// map.put("Zone_7_enrolled", arrEnroll.get(6));
// map.put("Zone_7_punched", arrPunched.get(6));
// map.put("Absent_7", Absent_7);
// map.put("Percentage_7", Percentage_7);
// map.put("Zone_8", 8);
// map.put("Zone_8_enrolled", arrEnroll.get(7));
// map.put("Zone_8_punched", arrPunched.get(7));
// map.put("Absent_8", Absent_8);
// map.put("Percentage_8", Percentage_8);
// map.put("Zone_9", 9);
// map.put("Zone_9_enrolled", arrEnroll.get(8));
// map.put("Zone_9_punched", arrPunched.get(8));
// map.put("Absent_9", Absent_9);
// map.put("Percentage_9", Percentage_9);
// map.put("Zone_10", 10);
// map.put("Zone_10_enrolled", arrEnroll.get(9));
// map.put("Zone_10_punched", arrPunched.get(9));
// map.put("Absent_10", Absent_10);
// map.put("Percentage_10", Percentage_10);
// map.put("Zone_11", 11);
// map.put("Zone_11_enrolled", arrEnroll.get(10));
// map.put("Zone_11_punched", arrPunched.get(10));
// map.put("Absent_11", Absent_11);
// map.put("Percentage_11", Percentage_11);
// map.put("Zone_12", 12);
// map.put("Zone_12_enrolled", arrEnroll.get(11));
// map.put("Zone_12_punched", arrPunched.get(11));
// map.put("Absent_12", Absent_12);
// map.put("Percentage_12", Percentage_12);
// map.put("Zone_13", 13);
// map.put("Zone_13_enrolled", arrEnroll.get(12));
// map.put("Zone_13_punched", arrPunched.get(12));
// map.put("Absent_13", Absent_13);
// map.put("Percentage_13", Percentage_13);
// map.put("Zone_14", 14);
// map.put("Zone_14_enrolled", arrEnroll.get(13));
// map.put("Zone_14_punched", arrPunched.get(13));
// map.put("Absent_14", Absent_14);
// map.put("Percentage_14", Percentage_14);
// map.put("Zone_15", 15);
// map.put("Zone_15_enrolled", arrEnroll.get(14));
// map.put("Zone_15_punched", arrPunched.get(14));
// map.put("Absent_15", Absent_15);
// map.put("Percentage_15", Percentage_15);
// map.put("Zone_16", 16);
// map.put("Zone_16_enrolled", arrEnroll.get(15));
// map.put("Zone_16_punched", arrPunched.get(15));
// map.put("Absent_16", Absent_16);
// map.put("Percentage_16", Percentage_16);
// System.out.println("Till 15");
// return map;
// }
}

127
src/main/java/com/gcc/biometric/api/GccBioMetricApi/controller/HeadQuaterOfficeController.java

@ -0,0 +1,127 @@
package com.gcc.biometric.api.GccBioMetricApi.controller;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/gcc.com")
public class HeadQuaterOfficeController {
@Autowired
private JdbcTemplate jdbcTemplate;
// Getting all the results here
@GetMapping("/ZoneEmpCountPresentAbsent123567/{tempDate}")
public List<Map<String, Object>> getEmpPerPunZoneCount(@PathVariable @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) String tempDate) { // @PathVariable
// String
// officePunch
System.out.println("Date is " + tempDate);
List<Map<String, Object>> empPerZoneCount = jdbcTemplate.queryForList("" + "select"
+ "'1' zone_1,sum(case when d.zone=1 then 1 else 0 end) empCount_1,\r\n"
+ "sum(case when d.zone=1 and e.PAYCODE is not null then 1 else 0 end) empPunchCount_1,\r\n"
+ "sum(case when d.zone=1 and e.PAYCODE is null then 1 else 0 end) absent_1,\r\n"
+ "'2' zone_2,sum(case when d.zone=2 then 1 else 0 end) empCount_2,\r\n"
+ "sum(case when d.zone=2 and e.PAYCODE is not null then 1 else 0 end) empPunchCount_2,\r\n"
+ "sum(case when d.zone=2 and e.PAYCODE is null then 1 else 0 end) absent_2,\r\n"
+ "'3' zone_3,sum(case when d.zone=3 then 1 else 0 end) empCount_3,\r\n"
+ "sum(case when d.zone=3 and e.PAYCODE is not null then 1 else 0 end) empPunchCount_3,\r\n"
+ "sum(case when d.zone=3 and e.PAYCODE is null then 1 else 0 end) absent_3,\r\n"
+ "'4' zone_4,sum(case when d.zone=4 then 1 else 0 end) empCount_4,\r\n"
+ "sum(case when d.zone=4 and e.PAYCODE is not null then 1 else 0 end) empPunchCount_4,\r\n"
+ "sum(case when d.zone=4 and e.PAYCODE is null then 1 else 0 end) absent_4,\r\n"
+ "'5' zone_5,sum(case when d.zone=5 then 1 else 0 end) empCount_5,\r\n"
+ "sum(case when d.zone=5 and e.PAYCODE is not null then 1 else 0 end) empPunchCount_5,\r\n"
+ "sum(case when d.zone=5 and e.PAYCODE is null then 1 else 0 end) absent_5,\r\n"
+ "'6' zone_6,sum(case when d.zone=6 then 1 else 0 end) empCount_6,\r\n"
+ "sum(case when d.zone=6 and e.PAYCODE is not null then 1 else 0 end) empPunchCount_6,\r\n"
+ "sum(case when d.zone=6 and e.PAYCODE is null then 1 else 0 end) absent_6,\r\n"
+ "'7' zone_7,sum(case when d.zone=7 then 1 else 0 end) empCount_7,\r\n"
+ "sum(case when d.zone=7 and e.PAYCODE is not null then 1 else 0 end) empPunchCount_7,\r\n"
+ "sum(case when d.zone=7 and e.PAYCODE is null then 1 else 0 end) absent_7,\r\n"
+ "'8' zone_8,sum(case when d.zone=8 then 1 else 0 end) empCount_8,\r\n"
+ "sum(case when d.zone=8 and e.PAYCODE is not null then 1 else 0 end) empPunchCount_8,\r\n"
+ "sum(case when d.zone=8 and e.PAYCODE is null then 1 else 0 end) absent_8,\r\n"
+ "'9' zone_9,sum(case when d.zone=9 then 1 else 0 end) empCount_9,\r\n"
+ "sum(case when d.zone=9 and e.PAYCODE is not null then 1 else 0 end) empPunchCount_9,\r\n"
+ "sum(case when d.zone=9 and e.PAYCODE is null then 1 else 0 end) absent_9,\r\n"
+ "'10' zone_10,sum(case when d.zone=10 then 1 else 0 end) empCount_10,\r\n"
+ "sum(case when d.zone=10 and e.PAYCODE is not null then 1 else 0 end) empPunchCount_10,\r\n"
+ "sum(case when d.zone=10 and e.PAYCODE is null then 1 else 0 end) absent_10,\r\n"
+ "'11' zone_11,sum(case when d.zone=11 then 1 else 0 end) empCount_11,\r\n"
+ "sum(case when d.zone=11 and e.PAYCODE is not null then 1 else 0 end) empPunchCount_11,\r\n"
+ "sum(case when d.zone=11 and e.PAYCODE is null then 1 else 0 end) absent_11,\r\n"
+ "'12' zone_12,sum(case when d.zone=12 then 1 else 0 end) empCount_12,\r\n"
+ "sum(case when d.zone=12 and e.PAYCODE is not null then 1 else 0 end) empPunchCount_12,\r\n"
+ "sum(case when d.zone=12 and e.PAYCODE is null then 1 else 0 end) absent_12,\r\n"
+ "'13' zone_13,sum(case when d.zone=13 then 1 else 0 end) empCount_13,\r\n"
+ "sum(case when d.zone=13 and e.PAYCODE is not null then 1 else 0 end) empPunchCount_13,\r\n"
+ "sum(case when d.zone=13 and e.PAYCODE is null then 1 else 0 end) absent_13,\r\n"
+ "'14' zone_14,sum(case when d.zone=14 then 1 else 0 end) empCount_14,\r\n"
+ "sum(case when d.zone=14 and e.PAYCODE is not null then 1 else 0 end) empPunchCount_14,\r\n"
+ "sum(case when d.zone=14 and e.PAYCODE is null then 1 else 0 end) absent_14,\r\n"
+ "'15' zone_15,sum(case when d.zone=15 then 1 else 0 end) empCount_15,\r\n"
+ "sum(case when d.zone=15 and e.PAYCODE is not null then 1 else 0 end) empPunchCount_15,\r\n"
+ "sum(case when d.zone=15 and e.PAYCODE is null then 1 else 0 end) absent_15,\r\n"
+ "'16' zone_16,sum(case when d.zone=16 then 1 else 0 end) empCount_16,\r\n"
+ "sum(case when d.zone=16 and e.PAYCODE is not null then 1 else 0 end) empPunchCount_16,\r\n"
+ "sum(case when d.zone=16 and e.PAYCODE is null then 1 else 0 end) absent_16\r\n"
+ "from tbl_realtime_userinfo a\r\n" + "inner join tbl_fkdevice_status b on a.Device_ID=b.device_id\r\n"
+ "inner join tblemployee c on a.user_id=c.paycode\r\n"
+ "inner join zone_div_mast d on b.device_name=d.devname\r\n"
+ "left outer join machine_raw_punch e on (c.PAYCODE = e.PAYCODE and cast(e.OFFICEPUNCH as date)=?)\r\n"
+ "where a.user_id <>1 and a.user_id <> 2 and a.user_id <> 3", tempDate);
System.out.println("Printed");
return empPerZoneCount;
}
// Getting all the results here
@GetMapping("/ZoneEnrolledPunched")
public List<Map<String, Object>> getEmpPerPunZoneCountFaster() {
List<Map<String, Object>> empPerZoneCount = jdbcTemplate
.queryForList("select a.*,x.Punched from (select zone,count(a.user_id) as Enrolled \r\n"
+ "from tbl_realtime_userinfo a, tblemployee c,\r\n"
+ " tbl_fkdevice_status b, zone_div_mast d \r\n"
+ "where a.Device_ID=b.device_id and a.user_id <>1 and a.user_id <> 2 and a.user_id <> 3\r\n"
+ "AND a.Device_ID=b.device_id\r\n" + "and c.paycode=a.user_id\r\n"
+ "and d.DEVNAME=b.device_name\r\n" + "group by d.ZONE) as a , (\r\n"
+ "select zone,count(distinct a.paycode) as Punched\r\n"
+ "from MachineRawPunch a inner join tbl_fkdevice_status b\r\n"
+ "inner join zone_div_mast c on c.DEVNAME=b.device_name\r\n" + "on a.DeviceID=b.device_id \r\n"
+ "where cast(OFFICEPUNCH as date) ='2022-10-21'\r\n" + "group by ZONE ) as x\r\n"
+ "where x.zone=a.zone");
System.out.println("Printed Faster");
return empPerZoneCount;
}
// @GetMapping("/classtesting")
// public HeadQuaterEntries getEnrollPunchedAbsentPercentage() {
//
//
//
// }
}

53
src/main/java/com/gcc/biometric/api/GccBioMetricApi/controller/MachineRawPunchRestController.java

@ -0,0 +1,53 @@
package com.gcc.biometric.api.GccBioMetricApi.controller;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.gcc.biometric.api.GccBioMetricApi.entity.MachineRawPunchh;
import com.gcc.biometric.api.GccBioMetricApi.service.MachineRawPunchService;
@RestController
@RequestMapping("/gcc.com")
public class MachineRawPunchRestController {
private MachineRawPunchService machineRawPunchService;
// inject employee dao
@Autowired
public MachineRawPunchRestController(MachineRawPunchService theMachineRawPunchService) {
machineRawPunchService = theMachineRawPunchService;
}
@GetMapping("/rawpunch")
public List<MachineRawPunchh> getAllRawPunch() {
return machineRawPunchService.findAll();
}
}

501
src/main/java/com/gcc/biometric/api/GccBioMetricApi/controller/PunchedEmpListDataController.java

@ -0,0 +1,501 @@
package com.gcc.biometric.api.GccBioMetricApi.controller;
import org.springframework.web.bind.annotation.GetMapping;
import java.util.LinkedHashMap;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashSet;
import java.util.Map;
import java.util.List;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.beans.factory.annotation.Autowired;
import com.gcc.biometric.api.GccBioMetricApi.repo.PunchedEmpListDataRepository;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/gcc.com")
public class PunchedEmpListDataController {
@Autowired
private PunchedEmpListDataRepository punchedEmpListDataRepository;
@Autowired
public PunchedEmpListDataController(PunchedEmpListDataRepository theEnrolledEmpListDataRepository) {
punchedEmpListDataRepository = theEnrolledEmpListDataRepository;
}
// ----------------------Division office
// Enrolled-----------------------------------------
@GetMapping({ "/getDivPunchedEmpList/{div}/{tempDate}" })
public List<Map<String, String>> getDivPunchedEmpList(@PathVariable String div,
@PathVariable final String tempDate) {
String divValue = div;
Date date = null;
try {
date = new SimpleDateFormat("dd-MM-yyyy").parse(tempDate);
} catch (ParseException e) {
e.printStackTrace();
}
System.out.println(date);
System.out.println(divValue);
ArrayList<String> tempPunchedUserId= new ArrayList<>();
ArrayList<String> PunchedUserName = new ArrayList<>();
ArrayList<String> PunchedUserDesignation = new ArrayList<>();
tempPunchedUserId = punchedEmpListDataRepository.getPunchedDivUserId(divValue, date);
ArrayList<String> PunchedUserId = new ArrayList<String>();
for (int i = 0; i < tempPunchedUserId.size(); i++) {
PunchedUserId.add(tempPunchedUserId.get(i).trim());
}
System.out.println(PunchedUserId.size());
for (int i = 0; i < PunchedUserId.size(); i++) {
PunchedUserName.add(punchedEmpListDataRepository.getPunchedDivUserName(PunchedUserId.get(i)).trim());
PunchedUserDesignation.add(punchedEmpListDataRepository.getPunchedDivDesignation(PunchedUserId.get(i)).trim());
}
// System.out.println(PunchedUserName);
System.out.println(PunchedUserName.size());
// System.out.println(PunchedUserDesignation);
System.out.println(PunchedUserDesignation.size());
List<Map<String, String>> listMap = new ArrayList<Map<String, String>>();
if (!PunchedUserId.isEmpty()) {
for (int i = 0; i < PunchedUserId.size(); i++) {
ArrayList<String> myListKey = new ArrayList<String>();
ArrayList<String> myListValue = new ArrayList<String>();
myListKey.add("UserId");
myListValue.add(PunchedUserId.get(i));
myListKey.add("UserName");
myListValue.add(PunchedUserName.get(i).trim());
myListKey.add("Designation");
myListValue.add(PunchedUserDesignation.get(i).trim());
final Map<String, String> map = new LinkedHashMap<String, String>();
for (int x = 0; x < myListKey.size(); x++) {
map.put(myListKey.get(x), myListValue.get(x));
}
listMap.add(map);
}
System.out.println("Printed");
return listMap;
}
final ArrayList<String> myListKey2 = new ArrayList<String>();
final ArrayList<String> myListValue2 = new ArrayList<String>();
myListKey2.add("UserId");
myListValue2.add("0");
myListKey2.add("UserName");
myListValue2.add("0");
myListKey2.add("Designation");
myListValue2.add("0");
final Map<String, String> map2 = new LinkedHashMap<String, String>();
for (int x2 = 0; x2 < myListKey2.size(); x2++) {
map2.put(myListKey2.get(x2), myListValue2.get(x2));
}
listMap.add(map2);
System.out.println("Printed");
return listMap;
}
// ----------------------Unit office
// Enrolled-----------------------------------------
@GetMapping({ "/getUnitPunchedEmpList/{unit}/{tempDate}" })
public List<Map<String, String>> getUnitPunchedEmpList(@PathVariable String unit, @PathVariable String tempDate) {
String unitValue = unit;
Date date = null;
try {
date = new SimpleDateFormat("dd-MM-yyyy").parse(tempDate);
} catch (ParseException e) {
e.printStackTrace();
}
System.out.println(date);
System.out.println(unitValue);
ArrayList<String> tempPunchedUserId= new ArrayList<>();
ArrayList<String> PunchedUserName = new ArrayList<>();
ArrayList<String> PunchedUserDesignation = new ArrayList<>();
tempPunchedUserId = punchedEmpListDataRepository.getPunchedUnitUserId(unitValue, date);
ArrayList<String> PunchedUserId = new ArrayList<String>();
for (int i = 0; i < tempPunchedUserId.size(); i++) {
PunchedUserId.add(tempPunchedUserId.get(i).trim());
}
System.out.println(PunchedUserId.size());
for (int i = 0; i < PunchedUserId.size(); i++) {
PunchedUserName.add(punchedEmpListDataRepository.getPunchedUnitUserName(PunchedUserId.get(i)).trim());
PunchedUserDesignation.add(punchedEmpListDataRepository.getPunchedUnitDesignation(PunchedUserId.get(i)).trim());
}
// System.out.println(PunchedUserName);
System.out.println(PunchedUserName.size());
// System.out.println(PunchedUserDesignation);
System.out.println(PunchedUserDesignation.size());
List<Map<String, String>> listMap = new ArrayList<Map<String, String>>();
if (!tempPunchedUserId.isEmpty()) {
for (int i = 0; i < tempPunchedUserId.size(); i++) {
final ArrayList<String> myListKey = new ArrayList<String>();
final ArrayList<String> myListValue = new ArrayList<String>();
myListKey.add("UserId");
myListValue.add(PunchedUserId.get(i));
myListKey.add("UserName");
myListValue.add(PunchedUserName.get(i).trim());
myListKey.add("Designation");
myListValue.add(PunchedUserDesignation.get(i).trim());
final Map<String, String> map = new LinkedHashMap<String, String>();
for (int x = 0; x < myListKey.size(); x++) {
map.put(myListKey.get(x), myListValue.get(x));
}
listMap.add(map);
}
System.out.println("Printed");
return listMap;
}
final ArrayList<String> myListKey2 = new ArrayList<String>();
final ArrayList<String> myListValue2 = new ArrayList<String>();
myListKey2.add("UserId");
myListValue2.add("0");
myListKey2.add("UserName");
myListValue2.add("0");
myListKey2.add("Designation");
myListValue2.add("0");
final Map<String, String> map2 = new LinkedHashMap<String, String>();
for (int x2 = 0; x2 < myListKey2.size(); x2++) {
map2.put(myListKey2.get(x2), myListValue2.get(x2));
}
listMap.add(map2);
System.out.println("Printed");
return listMap;
}
// // ----------------------Lorry office Enrolled-----------------------------------------
@GetMapping({ "/getLorryPunchedEmpList/{zone}/{tempDate}" })
public List<Map<String, String>> getLorryPunchedEmpList(@PathVariable Integer zone,
@PathVariable final String tempDate) {
Integer zoneValue = zone;
if (zoneValue == 1 || zoneValue == 2 || zoneValue == 3) {
zoneValue = 1;
}
Date date = null;
try {
date = new SimpleDateFormat("dd-MM-yyyy").parse(tempDate);
} catch (ParseException e) {
e.printStackTrace();
}
System.out.println(date);
System.out.println(zoneValue);
ArrayList<String> tempPunchedUserId= new ArrayList<>();
ArrayList<String> PunchedUserName = new ArrayList<>();
ArrayList<String> PunchedUserDesignation = new ArrayList<>();
tempPunchedUserId = punchedEmpListDataRepository.getPunchedLorryUserId(zoneValue, date);
ArrayList<String> PunchedUserId = new ArrayList<String>();
for (int i = 0; i < tempPunchedUserId.size(); i++) {
PunchedUserId.add(tempPunchedUserId.get(i).trim());
}
System.out.println(PunchedUserId.size());
for (int i = 0; i < PunchedUserId.size(); i++) {
PunchedUserName.add(punchedEmpListDataRepository.getPunchedLorryUserName(PunchedUserId.get(i)).trim());
PunchedUserDesignation.add(punchedEmpListDataRepository.getPunchedLorryDesignation(PunchedUserId.get(i)).trim());
}
// System.out.println(PunchedUserName);
System.out.println(PunchedUserName.size());
// System.out.println(PunchedUserDesignation);
System.out.println(PunchedUserDesignation.size());
List<Map<String, String>> listMap = new ArrayList<Map<String, String>>();
if (!tempPunchedUserId.isEmpty()) {
for (int i = 0; i < tempPunchedUserId.size(); i++) {
final ArrayList<String> myListKey = new ArrayList<String>();
final ArrayList<String> myListValue = new ArrayList<String>();
myListKey.add("UserId");
myListValue.add(PunchedUserId.get(i));
myListKey.add("UserName");
myListValue.add(PunchedUserName.get(i).trim());
myListKey.add("Designation");
myListValue.add(PunchedUserDesignation.get(i).trim());
final Map<String, String> map = new LinkedHashMap<String, String>();
for (int x = 0; x < myListKey.size(); x++) {
map.put(myListKey.get(x), myListValue.get(x));
}
listMap.add(map);
}
System.out.println("Printed");
return listMap;
}
final ArrayList<String> myListKey2 = new ArrayList<String>();
final ArrayList<String> myListValue2 = new ArrayList<String>();
myListKey2.add("UserId");
myListValue2.add("0");
myListKey2.add("UserName");
myListValue2.add("0");
myListKey2.add("Designation");
myListValue2.add("0");
final Map<String, String> map2 = new LinkedHashMap<String, String>();
for (int x2 = 0; x2 < myListKey2.size(); x2++) {
map2.put(myListKey2.get(x2), myListValue2.get(x2));
}
listMap.add(map2);
System.out.println("Printed");
return listMap;
}
// // ----------------------zonal office Enrolled-----------------------------------------
@GetMapping({ "/getZonalPunchedEmpList/{zone}/{tempDate}" })
public List<Map<String, String>> getZonalPunchedEmpList(@PathVariable Integer zone, @PathVariable final String tempDate) {
Integer zoneValue = zone;
Date date = null;
try {
date = new SimpleDateFormat("dd-MM-yyyy").parse(tempDate);
} catch (ParseException e) {
e.printStackTrace();
}
System.out.println(date);
System.out.println(zoneValue);
ArrayList<String> tempPunchedUserId= new ArrayList<>();
ArrayList<String> PunchedUserName = new ArrayList<>();
ArrayList<String> PunchedUserDesignation = new ArrayList<>();
tempPunchedUserId = punchedEmpListDataRepository.getPunchedZonalUserId(zoneValue, date);
ArrayList<String> PunchedUserId = new ArrayList<String>();
for (int i = 0; i < tempPunchedUserId.size(); i++) {
PunchedUserId.add(tempPunchedUserId.get(i).trim());
}
System.out.println(PunchedUserId.size());
for (int i = 0; i < PunchedUserId.size(); i++) {
PunchedUserName.add(punchedEmpListDataRepository.getPunchedZonalUserName(PunchedUserId.get(i)).trim());
PunchedUserDesignation.add(punchedEmpListDataRepository.getPunchedZonalDesignation(PunchedUserId.get(i)).trim());
}
// System.out.println(PunchedUserName);
System.out.println(PunchedUserName.size());
// System.out.println(PunchedUserDesignation);
System.out.println(PunchedUserDesignation.size());
List<Map<String, String>> listMap = new ArrayList<Map<String, String>>();
if (!tempPunchedUserId.isEmpty()) {
for (int i = 0; i < tempPunchedUserId.size(); i++) {
final ArrayList<String> myListKey = new ArrayList<String>();
final ArrayList<String> myListValue = new ArrayList<String>();
myListKey.add("UserId");
myListValue.add(PunchedUserId.get(i));
myListKey.add("UserName");
myListValue.add(PunchedUserName.get(i).trim());
myListKey.add("Designation");
myListValue.add(PunchedUserDesignation.get(i).trim());
final Map<String, String> map = new LinkedHashMap<String, String>();
for (int x = 0; x < myListKey.size(); x++) {
map.put(myListKey.get(x), myListValue.get(x));
}
listMap.add(map);
}
System.out.println("Printed");
return listMap;
}
final ArrayList<String> myListKey2 = new ArrayList<String>();
final ArrayList<String> myListValue2 = new ArrayList<String>();
myListKey2.add("UserId");
myListValue2.add("0");
myListKey2.add("UserName");
myListValue2.add("0");
myListKey2.add("Designation");
myListValue2.add("0");
final Map<String, String> map2 = new LinkedHashMap<String, String>();
for (int x2 = 0; x2 < myListKey2.size(); x2++) {
map2.put(myListKey2.get(x2), myListValue2.get(x2));
}
listMap.add(map2);
System.out.println("Printed");
return listMap;
}
// // ----------------------Department office Enrolled-----------------------------------------
@GetMapping({ "/getDeptPunchedEmpList/{dept}/{tempDate}" })
public List<Map<String, String>> getDeptPunchedEmpList(@PathVariable String dept,
@PathVariable final String tempDate) {
String zoneValue = dept;
Date date = null;
try {
date = new SimpleDateFormat("dd-MM-yyyy").parse(tempDate);
} catch (ParseException e) {
e.printStackTrace();
}
System.out.println(date);
System.out.println(zoneValue);
ArrayList<String> tempPunchedUserId= new ArrayList<>();
ArrayList<String> PunchedUserName = new ArrayList<>();
ArrayList<String> PunchedUserDesignation = new ArrayList<>();
tempPunchedUserId = punchedEmpListDataRepository.getPunchedDeptUserId(zoneValue, date);
ArrayList<String> PunchedUserId = new ArrayList<String>();
for (int i = 0; i < tempPunchedUserId.size(); i++) {
PunchedUserId.add(tempPunchedUserId.get(i).trim());
}
System.out.println(PunchedUserId.size());
for (int i = 0; i < PunchedUserId.size(); i++) {
PunchedUserName.add(punchedEmpListDataRepository.getPunchedDeptUserName(PunchedUserId.get(i)).trim());
PunchedUserDesignation.add(punchedEmpListDataRepository.getPunchedDeptDesignation(PunchedUserId.get(i)).trim());
}
// System.out.println(PunchedUserName);
System.out.println(PunchedUserName.size());
// System.out.println(PunchedUserDesignation);
System.out.println(PunchedUserDesignation.size());
List<Map<String, String>> listMap = new ArrayList<Map<String, String>>();
if (!tempPunchedUserId.isEmpty()) {
for (int i = 0; i < tempPunchedUserId.size(); i++) {
ArrayList<String> myListKey = new ArrayList<String>();
ArrayList<String> myListValue = new ArrayList<String>();
myListKey.add("UserId");
myListValue.add(PunchedUserId.get(i));
myListKey.add("UserName");
myListValue.add(PunchedUserName.get(i).trim());
myListKey.add("Designation");
myListValue.add(PunchedUserDesignation.get(i).trim());
Map<String, String> map = new LinkedHashMap<String, String>();
for (int x = 0; x < myListKey.size(); x++) {
map.put(myListKey.get(x), myListValue.get(x));
}
listMap.add(map);
}
System.out.println("Printed");
return listMap;
}
ArrayList<String> myListKey2 = new ArrayList<String>();
ArrayList<String> myListValue2 = new ArrayList<String>();
myListKey2.add("UserId");
myListValue2.add("0");
myListKey2.add("UserName");
myListValue2.add("0");
myListKey2.add("Designation");
myListValue2.add("0");
Map<String, String> map2 = new LinkedHashMap<String, String>();
for (int x2 = 0; x2 < myListKey2.size(); x2++) {
map2.put(myListKey2.get(x2), myListValue2.get(x2));
}
listMap.add(map2);
System.out.println("Printed");
return listMap;
}
// // ----------------------RDC office Enrolled-----------------------------------------
@GetMapping({ "/getRDCPunchedEmpList/{zone}/{tempDate}" })
public List<Map<String, String>> getRDCPunchedEmpList(@PathVariable Integer zone,
@PathVariable final String tempDate) {
Integer zoneValue = zone;
Date date = null;
try {
date = new SimpleDateFormat("dd-MM-yyyy").parse(tempDate);
} catch (ParseException e) {
e.printStackTrace();
}
System.out.println(date);
System.out.println(zoneValue);
ArrayList<String> tempPunchedUserId= new ArrayList<>();
ArrayList<String> PunchedUserName = new ArrayList<>();
ArrayList<String> PunchedUserDesignation = new ArrayList<>();
tempPunchedUserId = punchedEmpListDataRepository.getPunchedRDCUserId(zoneValue, date);
ArrayList<String> PunchedUserId = new ArrayList<String>();
for (int i = 0; i < tempPunchedUserId.size(); i++) {
PunchedUserId.add(tempPunchedUserId.get(i).trim());
}
System.out.println(PunchedUserId.size());
for (int i = 0; i < PunchedUserId.size(); i++) {
PunchedUserName.add(punchedEmpListDataRepository.getPunchedRDCUserName(PunchedUserId.get(i)).trim());
PunchedUserDesignation.add(punchedEmpListDataRepository.getPunchedRDCDesignation(PunchedUserId.get(i)).trim());
}
// System.out.println(PunchedUserName);
System.out.println(PunchedUserName.size());
// System.out.println(PunchedUserDesignation);
System.out.println(PunchedUserDesignation.size());
List<Map<String, String>> listMap = new ArrayList<Map<String, String>>();
if (!tempPunchedUserId.isEmpty()) {
for (int i = 0; i < tempPunchedUserId.size(); i++) {
ArrayList<String> myListKey = new ArrayList<String>();
ArrayList<String> myListValue = new ArrayList<String>();
myListKey.add("UserId");
myListValue.add(PunchedUserId.get(i));
myListKey.add("UserName");
myListValue.add(PunchedUserName.get(i).trim());
myListKey.add("Designation");
myListValue.add(PunchedUserDesignation.get(i).trim());
Map<String, String> map = new LinkedHashMap<String, String>();
for (int x = 0; x < myListKey.size(); x++) {
map.put(myListKey.get(x), myListValue.get(x));
}
listMap.add(map);
}
System.out.println("Printed");
return listMap;
}
ArrayList<String> myListKey2 = new ArrayList<String>();
ArrayList<String> myListValue2 = new ArrayList<String>();
myListKey2.add("UserId");
myListValue2.add("0");
myListKey2.add("UserName");
myListValue2.add("0");
myListKey2.add("Designation");
myListValue2.add("0");
Map<String, String> map2 = new LinkedHashMap<String, String>();
for (int x2 = 0; x2 < myListKey2.size(); x2++) {
map2.put(myListKey2.get(x2), myListValue2.get(x2));
}
listMap.add(map2);
System.out.println("Printed");
return listMap;
}
}

79
src/main/java/com/gcc/biometric/api/GccBioMetricApi/controller/RDCAbsenteesDataController.java

@ -0,0 +1,79 @@
package com.gcc.biometric.api.GccBioMetricApi.controller;
import org.springframework.web.bind.annotation.GetMapping;
import java.util.Date;
import java.util.LinkedHashMap;
import java.util.ArrayList;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Map;
import java.util.List;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.beans.factory.annotation.Autowired;
import com.gcc.biometric.api.GccBioMetricApi.repo.RDCAbsenteesDataRepository;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController("rDCAbsenteesDataController")
@RequestMapping("/gcc.com")
public class RDCAbsenteesDataController
{
@Autowired
private RDCAbsenteesDataRepository rDCAbsenteesDataRepository;
@Autowired
public RDCAbsenteesDataController(final RDCAbsenteesDataRepository theRDCAbsenteesDataRepository) {
this.rDCAbsenteesDataRepository = theRDCAbsenteesDataRepository;
}
@GetMapping({ "/AbsenteesOfRDCOffices/{zone}/{tempDate}" })
public List<Map<String, String>> getDepartmentAbsetees(@PathVariable final Integer zone, @PathVariable final String tempDate) {
final Integer zoneValue = zone;
Date date = null;
try {
date = new SimpleDateFormat("dd-MM-yyyy").parse(tempDate);
}
catch (ParseException e) {
e.printStackTrace();
}
System.out.println(zoneValue);
System.out.println(date);
final ArrayList<String> AbsenteesUserId = (ArrayList<String>)this.rDCAbsenteesDataRepository.rdcAbsenteesUserId(zoneValue, date);
final ArrayList<String> AbsenteesUserName = (ArrayList<String>)this.rDCAbsenteesDataRepository.rdcAbsenteesUserName(zoneValue, date);
final ArrayList<String> AbsenteesUserDesignation = (ArrayList<String>)this.rDCAbsenteesDataRepository.rdcAbsenteesUserDesignation(zoneValue, date);
final List<Map<String, String>> listMap = new ArrayList<Map<String, String>>();
if (!AbsenteesUserId.isEmpty()) {
for (int i = 0; i < AbsenteesUserId.size(); ++i) {
final ArrayList<String> myListKey = new ArrayList<String>();
final ArrayList<String> myListValue = new ArrayList<String>();
myListKey.add("UserId");
myListValue.add(AbsenteesUserId.get(i));
myListKey.add("UserName");
myListValue.add(AbsenteesUserName.get(i));
myListKey.add("Designation");
myListValue.add(AbsenteesUserDesignation.get(i).trim());
final Map<String, String> map = new LinkedHashMap<String, String>();
for (int x = 0; x < myListKey.size(); ++x) {
map.put(myListKey.get(x), myListValue.get(x));
}
listMap.add(map);
}
return listMap;
}
final ArrayList<String> myListKey2 = new ArrayList<String>();
final ArrayList<String> myListValue2 = new ArrayList<String>();
myListKey2.add("UserId");
myListValue2.add("0");
myListKey2.add("UserName");
myListValue2.add("0");
myListKey2.add("Designation");
myListValue2.add("0");
final Map<String, String> map2 = new LinkedHashMap<String, String>();
for (int x2 = 0; x2 < myListKey2.size(); ++x2) {
map2.put(myListKey2.get(x2), myListValue2.get(x2));
}
listMap.add(map2);
System.out.println("Printed");
return listMap;
}
}

51
src/main/java/com/gcc/biometric/api/GccBioMetricApi/controller/RealTimeUserInfoRestController.java

@ -0,0 +1,51 @@
package com.gcc.biometric.api.GccBioMetricApi.controller;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.gcc.biometric.api.GccBioMetricApi.entity.RealTimeUserInfo;
import com.gcc.biometric.api.GccBioMetricApi.service.RealTimeUserInfoService;
@RestController
@RequestMapping("/gcc.com")
public class RealTimeUserInfoRestController {
private RealTimeUserInfoService realTimeUserInfoService;
// inject employee dao
@Autowired
public RealTimeUserInfoRestController(RealTimeUserInfoService theRealTimeUserInfoService) {
realTimeUserInfoService = theRealTimeUserInfoService;
}
@GetMapping("/userinfo")
public List<RealTimeUserInfo> getAllEmployee() {
return realTimeUserInfoService.findAll();
}
}

113
src/main/java/com/gcc/biometric/api/GccBioMetricApi/controller/RegionalDeputyCommissionerController.java

@ -0,0 +1,113 @@
package com.gcc.biometric.api.GccBioMetricApi.controller;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.LinkedHashMap;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.jpa.repository.Query;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.gcc.biometric.api.GccBioMetricApi.repo.HeadQuaterEntriesRepository;
import com.gcc.biometric.api.GccBioMetricApi.repo.RegionalDeputyCommissionerRepository;
@RestController
@RequestMapping("/gcc.com")
public class RegionalDeputyCommissionerController {
@Autowired
private RegionalDeputyCommissionerRepository regionalDeputyCommissionerRepository;
// inject employee dao
@Autowired
public RegionalDeputyCommissionerController(RegionalDeputyCommissionerRepository theRegionalDeputyCommissionerRepository) {
regionalDeputyCommissionerRepository = theRegionalDeputyCommissionerRepository;
}
ArrayList<Integer> arrRDCEnroll;
ArrayList<Integer> arrRDCPunched;
ArrayList<String> arrRDCZoneNames;
@GetMapping("/RegionalDeputyCommissionerOfficeData/{tempDate}")
public LinkedHashMap<String, String> getZoneEnrollPunchAbsentPercentage(@PathVariable String tempDate) //@RequestParam(value = "date")@DateTimeFormat(pattern="yyyy-MM-dd") LocalDate date
{
Date date = null;
try {
date = new SimpleDateFormat("dd-MM-yyyy").parse(tempDate);
} catch (ParseException e) {
e.printStackTrace();
}
System.out.println(date);
LinkedHashMap<String, String> map = new LinkedHashMap<>();
arrRDCPunched = regionalDeputyCommissionerRepository.getRDCPunched(date);
System.out.println("Punched: "+arrRDCPunched);
arrRDCEnroll = regionalDeputyCommissionerRepository.getRDCEnrolled();
System.out.println("Enrolled: "+arrRDCEnroll);
arrRDCZoneNames = regionalDeputyCommissionerRepository.getRDCZoneNames();
System.out.println("Enrolled: "+arrRDCZoneNames);
Integer zoneAbsent=0;
Integer zonePercentage=0;
for(int i=0;i<arrRDCEnroll.size();i++)
{
if(arrRDCPunched.isEmpty())
{
System.out.println("Printing for zone_"+i);
map.put(arrRDCZoneNames.get(i), arrRDCZoneNames.get(i));
map.put(arrRDCZoneNames.get(i)+"_Enrolled", arrRDCEnroll.get(i).toString());
map.put(arrRDCZoneNames.get(i)+"_Punched", "0");
zoneAbsent = arrRDCEnroll.get(i) - 0;
zonePercentage = ((0 *100)/ arrRDCEnroll.get(i));
map.put(arrRDCZoneNames.get(i)+"_Absent", zoneAbsent.toString());
map.put(arrRDCZoneNames.get(i)+"_Percentage", zonePercentage.toString());
zoneAbsent=0;
zonePercentage=0;
}
else
{
System.out.println("Printing for zone_"+i);
map.put(arrRDCZoneNames.get(i), arrRDCZoneNames.get(i));
map.put(arrRDCZoneNames.get(i)+"_Enrolled", arrRDCEnroll.get(i).toString());
map.put(arrRDCZoneNames.get(i)+"_Punched", arrRDCPunched.get(i).toString());
zoneAbsent = arrRDCEnroll.get(i) - arrRDCPunched.get(i);
zonePercentage = ((arrRDCPunched.get(i) *100)/ arrRDCEnroll.get(i));
map.put(arrRDCZoneNames.get(i)+"_Absent", zoneAbsent.toString());
map.put(arrRDCZoneNames.get(i)+"_Percentage", zonePercentage.toString());
zoneAbsent=0;
zonePercentage=0;
}
}
return map;
}
}

284
src/main/java/com/gcc/biometric/api/GccBioMetricApi/controller/ResultRestController.java

@ -0,0 +1,284 @@
package com.gcc.biometric.api.GccBioMetricApi.controller;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/gcc.com")
public class ResultRestController {
Object[] empZoneCount;
@Autowired
private JdbcTemplate jdbcTemplate;
// Permanent staff Registered or Enrolled count
@GetMapping("/PermanentStaffCountOnDevice")
public List<Map<String, Object>> getTotalEmployee() {
List<Map<String, Object>> permList = jdbcTemplate.queryForList(
"select count(*) as total_employee ,a.Device_ID, b.device_name from tbl_realtime_userinfo a, tbl_fkdevice_status b,tblemployee c\n"
+ "where a.Device_ID=b.device_id and a.user_id <>1 and a.user_id <> 2 and a.user_id <> 3\n"
+ "AND a.user_id=c.paycode\n"
+ "AND a.user_id not like '1100%' AND a.user_id not like '1200%' \n"
+ "group by a.device_id,b.device_name\n" + " order by device_name");
return permList;
}
@GetMapping("/NULMStaffCountOnDevice")
public List<Map<String, Object>> getNULM() {
List<Map<String, Object>> nulmList = jdbcTemplate.queryForList(
"select count(*) as total_employee ,a.Device_ID, b.device_name from tbl_realtime_userinfo a, tbl_fkdevice_status b,tblemployee c\r\n"
+ "where a.Device_ID=b.device_id and a.user_id <>1 and a.user_id <> 2 and a.user_id <> 3\r\n"
+ "AND a.user_id=c.paycode\r\n" + "AND a.user_id like '1100%' \r\n"
+ "group by a.device_id,b.device_name\r\n" + " order by device_name");
return nulmList;
}
// NMR staff Registered or Enrolled count
@GetMapping("/NMRStaffCountOnDevice")
public List<Map<String, Object>> getNMR() {
List<Map<String, Object>> nmrList = jdbcTemplate.queryForList(
"select count(*) as total_employee ,a.Device_ID, b.device_name from tbl_realtime_userinfo a, tbl_fkdevice_status b,tblemployee c\r\n"
+ "where a.Device_ID=b.device_id and a.user_id <>1 and a.user_id <> 2 and a.user_id <> 3\r\n"
+ "AND a.user_id=c.paycode\r\n" + "AND a.user_id like '1100%' \r\n"
+ "group by a.device_id,b.device_name\r\n" + " order by device_name");
return nmrList;
}
// Zone Enrolled count
@GetMapping("/EmployeeEnrolledCountAsPerZone")
public List<Map<String, Object>> getEmpPerZoneCount() {
List<Map<String, Object>> empPerZoneCount = jdbcTemplate
.queryForList("select '1' zone_1,sum(case when d.zone=1 then 1 else 0 end) empCount_1,"
+ "'2' zone_2,sum(case when d.zone=2 then 1 else 0 end) empCount_2,"
+ "'3' zone_3,sum(case when d.zone=3 then 1 else 0 end) empCount_3,"
+ "'4' zone_4,sum(case when d.zone=4 then 1 else 0 end) empCount_4,"
+ "'5' zone_5,sum(case when d.zone=5 then 1 else 0 end) empCount_5,"
+ "'6' zone_6,sum(case when d.zone=6 then 1 else 0 end) empCount_6,"
+ "'7' zone_7,sum(case when d.zone=7 then 1 else 0 end) empCount_7,"
+ "'8' zone_8,sum(case when d.zone=8 then 1 else 0 end) empCount_8,"
+ "'9' zone_9,sum(case when d.zone=9 then 1 else 0 end) empCount_9,"
+ "'10' zone_10,sum(case when d.zone=10 then 1 else 0 end) empCount_10,"
+ "'11' zone_11,sum(case when d.zone=11 then 1 else 0 end) empCount_11,"
+ "'12' zone_12,sum(case when d.zone=12 then 1 else 0 end) empCount_12,"
+ "'13' zone_13,sum(case when d.zone=13 then 1 else 0 end) empCount_13,"
+ "'14' zone_14,sum(case when d.zone=14 then 1 else 0 end) empCount_14,"
+ "'15' zone_15,sum(case when d.zone=15 then 1 else 0 end) empCount_15,"
+ "'16' zone_16,sum(case when d.zone=16 then 1 else 0 end) empCount_16\r\n"
+ "from tbl_realtime_userinfo a, tbl_fkdevice_status b,tblemployee c,zone_div_mast d "
+ "where a.Device_ID=b.device_id and a.user_id <>1 and a.user_id <> 2 and a.user_id <> 3 \r\n"
+ "AND a.user_id=c.paycode and b.device_name=d.devname");
return empPerZoneCount;
// Real Query "Select d.zone, count(*) as empCount
// from tbl_realtime_userinfo a, tbl_fkdevice_status b,tblemployee c,zone_div_mast d
// where a.Device_ID=b.device_id and a.user_id <>1 and a.user_id <> 2 and a.user_id <> 3
// AND a.user_id=c.paycode and b.device_name=d.devname AND a.user_id not like '1100%' AND a.user_id not like '1200%'
// and d.division not like '%ZONE%'
// group by d.zone order by d.zone;"
}
// Zone Enrolled count
@GetMapping("/ByRealQueryEmployeeEnrolledCountAsPerZone")
public List<Map<String, Object>> getEmpPerZoneCountByRealQuery() {
List<Map<String, Object>> empPerZoneCount = jdbcTemplate.queryForList("Select d.zone, count(*) as empCount\r\n"
+ " from tbl_realtime_userinfo a, tbl_fkdevice_status b,tblemployee c,zone_div_mast d\r\n"
+ " where a.Device_ID=b.device_id and a.user_id <>1 and a.user_id <> 2 and a.user_id <> 3\r\n"
+ " AND a.user_id=c.paycode and b.device_name=d.devname AND a.user_id not like '1100%' AND a.user_id not like '1200%' \r\n"
+ " and d.division not like '%ZONE%'\r\n" + " group by d.zone order by d.zone");
return empPerZoneCount;
}
// // Getting all the results here
// @GetMapping("/ZoneEmpCountPresentAbsent/{tempDate}")
// public List getEmpPerPunZoneCount(@PathVariable @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) String tempDate) { // @PathVariable String officePunch
//
// System.out.println("Date is " + tempDate);
//
//
//// DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss");
//// LocalDateTime now = LocalDateTime.now();
//// System.out.println(dtf.format(now));
////
////
////
//// String startInput = tempDate;
//// String stopInput = now.toString();
////
//// DateTimeFormatter f = DateTimeFormatter.ofPattern( "yyyy/MM/dd HH:mm:ss" );
////
//// LocalDateTime start = LocalDateTime.parse( startInput , f ) ;
//// LocalDateTime stop = LocalDateTime.parse( stopInput , f ) ;
//// boolean isBefore = start.isBefore( stop ) ;
////
//// System.out.println(isBefore);
//
//
// List empPerZoneCount = jdbcTemplate.queryForList("" + "select"
// + "'1' zone_1,sum(case when d.zone=1 then 1 else 0 end) empCount_1,\r\n"
// + "sum(case when d.zone=1 and e.PAYCODE is not null then 1 else 0 end) empPunchCount_1,\r\n"
// + "sum(case when d.zone=1 and e.PAYCODE is null then 1 else 0 end) absent_1,\r\n"
// + "'2' zone_2,sum(case when d.zone=2 then 1 else 0 end) empCount_2,\r\n"
// + "sum(case when d.zone=2 and e.PAYCODE is not null then 1 else 0 end) empPunchCount_2,\r\n"
// + "sum(case when d.zone=2 and e.PAYCODE is null then 1 else 0 end) absent_2,\r\n"
// + "'3' zone_3,sum(case when d.zone=3 then 1 else 0 end) empCount_3,\r\n"
// + "sum(case when d.zone=3 and e.PAYCODE is not null then 1 else 0 end) empPunchCount_3,\r\n"
// + "sum(case when d.zone=3 and e.PAYCODE is null then 1 else 0 end) absent_3,\r\n"
// + "'4' zone_4,sum(case when d.zone=4 then 1 else 0 end) empCount_4,\r\n"
// + "sum(case when d.zone=4 and e.PAYCODE is not null then 1 else 0 end) empPunchCount_4,\r\n"
// + "sum(case when d.zone=4 and e.PAYCODE is null then 1 else 0 end) absent_4,\r\n"
// + "'5' zone_5,sum(case when d.zone=5 then 1 else 0 end) empCount_5,\r\n"
// + "sum(case when d.zone=5 and e.PAYCODE is not null then 1 else 0 end) empPunchCount_5,\r\n"
// + "sum(case when d.zone=5 and e.PAYCODE is null then 1 else 0 end) absent_5,\r\n"
// + "'6' zone_6,sum(case when d.zone=6 then 1 else 0 end) empCount_6,\r\n"
// + "sum(case when d.zone=6 and e.PAYCODE is not null then 1 else 0 end) empPunchCount_6,\r\n"
// + "sum(case when d.zone=6 and e.PAYCODE is null then 1 else 0 end) absent_6,\r\n"
// + "'7' zone_7,sum(case when d.zone=7 then 1 else 0 end) empCount_7,\r\n"
// + "sum(case when d.zone=7 and e.PAYCODE is not null then 1 else 0 end) empPunchCount_7,\r\n"
// + "sum(case when d.zone=7 and e.PAYCODE is null then 1 else 0 end) absent_7,\r\n"
// + "'8' zone_8,sum(case when d.zone=8 then 1 else 0 end) empCount_8,\r\n"
// + "sum(case when d.zone=8 and e.PAYCODE is not null then 1 else 0 end) empPunchCount_8,\r\n"
// + "sum(case when d.zone=8 and e.PAYCODE is null then 1 else 0 end) absent_8,\r\n"
// + "'9' zone_9,sum(case when d.zone=9 then 1 else 0 end) empCount_9,\r\n"
// + "sum(case when d.zone=9 and e.PAYCODE is not null then 1 else 0 end) empPunchCount_9,\r\n"
// + "sum(case when d.zone=9 and e.PAYCODE is null then 1 else 0 end) absent_9,\r\n"
// + "'10' zone_10,sum(case when d.zone=10 then 1 else 0 end) empCount_10,\r\n"
// + "sum(case when d.zone=10 and e.PAYCODE is not null then 1 else 0 end) empPunchCount_10,\r\n"
// + "sum(case when d.zone=10 and e.PAYCODE is null then 1 else 0 end) absent_10,\r\n"
// + "'11' zone_11,sum(case when d.zone=11 then 1 else 0 end) empCount_11,\r\n"
// + "sum(case when d.zone=11 and e.PAYCODE is not null then 1 else 0 end) empPunchCount_11,\r\n"
// + "sum(case when d.zone=11 and e.PAYCODE is null then 1 else 0 end) absent_11,\r\n"
// + "'12' zone_12,sum(case when d.zone=12 then 1 else 0 end) empCount_12,\r\n"
// + "sum(case when d.zone=12 and e.PAYCODE is not null then 1 else 0 end) empPunchCount_12,\r\n"
// + "sum(case when d.zone=12 and e.PAYCODE is null then 1 else 0 end) absent_12,\r\n"
// + "'13' zone_13,sum(case when d.zone=13 then 1 else 0 end) empCount_13,\r\n"
// + "sum(case when d.zone=13 and e.PAYCODE is not null then 1 else 0 end) empPunchCount_13,\r\n"
// + "sum(case when d.zone=13 and e.PAYCODE is null then 1 else 0 end) absent_13,\r\n"
// + "'14' zone_14,sum(case when d.zone=14 then 1 else 0 end) empCount_14,\r\n"
// + "sum(case when d.zone=14 and e.PAYCODE is not null then 1 else 0 end) empPunchCount_14,\r\n"
// + "sum(case when d.zone=14 and e.PAYCODE is null then 1 else 0 end) absent_14,\r\n"
// + "'15' zone_15,sum(case when d.zone=15 then 1 else 0 end) empCount_15,\r\n"
// + "sum(case when d.zone=15 and e.PAYCODE is not null then 1 else 0 end) empPunchCount_15,\r\n"
// + "sum(case when d.zone=15 and e.PAYCODE is null then 1 else 0 end) absent_15,\r\n"
// + "'16' zone_16,sum(case when d.zone=16 then 1 else 0 end) empCount_16,\r\n"
// + "sum(case when d.zone=16 and e.PAYCODE is not null then 1 else 0 end) empPunchCount_16,\r\n"
// + "sum(case when d.zone=16 and e.PAYCODE is null then 1 else 0 end) absent_16\r\n"
// + "from tbl_realtime_userinfo a\r\n" + "inner join tbl_fkdevice_status b on a.Device_ID=b.device_id\r\n"
// + "inner join tblemployee c on a.user_id=c.paycode\r\n"
// + "inner join zone_div_mast d on b.device_name=d.devname\r\n"
// + "left outer join MachineRawPunch e on (c.PAYCODE = e.PAYCODE and cast(e.OFFICEPUNCH as date)=?)\r\n"
// + "where a.user_id <>1 and a.user_id <> 2 and a.user_id <> 3 \r\n"
// + "AND a.user_id not like '1100%' AND a.user_id not like '1200%' \r\n"
// + "and d.division not like '%ZONE%'", tempDate);
//
// System.out.println("Printed");
// return empPerZoneCount;
//
//// Real Query "Select d.zone, count(*) as empCount
//// from tbl_realtime_userinfo a, tbl_fkdevice_status b,tblemployee c,zone_div_mast d
//// where a.Device_ID=b.device_id and a.user_id <>1 and a.user_id <> 2 and a.user_id <> 3
//// AND a.user_id=c.paycode and b.device_name=d.devname AND a.user_id not like '1100%' AND a.user_id not like '1200%'
//// and d.division not like '%ZONE%'
//// group by d.zone order by d.zone;"
//
// }
// Employee punch count as per date
@GetMapping("/EmployeePunchedCountAsPerZone")
public List<Map<String, Object>> empZonePunchCount() {
List<Map<String, Object>> empZonePunchCount = jdbcTemplate.queryForList(""
+ "(sum(case when c.zone=1 and a.paycode is not null then 1 else 0 end) empPunchCount_1\r\n"
+ "from MachineRawPunch a inner join tbl_fkdevice_status b\r\n"
+ "inner join zone_div_mast c on c.DEVNAME=b.device_name\r\n"
+ "on a.DeviceID=b.device_id \r\n"
+ "where cast(OFFICEPUNCH as date) ='2022-10-21'\r\n"
+ "group by ZONE) as x");
return empZonePunchCount;
// Real Query
// @GetMapping("/empZonePunchCount")
// public List empZonePunchCount1() {
//
// List empZonePunchCount = jdbcTemplate.queryForList("SELECT e.zone , count(*) as punched\r\n"
// + "FROM tblemployee a , MachineRawPunch b,tbl_fkdevice_status c, tblDepartment d, zone_div_mast e\r\n"
// + "where a.PAYCODE = b.PAYCODE\r\n"
// + "AND e.DEVNAME=c.device_name\r\n"
// + "AND b.DeviceID=c.device_id\r\n"
// + "and a.DepartmentCode=d.DepartmentCode\r\n"
// + "and cast(b.OFFICEPUNCH as date)='2022-10-26'\r\n"
// + "group by e.zone\r\n"
// + " order by e.zone");
//
// return empZonePunchCount;
//
// }
}
}
// @GetMapping("/jasonzonecount")
// public JSONObject getList()
// {
//
// List lst = jdbcTemplate.queryForList("select '1' zone1,sum(case when d.zone=1 then 1 else 0 end) zonecnt1,\r\n"
// + "sum(case when d.zone=1 and lower(d.devname) like '%a%' then 1 else 0 end) zonepunchcnt1,"
// + "'2' zone2,sum(case when d.zone=2 then 1 else 0 end) zonecnt2,\r\n"
// + "'3' zone3,sum(case when d.zone=3 then 1 else 0 end) zonecnt3,\r\n"
// + "'4' zone4,sum(case when d.zone=4 then 1 else 0 end) zonecnt4,\r\n"
// + "'5' zone5,sum(case when d.zone=5 then 1 else 0 end) zonecnt5,\r\n"
// + "'6' zone6,sum(case when d.zone=6 then 1 else 0 end) zonecnt6,\r\n"
// + "'7' zone7,sum(case when d.zone=7 then 1 else 0 end) zonecnt7,\r\n"
// + "'8' zone8,sum(case when d.zone=8 then 1 else 0 end) zonecnt8,\r\n"
// + "'9' zone9,sum(case when d.zone=9 then 1 else 0 end) zonecnt9,\r\n"
// + "'10' zone10,sum(case when d.zone=10 then 1 else 0 end) zonecnt10,\r\n"
// + "'11' zone11,sum(case when d.zone=11 then 1 else 0 end) zonecnt11,\r\n"
// + "'12' zone12,sum(case when d.zone=12 then 1 else 0 end) zonecnt12,\r\n"
// + "'13' zone13,sum(case when d.zone=13 then 1 else 0 end) zonecnt13,\r\n"
// + "'14' zone14,sum(case when d.zone=14 then 1 else 0 end) zonecnt14,\r\n"
// + "'15' zone15,sum(case when d.zone=15 then 1 else 0 end) zonecnt15,\r\n"
// + "'16' zone16,sum(case when d.zone=16 then 1 else 0 end) zonecnt16\r\n"
// + "from tbl_realtime_userinfo a, tbl_fkdevice_status b,tblemployee c,zone_div_mast d where a.Device_ID=b.device_id and a.user_id <>1 and a.user_id <> 2 and a.user_id <> 3 \r\n"
// + " AND a.user_id=c.paycode and b.device_name=d.devname AND a.user_id not like '1100%' AND a.user_id not like '1200%' and d.division not like '%ZONE%' and d.zone=15");
// JSONObject obj = new JSONObject();
// for(int i=0;i<lst.size();i++)
// {
// System.out.println(lst.get(i));
// Object a=lst.get(i);
// obj.put("zone1", a.);
// }
//
//
//
// return obj;
// }
//
// @ResponseBody
// @GetMapping("/zonecount1")
// public String getZoneCount1() {
//
// return "[\r\n" + "{\r\n" + "\"zone1\": \"1\",\r\n" + "\"zonecnt1\": 276}\r\n" + "]";
//
// }

117
src/main/java/com/gcc/biometric/api/GccBioMetricApi/controller/UserCountRestController.java

@ -0,0 +1,117 @@
package com.gcc.biometric.api.GccBioMetricApi.controller;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/gcc.com")
public class UserCountRestController {
Object[] empZoneCount;
@Autowired
private JdbcTemplate jdbcTemplate;
// Zone Enrolled count
@GetMapping("/Testing")
public List<Map<String, Object>> getEmpPerZoneCountByRealQuery() {
List<Map<String, Object>> empPerZoneCount = jdbcTemplate.queryForList("Select d.zone, count(*) as empCount\r\n"
+ " from tbl_realtime_userinfo a, tbl_fkdevice_status b,tblemployee c,zone_div_mast d\r\n"
+ " where a.Device_ID=b.device_id and a.user_id <>1 and a.user_id <> 2 and a.user_id <> 3\r\n"
+ " AND a.user_id=c.paycode and b.device_name=d.devname AND a.user_id not like '1100%' AND a.user_id not like '1200%' \r\n"
+ " and d.division not like '%ZONE%'\r\n" + " group by d.zone order by d.zone");
empZoneCount = empPerZoneCount.toArray();
for (int i = 0; i < empZoneCount.length; i++) {
System.out.println(empZoneCount[i]);
}
System.out.println("Length is:::::::::::::::::::::::" + empZoneCount.length);
return empPerZoneCount;
}
@GetMapping("/ZoneEmpCountPresentAbsentTest")
public List<Map<String, Object>> getEmpPerPunZoneCount()
{
// DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss");
// LocalDateTime now = LocalDateTime.now();
// System.out.println(dtf.format(now));
//
//
//
// String startInput = tempDate;
// String stopInput = now.toString();
//
// DateTimeFormatter f = DateTimeFormatter.ofPattern( "yyyy/MM/dd HH:mm:ss" );
//
// LocalDateTime start = LocalDateTime.parse( startInput , f ) ;
// LocalDateTime stop = LocalDateTime.parse( stopInput , f ) ;
// boolean isBefore = start.isBefore( stop ) ;
//
// System.out.println(isBefore);
List<Map<String, Object>> empPerZoneCount = jdbcTemplate.queryForList("select ZONE,count(*) as Enrolled,\r\n"
+ "(select count(distinct paycode) from MachineRawPunch a,tbl_fkdevice_status c,zone_div_mast b\r\n"
+ "where a.DeviceID=c.device_id and c.device_name=b.DEVNAME and cast(OFFICEPUNCH as date) = '2022-10-21' \r\n"
+ ") as Punched\r\n"
+ "from tbl_realtime_userinfo a,tbl_fkdevice_status b,zone_div_mast c\r\n"
+ "where a.Device_ID=b.device_id and c.DEVNAME=b.device_name\r\n"
+ " and a.user_id <>1 and a.user_id <> 2 and a.user_id <> 3 group by zone");
return empPerZoneCount;
// Real Query "Select d.zone, count(*) as empCount
// from tbl_realtime_userinfo a, tbl_fkdevice_status b,tblemployee c,zone_div_mast d
// where a.Device_ID=b.device_id and a.user_id <>1 and a.user_id <> 2 and a.user_id <> 3
// AND a.user_id=c.paycode and b.device_name=d.devname AND a.user_id not like '1100%' AND a.user_id not like '1200%'
// and d.division not like '%ZONE%'
// group by d.zone order by d.zone;"
}
}

79
src/main/java/com/gcc/biometric/api/GccBioMetricApi/controller/ZonalAbsenteesDataController.java

@ -0,0 +1,79 @@
package com.gcc.biometric.api.GccBioMetricApi.controller;
import org.springframework.web.bind.annotation.GetMapping;
import java.util.Date;
import java.util.LinkedHashMap;
import java.util.ArrayList;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Map;
import java.util.List;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.beans.factory.annotation.Autowired;
import com.gcc.biometric.api.GccBioMetricApi.repo.ZonalAbsenteesDataRepository;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController("zonalAbsenteesDataController")
@RequestMapping("/gcc.com")
public class ZonalAbsenteesDataController
{
@Autowired
private ZonalAbsenteesDataRepository zonalAbsenteesDataRepository;
@Autowired
public ZonalAbsenteesDataController(final ZonalAbsenteesDataRepository theZonalAbsenteesDataRepository) {
this.zonalAbsenteesDataRepository = theZonalAbsenteesDataRepository;
}
@GetMapping({ "/AbsenteesOfZonalOffices/{zone}/{tempDate}" })
public List<Map<String, String>> getDepartmentAbsetees(@PathVariable final Integer zone, @PathVariable final String tempDate) {
final Integer zoneValue = zone;
Date date = null;
try {
date = new SimpleDateFormat("dd-MM-yyyy").parse(tempDate);
}
catch (ParseException e) {
e.printStackTrace();
}
System.out.println(zoneValue);
System.out.println(date);
final ArrayList<String> AbsenteesUserId = (ArrayList<String>)this.zonalAbsenteesDataRepository.zonalAbsenteesUserId(zoneValue, date);
final ArrayList<String> AbsenteesUserName = (ArrayList<String>)this.zonalAbsenteesDataRepository.zonalAbsenteesUserName(zoneValue, date);
final ArrayList<String> AbsenteesUserDesignation = (ArrayList<String>)this.zonalAbsenteesDataRepository.zonalAbsenteesUserDesignation(zoneValue, date);
final List<Map<String, String>> listMap = new ArrayList<Map<String, String>>();
if (!AbsenteesUserId.isEmpty()) {
for (int i = 0; i < AbsenteesUserId.size(); ++i) {
final ArrayList<String> myListKey = new ArrayList<String>();
final ArrayList<String> myListValue = new ArrayList<String>();
myListKey.add("UserId");
myListValue.add(AbsenteesUserId.get(i));
myListKey.add("UserName");
myListValue.add(AbsenteesUserName.get(i));
myListKey.add("Designation");
myListValue.add(AbsenteesUserDesignation.get(i).trim());
final Map<String, String> map = new LinkedHashMap<String, String>();
for (int x = 0; x < myListKey.size(); ++x) {
map.put(myListKey.get(x), myListValue.get(x));
}
listMap.add(map);
}
return listMap;
}
final ArrayList<String> myListKey2 = new ArrayList<String>();
final ArrayList<String> myListValue2 = new ArrayList<String>();
myListKey2.add("UserId");
myListValue2.add("0");
myListKey2.add("UserName");
myListValue2.add("0");
myListKey2.add("Designation");
myListValue2.add("0");
final Map<String, String> map2 = new LinkedHashMap<String, String>();
for (int x2 = 0; x2 < myListKey2.size(); ++x2) {
map2.put(myListKey2.get(x2), myListValue2.get(x2));
}
listMap.add(map2);
System.out.println("Printed");
return listMap;
}
}

86
src/main/java/com/gcc/biometric/api/GccBioMetricApi/controller/ZonalOfficeTotalDateController.java

@ -0,0 +1,86 @@
package com.gcc.biometric.api.GccBioMetricApi.controller;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.LinkedHashMap;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.gcc.biometric.api.GccBioMetricApi.repo.HeadQuaterEntriesRepository;
import com.gcc.biometric.api.GccBioMetricApi.repo.ZonalOfficeTotalDataRepository;
@RestController
@RequestMapping("/gcc.com")
public class ZonalOfficeTotalDateController {
@Autowired
private ZonalOfficeTotalDataRepository zonalOfficeTotalDataRepository;
// inject employee dao
@Autowired
public ZonalOfficeTotalDateController(ZonalOfficeTotalDataRepository theZonalOfficeTotalDataRepository) {
zonalOfficeTotalDataRepository = theZonalOfficeTotalDataRepository;
}
ArrayList<Integer> arrZonalTotalEnroll;
ArrayList<Integer> arrZonalTotalPunched;
@GetMapping("/TotalZonalOfficeEmployeeData/{tempDate}")
public LinkedHashMap<String, Integer> getZoneEnrollPunchAbsentPercentage(@PathVariable String tempDate) //@RequestParam(value = "date")@DateTimeFormat(pattern="yyyy-MM-dd") LocalDate date
{
Date date = null;
try {
date = new SimpleDateFormat("dd-MM-yyyy").parse(tempDate);
} catch (ParseException e) {
e.printStackTrace();
}
System.out.println(date);
LinkedHashMap<String, Integer> map = new LinkedHashMap<>();
arrZonalTotalEnroll = zonalOfficeTotalDataRepository.getZonalOfficeTotalEnrolled();
arrZonalTotalPunched = zonalOfficeTotalDataRepository.getZonalOfficeTotalPunched(date);
System.out.println("Enrolled: "+arrZonalTotalEnroll);
System.out.println("Punched: "+arrZonalTotalPunched);
Integer zoneAbsent=0;
Integer zonePercentage=0;
for(int i=0;i<arrZonalTotalEnroll.size();i++)
{
System.out.println("Printing for zone_"+i);
map.put("Zonal Office Eenrolled", arrZonalTotalEnroll.get(i));
map.put("Zonal Office Punched", arrZonalTotalPunched.get(i));
zoneAbsent = arrZonalTotalEnroll.get(i) - arrZonalTotalPunched.get(i);
zonePercentage = ((arrZonalTotalPunched.get(i) *100)/ arrZonalTotalEnroll.get(i));
map.put("Absent", zoneAbsent);
map.put("Percentage", zonePercentage);
zoneAbsent=0;
zonePercentage=0;
}
return map;
}
}

48
src/main/java/com/gcc/biometric/api/GccBioMetricApi/controller/ZoneDivMasterController.java

@ -0,0 +1,48 @@
package com.gcc.biometric.api.GccBioMetricApi.controller;
import java.util.HashSet;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.gcc.biometric.api.GccBioMetricApi.entity.ZoneDivMaster;
import com.gcc.biometric.api.GccBioMetricApi.service.ZoneDivMasterService;
@RestController
@RequestMapping("/gcc.com")
public class ZoneDivMasterController {
static Object[] zoneList;
@Autowired
private static ZoneDivMasterService zoneDivMasterService;
// @Autowired
// private JdbcTemplate jdbcTemplate;
// inject employee dao
@Autowired
public ZoneDivMasterController(ZoneDivMasterService theZoneDivMasterService) {
zoneDivMasterService = theZoneDivMasterService;
}
@GetMapping("/zones")
static HashSet<ZoneDivMaster> getZoneList() {
HashSet<ZoneDivMaster> tempZones = zoneDivMasterService.getZoneList();
zoneList = tempZones.toArray();
for(int i=0;i<zoneList.length;i++)
{
System.out.println(zoneList[i]);
}
return tempZones;
}
}

194
src/main/java/com/gcc/biometric/api/GccBioMetricApi/controller/ZoneDivisionOfficeAbsenteesDataController.java

@ -0,0 +1,194 @@
package com.gcc.biometric.api.GccBioMetricApi.controller;
import org.springframework.web.bind.annotation.GetMapping;
import java.util.Date;
import java.util.LinkedHashMap;
import java.util.ArrayList;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Map;
import java.util.List;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.beans.factory.annotation.Autowired;
import com.gcc.biometric.api.GccBioMetricApi.repo.ZoneDivisionOfficeAbsenteesDataRepository;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController("zoneDivisionOfficeAbsenteesDataController")
@RequestMapping("/gcc.com")
public class ZoneDivisionOfficeAbsenteesDataController
{
@Autowired
private ZoneDivisionOfficeAbsenteesDataRepository zoneDivisionOfficeAbsenteesDataRepository;
@Autowired
public ZoneDivisionOfficeAbsenteesDataController(ZoneDivisionOfficeAbsenteesDataRepository theZoneDivisionOfficeAbsenteesDataRepository) {
zoneDivisionOfficeAbsenteesDataRepository = theZoneDivisionOfficeAbsenteesDataRepository;
}
@GetMapping({ "/AbsenteesOfZone_DIV_UNIT_LORRY_Offices/{div}/{officeTypes}/{tempDate}" })
public List<Map<String, String>> getDepartmentAbsetees(@PathVariable final String div, @PathVariable final String officeTypes, @PathVariable final String tempDate) {
final String divValue = div;
final String officeType = officeTypes;
if (officeType.equals("DO")) {
System.out.println("for Division Office Absentees");
Date date = null;
try {
date = new SimpleDateFormat("dd-MM-yyyy").parse(tempDate);
}
catch (ParseException e) {
e.printStackTrace();
}
System.out.println(divValue);
System.out.println(officeType);
System.out.println(date);
final ArrayList<String> AbsenteesUserId = (ArrayList<String>)this.zoneDivisionOfficeAbsenteesDataRepository.divAbsenteesUserId(divValue, date);
final ArrayList<String> AbsenteesUserName = (ArrayList<String>)this.zoneDivisionOfficeAbsenteesDataRepository.divAbsenteesUserName(divValue, date);
final ArrayList<String> AbsenteesUserDesignation = (ArrayList<String>)this.zoneDivisionOfficeAbsenteesDataRepository.divAbsenteesUserDesignation(divValue, date);
final List<Map<String, String>> listMap = new ArrayList<Map<String, String>>();
System.out.println(AbsenteesUserId.isEmpty());
if (!AbsenteesUserId.isEmpty()) {
for (int i = 0; i < AbsenteesUserId.size(); ++i) {
final ArrayList<String> myListKey = new ArrayList<String>();
final ArrayList<String> myListValue = new ArrayList<String>();
myListKey.add("UserId");
myListValue.add(AbsenteesUserId.get(i));
myListKey.add("UserName");
myListValue.add(AbsenteesUserName.get(i));
myListKey.add("Designation");
myListValue.add(AbsenteesUserDesignation.get(i).trim());
final Map<String, String> map = new LinkedHashMap<String, String>();
for (int x = 0; x < myListKey.size(); ++x) {
map.put(myListKey.get(x), myListValue.get(x));
}
listMap.add(map);
}
return listMap;
}
final ArrayList<String> myListKey2 = new ArrayList<String>();
final ArrayList<String> myListValue2 = new ArrayList<String>();
myListKey2.add("UserId");
myListValue2.add("0");
myListKey2.add("UserName");
myListValue2.add("0");
myListKey2.add("Designation");
myListValue2.add("0");
final Map<String, String> map2 = new LinkedHashMap<String, String>();
for (int x2 = 0; x2 < myListKey2.size(); ++x2) {
map2.put(myListKey2.get(x2), myListValue2.get(x2));
}
listMap.add(map2);
return listMap;
}
else if (officeType.equals("LS")) {
System.out.println("for Lorry Station Absentees");
Date date = null;
try {
date = new SimpleDateFormat("dd-MM-yyyy").parse(tempDate);
}
catch (ParseException e) {
e.printStackTrace();
}
System.out.println(divValue);
System.out.println(officeType);
System.out.println(date);
Integer zone = Integer.parseInt(divValue);
if (zone == 1 || zone == 2 || zone == 3) {
zone = 1;
}
final ArrayList<String> AbsenteesUserId = (ArrayList<String>)this.zoneDivisionOfficeAbsenteesDataRepository.lorryAbsenteesUserId(zone, date);
final ArrayList<String> AbsenteesUserName = (ArrayList<String>)this.zoneDivisionOfficeAbsenteesDataRepository.lorryAbsenteesUserName(zone, date);
final ArrayList<String> AbsenteesUserDesignation = (ArrayList<String>)this.zoneDivisionOfficeAbsenteesDataRepository.lorryAbsenteesUserDesignation(zone, date);
System.out.println(AbsenteesUserId.size());
final List<Map<String, String>> listMap2 = new ArrayList<Map<String, String>>();
if (!AbsenteesUserId.isEmpty()) {
for (int j = 0; j < AbsenteesUserId.size(); ++j) {
final ArrayList<String> myListKey3 = new ArrayList<String>();
final ArrayList<String> myListValue3 = new ArrayList<String>();
myListKey3.add("UserId");
myListValue3.add(AbsenteesUserId.get(j));
myListKey3.add("UserName");
myListValue3.add(AbsenteesUserName.get(j));
myListKey3.add("Designation");
myListValue3.add(AbsenteesUserDesignation.get(j).trim());
final Map<String, String> map3 = new LinkedHashMap<String, String>();
for (int x3 = 0; x3 < myListKey3.size(); ++x3) {
map3.put(myListKey3.get(x3), myListValue3.get(x3));
}
listMap2.add(map3);
}
return listMap2;
}
final ArrayList<String> myListKey = new ArrayList<String>();
final ArrayList<String> myListValue = new ArrayList<String>();
myListKey.add("UserId");
myListValue.add("0");
myListKey.add("UserName");
myListValue.add("0");
myListKey.add("Designation");
myListValue.add("0");
final Map<String, String> map = new LinkedHashMap<String, String>();
for (int x = 0; x < myListKey.size(); ++x) {
map.put(myListKey.get(x), myListValue.get(x));
}
listMap2.add(map);
System.out.println("Total Absentees: " + AbsenteesUserId.size());
return listMap2;
}
else {
if (officeType.equals("UO")) {
System.out.println("for Unit Office Absentees");
Date date = null;
try {
date = new SimpleDateFormat("dd-MM-yyyy").parse(tempDate);
}
catch (ParseException e) {
e.printStackTrace();
}
System.out.println(divValue);
System.out.println(officeType);
System.out.println(date);
final String unitValue = divValue;
final ArrayList<String> AbsenteesUserId = (ArrayList<String>)this.zoneDivisionOfficeAbsenteesDataRepository.unitAbsenteesUserId(unitValue, date);
final ArrayList<String> AbsenteesUserName = (ArrayList<String>)this.zoneDivisionOfficeAbsenteesDataRepository.unitAbsenteesUserName(unitValue, date);
final ArrayList<String> AbsenteesUserDesignation = (ArrayList<String>)this.zoneDivisionOfficeAbsenteesDataRepository.unitAbsenteesUserDesignation(unitValue, date);
final List<Map<String, String>> listMap2 = new ArrayList<Map<String, String>>();
if (!AbsenteesUserId.isEmpty()) {
for (int j = 0; j < AbsenteesUserId.size(); ++j) {
final ArrayList<String> myListKey3 = new ArrayList<String>();
final ArrayList<String> myListValue3 = new ArrayList<String>();
myListKey3.add("UserId");
myListValue3.add(AbsenteesUserId.get(j));
myListKey3.add("UserName");
myListValue3.add(AbsenteesUserName.get(j));
myListKey3.add("Designation");
myListValue3.add(AbsenteesUserDesignation.get(j).trim());
final Map<String, String> map3 = new LinkedHashMap<String, String>();
for (int x3 = 0; x3 < myListKey3.size(); ++x3) {
map3.put(myListKey3.get(x3), myListValue3.get(x3));
}
listMap2.add(map3);
}
}
else {
final ArrayList<String> myListKey = new ArrayList<String>();
final ArrayList<String> myListValue = new ArrayList<String>();
myListKey.add("UserId");
myListValue.add("0");
myListKey.add("UserName");
myListValue.add("0");
myListKey.add("Designation");
myListValue.add("0");
final Map<String, String> map = new LinkedHashMap<String, String>();
for (int x = 0; x < myListKey.size(); ++x) {
map.put(myListKey.get(x), myListValue.get(x));
}
listMap2.add(map);
}
System.out.println("Total Absentees: " + AbsenteesUserId.size());
return listMap2;
}
return null;
}
}
}

523
src/main/java/com/gcc/biometric/api/GccBioMetricApi/controller/ZoneDivisionOfficeController.java

@ -0,0 +1,523 @@
package com.gcc.biometric.api.GccBioMetricApi.controller;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.gcc.biometric.api.GccBioMetricApi.repo.ZoneDivisionOfficeRepository;
@RestController
@RequestMapping("/gcc.com")
public class ZoneDivisionOfficeController {
@Autowired
private ZoneDivisionOfficeRepository zoneDivMasterRepository;
@Autowired
public ZoneDivisionOfficeController(ZoneDivisionOfficeRepository theZoneDivMasterRepository) {
zoneDivMasterRepository = theZoneDivMasterRepository;
}
@GetMapping("/DivEmpCountPresentAbsentPercentage/{zone}/{officeTypes}/{tempDate}")
public ResponseEntity<List<Map<String, String>>> getDivEnrollPunchAbsentPercentage(@PathVariable Integer zone,
@PathVariable String officeTypes, @PathVariable String tempDate)
{
System.out.println("Inside getDivEnrollPunchAbsentPercentage() method!");
Integer zoneValue = zone;
String officeType = officeTypes;
//Division Office
if (officeType.equals("DO")) {
System.out.println("for Division Office Data");
Date date = null;
try {
date = new SimpleDateFormat("dd-MM-yyyy").parse(tempDate);
} catch (ParseException e) {
e.printStackTrace();
}
System.out.println(zoneValue);
System.out.println(officeType);
System.out.println(date);
ArrayList<String> zoneDivisions;
ArrayList<String> zoneDivisionsOnDate;
ArrayList<String> divEnrolled;
ArrayList<String> divPunched;
if(zoneValue==1)
{
System.out.println("Inside division 1: Special case");
divPunched = zoneDivMasterRepository.getDivisionOfficePunchedPerDiv_1(zoneValue, date);
zoneDivisionsOnDate = zoneDivMasterRepository.getDivisionOfficeZoneDivAsPerDate(zoneValue, date);
Collections.sort(zoneDivisionsOnDate);
zoneDivisions = zoneDivMasterRepository.getDivisionOfficeZoneDivisions(zoneValue);
System.out.println("Divisions: "+zoneDivisions);
System.out.println("Divisions as per Date: "+zoneDivisionsOnDate);
System.out.println("Punched: "+divPunched);
divEnrolled = zoneDivMasterRepository.getDivisionOfficeEnrolledPerDiv_1(zoneValue);
System.out.println("Enrolled: "+divEnrolled);
}
else
{
divPunched = zoneDivMasterRepository.getDivisionOfficePunchedPerDiv(zoneValue, date);
zoneDivisionsOnDate = zoneDivMasterRepository.getDivisionOfficeZoneDivAsPerDate(zoneValue, date);
Collections.sort(zoneDivisionsOnDate);
zoneDivisions = zoneDivMasterRepository.getDivisionOfficeZoneDivisions(zoneValue);
System.out.println("Divisions: "+zoneDivisions);
System.out.println("Divisions as per Date: "+zoneDivisionsOnDate);
System.out.println("Punched: "+divPunched);
divEnrolled = zoneDivMasterRepository.getDivisionOfficeEnrolledPerDiv(zoneValue);
System.out.println("Enrolled: "+divEnrolled);
}
String divAbsent = null;
String divPercentage = null;
Integer j = 0;
List<Map<String, String>> listMap = new ArrayList<Map<String, String>>();
for (int i = 0; i <zoneDivisions.size(); i++) {
ArrayList<String> myListKey = new ArrayList<>();
ArrayList<String> myListValue = new ArrayList<>();
myListKey.add("Division"); myListValue.add(zoneDivisions.get(i));
myListKey.add("Enrolled"); myListValue.add(divEnrolled.get(i));
if (zoneDivisionsOnDate.contains(zoneDivisions.get(i)))
{
myListKey.add("Punched"); myListValue.add(divPunched.get(j));
Integer xDivAbsent = Integer.parseInt(divEnrolled.get(i)) - Integer.parseInt(divPunched.get(j));
Integer xdivPercentage = ((Integer.parseInt((divPunched.get(j))) *100)/ Integer.parseInt(divEnrolled.get(i)));
divAbsent = xDivAbsent.toString();
divPercentage = xdivPercentage.toString();
j++;
}
else
{
myListKey.add("Punched"); myListValue.add("0");
divAbsent = divEnrolled.get(i);
divPercentage = "0";
}
myListKey.add("Absent"); myListValue.add(divAbsent);
myListKey.add("Percentage"); myListValue.add(divPercentage);
Map<String, String> map = new LinkedHashMap<>();
for(int x=0;x<myListKey.size();x++)
{
map.put(myListKey.get(x), myListValue.get(x));
}
listMap.add(map);
divAbsent=null;
divPercentage=null;
}
return ResponseEntity.ok(listMap);
}
//Unit Office
else if (officeType.equals("UO")) {
System.out.println("for Unit Office Data");
Date date = null;
try {
date = new SimpleDateFormat("dd-MM-yyyy").parse(tempDate);
} catch (ParseException e) {
e.printStackTrace();
}
System.out.println(zoneValue);
System.out.println(officeType);
System.out.println(date);
ArrayList<String> allUnitsAsPerZone;
ArrayList<String> unitEnrolled;
ArrayList<String> unitAsEnrolled;
ArrayList<String> unitPunched;
ArrayList<String> unitAsPunched;
allUnitsAsPerZone = zoneDivMasterRepository.getAllUnitOfficeAsPerZone(zoneValue);
unitEnrolled = zoneDivMasterRepository.getUnitOfficeEnrolledPerZone(zoneValue);
unitAsEnrolled = zoneDivMasterRepository.getAllUnitOfficeAsPerZoneAsPerEnrolled(zoneValue);
unitPunched = zoneDivMasterRepository.getUnitOfficePunchedPerZone(zoneValue, date);
unitAsPunched = zoneDivMasterRepository.getAllUnitOfficeAsPerZoneAsPerPunched(zoneValue, date);
System.out.println("All unit office as per Zone "+allUnitsAsPerZone);
System.out.println("Unit Office Enrolled per zone "+unitEnrolled);
System.out.println("Unit office Which have enrolled data "+unitAsEnrolled);
System.out.println("Unit office Punched "+unitPunched);
System.out.println("Unit office which have punched data "+unitAsPunched);
String divAbsent = null;
String divPercentage = null;
Integer j = 0;
Integer k = 0;
List<Map<String, String>> listMap = new ArrayList<Map<String, String>>();
for (int i = 0; i <allUnitsAsPerZone.size(); i++) {
ArrayList<String> myListKey = new ArrayList<>();
ArrayList<String> myListValue = new ArrayList<>();
myListKey.add("Division"); myListValue.add(allUnitsAsPerZone.get(i));
if(unitAsEnrolled.contains(allUnitsAsPerZone.get(i)))
{
myListKey.add("Enrolled"); myListValue.add(unitEnrolled.get(k));
String enrolled = unitEnrolled.get(k);
k++;
if (unitAsPunched.contains(allUnitsAsPerZone.get(i)))
{
myListKey.add("Punched"); myListValue.add(unitPunched.get(j));
Integer xDivAbsent = Integer.parseInt(enrolled) - Integer.parseInt(unitPunched.get(j));
Integer xdivPercentage = ((Integer.parseInt((unitPunched.get(j))) *100)/ Integer.parseInt(enrolled));
divAbsent = xDivAbsent.toString();
divPercentage = xdivPercentage.toString();
myListKey.add("Absent"); myListValue.add(divAbsent);
myListKey.add("Percentage"); myListValue.add(divPercentage);
j++;
}
else
{
myListKey.add("Punched"); myListValue.add("0");
divAbsent = unitEnrolled.get(i);
divPercentage = "0";
myListKey.add("Absent"); myListValue.add(divAbsent);
myListKey.add("Percentage"); myListValue.add(divPercentage);
}
}
else
{
myListKey.add("Enrolled"); myListValue.add("0");
myListKey.add("Punched"); myListValue.add("0");
myListKey.add("Absent"); myListValue.add("0");
myListKey.add("Percentage"); myListValue.add("0");
}
Map<String, String> map = new LinkedHashMap<>();
for(int x=0;x<myListKey.size();x++)
{
map.put(myListKey.get(x), myListValue.get(x));
}
listMap.add(map);
divAbsent=null;
divPercentage=null;
}
return ResponseEntity.ok(listMap);
}
//Zonal Office
else if (officeType.equals("ZO")) {
System.out.println("for Zonal Office Data");
Date date = null;
try {
date = new SimpleDateFormat("dd-MM-yyyy").parse(tempDate);
} catch (ParseException e) {
e.printStackTrace();
}
System.out.println(zoneValue);
System.out.println(officeType);
System.out.println(date);
ArrayList<String> zoneDivisions;
ArrayList<String> zoneDivisionsOnDate;
ArrayList<String> divEnrolled;
ArrayList<String> divPunched;
divPunched = zoneDivMasterRepository.getZonalOfficePunchedPerDiv(zoneValue, date);
zoneDivisionsOnDate = zoneDivMasterRepository.getZonalOfficeZoneDivAsPerDate(zoneValue, date);
Collections.sort(zoneDivisionsOnDate);
zoneDivisions = zoneDivMasterRepository.getZonalOfficeZoneDivisions(zoneValue);
System.out.println("Divisions: "+zoneDivisions);
System.out.println("Divisionsas per Date: "+zoneDivisionsOnDate);
System.out.println("Punched: "+divPunched);
divEnrolled = zoneDivMasterRepository.getZonalOfficeEnrolledPerDiv(zoneValue);
System.out.println("Enrolled: "+divEnrolled);
String divAbsent = null;
String divPercentage = null;
Integer j = 0;
List<Map<String, String>> listMap = new ArrayList<Map<String, String>>();
for (int i = 0; i <zoneDivisions.size(); i++) {
ArrayList<String> myListKey = new ArrayList<>();
ArrayList<String> myListValue = new ArrayList<>();
myListKey.add("Division"); myListValue.add(zoneDivisions.get(i));
myListKey.add("Enrolled"); myListValue.add(divEnrolled.get(i));
if (zoneDivisionsOnDate.contains(zoneDivisions.get(i)))
{
myListKey.add("Punched"); myListValue.add(divPunched.get(j));
Integer xDivAbsent = Integer.parseInt(divEnrolled.get(i)) - Integer.parseInt(divPunched.get(j));
Integer xdivPercentage = ((Integer.parseInt((divPunched.get(j))) *100)/ Integer.parseInt(divEnrolled.get(i)));
divAbsent = xDivAbsent.toString();
divPercentage = xdivPercentage.toString();
j++;
}
else
{
myListKey.add("Punched"); myListValue.add("0");
divAbsent = divEnrolled.get(i);
divPercentage = "0";
}
myListKey.add("Absent"); myListValue.add(divAbsent);
myListKey.add("Percentage"); myListValue.add(divPercentage);
Map<String, String> map = new LinkedHashMap<>();
for(int x=0;x<myListKey.size();x++)
{
map.put(myListKey.get(x), myListValue.get(x));
}
listMap.add(map);
divAbsent=null;
divPercentage=null;
}
return ResponseEntity.ok(listMap);
}
//Lorry Station
else if (officeType.equals("LS")) {
System.out.println("for Lorry Station Data");
if(zoneValue==2 || zoneValue==3)
{
System.out.println("zone value passed as 2 or 3");
zoneValue=1;
}
Date date = null;
try {
date = new SimpleDateFormat("dd-MM-yyyy").parse(tempDate);
} catch (ParseException e) {
e.printStackTrace();
}
System.out.println(zoneValue);
System.out.println(officeType);
System.out.println(date);
ArrayList<String> zoneDivisions;
ArrayList<String> zoneDivisionsOnDate;
ArrayList<String> divEnrolled;
ArrayList<String> divPunched;
divEnrolled = zoneDivMasterRepository.getLorryStationEnrolledPerDiv(zoneValue);
divPunched = zoneDivMasterRepository.getLorryStationPunchedPerDiv(zoneValue, date);
zoneDivisionsOnDate = zoneDivMasterRepository.getLorryStationZoneDivAsPerDate(zoneValue, date);
Collections.sort(zoneDivisionsOnDate);
zoneDivisions = zoneDivMasterRepository.getLorryStationZoneDivisions(zoneValue);
System.out.println("Divisions: "+zoneDivisions);
System.out.println("Divisionsas per Date: "+zoneDivisionsOnDate);
System.out.println("Enrolled: "+divEnrolled);
System.out.println("Punched: "+divPunched);
String divAbsent = null;
String divPercentage = null;
Integer j = 0;
List<Map<String, String>> listMap = new ArrayList<Map<String, String>>();
for (int i = 0; i <zoneDivisions.size(); i++) {
ArrayList<String> myListKey = new ArrayList<>();
ArrayList<String> myListValue = new ArrayList<>();
myListKey.add("Division"); myListValue.add(zoneDivisions.get(i));
myListKey.add("Enrolled"); myListValue.add(divEnrolled.get(i));
if (zoneDivisionsOnDate.contains(zoneDivisions.get(i)))
{
myListKey.add("Punched"); myListValue.add(divPunched.get(j));
Integer xDivAbsent = Integer.parseInt(divEnrolled.get(i)) - Integer.parseInt(divPunched.get(j));
Integer xdivPercentage = ((Integer.parseInt((divPunched.get(j))) *100)/ Integer.parseInt(divEnrolled.get(i)));
divAbsent = xDivAbsent.toString();
divPercentage = xdivPercentage.toString();
j++;
}
else
{
myListKey.add("Punched"); myListValue.add("0");
divAbsent = divEnrolled.get(i);
divPercentage = "0";
}
myListKey.add("Absent"); myListValue.add(divAbsent);
myListKey.add("Percentage"); myListValue.add(divPercentage);
Map<String, String> map = new LinkedHashMap<>();
for(int x=0;x<myListKey.size();x++)
{
map.put(myListKey.get(x), myListValue.get(x));
}
listMap.add(map);
divAbsent=null;
divPercentage=null;
}
return ResponseEntity.ok(listMap);
}
else if (officeType.equals("ZONAL")) {
System.out.println("for Zonal Office zone data Data");
Date date = null;
try {
date = new SimpleDateFormat("dd-MM-yyyy").parse(tempDate);
} catch (ParseException e) {
e.printStackTrace();
}
System.out.println(zoneValue);
System.out.println(officeType);
System.out.println(date);
ArrayList<String> zoneDivisions;
ArrayList<String> zoneDivisionsOnDate;
ArrayList<String> divEnrolled;
ArrayList<String> divPunched;
divPunched = zoneDivMasterRepository.getAllZonalOfficesPunchedOfAllZones(date);
zoneDivisionsOnDate = zoneDivMasterRepository.getAllZonalOfficesZoneAsPerDate(date);
// Collections.sort(zoneDivisionsOnDate);
zoneDivisions = zoneDivMasterRepository.getAllZonalOfficesZones();
System.out.println("Divisions: "+zoneDivisions);
System.out.println("Divisions as per Date: "+zoneDivisionsOnDate);
System.out.println("Punched: "+divPunched);
divEnrolled = zoneDivMasterRepository.getAllZonalOfficesEnrolledOfAllZones();
System.out.println("Enrolled: "+divEnrolled);
String divAbsent = null;
String divPercentage = null;
Integer j = 0;
List<Map<String, String>> listMap = new ArrayList<Map<String, String>>();
for (Integer i = 0; i <zoneDivisions.size(); i++) {
Integer n = 1+i;
ArrayList<String> myListKey = new ArrayList<>();
ArrayList<String> myListValue = new ArrayList<>();
myListKey.add("Division"); myListValue.add((n).toString());
myListKey.add("Enrolled"); myListValue.add(divEnrolled.get(i));
if (zoneDivisionsOnDate.contains(zoneDivisions.get(i)))
{
myListKey.add("Punched"); myListValue.add(divPunched.get(j));
Integer xDivAbsent = Integer.parseInt(divEnrolled.get(i)) - Integer.parseInt(divPunched.get(j));
Integer xdivPercentage = ((Integer.parseInt((divPunched.get(j))) *100)/ Integer.parseInt(divEnrolled.get(i)));
divAbsent = xDivAbsent.toString();
divPercentage = xdivPercentage.toString();
j++;
}
else
{
myListKey.add("Punched"); myListValue.add("0");
divAbsent = divEnrolled.get(i);
divPercentage = "0";
}
myListKey.add("Absent"); myListValue.add(divAbsent);
myListKey.add("Percentage"); myListValue.add(divPercentage);
Map<String, String> map = new LinkedHashMap<>();
for(int x=0;x<myListKey.size();x++)
{
map.put(myListKey.get(x), myListValue.get(x));
}
listMap.add(map);
divAbsent=null;
divPercentage=null;
}
return ResponseEntity.ok(listMap);
}
return null;
}
}

18
src/main/java/com/gcc/biometric/api/GccBioMetricApi/dao/CustomerDAO.java

@ -0,0 +1,18 @@
//package com.gcc.biometric.api.GccBioMetricApi.dao;
//
//import java.util.List;
//
//import com.gcc.biometric.api.GccBioMetricApi.entity.Customer;
//
//public interface CustomerDAO {
//
// public List<Customer> findAll();
//
// public Customer findById(int theId);
//
// public void save(Customer theCustomer);
//
// public void deleteById(int thId);
//
//
//}

71
src/main/java/com/gcc/biometric/api/GccBioMetricApi/dao/CustomerDAOImpl.java

@ -0,0 +1,71 @@
//package com.gcc.biometric.api.GccBioMetricApi.dao;
//
//import java.util.List;
//
//import javax.persistence.EntityManager;
//
//import org.hibernate.Session;
//import org.hibernate.query.Query;
//import org.springframework.stereotype.Repository;
//import com.gcc.biometric.api.GccBioMetricApi.entity.Customer;
//
//@Repository
//public class CustomerDAOImpl implements CustomerDAO {
//
// // define fields for entity manager
// private EntityManager entityManager;
//
// // set up constructor injection
// public CustomerDAOImpl(EntityManager theEntityManager) {
// entityManager = theEntityManager;
// }
//
// @Override
//// @Transactional //removing this @Transactional bcs we are gonna add a service to handle @Transactional
// public List<Customer> findAll() {
//
// // get the current hibernate session
// Session currentSession = entityManager.unwrap(Session.class);
// System.out.println("Session Created");
// // create a query
// Query<Customer> theQuery = currentSession.createQuery("from Customer", Customer.class);
// System.out.println("Reading Query");
// // execute query and get result
// List<Customer> customers = theQuery.getResultList();
// // return the result
// System.out.println("Returning query");
// return customers;
// }
//
// @Override
// public Customer findById(int theId) {
// // get the current hibernate session
// Session currentSession = entityManager.unwrap(Session.class);
// // get the employee
// Customer theCustomer = currentSession.get(Customer.class, theId);
// // return the employee
// return theCustomer;
// }
//
// @Override
// public void save(Customer theCustomer) {
// // get the current hibernate session
// Session currentSession = entityManager.unwrap(Session.class);
// // save customer
// currentSession.saveOrUpdate(theCustomer);
//
// }
//
// @Override
// public void deleteById(int theId) {
// // get the current hibernate session
// Session currentSession = entityManager.unwrap(Session.class);
//
// //delete object with primary key
// Query<Customer> theQuery = currentSession.createQuery("delete from Customer where id="+theId);
// //theQuery.setParameter("customerId", theId);
// theQuery.executeUpdate();
//
// }
//
//}

59
src/main/java/com/gcc/biometric/api/GccBioMetricApi/dao/CustomerDAOJpaImpl.java

@ -0,0 +1,59 @@
//package com.gcc.biometric.api.GccBioMetricApi.dao;
//
//import java.util.List;
//
//import javax.persistence.EntityManager;
//import javax.persistence.Query;
//
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Repository;
//
//import com.gcc.biometric.api.GccBioMetricApi.entity.Customer;
//
//
//@Repository
//public class CustomerDAOJpaImpl implements CustomerDAO {
//
// //define entity manager
// private EntityManager entityManager;
//
// // Constructor Injection
// @Autowired
// public CustomerDAOJpaImpl(EntityManager theEntityManager) {
// entityManager = theEntityManager;
// }
//
// @Override
// public List<Customer> findAll() {
// // create query
// Query theQuery = entityManager.createQuery("from Customer");
// // execute query and get the results
// List<Customer> customers = theQuery.getResultList();
// // return the results
// return customers;
// }
//
// @Override
// public Customer findById(int theId) {
// // create query
//
// // execute query and get the results
//
// // return the results
// return null;
// }
//
// @Override
// public void save(Customer theCustomer) {
// // TODO Auto-generated method stub
//
// }
//
// @Override
// public void deleteById(int thId) {
// // TODO Auto-generated method stub
//
// }
//
//
//}

12
src/main/java/com/gcc/biometric/api/GccBioMetricApi/dao/DeviceStatusDAO.java

@ -0,0 +1,12 @@
//package com.gcc.biometric.api.GccBioMetricApi.dao;
//
//import java.util.List;
//
//import com.gcc.biometric.api.GccBioMetricApi.entity.DeviceStatus;
//
//
//public interface DeviceStatusDAO {
//
// public List<DeviceStatus> getAllDevices();
//
//}

37
src/main/java/com/gcc/biometric/api/GccBioMetricApi/dao/DeviceStatusDAOImpl.java

@ -0,0 +1,37 @@
//package com.gcc.biometric.api.GccBioMetricApi.dao;
//
//import java.util.List;
//import javax.persistence.EntityManager;
//import org.hibernate.Session;
//import org.hibernate.query.Query;
//import org.springframework.stereotype.Repository;
//import com.gcc.biometric.api.GccBioMetricApi.entity.DeviceStatus;
//
//
//@Repository
//public class DeviceStatusDAOImpl implements DeviceStatusDAO {
//
// // define fields for entity manager
// private EntityManager entityManager;
//
// // set up constructor injection
// public DeviceStatusDAOImpl(EntityManager theEntityManager) {
// entityManager = theEntityManager;
// }
//
// @Override
// public List<DeviceStatus> getAllDevices() {
// // get the current hibernate session
// Session currentSession = entityManager.unwrap(Session.class);
// System.out.println("Session Created");
// // create a query
// Query<DeviceStatus> theQuery = currentSession.createQuery("from DeviceStatus", DeviceStatus.class);
// System.out.println("Reading Query");
// // execute query and get result
// List<DeviceStatus> deviceStatus = theQuery.getResultList();
// // return the result
// System.out.println("Returning query");
// return deviceStatus;
// }
//
//}

13
src/main/java/com/gcc/biometric/api/GccBioMetricApi/dao/EmployeeDAO.java

@ -0,0 +1,13 @@
//package com.gcc.biometric.api.GccBioMetricApi.dao;
//
//import java.util.List;
//
//import com.gcc.biometric.api.GccBioMetricApi.entity.Employee;
//
//public interface EmployeeDAO {
//
// public List<Employee> getAllEmployee();
//
// public Employee findEmpBySnn(String snn);
//
//}

59
src/main/java/com/gcc/biometric/api/GccBioMetricApi/dao/EmployeeDAOImpl.java

@ -0,0 +1,59 @@
//package com.gcc.biometric.api.GccBioMetricApi.dao;
//
//import java.util.List;
//
//import javax.persistence.EntityManager;
//
//import org.hibernate.Session;
//import org.hibernate.query.Query;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.jdbc.core.JdbcTemplate;
//import org.springframework.stereotype.Repository;
//
//import com.gcc.biometric.api.GccBioMetricApi.entity.DeviceStatus;
//import com.gcc.biometric.api.GccBioMetricApi.entity.Employee;
//
//@Repository
//public class EmployeeDAOImpl implements EmployeeDAO {
//
// // define fields for entity manager
// private EntityManager entityManager;
//
// @Autowired
// private JdbcTemplate jbbcTemplate;
//
// // set up constructor injection
// public EmployeeDAOImpl(EntityManager theEntityManager) {
// entityManager = theEntityManager;
// }
//
//
//
// @Override
// public List<Employee> getAllEmployee() {
// // get the current hibernate session
// Session currentSession = entityManager.unwrap(Session.class);
// System.out.println("Session Created");
// // create a query
// Query<Employee> theQuery = currentSession.createQuery("from Employee", Employee.class);
// System.out.println("Reading Query");
// // execute query and get result
// List<Employee> employees = theQuery.getResultList();
// // return the result
// System.out.println("Returning query");
// return employees;
// }
//
// @Override
// public Employee findEmpBySnn(String snn) {
// // get the current hibernate session
// Session currentSession = entityManager.unwrap(Session.class);
// // get the employee
// Employee theEmployee = currentSession.get(Employee.class, snn);
// // return the employee
// return theEmployee;
//
// }
//
//
//}

10
src/main/java/com/gcc/biometric/api/GccBioMetricApi/dao/MachineRawPunchDAO.java

@ -0,0 +1,10 @@
//package com.gcc.biometric.api.GccBioMetricApi.dao;
//
//import java.util.List;
//import com.gcc.biometric.api.GccBioMetricApi.entity.MachineRawPunch;
//
//public interface MachineRawPunchDAO {
//
// public List<MachineRawPunch> getAllRawPunch();
//
//}

36
src/main/java/com/gcc/biometric/api/GccBioMetricApi/dao/MachineRawPunchDAOImpl.java

@ -0,0 +1,36 @@
//package com.gcc.biometric.api.GccBioMetricApi.dao;
//
//import java.util.List;
//import javax.persistence.EntityManager;
//import org.hibernate.Session;
//import org.hibernate.query.Query;
//import org.springframework.stereotype.Repository;
//import com.gcc.biometric.api.GccBioMetricApi.entity.MachineRawPunch;
//
//@Repository
//public class MachineRawPunchDAOImpl implements MachineRawPunchDAO {
//
// // define fields for entity manager
// private EntityManager entityManager;
//
// // set up constructor injection
// public MachineRawPunchDAOImpl(EntityManager theEntityManager) {
// entityManager = theEntityManager;
// }
//
// @Override
// public List<MachineRawPunch> getAllRawPunch() {
// // get the current hibernate session
// Session currentSession = entityManager.unwrap(Session.class);
// System.out.println("Session Created");
// // create a query
// Query<MachineRawPunch> theQuery = currentSession.createQuery("from MachineRawPunch", MachineRawPunch.class);
// System.out.println("Reading Query");
// // execute query and get result
// List<MachineRawPunch> machineRawPunch = theQuery.getResultList();
// // return the result
// System.out.println("Returning query");
// return machineRawPunch;
// }
//
//}

11
src/main/java/com/gcc/biometric/api/GccBioMetricApi/dao/RealTimeUserInfoDAO.java

@ -0,0 +1,11 @@
//package com.gcc.biometric.api.GccBioMetricApi.dao;
//
//import java.util.List;
//
//import com.gcc.biometric.api.GccBioMetricApi.entity.RealTimeUserInfo;
//
//public interface RealTimeUserInfoDAO {
//
// public List<RealTimeUserInfo> getAllUserInfo();
//
//}

55
src/main/java/com/gcc/biometric/api/GccBioMetricApi/dao/RealTimeUserInfoDAOImpl.java

@ -0,0 +1,55 @@
//package com.gcc.biometric.api.GccBioMetricApi.dao;
//
//import java.util.List;
//import javax.persistence.EntityManager;
//import org.hibernate.Session;
//import org.hibernate.query.Query;
//import org.springframework.stereotype.Repository;
//
//import com.gcc.biometric.api.GccBioMetricApi.entity.Employee;
//import com.gcc.biometric.api.GccBioMetricApi.entity.RealTimeUserInfo;
//
//@Repository
//public class RealTimeUserInfoDAOImpl implements RealTimeUserInfoDAO {
//
// // define fields for entity manager
// private EntityManager entityManager;
//
// // set up constructor injection
// public RealTimeUserInfoDAOImpl(EntityManager theEntityManager) {
// entityManager = theEntityManager;
// }
//
// @Override
// public List<RealTimeUserInfo> getAllUserInfo() {
//
// // get the current hibernate session
// Session currentSession = entityManager.unwrap(Session.class);
// System.out.println("Session Created");
// // create a query
// Query<RealTimeUserInfo> theQuery = currentSession.createQuery("from RealTimeUserInfo", RealTimeUserInfo.class);
// System.out.println("Reading Query");
// // execute query and get result
// List<RealTimeUserInfo> realTimeUserInfo = theQuery.getResultList();
// // return the result
// System.out.println("Returning query");
// return realTimeUserInfo;
//
// }
//
//// @Override
//// public List<RealTimeUserInfo> getAllUserInfo() {
//// // get the current hibernate session
//// Session currentSession = entityManager.unwrap(Session.class);
//// System.out.println("Session Created");
//// // create a query
//// Query<RealTimeUserInfo> theQuery = currentSession.createQuery("from RealTimeUserInfo", RealTimeUserInfo.class);
//// System.out.println("Reading Query");
//// // execute query and get result
//// List<RealTimeUserInfo> employees = theQuery.getResultList();
//// // return the result
//// System.out.println("Returning query");
//// return employees;
//// }
//
//}

91
src/main/java/com/gcc/biometric/api/GccBioMetricApi/entity/Customer.java

@ -0,0 +1,91 @@
//package com.gcc.biometric.api.GccBioMetricApi.entity;
//
//import javax.persistence.Column;
//import javax.persistence.Entity;
//import javax.persistence.GeneratedValue;
//import javax.persistence.GenerationType;
//import javax.persistence.Id;
//import javax.persistence.Table;
//
//
//@Entity
////@Scope(value = "singleton")
//@Table(name="customers")
//public class Customer {
//
//
// //define fields
// @Id
// @GeneratedValue(strategy = GenerationType.IDENTITY)
// @Column(name="id")
// int id;
//
// @Column(name="first_name")
// String firstname;
//
// @Column(name="last_name")
// String lastname;
//
// @Column(name="email")
// String email;
//
//
// //define constrcutors
//
// public Customer(){}
//
//
// public Customer(int id, String firstname, String lastname, String email) {
// super();
// this.id = id;
// this.firstname = firstname;
// this.lastname = lastname;
// this.email = email;
// }
//
// public Customer(String firstname, String lastname, String email) {
// this.firstname = firstname;
// this.lastname = lastname;
// this.email = email;
// }
//
//
//
// //define getters and setters
// public int getId() {
// return id;
// }
//
// public void setId(int id) {
// this.id = id;
// }
// public String getFirstname() {
// return firstname;
// }
// public void setFirstname(String firstname) {
// this.firstname = firstname;
// }
// public String getLast_name() {
// return lastname;
// }
// public void setLast_name(String last_name) {
// this.lastname = last_name;
// }
// public String getEmail() {
// return email;
// }
// public void setEmail(String email) {
// this.email = email;
// }
//
// //define toString method
// @Override
// public String toString() {
// return "Customer [id=" + id + ", firstname=" + firstname + ", lastname=" + lastname + ", email=" + email
// + "]";
// }
//
//
//
//
//}

84
src/main/java/com/gcc/biometric/api/GccBioMetricApi/entity/DeviceStatus.java

@ -0,0 +1,84 @@
package com.gcc.biometric.api.GccBioMetricApi.entity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
@Entity
@Table(name = "tbl_fkdevice_status")
public class DeviceStatus {
// define fields
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "device_id")
String deviceId;
@Column(name = "device_name")
String deviceName;
/*
* // @Column(name="connected") // String connected; //
* // @Column(name="last_update_time") // String lastUpadteTime; //
* // @Column(name="last_update_fk_time") // String lastUpdateFkTime; //
* // @Column(name="device_info") // String deviceInfo; //
* // @Column(name="user_count") // String userCount; //
* // @Column(name="manager_count") // String managerCount; //
* // @Column(name="fp_count") // String fpCount; //
* // @Column(name="face_count") // String faceCount; //
* // @Column(name="password_count") // String passwordCount; //
* // @Column(name="idcard_count") // String idCardCount; //
* // @Column(name="total_log_count") // String totalLogCount; //
* // @Column(name="total_user_count") // String totalUserCount; //
* // @Column(name="IsMasterDevice") // String isMasterDevice; //
* // @Column(name="GroupID") // String groupId; // // @Column(name="IPAddrss")
* // String ipAddress;
*
* // @Column(name = "IsAUTHORIZED") // String isAuth;
*
* // @Column(name="TimeZone") // String timeZone;
*
* // @Column(name = "CompanyCode") // String companyCode; //
* // @Column(name="dev_model") // String devModel; //
* // @Column(name="dev_status_info") // String devStatusInfo;
*/
// Defining Constructors
public DeviceStatus() {
}
public DeviceStatus(String deviceId, String deviceName) {
super();
this.deviceId = deviceId;
this.deviceName = deviceName;
}
public String getDeviceId() {
return deviceId;
}
public void setDeviceId(String deviceId) {
this.deviceId = deviceId;
}
public String getDeviceName() {
return deviceName;
}
public void setDeviceName(String deviceName) {
this.deviceName = deviceName;
}
@Override
public String toString() {
return "DeviceStatus [deviceId=" + deviceId + ", deviceName=" + deviceName + "]";
}
}

214
src/main/java/com/gcc/biometric/api/GccBioMetricApi/entity/Employee.java

@ -0,0 +1,214 @@
package com.gcc.biometric.api.GccBioMetricApi.entity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
@Entity
@Table(name = "tblemployee")
public class Employee {
// Define fields
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "PAYCODE")
String payCode;
@Column(name = "SSN")
String ssn;
@Column(name = "ACTIVE")
Character active;
@Column(name = "EMPNAME")
String empName;
@Column(name = "DateOFBIRTH")
String dob;
@Column(name = "DateOFJOIN")
String doj;
@Column(name = "PRESENTCARDNO")
String presentCardNo;
@Column(name = "DESIGNATION")
String designation;
@Column(name = "DepartmentCODE")
String deptCode;
/*
* // // @Column(name = "COMPANYCODE") // String companyCode; // // @Column(name
* = "DivisionCODE") // String divisionCode; // // @Column(name = "CAT") //
* String cat; // // @Column(name = "ISMARRIED") // String isMarried; //
*
* // // @Column(name = "DepartmentCODE") // String deptCode; // // @Column(name
* = "GradeCODE") // String gradeCode; // // @Column(name = "BRANCHCODE") //
* String branchCode; // // @Column(name = "headid") // String headid; //
* // @Column(name = "Grade") // String grade; // // @Column(name = "GroupID")
* // String groupId;
*
* // @Column(name = "GUARDIANNAME") // String gaurdianName; // // @Column(name
* = "SEX") // String sex; // @Column(name = "BUS") // String bus;
* // @Column(name = "QUALIFICATION") // String qualification; // @Column(name =
* "EXPERIENCE") // String experience; // @Column(name="ADDRESS1") // String
* add1; // // @Column(name="PINCODE1") String pinCode1; //
* // @Column(name="TELEPHONE1") String telephone1; //
* // @Column(name="E_MAIL1") String email1; // // @Column(name="ADDRESS2")
* String add2; // // @Column(name="PINCODE2") String pinCode2; //
* // @Column(name="TELEPHONE2") String telephone2; //
* // @Column(name="BLOODGROUP") String bloodGroup; //
* // @Column(name="EMPPHOTO") String empPhoto; //
* // @Column(name="EMPSIGNATURE") String empSignature; // // //
* // @Column(name="Leavingdate") String leavingDate; //
* // @Column(name="LeavingReason") String leavingReason; //
* // @Column(name="VehicleNo") String vehicleNo; // // @Column(name="PFNO")
* String pfno; // // @Column(name="PF_NO") String pf_no; //
* // @Column(name="ESINO") String esino; //
* // @Column(name="AUTHORISEDMACHINE") String authMachine; //
* // @Column(name="EMPTYPE") String empType; // // @Column(name="bankACOUNT")
* String bankAcc; // // @Column(name="bankCODE") String bankCode; //
* // @Column(name="Reporting1") String reporting1; //
* // @Column(name="Reporting2") String reporting2; //
*
* // // @Column(name="DESPANSARYCODE") String despansaryCode; //
*
* // // @Column(name="Email_CC") String emailCC; //
* // @Column(name="LeaveApprovalStages") String leaveApprovalStage; //
* // @Column(name="IsFixedShift") String isFixedShift; //
* // @Column(name="involuntary") String involuntary; //
* // @Column(name="EmpBioData") String empBioData; //
* // @Column(name="dateofexp") String dateOfExp; // // @Column(name="Disable")
* String disable; // // @Column(name="Group_Index") String groupIndex; //
* // @Column(name="OnRoll") String onRoll; // // @Column(name="teamid") String
* teamId; // // @Column(name="PSCODE") String psCode; //
* // @Column(name="SUBAREACODE") String subAreaCode; //
* // @Column(name="SECTIONID") String sectionId; //
* // @Column(name="POSITIONCODE") String positionCode; //
* // @Column(name="trainer") String trainer; // // @Column(name="trainee")
* String trainee; // // @Column(name="TraineeLevel") String trainLvl; //
* // @Column(name="RockWellid") String rockWellId; //
* // @Column(name="Template_Send") String templateSend; //
*
* // // @Column(name="headid_2") String headid2; // // @Column(name="HOD_Codd")
* String hodCode; // // @Column(name="logid") String logId; //
* // @Column(name="GroupCode") String groupCode; //
* // @Column(name="ClassCODE") String classCode; //
* // @Column(name="ReligionCode") String religionCode; //
* // @Column(name="ValidityStartDate") String validateStartDate; //
* // @Column(name="ValidityEndDate") String validateEndtDate;
*
* // @Column(name="DeviceGROUPID") String deviceGroupId; //
* // @Column(name="ClientID") String clientId; //
*
* // @Column(name = "MachineCardNo") // String machineCardNo;
*/
// Defining Constructor
public Employee() {
}
public Employee(String ssn, Character active, String payCode, String empName, String dob, String doj,
String presentCardNo, String designation, String deptCode) {
super();
this.ssn = ssn;
this.active = active;
this.payCode = payCode;
this.empName = empName;
this.dob = dob;
this.doj = doj;
this.presentCardNo = presentCardNo;
this.designation = designation;
this.deptCode = deptCode;
}
public String getSsn() {
return ssn;
}
public void setSsn(String ssn) {
this.ssn = ssn;
}
public Character getActive() {
return active;
}
public void setActive(Character active) {
this.active = active;
}
public String getPayCode() {
return payCode;
}
public void setPayCode(String payCode) {
this.payCode = payCode;
}
public String getEmpName() {
return empName;
}
public void setEmpName(String empName) {
this.empName = empName;
}
public String getDob() {
return dob;
}
public void setDob(String dob) {
this.dob = dob;
}
public String getDoj() {
return doj;
}
public void setDoj(String doj) {
this.doj = doj;
}
public String getPresentCardNo() {
return presentCardNo;
}
public void setPresentCardNo(String presentCardNo) {
this.presentCardNo = presentCardNo;
}
public String getDesignation() {
return designation;
}
public void setDesignation(String designation) {
this.designation = designation;
}
public String getDeptCode() {
return deptCode;
}
public void setDeptCode(String deptCode) {
this.deptCode = deptCode;
}
@Override
public String toString() {
return "Employee [payCode=" + payCode + ", ssn=" + ssn + ", active=" + active + ", empName=" + empName
+ ", dob=" + dob + ", doj=" + doj + ", presentCardNo=" + presentCardNo + ", designation=" + designation
+ ", deptCode=" + deptCode + "]";
}
}

53
src/main/java/com/gcc/biometric/api/GccBioMetricApi/entity/HeadQuaterEntries.java

@ -0,0 +1,53 @@
package com.gcc.biometric.api.GccBioMetricApi.entity;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
@Entity
public class HeadQuaterEntries {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
public Integer zone_1;
public Integer enrolled_1;
public Integer punched_1;
public Integer absent_1;
public HeadQuaterEntries(Integer zone_1, Integer enrolled_1, Integer punched_1, Integer absent_1) {
super();
this.zone_1 = zone_1;
this.enrolled_1 = enrolled_1;
this.punched_1 = punched_1;
this.absent_1 = absent_1;
}
public Integer getZone_1() {
return zone_1;
}
public Integer getEnrolled_1() {
return enrolled_1;
}
public Integer getPunched_1() {
return punched_1;
}
public Integer getAbsent_1() {
return absent_1;
}
@Override
public String toString() {
return "HeadQuaterEntries [zone_1=" + zone_1 + ", enrolled_1=" + enrolled_1 + ", punched_1=" + punched_1
+ ", absent_1=" + absent_1 + "]";
}
}

113
src/main/java/com/gcc/biometric/api/GccBioMetricApi/entity/MachineRawPunchh.java

@ -0,0 +1,113 @@
package com.gcc.biometric.api.GccBioMetricApi.entity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
@Entity
@Table(name = "MachineRawPunch")
public class MachineRawPunchh {
// define fields
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "CARDNO")
String cardNo;
@Column(name = "OFFICEPUNCH")
String officePunch;
@Column(name = "PAYCODE")
String payCode;
@Column(name = "SSN")
String ssn;
@Column(name = "DeviceID")
String deviceId;
/*
* // @Column(name = "ISMANUAL") // String isManual;
* // @Column(name="ReasonCode") // String regionCode; // @Column(name =
* "MC_NO") // String mcNo; // @Column(name = "INOUT") // String inOut;
*
* //// @Column(name="Lcode") //// String lCode;
*
* // @Column(name="CompanyCode") // String companyCode;
*
* // @Column(name = "Temperature") // String temperature; //// @Column(name =
* "MaskStatus") //// String maskStatus; //// @Column(name="IsAbnomal") ////
* String isAbnormal;
*/
// Defining Constructor
public MachineRawPunchh() {
}
public MachineRawPunchh(String cardNo, String officePunch, String payCode, String ssn, String deviceId) {
super();
this.cardNo = cardNo;
this.officePunch = officePunch;
this.payCode = payCode;
this.ssn = ssn;
this.deviceId = deviceId;
}
public String getCardNo() {
return cardNo;
}
public void setCardNo(String cardNo) {
this.cardNo = cardNo;
}
public String getOfficePunch() {
return officePunch;
}
public void setOfficePunch(String officePunch) {
this.officePunch = officePunch;
}
public String getPayCode() {
return payCode;
}
public void setPayCode(String payCode) {
this.payCode = payCode;
}
public String getSsn() {
return ssn;
}
public void setSsn(String ssn) {
this.ssn = ssn;
}
public String getDeviceId() {
return deviceId;
}
public void setDeviceId(String deviceId) {
this.deviceId = deviceId;
}
@Override
public String toString() {
return "MachineRawPunch [cardNo=" + cardNo + ", officePunch=" + officePunch + ", payCode=" + payCode + ", ssn="
+ ssn + ", deviceId=" + deviceId + "]";
}
}

108
src/main/java/com/gcc/biometric/api/GccBioMetricApi/entity/RealTimeUserInfo.java

@ -0,0 +1,108 @@
package com.gcc.biometric.api.GccBioMetricApi.entity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
@Entity
@Table(name = "tbl_realtime_userinfo")
public class RealTimeUserInfo{
//define fields
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name="user_id")
String userId;
@Column(name="user_name")
String userName;
@Column(name="Device_ID")
String deviceId;
/*
* // @Column(name="privilige") // String privilige; // // @Column(name="card")
* // String card; // // @Column(name="Password") // String Password; //
* // @Column(name="Face") // String face; // // @Column(name="photo") // String
* photo; // // @Column(name="Fp_0") // String Fp_0; // // @Column(name="Fp_1")
* // String Fp_1; // // @Column(name="Fp_2") // String Fp_2; //
* // @Column(name="Fp_3") // String Fp_3; // // @Column(name="Fp_4") // String
* Fp_4; // // @Column(name="Fp_5") // String Fp_5; // // @Column(name="Fp_6")
* // String Fp_6; // // @Column(name="Fp_7") // String Fp_7; //
* // @Column(name="Fp_8") // String Fp_8; // // @Column(name="Fp_9") // String
* Fp_9;
*/
//defining constructor
public RealTimeUserInfo() {}
public RealTimeUserInfo(String userId, String userName, String deviceId) {
super();
this.userId = userId;
this.userName = userName;
this.deviceId = deviceId;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getDeviceId() {
return deviceId;
}
public void setDeviceId(String deviceId) {
this.deviceId = deviceId;
}
@Override
public String toString() {
return "RealTimeUserInfo [userId=" + userId + ", userName=" + userName + ", deviceId=" + deviceId + "]";
}
}

44
src/main/java/com/gcc/biometric/api/GccBioMetricApi/entity/ZoneDivMaster.java

@ -0,0 +1,44 @@
package com.gcc.biometric.api.GccBioMetricApi.entity;
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 com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Entity
@Table(name="zone_div_mast")
@NoArgsConstructor
@AllArgsConstructor
public class ZoneDivMaster {
@Column(name="zone")
@JsonIgnore
private Integer zone;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name="division")
private String division;
@Column(name="devname")
private String devname;
public static void main(String[] args) {
// HashMap<Integer,String> zones =new HashMap<>(Map.of(1,"zone_1"));
// zones.put(2,"");
}
}

37
src/main/java/com/gcc/biometric/api/GccBioMetricApi/exception/CustomizedResponseEntityExceptionHandler.java

@ -0,0 +1,37 @@
package com.gcc.biometric.api.GccBioMetricApi.exception;
import java.time.LocalDateTime;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.context.request.WebRequest;
import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler;
@ControllerAdvice
public class CustomizedResponseEntityExceptionHandler extends ResponseEntityExceptionHandler {
// This is for all exceptions
@ExceptionHandler(Exception.class)
public final ResponseEntity<ExceptionResponse> handleAllException(Exception ex, WebRequest request)
throws Exception {
ExceptionResponse errorDetails = new ExceptionResponse(LocalDateTime.now(), ex.getMessage(),
request.getDescription(false));
return new ResponseEntity<ExceptionResponse>(errorDetails, HttpStatus.INTERNAL_SERVER_ERROR);
}
// Only for UserNotFound
// In above method we replaced <Object> Response entity to ErrorDetail to remove
// warning
// @ExceptionHandler(UserNotFoundException.class)
// public final ResponseEntity<Object> handleUserNotFoundException(Exception ex, WebRequest request) throws Exception {
//
// ExceptionResponse errorDetails = new ExceptionResponse(LocalDateTime.now(), ex.getMessage(), request.getDescription(false));
//
// return new ResponseEntity(errorDetails, HttpStatus.NOT_FOUND);
// }
}

29
src/main/java/com/gcc/biometric/api/GccBioMetricApi/exception/ExceptionResponse.java

@ -0,0 +1,29 @@
package com.gcc.biometric.api.GccBioMetricApi.exception;
import java.time.LocalDateTime;
public class ExceptionResponse {
private LocalDateTime timestamp;
private String message;
private String details;
public ExceptionResponse(LocalDateTime timestamp, String message, String details) {
super();
this.timestamp = timestamp;
this.message = message;
this.details = details;
}
public LocalDateTime getTimestamp() {
return timestamp;
}
public String getMessage() {
return message;
}
public String getDetails() {
return details;
}
}

12
src/main/java/com/gcc/biometric/api/GccBioMetricApi/repo/CustomerRepository.java

@ -0,0 +1,12 @@
//package com.gcc.biometric.api.GccBioMetricApi.repo;
//
//import org.springframework.data.jpa.repository.JpaRepository;
//
//import com.gcc.biometric.api.GccBioMetricApi.entity.Customer;
//
//
//public interface CustomerRepository extends JpaRepository<Customer, String> {
//
//
//
//}

21
src/main/java/com/gcc/biometric/api/GccBioMetricApi/repo/DeptHQAbsenteesDataRepository.java

@ -0,0 +1,21 @@
package com.gcc.biometric.api.GccBioMetricApi.repo;
import org.springframework.data.jpa.repository.Query;
import java.util.ArrayList;
import java.util.Date;
import org.springframework.stereotype.Repository;
import com.gcc.biometric.api.GccBioMetricApi.entity.ZoneDivMaster;
import org.springframework.data.jpa.repository.JpaRepository;
@Repository
public interface DeptHQAbsenteesDataRepository extends JpaRepository<ZoneDivMaster, String>
{
@Query("select a.userId from RealTimeUserInfo a,DeviceStatus b, \r\nZoneDivMaster c , Employee d\r\nwhere a.deviceId=b.deviceId and c.devname=b.deviceName and d.payCode=a.userId\r\nand a.userId not in (select a.payCode from MachineRawPunchh a,DeviceStatus b,ZoneDivMaster c \r\nwhere cast(a.officePunch as date) =:date and \r\nc.devname=b.deviceName and a.deviceId=b.deviceId \r\nAND c.devname LIKE :dept AND c.division like '%HQ%')\r\nand c.division like '%HQ%' AND c.devname LIKE :dept \r\norder by c.zone,a.userId")
ArrayList<String> deptHQAbsenteesUserId(final String dept, final Date date);
@Query("select a.userName from RealTimeUserInfo a,DeviceStatus b, \r\nZoneDivMaster c , Employee d\r\nwhere a.deviceId=b.deviceId and c.devname=b.deviceName and d.payCode=a.userId\r\nand a.userId not in (select a.payCode from MachineRawPunchh a,DeviceStatus b,ZoneDivMaster c \r\nwhere cast(a.officePunch as date) =:date and \r\nc.devname=b.deviceName and a.deviceId=b.deviceId \r\nAND c.devname LIKE :dept AND c.division like '%HQ%')\r\nand c.division like '%HQ%' AND c.devname LIKE :dept \r\norder by c.zone,a.userId")
ArrayList<String> rdcAbsenteesUserName(final String dept, final Date date);
@Query("select d.designation from RealTimeUserInfo a,DeviceStatus b, \r\nZoneDivMaster c , Employee d\r\nwhere a.deviceId=b.deviceId and c.devname=b.deviceName and d.payCode=a.userId\r\nand a.userId not in (select a.payCode from MachineRawPunchh a,DeviceStatus b,ZoneDivMaster c \r\nwhere cast(a.officePunch as date) =:date and \r\nc.devname=b.deviceName and a.deviceId=b.deviceId \r\nAND c.devname LIKE :dept AND c.division like '%HQ%')\r\nand c.division like '%HQ%' AND c.devname LIKE :dept \r\norder by c.zone,a.userId")
ArrayList<String> rdcAbsenteesUserDesignation(final String dept, final Date date);
}

54
src/main/java/com/gcc/biometric/api/GccBioMetricApi/repo/DeptHeadQuaterOfficeRepository.java

@ -0,0 +1,54 @@
package com.gcc.biometric.api.GccBioMetricApi.repo;
import java.util.ArrayList;
import java.util.Date;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import com.gcc.biometric.api.GccBioMetricApi.entity.ZoneDivMaster;
@Repository
public interface DeptHeadQuaterOfficeRepository extends JpaRepository<ZoneDivMaster, String> {
// # # # # # # # # # # # # # # # # Department Office # # # # # # # # # # # # # # # # # # #
@Query(value="select count(a.userId) as Enrolled \r\n"
+ "from RealTimeUserInfo a, Employee c,\r\n"
+ " DeviceStatus b, ZoneDivMaster d \r\n"
+ "where a.deviceId=b.deviceId and a.userId <>1 and a.userId <> 2 and a.userId <> 3\r\n"
+ "and c.payCode=a.userId\r\n"
+ "and d.division like '%HQ%'\r\n"
+ "and d.devname=b.deviceName\r\n"
+ "group by d.division,d.devname")
public ArrayList<String> getHQDepartmentOfficeEnrolled();
@Query(value="select COUNT(distinct a.payCode) as punched\r\n"
+ "from MachineRawPunchh a , DeviceStatus b, ZoneDivMaster c where \r\n"
+ "c.devname=b.deviceName\r\n"
+ "and a.deviceId=b.deviceId \r\n"
+ "and c.division like '%HQ%'\r\n"
+ "and cast(a.officePunch as date) =:date\r\n"
+ "group by c.division,c.devname")
public ArrayList<String> getHQDepartmentOfficePunched(Date date);
@Query(value="select c.devname\r\n"
+ "from MachineRawPunchh a , DeviceStatus b, ZoneDivMaster c where \r\n"
+ "c.devname=b.deviceName\r\n"
+ "and a.deviceId=b.deviceId \r\n"
+ "and c.division like '%HQ%'\r\n"
+ "and cast(a.officePunch as date) =:date\r\n"
+ "group by c.division,c.devname")
public ArrayList<String> getHQDepartmentOfficesAsPerDate(Date date);
@Query(value="select distinct c.devname from ZoneDivMaster c where c.division like '%HQ%'")
public ArrayList<String> getAllHQDepartmentOffices();
// # # # # # # # # # # # # # # # # Department Office # # # # # # # # # # # # # # # # # # #
}

13
src/main/java/com/gcc/biometric/api/GccBioMetricApi/repo/DeviceStatusRepository.java

@ -0,0 +1,13 @@
package com.gcc.biometric.api.GccBioMetricApi.repo;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import com.gcc.biometric.api.GccBioMetricApi.entity.DeviceStatus;
@Repository
public interface DeviceStatusRepository extends JpaRepository<DeviceStatus, String> {
}

49
src/main/java/com/gcc/biometric/api/GccBioMetricApi/repo/EmployeeRepository.java

@ -0,0 +1,49 @@
package com.gcc.biometric.api.GccBioMetricApi.repo;
import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import com.gcc.biometric.api.GccBioMetricApi.entity.Employee;
@Repository
public interface EmployeeRepository extends JpaRepository<Employee, String> {
@Query(value="Select d.zone, count(*) as empCount\r\n"
+ "from RealTimeUserInfo a, DeviceStatus b,Employee c,ZoneDivMaster d\r\n"
+ "where a.deviceId=b.deviceId and a.userId <>1 and a.userId <> 2 and a.userId <> 3\r\n"
+ "AND a.userId=c.payCode and b.deviceName=d.devname AND a.userId not like '1100%' AND a.userId not like '1200%' \r\n"
+ "and d.division not like '%ZONE%'\r\n"
+ "group by d.zone order by d.zone")
List<String> getEmpCountPerZone();
@Query(value="SELECT e.zone , count(*) as punched\r\n"
+ "FROM Employee a , MachineRawPunchh b,DeviceStatus c, ZoneDivMaster e\r\n"
+ "where a.payCode = b.payCode\r\n"
+ "AND e.devname=c.deviceName\r\n"
+ "AND b.deviceId=c.deviceId\r\n"
+ "and cast(b.officePunch as date)='2022-10-26'\r\n"
+ "group by e.zone\r\n"
+ " order by e.zone")
public List<String> getEmpCountPresentAbsent();
}

249
src/main/java/com/gcc/biometric/api/GccBioMetricApi/repo/EnrolledEmpListDataRepository.java

@ -0,0 +1,249 @@
package com.gcc.biometric.api.GccBioMetricApi.repo;
import java.util.ArrayList;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import com.gcc.biometric.api.GccBioMetricApi.entity.ZoneDivMaster;
@Repository
public interface EnrolledEmpListDataRepository extends JpaRepository<ZoneDivMaster, String> {
// ----------------------Division office Enrolled-----------------------------------------
@Query(value="select a.userId\r\n" +
"from RealTimeUserInfo a, Employee c,\r\n" +
"DeviceStatus b, \r\n" +
"ZoneDivMaster d \r\n" +
"where a.deviceId=b.deviceId and a.userId <>1 and a.userId <> 2 and a.userId <> 3 \r\n" +
"AND a.deviceId=b.deviceId \r\n" +
"and c.payCode=a.userId\r\n" +
" and d.division=:divValue\r\n" +
"and d.devname like '%DIV%'\r\n" +
"and d.devname=b.deviceName\r\n" +
"order by a.userId")
public ArrayList<String> getEnrolledDivUserId(String divValue);
@Query(value="select a.userName\r\n" +
"from RealTimeUserInfo a, Employee c,\r\n" +
"DeviceStatus b, \r\n" +
"ZoneDivMaster d \r\n" +
"where a.deviceId=b.deviceId and a.userId <>1 and a.userId <> 2 and a.userId <> 3 \r\n" +
"AND a.deviceId=b.deviceId \r\n" +
"and c.payCode=a.userId\r\n" +
" and d.division=:divValue\r\n" +
"and d.devname like '%DIV%'\r\n" +
"and d.devname=b.deviceName\r\n" +
"order by a.userId")
public ArrayList<String> getEnrolledDivUserName(String divValue);
@Query(value="select c.designation\r\n" +
"from RealTimeUserInfo a, Employee c,\r\n" +
"DeviceStatus b, \r\n" +
"ZoneDivMaster d \r\n" +
"where a.deviceId=b.deviceId and a.userId <>1 and a.userId <> 2 and a.userId <> 3 \r\n" +
"AND a.deviceId=b.deviceId \r\n" +
"and c.payCode=a.userId\r\n" +
" and d.division=:divValue\r\n" +
"and d.devname like '%DIV%'\r\n" +
"and d.devname=b.deviceName\r\n" +
"order by a.userId")
public ArrayList<String> getEnrolledDivDesignation(String divValue);
//
//
//
//// ----------------------Unit Office Enrolled-----------------------------------------
@Query(value="select a.userId\r\n" +
"from RealTimeUserInfo a, Employee c,\r\n" +
"DeviceStatus b, \r\n" +
"ZoneDivMaster d \r\n" +
"where a.deviceId=b.deviceId and a.userId <>1 and a.userId <> 2 and a.userId <> 3\r\n" +
"and c.payCode=a.userId\r\n" +
"and d.division like '%UNIT%'\r\n" +
"AND d.division=:unitValue\r\n" +
"and d.devname=b.deviceName\r\n" +
"order by a.userId")
public ArrayList<String> getEnrolledUnitUserId(String unitValue);
@Query(value="select a.userName\r\n" +
"from RealTimeUserInfo a, Employee c,\r\n" +
"DeviceStatus b, \r\n" +
"ZoneDivMaster d \r\n" +
"where a.deviceId=b.deviceId and a.userId <>1 and a.userId <> 2 and a.userId <> 3\r\n" +
"and c.payCode=a.userId\r\n" +
"and d.division like '%UNIT%'\r\n" +
"AND d.division=:unitValue\r\n" +
"and d.devname=b.deviceName\r\n" +
"order by a.userId")
public ArrayList<String> getEnrolledUnitUserName(String unitValue);
@Query(value="select c.designation\r\n" +
"from RealTimeUserInfo a, Employee c,\r\n" +
"DeviceStatus b, \r\n" +
"ZoneDivMaster d \r\n" +
"where a.deviceId=b.deviceId and a.userId <>1 and a.userId <> 2 and a.userId <> 3\r\n" +
"and c.payCode=a.userId\r\n" +
"and d.division like '%UNIT%'\r\n" +
"AND d.division=:unitValue\r\n" +
"and d.devname=b.deviceName\r\n" +
"order by a.userId")
public ArrayList<String> getEnrolledUnitDesignation(String unitValue);
//// ----------------------Lorry Office Enrolled-----------------------------------------
@Query(value="select a.userId\r\n" +
"from RealTimeUserInfo a, Employee c,\r\n" +
" DeviceStatus b, \r\n" +
"ZoneDivMaster d \r\n" +
"where a.deviceId=b.deviceId and a.userId <>1 and a.userId <> 2 and a.userId <> 3\r\n" +
" and c.payCode=a.userId\r\n" +
"and d.zone=:zoneValue\r\n" +
"and d.devname like '%LORRY%'\r\n" +
"and d.devname=b.deviceName\r\n" +
"order by a.userId")
public ArrayList<String> getEnrolledLorryUserId(Integer zoneValue);
@Query(value="select a.userName\r\n" +
"from RealTimeUserInfo a, Employee c,\r\n" +
" DeviceStatus b, \r\n" +
"ZoneDivMaster d \r\n" +
"where a.deviceId=b.deviceId and a.userId <>1 and a.userId <> 2 and a.userId <> 3\r\n" +
" and c.payCode=a.userId\r\n" +
"and d.zone=:zoneValue\r\n" +
"and d.devname like '%LORRY%'\r\n" +
"and d.devname=b.deviceName\r\n" +
"order by a.userId")
public ArrayList<String> getEnrolledLorryUserName(Integer zoneValue);
@Query(value="select c.designation\r\n" +
"from RealTimeUserInfo a, Employee c,\r\n" +
" DeviceStatus b, \r\n" +
"ZoneDivMaster d \r\n" +
"where a.deviceId=b.deviceId and a.userId <>1 and a.userId <> 2 and a.userId <> 3\r\n" +
" and c.payCode=a.userId\r\n" +
"and d.zone=:zoneValue\r\n" +
"and d.devname like '%LORRY%'\r\n" +
"and d.devname=b.deviceName\r\n" +
"order by a.userId")
public ArrayList<String> getEnrolledLorryDesignation(Integer zoneValue);
//// ----------------------Zonal Office Enrolled-----------------------------------------
@Query(value="select a.userId \r\n" +
"from RealTimeUserInfo a, Employee c,\r\n" +
"DeviceStatus b, \r\n" +
"ZoneDivMaster d \r\n" +
"where a.deviceId=b.deviceId and a.userId <>1 and a.userId <> 2 and a.userId <> 3\r\n" +
"and d.division like '%ZONAL%'\r\n" +
"AND a.deviceId=b.deviceId\r\n" +
"and d.zone =:zonaValue\r\n" +
"and c.payCode=a.userId\r\n" +
"and d.devname=b.deviceName")
public ArrayList<String> getEnrolledZonalUserId(Integer zonaValue);
@Query(value="select a.userName \r\n" +
"from RealTimeUserInfo a, Employee c,\r\n" +
"DeviceStatus b, \r\n" +
"ZoneDivMaster d \r\n" +
"where a.deviceId=b.deviceId and a.userId <>1 and a.userId <> 2 and a.userId <> 3\r\n" +
"and d.division like '%ZONAL%'\r\n" +
"AND a.deviceId=b.deviceId\r\n" +
"and d.zone =:zonaValue\r\n" +
"and c.payCode=a.userId\r\n" +
"and d.devname=b.deviceName")
public ArrayList<String> getEnrolledZonalUserName(Integer zonaValue);
@Query(value="select c.designation \r\n" +
"from RealTimeUserInfo a, Employee c,\r\n" +
"DeviceStatus b, \r\n" +
"ZoneDivMaster d \r\n" +
"where a.deviceId=b.deviceId and a.userId <>1 and a.userId <> 2 and a.userId <> 3\r\n" +
"and d.division like '%ZONAL%'\r\n" +
"AND a.deviceId=b.deviceId\r\n" +
"and d.zone =:zonaValue\r\n" +
"and c.payCode=a.userId\r\n" +
"and d.devname=b.deviceName")
public ArrayList<String> getEnrolledZonalDesignation(Integer zonaValue);
//// ----------------------Department Office Enrolled-----------------------------------------
@Query(value="select a.userId\r\n" +
"from RealTimeUserInfo a, Employee c,\r\n" +
"DeviceStatus b, \r\n" +
"ZoneDivMaster d \r\n" +
"where a.deviceId=b.deviceId and a.userId <>1 and a.userId <> 2 and a.userId <> 3\r\n" +
"and c.payCode=a.userId\r\n" +
"and d.division like '%HQ%'\r\n" +
"and d.devname=:deptValue\r\n" +
"and d.devname=b.deviceName\r\n" +
"order by a.userId")
public ArrayList<String> getEnrolledDeptUserId(String deptValue);
@Query(value="select a.userName\r\n" +
"from RealTimeUserInfo a, Employee c,\r\n" +
"DeviceStatus b, \r\n" +
"ZoneDivMaster d \r\n" +
"where a.deviceId=b.deviceId and a.userId <>1 and a.userId <> 2 and a.userId <> 3\r\n" +
"and c.payCode=a.userId\r\n" +
"and d.division like '%HQ%'\r\n" +
"and d.devname=:deptValue\r\n" +
"and d.devname=b.deviceName\r\n" +
"order by a.userId")
public ArrayList<String> getEnrolledDeptUserName(String deptValue);
@Query(value="select c.designation\r\n" +
"from RealTimeUserInfo a, Employee c,\r\n" +
"DeviceStatus b, \r\n" +
"ZoneDivMaster d \r\n" +
"where a.deviceId=b.deviceId and a.userId <>1 and a.userId <> 2 and a.userId <> 3\r\n" +
"and c.payCode=a.userId\r\n" +
"and d.division like '%HQ%'\r\n" +
"and d.devname=:deptValue\r\n" +
"and d.devname=b.deviceName\r\n" +
"order by a.userId")
public ArrayList<String> getEnrolledDeptDesignation(String deptValue);
//// ----------------------RDC Office Enrolled-----------------------------------------
@Query(value="select a.userId\r\n" +
"from RealTimeUserInfo a, Employee c,\r\n" +
"DeviceStatus b, \r\n" +
"ZoneDivMaster d \r\n" +
"where a.deviceId=b.deviceId and a.userId <>1 and a.userId <> 2 and a.userId <> 3\r\n" +
"and c.payCode=a.userId\r\n" +
"and d.zone=:zoneValue\r\n" +
"and d.division like '%RDC%'\r\n" +
"and d.devname=b.deviceName\r\n" +
"order by d.division")
public ArrayList<String> getEnrolledRDCUserId(Integer zoneValue);
@Query(value="select a.userName\r\n" +
"from RealTimeUserInfo a, Employee c,\r\n" +
"DeviceStatus b, \r\n" +
"ZoneDivMaster d \r\n" +
"where a.deviceId=b.deviceId and a.userId <>1 and a.userId <> 2 and a.userId <> 3\r\n" +
"and c.payCode=a.userId\r\n" +
"and d.zone=:zoneValue\r\n" +
"and d.division like '%RDC%'\r\n" +
"and d.devname=b.deviceName\r\n" +
"order by d.division")
public ArrayList<String> getEnrolledRDCUserName(Integer zoneValue);
@Query(value="select c.designation\r\n" +
"from RealTimeUserInfo a, Employee c,\r\n" +
"DeviceStatus b, \r\n" +
"ZoneDivMaster d \r\n" +
"where a.deviceId=b.deviceId and a.userId <>1 and a.userId <> 2 and a.userId <> 3\r\n" +
"and c.payCode=a.userId\r\n" +
"and d.zone=:zoneValue\r\n" +
"and d.division like '%RDC%'\r\n" +
"and d.devname=b.deviceName\r\n" +
"order by d.division")
public ArrayList<String> getEnrolledRDCDesignation(Integer zoneValue);
}

324
src/main/java/com/gcc/biometric/api/GccBioMetricApi/repo/HeadQuaterEntriesRepository.java

@ -0,0 +1,324 @@
package com.gcc.biometric.api.GccBioMetricApi.repo;
import java.util.ArrayList;
import java.util.Date;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import com.gcc.biometric.api.GccBioMetricApi.entity.HeadQuaterEntries;
public interface HeadQuaterEntriesRepository extends JpaRepository<HeadQuaterEntries, Integer> {
@Query("select count(a.userId)\r\n"
+ "from RealTimeUserInfo a, Employee c,\r\n"
+ " DeviceStatus b, ZoneDivMaster d \r\n"
+ "where a.deviceId=b.deviceId and a.userId <>1 and a.userId <> 2 and a.userId <> 3\r\n"
+ "AND a.deviceId=b.deviceId\r\n"
+ "and c.payCode=a.userId\r\n"
+ "and d.devname=b.deviceName\r\n"
+ "group by d.zone")
ArrayList<Integer> getEnrolled();
@Query("select count(distinct a.payCode)\r\n"
+ "from MachineRawPunchh a , DeviceStatus b, ZoneDivMaster c where c.devname=b.deviceName\r\n"
+ "and a.deviceId=b.deviceId \r\n"
+ "and cast(a.officePunch as date) =?1\r\n"
+ "group by c.zone")
ArrayList<Integer> getPunched(Date date);
// ========================================================================================
// @Query("select count(a.userId)\r\n"
// + "from RealTimeUserInfo a, Employee c,\r\n"
// + " DeviceStatus b, ZoneDivMaster d \r\n"
// + "where a.deviceId=b.deviceId and a.userId <>1 and a.userId <> 2 and a.userId <> 3\r\n"
// + "AND a.deviceId=b.deviceId\r\n"
// + "and d.zone=1\r\n"
// + "and c.payCode=a.userId\r\n"
// + "and d.devname=b.deviceName")
// String getEnroll_ZONE_1();
//
// @Query("select count(distinct a.payCode)\r\n"
// + "from MachineRawPunch a , DeviceStatus b, ZoneDivMaster c where c.devname=b.deviceName\r\n"
// + "AND c.zone=1\r\n"
// + "and a.deviceId=b.deviceId \r\n"
// + "and cast(a.officePunch as date) ='2022-10-21'")
// String getPunched_1();
//
//
//
// @Query("select count(a.userId)\r\n"
// + "from RealTimeUserInfo a, Employee c,\r\n"
// + " DeviceStatus b, ZoneDivMaster d \r\n"
// + "where a.deviceId=b.deviceId and a.userId <>1 and a.userId <> 2 and a.userId <> 3\r\n"
// + "AND a.deviceId=b.deviceId\r\n"
// + "and d.zone=2\r\n"
// + "and c.payCode=a.userId\r\n"
// + "and d.devname=b.deviceName")
// String getEnroll_ZONE_2();
//
// @Query("select count(distinct a.payCode)\r\n"
// + "from MachineRawPunch a , DeviceStatus b, ZoneDivMaster c where c.devname=b.deviceName\r\n"
// + "AND c.zone=2\r\n"
// + "and a.deviceId=b.deviceId \r\n"
// + "and cast(a.officePunch as date) ='2022-10-21'")
// String getPunched_2();
//
// @Query("select count(a.userId)\r\n"
// + "from RealTimeUserInfo a, Employee c,\r\n"
// + " DeviceStatus b, ZoneDivMaster d \r\n"
// + "where a.deviceId=b.deviceId and a.userId <>1 and a.userId <> 2 and a.userId <> 3\r\n"
// + "AND a.deviceId=b.deviceId\r\n"
// + "and d.zone=3\r\n"
// + "and c.payCode=a.userId\r\n"
// + "and d.devname=b.deviceName")
// String getEnroll_ZONE_3();
//
// @Query("select count(distinct a.payCode)\r\n"
// + "from MachineRawPunch a , DeviceStatus b, ZoneDivMaster c where c.devname=b.deviceName\r\n"
// + "AND c.zone=3\r\n"
// + "and a.deviceId=b.deviceId \r\n"
// + "and cast(a.officePunch as date) ='2022-10-21'")
// String getPunched_3();
//
// @Query("select count(a.userId)\r\n"
// + "from RealTimeUserInfo a, Employee c,\r\n"
// + " DeviceStatus b, ZoneDivMaster d \r\n"
// + "where a.deviceId=b.deviceId and a.userId <>1 and a.userId <> 2 and a.userId <> 3\r\n"
// + "AND a.deviceId=b.deviceId\r\n"
// + "and d.zone=4\r\n"
// + "and c.payCode=a.userId\r\n"
// + "and d.devname=b.deviceName")
// String getEnroll_ZONE_4();
//
// @Query("select count(distinct a.payCode)\r\n"
// + "from MachineRawPunch a , DeviceStatus b, ZoneDivMaster c where c.devname=b.deviceName\r\n"
// + "AND c.zone=4\r\n"
// + "and a.deviceId=b.deviceId \r\n"
// + "and cast(a.officePunch as date) ='2022-10-21'")
// String getPunched_4();
//
// @Query("select count(a.userId)\r\n"
// + "from RealTimeUserInfo a, Employee c,\r\n"
// + " DeviceStatus b, ZoneDivMaster d \r\n"
// + "where a.deviceId=b.deviceId and a.userId <>1 and a.userId <> 2 and a.userId <> 3\r\n"
// + "AND a.deviceId=b.deviceId\r\n"
// + "and d.zone=5\r\n"
// + "and c.payCode=a.userId\r\n"
// + "and d.devname=b.deviceName")
// String getEnroll_ZONE_5();
//
// @Query("select count(distinct a.payCode)\r\n"
// + "from MachineRawPunch a , DeviceStatus b, ZoneDivMaster c where c.devname=b.deviceName\r\n"
// + "AND c.zone=5\r\n"
// + "and a.deviceId=b.deviceId \r\n"
// + "and cast(a.officePunch as date) ='2022-10-21'")
// String getPunched_5();
//
// @Query("select count(a.userId)\r\n"
// + "from RealTimeUserInfo a, Employee c,\r\n"
// + " DeviceStatus b, ZoneDivMaster d \r\n"
// + "where a.deviceId=b.deviceId and a.userId <>1 and a.userId <> 2 and a.userId <> 3\r\n"
// + "AND a.deviceId=b.deviceId\r\n"
// + "and d.zone=6\r\n"
// + "and c.payCode=a.userId\r\n"
// + "and d.devname=b.deviceName")
// String getEnroll_ZONE_6();
//
// @Query("select count(distinct a.payCode)\r\n"
// + "from MachineRawPunch a , DeviceStatus b, ZoneDivMaster c where c.devname=b.deviceName\r\n"
// + "AND c.zone=6\r\n"
// + "and a.deviceId=b.deviceId \r\n"
// + "and cast(a.officePunch as date) ='2022-10-21'")
// String getPunched_6();
//
// @Query("select count(a.userId)\r\n"
// + "from RealTimeUserInfo a, Employee c,\r\n"
// + " DeviceStatus b, ZoneDivMaster d \r\n"
// + "where a.deviceId=b.deviceId and a.userId <>1 and a.userId <> 2 and a.userId <> 3\r\n"
// + "AND a.deviceId=b.deviceId\r\n"
// + "and d.zone=7\r\n"
// + "and c.payCode=a.userId\r\n"
// + "and d.devname=b.deviceName")
// String getEnroll_ZONE_7();
//
// @Query("select count(distinct a.payCode)\r\n"
// + "from MachineRawPunch a , DeviceStatus b, ZoneDivMaster c where c.devname=b.deviceName\r\n"
// + "AND c.zone=7\r\n"
// + "and a.deviceId=b.deviceId \r\n"
// + "and cast(a.officePunch as date) ='2022-10-21'")
// String getPunched_7();
//
// @Query("select count(a.userId)\r\n"
// + "from RealTimeUserInfo a, Employee c,\r\n"
// + " DeviceStatus b, ZoneDivMaster d \r\n"
// + "where a.deviceId=b.deviceId and a.userId <>1 and a.userId <> 2 and a.userId <> 3\r\n"
// + "AND a.deviceId=b.deviceId\r\n"
// + "and d.zone=8\r\n"
// + "and c.payCode=a.userId\r\n"
// + "and d.devname=b.deviceName")
// String getEnroll_ZONE_8();
//
// @Query("select count(distinct a.payCode)\r\n"
// + "from MachineRawPunch a , DeviceStatus b, ZoneDivMaster c where c.devname=b.deviceName\r\n"
// + "AND c.zone=8\r\n"
// + "and a.deviceId=b.deviceId \r\n"
// + "and cast(a.officePunch as date) ='2022-10-21'")
// String getPunched_8();
//
// @Query("select count(a.userId)\r\n"
// + "from RealTimeUserInfo a, Employee c,\r\n"
// + " DeviceStatus b, ZoneDivMaster d \r\n"
// + "where a.deviceId=b.deviceId and a.userId <>1 and a.userId <> 2 and a.userId <> 3\r\n"
// + "AND a.deviceId=b.deviceId\r\n"
// + "and d.zone=9\r\n"
// + "and c.payCode=a.userId\r\n"
// + "and d.devname=b.deviceName")
// String getEnroll_ZONE_9();
//
// @Query("select count(distinct a.payCode)\r\n"
// + "from MachineRawPunch a , DeviceStatus b, ZoneDivMaster c where c.devname=b.deviceName\r\n"
// + "AND c.zone=9\r\n"
// + "and a.deviceId=b.deviceId \r\n"
// + "and cast(a.officePunch as date) ='2022-10-21'")
// String getPunched_9();
//
// @Query("select count(a.userId)\r\n"
// + "from RealTimeUserInfo a, Employee c,\r\n"
// + " DeviceStatus b, ZoneDivMaster d \r\n"
// + "where a.deviceId=b.deviceId and a.userId <>1 and a.userId <> 2 and a.userId <> 3\r\n"
// + "AND a.deviceId=b.deviceId\r\n"
// + "and d.zone=10\r\n"
// + "and c.payCode=a.userId\r\n"
// + "and d.devname=b.deviceName")
// String getEnroll_ZONE_10();
//
// @Query("select count(distinct a.payCode)\r\n"
// + "from MachineRawPunch a , DeviceStatus b, ZoneDivMaster c where c.devname=b.deviceName\r\n"
// + "AND c.zone=10\r\n"
// + "and a.deviceId=b.deviceId \r\n"
// + "and cast(a.officePunch as date) ='2022-10-21'")
// String getPunched_10();
//
// @Query("select count(a.userId)\r\n"
// + "from RealTimeUserInfo a, Employee c,\r\n"
// + " DeviceStatus b, ZoneDivMaster d \r\n"
// + "where a.deviceId=b.deviceId and a.userId <>1 and a.userId <> 2 and a.userId <> 3\r\n"
// + "AND a.deviceId=b.deviceId\r\n"
// + "and d.zone=11\r\n"
// + "and c.payCode=a.userId\r\n"
// + "and d.devname=b.deviceName")
// String getEnroll_ZONE_11();
//
// @Query("select count(distinct a.payCode)\r\n"
// + "from MachineRawPunch a , DeviceStatus b, ZoneDivMaster c where c.devname=b.deviceName\r\n"
// + "AND c.zone=11\r\n"
// + "and a.deviceId=b.deviceId \r\n"
// + "and cast(a.officePunch as date) ='2022-10-21'")
// String getPunched_11();
//
// @Query("select count(a.userId)\r\n"
// + "from RealTimeUserInfo a, Employee c,\r\n"
// + " DeviceStatus b, ZoneDivMaster d \r\n"
// + "where a.deviceId=b.deviceId and a.userId <>1 and a.userId <> 2 and a.userId <> 3\r\n"
// + "AND a.deviceId=b.deviceId\r\n"
// + "and d.zone=12\r\n"
// + "and c.payCode=a.userId\r\n"
// + "and d.devname=b.deviceName")
// String getEnroll_ZONE_12();
//
// @Query("select count(distinct a.payCode)\r\n"
// + "from MachineRawPunch a , DeviceStatus b, ZoneDivMaster c where c.devname=b.deviceName\r\n"
// + "AND c.zone=12\r\n"
// + "and a.deviceId=b.deviceId \r\n"
// + "and cast(a.officePunch as date) ='2022-10-21'")
// String getPunched_12();
//
// @Query("select count(a.userId)\r\n"
// + "from RealTimeUserInfo a, Employee c,\r\n"
// + " DeviceStatus b, ZoneDivMaster d \r\n"
// + "where a.deviceId=b.deviceId and a.userId <>1 and a.userId <> 2 and a.userId <> 3\r\n"
// + "AND a.deviceId=b.deviceId\r\n"
// + "and d.zone=13\r\n"
// + "and c.payCode=a.userId\r\n"
// + "and d.devname=b.deviceName")
// String getEnroll_ZONE_13();
//
// @Query("select count(distinct a.payCode)\r\n"
// + "from MachineRawPunch a , DeviceStatus b, ZoneDivMaster c where c.devname=b.deviceName\r\n"
// + "AND c.zone=13\r\n"
// + "and a.deviceId=b.deviceId \r\n"
// + "and cast(a.officePunch as date) ='2022-10-21'")
// String getPunched_13();
//
// @Query("select count(a.userId)\r\n"
// + "from RealTimeUserInfo a, Employee c,\r\n"
// + " DeviceStatus b, ZoneDivMaster d \r\n"
// + "where a.deviceId=b.deviceId and a.userId <>1 and a.userId <> 2 and a.userId <> 3\r\n"
// + "AND a.deviceId=b.deviceId\r\n"
// + "and d.zone=14\r\n"
// + "and c.payCode=a.userId\r\n"
// + "and d.devname=b.deviceName")
// String getEnroll_ZONE_14();
//
// @Query("select count(distinct a.payCode)\r\n"
// + "from MachineRawPunch a , DeviceStatus b, ZoneDivMaster c where c.devname=b.deviceName\r\n"
// + "AND c.zone=14\r\n"
// + "and a.deviceId=b.deviceId \r\n"
// + "and cast(a.officePunch as date) ='2022-10-21'")
// String getPunched_14();
//
// @Query("select count(a.userId)\r\n"
// + "from RealTimeUserInfo a, Employee c,\r\n"
// + " DeviceStatus b, ZoneDivMaster d \r\n"
// + "where a.deviceId=b.deviceId and a.userId <>1 and a.userId <> 2 and a.userId <> 3\r\n"
// + "AND a.deviceId=b.deviceId\r\n"
// + "and d.zone=15\r\n"
// + "and c.payCode=a.userId\r\n"
// + "and d.devname=b.deviceName")
// String getEnroll_ZONE_15();
//
// @Query("select count(distinct a.payCode)\r\n"
// + "from MachineRawPunch a , DeviceStatus b, ZoneDivMaster c where c.devname=b.deviceName\r\n"
// + "AND c.zone=15\r\n"
// + "and a.deviceId=b.deviceId \r\n"
// + "and cast(a.officePunch as date) ='2022-10-21'")
// String getPunched_15();
//
// @Query("select count(a.userId)\r\n"
// + "from RealTimeUserInfo a, Employee c,\r\n"
// + " DeviceStatus b, ZoneDivMaster d \r\n"
// + "where a.deviceId=b.deviceId and a.userId <>1 and a.userId <> 2 and a.userId <> 3\r\n"
// + "AND a.deviceId=b.deviceId\r\n"
// + "and d.zone=16\r\n"
// + "and c.payCode=a.userId\r\n"
// + "and d.devname=b.deviceName")
// String getEnroll_ZONE_16();
//
// @Query("select count(distinct a.payCode)\r\n"
// + "from MachineRawPunch a , DeviceStatus b, ZoneDivMaster c where c.devname=b.deviceName\r\n"
// + "AND c.zone=16\r\n"
// + "and a.deviceId=b.deviceId \r\n"
// + "and cast(a.officePunch as date) ='2022-10-21'")
// String getPunched_16();
//
}

12
src/main/java/com/gcc/biometric/api/GccBioMetricApi/repo/MachineRawPunchRepository.java

@ -0,0 +1,12 @@
package com.gcc.biometric.api.GccBioMetricApi.repo;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import com.gcc.biometric.api.GccBioMetricApi.entity.MachineRawPunchh;
@Repository
public interface MachineRawPunchRepository extends JpaRepository<MachineRawPunchh, String> {
}

140
src/main/java/com/gcc/biometric/api/GccBioMetricApi/repo/PunchedEmpListDataRepository.java

@ -0,0 +1,140 @@
package com.gcc.biometric.api.GccBioMetricApi.repo;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashSet;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import com.gcc.biometric.api.GccBioMetricApi.entity.ZoneDivMaster;
@Repository
public interface PunchedEmpListDataRepository extends JpaRepository<ZoneDivMaster, String> {
// ----------------------Division office Enrolled-----------------------------------------
@Query(value="select distinct a.payCode\r\n" +
"from MachineRawPunchh a , DeviceStatus b, ZoneDivMaster c,\r\n" +
"Employee d where \r\n" +
"d.payCode=a.payCode and\r\n" +
"c.devname=b.deviceName\r\n" +
"and a.deviceId=b.deviceId \r\n" +
"AND c.division=:divValue\r\n" +
"and c.devname like '%DIV%'\r\n" +
"and cast(a.officePunch as date) =:date\r\n" +
"order by a.payCode asc")
public ArrayList<String> getPunchedDivUserId(String divValue, Date date);
@Query(value="select d.empName from Employee d where d.payCode=:userId")
public String getPunchedDivUserName(String userId);
@Query(value="select d.designation from Employee d where d.payCode=:userId")
public String getPunchedDivDesignation(String userId);
// ----------------------Unit Office Enrolled-----------------------------------------
@Query(value="select distinct a.payCode\r\n" +
"from MachineRawPunchh a, DeviceStatus b, ZoneDivMaster c,\r\n" +
"Employee d\r\n" +
"where a.payCode=d.payCode\r\n" +
"and c.devname=b.deviceName\r\n" +
"and a.deviceId=b.deviceId \r\n" +
"and c.division=:divValue\r\n" +
"and cast(a.officePunch as date) =:date\r\n" +
"order by a.payCode asc")
public ArrayList<String> getPunchedUnitUserId(String divValue, Date date);
@Query(value="select d.empName from Employee d where d.payCode=:userId")
public String getPunchedUnitUserName(String userId);
@Query(value="select d.designation from Employee d where d.payCode=:userId")
public String getPunchedUnitDesignation(String userId);
// ----------------------Lorry Office Enrolled-----------------------------------------
@Query(value="select distinct a.payCode\r\n" +
"from MachineRawPunchh a , DeviceStatus b, ZoneDivMaster c,\r\n" +
"Employee d\r\n" +
"where \r\n" +
"d.payCode=a.payCode and\r\n" +
"c.devname=b.deviceName\r\n" +
"and a.deviceId=b.deviceId \r\n" +
"AND c.zone=:divValue\r\n" +
"and c.devname like '%LORRY%'\r\n" +
"and cast(a.officePunch as date) =:date\r\n" +
"order by a.payCode asc")
public ArrayList<String> getPunchedLorryUserId(Integer divValue, Date date);
@Query(value="select d.empName from Employee d where d.payCode=:userId")
public String getPunchedLorryUserName(String userId);
@Query(value="select d.designation from Employee d where d.payCode=:userId")
public String getPunchedLorryDesignation(String userId);
// ----------------------Zonal Office Enrolled-----------------------------------------
@Query(value="select distinct a.payCode\r\n" +
"from MachineRawPunchh a , DeviceStatus b, ZoneDivMaster c,\r\n" +
"Employee d where \r\n" +
"d.payCode=a.payCode and\r\n" +
"c.devname=b.deviceName\r\n" +
"and a.deviceId=b.deviceId \r\n" +
"AND c.zone=:divValue\r\n" +
"and c.division like '%ZONAL%'\r\n" +
"and cast(a.officePunch as date) =:date\r\n" +
"order by a.payCode asc")
public ArrayList<String> getPunchedZonalUserId(Integer divValue, Date date);
@Query(value="select d.empName from Employee d where d.payCode=:userId")
public String getPunchedZonalUserName(String userId);
@Query(value="select d.designation from Employee d where d.payCode=:userId")
public String getPunchedZonalDesignation(String userId);
// ----------------------Department Office Enrolled-----------------------------------------
@Query(value="select distinct a.payCode \r\n" +
"from MachineRawPunchh a,DeviceStatus b,ZoneDivMaster c,\r\n" +
"Employee d\r\n" +
"where cast(a.officePunch as date) =:date \r\n" +
"and a.payCode=d.payCode \r\n" +
"and c.devname=b.deviceName \r\n" +
"and a.deviceId=b.deviceId \r\n" +
"AND c.devname=:divValue \r\n" +
"AND c.division like '%HQ%' \r\n" +
"order by a.payCode asc")
public ArrayList<String> getPunchedDeptUserId(String divValue, Date date);
@Query(value="select d.empName from Employee d where d.payCode=:userId")
public String getPunchedDeptUserName(String userId);
@Query(value="select d.designation from Employee d where d.payCode=:userId")
public String getPunchedDeptDesignation(String userId);
// ----------------------RDC Office Enrolled-----------------------------------------
@Query(value="select distinct a.payCode\r\n" +
"from MachineRawPunchh a , DeviceStatus b, ZoneDivMaster c,\r\n" +
"Employee d where\r\n" +
"a.payCode=d.payCode \r\n" +
"and c.zone=:divValue\r\n" +
"and c.devname=b.deviceName\r\n" +
"and a.deviceId=b.deviceId \r\n" +
"and c.division like '%RDC%'\r\n" +
"and cast(a.officePunch as date) =:date\r\n" +
"order by a.payCode asc")
public ArrayList<String> getPunchedRDCUserId(Integer divValue, Date date);
@Query(value="select d.empName from Employee d where d.payCode=:userId")
public String getPunchedRDCUserName(String userId);
@Query(value="select d.designation from Employee d where d.payCode=:userId")
public String getPunchedRDCDesignation(String userId);
}

21
src/main/java/com/gcc/biometric/api/GccBioMetricApi/repo/RDCAbsenteesDataRepository.java

@ -0,0 +1,21 @@
package com.gcc.biometric.api.GccBioMetricApi.repo;
import org.springframework.data.jpa.repository.Query;
import java.util.ArrayList;
import java.util.Date;
import org.springframework.stereotype.Repository;
import com.gcc.biometric.api.GccBioMetricApi.entity.ZoneDivMaster;
import org.springframework.data.jpa.repository.JpaRepository;
@Repository
public interface RDCAbsenteesDataRepository extends JpaRepository<ZoneDivMaster, String>
{
@Query("select a.userId \r\nfrom RealTimeUserInfo a,DeviceStatus b, \r\nZoneDivMaster c , Employee d\r\nwhere a.deviceId=b.deviceId and c.devname=b.deviceName and d.payCode=a.userId\r\nand a.userId not in ( select DISTINCT a.payCode from MachineRawPunchh a,DeviceStatus b,ZoneDivMaster c \r\nwhere cast(a.officePunch as date) =:date and \r\nc.devname=b.deviceName and a.deviceId=b.deviceId \r\nAND c.zone=:zone and c.devname like '%RDC%')\r\nand c.zone=:zone and c.devname like '%RDC%'\r\norder by c.zone,c.division,a.userId")
ArrayList<String> rdcAbsenteesUserId(final Integer zone, final Date date);
@Query("select a.userName \r\nfrom RealTimeUserInfo a,DeviceStatus b, \r\nZoneDivMaster c , Employee d\r\nwhere a.deviceId=b.deviceId and c.devname=b.deviceName and d.payCode=a.userId\r\nand a.userId not in ( select DISTINCT a.payCode from MachineRawPunchh a,DeviceStatus b,ZoneDivMaster c \r\nwhere cast(a.officePunch as date) =:date and \r\nc.devname=b.deviceName and a.deviceId=b.deviceId \r\nAND c.zone=:zone and c.devname like '%RDC%')\r\nand c.zone=:zone and c.devname like '%RDC%'\r\norder by c.zone,c.division,a.userId")
ArrayList<String> rdcAbsenteesUserName(final Integer zone, final Date date);
@Query("select d.designation \r\nfrom RealTimeUserInfo a,DeviceStatus b, \r\nZoneDivMaster c , Employee d\r\nwhere a.deviceId=b.deviceId and c.devname=b.deviceName and d.payCode=a.userId\r\nand a.userId not in ( select DISTINCT a.payCode from MachineRawPunchh a,DeviceStatus b,ZoneDivMaster c \r\nwhere cast(a.officePunch as date) =:date and \r\nc.devname=b.deviceName and a.deviceId=b.deviceId \r\nAND c.zone=:zone and c.devname like '%RDC%')\r\nand c.zone=:zone and c.devname like '%RDC%'\r\norder by c.zone,c.division,a.userId")
ArrayList<String> rdcAbsenteesUserDesignation(final Integer zone, final Date date);
}

13
src/main/java/com/gcc/biometric/api/GccBioMetricApi/repo/RealTimeUserInfoRepository.java

@ -0,0 +1,13 @@
package com.gcc.biometric.api.GccBioMetricApi.repo;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import com.gcc.biometric.api.GccBioMetricApi.entity.RealTimeUserInfo;
@Repository
public interface RealTimeUserInfoRepository extends JpaRepository<RealTimeUserInfo, String> {
}

338
src/main/java/com/gcc/biometric/api/GccBioMetricApi/repo/RegionalDeputyCommissionerRepository.java

@ -0,0 +1,338 @@
package com.gcc.biometric.api.GccBioMetricApi.repo;
import java.util.ArrayList;
import java.util.Date;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import com.gcc.biometric.api.GccBioMetricApi.entity.HeadQuaterEntries;
public interface RegionalDeputyCommissionerRepository extends JpaRepository<HeadQuaterEntries, Integer> {
@Query("select count(a.userId) as Enrolled \r\n"
+ "from RealTimeUserInfo a, Employee c,\r\n"
+ " DeviceStatus b, ZoneDivMaster d \r\n"
+ "where a.deviceId=b.deviceId and a.userId <>1 and a.userId <> 2 and a.userId <> 3\r\n"
+ "and c.payCode=a.userId\r\n"
+ "and d.division like '%RDC%'\r\n"
+ "and d.devname=b.deviceName\r\n"
+ "group by d.division\r\n"
+ "order by d.division ")
ArrayList<Integer> getRDCEnrolled();
@Query("select COUNT(distinct a.payCode) as punched\r\n"
+ "from MachineRawPunchh a , DeviceStatus b, ZoneDivMaster c where \r\n"
+ "c.devname=b.deviceName\r\n"
+ "and a.deviceId=b.deviceId \r\n"
+ "and c.division like '%RDC%'\r\n"
+ "and cast(a.officePunch as date) =:date\r\n"
+ "group by c.division\r\n"
+ "order by c.division")
ArrayList<Integer> getRDCPunched(Date date);
@Query("select c.division\r\n"
+ "from MachineRawPunchh a , DeviceStatus b, ZoneDivMaster c where \r\n"
+ "c.devname=b.deviceName\r\n"
+ "and a.deviceId=b.deviceId \r\n"
+ "and c.division like '%RDC%'\r\n"
+ "group by c.division\r\n"
+ "order by c.division")
ArrayList<String> getRDCZoneNames();
// ========================================================================================
// @Query("select count(a.userId)\r\n"
// + "from RealTimeUserInfo a, Employee c,\r\n"
// + " DeviceStatus b, ZoneDivMaster d \r\n"
// + "where a.deviceId=b.deviceId and a.userId <>1 and a.userId <> 2 and a.userId <> 3\r\n"
// + "AND a.deviceId=b.deviceId\r\n"
// + "and d.zone=1\r\n"
// + "and c.payCode=a.userId\r\n"
// + "and d.devname=b.deviceName")
// String getEnroll_ZONE_1();
//
// @Query("select count(distinct a.payCode)\r\n"
// + "from MachineRawPunch a , DeviceStatus b, ZoneDivMaster c where c.devname=b.deviceName\r\n"
// + "AND c.zone=1\r\n"
// + "and a.deviceId=b.deviceId \r\n"
// + "and cast(a.officePunch as date) ='2022-10-21'")
// String getPunched_1();
//
//
//
// @Query("select count(a.userId)\r\n"
// + "from RealTimeUserInfo a, Employee c,\r\n"
// + " DeviceStatus b, ZoneDivMaster d \r\n"
// + "where a.deviceId=b.deviceId and a.userId <>1 and a.userId <> 2 and a.userId <> 3\r\n"
// + "AND a.deviceId=b.deviceId\r\n"
// + "and d.zone=2\r\n"
// + "and c.payCode=a.userId\r\n"
// + "and d.devname=b.deviceName")
// String getEnroll_ZONE_2();
//
// @Query("select count(distinct a.payCode)\r\n"
// + "from MachineRawPunch a , DeviceStatus b, ZoneDivMaster c where c.devname=b.deviceName\r\n"
// + "AND c.zone=2\r\n"
// + "and a.deviceId=b.deviceId \r\n"
// + "and cast(a.officePunch as date) ='2022-10-21'")
// String getPunched_2();
//
// @Query("select count(a.userId)\r\n"
// + "from RealTimeUserInfo a, Employee c,\r\n"
// + " DeviceStatus b, ZoneDivMaster d \r\n"
// + "where a.deviceId=b.deviceId and a.userId <>1 and a.userId <> 2 and a.userId <> 3\r\n"
// + "AND a.deviceId=b.deviceId\r\n"
// + "and d.zone=3\r\n"
// + "and c.payCode=a.userId\r\n"
// + "and d.devname=b.deviceName")
// String getEnroll_ZONE_3();
//
// @Query("select count(distinct a.payCode)\r\n"
// + "from MachineRawPunch a , DeviceStatus b, ZoneDivMaster c where c.devname=b.deviceName\r\n"
// + "AND c.zone=3\r\n"
// + "and a.deviceId=b.deviceId \r\n"
// + "and cast(a.officePunch as date) ='2022-10-21'")
// String getPunched_3();
//
// @Query("select count(a.userId)\r\n"
// + "from RealTimeUserInfo a, Employee c,\r\n"
// + " DeviceStatus b, ZoneDivMaster d \r\n"
// + "where a.deviceId=b.deviceId and a.userId <>1 and a.userId <> 2 and a.userId <> 3\r\n"
// + "AND a.deviceId=b.deviceId\r\n"
// + "and d.zone=4\r\n"
// + "and c.payCode=a.userId\r\n"
// + "and d.devname=b.deviceName")
// String getEnroll_ZONE_4();
//
// @Query("select count(distinct a.payCode)\r\n"
// + "from MachineRawPunch a , DeviceStatus b, ZoneDivMaster c where c.devname=b.deviceName\r\n"
// + "AND c.zone=4\r\n"
// + "and a.deviceId=b.deviceId \r\n"
// + "and cast(a.officePunch as date) ='2022-10-21'")
// String getPunched_4();
//
// @Query("select count(a.userId)\r\n"
// + "from RealTimeUserInfo a, Employee c,\r\n"
// + " DeviceStatus b, ZoneDivMaster d \r\n"
// + "where a.deviceId=b.deviceId and a.userId <>1 and a.userId <> 2 and a.userId <> 3\r\n"
// + "AND a.deviceId=b.deviceId\r\n"
// + "and d.zone=5\r\n"
// + "and c.payCode=a.userId\r\n"
// + "and d.devname=b.deviceName")
// String getEnroll_ZONE_5();
//
// @Query("select count(distinct a.payCode)\r\n"
// + "from MachineRawPunch a , DeviceStatus b, ZoneDivMaster c where c.devname=b.deviceName\r\n"
// + "AND c.zone=5\r\n"
// + "and a.deviceId=b.deviceId \r\n"
// + "and cast(a.officePunch as date) ='2022-10-21'")
// String getPunched_5();
//
// @Query("select count(a.userId)\r\n"
// + "from RealTimeUserInfo a, Employee c,\r\n"
// + " DeviceStatus b, ZoneDivMaster d \r\n"
// + "where a.deviceId=b.deviceId and a.userId <>1 and a.userId <> 2 and a.userId <> 3\r\n"
// + "AND a.deviceId=b.deviceId\r\n"
// + "and d.zone=6\r\n"
// + "and c.payCode=a.userId\r\n"
// + "and d.devname=b.deviceName")
// String getEnroll_ZONE_6();
//
// @Query("select count(distinct a.payCode)\r\n"
// + "from MachineRawPunch a , DeviceStatus b, ZoneDivMaster c where c.devname=b.deviceName\r\n"
// + "AND c.zone=6\r\n"
// + "and a.deviceId=b.deviceId \r\n"
// + "and cast(a.officePunch as date) ='2022-10-21'")
// String getPunched_6();
//
// @Query("select count(a.userId)\r\n"
// + "from RealTimeUserInfo a, Employee c,\r\n"
// + " DeviceStatus b, ZoneDivMaster d \r\n"
// + "where a.deviceId=b.deviceId and a.userId <>1 and a.userId <> 2 and a.userId <> 3\r\n"
// + "AND a.deviceId=b.deviceId\r\n"
// + "and d.zone=7\r\n"
// + "and c.payCode=a.userId\r\n"
// + "and d.devname=b.deviceName")
// String getEnroll_ZONE_7();
//
// @Query("select count(distinct a.payCode)\r\n"
// + "from MachineRawPunch a , DeviceStatus b, ZoneDivMaster c where c.devname=b.deviceName\r\n"
// + "AND c.zone=7\r\n"
// + "and a.deviceId=b.deviceId \r\n"
// + "and cast(a.officePunch as date) ='2022-10-21'")
// String getPunched_7();
//
// @Query("select count(a.userId)\r\n"
// + "from RealTimeUserInfo a, Employee c,\r\n"
// + " DeviceStatus b, ZoneDivMaster d \r\n"
// + "where a.deviceId=b.deviceId and a.userId <>1 and a.userId <> 2 and a.userId <> 3\r\n"
// + "AND a.deviceId=b.deviceId\r\n"
// + "and d.zone=8\r\n"
// + "and c.payCode=a.userId\r\n"
// + "and d.devname=b.deviceName")
// String getEnroll_ZONE_8();
//
// @Query("select count(distinct a.payCode)\r\n"
// + "from MachineRawPunch a , DeviceStatus b, ZoneDivMaster c where c.devname=b.deviceName\r\n"
// + "AND c.zone=8\r\n"
// + "and a.deviceId=b.deviceId \r\n"
// + "and cast(a.officePunch as date) ='2022-10-21'")
// String getPunched_8();
//
// @Query("select count(a.userId)\r\n"
// + "from RealTimeUserInfo a, Employee c,\r\n"
// + " DeviceStatus b, ZoneDivMaster d \r\n"
// + "where a.deviceId=b.deviceId and a.userId <>1 and a.userId <> 2 and a.userId <> 3\r\n"
// + "AND a.deviceId=b.deviceId\r\n"
// + "and d.zone=9\r\n"
// + "and c.payCode=a.userId\r\n"
// + "and d.devname=b.deviceName")
// String getEnroll_ZONE_9();
//
// @Query("select count(distinct a.payCode)\r\n"
// + "from MachineRawPunch a , DeviceStatus b, ZoneDivMaster c where c.devname=b.deviceName\r\n"
// + "AND c.zone=9\r\n"
// + "and a.deviceId=b.deviceId \r\n"
// + "and cast(a.officePunch as date) ='2022-10-21'")
// String getPunched_9();
//
// @Query("select count(a.userId)\r\n"
// + "from RealTimeUserInfo a, Employee c,\r\n"
// + " DeviceStatus b, ZoneDivMaster d \r\n"
// + "where a.deviceId=b.deviceId and a.userId <>1 and a.userId <> 2 and a.userId <> 3\r\n"
// + "AND a.deviceId=b.deviceId\r\n"
// + "and d.zone=10\r\n"
// + "and c.payCode=a.userId\r\n"
// + "and d.devname=b.deviceName")
// String getEnroll_ZONE_10();
//
// @Query("select count(distinct a.payCode)\r\n"
// + "from MachineRawPunch a , DeviceStatus b, ZoneDivMaster c where c.devname=b.deviceName\r\n"
// + "AND c.zone=10\r\n"
// + "and a.deviceId=b.deviceId \r\n"
// + "and cast(a.officePunch as date) ='2022-10-21'")
// String getPunched_10();
//
// @Query("select count(a.userId)\r\n"
// + "from RealTimeUserInfo a, Employee c,\r\n"
// + " DeviceStatus b, ZoneDivMaster d \r\n"
// + "where a.deviceId=b.deviceId and a.userId <>1 and a.userId <> 2 and a.userId <> 3\r\n"
// + "AND a.deviceId=b.deviceId\r\n"
// + "and d.zone=11\r\n"
// + "and c.payCode=a.userId\r\n"
// + "and d.devname=b.deviceName")
// String getEnroll_ZONE_11();
//
// @Query("select count(distinct a.payCode)\r\n"
// + "from MachineRawPunch a , DeviceStatus b, ZoneDivMaster c where c.devname=b.deviceName\r\n"
// + "AND c.zone=11\r\n"
// + "and a.deviceId=b.deviceId \r\n"
// + "and cast(a.officePunch as date) ='2022-10-21'")
// String getPunched_11();
//
// @Query("select count(a.userId)\r\n"
// + "from RealTimeUserInfo a, Employee c,\r\n"
// + " DeviceStatus b, ZoneDivMaster d \r\n"
// + "where a.deviceId=b.deviceId and a.userId <>1 and a.userId <> 2 and a.userId <> 3\r\n"
// + "AND a.deviceId=b.deviceId\r\n"
// + "and d.zone=12\r\n"
// + "and c.payCode=a.userId\r\n"
// + "and d.devname=b.deviceName")
// String getEnroll_ZONE_12();
//
// @Query("select count(distinct a.payCode)\r\n"
// + "from MachineRawPunch a , DeviceStatus b, ZoneDivMaster c where c.devname=b.deviceName\r\n"
// + "AND c.zone=12\r\n"
// + "and a.deviceId=b.deviceId \r\n"
// + "and cast(a.officePunch as date) ='2022-10-21'")
// String getPunched_12();
//
// @Query("select count(a.userId)\r\n"
// + "from RealTimeUserInfo a, Employee c,\r\n"
// + " DeviceStatus b, ZoneDivMaster d \r\n"
// + "where a.deviceId=b.deviceId and a.userId <>1 and a.userId <> 2 and a.userId <> 3\r\n"
// + "AND a.deviceId=b.deviceId\r\n"
// + "and d.zone=13\r\n"
// + "and c.payCode=a.userId\r\n"
// + "and d.devname=b.deviceName")
// String getEnroll_ZONE_13();
//
// @Query("select count(distinct a.payCode)\r\n"
// + "from MachineRawPunch a , DeviceStatus b, ZoneDivMaster c where c.devname=b.deviceName\r\n"
// + "AND c.zone=13\r\n"
// + "and a.deviceId=b.deviceId \r\n"
// + "and cast(a.officePunch as date) ='2022-10-21'")
// String getPunched_13();
//
// @Query("select count(a.userId)\r\n"
// + "from RealTimeUserInfo a, Employee c,\r\n"
// + " DeviceStatus b, ZoneDivMaster d \r\n"
// + "where a.deviceId=b.deviceId and a.userId <>1 and a.userId <> 2 and a.userId <> 3\r\n"
// + "AND a.deviceId=b.deviceId\r\n"
// + "and d.zone=14\r\n"
// + "and c.payCode=a.userId\r\n"
// + "and d.devname=b.deviceName")
// String getEnroll_ZONE_14();
//
// @Query("select count(distinct a.payCode)\r\n"
// + "from MachineRawPunch a , DeviceStatus b, ZoneDivMaster c where c.devname=b.deviceName\r\n"
// + "AND c.zone=14\r\n"
// + "and a.deviceId=b.deviceId \r\n"
// + "and cast(a.officePunch as date) ='2022-10-21'")
// String getPunched_14();
//
// @Query("select count(a.userId)\r\n"
// + "from RealTimeUserInfo a, Employee c,\r\n"
// + " DeviceStatus b, ZoneDivMaster d \r\n"
// + "where a.deviceId=b.deviceId and a.userId <>1 and a.userId <> 2 and a.userId <> 3\r\n"
// + "AND a.deviceId=b.deviceId\r\n"
// + "and d.zone=15\r\n"
// + "and c.payCode=a.userId\r\n"
// + "and d.devname=b.deviceName")
// String getEnroll_ZONE_15();
//
// @Query("select count(distinct a.payCode)\r\n"
// + "from MachineRawPunch a , DeviceStatus b, ZoneDivMaster c where c.devname=b.deviceName\r\n"
// + "AND c.zone=15\r\n"
// + "and a.deviceId=b.deviceId \r\n"
// + "and cast(a.officePunch as date) ='2022-10-21'")
// String getPunched_15();
//
// @Query("select count(a.userId)\r\n"
// + "from RealTimeUserInfo a, Employee c,\r\n"
// + " DeviceStatus b, ZoneDivMaster d \r\n"
// + "where a.deviceId=b.deviceId and a.userId <>1 and a.userId <> 2 and a.userId <> 3\r\n"
// + "AND a.deviceId=b.deviceId\r\n"
// + "and d.zone=16\r\n"
// + "and c.payCode=a.userId\r\n"
// + "and d.devname=b.deviceName")
// String getEnroll_ZONE_16();
//
// @Query("select count(distinct a.payCode)\r\n"
// + "from MachineRawPunch a , DeviceStatus b, ZoneDivMaster c where c.devname=b.deviceName\r\n"
// + "AND c.zone=16\r\n"
// + "and a.deviceId=b.deviceId \r\n"
// + "and cast(a.officePunch as date) ='2022-10-21'")
// String getPunched_16();
//
}

51
src/main/java/com/gcc/biometric/api/GccBioMetricApi/repo/ZonalAbsenteesDataRepository.java

@ -0,0 +1,51 @@
package com.gcc.biometric.api.GccBioMetricApi.repo;
import org.springframework.data.jpa.repository.Query;
import java.util.ArrayList;
import java.util.Date;
import org.springframework.stereotype.Repository;
import com.gcc.biometric.api.GccBioMetricApi.entity.ZoneDivMaster;
import org.springframework.data.jpa.repository.JpaRepository;
@Repository
public interface ZonalAbsenteesDataRepository extends JpaRepository<ZoneDivMaster, String>
{
@Query("select a.userId from RealTimeUserInfo a,DeviceStatus b, \r\n ZoneDivMaster c ,"
+ " Employee d\r\n"
+ "where a.deviceId=b.deviceId "
+ "and c.devname=b.deviceName and d.payCode=a.userId\r\n"
+ "and a.userId not in (select a.payCode from MachineRawPunchh a,RealTimeUserInfo b,"
+ "DeviceStatus c,ZoneDivMaster d \r\n "
+ "where cast(a.officePunch as date) =:date "
+ "and a.payCode=b.userId and \r\n "
+ "d.devname=c.deviceName "
+ "and b.deviceId=c.deviceId \r\n"
+ "AND d.zone=:zone and d.division like '%ZONAL%')\r\n "
+ "and c.zone=:zone and c.division like '%ZONAL%'\r\n "
+ "order by c.zone,c.division,a.userId")
ArrayList<String> zonalAbsenteesUserId(final Integer zone, final Date date);
@Query("select a.userName \r\n"
+ "from RealTimeUserInfo a,DeviceStatus b,\r\n"
+ " ZoneDivMaster c , Employee d\r\n"
+ "where a.deviceId=b.deviceId and c.devname=b.deviceName and d.payCode=a.userId\r\n"
+ "and a.userId not in (select a.payCode from MachineRawPunchh a,RealTimeUserInfo b,DeviceStatus c,ZoneDivMaster d \r\n"
+ "where cast(a.officePunch as date) =:date and a.payCode=b.userId and\r\n"
+ "d.devname=c.deviceName and b.deviceId=c.deviceId \r\n"
+ "AND d.zone=:zone and d.division like '%ZONAL%') \r\n "
+ "and c.zone=:zone and c.division like '%ZONAL%'\r\n "
+ "order by c.zone,c.division,a.userId")
ArrayList<String> zonalAbsenteesUserName(final Integer zone, final Date date);
@Query("select d.designation \r\n"
+ "from RealTimeUserInfo a,DeviceStatus b,\r\n "
+ "ZoneDivMaster c , Employee d\r\n"
+ "where a.deviceId=b.deviceId and c.devname=b.deviceName and d.payCode=a.userId\r\n"
+ " and a.userId not in (select a.payCode from MachineRawPunchh a,RealTimeUserInfo b,DeviceStatus c,ZoneDivMaster d \r\n"
+ "where cast(a.officePunch as date) =:date and a.payCode=b.userId and\r\n"
+ "d.devname=c.deviceName and b.deviceId=c.deviceId \r\n"
+ "AND d.zone=:zone and d.division like '%ZONAL%') \r\n"
+ " and c.zone=:zone and c.division like '%ZONAL%'\r\n "
+ "order by c.zone,c.division,a.userId")
ArrayList<String> zonalAbsenteesUserDesignation(final Integer zone, final Date date);
}

34
src/main/java/com/gcc/biometric/api/GccBioMetricApi/repo/ZonalOfficeTotalDataRepository.java

@ -0,0 +1,34 @@
package com.gcc.biometric.api.GccBioMetricApi.repo;
import java.util.ArrayList;
import java.util.Date;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import com.gcc.biometric.api.GccBioMetricApi.entity.ZoneDivMaster;
@Repository
public interface ZonalOfficeTotalDataRepository extends JpaRepository<ZoneDivMaster, String> {
@Query(value="select count(a.userId) as Enrolled \r\n"
+ "from RealTimeUserInfo a, Employee c,\r\n"
+ " DeviceStatus b, ZoneDivMaster d \r\n"
+ "where a.deviceId=b.deviceId and a.userId <>1 and a.userId <> 2 and a.userId <> 3\r\n"
+ "and c.payCode=a.userId\r\n"
+ "and d.division like '%ZONAL%'\r\n"
+ "and d.devname=b.deviceName")
public ArrayList<Integer> getZonalOfficeTotalEnrolled();
@Query(value="select COUNT(distinct a.payCode) as punched\r\n"
+ "from MachineRawPunchh a , DeviceStatus b, ZoneDivMaster c where \r\n"
+ "c.devname=b.deviceName\r\n"
+ "and a.deviceId=b.deviceId \r\n"
+ "and c.division like '%ZONAL%'\r\n"
+ "and cast(a.officePunch as date) =:date")
public ArrayList<Integer> getZonalOfficeTotalPunched(Date date);
}

93
src/main/java/com/gcc/biometric/api/GccBioMetricApi/repo/ZoneDivisionOfficeAbsenteesDataRepository.java

@ -0,0 +1,93 @@
package com.gcc.biometric.api.GccBioMetricApi.repo;
import org.springframework.data.jpa.repository.Query;
import java.util.ArrayList;
import java.util.Date;
import org.springframework.stereotype.Repository;
import com.gcc.biometric.api.GccBioMetricApi.entity.ZoneDivMaster;
import org.springframework.data.jpa.repository.JpaRepository;
@Repository
public interface ZoneDivisionOfficeAbsenteesDataRepository extends JpaRepository<ZoneDivMaster, String>
{
@Query("select a.userId from RealTimeUserInfo a,DeviceStatus b, \r\nZoneDivMaster c , Employee d\r\nwhere a.deviceId=b.deviceId and c.devname=b.deviceName and d.payCode=a.userId\r\nand a.userId not in (select a.payCode from MachineRawPunchh a,RealTimeUserInfo b,DeviceStatus c,ZoneDivMaster d \r\nwhere cast(a.officePunch as date) =:date and a.payCode=b.userId and \r\nd.devname=c.deviceName and b.deviceId=c.deviceId \r\nAND d.division=:divValue and d.devname like '%DIV%')\r\nand c.division=:divValue and c.devname like '%DIV%'\r\norder by c.zone,c.division,a.userId")
ArrayList<String> divAbsenteesUserId(final String divValue, final Date date);
@Query("select a.userName from RealTimeUserInfo a,DeviceStatus b, \r\nZoneDivMaster c , Employee d\r\n"
+ "where a.deviceId=b.deviceId and c.devname=b.deviceName and d.payCode=a.userId\r\n"
+ "and a.userId not in (select a.payCode from MachineRawPunchh a,RealTimeUserInfo b,DeviceStatus c,ZoneDivMaster d \r\n"
+ "where cast(a.officePunch as date) =:date and a.payCode=b.userId and \r\n"
+ "d.devname=c.deviceName and b.deviceId=c.deviceId \r\n"
+ "AND d.division=:divValue and d.devname like '%DIV%')\r\n"
+ "and c.division=:divValue and c.devname like '%DIV%'\r\n"
+ "order by c.zone,c.division,a.userId")
ArrayList<String> divAbsenteesUserName(final String divValue, final Date date);
@Query("select d.designation from RealTimeUserInfo a,DeviceStatus b, \r\n"
+ "ZoneDivMaster c , Employee d\r\nwhere a.deviceId=b.deviceId and c.devname=b.deviceName and d.payCode=a.userId\r\n"
+ "and a.userId not in (select a.payCode from MachineRawPunchh a,RealTimeUserInfo b,DeviceStatus c,ZoneDivMaster d \r\n"
+ "where cast(a.officePunch as date) =:date and a.payCode=b.userId and \r\n"
+ "d.devname=c.deviceName and b.deviceId=c.deviceId \r\n"
+ "AND d.division=:divValue and d.devname like '%DIV%')\r\n"
+ "and c.division=:divValue and c.devname like '%DIV%'\r\n"
+ "order by c.zone,c.division,a.userId")
ArrayList<String> divAbsenteesUserDesignation(final String divValue, final Date date);
@Query("select a.userId from RealTimeUserInfo a,DeviceStatus b, \r\n"
+ "ZoneDivMaster c , Employee d\r\nwhere a.deviceId=b.deviceId and c.devname=b.deviceName and d.payCode=a.userId\r\n"
+ "and a.userId not in (select a.payCode from MachineRawPunchh a,DeviceStatus b,ZoneDivMaster c \r\n"
+ "where cast(a.officePunch as date) =:date and \r\nc.devname=b.deviceName and a.deviceId=b.deviceId \r\n"
+ "and c.division =:unitValue)\r\n"
+ "and c.division =:unitValue\r\n"
+ "order by c.zone,a.userId")
ArrayList<String> unitAbsenteesUserId(final String unitValue, final Date date);
@Query("select a.userName from RealTimeUserInfo a,DeviceStatus b, \r\n"
+ "ZoneDivMaster c , Employee d\r\nwhere a.deviceId=b.deviceId and c.devname=b.deviceName and d.payCode=a.userId\r\n"
+ "and a.userId not in (select a.payCode from MachineRawPunchh a,DeviceStatus b,ZoneDivMaster c \r\n"
+ "where cast(a.officePunch as date) =:date and \r\nc.devname=b.deviceName and a.deviceId=b.deviceId \r\n"
+ "and c.division =:unitValue)\r\n"
+ "and c.division =:unitValue\r\n"
+ "order by c.zone,a.userId")
ArrayList<String> unitAbsenteesUserName(final String unitValue, final Date date);
@Query("select d.designation from RealTimeUserInfo a,DeviceStatus b, \r\nZoneDivMaster c , Employee d\r\n"
+ "where a.deviceId=b.deviceId and c.devname=b.deviceName and d.payCode=a.userId\r\nand a.userId not in (select a.payCode from MachineRawPunchh a,DeviceStatus b,ZoneDivMaster c \r\n"
+ "where cast(a.officePunch as date) =:date and \r\nc.devname=b.deviceName and a.deviceId=b.deviceId \r\n"
+ "and c.division =:unitValue)\r\n"
+ "and c.division =:unitValue\r\n"
+ "order by c.zone,a.userId")
ArrayList<String> unitAbsenteesUserDesignation(final String unitValue, final Date date);
@Query("select a.userId from RealTimeUserInfo a,DeviceStatus b, \r\nZoneDivMaster c , Employee d\r\n"
+ "where a.deviceId=b.deviceId and c.devname=b.deviceName and d.payCode=a.userId\r\n"
+ "and a.userId not in (select a.payCode from MachineRawPunchh a,RealTimeUserInfo b,DeviceStatus c,ZoneDivMaster d \r\n"
+ "where cast(a.officePunch as date) =:date and a.payCode=b.userId and \r\n"
+ "d.devname=c.deviceName and b.deviceId=c.deviceId \r\n"
+ "AND d.zone=:zone and d.devname like '%LORRY%')\r\n"
+ "and c.zone=:zone and c.devname like '%LORRY%'\r\n"
+ "order by c.zone,c.division,a.userId")
ArrayList<String> lorryAbsenteesUserId(final Integer zone, final Date date);
@Query("select a.userName from RealTimeUserInfo a,DeviceStatus b, \r\n"
+ "ZoneDivMaster c , Employee d\r\n"
+ "where a.deviceId=b.deviceId and c.devname=b.deviceName and d.payCode=a.userId\r\n"
+ "and a.userId not in (select a.payCode from MachineRawPunchh a,RealTimeUserInfo b,DeviceStatus c,ZoneDivMaster d \r\n"
+ "where cast(a.officePunch as date) =:date and a.payCode=b.userId and \r\n"
+ "d.devname=c.deviceName and b.deviceId=c.deviceId \r\n"
+ "AND d.zone=:zone and d.devname like '%LORRY%')\r\n"
+ "and c.zone=:zone and c.devname like '%LORRY%'\r\n"
+ "order by c.zone,c.division,a.userId")
ArrayList<String> lorryAbsenteesUserName(final Integer zone, final Date date);
@Query("select d.designation from RealTimeUserInfo a,DeviceStatus b, \r\n"
+ "ZoneDivMaster c , Employee d\r\n"
+ "where a.deviceId=b.deviceId and c.devname=b.deviceName and d.payCode=a.userId\r\n"
+ "and a.userId not in (select a.payCode from MachineRawPunchh a,RealTimeUserInfo b,DeviceStatus c,ZoneDivMaster d \r\n"
+ "where cast(a.officePunch as date) =:date and a.payCode=b.userId and \r\n"
+ "d.devname=c.deviceName and b.deviceId=c.deviceId \r\n"
+ "AND d.zone=:zone and d.devname like '%LORRY%')\r\n"
+ "and c.zone=:zone and c.devname like '%LORRY%'\r\n"
+ "order by c.zone,c.division,a.userId")
ArrayList<String> lorryAbsenteesUserDesignation(final Integer zone, final Date date);
}

262
src/main/java/com/gcc/biometric/api/GccBioMetricApi/repo/ZoneDivisionOfficeRepository.java

@ -0,0 +1,262 @@
package com.gcc.biometric.api.GccBioMetricApi.repo;
import java.util.ArrayList;
import java.util.Date;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import com.gcc.biometric.api.GccBioMetricApi.entity.ZoneDivMaster;
@Repository
public interface ZoneDivisionOfficeRepository extends JpaRepository<ZoneDivMaster, String> {
// # # # # # # # # # # # # # # # # DivisionOffice # # # # # # # # # # # # # # # # # # #
//because div_1 date is different so for matching
@Query(value="select count(a.userId)\r\n"
+ "from RealTimeUserInfo a, Employee c,\r\n"
+ " DeviceStatus b, ZoneDivMaster d \r\n"
+ "where a.deviceId=b.deviceId and a.userId <>1 and a.userId <> 2 and a.userId <> 3\r\n"
+ "and c.payCode=a.userId\r\n"
+ "and d.zone=:zoneValue\r\n"
+ "and d.devname like '%DIV%'\r\n"
+ "and d.devname=b.deviceName\r\n"
+ "group by d.division\r\n"
+ "order by d.division + 0 asc")
public ArrayList<String> getDivisionOfficeEnrolledPerDiv_1(Integer zoneValue);
@Query(value="select count(a.userId)\r\n"
+ "from RealTimeUserInfo a, Employee c,\r\n"
+ " DeviceStatus b, ZoneDivMaster d \r\n"
+ "where a.deviceId=b.deviceId and a.userId <>1 and a.userId <> 2 and a.userId <> 3\r\n"
+ "and c.payCode=a.userId\r\n"
+ "and d.zone=:zoneValue\r\n"
+ "and d.devname like '%DIV%'\r\n"
+ "and d.devname=b.deviceName\r\n"
+ "group by d.division\r\n"
+ "order by d.division asc")
public ArrayList<String> getDivisionOfficeEnrolledPerDiv(Integer zoneValue);
@Query(value="select count(distinct a.payCode)\r\n"
+ "from MachineRawPunchh a , DeviceStatus b, ZoneDivMaster c where \r\n"
+ "c.devname=b.deviceName\r\n"
+ "and a.deviceId=b.deviceId \r\n"
+ "and c.devname like '%DIV%'\r\n"
+ "and c.zone= :zoneValue\r\n"
+ "and cast(a.officePunch as date) = :date\r\n"
+ "group by c.division\r\n"
+"order by c.division + 0 asc")
public ArrayList<String> getDivisionOfficePunchedPerDiv_1(Integer zoneValue, Date date);
@Query(value="select count(distinct a.payCode)\r\n"
+ "from MachineRawPunchh a , DeviceStatus b, ZoneDivMaster c where \r\n"
+ "c.devname=b.deviceName\r\n"
+ "and a.deviceId=b.deviceId \r\n"
+ "and c.devname like '%DIV%'\r\n"
+ "and c.zone= :zoneValue\r\n"
+ "and cast(a.officePunch as date) = :date\r\n"
+ "group by c.division\r\n"
+"order by c.division asc")
public ArrayList<String> getDivisionOfficePunchedPerDiv(Integer zoneValue, Date date);
@Query(value="select c.division\r\n"
+ "from MachineRawPunchh a , DeviceStatus b, ZoneDivMaster c where \r\n"
+ "c.devname=b.deviceName\r\n"
+ "and a.deviceId=b.deviceId \r\n"
+ "and c.zone= :zoneValue \r\n"
+ "and c.devname like '%DIV%'\r\n"
+ "and cast(a.officePunch as date) = :date group by c.division\r\n"
+"order by c.division asc")
public ArrayList<String> getDivisionOfficeZoneDivAsPerDate(Integer zoneValue, Date date);
@Query(value="select division from ZoneDivMaster c where c.zone= :zoneValue and c.devname like '%DIV%'")
public ArrayList<String> getDivisionOfficeZoneDivisions(Integer zoneValue);
// # # # # # # # # # # # # # # # # DivisionOffice # # # # # # # # # # # # # # # # # # #
// # # # # # # # # # # # # # # # # Unit Office # # # # # # # # # # # # # # # # # # #
@Query(value="select count(a.userId)\r\n"
+ "from RealTimeUserInfo a, Employee c,\r\n"
+ " DeviceStatus b, ZoneDivMaster d \r\n"
+ "where a.deviceId=b.deviceId and a.userId <>1 and a.userId <> 2 and a.userId <> 3\r\n"
+ "and c.payCode=a.userId\r\n"
+ "and d.zone=:zoneValue\r\n"
+ "and d.division like '%UNIT%'\r\n"
+ "and d.devname=b.deviceName\r\n"
+ "group by d.zone,d.division\r\n"
+ "order by d.zone")
public ArrayList<String> getUnitOfficeEnrolledPerZone(Integer zoneValue);
@Query(value="select COUNT(distinct a.payCode) as punched\r\n"
+ "from MachineRawPunchh a , DeviceStatus b, ZoneDivMaster c where \r\n"
+ "c.devname=b.deviceName\r\n"
+ "and a.deviceId=b.deviceId \r\n"
+ "and c.zone=:zoneValue\r\n"
+ "and c.division like '%UNIT%'\r\n"
+ "and cast(a.officePunch as date) =:date\r\n"
+ "group by c.zone,c.division\r\n"
+ "order by c.zone")
public ArrayList<String> getUnitOfficePunchedPerZone(Integer zoneValue, Date date);
@Query(value="select d.division\r\n"
+ "from RealTimeUserInfo a, Employee c,\r\n"
+ "DeviceStatus b, ZoneDivMaster d\r\n"
+ "where a.deviceId=b.deviceId and a.userId <>1 and a.userId <> 2 and a.userId <> 3\r\n"
+ "and c.payCode=a.userId\r\n"
+ "and d.zone=:zoneValue\r\n"
+ "and d.division like '%UNIT%'\r\n"
+ "and d.devname=b.deviceName\r\n"
+ "group by d.zone,d.division\r\n"
+ "order by d.zone")
public ArrayList<String> getAllUnitOfficeAsPerZoneAsPerEnrolled(Integer zoneValue);
@Query(value="select c.division\r\n"
+ "from MachineRawPunchh a , DeviceStatus b, ZoneDivMaster c where\r\n"
+ "c.devname=b.deviceName\r\n"
+ "and a.deviceId=b.deviceId\r\n"
+ "and c.zone=:zoneValue\r\n"
+ "and c.division like '%UNIT%'\r\n"
+ "and cast(a.officePunch as date) =:date\r\n"
+ "group by c.zone,c.division\r\n"
+ "order by c.zone")
public ArrayList<String> getAllUnitOfficeAsPerZoneAsPerPunched(Integer zoneValue, Date date);
@Query(value="select division from ZoneDivMaster c where c.zone=:zoneValue and c.division like '%UNIT%'")
public ArrayList<String> getAllUnitOfficeAsPerZone(Integer zoneValue);
// # # # # # # # # # # # # # # # # Unit Office # # # # # # # # # # # # # # # # # # #
// # # # # # # # # # # # # # # # # Zonal Office As per Zone# # # # # # # # # # # # # # # # # # #
@Query(value="select count(a.userId)\r\n"
+ "from RealTimeUserInfo a, Employee c,\r\n"
+ " DeviceStatus b, ZoneDivMaster d \r\n"
+ "where a.deviceId=b.deviceId and a.userId <>1 and a.userId <> 2 and a.userId <> 3\r\n"
+ "and c.payCode=a.userId\r\n"
+ "and d.zone= :zoneValue\r\n"
+ "and d.division like '%ZONAL%'\r\n"
+ "and d.devname=b.deviceName\r\n"
+ "group by d.division\r\n"
+ "order by d.division")
public ArrayList<String> getZonalOfficeEnrolledPerDiv(Integer zoneValue);
@Query(value="select COUNT(distinct a.payCode)\r\n"
+ "from MachineRawPunchh a , DeviceStatus b, ZoneDivMaster c where \r\n"
+ "c.devname=b.deviceName\r\n"
+ "and a.deviceId=b.deviceId \r\n"
+ "AND c.zone=:zoneValue\r\n"
+ "and c.division like '%ZONAL%'\r\n"
+ "and cast(a.officePunch as date) = :date\r\n"
+ "group by c.division\r\n"
+ "order by c.division")
public ArrayList<String> getZonalOfficePunchedPerDiv(Integer zoneValue, Date date);
@Query(value="select c.devname\r\n"
+ "from MachineRawPunchh a , DeviceStatus b, ZoneDivMaster c where \r\n"
+ "c.devname=b.deviceName\r\n"
+ "and a.deviceId=b.deviceId \r\n"
+ "AND c.zone=:zoneValue\r\n"
+ "and c.division like '%ZONAL%'\r\n"
+ "and cast(a.officePunch as date) =:date\r\n"
+ "group by c.devname\r\n"
+ "order by c.devname")
public ArrayList<String> getZonalOfficeZoneDivAsPerDate(Integer zoneValue, Date date);
@Query(value="select devname from ZoneDivMaster c where c.zone= :zoneValue and c.division like '%ZONAL%'")
public ArrayList<String> getZonalOfficeZoneDivisions(Integer zoneValue);
// # # # # # # # # # # # # # # # # Zonal Office As per Zone # # # # # # # # # # # # # # # # # # #
// # # # # # # # # # # # # # # # # Zonal Office of all 15 Zones # # # # # # # # # # # # # # # # # # #
@Query(value="select count(a.userId) as Enrolled \r\n"
+ "from RealTimeUserInfo a, Employee c,\r\n"
+ " DeviceStatus b, ZoneDivMaster d \r\n"
+ "where a.deviceId=b.deviceId and a.userId <>1 and a.userId <> 2 and a.userId <> 3\r\n"
+ "and c.payCode=a.userId\r\n"
+ "and d.division like '%ZONAL%'\r\n"
+ "and d.devname=b.deviceName\r\n"
+ "group by d.zone,d.devname\r\n"
+ "order by d.zone")
public ArrayList<String> getAllZonalOfficesEnrolledOfAllZones();
@Query(value="select COUNT(distinct a.payCode) as punched\r\n"
+ "from MachineRawPunchh a , DeviceStatus b, ZoneDivMaster c where \r\n"
+ "c.devname=b.deviceName\r\n"
+ "and a.deviceId=b.deviceId\r\n"
+ "and c.division like '%ZONAL%'\r\n"
+ "and cast(a.officePunch as date) =:date\r\n"
+ "group by c.zone,c.division\r\n"
+ "order by c.zone")
public ArrayList<String> getAllZonalOfficesPunchedOfAllZones(Date date);
@Query(value="select c.devname\r\n"
+ "from MachineRawPunchh a , DeviceStatus b, ZoneDivMaster c where \r\n"
+ "c.devname=b.deviceName\r\n"
+ "and a.deviceId=b.deviceId \r\n"
+ "and c.division like '%ZONAL%'\r\n"
+ "and cast(a.officePunch as date) =:date\r\n"
+ "group by c.devname\r\n"
+ "order by c.devname")
public ArrayList<String> getAllZonalOfficesZoneAsPerDate(Date date);
@Query(value="select devname from ZoneDivMaster c where c.division like '%ZONAL%'")
public ArrayList<String> getAllZonalOfficesZones();
// # # # # # # # # # # # # # # # # Zonal Office of all 15 Zones # # # # # # # # # # # # # # # # # # #
// # # # # # # # # # # # # # # # # Lorry Station # # # # # # # # # # # # # # # # # # #
@Query(value="select count(a.userId) \r\n"
+ "from RealTimeUserInfo a, Employee c,\r\n"
+ " DeviceStatus b, ZoneDivMaster d \r\n"
+ "where a.deviceId=b.deviceId and a.userId <>1 and a.userId <> 2 and a.userId <> 3\r\n"
+ "and c.payCode=a.userId\r\n"
+ "and d.zone=:zoneValue\r\n"
+ "and d.devname like '%LORRY%'\r\n"
+ "and d.devname=b.deviceName\r\n"
+ "group by d.division\r\n"
+ "order by d.division asc")
public ArrayList<String> getLorryStationEnrolledPerDiv(Integer zoneValue);
@Query(value="select COUNT(distinct a.payCode)\r\n"
+ "from MachineRawPunchh a , DeviceStatus b, ZoneDivMaster c where \r\n"
+ "c.devname=b.deviceName\r\n"
+ "and a.deviceId=b.deviceId \r\n"
+ "AND c.zone=:zoneValue\r\n"
+ "and c.devname like '%LORRY%'\r\n"
+ "and cast(a.officePunch as date) =:date\r\n"
+ "group by c.division\r\n"
+ "order by c.division")
public ArrayList<String> getLorryStationPunchedPerDiv(Integer zoneValue, Date date);
@Query(value="select c.division\r\n"
+ "from MachineRawPunchh a , DeviceStatus b, ZoneDivMaster c where \r\n"
+ "c.devname=b.deviceName\r\n"
+ "and a.deviceId=b.deviceId \r\n"
+ "AND c.zone=:zoneValue\r\n"
+ "and c.devname like '%LORRY%'\r\n"
+ "and cast(a.officePunch as date) =:date\r\n"
+ "group by c.division\r\n"
+ "order by c.division")
public ArrayList<String> getLorryStationZoneDivAsPerDate(Integer zoneValue, Date date);
@Query(value="select division from ZoneDivMaster c where c.zone= :zoneValue and c.devname like '%LORRY%'")
public ArrayList<String> getLorryStationZoneDivisions(Integer zoneValue);
// # # # # # # # # # # # # # # # # Lorry Station # # # # # # # # # # # # # # # # # # #
}

17
src/main/java/com/gcc/biometric/api/GccBioMetricApi/service/CustomerService.java

@ -0,0 +1,17 @@
//package com.gcc.biometric.api.GccBioMetricApi.service;
//
//import java.util.List;
//
//import com.gcc.biometric.api.GccBioMetricApi.entity.Customer;
//
//public interface CustomerService {
//
// public List<Customer> findAll();
//
// public Customer findById(String theId);
//
// public void save(Customer theCustomer);
//
// public void deleteById(String thId);
//
//}

71
src/main/java/com/gcc/biometric/api/GccBioMetricApi/service/CustomerServiceImpl.java

@ -0,0 +1,71 @@
//package com.gcc.biometric.api.GccBioMetricApi.service;
//
//import java.util.List;
//import java.util.Optional;
//
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Service;
//import org.springframework.transaction.annotation.Transactional;
//import com.gcc.biometric.api.GccBioMetricApi.entity.Customer;
//import com.gcc.biometric.api.GccBioMetricApi.repo.CustomerRepository;
//
//
//@Service
//public class CustomerServiceImpl implements CustomerService {
//
//
// //for constructor Injection
// private CustomerRepository customerRepository;
//
//
// //Constructor Injection
// @Autowired
// public CustomerServiceImpl(CustomerRepository theCustomerRepository)
// {
// customerRepository = theCustomerRepository;
// }
//
// @Transactional
// @Override
// public List<Customer> findAll() {
//
// return customerRepository.findAll();
// }
//
// @Transactional
// @Override
// public Customer findById(String theId) {
//
// Optional<Customer> result = customerRepository.findById(theId);
//
// Customer theEmployee = null;
// if(result.isPresent())
// {
// theEmployee = result.get();
// }
// else
// {
// throw new RuntimeException("Customer not found with payCode: "+theId);
// }
//
// return theEmployee;
// }
//
// @Transactional
// @Override
// public void save(Customer theCustomer) {
//
// System.out.println("Calling save method");
// customerRepository.save(theCustomer);
//
// }
//
// @Transactional
// @Override
// public void deleteById(String thId) {
// System.out.println("Called deletemethod from service");
// customerRepository.deleteById(thId);
//
// }
//
//}

19
src/main/java/com/gcc/biometric/api/GccBioMetricApi/service/DeviceStatusService.java

@ -0,0 +1,19 @@
package com.gcc.biometric.api.GccBioMetricApi.service;
import java.util.ArrayList;
import java.util.List;
import com.gcc.biometric.api.GccBioMetricApi.entity.DeviceStatus;
public interface DeviceStatusService {
public List<DeviceStatus> findAll();
public DeviceStatus findById(String theId);
public void save(DeviceStatus theCustomer);
public void deleteById(String thId);
public ArrayList<String> zones();
}

76
src/main/java/com/gcc/biometric/api/GccBioMetricApi/service/DeviceStatusServiceImpl.java

@ -0,0 +1,76 @@
package com.gcc.biometric.api.GccBioMetricApi.service;
import java.util.ArrayList;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Service;
import com.gcc.biometric.api.GccBioMetricApi.entity.DeviceStatus;
import com.gcc.biometric.api.GccBioMetricApi.repo.DeviceStatusRepository;
@Service
public class DeviceStatusServiceImpl implements DeviceStatusService {
//for constructor Injection
private DeviceStatusRepository deviceStatusRepository;
//Constructor Injection
@Autowired
public DeviceStatusServiceImpl(DeviceStatusRepository theDeviceStatusDAO)
{
deviceStatusRepository = theDeviceStatusDAO;
}
@Override
public List<DeviceStatus> findAll() {
// TODO Auto-generated method stub
return deviceStatusRepository.findAll();
}
@Override
public DeviceStatus findById(String deviceId) {
// TODO Auto-generated method stub
// Optional<DeviceStatus> result = DeviceStatusRepository.findById(deviceId);
//
// DeviceStatus theDeviceStatus = null;
// if(result.isPresent())
// {
// theDeviceStatus = result.get();
// }
// else
// {
// throw new RuntimeException("Customer not found with payCode: "+deviceId);
// }
return null;
}
@Override
public void save(DeviceStatus theCustomer) {
// TODO Auto-generated method stub
}
@Override
public void deleteById(String thId) {
// TODO Auto-generated method stub
}
@Override
@Query(value="select ")
public ArrayList<String> zones() {
// TODO Auto-generated method stub
return null;
}
}

29
src/main/java/com/gcc/biometric/api/GccBioMetricApi/service/EmployeeService.java

@ -0,0 +1,29 @@
package com.gcc.biometric.api.GccBioMetricApi.service;
import java.util.List;
import com.gcc.biometric.api.GccBioMetricApi.entity.Employee;
public interface EmployeeService {
public List<Employee> findAll();
public Employee findById(String payCode);
public void save(Employee theEmployee);
public void deleteById(String payCode);
//////////////////////////////////////Doing it using JPA @Query Annotation////////////////////////////////////////
public List<String> getEmpCountPerZone();
public List<String> getEmpCountPresentAbsent();
}

75
src/main/java/com/gcc/biometric/api/GccBioMetricApi/service/EmployeeServiceImpl.java

@ -0,0 +1,75 @@
package com.gcc.biometric.api.GccBioMetricApi.service;
import java.util.List;
import java.util.Optional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.gcc.biometric.api.GccBioMetricApi.entity.Employee;
import com.gcc.biometric.api.GccBioMetricApi.repo.EmployeeRepository;
@Service
public class EmployeeServiceImpl implements EmployeeService {
// for constructor Injection
@Autowired
private EmployeeRepository employeeRepository;
// Constructor Injection
@Autowired
public EmployeeServiceImpl(EmployeeRepository theEmployeeRepository) {
employeeRepository = theEmployeeRepository;
}
@Override
public List<Employee> findAll() {
return employeeRepository.findAll();
}
@Override
public Employee findById(String payCode) {
Optional<Employee> result = employeeRepository.findById(payCode);
Employee theEmployee = null;
if (result.isPresent()) {
theEmployee = result.get();
} else {
throw new RuntimeException("Customer not found with payCode: " + payCode);
}
return theEmployee;
}
@Override
public void save(Employee theEmployee) {
// TODO Auto-generated method stub
}
@Override
public void deleteById(String payCode) {
// TODO Auto-generated method stub
}
//////////////////////////////////////Doing it using JPA @Query Annotation////////////////////////////////////////
@Override
public List<String> getEmpCountPerZone() {
return employeeRepository.getEmpCountPerZone();
}
@Override
public List<String> getEmpCountPresentAbsent()
{
return employeeRepository.getEmpCountPresentAbsent();
}
}

10
src/main/java/com/gcc/biometric/api/GccBioMetricApi/service/HeadQuaterEntriesService.java

@ -0,0 +1,10 @@
//package com.gcc.biometric.api.GccBioMetricApi.service;
//
//
//public interface HeadQuaterEntriesService {
//
// public String getZone_1();
// public String getEnroll_1();
// public String getPunched_1();
//
//}

44
src/main/java/com/gcc/biometric/api/GccBioMetricApi/service/HeadQuaterEntriesServiceImpl.java

@ -0,0 +1,44 @@
//package com.gcc.biometric.api.GccBioMetricApi.service;
//
//
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Service;
//import com.gcc.biometric.api.GccBioMetricApi.repo.HeadQuaterEntriesRepository;
//
//@Service
//public class HeadQuaterEntriesServiceImpl implements HeadQuaterEntriesService {
//
// // for constructor Injection
//
// @Autowired
// private HeadQuaterEntriesRepository headQuaterEntriesRepository;
//
// // Constructor Injection
// @Autowired
// public HeadQuaterEntriesServiceImpl(HeadQuaterEntriesRepository theHeadQuaterEntriesRepository) {
// headQuaterEntriesRepository = theHeadQuaterEntriesRepository;
// }
//
// @Override
// public String getZone_1() {
// // TODO Auto-generated method stub
// return null;
// }
//
// @Override
// public String getEnroll_1() {
// // TODO Auto-generated method stub
// return headQuaterEntriesRepository.getEnroll_1();
// }
//
// @Override
// public String getPunched_1() {
// // TODO Auto-generated method stub
// return headQuaterEntriesRepository.getPunched_1();
// }
//
//
//
//
//
//}

17
src/main/java/com/gcc/biometric/api/GccBioMetricApi/service/MachineRawPunchService.java

@ -0,0 +1,17 @@
package com.gcc.biometric.api.GccBioMetricApi.service;
import java.util.List;
import com.gcc.biometric.api.GccBioMetricApi.entity.MachineRawPunchh;
public interface MachineRawPunchService {
public List<MachineRawPunchh> findAll();
public MachineRawPunchh findById(String cardNo);
public void save(MachineRawPunchh theEmployee);
public void deleteById(String cardNo);
}

57
src/main/java/com/gcc/biometric/api/GccBioMetricApi/service/MachineRawPunchServiceImpl.java

@ -0,0 +1,57 @@
package com.gcc.biometric.api.GccBioMetricApi.service;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.gcc.biometric.api.GccBioMetricApi.entity.MachineRawPunchh;
import com.gcc.biometric.api.GccBioMetricApi.repo.MachineRawPunchRepository;
@Service
public class MachineRawPunchServiceImpl implements MachineRawPunchService {
//for constructor Injection
private MachineRawPunchRepository machineRawPunchRepository;
//Constructor Injection
@Autowired
public MachineRawPunchServiceImpl(MachineRawPunchRepository theMachineRawPunchRepository)
{
machineRawPunchRepository = theMachineRawPunchRepository;
}
@Override
public List<MachineRawPunchh> findAll() {
// TODO Auto-generated method stub
return machineRawPunchRepository.findAll();
}
@Override
public MachineRawPunchh findById(String cardNo) {
// TODO Auto-generated method stub
return null;
}
@Override
public void save(MachineRawPunchh theEmployee) {
// TODO Auto-generated method stub
}
@Override
public void deleteById(String cardNo) {
// TODO Auto-generated method stub
}
}

17
src/main/java/com/gcc/biometric/api/GccBioMetricApi/service/RealTimeUserInfoService.java

@ -0,0 +1,17 @@
package com.gcc.biometric.api.GccBioMetricApi.service;
import java.util.List;
import com.gcc.biometric.api.GccBioMetricApi.entity.RealTimeUserInfo;
public interface RealTimeUserInfoService {
public List<RealTimeUserInfo> findAll();
public RealTimeUserInfo findById(String userId);
public void save(RealTimeUserInfo theRealTimeUserInfo);
public void deleteById(String userId);
}

56
src/main/java/com/gcc/biometric/api/GccBioMetricApi/service/RealTimeUserInfoServiceImpl.java

@ -0,0 +1,56 @@
package com.gcc.biometric.api.GccBioMetricApi.service;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.gcc.biometric.api.GccBioMetricApi.entity.RealTimeUserInfo;
import com.gcc.biometric.api.GccBioMetricApi.repo.RealTimeUserInfoRepository;
@Service
public class RealTimeUserInfoServiceImpl implements RealTimeUserInfoService {
//for constructor Injection
@Autowired
private RealTimeUserInfoRepository realTimeUserInfoRepository;
//Constructor Injection
@Autowired
public RealTimeUserInfoServiceImpl(RealTimeUserInfoRepository theRealTimeUserInfoRepository)
{
realTimeUserInfoRepository = theRealTimeUserInfoRepository;
}
@Override
public List<RealTimeUserInfo> findAll() {
// TODO Auto-generated method stub
return realTimeUserInfoRepository.findAll();
}
@Override
public RealTimeUserInfo findById(String userId) {
// TODO Auto-generated method stub
return null;
}
@Override
public void save(RealTimeUserInfo theRealTimeUserInfo) {
// TODO Auto-generated method stub
}
@Override
public void deleteById(String userId) {
// TODO Auto-generated method stub
}
}

12
src/main/java/com/gcc/biometric/api/GccBioMetricApi/service/ZoneDivMasterService.java

@ -0,0 +1,12 @@
package com.gcc.biometric.api.GccBioMetricApi.service;
import java.util.HashSet;
import com.gcc.biometric.api.GccBioMetricApi.entity.ZoneDivMaster;
public interface ZoneDivMasterService {
public HashSet<ZoneDivMaster> getZoneList();
}

40
src/main/java/com/gcc/biometric/api/GccBioMetricApi/service/ZoneDivMasterServiceImpl.java

@ -0,0 +1,40 @@
package com.gcc.biometric.api.GccBioMetricApi.service;
import java.util.HashSet;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.gcc.biometric.api.GccBioMetricApi.entity.ZoneDivMaster;
import com.gcc.biometric.api.GccBioMetricApi.repo.ZoneDivisionOfficeRepository;
@Service
public class ZoneDivMasterServiceImpl implements ZoneDivMasterService {
//for constructor Injection
@Autowired
private ZoneDivisionOfficeRepository zoneDivMasterRepository;
//Constructor Injection
@Autowired
public ZoneDivMasterServiceImpl(ZoneDivisionOfficeRepository theZoneDivMasterRepository)
{
zoneDivMasterRepository = theZoneDivMasterRepository;
}
@Override
public HashSet<ZoneDivMaster> getZoneList() {
//HashSet<ZoneDivMaster> tempList = zoneDivMasterRepository.getZoneList();
return null;
}
}

31
src/main/java/com/gcc/biometric/api/GccBioMetricApi/swagger/SwaggerConfig.java

@ -0,0 +1,31 @@
//package com.gcc.biometric.api.GccBioMetricApi.swagger;
//
//import org.springframework.context.annotation.Bean;
//import org.springframework.stereotype.Component;
//
//import springfox.documentation.builders.ApiInfoBuilder;
//import springfox.documentation.service.ApiInfo;
//import springfox.documentation.spi.DocumentationType;
//import springfox.documentation.spring.web.plugins.Docket;
//import springfox.documentation.swagger2.annotations.EnableSwagger2;
//
//@Component
//@EnableSwagger2
//public class SwaggerConfig {
//
// @Bean
// public Docket getDocket()
// {
// return new Docket(DocumentationType.SWAGGER_2)
// .groupName("public=apis")
// .apiInfo(getApiInfo())
// .select().build();
// }
//
// public ApiInfo getApiInfo() {
//
// return new ApiInfoBuilder().title("Gcc Attendence Api")
// .description("API created by SS").version("1.0").build();
// }
//
//}

5
src/main/resources/META-INF/additional-spring-configuration-metadata.json

@ -0,0 +1,5 @@
{"properties": [{
"name": "spring.jpa.hibernate.dialect",
"type": "java.lang.String",
"description": "A description for 'spring.jpa.hibernate.dialect'"
}]}

70
src/main/resources/application.properties

@ -0,0 +1,70 @@
#Production
spring.datasource.url=jdbc:sqlserver://10.6.1.165:1433;databaseName=iASweb;encrypt=true;trustServerCertificate=true;
spring.datasource.username=sa
spring.datasource.password=sss
spring.datasource.driverClassName=com.microsoft.sqlserver.jdbc.SQLServerDriver
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.SQLServer2012Dialect
server.port=8090
#server.address=117.232.67.158
#server.address=10.6.10.193
#spring.jpa.show-sql=true
#spring.jpa.hibernate.ddl-auto=none
#server.port=8099
#server.address=10.6.10.193
#spring.datasource.url=jdbc:sqlserver://SACHINSAVITA\\SQLEXPRESS:1433;encrypt=false;databaseName=iASweb
#spring.datasource.username=MicroSystem
#spring.datasource.password=micro@123
#spring.datasource.driverClassName=com.microsoft.sqlserver.jdbc.SQLServerDriver
#server.port=8090
#server.address=localhost
#server.address=10.6.10.193
#server.address=10.6.1.165
#DESKTOP-IR2M3UU\SQLEXPRESS

13
src/test/java/com/gcc/biometric/api/GccBioMetricApi/GccAttendanceApplicationTests.java

@ -0,0 +1,13 @@
package com.gcc.biometric.api.GccBioMetricApi;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class GccAttendanceApplicationTests {
@Test
void contextLoads() {
}
}
Loading…
Cancel
Save