commit 77d8db8e4ceb06dee625e3a8d10c7ba4eb3bdb8d Author: sachinsavita Date: Fri Dec 23 12:52:17 2022 +0530 Enrolled, Punched List Done diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..549e00a --- /dev/null +++ b/.gitignore @@ -0,0 +1,33 @@ +HELP.md +target/ +!.mvn/wrapper/maven-wrapper.jar +!**/src/main/**/target/ +!**/src/test/**/target/ + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +build/ +!**/src/main/**/build/ +!**/src/test/**/build/ + +### VS Code ### +.vscode/ diff --git a/.mvn/wrapper/maven-wrapper.jar b/.mvn/wrapper/maven-wrapper.jar new file mode 100644 index 0000000..c1dd12f Binary files /dev/null and b/.mvn/wrapper/maven-wrapper.jar differ diff --git a/.mvn/wrapper/maven-wrapper.properties b/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000..b74bf7f --- /dev/null +++ b/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1,2 @@ +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.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 diff --git a/mvnw b/mvnw new file mode 100644 index 0000000..8a8fb22 --- /dev/null +++ b/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 "$@" diff --git a/mvnw.cmd b/mvnw.cmd new file mode 100644 index 0000000..1d8ab01 --- /dev/null +++ b/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% diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..10e6cf8 --- /dev/null +++ b/pom.xml @@ -0,0 +1,85 @@ + + + 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + 2.7.5 + + + com.gcc.biometric.api + GccBioMetricApi + 2.0.0-SNAPSHOT + war + GccBioMetricApi + Spring Boot Api + + 1.8 + + + + org.springframework.boot + spring-boot-starter-data-jpa + + + org.springframework.boot + spring-boot-starter-web + + + + org.springframework.boot + spring-boot-devtools + runtime + true + + + com.microsoft.sqlserver + mssql-jdbc + 8.4.1.jre8 + + + org.springframework.boot + spring-boot-starter-test + test + + + + + + + + + + org.json + json + 20171018 + + + + org.projectlombok + lombok + + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + 1.8 + 1.8 + + + + package + + + + diff --git a/src/main/java/com/gcc/biometric/api/GccBioMetricApi/GccAttendanceApplication.java b/src/main/java/com/gcc/biometric/api/GccBioMetricApi/GccAttendanceApplication.java new file mode 100644 index 0000000..a7a93dd --- /dev/null +++ b/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); + + } + + + + +} diff --git a/src/main/java/com/gcc/biometric/api/GccBioMetricApi/TestApp.java b/src/main/java/com/gcc/biometric/api/GccBioMetricApi/TestApp.java new file mode 100644 index 0000000..7fd8ebb --- /dev/null +++ b/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)); + } + + } + +} diff --git a/src/main/java/com/gcc/biometric/api/GccBioMetricApi/controller/ApiRespo.java b/src/main/java/com/gcc/biometric/api/GccBioMetricApi/controller/ApiRespo.java new file mode 100644 index 0000000..aa3492b --- /dev/null +++ b/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 zoneList = ZoneDivMasterController.getZoneList(); +// Object[] tempzoneList = zoneList.toArray(); +// for(int i=0;i> testingformat1() + { + + List myList = new ArrayList<>(); + List> 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> testingformat2() + { + ArrayList myListKey = new ArrayList<>(); + ArrayList myListValue = new ArrayList<>(); + Map,ArrayList> 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> testingformat3() + { + ArrayList myList = new ArrayList<>(); + List> 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> testingformat4() + { + List> listMap = new ArrayList>(); + ArrayList myListKey = new ArrayList<>(); + ArrayList myListValue = new ArrayList<>(); + Map map1 = new HashMap<>(); + Map 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; + + } + +} \ No newline at end of file diff --git a/src/main/java/com/gcc/biometric/api/GccBioMetricApi/controller/CustomerRestController.java b/src/main/java/com/gcc/biometric/api/GccBioMetricApi/controller/CustomerRestController.java new file mode 100644 index 0000000..30d037c --- /dev/null +++ b/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 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 ###########################// +// +// +// +//} diff --git a/src/main/java/com/gcc/biometric/api/GccBioMetricApi/controller/DepartmentHQAbsenteesDataController.java b/src/main/java/com/gcc/biometric/api/GccBioMetricApi/controller/DepartmentHQAbsenteesDataController.java new file mode 100644 index 0000000..df3c06d --- /dev/null +++ b/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> 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 AbsenteesUserId = (ArrayList)this.deptHQAbsenteesDataRepository.deptHQAbsenteesUserId(deptValue, date); + final ArrayList AbsenteesUserName = (ArrayList)this.deptHQAbsenteesDataRepository.rdcAbsenteesUserName(deptValue, date); + final ArrayList AbsenteesUserDesignation = (ArrayList)this.deptHQAbsenteesDataRepository.rdcAbsenteesUserDesignation(deptValue, date); + System.out.println(AbsenteesUserId); + final List> listMap = new ArrayList>(); + if (!AbsenteesUserId.isEmpty()) { + for (int i = 0; i < AbsenteesUserId.size(); ++i) { + final ArrayList myListKey = new ArrayList(); + final ArrayList myListValue = new ArrayList(); + 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 map = new LinkedHashMap(); + for (int x = 0; x < myListKey.size(); ++x) { + map.put(myListKey.get(x), myListValue.get(x)); + } + listMap.add(map); + } + return listMap; + } + final ArrayList myListKey2 = new ArrayList(); + final ArrayList myListValue2 = new ArrayList(); + myListKey2.add("UserId"); + myListValue2.add("0"); + myListKey2.add("UserName"); + myListValue2.add("0"); + myListKey2.add("Designation"); + myListValue2.add("0"); + final Map map2 = new LinkedHashMap(); + 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; + } +} diff --git a/src/main/java/com/gcc/biometric/api/GccBioMetricApi/controller/DeptHeadQuaterOfficeController.java b/src/main/java/com/gcc/biometric/api/GccBioMetricApi/controller/DeptHeadQuaterOfficeController.java new file mode 100644 index 0000000..254cf6e --- /dev/null +++ b/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>> 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 allHQDepartments; + ArrayList allHQDepartmentsAsperDate; + ArrayList hqDepartmentsEnrolled; + ArrayList 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> listMap = new ArrayList>(); + for (int i = 0; i myListKey = new ArrayList<>(); + ArrayList 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 map = new LinkedHashMap<>(); + for(int x=0;x getAllDevices() { + + return deviceStatusService.findAll(); + } + + +} + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/java/com/gcc/biometric/api/GccBioMetricApi/controller/EmployeeRestController.java b/src/main/java/com/gcc/biometric/api/GccBioMetricApi/controller/EmployeeRestController.java new file mode 100644 index 0000000..1c44ea3 --- /dev/null +++ b/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 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> getNMR() { +// return jdbcTemplate.queryForList( +// "select SSN,ACTIVE,PAYCODE,EMPNAME,DateOFBIRTH,DateOFJOIN,PRESENTCARDNO from tblemployee"); +// } + + + + //////////////////////////////////////Doing it using JPA @Query Annotation//////////////////////////////////////// + + @GetMapping("/getEmpCountPerZone123") + public List getEmpCountPerZone() { + + return employeeService.getEmpCountPerZone(); + } + + @GetMapping("/getEmpCountPresentAbsent") + public List getEmpCountPresentAbsent() { + + return employeeService.getEmpCountPresentAbsent(); + } + + +} diff --git a/src/main/java/com/gcc/biometric/api/GccBioMetricApi/controller/EnrolledEmpListDataController.java b/src/main/java/com/gcc/biometric/api/GccBioMetricApi/controller/EnrolledEmpListDataController.java new file mode 100644 index 0000000..ad57c99 --- /dev/null +++ b/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 EnrolledUserId; + ArrayList EnrolledUserName; + ArrayList EnrolledUserDesignation; + + + // ----------------------Division office Enrolled----------------------------------------- + + @GetMapping({ "/getDivEnrolledEmpList/{div}" }) + public List> 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> listMap = new ArrayList>(); + if (!EnrolledUserId.isEmpty()) { + for (int i = 0; i < EnrolledUserId.size(); ++i) { + final ArrayList myListKey = new ArrayList(); + final ArrayList myListValue = new ArrayList(); + 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 map = new LinkedHashMap(); + 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 myListKey2 = new ArrayList(); + final ArrayList myListValue2 = new ArrayList(); + myListKey2.add("UserId"); + myListValue2.add("0"); + myListKey2.add("UserName"); + myListValue2.add("0"); + myListKey2.add("Designation"); + myListValue2.add("0"); + final Map map2 = new LinkedHashMap(); + 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> 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> listMap = new ArrayList>(); + if (!EnrolledUserId.isEmpty()) { + for (int i = 0; i < EnrolledUserId.size(); ++i) { + final ArrayList myListKey = new ArrayList(); + final ArrayList myListValue = new ArrayList(); + 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 map = new LinkedHashMap(); + 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 myListKey2 = new ArrayList(); + final ArrayList myListValue2 = new ArrayList(); + myListKey2.add("UserId"); + myListValue2.add("0"); + myListKey2.add("UserName"); + myListValue2.add("0"); + myListKey2.add("Designation"); + myListValue2.add("0"); + final Map map2 = new LinkedHashMap(); + 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> 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> listMap = new ArrayList>(); + if (!EnrolledUserId.isEmpty()) { + for (int i = 0; i < EnrolledUserId.size(); ++i) { + final ArrayList myListKey = new ArrayList(); + final ArrayList myListValue = new ArrayList(); + 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 map = new LinkedHashMap(); + 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 myListKey2 = new ArrayList(); + final ArrayList myListValue2 = new ArrayList(); + myListKey2.add("UserId"); + myListValue2.add("0"); + myListKey2.add("UserName"); + myListValue2.add("0"); + myListKey2.add("Designation"); + myListValue2.add("0"); + final Map map2 = new LinkedHashMap(); + 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> 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> listMap = new ArrayList>(); + if (!EnrolledUserId.isEmpty()) { + for (int i = 0; i < EnrolledUserId.size(); ++i) { + final ArrayList myListKey = new ArrayList(); + final ArrayList myListValue = new ArrayList(); + 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 map = new LinkedHashMap(); + 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 myListKey2 = new ArrayList(); + final ArrayList myListValue2 = new ArrayList(); + myListKey2.add("UserId"); + myListValue2.add("0"); + myListKey2.add("UserName"); + myListValue2.add("0"); + myListKey2.add("Designation"); + myListValue2.add("0"); + final Map map2 = new LinkedHashMap(); + 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> 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> listMap = new ArrayList>(); + if (!EnrolledUserId.isEmpty()) { + for (int i = 0; i < EnrolledUserId.size(); ++i) { + ArrayList myListKey = new ArrayList(); + ArrayList myListValue = new ArrayList(); + 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 map = new LinkedHashMap(); + 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 myListKey2 = new ArrayList(); + ArrayList myListValue2 = new ArrayList(); + myListKey2.add("UserId"); + myListValue2.add("0"); + myListKey2.add("UserName"); + myListValue2.add("0"); + myListKey2.add("Designation"); + myListValue2.add("0"); + Map map2 = new LinkedHashMap(); + 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> 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> listMap = new ArrayList>(); + if (!EnrolledUserId.isEmpty()) { + for (int i = 0; i < EnrolledUserId.size(); ++i) { + ArrayList myListKey = new ArrayList(); + ArrayList myListValue = new ArrayList(); + 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 map = new LinkedHashMap(); + 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 myListKey2 = new ArrayList(); + ArrayList myListValue2 = new ArrayList(); + myListKey2.add("UserId"); + myListValue2.add("0"); + myListKey2.add("UserName"); + myListValue2.add("0"); + myListKey2.add("Designation"); + myListValue2.add("0"); + Map map2 = new LinkedHashMap(); + 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; + + } +} diff --git a/src/main/java/com/gcc/biometric/api/GccBioMetricApi/controller/FormatTestingController.java b/src/main/java/com/gcc/biometric/api/GccBioMetricApi/controller/FormatTestingController.java new file mode 100644 index 0000000..37dc208 --- /dev/null +++ b/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 zoneDivisions; + ArrayList zoneDivisionsOnDate; + ArrayList divEnrolled; + ArrayList divPunched; + + @GetMapping("/FormatTesting/{zone}/{officeTypes}/{tempDate}") + public List> 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> listMap = new ArrayList>(); + ArrayList myListKey = new ArrayList<>(); + ArrayList myListValue = new ArrayList<>(); + Map 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; + } + +} diff --git a/src/main/java/com/gcc/biometric/api/GccBioMetricApi/controller/HeadQuaterEntriesRestController.java b/src/main/java/com/gcc/biometric/api/GccBioMetricApi/controller/HeadQuaterEntriesRestController.java new file mode 100644 index 0000000..de6882a --- /dev/null +++ b/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 arrZoneEnroll; + ArrayList arrZonePunched; + + @GetMapping("/ZoneEmpCountPresentAbsentPercentage/{tempDate}") + public LinkedHashMap 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 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 getTheEnrolledAndPunchedAbsPer(@RequestParam(value = "date")@DateTimeFormat(iso = DateTimeFormat.ISO.DATE)String date) { +// +// arrEnroll = headQuaterEntriesRepository.getEnrolled(); +// arrPunched = headQuaterEntriesRepository.getPunched(date); +// LinkedHashMap 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; +// } + + +} diff --git a/src/main/java/com/gcc/biometric/api/GccBioMetricApi/controller/HeadQuaterOfficeController.java b/src/main/java/com/gcc/biometric/api/GccBioMetricApi/controller/HeadQuaterOfficeController.java new file mode 100644 index 0000000..f207bb5 --- /dev/null +++ b/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> getEmpPerPunZoneCount(@PathVariable @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) String tempDate) { // @PathVariable + // String + // officePunch + + System.out.println("Date is " + tempDate); + + 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 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> getEmpPerPunZoneCountFaster() { + + List> 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() { +// +// +// +// } + + + + + +} diff --git a/src/main/java/com/gcc/biometric/api/GccBioMetricApi/controller/MachineRawPunchRestController.java b/src/main/java/com/gcc/biometric/api/GccBioMetricApi/controller/MachineRawPunchRestController.java new file mode 100644 index 0000000..555aab4 --- /dev/null +++ b/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 getAllRawPunch() { + + return machineRawPunchService.findAll(); + } + + +} + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/java/com/gcc/biometric/api/GccBioMetricApi/controller/PunchedEmpListDataController.java b/src/main/java/com/gcc/biometric/api/GccBioMetricApi/controller/PunchedEmpListDataController.java new file mode 100644 index 0000000..7201e68 --- /dev/null +++ b/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> 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 tempPunchedUserId= new ArrayList<>(); + ArrayList PunchedUserName = new ArrayList<>(); + ArrayList PunchedUserDesignation = new ArrayList<>(); + + tempPunchedUserId = punchedEmpListDataRepository.getPunchedDivUserId(divValue, date); + + ArrayList PunchedUserId = new ArrayList(); + 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> listMap = new ArrayList>(); + + if (!PunchedUserId.isEmpty()) { + + for (int i = 0; i < PunchedUserId.size(); i++) { + + ArrayList myListKey = new ArrayList(); + ArrayList myListValue = new ArrayList(); + 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 map = new LinkedHashMap(); + 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 myListKey2 = new ArrayList(); + final ArrayList myListValue2 = new ArrayList(); + myListKey2.add("UserId"); + myListValue2.add("0"); + myListKey2.add("UserName"); + myListValue2.add("0"); + myListKey2.add("Designation"); + myListValue2.add("0"); + final Map map2 = new LinkedHashMap(); + 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> 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 tempPunchedUserId= new ArrayList<>(); + ArrayList PunchedUserName = new ArrayList<>(); + ArrayList PunchedUserDesignation = new ArrayList<>(); + + tempPunchedUserId = punchedEmpListDataRepository.getPunchedUnitUserId(unitValue, date); + + ArrayList PunchedUserId = new ArrayList(); + 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> listMap = new ArrayList>(); + if (!tempPunchedUserId.isEmpty()) { + for (int i = 0; i < tempPunchedUserId.size(); i++) { + final ArrayList myListKey = new ArrayList(); + final ArrayList myListValue = new ArrayList(); + 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 map = new LinkedHashMap(); + 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 myListKey2 = new ArrayList(); + final ArrayList myListValue2 = new ArrayList(); + myListKey2.add("UserId"); + myListValue2.add("0"); + myListKey2.add("UserName"); + myListValue2.add("0"); + myListKey2.add("Designation"); + myListValue2.add("0"); + final Map map2 = new LinkedHashMap(); + 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> 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 tempPunchedUserId= new ArrayList<>(); + ArrayList PunchedUserName = new ArrayList<>(); + ArrayList PunchedUserDesignation = new ArrayList<>(); + + tempPunchedUserId = punchedEmpListDataRepository.getPunchedLorryUserId(zoneValue, date); + + ArrayList PunchedUserId = new ArrayList(); + 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> listMap = new ArrayList>(); + if (!tempPunchedUserId.isEmpty()) { + for (int i = 0; i < tempPunchedUserId.size(); i++) { + final ArrayList myListKey = new ArrayList(); + final ArrayList myListValue = new ArrayList(); + 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 map = new LinkedHashMap(); + 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 myListKey2 = new ArrayList(); + final ArrayList myListValue2 = new ArrayList(); + myListKey2.add("UserId"); + myListValue2.add("0"); + myListKey2.add("UserName"); + myListValue2.add("0"); + myListKey2.add("Designation"); + myListValue2.add("0"); + final Map map2 = new LinkedHashMap(); + 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> 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 tempPunchedUserId= new ArrayList<>(); + ArrayList PunchedUserName = new ArrayList<>(); + ArrayList PunchedUserDesignation = new ArrayList<>(); + + tempPunchedUserId = punchedEmpListDataRepository.getPunchedZonalUserId(zoneValue, date); + + ArrayList PunchedUserId = new ArrayList(); + 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> listMap = new ArrayList>(); + if (!tempPunchedUserId.isEmpty()) { + for (int i = 0; i < tempPunchedUserId.size(); i++) { + final ArrayList myListKey = new ArrayList(); + final ArrayList myListValue = new ArrayList(); + 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 map = new LinkedHashMap(); + 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 myListKey2 = new ArrayList(); + final ArrayList myListValue2 = new ArrayList(); + myListKey2.add("UserId"); + myListValue2.add("0"); + myListKey2.add("UserName"); + myListValue2.add("0"); + myListKey2.add("Designation"); + myListValue2.add("0"); + final Map map2 = new LinkedHashMap(); + 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> 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 tempPunchedUserId= new ArrayList<>(); + ArrayList PunchedUserName = new ArrayList<>(); + ArrayList PunchedUserDesignation = new ArrayList<>(); + + tempPunchedUserId = punchedEmpListDataRepository.getPunchedDeptUserId(zoneValue, date); + + ArrayList PunchedUserId = new ArrayList(); + 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> listMap = new ArrayList>(); + if (!tempPunchedUserId.isEmpty()) { + for (int i = 0; i < tempPunchedUserId.size(); i++) { + ArrayList myListKey = new ArrayList(); + ArrayList myListValue = new ArrayList(); + 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 map = new LinkedHashMap(); + 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 myListKey2 = new ArrayList(); + ArrayList myListValue2 = new ArrayList(); + myListKey2.add("UserId"); + myListValue2.add("0"); + myListKey2.add("UserName"); + myListValue2.add("0"); + myListKey2.add("Designation"); + myListValue2.add("0"); + Map map2 = new LinkedHashMap(); + 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> 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 tempPunchedUserId= new ArrayList<>(); + ArrayList PunchedUserName = new ArrayList<>(); + ArrayList PunchedUserDesignation = new ArrayList<>(); + tempPunchedUserId = punchedEmpListDataRepository.getPunchedRDCUserId(zoneValue, date); + + ArrayList PunchedUserId = new ArrayList(); + 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> listMap = new ArrayList>(); + if (!tempPunchedUserId.isEmpty()) { + for (int i = 0; i < tempPunchedUserId.size(); i++) { + ArrayList myListKey = new ArrayList(); + ArrayList myListValue = new ArrayList(); + 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 map = new LinkedHashMap(); + 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 myListKey2 = new ArrayList(); + ArrayList myListValue2 = new ArrayList(); + myListKey2.add("UserId"); + myListValue2.add("0"); + myListKey2.add("UserName"); + myListValue2.add("0"); + myListKey2.add("Designation"); + myListValue2.add("0"); + Map map2 = new LinkedHashMap(); + 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; + + } +} diff --git a/src/main/java/com/gcc/biometric/api/GccBioMetricApi/controller/RDCAbsenteesDataController.java b/src/main/java/com/gcc/biometric/api/GccBioMetricApi/controller/RDCAbsenteesDataController.java new file mode 100644 index 0000000..d79a61e --- /dev/null +++ b/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> 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 AbsenteesUserId = (ArrayList)this.rDCAbsenteesDataRepository.rdcAbsenteesUserId(zoneValue, date); + final ArrayList AbsenteesUserName = (ArrayList)this.rDCAbsenteesDataRepository.rdcAbsenteesUserName(zoneValue, date); + final ArrayList AbsenteesUserDesignation = (ArrayList)this.rDCAbsenteesDataRepository.rdcAbsenteesUserDesignation(zoneValue, date); + final List> listMap = new ArrayList>(); + if (!AbsenteesUserId.isEmpty()) { + for (int i = 0; i < AbsenteesUserId.size(); ++i) { + final ArrayList myListKey = new ArrayList(); + final ArrayList myListValue = new ArrayList(); + 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 map = new LinkedHashMap(); + for (int x = 0; x < myListKey.size(); ++x) { + map.put(myListKey.get(x), myListValue.get(x)); + } + listMap.add(map); + } + return listMap; + } + final ArrayList myListKey2 = new ArrayList(); + final ArrayList myListValue2 = new ArrayList(); + myListKey2.add("UserId"); + myListValue2.add("0"); + myListKey2.add("UserName"); + myListValue2.add("0"); + myListKey2.add("Designation"); + myListValue2.add("0"); + final Map map2 = new LinkedHashMap(); + 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; + } +} diff --git a/src/main/java/com/gcc/biometric/api/GccBioMetricApi/controller/RealTimeUserInfoRestController.java b/src/main/java/com/gcc/biometric/api/GccBioMetricApi/controller/RealTimeUserInfoRestController.java new file mode 100644 index 0000000..7b1ae6e --- /dev/null +++ b/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 getAllEmployee() { + + return realTimeUserInfoService.findAll(); + } + + +} + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/java/com/gcc/biometric/api/GccBioMetricApi/controller/RegionalDeputyCommissionerController.java b/src/main/java/com/gcc/biometric/api/GccBioMetricApi/controller/RegionalDeputyCommissionerController.java new file mode 100644 index 0000000..7fbef4b --- /dev/null +++ b/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 arrRDCEnroll; + ArrayList arrRDCPunched; + ArrayList arrRDCZoneNames; + + @GetMapping("/RegionalDeputyCommissionerOfficeData/{tempDate}") + public LinkedHashMap 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 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> getTotalEmployee() { + List> 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> getNULM() { + List> 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> getNMR() { + List> 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> getEmpPerZoneCount() { + + List> 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> getEmpPerZoneCountByRealQuery() { + + List> 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> empZonePunchCount() { + + List> 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> getEmpPerZoneCountByRealQuery() { + + List> 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> 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> 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;" + + } + + + + + + + + + + + + + + + + +} \ No newline at end of file diff --git a/src/main/java/com/gcc/biometric/api/GccBioMetricApi/controller/ZonalAbsenteesDataController.java b/src/main/java/com/gcc/biometric/api/GccBioMetricApi/controller/ZonalAbsenteesDataController.java new file mode 100644 index 0000000..db2e406 --- /dev/null +++ b/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> 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 AbsenteesUserId = (ArrayList)this.zonalAbsenteesDataRepository.zonalAbsenteesUserId(zoneValue, date); + final ArrayList AbsenteesUserName = (ArrayList)this.zonalAbsenteesDataRepository.zonalAbsenteesUserName(zoneValue, date); + final ArrayList AbsenteesUserDesignation = (ArrayList)this.zonalAbsenteesDataRepository.zonalAbsenteesUserDesignation(zoneValue, date); + final List> listMap = new ArrayList>(); + if (!AbsenteesUserId.isEmpty()) { + for (int i = 0; i < AbsenteesUserId.size(); ++i) { + final ArrayList myListKey = new ArrayList(); + final ArrayList myListValue = new ArrayList(); + 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 map = new LinkedHashMap(); + for (int x = 0; x < myListKey.size(); ++x) { + map.put(myListKey.get(x), myListValue.get(x)); + } + listMap.add(map); + } + return listMap; + } + final ArrayList myListKey2 = new ArrayList(); + final ArrayList myListValue2 = new ArrayList(); + myListKey2.add("UserId"); + myListValue2.add("0"); + myListKey2.add("UserName"); + myListValue2.add("0"); + myListKey2.add("Designation"); + myListValue2.add("0"); + final Map map2 = new LinkedHashMap(); + 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; + } +} diff --git a/src/main/java/com/gcc/biometric/api/GccBioMetricApi/controller/ZonalOfficeTotalDateController.java b/src/main/java/com/gcc/biometric/api/GccBioMetricApi/controller/ZonalOfficeTotalDateController.java new file mode 100644 index 0000000..51900f5 --- /dev/null +++ b/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 arrZonalTotalEnroll; + ArrayList arrZonalTotalPunched; + + @GetMapping("/TotalZonalOfficeEmployeeData/{tempDate}") + public LinkedHashMap 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 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 getZoneList() { + HashSet tempZones = zoneDivMasterService.getZoneList(); + zoneList = tempZones.toArray(); + + for(int i=0;i> 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 AbsenteesUserId = (ArrayList)this.zoneDivisionOfficeAbsenteesDataRepository.divAbsenteesUserId(divValue, date); + final ArrayList AbsenteesUserName = (ArrayList)this.zoneDivisionOfficeAbsenteesDataRepository.divAbsenteesUserName(divValue, date); + final ArrayList AbsenteesUserDesignation = (ArrayList)this.zoneDivisionOfficeAbsenteesDataRepository.divAbsenteesUserDesignation(divValue, date); + final List> listMap = new ArrayList>(); + System.out.println(AbsenteesUserId.isEmpty()); + if (!AbsenteesUserId.isEmpty()) { + for (int i = 0; i < AbsenteesUserId.size(); ++i) { + final ArrayList myListKey = new ArrayList(); + final ArrayList myListValue = new ArrayList(); + 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 map = new LinkedHashMap(); + for (int x = 0; x < myListKey.size(); ++x) { + map.put(myListKey.get(x), myListValue.get(x)); + } + listMap.add(map); + } + return listMap; + } + final ArrayList myListKey2 = new ArrayList(); + final ArrayList myListValue2 = new ArrayList(); + myListKey2.add("UserId"); + myListValue2.add("0"); + myListKey2.add("UserName"); + myListValue2.add("0"); + myListKey2.add("Designation"); + myListValue2.add("0"); + final Map map2 = new LinkedHashMap(); + 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 AbsenteesUserId = (ArrayList)this.zoneDivisionOfficeAbsenteesDataRepository.lorryAbsenteesUserId(zone, date); + final ArrayList AbsenteesUserName = (ArrayList)this.zoneDivisionOfficeAbsenteesDataRepository.lorryAbsenteesUserName(zone, date); + final ArrayList AbsenteesUserDesignation = (ArrayList)this.zoneDivisionOfficeAbsenteesDataRepository.lorryAbsenteesUserDesignation(zone, date); + System.out.println(AbsenteesUserId.size()); + final List> listMap2 = new ArrayList>(); + if (!AbsenteesUserId.isEmpty()) { + for (int j = 0; j < AbsenteesUserId.size(); ++j) { + final ArrayList myListKey3 = new ArrayList(); + final ArrayList myListValue3 = new ArrayList(); + 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 map3 = new LinkedHashMap(); + for (int x3 = 0; x3 < myListKey3.size(); ++x3) { + map3.put(myListKey3.get(x3), myListValue3.get(x3)); + } + listMap2.add(map3); + } + return listMap2; + } + final ArrayList myListKey = new ArrayList(); + final ArrayList myListValue = new ArrayList(); + myListKey.add("UserId"); + myListValue.add("0"); + myListKey.add("UserName"); + myListValue.add("0"); + myListKey.add("Designation"); + myListValue.add("0"); + final Map map = new LinkedHashMap(); + 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 AbsenteesUserId = (ArrayList)this.zoneDivisionOfficeAbsenteesDataRepository.unitAbsenteesUserId(unitValue, date); + final ArrayList AbsenteesUserName = (ArrayList)this.zoneDivisionOfficeAbsenteesDataRepository.unitAbsenteesUserName(unitValue, date); + final ArrayList AbsenteesUserDesignation = (ArrayList)this.zoneDivisionOfficeAbsenteesDataRepository.unitAbsenteesUserDesignation(unitValue, date); + final List> listMap2 = new ArrayList>(); + if (!AbsenteesUserId.isEmpty()) { + for (int j = 0; j < AbsenteesUserId.size(); ++j) { + final ArrayList myListKey3 = new ArrayList(); + final ArrayList myListValue3 = new ArrayList(); + 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 map3 = new LinkedHashMap(); + for (int x3 = 0; x3 < myListKey3.size(); ++x3) { + map3.put(myListKey3.get(x3), myListValue3.get(x3)); + } + listMap2.add(map3); + } + } + else { + final ArrayList myListKey = new ArrayList(); + final ArrayList myListValue = new ArrayList(); + myListKey.add("UserId"); + myListValue.add("0"); + myListKey.add("UserName"); + myListValue.add("0"); + myListKey.add("Designation"); + myListValue.add("0"); + final Map map = new LinkedHashMap(); + 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; + } + } +} diff --git a/src/main/java/com/gcc/biometric/api/GccBioMetricApi/controller/ZoneDivisionOfficeController.java b/src/main/java/com/gcc/biometric/api/GccBioMetricApi/controller/ZoneDivisionOfficeController.java new file mode 100644 index 0000000..b596341 --- /dev/null +++ b/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>> 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 zoneDivisions; + ArrayList zoneDivisionsOnDate; + ArrayList divEnrolled; + ArrayList 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> listMap = new ArrayList>(); + for (int i = 0; i myListKey = new ArrayList<>(); + ArrayList 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 map = new LinkedHashMap<>(); + + for(int x=0;x allUnitsAsPerZone; + ArrayList unitEnrolled; + ArrayList unitAsEnrolled; + ArrayList unitPunched; + ArrayList 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> listMap = new ArrayList>(); + for (int i = 0; i myListKey = new ArrayList<>(); + ArrayList 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 map = new LinkedHashMap<>(); + for(int x=0;x zoneDivisions; + ArrayList zoneDivisionsOnDate; + ArrayList divEnrolled; + ArrayList 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> listMap = new ArrayList>(); + for (int i = 0; i myListKey = new ArrayList<>(); + ArrayList 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 map = new LinkedHashMap<>(); + for(int x=0;x zoneDivisions; + ArrayList zoneDivisionsOnDate; + ArrayList divEnrolled; + ArrayList 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> listMap = new ArrayList>(); + for (int i = 0; i myListKey = new ArrayList<>(); + ArrayList 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 map = new LinkedHashMap<>(); + for(int x=0;x zoneDivisions; + ArrayList zoneDivisionsOnDate; + ArrayList divEnrolled; + ArrayList 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> listMap = new ArrayList>(); + for (Integer i = 0; i myListKey = new ArrayList<>(); + ArrayList 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 map = new LinkedHashMap<>(); + for(int x=0;x findAll(); +// +// public Customer findById(int theId); +// +// public void save(Customer theCustomer); +// +// public void deleteById(int thId); +// +// +//} diff --git a/src/main/java/com/gcc/biometric/api/GccBioMetricApi/dao/CustomerDAOImpl.java b/src/main/java/com/gcc/biometric/api/GccBioMetricApi/dao/CustomerDAOImpl.java new file mode 100644 index 0000000..cc132e9 --- /dev/null +++ b/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 findAll() { +// +// // get the current hibernate session +// Session currentSession = entityManager.unwrap(Session.class); +// System.out.println("Session Created"); +// // create a query +// Query theQuery = currentSession.createQuery("from Customer", Customer.class); +// System.out.println("Reading Query"); +// // execute query and get result +// List 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 theQuery = currentSession.createQuery("delete from Customer where id="+theId); +// //theQuery.setParameter("customerId", theId); +// theQuery.executeUpdate(); +// +// } +// +//} diff --git a/src/main/java/com/gcc/biometric/api/GccBioMetricApi/dao/CustomerDAOJpaImpl.java b/src/main/java/com/gcc/biometric/api/GccBioMetricApi/dao/CustomerDAOJpaImpl.java new file mode 100644 index 0000000..726c168 --- /dev/null +++ b/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 findAll() { +// // create query +// Query theQuery = entityManager.createQuery("from Customer"); +// // execute query and get the results +// List 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 +// +// } +// +// +//} diff --git a/src/main/java/com/gcc/biometric/api/GccBioMetricApi/dao/DeviceStatusDAO.java b/src/main/java/com/gcc/biometric/api/GccBioMetricApi/dao/DeviceStatusDAO.java new file mode 100644 index 0000000..40acaeb --- /dev/null +++ b/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 getAllDevices(); +// +//} diff --git a/src/main/java/com/gcc/biometric/api/GccBioMetricApi/dao/DeviceStatusDAOImpl.java b/src/main/java/com/gcc/biometric/api/GccBioMetricApi/dao/DeviceStatusDAOImpl.java new file mode 100644 index 0000000..3f32901 --- /dev/null +++ b/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 getAllDevices() { +// // get the current hibernate session +// Session currentSession = entityManager.unwrap(Session.class); +// System.out.println("Session Created"); +// // create a query +// Query theQuery = currentSession.createQuery("from DeviceStatus", DeviceStatus.class); +// System.out.println("Reading Query"); +// // execute query and get result +// List deviceStatus = theQuery.getResultList(); +// // return the result +// System.out.println("Returning query"); +// return deviceStatus; +// } +// +//} diff --git a/src/main/java/com/gcc/biometric/api/GccBioMetricApi/dao/EmployeeDAO.java b/src/main/java/com/gcc/biometric/api/GccBioMetricApi/dao/EmployeeDAO.java new file mode 100644 index 0000000..802477d --- /dev/null +++ b/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 getAllEmployee(); +// +// public Employee findEmpBySnn(String snn); +// +//} diff --git a/src/main/java/com/gcc/biometric/api/GccBioMetricApi/dao/EmployeeDAOImpl.java b/src/main/java/com/gcc/biometric/api/GccBioMetricApi/dao/EmployeeDAOImpl.java new file mode 100644 index 0000000..01ce789 --- /dev/null +++ b/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 getAllEmployee() { +// // get the current hibernate session +// Session currentSession = entityManager.unwrap(Session.class); +// System.out.println("Session Created"); +// // create a query +// Query theQuery = currentSession.createQuery("from Employee", Employee.class); +// System.out.println("Reading Query"); +// // execute query and get result +// List 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; +// +// } +// +// +//} diff --git a/src/main/java/com/gcc/biometric/api/GccBioMetricApi/dao/MachineRawPunchDAO.java b/src/main/java/com/gcc/biometric/api/GccBioMetricApi/dao/MachineRawPunchDAO.java new file mode 100644 index 0000000..273a803 --- /dev/null +++ b/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 getAllRawPunch(); +// +//} diff --git a/src/main/java/com/gcc/biometric/api/GccBioMetricApi/dao/MachineRawPunchDAOImpl.java b/src/main/java/com/gcc/biometric/api/GccBioMetricApi/dao/MachineRawPunchDAOImpl.java new file mode 100644 index 0000000..12bd7cb --- /dev/null +++ b/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 getAllRawPunch() { +// // get the current hibernate session +// Session currentSession = entityManager.unwrap(Session.class); +// System.out.println("Session Created"); +// // create a query +// Query theQuery = currentSession.createQuery("from MachineRawPunch", MachineRawPunch.class); +// System.out.println("Reading Query"); +// // execute query and get result +// List machineRawPunch = theQuery.getResultList(); +// // return the result +// System.out.println("Returning query"); +// return machineRawPunch; +// } +// +//} diff --git a/src/main/java/com/gcc/biometric/api/GccBioMetricApi/dao/RealTimeUserInfoDAO.java b/src/main/java/com/gcc/biometric/api/GccBioMetricApi/dao/RealTimeUserInfoDAO.java new file mode 100644 index 0000000..7b08e34 --- /dev/null +++ b/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 getAllUserInfo(); +// +//} diff --git a/src/main/java/com/gcc/biometric/api/GccBioMetricApi/dao/RealTimeUserInfoDAOImpl.java b/src/main/java/com/gcc/biometric/api/GccBioMetricApi/dao/RealTimeUserInfoDAOImpl.java new file mode 100644 index 0000000..9cb50ea --- /dev/null +++ b/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 getAllUserInfo() { +// +// // get the current hibernate session +// Session currentSession = entityManager.unwrap(Session.class); +// System.out.println("Session Created"); +// // create a query +// Query theQuery = currentSession.createQuery("from RealTimeUserInfo", RealTimeUserInfo.class); +// System.out.println("Reading Query"); +// // execute query and get result +// List realTimeUserInfo = theQuery.getResultList(); +// // return the result +// System.out.println("Returning query"); +// return realTimeUserInfo; +// +// } +// +//// @Override +//// public List getAllUserInfo() { +//// // get the current hibernate session +//// Session currentSession = entityManager.unwrap(Session.class); +//// System.out.println("Session Created"); +//// // create a query +//// Query theQuery = currentSession.createQuery("from RealTimeUserInfo", RealTimeUserInfo.class); +//// System.out.println("Reading Query"); +//// // execute query and get result +//// List employees = theQuery.getResultList(); +//// // return the result +//// System.out.println("Returning query"); +//// return employees; +//// } +// +//} diff --git a/src/main/java/com/gcc/biometric/api/GccBioMetricApi/entity/Customer.java b/src/main/java/com/gcc/biometric/api/GccBioMetricApi/entity/Customer.java new file mode 100644 index 0000000..612e0a9 --- /dev/null +++ b/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 +// + "]"; +// } +// +// +// +// +//} diff --git a/src/main/java/com/gcc/biometric/api/GccBioMetricApi/entity/DeviceStatus.java b/src/main/java/com/gcc/biometric/api/GccBioMetricApi/entity/DeviceStatus.java new file mode 100644 index 0000000..f56ab63 --- /dev/null +++ b/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 + "]"; + } + +} diff --git a/src/main/java/com/gcc/biometric/api/GccBioMetricApi/entity/Employee.java b/src/main/java/com/gcc/biometric/api/GccBioMetricApi/entity/Employee.java new file mode 100644 index 0000000..e51bef6 --- /dev/null +++ b/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 + "]"; + } + +} diff --git a/src/main/java/com/gcc/biometric/api/GccBioMetricApi/entity/HeadQuaterEntries.java b/src/main/java/com/gcc/biometric/api/GccBioMetricApi/entity/HeadQuaterEntries.java new file mode 100644 index 0000000..4a4645e --- /dev/null +++ b/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 + "]"; + } + + + + + +} diff --git a/src/main/java/com/gcc/biometric/api/GccBioMetricApi/entity/MachineRawPunchh.java b/src/main/java/com/gcc/biometric/api/GccBioMetricApi/entity/MachineRawPunchh.java new file mode 100644 index 0000000..c99552c --- /dev/null +++ b/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 + "]"; + } + + + +} diff --git a/src/main/java/com/gcc/biometric/api/GccBioMetricApi/entity/RealTimeUserInfo.java b/src/main/java/com/gcc/biometric/api/GccBioMetricApi/entity/RealTimeUserInfo.java new file mode 100644 index 0000000..73d8ed6 --- /dev/null +++ b/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 + "]"; + } + + + + + +} diff --git a/src/main/java/com/gcc/biometric/api/GccBioMetricApi/entity/ZoneDivMaster.java b/src/main/java/com/gcc/biometric/api/GccBioMetricApi/entity/ZoneDivMaster.java new file mode 100644 index 0000000..ab31bf9 --- /dev/null +++ b/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 zones =new HashMap<>(Map.of(1,"zone_1")); +// zones.put(2,""); + + + } + + +} diff --git a/src/main/java/com/gcc/biometric/api/GccBioMetricApi/exception/CustomizedResponseEntityExceptionHandler.java b/src/main/java/com/gcc/biometric/api/GccBioMetricApi/exception/CustomizedResponseEntityExceptionHandler.java new file mode 100644 index 0000000..b11396a --- /dev/null +++ b/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 handleAllException(Exception ex, WebRequest request) + throws Exception { + + ExceptionResponse errorDetails = new ExceptionResponse(LocalDateTime.now(), ex.getMessage(), + request.getDescription(false)); + + return new ResponseEntity(errorDetails, HttpStatus.INTERNAL_SERVER_ERROR); + } + + // Only for UserNotFound + // In above method we replaced Response entity to ErrorDetail to remove + // warning +// @ExceptionHandler(UserNotFoundException.class) +// public final ResponseEntity 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); +// } + +} diff --git a/src/main/java/com/gcc/biometric/api/GccBioMetricApi/exception/ExceptionResponse.java b/src/main/java/com/gcc/biometric/api/GccBioMetricApi/exception/ExceptionResponse.java new file mode 100644 index 0000000..78f507c --- /dev/null +++ b/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; + } +} \ No newline at end of file diff --git a/src/main/java/com/gcc/biometric/api/GccBioMetricApi/repo/CustomerRepository.java b/src/main/java/com/gcc/biometric/api/GccBioMetricApi/repo/CustomerRepository.java new file mode 100644 index 0000000..4389ac8 --- /dev/null +++ b/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 { +// +// +// +//} diff --git a/src/main/java/com/gcc/biometric/api/GccBioMetricApi/repo/DeptHQAbsenteesDataRepository.java b/src/main/java/com/gcc/biometric/api/GccBioMetricApi/repo/DeptHQAbsenteesDataRepository.java new file mode 100644 index 0000000..7126695 --- /dev/null +++ b/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 +{ + @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 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 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 rdcAbsenteesUserDesignation(final String dept, final Date date); +} \ No newline at end of file diff --git a/src/main/java/com/gcc/biometric/api/GccBioMetricApi/repo/DeptHeadQuaterOfficeRepository.java b/src/main/java/com/gcc/biometric/api/GccBioMetricApi/repo/DeptHeadQuaterOfficeRepository.java new file mode 100644 index 0000000..0ad0848 --- /dev/null +++ b/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 { + + +// # # # # # # # # # # # # # # # # 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 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 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 getHQDepartmentOfficesAsPerDate(Date date); + + + @Query(value="select distinct c.devname from ZoneDivMaster c where c.division like '%HQ%'") + public ArrayList getAllHQDepartmentOffices(); + +// # # # # # # # # # # # # # # # # Department Office # # # # # # # # # # # # # # # # # # # + + +} diff --git a/src/main/java/com/gcc/biometric/api/GccBioMetricApi/repo/DeviceStatusRepository.java b/src/main/java/com/gcc/biometric/api/GccBioMetricApi/repo/DeviceStatusRepository.java new file mode 100644 index 0000000..b0e3a23 --- /dev/null +++ b/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 { + + + +} diff --git a/src/main/java/com/gcc/biometric/api/GccBioMetricApi/repo/EmployeeRepository.java b/src/main/java/com/gcc/biometric/api/GccBioMetricApi/repo/EmployeeRepository.java new file mode 100644 index 0000000..e754ab0 --- /dev/null +++ b/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 { + + + + @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 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 getEmpCountPresentAbsent(); + +} + + + + + + + + + + + diff --git a/src/main/java/com/gcc/biometric/api/GccBioMetricApi/repo/EnrolledEmpListDataRepository.java b/src/main/java/com/gcc/biometric/api/GccBioMetricApi/repo/EnrolledEmpListDataRepository.java new file mode 100644 index 0000000..83c40b7 --- /dev/null +++ b/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 { + +// ----------------------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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 getEnrolledRDCDesignation(Integer zoneValue); + + + +} diff --git a/src/main/java/com/gcc/biometric/api/GccBioMetricApi/repo/HeadQuaterEntriesRepository.java b/src/main/java/com/gcc/biometric/api/GccBioMetricApi/repo/HeadQuaterEntriesRepository.java new file mode 100644 index 0000000..280a6f3 --- /dev/null +++ b/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 { + + + @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 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 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(); +// + + + + + + +} diff --git a/src/main/java/com/gcc/biometric/api/GccBioMetricApi/repo/MachineRawPunchRepository.java b/src/main/java/com/gcc/biometric/api/GccBioMetricApi/repo/MachineRawPunchRepository.java new file mode 100644 index 0000000..284167f --- /dev/null +++ b/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 { + + + +} diff --git a/src/main/java/com/gcc/biometric/api/GccBioMetricApi/repo/PunchedEmpListDataRepository.java b/src/main/java/com/gcc/biometric/api/GccBioMetricApi/repo/PunchedEmpListDataRepository.java new file mode 100644 index 0000000..aeb3b14 --- /dev/null +++ b/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 { + +// ----------------------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 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 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 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 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 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 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); + + + +} diff --git a/src/main/java/com/gcc/biometric/api/GccBioMetricApi/repo/RDCAbsenteesDataRepository.java b/src/main/java/com/gcc/biometric/api/GccBioMetricApi/repo/RDCAbsenteesDataRepository.java new file mode 100644 index 0000000..ac41a47 --- /dev/null +++ b/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 +{ + @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 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 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 rdcAbsenteesUserDesignation(final Integer zone, final Date date); +} \ No newline at end of file diff --git a/src/main/java/com/gcc/biometric/api/GccBioMetricApi/repo/RealTimeUserInfoRepository.java b/src/main/java/com/gcc/biometric/api/GccBioMetricApi/repo/RealTimeUserInfoRepository.java new file mode 100644 index 0000000..7e9def6 --- /dev/null +++ b/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 { + + + +} diff --git a/src/main/java/com/gcc/biometric/api/GccBioMetricApi/repo/RegionalDeputyCommissionerRepository.java b/src/main/java/com/gcc/biometric/api/GccBioMetricApi/repo/RegionalDeputyCommissionerRepository.java new file mode 100644 index 0000000..3f30f3e --- /dev/null +++ b/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 { + + + + @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 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 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 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(); +// + + + + + + +} diff --git a/src/main/java/com/gcc/biometric/api/GccBioMetricApi/repo/ZonalAbsenteesDataRepository.java b/src/main/java/com/gcc/biometric/api/GccBioMetricApi/repo/ZonalAbsenteesDataRepository.java new file mode 100644 index 0000000..57f8b78 --- /dev/null +++ b/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 +{ + @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 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 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 zonalAbsenteesUserDesignation(final Integer zone, final Date date); +} \ No newline at end of file diff --git a/src/main/java/com/gcc/biometric/api/GccBioMetricApi/repo/ZonalOfficeTotalDataRepository.java b/src/main/java/com/gcc/biometric/api/GccBioMetricApi/repo/ZonalOfficeTotalDataRepository.java new file mode 100644 index 0000000..09383b6 --- /dev/null +++ b/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 { + + + @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 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 getZonalOfficeTotalPunched(Date date); + + +} diff --git a/src/main/java/com/gcc/biometric/api/GccBioMetricApi/repo/ZoneDivisionOfficeAbsenteesDataRepository.java b/src/main/java/com/gcc/biometric/api/GccBioMetricApi/repo/ZoneDivisionOfficeAbsenteesDataRepository.java new file mode 100644 index 0000000..a22a7c7 --- /dev/null +++ b/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 +{ + @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 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 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 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 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 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 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 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 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 lorryAbsenteesUserDesignation(final Integer zone, final Date date); +} \ No newline at end of file diff --git a/src/main/java/com/gcc/biometric/api/GccBioMetricApi/repo/ZoneDivisionOfficeRepository.java b/src/main/java/com/gcc/biometric/api/GccBioMetricApi/repo/ZoneDivisionOfficeRepository.java new file mode 100644 index 0000000..171fdd1 --- /dev/null +++ b/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 { + + +// # # # # # # # # # # # # # # # # 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 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 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 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 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 getDivisionOfficeZoneDivAsPerDate(Integer zoneValue, Date date); + + + @Query(value="select division from ZoneDivMaster c where c.zone= :zoneValue and c.devname like '%DIV%'") + public ArrayList 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 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 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 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 getAllUnitOfficeAsPerZoneAsPerPunched(Integer zoneValue, Date date); + + + @Query(value="select division from ZoneDivMaster c where c.zone=:zoneValue and c.division like '%UNIT%'") + public ArrayList 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 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 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 getZonalOfficeZoneDivAsPerDate(Integer zoneValue, Date date); + + + @Query(value="select devname from ZoneDivMaster c where c.zone= :zoneValue and c.division like '%ZONAL%'") + public ArrayList 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 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 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 getAllZonalOfficesZoneAsPerDate(Date date); + + + @Query(value="select devname from ZoneDivMaster c where c.division like '%ZONAL%'") + public ArrayList 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 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 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 getLorryStationZoneDivAsPerDate(Integer zoneValue, Date date); + + + @Query(value="select division from ZoneDivMaster c where c.zone= :zoneValue and c.devname like '%LORRY%'") + public ArrayList getLorryStationZoneDivisions(Integer zoneValue); + +// # # # # # # # # # # # # # # # # Lorry Station # # # # # # # # # # # # # # # # # # # +} diff --git a/src/main/java/com/gcc/biometric/api/GccBioMetricApi/service/CustomerService.java b/src/main/java/com/gcc/biometric/api/GccBioMetricApi/service/CustomerService.java new file mode 100644 index 0000000..c7b896b --- /dev/null +++ b/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 findAll(); +// +// public Customer findById(String theId); +// +// public void save(Customer theCustomer); +// +// public void deleteById(String thId); +// +//} diff --git a/src/main/java/com/gcc/biometric/api/GccBioMetricApi/service/CustomerServiceImpl.java b/src/main/java/com/gcc/biometric/api/GccBioMetricApi/service/CustomerServiceImpl.java new file mode 100644 index 0000000..c2b2be2 --- /dev/null +++ b/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 findAll() { +// +// return customerRepository.findAll(); +// } +// +// @Transactional +// @Override +// public Customer findById(String theId) { +// +// Optional 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); +// +// } +// +//} diff --git a/src/main/java/com/gcc/biometric/api/GccBioMetricApi/service/DeviceStatusService.java b/src/main/java/com/gcc/biometric/api/GccBioMetricApi/service/DeviceStatusService.java new file mode 100644 index 0000000..c2a1ed7 --- /dev/null +++ b/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 findAll(); + + public DeviceStatus findById(String theId); + + public void save(DeviceStatus theCustomer); + + public void deleteById(String thId); + + public ArrayList zones(); + +} diff --git a/src/main/java/com/gcc/biometric/api/GccBioMetricApi/service/DeviceStatusServiceImpl.java b/src/main/java/com/gcc/biometric/api/GccBioMetricApi/service/DeviceStatusServiceImpl.java new file mode 100644 index 0000000..9c278a9 --- /dev/null +++ b/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 findAll() { + // TODO Auto-generated method stub + return deviceStatusRepository.findAll(); + } + + + @Override + public DeviceStatus findById(String deviceId) { + // TODO Auto-generated method stub +// Optional 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 zones() { + // TODO Auto-generated method stub + return null; + } + +} diff --git a/src/main/java/com/gcc/biometric/api/GccBioMetricApi/service/EmployeeService.java b/src/main/java/com/gcc/biometric/api/GccBioMetricApi/service/EmployeeService.java new file mode 100644 index 0000000..ee9b1eb --- /dev/null +++ b/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 findAll(); + + public Employee findById(String payCode); + + public void save(Employee theEmployee); + + public void deleteById(String payCode); + + + + + + +//////////////////////////////////////Doing it using JPA @Query Annotation//////////////////////////////////////// + + public List getEmpCountPerZone(); + + public List getEmpCountPresentAbsent(); +} diff --git a/src/main/java/com/gcc/biometric/api/GccBioMetricApi/service/EmployeeServiceImpl.java b/src/main/java/com/gcc/biometric/api/GccBioMetricApi/service/EmployeeServiceImpl.java new file mode 100644 index 0000000..925c5df --- /dev/null +++ b/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 findAll() { + return employeeRepository.findAll(); + + } + + @Override + public Employee findById(String payCode) { + + Optional 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 getEmpCountPerZone() { + + return employeeRepository.getEmpCountPerZone(); + } + + @Override + public List getEmpCountPresentAbsent() + { + return employeeRepository.getEmpCountPresentAbsent(); + } + +} diff --git a/src/main/java/com/gcc/biometric/api/GccBioMetricApi/service/HeadQuaterEntriesService.java b/src/main/java/com/gcc/biometric/api/GccBioMetricApi/service/HeadQuaterEntriesService.java new file mode 100644 index 0000000..9135288 --- /dev/null +++ b/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(); +// +//} diff --git a/src/main/java/com/gcc/biometric/api/GccBioMetricApi/service/HeadQuaterEntriesServiceImpl.java b/src/main/java/com/gcc/biometric/api/GccBioMetricApi/service/HeadQuaterEntriesServiceImpl.java new file mode 100644 index 0000000..8dcae45 --- /dev/null +++ b/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(); +// } +// +// +// +// +// +//} diff --git a/src/main/java/com/gcc/biometric/api/GccBioMetricApi/service/MachineRawPunchService.java b/src/main/java/com/gcc/biometric/api/GccBioMetricApi/service/MachineRawPunchService.java new file mode 100644 index 0000000..497775e --- /dev/null +++ b/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 findAll(); + + public MachineRawPunchh findById(String cardNo); + + public void save(MachineRawPunchh theEmployee); + + public void deleteById(String cardNo); + +} diff --git a/src/main/java/com/gcc/biometric/api/GccBioMetricApi/service/MachineRawPunchServiceImpl.java b/src/main/java/com/gcc/biometric/api/GccBioMetricApi/service/MachineRawPunchServiceImpl.java new file mode 100644 index 0000000..3565172 --- /dev/null +++ b/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 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 + + } + + + +} diff --git a/src/main/java/com/gcc/biometric/api/GccBioMetricApi/service/RealTimeUserInfoService.java b/src/main/java/com/gcc/biometric/api/GccBioMetricApi/service/RealTimeUserInfoService.java new file mode 100644 index 0000000..9f0747b --- /dev/null +++ b/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 findAll(); + + public RealTimeUserInfo findById(String userId); + + public void save(RealTimeUserInfo theRealTimeUserInfo); + + public void deleteById(String userId); + +} diff --git a/src/main/java/com/gcc/biometric/api/GccBioMetricApi/service/RealTimeUserInfoServiceImpl.java b/src/main/java/com/gcc/biometric/api/GccBioMetricApi/service/RealTimeUserInfoServiceImpl.java new file mode 100644 index 0000000..564974e --- /dev/null +++ b/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 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 + + } + + +} diff --git a/src/main/java/com/gcc/biometric/api/GccBioMetricApi/service/ZoneDivMasterService.java b/src/main/java/com/gcc/biometric/api/GccBioMetricApi/service/ZoneDivMasterService.java new file mode 100644 index 0000000..dddf580 --- /dev/null +++ b/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 getZoneList(); + +} diff --git a/src/main/java/com/gcc/biometric/api/GccBioMetricApi/service/ZoneDivMasterServiceImpl.java b/src/main/java/com/gcc/biometric/api/GccBioMetricApi/service/ZoneDivMasterServiceImpl.java new file mode 100644 index 0000000..4df16b1 --- /dev/null +++ b/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 getZoneList() { + + //HashSet tempList = zoneDivMasterRepository.getZoneList(); + + return null; + + } + + + +} diff --git a/src/main/java/com/gcc/biometric/api/GccBioMetricApi/swagger/SwaggerConfig.java b/src/main/java/com/gcc/biometric/api/GccBioMetricApi/swagger/SwaggerConfig.java new file mode 100644 index 0000000..2eeac80 --- /dev/null +++ b/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(); +// } +// +//} diff --git a/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000..989a42f --- /dev/null +++ b/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'" +}]} \ No newline at end of file diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties new file mode 100644 index 0000000..b826454 --- /dev/null +++ b/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 \ No newline at end of file diff --git a/src/test/java/com/gcc/biometric/api/GccBioMetricApi/GccAttendanceApplicationTests.java b/src/test/java/com/gcc/biometric/api/GccBioMetricApi/GccAttendanceApplicationTests.java new file mode 100644 index 0000000..5222745 --- /dev/null +++ b/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() { + } + +}