Browse Source

first commit

master
mohammedthaqi 3 years ago
commit
de9cd022d5
  1. BIN
      .DS_Store
  2. BIN
      ._.DS_Store
  3. BIN
      ._.gitignore
  4. BIN
      ._.idea
  5. BIN
      ._.mvn
  6. BIN
      ._HELP.md
  7. BIN
      ._mvnw
  8. BIN
      ._mvnw.cmd
  9. BIN
      ._pom.xml
  10. BIN
      ._src
  11. BIN
      ._target
  12. 33
      .gitignore
  13. BIN
      .mvn/._wrapper
  14. BIN
      .mvn/wrapper/._maven-wrapper.jar
  15. BIN
      .mvn/wrapper/._maven-wrapper.properties
  16. BIN
      .mvn/wrapper/maven-wrapper.jar
  17. 18
      .mvn/wrapper/maven-wrapper.properties
  18. 316
      mvnw
  19. 188
      mvnw.cmd
  20. 140
      pom.xml
  21. BIN
      src/.DS_Store
  22. BIN
      src/._.DS_Store
  23. BIN
      src/._main
  24. BIN
      src/main/.DS_Store
  25. BIN
      src/main/._.DS_Store
  26. BIN
      src/main/._java
  27. BIN
      src/main/._resources
  28. BIN
      src/main/java/.DS_Store
  29. BIN
      src/main/java/._.DS_Store
  30. BIN
      src/main/java/._com
  31. BIN
      src/main/java/com/.DS_Store
  32. BIN
      src/main/java/com/._.DS_Store
  33. BIN
      src/main/java/com/._gcc
  34. BIN
      src/main/java/com/gcc/.DS_Store
  35. BIN
      src/main/java/com/gcc/._.DS_Store
  36. BIN
      src/main/java/com/gcc/._mtm
  37. BIN
      src/main/java/com/gcc/mtm/.DS_Store
  38. BIN
      src/main/java/com/gcc/mtm/._.DS_Store
  39. BIN
      src/main/java/com/gcc/mtm/._Makkalai
  40. BIN
      src/main/java/com/gcc/mtm/Makkalai/.DS_Store
  41. BIN
      src/main/java/com/gcc/mtm/Makkalai/._.DS_Store
  42. BIN
      src/main/java/com/gcc/mtm/Makkalai/._Thedi
  43. BIN
      src/main/java/com/gcc/mtm/Makkalai/Thedi/.DS_Store
  44. BIN
      src/main/java/com/gcc/mtm/Makkalai/Thedi/._.DS_Store
  45. BIN
      src/main/java/com/gcc/mtm/Makkalai/Thedi/._Mayor
  46. BIN
      src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/._MakkalaiThediMayorApplication.java
  47. BIN
      src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/._component
  48. BIN
      src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/._configuration
  49. BIN
      src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/._controller
  50. BIN
      src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/._entity
  51. BIN
      src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/._error
  52. BIN
      src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/._login
  53. BIN
      src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/._others
  54. BIN
      src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/._repository
  55. 14
      src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/MakkalaiThediMayorApplication.java
  56. BIN
      src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/component/._UserSessionInterceptor.java
  57. 74
      src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/component/UserSessionInterceptor.java
  58. BIN
      src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/configuration/._WebConfig.java
  59. 19
      src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/configuration/WebConfig.java
  60. BIN
      src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/controller/._APIController.java
  61. BIN
      src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/controller/._AdminController.java
  62. BIN
      src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/controller/._BlobController.java
  63. BIN
      src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/controller/._MainController.java
  64. BIN
      src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/controller/._MayorController.java
  65. BIN
      src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/controller/._OfficerController.java
  66. 514
      src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/controller/APIController.java
  67. 565
      src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/controller/AdminController.java
  68. 106
      src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/controller/BlobController.java
  69. 1032
      src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/controller/MainController.java
  70. 776
      src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/controller/MayorController.java
  71. 767
      src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/controller/OfficerController.java
  72. BIN
      src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/entity/._MTMComplaintTypes.java
  73. BIN
      src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/entity/._MTMEvents.java
  74. BIN
      src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/entity/._MTMEventsPetition.java
  75. BIN
      src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/entity/._MTMEventsPetitionAction.java
  76. BIN
      src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/entity/._MTMEventsPetitionFiles.java
  77. BIN
      src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/entity/._MTMEventsPetitionForwardLog.java
  78. BIN
      src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/entity/._MTMEventsPetitionMapping.java
  79. BIN
      src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/entity/._MTMUsers.java
  80. BIN
      src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/entity/._OfficerAccess.java
  81. BIN
      src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/entity/._OfficerMaster.java
  82. 76
      src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/entity/MTMComplaintTypes.java
  83. 207
      src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/entity/MTMEvents.java
  84. 170
      src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/entity/MTMEventsPetition.java
  85. 156
      src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/entity/MTMEventsPetitionAction.java
  86. 129
      src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/entity/MTMEventsPetitionFiles.java
  87. 171
      src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/entity/MTMEventsPetitionForwardLog.java
  88. 181
      src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/entity/MTMEventsPetitionMapping.java
  89. 118
      src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/entity/MTMUsers.java
  90. 58
      src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/entity/OfficerAccess.java
  91. 110
      src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/entity/OfficerMaster.java
  92. BIN
      src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/error/._CustomErrorController.java
  93. BIN
      src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/error/._CustomExceptionHandler.java
  94. 35
      src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/error/CustomErrorController.java
  95. 16
      src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/error/CustomExceptionHandler.java
  96. BIN
      src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/login/._CheckUserSession.java
  97. BIN
      src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/login/._LoginController.java
  98. BIN
      src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/login/._UserService.java
  99. BIN
      src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/login/._UserSession.java
  100. 18
      src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/login/CheckUserSession.java

BIN
.DS_Store

BIN
._.DS_Store

BIN
._.gitignore

BIN
._.idea

BIN
._.mvn

BIN
._HELP.md

BIN
._mvnw

BIN
._mvnw.cmd

BIN
._pom.xml

BIN
._src

BIN
._target

33
.gitignore

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

BIN
.mvn/._wrapper

BIN
.mvn/wrapper/._maven-wrapper.jar

BIN
.mvn/wrapper/._maven-wrapper.properties

BIN
.mvn/wrapper/maven-wrapper.jar

18
.mvn/wrapper/maven-wrapper.properties

@ -0,0 +1,18 @@
# 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.
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.7/apache-maven-3.8.7-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar

316
mvnw

@ -0,0 +1,316 @@
#!/bin/sh
# ----------------------------------------------------------------------------
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
# ----------------------------------------------------------------------------
# ----------------------------------------------------------------------------
# Maven Start Up Batch script
#
# Required ENV vars:
# ------------------
# JAVA_HOME - location of a JDK home dir
#
# Optional ENV vars
# -----------------
# M2_HOME - location of maven2's installed home dir
# MAVEN_OPTS - parameters passed to the Java VM when running Maven
# e.g. to debug Maven itself, use
# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
# MAVEN_SKIP_RC - flag to disable loading of mavenrc files
# ----------------------------------------------------------------------------
if [ -z "$MAVEN_SKIP_RC" ] ; then
if [ -f /usr/local/etc/mavenrc ] ; then
. /usr/local/etc/mavenrc
fi
if [ -f /etc/mavenrc ] ; then
. /etc/mavenrc
fi
if [ -f "$HOME/.mavenrc" ] ; then
. "$HOME/.mavenrc"
fi
fi
# OS specific support. $var _must_ be set to either true or false.
cygwin=false;
darwin=false;
mingw=false
case "`uname`" in
CYGWIN*) cygwin=true ;;
MINGW*) mingw=true;;
Darwin*) darwin=true
# Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
# See https://developer.apple.com/library/mac/qa/qa1170/_index.html
if [ -z "$JAVA_HOME" ]; then
if [ -x "/usr/libexec/java_home" ]; then
export JAVA_HOME="`/usr/libexec/java_home`"
else
export JAVA_HOME="/Library/Java/Home"
fi
fi
;;
esac
if [ -z "$JAVA_HOME" ] ; then
if [ -r /etc/gentoo-release ] ; then
JAVA_HOME=`java-config --jre-home`
fi
fi
if [ -z "$M2_HOME" ] ; then
## resolve links - $0 may be a link to maven's home
PRG="$0"
# need this for relative symlinks
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG="`dirname "$PRG"`/$link"
fi
done
saveddir=`pwd`
M2_HOME=`dirname "$PRG"`/..
# make it fully qualified
M2_HOME=`cd "$M2_HOME" && pwd`
cd "$saveddir"
# echo Using m2 at $M2_HOME
fi
# For Cygwin, ensure paths are in UNIX format before anything is touched
if $cygwin ; then
[ -n "$M2_HOME" ] &&
M2_HOME=`cygpath --unix "$M2_HOME"`
[ -n "$JAVA_HOME" ] &&
JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
[ -n "$CLASSPATH" ] &&
CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
fi
# For Mingw, ensure paths are in UNIX format before anything is touched
if $mingw ; then
[ -n "$M2_HOME" ] &&
M2_HOME="`(cd "$M2_HOME"; pwd)`"
[ -n "$JAVA_HOME" ] &&
JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
fi
if [ -z "$JAVA_HOME" ]; then
javaExecutable="`which javac`"
if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
# readlink(1) is not available as standard on Solaris 10.
readLink=`which readlink`
if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
if $darwin ; then
javaHome="`dirname \"$javaExecutable\"`"
javaExecutable="`cd \"$javaHome\" && pwd -P`/javac"
else
javaExecutable="`readlink -f \"$javaExecutable\"`"
fi
javaHome="`dirname \"$javaExecutable\"`"
javaHome=`expr "$javaHome" : '\(.*\)/bin'`
JAVA_HOME="$javaHome"
export JAVA_HOME
fi
fi
fi
if [ -z "$JAVACMD" ] ; then
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
else
JAVACMD="`\\unset -f command; \\command -v java`"
fi
fi
if [ ! -x "$JAVACMD" ] ; then
echo "Error: JAVA_HOME is not defined correctly." >&2
echo " We cannot execute $JAVACMD" >&2
exit 1
fi
if [ -z "$JAVA_HOME" ] ; then
echo "Warning: JAVA_HOME environment variable is not set."
fi
CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
# traverses directory structure from process work directory to filesystem root
# first directory with .mvn subdirectory is considered project base directory
find_maven_basedir() {
if [ -z "$1" ]
then
echo "Path not specified to find_maven_basedir"
return 1
fi
basedir="$1"
wdir="$1"
while [ "$wdir" != '/' ] ; do
if [ -d "$wdir"/.mvn ] ; then
basedir=$wdir
break
fi
# workaround for JBEAP-8937 (on Solaris 10/Sparc)
if [ -d "${wdir}" ]; then
wdir=`cd "$wdir/.."; pwd`
fi
# end of workaround
done
echo "${basedir}"
}
# concatenates all lines of a file
concat_lines() {
if [ -f "$1" ]; then
echo "$(tr -s '\n' ' ' < "$1")"
fi
}
BASE_DIR=`find_maven_basedir "$(pwd)"`
if [ -z "$BASE_DIR" ]; then
exit 1;
fi
##########################################################################################
# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
# This allows using the maven wrapper in projects that prohibit checking in binary data.
##########################################################################################
if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then
if [ "$MVNW_VERBOSE" = true ]; then
echo "Found .mvn/wrapper/maven-wrapper.jar"
fi
else
if [ "$MVNW_VERBOSE" = true ]; then
echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..."
fi
if [ -n "$MVNW_REPOURL" ]; then
jarUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
else
jarUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
fi
while IFS="=" read key value; do
case "$key" in (wrapperUrl) jarUrl="$value"; break ;;
esac
done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties"
if [ "$MVNW_VERBOSE" = true ]; then
echo "Downloading from: $jarUrl"
fi
wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar"
if $cygwin; then
wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"`
fi
if command -v wget > /dev/null; then
if [ "$MVNW_VERBOSE" = true ]; then
echo "Found wget ... using wget"
fi
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
wget "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
else
wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
fi
elif command -v curl > /dev/null; then
if [ "$MVNW_VERBOSE" = true ]; then
echo "Found curl ... using curl"
fi
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
curl -o "$wrapperJarPath" "$jarUrl" -f
else
curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f
fi
else
if [ "$MVNW_VERBOSE" = true ]; then
echo "Falling back to using Java to download"
fi
javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java"
# For Cygwin, switch paths to Windows format before running javac
if $cygwin; then
javaClass=`cygpath --path --windows "$javaClass"`
fi
if [ -e "$javaClass" ]; then
if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
if [ "$MVNW_VERBOSE" = true ]; then
echo " - Compiling MavenWrapperDownloader.java ..."
fi
# Compiling the Java class
("$JAVA_HOME/bin/javac" "$javaClass")
fi
if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
# Running the downloader
if [ "$MVNW_VERBOSE" = true ]; then
echo " - Running MavenWrapperDownloader.java ..."
fi
("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR")
fi
fi
fi
fi
##########################################################################################
# End of extension
##########################################################################################
export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}
if [ "$MVNW_VERBOSE" = true ]; then
echo $MAVEN_PROJECTBASEDIR
fi
MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
# For Cygwin, switch paths to Windows format before running java
if $cygwin; then
[ -n "$M2_HOME" ] &&
M2_HOME=`cygpath --path --windows "$M2_HOME"`
[ -n "$JAVA_HOME" ] &&
JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
[ -n "$CLASSPATH" ] &&
CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
[ -n "$MAVEN_PROJECTBASEDIR" ] &&
MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
fi
# Provide a "standardized" way to retrieve the CLI args that will
# work with both Windows and non-Windows executions.
MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@"
export MAVEN_CMD_LINE_ARGS
WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
exec "$JAVACMD" \
$MAVEN_OPTS \
$MAVEN_DEBUG_OPTS \
-classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
"-Dmaven.home=${M2_HOME}" \
"-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"

188
mvnw.cmd

@ -0,0 +1,188 @@
@REM ----------------------------------------------------------------------------
@REM Licensed to the Apache Software Foundation (ASF) under one
@REM or more contributor license agreements. See the NOTICE file
@REM distributed with this work for additional information
@REM regarding copyright ownership. The ASF licenses this file
@REM to you under the Apache License, Version 2.0 (the
@REM "License"); you may not use this file except in compliance
@REM with the License. You may obtain a copy of the License at
@REM
@REM https://www.apache.org/licenses/LICENSE-2.0
@REM
@REM Unless required by applicable law or agreed to in writing,
@REM software distributed under the License is distributed on an
@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@REM KIND, either express or implied. See the License for the
@REM specific language governing permissions and limitations
@REM under the License.
@REM ----------------------------------------------------------------------------
@REM ----------------------------------------------------------------------------
@REM Maven Start Up Batch script
@REM
@REM Required ENV vars:
@REM JAVA_HOME - location of a JDK home dir
@REM
@REM Optional ENV vars
@REM M2_HOME - location of maven2's installed home dir
@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending
@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
@REM e.g. to debug Maven itself, use
@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
@REM ----------------------------------------------------------------------------
@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
@echo off
@REM set title of command window
title %0
@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on'
@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
@REM set %HOME% to equivalent of $HOME
if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
@REM Execute a user defined script before this one
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
@REM check for pre script, once with legacy .bat ending and once with .cmd ending
if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %*
if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %*
:skipRcPre
@setlocal
set ERROR_CODE=0
@REM To isolate internal variables from possible post scripts, we use another setlocal
@setlocal
@REM ==== START VALIDATION ====
if not "%JAVA_HOME%" == "" goto OkJHome
echo.
echo Error: JAVA_HOME not found in your environment. >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error
:OkJHome
if exist "%JAVA_HOME%\bin\java.exe" goto init
echo.
echo Error: JAVA_HOME is set to an invalid directory. >&2
echo JAVA_HOME = "%JAVA_HOME%" >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error
@REM ==== END VALIDATION ====
:init
@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
@REM Fallback to current working directory if not found.
set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
set EXEC_DIR=%CD%
set WDIR=%EXEC_DIR%
:findBaseDir
IF EXIST "%WDIR%"\.mvn goto baseDirFound
cd ..
IF "%WDIR%"=="%CD%" goto baseDirNotFound
set WDIR=%CD%
goto findBaseDir
:baseDirFound
set MAVEN_PROJECTBASEDIR=%WDIR%
cd "%EXEC_DIR%"
goto endDetectBaseDir
:baseDirNotFound
set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
cd "%EXEC_DIR%"
:endDetectBaseDir
IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
@setlocal EnableExtensions EnableDelayedExpansion
for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
:endReadAdditionalConfig
SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B
)
@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
@REM This allows using the maven wrapper in projects that prohibit checking in binary data.
if exist %WRAPPER_JAR% (
if "%MVNW_VERBOSE%" == "true" (
echo Found %WRAPPER_JAR%
)
) else (
if not "%MVNW_REPOURL%" == "" (
SET DOWNLOAD_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
)
if "%MVNW_VERBOSE%" == "true" (
echo Couldn't find %WRAPPER_JAR%, downloading it ...
echo Downloading from: %DOWNLOAD_URL%
)
powershell -Command "&{"^
"$webclient = new-object System.Net.WebClient;"^
"if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
"$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
"}"^
"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^
"}"
if "%MVNW_VERBOSE%" == "true" (
echo Finished downloading %WRAPPER_JAR%
)
)
@REM End of extension
@REM Provide a "standardized" way to retrieve the CLI args that will
@REM work with both Windows and non-Windows executions.
set MAVEN_CMD_LINE_ARGS=%*
%MAVEN_JAVA_EXE% ^
%JVM_CONFIG_MAVEN_PROPS% ^
%MAVEN_OPTS% ^
%MAVEN_DEBUG_OPTS% ^
-classpath %WRAPPER_JAR% ^
"-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^
%WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
if ERRORLEVEL 1 goto error
goto end
:error
set ERROR_CODE=1
:end
@endlocal & set ERROR_CODE=%ERROR_CODE%
if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost
@REM check for post script, once with legacy .bat ending and once with .cmd ending
if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat"
if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd"
:skipRcPost
@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
if "%MAVEN_BATCH_PAUSE%"=="on" pause
if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE%
cmd /C exit /B %ERROR_CODE%

140
pom.xml

@ -0,0 +1,140 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.0.4</version>
<relativePath/>
</parent>
<groupId>com.gcc.mtm</groupId>
<artifactId>Makkalai-Thedi-Mayor</artifactId>
<version>1</version>
<name>Makkalai-Thedi-Mayor</name>
<description>Makkalai Thedi Mayor</description>
<properties>
<java.version>19</java.version> <!-- Updated Java version to 19 -->
</properties>
<dependencies>
<!-- Other dependencies -->
<!--
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
<version>2.5.5</version>
</dependency>
-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.kafka</groupId>
<artifactId>spring-kafka</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.session</groupId>
<artifactId>spring-session-core</artifactId>
</dependency>
<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20210307</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.9</version>
</dependency>
<dependency>
<groupId>org.apache.tika</groupId>
<artifactId>tika-core</artifactId>
<version>1.28</version> <!-- Updated Tika version -->
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
<version>5.0.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
<version>4.0.3</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>1.3.2</version>
</dependency>
<!-- Apache POI dependencies for working with Excel -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>4.1.2</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>4.1.2</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-text</artifactId>
<version>1.9</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>17</source> <!-- Updated source and target versions to 17 -->
<target>17</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>3.1.0</version> <!-- Updated plugin version -->
<configuration>
<!-- Configuration options for the plugin -->
</configuration>
</plugin>
</plugins>
</build>
</project>

BIN
src/.DS_Store

BIN
src/._.DS_Store

BIN
src/._main

BIN
src/main/.DS_Store

BIN
src/main/._.DS_Store

BIN
src/main/._java

BIN
src/main/._resources

BIN
src/main/java/.DS_Store

BIN
src/main/java/._.DS_Store

BIN
src/main/java/._com

BIN
src/main/java/com/.DS_Store

BIN
src/main/java/com/._.DS_Store

BIN
src/main/java/com/._gcc

BIN
src/main/java/com/gcc/.DS_Store

BIN
src/main/java/com/gcc/._.DS_Store

BIN
src/main/java/com/gcc/._mtm

BIN
src/main/java/com/gcc/mtm/.DS_Store

BIN
src/main/java/com/gcc/mtm/._.DS_Store

BIN
src/main/java/com/gcc/mtm/._Makkalai

BIN
src/main/java/com/gcc/mtm/Makkalai/.DS_Store

BIN
src/main/java/com/gcc/mtm/Makkalai/._.DS_Store

BIN
src/main/java/com/gcc/mtm/Makkalai/._Thedi

BIN
src/main/java/com/gcc/mtm/Makkalai/Thedi/.DS_Store

BIN
src/main/java/com/gcc/mtm/Makkalai/Thedi/._.DS_Store

BIN
src/main/java/com/gcc/mtm/Makkalai/Thedi/._Mayor

BIN
src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/._MakkalaiThediMayorApplication.java

BIN
src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/._component

BIN
src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/._configuration

BIN
src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/._controller

BIN
src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/._entity

BIN
src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/._error

BIN
src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/._login

BIN
src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/._others

BIN
src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/._repository

14
src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/MakkalaiThediMayorApplication.java

@ -0,0 +1,14 @@
package com.gcc.mtm.Makkalai.Thedi.Mayor;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class MakkalaiThediMayorApplication {
public static void main(String[] args) {
SpringApplication.run(MakkalaiThediMayorApplication.class, args);
}
}

BIN
src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/component/._UserSessionInterceptor.java

74
src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/component/UserSessionInterceptor.java

@ -0,0 +1,74 @@
package com.gcc.mtm.Makkalai.Thedi.Mayor.component;
import com.gcc.mtm.Makkalai.Thedi.Mayor.login.UserSession;
import com.gcc.mtm.Makkalai.Thedi.Mayor.others.AppConfig;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.HandlerInterceptor;
import jakarta.servlet.http.HttpSession;
import java.util.Arrays;
import java.util.Enumeration;
import java.util.List;
@Component
public class UserSessionInterceptor implements HandlerInterceptor {
@Autowired
private HttpSession session;
@Autowired
private UserSession userSession;
@Autowired
private AppConfig appConfig;
private static final List<String> EXCLUDED_URLS = Arrays.asList("/public","/login", "/");
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
// Get the current request URL
String requestUrl = request.getRequestURI();
//System.out.println(requestUrl);
// Exclude static resources from the check
if (requestUrl.startsWith("/assets/") || requestUrl.startsWith("/css/") || requestUrl.startsWith("/js/") || requestUrl.startsWith("/images/") || requestUrl.startsWith("/api/")) {
return true; // Allow the request to proceed without checking the login status
}
if (requestUrl.startsWith("/public/")) {
return true; // Allow the request to proceed without checking the login status
}
// Exclude the login page from the check
// Exclude specific URLs from the check
if (EXCLUDED_URLS.contains(requestUrl)) {
return true; // Allow the request to proceed without checking the login status
}
// Check if the user is logged in
// If logged in, add the userSession to the model
// Return true to allow the request to proceed
//if (isLoggedIn()) {
//HttpSession session = request.getSession();
Enumeration<String> attributeNames = session.getAttributeNames();
while (attributeNames.hasMoreElements()) {
String attributeName = attributeNames.nextElement();
Object attributeValue = session.getAttribute(attributeName);
//System.out.println(attributeName + " : " + attributeValue);
}
//System.out.println("Session"+request.getRequestURI());
//System.out.println("My Session Check"+session.getAttribute("userId"));
//System.out.println("Check Session:"+request.getSession().getAttribute("userId"));
if(userSession.getUserId() != null && userSession.getUserType() != null){
request.setAttribute("userSession", userSession);
} else {
request.setAttribute("title", "Login");
request.setAttribute("baseURL", appConfig.getBaseUrl());
response.sendRedirect("/login");
return false; // Stop further processing of the request
}
return true; // Allow the request to proceed
}
private boolean isLoggedIn() {
// Implement your login check logic here
// For example, check if the userSession contains the necessary information
return userSession.getUserId() != null && userSession.getUserType() != null;
}
}

BIN
src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/configuration/._WebConfig.java

19
src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/configuration/WebConfig.java

@ -0,0 +1,19 @@
package com.gcc.mtm.Makkalai.Thedi.Mayor.configuration;
import com.gcc.mtm.Makkalai.Thedi.Mayor.component.UserSessionInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
public class WebConfig implements WebMvcConfigurer {
@Autowired
private UserSessionInterceptor userSessionInterceptor;
@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(userSessionInterceptor);
}
}

BIN
src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/controller/._APIController.java

BIN
src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/controller/._AdminController.java

BIN
src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/controller/._BlobController.java

BIN
src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/controller/._MainController.java

BIN
src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/controller/._MayorController.java

BIN
src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/controller/._OfficerController.java

514
src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/controller/APIController.java

@ -0,0 +1,514 @@
package com.gcc.mtm.Makkalai.Thedi.Mayor.controller;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.gcc.mtm.Makkalai.Thedi.Mayor.entity.*;
import com.gcc.mtm.Makkalai.Thedi.Mayor.login.UserSession;
import com.gcc.mtm.Makkalai.Thedi.Mayor.others.AppConfig;
import com.gcc.mtm.Makkalai.Thedi.Mayor.repository.*;
import org.apache.kafka.common.protocol.types.Field;
import org.apache.tika.utils.SystemUtils;
import org.json.JSONArray;
import org.json.JSONObject;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.multipart.MultipartFile;
import javax.sql.rowset.serial.SerialBlob;
import java.io.IOException;
import java.net.URI;
import java.sql.Blob;
import java.sql.SQLException;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
import org.springframework.core.env.Environment;
@RequestMapping("/api")
@RestController
public class APIController {
@Autowired
private AppConfig appConfig;
private final UserSession userSession;
@Autowired
public APIController(UserSession userSession) {
this.userSession = userSession;
}
@Autowired
private MTMUsersRep mtmUsersRep;
@Autowired
private MTMEventsRep mtmEventsRep;
@Autowired
private MTMComplaintTypesRep mtmComplaintTypesRep;
@Autowired
private OfficerMasterRep officerMasterRep;
@Autowired
private MTMEventsPetitionRep mtmEventsPetitionRep;
@Autowired
private MTMEventsPetitionFilesRep mtmEventsPetitionFilesRep;
@Autowired
private MTMEventsPetitionMappingRep mtmEventsPetitionMappingRep;
@Autowired
private MTMEventsPetitionForwardLogRep mtmEventsPetitionForwardLogRep;
@Autowired
private MTMEventsPetitionActionRep mtmEventsPetitionActionRep;
@Autowired
private OfficerAccessRep officerAccessRep;
@Autowired
private Environment environment;
@GetMapping(value = "/sendOTP")
public String sendOtp(HttpServletRequest request, @RequestParam String mobileNo) {
String MobileNo=mobileNo;
System.out.print("\n MobileNo---:"+mobileNo);
Random rand = new Random();
int otp = rand.nextInt(90000) + 10000;
System.out.print("\n otp---:"+otp);
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("dd-MMM-yyyy%20HH:mm");
LocalDateTime now = LocalDateTime.now();
System.out.println(dtf.format(now));
//String generatedToken = "OTP%20for%20GREATER%20CHENNAI%20CORPORATION%20ERP%20Login%20for%20AELD31%20on%20" + dtf.format(now) + "%20is%20%20" + otp + "%20Do%20not%20share%20it%20with%20anyone";
String generatedToken = "Welcome to GCC "+otp+" is your OTP for gcc QR System";
//String urlString=appConfig.getGetOtpUrl()+"user=GCCtrans&authkey=92kOC1RBGBIws&sender=GCCCRP&mobile="+MobileNo+"&text="+generatedToken+"&rpt=1&summary=1&output=json&entityid=1401572690000011081&templateid=1407161640444625990";
String urlString=appConfig.getGetOtpUrl()+"user=GCCtrans&authkey=92kOC1RBGBIws&sender=GCCCRP&mobile="+MobileNo+"&text="+generatedToken+"&rpt=1&summary=1&output=json&entityid=1401572690000011081&templateid=1407168250479102852";
System.out.print("\n urlString---: "+urlString);
ResponseEntity<String> response = null;
RestTemplate restTemplate = new RestTemplate();
String bodyMessage = "";
HttpHeaders headers = new HttpHeaders();
try {
HttpEntity<String> postData = new HttpEntity<String>(headers);
response = restTemplate.exchange(urlString, HttpMethod.POST, postData, String.class);
bodyMessage = response.getBody();
System.out.println("\n bodyMessage"+bodyMessage);
} catch (Exception e) {
// e.printStackTrace();
System.out.print("ERROR---: "+e);
bodyMessage = "Error";
}
System.out.println("OTP sent successfully!");
HttpSession session = request.getSession();
session.setAttribute("otp", otp);
return bodyMessage;
}
@GetMapping(value = "/verifyOTP")
public String verifyOtp(HttpServletRequest request, @RequestParam String otp) {
HttpSession session = request.getSession();
try {
Integer session_otp = (Integer) session.getAttribute("otp");
System.out.println("session_otp---:" + session_otp);
Integer entered_otp = Integer.parseInt(otp);
if (session_otp != null && session_otp.equals(entered_otp)) {
System.out.println("Entered OTP Correct");
session.setAttribute("verifiedotp", "success");
return "Success";
} else {
System.out.println("Incorrect OTP. Please enter correct OTPs.");
session.setAttribute("verifiedotp", "error");
return "Error";
}
} catch (NumberFormatException e) {
System.out.println("Invalid OTP format: " + otp);
return "Error";
} catch (Exception e) {
System.out.println("Error verifying OTP: " + e.getMessage());
return "Error";
}
}
@GetMapping(value = "/login")
public String login(HttpServletRequest request, @RequestParam String uname, @RequestParam String upass){
//System.out.println(uname);
System.out.println("API Session"+request.getRequestURI());
List<MTMUsers> mtmUsersList = mtmUsersRep.login(uname,upass);
if (!mtmUsersList.isEmpty()) {
if (mtmUsersList.size() == 1) {
//request.getSession().setAttribute("attributeName", attributeValue);
request.getSession().setAttribute("userId",mtmUsersList.get(0).getuId());
request.getSession().setAttribute("usertype",mtmUsersList.get(0).getUserType());
System.out.println(request.getSession().getAttribute("userId"));
userSession.setUserId(mtmUsersList.get(0).getuId());
userSession.setUserType(mtmUsersList.get(0).getUserType());
userSession.setDispayName(mtmUsersList.get(0).getDisplayName());
userSession.setTableNo(mtmUsersList.get(0).getTableNum());
System.out.println(mtmUsersList.get(0).getUserType());
if (!mtmUsersList.isEmpty() && mtmUsersList.get(0).getUserType().equals("user")) {
userSession.setEventid(mtmUsersList.get(0).getEventid());
}
else if(!mtmUsersList.isEmpty() && mtmUsersList.get(0).getUserType().equals("officer")){
List<OfficerAccess> officerAccesses = officerAccessRep.getAccessOfficerIDs(mtmUsersList.get(0).getuId());
if(officerAccesses.isEmpty()){
return "Error";
}
else{
//System.out.println(officerAccesses.get(0).getOfficerId());
userSession.setAccessIds(officerAccesses.get(0).getOfficerId());
}
}
System.out.println(mtmUsersList.get(0).getuId());
System.out.println(environment.getProperty("server.servlet.session.cookie.domain"));
//System.out.println("Success");
return "Success";
} else {
//System.out.println("Error");
return "Error";
}
}else{
return "Error";
}
}
//Access Details
@GetMapping(value = "/officerAccessid")
public List officerAccessId(@RequestParam Integer uid){
return officerAccessRep.getAccessOfficerIDs(uid);
}
// Event
@GetMapping(value = "/eventsbyid")
public List eventById(@RequestParam String eid){
return mtmEventsRep.eventsByID(eid);
}
// Petition
@GetMapping(value="/complainttypes")
public List complaintTypesAPI(){
return mtmComplaintTypesRep.showAll();
}
@GetMapping(value="/petitions")
public List petitionListAPI(){
return mtmEventsPetitionRep.showAll();
}
@GetMapping(value="/petitionbyid")
public List petitionById(HttpServletRequest request,@RequestParam String pid) {
return mtmEventsPetitionRep.petitionById(pid);
}
@GetMapping(value="/petitionbyno")
public List petitionByNO(HttpServletRequest request,@RequestParam String pno){
return mtmEventsPetitionRep.petitionByNo(pno);
}
@GetMapping(value="/petitionFilesBypetitionId")
public List petitionByPetitionId(HttpServletRequest request,@RequestParam String pid){
return mtmEventsPetitionFilesRep.ShowFilesByPetitionId(pid);
}
@GetMapping(value="/officerMaster")
public List officerMaster(HttpServletRequest request){
return officerMasterRep.showAll();
}
@RequestMapping(value = "/savePetitionFile", method = RequestMethod.POST)
public String savePetitionFile(HttpServletRequest request,
@RequestParam(required = false) MultipartFile san_page1,
@RequestParam(required = false) MultipartFile san_page2,
@RequestParam(required = false) MultipartFile san_page3,
@RequestParam(required = false) MultipartFile san_page4,@RequestParam("petitionId") Integer petitionId,
@RequestParam("petitionNo") String petitionNo) throws IOException, SQLException {
LocalDateTime cdate = LocalDateTime.now();
MTMEventsPetition mtmEventsPetition = new MTMEventsPetition();
mtmEventsPetition.setPetitionId(petitionId);
String fileName="";
for (int i = 1; i <= 4; i++) {
MultipartFile file = null;
switch (i) {
case 1:
file = san_page1;
fileName = "Page1-";
break;
case 2:
file = san_page2;
fileName = "Page-";
break;
case 3:
file = san_page3;
fileName = "Page3-";
break;
case 4:
file = san_page4;
fileName = "Page4-";
break;
}
if (file != null && !file.isEmpty()) {
MTMEventsPetitionFiles petitionFiles = new MTMEventsPetitionFiles();
petitionFiles.setFileName(fileName + file.getOriginalFilename());
petitionFiles.setFileSize(file.getSize());
petitionFiles.setFileType(file.getContentType());
byte[] fileBytes = file.getBytes();
Blob fileBlob = new SerialBlob(fileBytes);
petitionFiles.setData(fileBlob);
petitionFiles.setMtmEventsPetitionId(mtmEventsPetition);
petitionFiles.setPetitionNumber(petitionNo);
petitionFiles.setcDate(cdate);
petitionFiles.setCreatedBy(userSession.getUserId());
mtmEventsPetitionFilesRep.save(petitionFiles);
}
}
return "Success";
}
@GetMapping(value="/getPetitionStatusPublic")
public List getPetitionStatusByNo(HttpServletRequest request,
@RequestParam("petition_no") String petition_no){
List<MTMEventsPetition> mtmEventsPetitionList = mtmEventsPetitionRep.petitionByNo(petition_no);
return mtmEventsPetitionList;
}
@GetMapping(value="/getComplaintsMappingDetails")
public List getComplaintsMappingDetailsById(HttpServletRequest request,
@RequestParam("complaint_typeid") String complaint_typeid,
@RequestParam("petition_id") String petition_id){
List<MTMEventsPetitionMapping> mtmEventsPetitionMappingList = mtmEventsPetitionMappingRep.getPetionMapByComplaintId(complaint_typeid,petition_id);
return mtmEventsPetitionMappingList;
}
@GetMapping(value="/setEventId")
public String setEventId(HttpServletRequest request,
@RequestParam("eventid") String eventid){
if ("0".equals(eventid)) {
userSession.setEventid(null);
}else{
userSession.setEventid(eventid);
}
return "success";
}
@GetMapping(value="/getComMappingDetailsByMapId")
public List getComMappingDetailsByMapId(HttpServletRequest request,
@RequestParam("mapid") String mapid){
/* List<MTMEventsPetitionMapping> mtmEventsPetitionMappingList = mtmEventsPetitionMappingRep.getComMappingDetailsByMapId(mapid);
return mtmEventsPetitionMappingList;*/
List<MTMEventsPetitionMapping> mtmEventsPetitionMappingList = mtmEventsPetitionMappingRep.getComMappingDetailsByMapId(mapid);
List<OfficerMaster> officerMasterList = officerMasterRep.showAll();
// Create a map of Officer IDs to Officer Names for easy lookup
Map<String, String> officerMap = new HashMap<>();
for (OfficerMaster officer : officerMasterList) {
officerMap.put(officer.getOffId(), officer.getOffNM());
}
for (MTMEventsPetitionMapping mapping : mtmEventsPetitionMappingList) {
String officerId = mapping.getOffID();
String officerName = officerMap.get(officerId);
mapping.setOfficer_name(officerName);
}
return mtmEventsPetitionMappingList;
}
@GetMapping(value="/getComMappingDetailsByPetId")
public List getComMappingDetailsByPetId(HttpServletRequest request,
@RequestParam("petid") String petition_id){
/* List<MTMEventsPetitionMapping> mtmEventsPetitionMappingList = mtmEventsPetitionMappingRep.getComMappingDetailsByMapId(mapid);
return mtmEventsPetitionMappingList;*/
List<MTMEventsPetitionMapping> mtmEventsPetitionMappingList = mtmEventsPetitionMappingRep.getComMappingDetailsByPetId(petition_id);
List<OfficerMaster> officerMasterList = officerMasterRep.showAll();
// Create a map of Officer IDs to Officer Names for easy lookup
Map<String, String> officerMap = new HashMap<>();
for (OfficerMaster officer : officerMasterList) {
officerMap.put(officer.getOffId(), officer.getOffNM());
}
for (MTMEventsPetitionMapping mapping : mtmEventsPetitionMappingList) {
String officerId = mapping.getOffID();
String officerName = officerMap.get(officerId);
mapping.setOfficer_name(officerName);
}
return mtmEventsPetitionMappingList;
}
@GetMapping(value="/getAllComplaintsMappingDetails")
public List getAllComplaintsMappingDetails(HttpServletRequest request){
List<MTMEventsPetitionMapping> mtmEventsPetitionMappingList = mtmEventsPetitionMappingRep.showAll();
List<OfficerMaster> officerMasterList = officerMasterRep.showAll();
// Create a map of Officer IDs to Officer Names for easy lookup
Map<String, String> officerMap = new HashMap<>();
for (OfficerMaster officer : officerMasterList) {
officerMap.put(officer.getOffId(), officer.getOffNM());
}
// Iterate through the mtmEventsPetitionMappingList and add Officer Name
for (MTMEventsPetitionMapping mapping : mtmEventsPetitionMappingList) {
String officerId = mapping.getOffID();
String officerName = officerMap.get(officerId);
mapping.setOfficer_name(officerName);
}
return mtmEventsPetitionMappingList;
}
@GetMapping(value="/getComplaintsMappingDetailsByOfficeID")
public List getComplaintsMappingDetailsById(HttpServletRequest request,
@RequestParam("Officer_ID") String officer_id){
List<MTMEventsPetitionMapping> mtmEventsPetitionMappingList = mtmEventsPetitionMappingRep.getPetionMapByOffId(officer_id);
List<OfficerMaster> officerMasterList = officerMasterRep.showAll();
// Create a map of Officer IDs to Officer Names for easy lookup
Map<String, String> officerMap = new HashMap<>();
for (OfficerMaster officer : officerMasterList) {
officerMap.put(officer.getOffId(), officer.getOffNM());
}
// Iterate through the mtmEventsPetitionMappingList and add Officer Name
for (MTMEventsPetitionMapping mapping : mtmEventsPetitionMappingList) {
String officerId = mapping.getOffID();
String officerName = officerMap.get(officerId);
mapping.setOfficer_name(officerName);
}
return mtmEventsPetitionMappingList;
}
@RequestMapping(value = "/saveComplaintStatus", method = RequestMethod.POST)
public String saveComplaintStatus(HttpServletRequest request,
@RequestParam(required = false) MultipartFile san_page1,
@RequestParam("mapid") Integer mapid,
@RequestParam("comments") String comments
) throws IOException, SQLException, InterruptedException {
LocalDateTime cdate = LocalDateTime.now();
String fileName="";
for (int i = 1; i <= 1; i++) {
MultipartFile file = null;
switch (i) {
case 1:
file = san_page1;
fileName = "Page1-";
break;
}
MTMEventsPetitionAction petitionAction = new MTMEventsPetitionAction();
if (file != null && !file.isEmpty()) {
petitionAction.setFileName(fileName + file.getOriginalFilename());
petitionAction.setFileSize(file.getSize());
petitionAction.setFileType(file.getContentType());
byte[] fileBytes = file.getBytes();
Blob fileBlob = new SerialBlob(fileBytes);
petitionAction.setData(fileBlob);
}
MTMEventsPetitionMapping mapping = mtmEventsPetitionMappingRep.getReferenceById(mapid);
petitionAction.setStatus("close");
petitionAction.setComments(comments);
petitionAction.setMtmEventsPetitionMapping(mapping);
petitionAction.setOffID(mapping.getOffID());
petitionAction.setcDate(cdate.toString());
petitionAction.setCreatedBy(userSession.getUserId());
petitionAction.setIsDelete(false);
petitionAction.setIsActive(true);
List<MTMEventsPetitionMapping> mtmEventsPetitionMappingList=mtmEventsPetitionMappingRep.getComMappingDetailsByMapId(mapid.toString());
if(!mtmEventsPetitionMappingList.isEmpty()){
if(mtmEventsPetitionActionRep.ShowDataByMapId(mapid.toString()).isEmpty()){
mtmEventsPetitionActionRep.save(petitionAction);
}
// close, partial
mtmEventsPetitionMappingRep.UpdateMappingStatus(mapid.toString(),"close");
// Check all complaints are completed then set as `close` in petition table else set as `partial`
List <MTMEventsPetitionMapping>mtmEventsPetitionMappingList1=mtmEventsPetitionMappingRep.getComMappingDetailsByPetId(mtmEventsPetitionMappingList.get(0).getMtmEventsPetitionId().getPetitionId().toString());
//System.out.println(mtmEventsPetitionMappingList.get(0).getMtmEventsPetitionId().getPetitionId().toString());
if(!mtmEventsPetitionMappingList1.isEmpty()) {
if (mtmEventsPetitionMappingList1.size() == 1) {
mtmEventsPetitionRep.updatePetitionStatus(mtmEventsPetitionMappingList.get(0).getMtmEventsPetitionId().getPetitionId().toString(), "close");
}
else {
String updateStatus = "close";
for (MTMEventsPetitionMapping petData : mtmEventsPetitionMappingList1) {
if (!petData.getStatus().equals("close") && mtmEventsPetitionMappingList.get(0).getMapId()!=petData.getMapId()) {
updateStatus = "partial";
}
}
//System.out.println(updateStatus);
mtmEventsPetitionRep.updatePetitionStatus(mtmEventsPetitionMappingList.get(0).getMtmEventsPetitionId().getPetitionId().toString(), updateStatus);
}
//மக்களை தேடி மேயர் தங்களது மனு பரிசீலனை செய்து தீர்வு செய்யப்பட்டுள்ளது
//By GCC
// SMS FOR END USER (Public)
String toMobileNo = mtmEventsPetitionMappingList.get(0).getMtmEventsPetitionId().getPetitionerMobile();
if(toMobileNo.length()==10){
String SMSTEXT = "மக்களை தேடி மேயர் தங்களது மனு பரிசீலனை செய்து தீர்வு செய்யப்பட்டுள்ளது\n"+
"By GCC";
//String urlString=appConfig.getGetOtpUrl()+"user=GCCtrans&authkey=92kOC1RBGBIws&sender=GCCCRP&mobile="+toMobileNo+"&text="+SMSTEXT+"&rpt=1&summary=1&output=json&entityid=1401572690000011081&templateid=1407168595423702047";
String urlString=appConfig.getGetOtpUrl()+"from=GCCCRP&key=qxg4mklD&sender=GCCCRP&to="+toMobileNo+"&body="+SMSTEXT+"&entityid=1401572690000011081&templateid=1407168595423702047";
RestTemplate restTemplate = new RestTemplate();
String Response = restTemplate.getForObject(urlString, String.class);
//System.out.println(Response);
}
}
}
}
return "Success";
}
@GetMapping(value="/getComMappingActionByMapId")
public List getComMappingActionByMapId(HttpServletRequest request,
@RequestParam("mapid") String mapid){
List<OfficerMaster> officerMasterList = officerMasterRep.showAll();
Map<String, String> officerMap = new HashMap<>();
for (OfficerMaster officer : officerMasterList) {
officerMap.put(officer.getOffId(), officer.getOffNM());
}
List<MTMEventsPetitionAction> mtmEventsPetitionActionList = mtmEventsPetitionActionRep.ShowDataByMapId(mapid);
// Iterate through the mtmEventsPetitionMappingList and add Officer Name
for (MTMEventsPetitionAction mapping : mtmEventsPetitionActionList) {
String officerId = mapping.getOffID();
String officerName = officerMap.get(officerId);
mapping.setOfficer_name(officerName);
}
return mtmEventsPetitionActionList;
}
@RequestMapping(value = "/insertForwardLog", method = RequestMethod.POST)
public String insertForwardLog(HttpServletRequest request,
@RequestParam("offidto") String offidto,
@RequestParam("comments") String comments,
@RequestParam("mapid") Integer mapid){
List<MTMEventsPetitionMapping> mtmEventsPetitionMappingList = mtmEventsPetitionMappingRep.getComMappingDetailsByMapId(mapid.toString());
if(!mtmEventsPetitionMappingList.isEmpty()) {
if (mtmEventsPetitionMappingList.size() == 1) {
mtmEventsPetitionForwardLogRep.insertForwardLog(
mtmEventsPetitionMappingList.get(0).getOffID(),
offidto,
mtmEventsPetitionMappingList.get(0).getPetitionNumber(),
mtmEventsPetitionMappingList.get(0).getMtmEventsPetitionId().getPetitionId(),
mtmEventsPetitionMappingList.get(0).getMtmComplaintTypes().getComplaintTypeId(),
mtmEventsPetitionMappingList.get(0).getMtmEvents().getMtmId(),
mapid,
comments);
mtmEventsPetitionMappingRep.updateForward(mapid.toString(),offidto);
}
}
return "success";
}
}

565
src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/controller/AdminController.java

@ -0,0 +1,565 @@
package com.gcc.mtm.Makkalai.Thedi.Mayor.controller;
import com.gcc.mtm.Makkalai.Thedi.Mayor.entity.*;
import com.gcc.mtm.Makkalai.Thedi.Mayor.login.UserSession;
import com.gcc.mtm.Makkalai.Thedi.Mayor.others.AppConfig;
import com.gcc.mtm.Makkalai.Thedi.Mayor.repository.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Controller
public class AdminController {
@Autowired
private AppConfig appConfig;
private final UserSession userSession;
@Autowired
public AdminController(UserSession userSession) {
this.userSession = userSession;
}
//@Autowired
//private UserSession userSession;
@Autowired
private MTMComplaintTypesRep mtmComplaintTypesRep;
@Autowired
private OfficerMasterRep officerMasterRep;
@Autowired
private MTMEventsPetitionRep mtmEventsPetitionRep;
@Autowired
private MTMEventsPetitionFilesRep mtmEventsPetitionFilesRep;
@Autowired
private MTMEventsPetitionMappingRep mtmEventsPetitionMappingRep;
@Autowired
private MTMEventsRep mtmEventsRep;
@Autowired
private MTMUsersRep mtmUsersRep;
@Autowired
private DatabaseInfoRep databaseInfoRep;
@GetMapping("/admin/dashboard")
public String viewDashboard(Model model) {
model.addAttribute("title", "MTM Dashboard");
model.addAttribute("baseURL", appConfig.getBaseUrl());
Long eventCount = mtmEventsRep.getCount();
Long usersCount = mtmUsersRep.getCount();
Long officerCount = mtmUsersRep.getCountByType("officer");
Long mayorCount = mtmUsersRep.getCountByType("mayor");
Long adminCount = mtmUsersRep.getCountByType("admin");
String dbName = databaseInfoRep.getDBName();
Long databaseSize = databaseInfoRep.getDBSize(dbName);
model.addAttribute("eventCount",eventCount);
model.addAttribute("usersCount",usersCount);
model.addAttribute("officerCount",officerCount);
model.addAttribute("mayorCount",mayorCount);
model.addAttribute("adminCount",adminCount);
model.addAttribute("databaseSize",databaseSize);
return "admin/dashboard";
}
@GetMapping("/admin/event-dashboard")
public String viewEventDashboard(Model model) {
model.addAttribute("title", "Count By Complaint Type");
model.addAttribute("baseURL", appConfig.getBaseUrl());
//System.out.println(userSession.getUserId());
Long Petitioncount;
Long PetitionCompletedcount;
Long PetitionPartialcount;
Long ComplaintCompletedcount;
List<MTMEventsPetition> mtmEventsPetitionList;
if(userSession.getEventid() != null && !userSession.getEventid().isEmpty()){
String eventid = userSession.getEventid();
mtmEventsPetitionList = mtmEventsPetitionRep.showAllByMTMID(eventid);
Petitioncount = mtmEventsPetitionRep.getPetitionCountByMTMID(eventid);
PetitionCompletedcount = mtmEventsPetitionRep.getPetitionCompletedCountByMTMID(eventid);
PetitionPartialcount = mtmEventsPetitionRep.getPetitionPartialCountByMTMID(eventid);
ComplaintCompletedcount = mtmEventsPetitionMappingRep.getCompletedCountByMTMID(eventid);
}
else{
mtmEventsPetitionList = mtmEventsPetitionRep.showAll();
Petitioncount = mtmEventsPetitionRep.getPetitionCount();
PetitionCompletedcount = mtmEventsPetitionRep.getPetitionCompletedCount();
PetitionPartialcount = mtmEventsPetitionRep.getPetitionPartialCount();
ComplaintCompletedcount = mtmEventsPetitionMappingRep.getCompletedCount();
}
// Petition
model.addAttribute("Petitioncount", Petitioncount);
model.addAttribute("PetitionCompletedcount", PetitionCompletedcount);
model.addAttribute("PetitionPendingcount", (Petitioncount-PetitionCompletedcount));
model.addAttribute("PetitionPartialcount", PetitionPartialcount);
// Complaints
Integer compliantCount = 0;
Integer totalCompliantTypes = mtmComplaintTypesRep.getComplaintCount()+1;
int[] byCompliantTypes = new int[totalCompliantTypes];
for (MTMEventsPetition petition : mtmEventsPetitionList) {
//System.out.println(petition.getPetitionerComplaint());
String compliant = petition.getPetitionerComplaint();
String[] compliantArray = compliant.split(",");
compliantCount+=compliantArray.length;
for (String compliantId : compliantArray) {
//System.out.println(compliantId);
int compliantIdInt = Integer.parseInt(compliantId);
byCompliantTypes[compliantIdInt]++;
}
}
model.addAttribute("Compliantcount", compliantCount);
model.addAttribute("ComplaintCompletedcount", ComplaintCompletedcount);
model.addAttribute("ComplaintPendingcount", (compliantCount-ComplaintCompletedcount));
List<MTMComplaintTypes> mtmComplaintTypesList = mtmComplaintTypesRep.showAll();
model.addAttribute("complaintTypesList",mtmComplaintTypesList);
model.addAttribute("countByCompliantTypes",byCompliantTypes);
List<MTMEvents> mtmEventsList = mtmEventsRep.showAll();
DateTimeFormatter inputFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
DateTimeFormatter outputFormatter = DateTimeFormatter.ofPattern("dd-MM-yyyy");
for (MTMEvents event : mtmEventsList) {
String eventDateStr = event.getEventDate();
LocalDate eventDate = LocalDate.parse(eventDateStr, inputFormatter);
String formattedEventDate = eventDate.format(outputFormatter);
event.setEventDate(formattedEventDate);
}
model.addAttribute("mtmEventsList",mtmEventsList);
//System.out.println(userSession.getEventid());
return "admin/event-dashboard";
}
@GetMapping("/admin/petition-list")
public String petitionList(Model model) {
model.addAttribute("title","Petition List");
model.addAttribute("baseURL", appConfig.getBaseUrl());
List<MTMEventsPetition> mtmEventsPetitionList;
if(userSession.getEventid() != null && !userSession.getEventid().isEmpty()){
String eventid = userSession.getEventid();
mtmEventsPetitionList = mtmEventsPetitionRep.showAllByMTMID(eventid);
}
else{
mtmEventsPetitionList = mtmEventsPetitionRep.showAll();
}
//model.addAttribute("petitionlist",mtmEventsPetitionList);
List<MTMComplaintTypes> mtmComplaintTypesList = mtmComplaintTypesRep.showAll();
model.addAttribute("complaintTypesList",mtmComplaintTypesList);
List<OfficerMaster> officerMasterList = officerMasterRep.showAll();
// Create a map to store the ID-name mappings from mtmComplaintTypesList
Map<Integer, String> complaintTypesMap = new HashMap<>();
for (MTMComplaintTypes complaintType : mtmComplaintTypesList) {
complaintTypesMap.put(complaintType.getComplaintTypeId(), complaintType.getComplaintType());
}
// Iterate over mtmEventsPetitionList and replace ID values with names
for (MTMEventsPetition petition : mtmEventsPetitionList) {
String[] complaintIds = petition.getPetitionerComplaint().split(",");
StringBuilder complaintNames = new StringBuilder();
for (String complaintId : complaintIds) {
int id = Integer.parseInt(complaintId);
if (complaintTypesMap.containsKey(id)) {
complaintNames.append(complaintTypesMap.get(id)).append(",");
}
}
if (complaintNames.length() > 0) {
complaintNames.deleteCharAt(complaintNames.length() - 1); // Remove the trailing comma
}
petition.setPetitionerComplaint_txt(complaintNames.toString());
}
model.addAttribute("petitionlist", mtmEventsPetitionList);
List<MTMEvents> mtmEventsList = mtmEventsRep.showAll();
DateTimeFormatter inputFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
DateTimeFormatter outputFormatter = DateTimeFormatter.ofPattern("dd-MM-yyyy");
for (MTMEvents event : mtmEventsList) {
String eventDateStr = event.getEventDate();
LocalDate eventDate = LocalDate.parse(eventDateStr, inputFormatter);
String formattedEventDate = eventDate.format(outputFormatter);
event.setEventDate(formattedEventDate);
}
model.addAttribute("mtmEventsList",mtmEventsList);
return "admin/petition-list";
}
@GetMapping("/admin/completed-petition-list")
public String completedPetitionList(Model model) {
String Status = "close";
model.addAttribute("title","Completed Petition List");
model.addAttribute("baseURL", appConfig.getBaseUrl());
List<MTMEventsPetition> mtmEventsPetitionList;
if(userSession.getEventid() != null && !userSession.getEventid().isEmpty()){
String eventid = userSession.getEventid();
mtmEventsPetitionList = mtmEventsPetitionRep.showCompletedByMTMID(eventid,Status);
}
else{
mtmEventsPetitionList = mtmEventsPetitionRep.showCompleted(Status);
}
//model.addAttribute("petitionlist",mtmEventsPetitionList);
List<MTMComplaintTypes> mtmComplaintTypesList = mtmComplaintTypesRep.showAll();
model.addAttribute("complaintTypesList",mtmComplaintTypesList);
List<OfficerMaster> officerMasterList = officerMasterRep.showAll();
// Create a map to store the ID-name mappings from mtmComplaintTypesList
Map<Integer, String> complaintTypesMap = new HashMap<>();
for (MTMComplaintTypes complaintType : mtmComplaintTypesList) {
complaintTypesMap.put(complaintType.getComplaintTypeId(), complaintType.getComplaintType());
}
// Iterate over mtmEventsPetitionList and replace ID values with names
for (MTMEventsPetition petition : mtmEventsPetitionList) {
String[] complaintIds = petition.getPetitionerComplaint().split(",");
StringBuilder complaintNames = new StringBuilder();
for (String complaintId : complaintIds) {
int id = Integer.parseInt(complaintId);
if (complaintTypesMap.containsKey(id)) {
complaintNames.append(complaintTypesMap.get(id)).append(",");
}
}
if (complaintNames.length() > 0) {
complaintNames.deleteCharAt(complaintNames.length() - 1); // Remove the trailing comma
}
petition.setPetitionerComplaint_txt(complaintNames.toString());
}
model.addAttribute("petitionlist", mtmEventsPetitionList);
List<MTMEvents> mtmEventsList = mtmEventsRep.showAll();
DateTimeFormatter inputFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
DateTimeFormatter outputFormatter = DateTimeFormatter.ofPattern("dd-MM-yyyy");
for (MTMEvents event : mtmEventsList) {
String eventDateStr = event.getEventDate();
LocalDate eventDate = LocalDate.parse(eventDateStr, inputFormatter);
String formattedEventDate = eventDate.format(outputFormatter);
event.setEventDate(formattedEventDate);
}
model.addAttribute("mtmEventsList",mtmEventsList);
return "admin/completed-petition-list";
}
@GetMapping("/admin/partial-petition-list")
public String partialPetitionList(Model model) {
String Status = "partial";
model.addAttribute("title","Partially Completed Petition List");
model.addAttribute("baseURL", appConfig.getBaseUrl());
List<MTMEventsPetition> mtmEventsPetitionList;
if(userSession.getEventid() != null && !userSession.getEventid().isEmpty()){
String eventid = userSession.getEventid();
mtmEventsPetitionList = mtmEventsPetitionRep.showCompletedByMTMID(eventid,Status);
}
else{
mtmEventsPetitionList = mtmEventsPetitionRep.showCompleted(Status);
}
//model.addAttribute("petitionlist",mtmEventsPetitionList);
List<MTMComplaintTypes> mtmComplaintTypesList = mtmComplaintTypesRep.showAll();
model.addAttribute("complaintTypesList",mtmComplaintTypesList);
List<OfficerMaster> officerMasterList = officerMasterRep.showAll();
// Create a map to store the ID-name mappings from mtmComplaintTypesList
Map<Integer, String> complaintTypesMap = new HashMap<>();
for (MTMComplaintTypes complaintType : mtmComplaintTypesList) {
complaintTypesMap.put(complaintType.getComplaintTypeId(), complaintType.getComplaintType());
}
// Iterate over mtmEventsPetitionList and replace ID values with names
for (MTMEventsPetition petition : mtmEventsPetitionList) {
String[] complaintIds = petition.getPetitionerComplaint().split(",");
StringBuilder complaintNames = new StringBuilder();
for (String complaintId : complaintIds) {
int id = Integer.parseInt(complaintId);
if (complaintTypesMap.containsKey(id)) {
complaintNames.append(complaintTypesMap.get(id)).append(",");
}
}
if (complaintNames.length() > 0) {
complaintNames.deleteCharAt(complaintNames.length() - 1); // Remove the trailing comma
}
petition.setPetitionerComplaint_txt(complaintNames.toString());
}
model.addAttribute("petitionlist", mtmEventsPetitionList);
List<MTMEvents> mtmEventsList = mtmEventsRep.showAll();
DateTimeFormatter inputFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
DateTimeFormatter outputFormatter = DateTimeFormatter.ofPattern("dd-MM-yyyy");
for (MTMEvents event : mtmEventsList) {
String eventDateStr = event.getEventDate();
LocalDate eventDate = LocalDate.parse(eventDateStr, inputFormatter);
String formattedEventDate = eventDate.format(outputFormatter);
event.setEventDate(formattedEventDate);
}
model.addAttribute("mtmEventsList",mtmEventsList);
return "admin/partial-petition-list";
}
@GetMapping("/admin/pending-petition-list")
public String pendingPetitionList(Model model) {
//String Status = "partial";
model.addAttribute("title","Pending Petition List");
model.addAttribute("baseURL", appConfig.getBaseUrl());
List<MTMEventsPetition> mtmEventsPetitionList;
if(userSession.getEventid() != null && !userSession.getEventid().isEmpty()){
String eventid = userSession.getEventid();
mtmEventsPetitionList = mtmEventsPetitionRep.showNotCompletedByMTMID(eventid);
}
else{
mtmEventsPetitionList = mtmEventsPetitionRep.showNotCompleted();
}
//model.addAttribute("petitionlist",mtmEventsPetitionList);
List<MTMComplaintTypes> mtmComplaintTypesList = mtmComplaintTypesRep.showAll();
model.addAttribute("complaintTypesList",mtmComplaintTypesList);
List<OfficerMaster> officerMasterList = officerMasterRep.showAll();
// Create a map to store the ID-name mappings from mtmComplaintTypesList
Map<Integer, String> complaintTypesMap = new HashMap<>();
for (MTMComplaintTypes complaintType : mtmComplaintTypesList) {
complaintTypesMap.put(complaintType.getComplaintTypeId(), complaintType.getComplaintType());
}
// Iterate over mtmEventsPetitionList and replace ID values with names
for (MTMEventsPetition petition : mtmEventsPetitionList) {
String[] complaintIds = petition.getPetitionerComplaint().split(",");
StringBuilder complaintNames = new StringBuilder();
for (String complaintId : complaintIds) {
int id = Integer.parseInt(complaintId);
if (complaintTypesMap.containsKey(id)) {
complaintNames.append(complaintTypesMap.get(id)).append(",");
}
}
if (complaintNames.length() > 0) {
complaintNames.deleteCharAt(complaintNames.length() - 1); // Remove the trailing comma
}
petition.setPetitionerComplaint_txt(complaintNames.toString());
}
model.addAttribute("petitionlist", mtmEventsPetitionList);
List<MTMEvents> mtmEventsList = mtmEventsRep.showAll();
DateTimeFormatter inputFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
DateTimeFormatter outputFormatter = DateTimeFormatter.ofPattern("dd-MM-yyyy");
for (MTMEvents event : mtmEventsList) {
String eventDateStr = event.getEventDate();
LocalDate eventDate = LocalDate.parse(eventDateStr, inputFormatter);
String formattedEventDate = eventDate.format(outputFormatter);
event.setEventDate(formattedEventDate);
}
model.addAttribute("mtmEventsList",mtmEventsList);
return "admin/pending-petition-list";
}
@GetMapping("/admin/petition-search")
public String petitionSearch(Model model) {
model.addAttribute("title","Petition Search");
model.addAttribute("baseURL", appConfig.getBaseUrl());
List<MTMComplaintTypes> mtmComplaintTypesList = mtmComplaintTypesRep.showAll();
model.addAttribute("complaintTypesList",mtmComplaintTypesList);
return "admin/petition-search";
}
@GetMapping("/admin/complaint-list")
public String complaintList(Model model) {
model.addAttribute("title","Complaint List");
model.addAttribute("baseURL", appConfig.getBaseUrl());
String officer_id= userSession.getUserType();
List<MTMEventsPetitionMapping> mtmEventsPetitionMappingList;
if(userSession.getEventid() != null && !userSession.getEventid().isEmpty()){
String eventid = userSession.getEventid();
mtmEventsPetitionMappingList = mtmEventsPetitionMappingRep.showByMTMID(eventid);
}
else{
mtmEventsPetitionMappingList = mtmEventsPetitionMappingRep.showAll();
}
List<OfficerMaster> officerMasterList = officerMasterRep.showAll();
// Create a map of Officer IDs to Officer Names for easy lookup
Map<String, String> officerMap = new HashMap<>();
for (OfficerMaster officer : officerMasterList) {
officerMap.put(officer.getOffId(), officer.getOffNM());
}
// Iterate through the mtmEventsPetitionMappingList and add Officer Name
for (MTMEventsPetitionMapping mapping : mtmEventsPetitionMappingList) {
String officerId = mapping.getOffID();
String officerName = officerMap.get(officerId);
mapping.setOfficer_name(officerName);
if(mapping.getStatus()==null){
mapping.setStatus("Pending");
}
}
model.addAttribute("petitionlist", mtmEventsPetitionMappingList);
model.addAttribute("officerMasterList", officerMasterList);
List<MTMComplaintTypes> mtmComplaintTypesList = mtmComplaintTypesRep.showAll();
model.addAttribute("complaintTypesList",mtmComplaintTypesList);
List<MTMEvents> mtmEventsList = mtmEventsRep.showAll();
DateTimeFormatter inputFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
DateTimeFormatter outputFormatter = DateTimeFormatter.ofPattern("dd-MM-yyyy");
for (MTMEvents event : mtmEventsList) {
String eventDateStr = event.getEventDate();
LocalDate eventDate = LocalDate.parse(eventDateStr, inputFormatter);
String formattedEventDate = eventDate.format(outputFormatter);
event.setEventDate(formattedEventDate);
}
model.addAttribute("mtmEventsList",mtmEventsList);
return "admin/complaint-list";
}
@GetMapping("/admin/completed-complaint-list")
public String completedComplaintList(Model model) {
String Status = "close";
model.addAttribute("title","Completed Complaint List");
model.addAttribute("baseURL", appConfig.getBaseUrl());
String officer_id= userSession.getUserType();
List<MTMEventsPetitionMapping> mtmEventsPetitionMappingList;
if(userSession.getEventid() != null && !userSession.getEventid().isEmpty()){
String eventid = userSession.getEventid();
mtmEventsPetitionMappingList = mtmEventsPetitionMappingRep.showCompletedByMTMID(eventid,Status);
}
else{
mtmEventsPetitionMappingList = mtmEventsPetitionMappingRep.showCompleted(Status);
}
List<OfficerMaster> officerMasterList = officerMasterRep.showAll();
// Create a map of Officer IDs to Officer Names for easy lookup
Map<String, String> officerMap = new HashMap<>();
for (OfficerMaster officer : officerMasterList) {
officerMap.put(officer.getOffId(), officer.getOffNM());
}
// Iterate through the mtmEventsPetitionMappingList and add Officer Name
for (MTMEventsPetitionMapping mapping : mtmEventsPetitionMappingList) {
String officerId = mapping.getOffID();
String officerName = officerMap.get(officerId);
mapping.setOfficer_name(officerName);
if(mapping.getStatus()==null){
mapping.setStatus("Pending");
}
}
model.addAttribute("petitionlist", mtmEventsPetitionMappingList);
model.addAttribute("officerMasterList", officerMasterList);
List<MTMComplaintTypes> mtmComplaintTypesList = mtmComplaintTypesRep.showAll();
model.addAttribute("complaintTypesList",mtmComplaintTypesList);
List<MTMEvents> mtmEventsList = mtmEventsRep.showAll();
DateTimeFormatter inputFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
DateTimeFormatter outputFormatter = DateTimeFormatter.ofPattern("dd-MM-yyyy");
for (MTMEvents event : mtmEventsList) {
String eventDateStr = event.getEventDate();
LocalDate eventDate = LocalDate.parse(eventDateStr, inputFormatter);
String formattedEventDate = eventDate.format(outputFormatter);
event.setEventDate(formattedEventDate);
}
model.addAttribute("mtmEventsList",mtmEventsList);
return "admin/completed-complaint-list";
}
@GetMapping("/admin/pending-complaint-list")
public String pendingComplaintList(Model model) {
String Status = "close";
model.addAttribute("title","pending complaint list");
model.addAttribute("baseURL", appConfig.getBaseUrl());
String officer_id= userSession.getUserType();
List<MTMEventsPetitionMapping> mtmEventsPetitionMappingList;
if(userSession.getEventid() != null && !userSession.getEventid().isEmpty()){
String eventid = userSession.getEventid();
mtmEventsPetitionMappingList = mtmEventsPetitionMappingRep.showNotCompletedByMTMID(eventid);
}
else{
mtmEventsPetitionMappingList = mtmEventsPetitionMappingRep.showNotCompleted();
}
List<OfficerMaster> officerMasterList = officerMasterRep.showAll();
// Create a map of Officer IDs to Officer Names for easy lookup
Map<String, String> officerMap = new HashMap<>();
for (OfficerMaster officer : officerMasterList) {
officerMap.put(officer.getOffId(), officer.getOffNM());
}
// Iterate through the mtmEventsPetitionMappingList and add Officer Name
for (MTMEventsPetitionMapping mapping : mtmEventsPetitionMappingList) {
String officerId = mapping.getOffID();
String officerName = officerMap.get(officerId);
mapping.setOfficer_name(officerName);
if(mapping.getStatus()==null){
mapping.setStatus("Pending");
}
}
model.addAttribute("petitionlist", mtmEventsPetitionMappingList);
model.addAttribute("officerMasterList", officerMasterList);
List<MTMComplaintTypes> mtmComplaintTypesList = mtmComplaintTypesRep.showAll();
model.addAttribute("complaintTypesList",mtmComplaintTypesList);
List<MTMEvents> mtmEventsList = mtmEventsRep.showAll();
DateTimeFormatter inputFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
DateTimeFormatter outputFormatter = DateTimeFormatter.ofPattern("dd-MM-yyyy");
for (MTMEvents event : mtmEventsList) {
String eventDateStr = event.getEventDate();
LocalDate eventDate = LocalDate.parse(eventDateStr, inputFormatter);
String formattedEventDate = eventDate.format(outputFormatter);
event.setEventDate(formattedEventDate);
}
model.addAttribute("mtmEventsList",mtmEventsList);
return "admin/pending-complaint-list";
}
}

106
src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/controller/BlobController.java

@ -0,0 +1,106 @@
package com.gcc.mtm.Makkalai.Thedi.Mayor.controller;
import java.io.IOException;
import java.sql.Blob;
import java.sql.SQLException;
import java.util.List;
import com.gcc.mtm.Makkalai.Thedi.Mayor.entity.MTMEventsPetitionFiles;
import com.gcc.mtm.Makkalai.Thedi.Mayor.repository.MTMEventsPetitionFilesRep;
import jakarta.servlet.http.HttpServletRequest;
import org.apache.tika.Tika;
import com.gcc.mtm.Makkalai.Thedi.Mayor.entity.MTMEventsPetitionAction;
import com.gcc.mtm.Makkalai.Thedi.Mayor.repository.MTMEventsPetitionActionRep;
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.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@RequestMapping("/api")
@RestController
public class BlobController {
@Autowired
MTMEventsPetitionActionRep mtmEventsPetitionActionRep;
@Autowired
MTMEventsPetitionFilesRep mtmEventsPetitionFilesRep;
@GetMapping("/viewBlobData")
public String[] viewBlob(HttpServletRequest request, @RequestParam("id") String id, @RequestParam("table") String table) {
// Retrieve Blob data from your data source
Blob blobData = getBlobData(id,table); // Replace with your logic to get the Blob data
if(blobData != null && isBlobDataExists(blobData)){
// Convert Blob data to Base64 encoding
String base64Data = convertBlobToBase64(blobData);
// Get the file type based on Blob data
String fileType = getFileType(blobData);
String[] fileData = new String[2];
fileData[0] = base64Data;
fileData[1] = fileType;
// Pass the Base64 encoded data and file type to the Thymeleaf template
//model.addAttribute("blobData", base64Data);
//model.addAttribute("fileType", fileType);
return fileData;
}
return null;
}
private Blob getBlobData(String Id, String type) {
if(type.equals("action")){
List<MTMEventsPetitionAction> DataList = mtmEventsPetitionActionRep.ShowDataBySolMapId(Id);
if(DataList.size()>0){
Blob blobData = DataList.get(0).getData();
return blobData;
}
} else if (type.equals("petition")) {
List<MTMEventsPetitionFiles> DataList = mtmEventsPetitionFilesRep.ShowFileByFileId(Id);
if(DataList.size()>0){
Blob blobData = DataList.get(0).getData();
return blobData;
}
}
return null;
}
public boolean isBlobDataExists(Blob blobData) {
try {
int blobLength = (int) blobData.length();
return blobLength > 0;
} catch (SQLException e) {
e.printStackTrace();
return false;
}
}
private String convertBlobToBase64(Blob blobData) {
try {
byte[] bytes = blobData.getBytes(1, (int) blobData.length());
return java.util.Base64.getEncoder().encodeToString(bytes);
} catch (SQLException e) {
e.printStackTrace();
return null;
}
}
private String getFileType(Blob blobData) {
try {
// Retrieve the input stream from the Blob
java.io.InputStream inputStream = blobData.getBinaryStream();
// Determine the file type based on the input stream
// Create an instance of Apache Tika
Tika tika = new Tika();
// Determine the file type based on the input stream using Apache Tika
String fileType = tika.detect(inputStream);
return fileType;
} catch (SQLException e) {
e.printStackTrace();
return null;
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}

1032
src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/controller/MainController.java
File diff suppressed because it is too large
View File

776
src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/controller/MayorController.java

@ -0,0 +1,776 @@
package com.gcc.mtm.Makkalai.Thedi.Mayor.controller;
import com.gcc.mtm.Makkalai.Thedi.Mayor.entity.*;
import com.gcc.mtm.Makkalai.Thedi.Mayor.login.UserSession;
import com.gcc.mtm.Makkalai.Thedi.Mayor.others.AppConfig;
import com.gcc.mtm.Makkalai.Thedi.Mayor.repository.*;
import jakarta.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.InputStreamResource;
import org.springframework.http.*;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.multipart.MultipartFile;
import javax.sql.rowset.serial.SerialBlob;
import java.io.IOException;
import java.io.InputStream;
import java.sql.Blob;
import java.sql.SQLException;
import java.time.LocalDateTime;
import java.util.*;
@Controller
public class MayorController {
@Autowired
private AppConfig appConfig;
private final UserSession userSession;
@Autowired
public MayorController(UserSession userSession) {
this.userSession = userSession;
}
//@Autowired
//private UserSession userSession;
@Autowired
private MTMComplaintTypesRep mtmComplaintTypesRep;
@Autowired
private OfficerMasterRep officerMasterRep;
@Autowired
private MTMEventsPetitionRep mtmEventsPetitionRep;
@Autowired
private MTMEventsPetitionFilesRep mtmEventsPetitionFilesRep;
@Autowired
private MTMEventsPetitionMappingRep mtmEventsPetitionMappingRep;
@Autowired
private MTMEventsRep mtmEventsRep;
@GetMapping("/mayor/dashboard")
public String viewDashboard(Model model) {
model.addAttribute("title", "Count By Complaint Type");
model.addAttribute("baseURL", appConfig.getBaseUrl());
//System.out.println(userSession.getUserId());
Long Petitioncount;
Long PetitionCompletedcount;
Long PetitionPartialcount;
Long ComplaintCompletedcount;
List<MTMEventsPetition> mtmEventsPetitionList;
if(userSession.getEventid() != null && !userSession.getEventid().isEmpty()){
String eventid = userSession.getEventid();
mtmEventsPetitionList = mtmEventsPetitionRep.showAllByMTMID(eventid);
Petitioncount = mtmEventsPetitionRep.getPetitionCountByMTMID(eventid);
PetitionCompletedcount = mtmEventsPetitionRep.getPetitionCompletedCountByMTMID(eventid);
PetitionPartialcount = mtmEventsPetitionRep.getPetitionPartialCountByMTMID(eventid);
ComplaintCompletedcount = mtmEventsPetitionMappingRep.getCompletedCountByMTMID(eventid);
}
else{
mtmEventsPetitionList = mtmEventsPetitionRep.showAll();
Petitioncount = mtmEventsPetitionRep.getPetitionCount();
PetitionCompletedcount = mtmEventsPetitionRep.getPetitionCompletedCount();
PetitionPartialcount = mtmEventsPetitionRep.getPetitionPartialCount();
ComplaintCompletedcount = mtmEventsPetitionMappingRep.getCompletedCount();
}
// Officers
List<OfficerMaster> officerMasterList = officerMasterRep.showAll();
// Create a map of Officer IDs to Officer Names for easy lookup
Map<String, String> officerMap = new HashMap<>();
for (OfficerMaster officer : officerMasterList) {
officerMap.put(officer.getOffId(), officer.getOffNM());
}
// Petition
model.addAttribute("Petitioncount", Petitioncount);
model.addAttribute("PetitionCompletedcount", PetitionCompletedcount);
model.addAttribute("PetitionPendingcount", (Petitioncount-PetitionCompletedcount));
model.addAttribute("PetitionPartialcount", PetitionPartialcount);
// Complaints
Integer compliantCount = 0;
Integer totalCompliantTypes = mtmComplaintTypesRep.getComplaintCount()+1;
int[] byCompliantTypes = new int[totalCompliantTypes];
for (MTMEventsPetition petition : mtmEventsPetitionList) {
//System.out.println(petition.getPetitionerComplaint());
String compliant = petition.getPetitionerComplaint();
String[] compliantArray = compliant.split(",");
compliantCount+=compliantArray.length;
for (String compliantId : compliantArray) {
//System.out.println(compliantId);
int compliantIdInt = Integer.parseInt(compliantId);
byCompliantTypes[compliantIdInt]++;
}
}
model.addAttribute("Compliantcount", compliantCount);
model.addAttribute("ComplaintCompletedcount", ComplaintCompletedcount);
model.addAttribute("ComplaintPendingcount", (compliantCount-ComplaintCompletedcount));
List<MTMEvents> mtmEventsList = mtmEventsRep.showAll();
DateTimeFormatter inputFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
DateTimeFormatter outputFormatter = DateTimeFormatter.ofPattern("dd-MM-yyyy");
for (MTMEvents event : mtmEventsList) {
String eventDateStr = event.getEventDate();
LocalDate eventDate = LocalDate.parse(eventDateStr, inputFormatter);
String formattedEventDate = eventDate.format(outputFormatter);
event.setEventDate(formattedEventDate);
}
model.addAttribute("mtmEventsList",mtmEventsList);
//System.out.println(userSession.getEventid());
return "mayor/dashboard";
}
@GetMapping("/mayor/by-event-list")
public String vieweventlistreport(Model model) {
model.addAttribute("title", "Count By Complaint Type");
model.addAttribute("baseURL", appConfig.getBaseUrl());
List<MTMEvents> mtmEventsListcount;
String eventName ="All";
if(userSession.getEventid() != null && !userSession.getEventid().isEmpty()){
String eventid = userSession.getEventid();
mtmEventsListcount = mtmEventsRep.eventsByID(eventid);
}
else{
mtmEventsListcount = mtmEventsRep.showAll();
}
DateTimeFormatter inputFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
DateTimeFormatter outputFormatter = DateTimeFormatter.ofPattern("dd-MM-yyyy");
Long Petitioncount;
Long PetitionCompletedcount;
Long ComplaintCompletedcount;
Long TotalComplaints = 0L;
for (MTMEvents event : mtmEventsListcount) {
String eventDateStr = event.getEventDate();
LocalDate eventDate = LocalDate.parse(eventDateStr, inputFormatter);
String formattedEventDate = eventDate.format(outputFormatter);
event.setEvent_date(formattedEventDate);
String eventid = event.getMtmId().toString();
Petitioncount = mtmEventsPetitionRep.getPetitionCountByMTMID(eventid);
event.setTotal_petitions(Petitioncount.toString());
PetitionCompletedcount = mtmEventsPetitionRep.getPetitionCompletedCountByMTMID(eventid);
event.setPetitions_completed(PetitionCompletedcount.toString());
Long PetitionPendingCount = (Petitioncount-PetitionCompletedcount);
event.setPetitions_pending(PetitionPendingCount.toString());
event.setPetition_partially_completed(mtmEventsPetitionRep.getPetitionPartialCountByMTMID(eventid).toString());
ComplaintCompletedcount = mtmEventsPetitionMappingRep.getCompletedCountByMTMID(eventid);
event.setCompliants_completed(ComplaintCompletedcount.toString());
// Complaints
List<MTMEventsPetition> mtmEventsPetitionList = mtmEventsPetitionRep.showAllByMTMID(eventid);
Integer compliantCount = 0;
Integer totalCompliantTypes = mtmComplaintTypesRep.getComplaintCount()+1;
int[] byCompliantTypes = new int[totalCompliantTypes];
for (MTMEventsPetition petition : mtmEventsPetitionList) {
//System.out.println(petition.getPetitionerComplaint());
String compliant = petition.getPetitionerComplaint();
String[] compliantArray = compliant.split(",");
compliantCount+=compliantArray.length;
for (String compliantId : compliantArray) {
//System.out.println(compliantId);
int compliantIdInt = Integer.parseInt(compliantId);
byCompliantTypes[compliantIdInt]++;
}
}
TotalComplaints = TotalComplaints + compliantCount;
event.setTotal_compliants(compliantCount.toString());
Long pendingcount = (compliantCount-ComplaintCompletedcount);
event.setCompliants_pending(pendingcount.toString());
}
model.addAttribute("mtmEventsTableList",mtmEventsListcount);
model.addAttribute("totalComplaintsCounts",TotalComplaints);
// For Search Event
List<MTMEvents> mtmEventsList = mtmEventsRep.showAll();
// Events
for (MTMEvents event : mtmEventsList) {
String eventDateStr = event.getEventDate();
LocalDate eventDate = LocalDate.parse(eventDateStr, inputFormatter);
String formattedEventDate = eventDate.format(outputFormatter);
event.setEventDate(formattedEventDate);
}
model.addAttribute("mtmEventsList",mtmEventsList);
return "mayor/by-event-list";
}
@GetMapping("/mayor/by-officer-list")
public String viewofficerlistreport(Model model) {
model.addAttribute("title", "Count By Complaint Type");
model.addAttribute("baseURL", appConfig.getBaseUrl());
// Format Date
DateTimeFormatter inputFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
DateTimeFormatter outputFormatter = DateTimeFormatter.ofPattern("dd-MM-yyyy");
List<String> distinctOffIds = null;
List<MTMEvents> mtmEventsList = mtmEventsRep.showAll();
// Create a map of Officer IDs to Officer Names for easy lookup
Map<String, String> eventMap = new HashMap<>();
for (MTMEvents event : mtmEventsList) {
LocalDate eventDate = LocalDate.parse(event.getEventDate(), inputFormatter);
String formattedEventDate = eventDate.format(outputFormatter);
eventMap.put(event.getMtmId().toString(), event.getEventName() +" ("+formattedEventDate+")");
}
String eventName ="All";
if(userSession.getEventid() != null && !userSession.getEventid().isEmpty()){
String eventid = userSession.getEventid();
distinctOffIds = mtmEventsPetitionMappingRep.showListByeventOfficer(eventid);
eventName = eventMap.get(eventid);
}
else{
distinctOffIds = mtmEventsPetitionMappingRep.showListBy_Officer();
}
// Officers
List<OfficerMaster> officerMasterList = officerMasterRep.showAll();
// Create a map of Officer IDs to Officer Names for easy lookup
Map<String, String> officerMap = new HashMap<>();
for (OfficerMaster officer : officerMasterList) {
officerMap.put(officer.getOffId(), officer.getOffNM());
}
Integer totalCount = 0;
List<MTMEventsPetitionMapping> officerList = new ArrayList<>();
for (String offId : distinctOffIds) {
Long offCount;
Long offCompletedCount;
Long offPendingCount;
if (userSession.getEventid() != null && !userSession.getEventid().isEmpty()) {
String eventId = userSession.getEventid();
offCount = mtmEventsPetitionMappingRep.getPetionCountByOffId_MapId(eventId, offId);
offCompletedCount = mtmEventsPetitionMappingRep.getPetionCountByOffId_MapId_Status(eventId, offId,"close");
} else {
offCount = mtmEventsPetitionMappingRep.getPetionCountByOffId(offId);
offCompletedCount = mtmEventsPetitionMappingRep.getPetionCountByOffId_Status(offId,"close");
}
offPendingCount = offCount-offCompletedCount;
String officerName = officerMap.get(offId);
MTMEventsPetitionMapping officer = new MTMEventsPetitionMapping();
// Create a new officer object or update an existing one with the necessary properties
officer.setOffID(offId);
officer.setOfficer_name(officerName);
officer.setOfficer_petition_count(offCount.toString());
totalCount = totalCount.intValue() + offCount.intValue();
officer.setOfficer_completed_count(offCompletedCount.toString());
officer.setOfficer_pending_count(offPendingCount.toString());
officer.setEvent_name(eventName);
officerList.add(officer);
}
model.addAttribute("officer",officerList);
model.addAttribute("totalCounts",totalCount);
// Events
for (MTMEvents event : mtmEventsList) {
String eventDateStr = event.getEventDate();
LocalDate eventDate = LocalDate.parse(eventDateStr, inputFormatter);
String formattedEventDate = eventDate.format(outputFormatter);
event.setEventDate(formattedEventDate);
}
model.addAttribute("mtmEventsList",mtmEventsList);
//System.out.println(userSession.getEventid());
return "mayor/by-officer-list";
}
@GetMapping("/mayor/by-complaint-list")
public String viewcomplaintlistreport(Model model) {
model.addAttribute("title", "Count By Complaint Type");
model.addAttribute("baseURL", appConfig.getBaseUrl());
List<MTMEventsPetition> mtmEventsPetitionList;
List<String> distinctOffIds = null;
if(userSession.getEventid() != null && !userSession.getEventid().isEmpty()){
String eventid = userSession.getEventid();
mtmEventsPetitionList = mtmEventsPetitionRep.showAllByMTMID(eventid);
}
else{
mtmEventsPetitionList = mtmEventsPetitionRep.showAll();
}
// Complaints
Integer totalCompliantTypes = mtmComplaintTypesRep.getComplaintCount()+1;
int[] byCompliantTypes = new int[totalCompliantTypes];
for (MTMEventsPetition petition : mtmEventsPetitionList) {
//System.out.println(petition.getPetitionerComplaint());
String compliant = petition.getPetitionerComplaint();
String[] compliantArray = compliant.split(",");
for (String compliantId : compliantArray) {
//System.out.println(compliantId);
int compliantIdInt = Integer.parseInt(compliantId);
byCompliantTypes[compliantIdInt]++;
}
}
List<MTMComplaintTypes> mtmComplaintTypesList = mtmComplaintTypesRep.showAll();
model.addAttribute("complaintTypesList",mtmComplaintTypesList);
model.addAttribute("countByCompliantTypes",byCompliantTypes);
List<MTMEvents> mtmEventsList = mtmEventsRep.showAll();
DateTimeFormatter inputFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
DateTimeFormatter outputFormatter = DateTimeFormatter.ofPattern("dd-MM-yyyy");
for (MTMEvents event : mtmEventsList) {
String eventDateStr = event.getEventDate();
LocalDate eventDate = LocalDate.parse(eventDateStr, inputFormatter);
String formattedEventDate = eventDate.format(outputFormatter);
event.setEventDate(formattedEventDate);
}
model.addAttribute("mtmEventsList",mtmEventsList);
//System.out.println(userSession.getEventid());
return "mayor/by-complaint-list";
}
@GetMapping("/mayor/petition-list")
public String petitionList(Model model) {
model.addAttribute("title","Petition List");
model.addAttribute("baseURL", appConfig.getBaseUrl());
List<MTMEventsPetition> mtmEventsPetitionList;
if(userSession.getEventid() != null && !userSession.getEventid().isEmpty()){
String eventid = userSession.getEventid();
mtmEventsPetitionList = mtmEventsPetitionRep.showAllByMTMID(eventid);
}
else{
mtmEventsPetitionList = mtmEventsPetitionRep.showAll();
}
//model.addAttribute("petitionlist",mtmEventsPetitionList);
List<MTMComplaintTypes> mtmComplaintTypesList = mtmComplaintTypesRep.showAll();
model.addAttribute("complaintTypesList",mtmComplaintTypesList);
List<OfficerMaster> officerMasterList = officerMasterRep.showAll();
// Create a map to store the ID-name mappings from mtmComplaintTypesList
Map<Integer, String> complaintTypesMap = new HashMap<>();
for (MTMComplaintTypes complaintType : mtmComplaintTypesList) {
complaintTypesMap.put(complaintType.getComplaintTypeId(), complaintType.getComplaintType());
}
// Iterate over mtmEventsPetitionList and replace ID values with names
for (MTMEventsPetition petition : mtmEventsPetitionList) {
String[] complaintIds = petition.getPetitionerComplaint().split(",");
StringBuilder complaintNames = new StringBuilder();
for (String complaintId : complaintIds) {
int id = Integer.parseInt(complaintId);
if (complaintTypesMap.containsKey(id)) {
complaintNames.append(complaintTypesMap.get(id)).append(",");
}
}
if (complaintNames.length() > 0) {
complaintNames.deleteCharAt(complaintNames.length() - 1); // Remove the trailing comma
}
petition.setPetitionerComplaint_txt(complaintNames.toString());
}
model.addAttribute("petitionlist", mtmEventsPetitionList);
List<MTMEvents> mtmEventsList = mtmEventsRep.showAll();
DateTimeFormatter inputFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
DateTimeFormatter outputFormatter = DateTimeFormatter.ofPattern("dd-MM-yyyy");
for (MTMEvents event : mtmEventsList) {
String eventDateStr = event.getEventDate();
LocalDate eventDate = LocalDate.parse(eventDateStr, inputFormatter);
String formattedEventDate = eventDate.format(outputFormatter);
event.setEventDate(formattedEventDate);
}
model.addAttribute("mtmEventsList",mtmEventsList);
return "mayor/petition-list";
}
@GetMapping("/mayor/completed-petition-list")
public String completedPetitionList(Model model) {
String Status = "close";
model.addAttribute("title","Completed Petition List");
model.addAttribute("baseURL", appConfig.getBaseUrl());
List<MTMEventsPetition> mtmEventsPetitionList;
if(userSession.getEventid() != null && !userSession.getEventid().isEmpty()){
String eventid = userSession.getEventid();
mtmEventsPetitionList = mtmEventsPetitionRep.showCompletedByMTMID(eventid,Status);
}
else{
mtmEventsPetitionList = mtmEventsPetitionRep.showCompleted(Status);
}
//model.addAttribute("petitionlist",mtmEventsPetitionList);
List<MTMComplaintTypes> mtmComplaintTypesList = mtmComplaintTypesRep.showAll();
model.addAttribute("complaintTypesList",mtmComplaintTypesList);
List<OfficerMaster> officerMasterList = officerMasterRep.showAll();
// Create a map to store the ID-name mappings from mtmComplaintTypesList
Map<Integer, String> complaintTypesMap = new HashMap<>();
for (MTMComplaintTypes complaintType : mtmComplaintTypesList) {
complaintTypesMap.put(complaintType.getComplaintTypeId(), complaintType.getComplaintType());
}
// Iterate over mtmEventsPetitionList and replace ID values with names
for (MTMEventsPetition petition : mtmEventsPetitionList) {
String[] complaintIds = petition.getPetitionerComplaint().split(",");
StringBuilder complaintNames = new StringBuilder();
for (String complaintId : complaintIds) {
int id = Integer.parseInt(complaintId);
if (complaintTypesMap.containsKey(id)) {
complaintNames.append(complaintTypesMap.get(id)).append(",");
}
}
if (complaintNames.length() > 0) {
complaintNames.deleteCharAt(complaintNames.length() - 1); // Remove the trailing comma
}
petition.setPetitionerComplaint_txt(complaintNames.toString());
}
model.addAttribute("petitionlist", mtmEventsPetitionList);
List<MTMEvents> mtmEventsList = mtmEventsRep.showAll();
DateTimeFormatter inputFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
DateTimeFormatter outputFormatter = DateTimeFormatter.ofPattern("dd-MM-yyyy");
for (MTMEvents event : mtmEventsList) {
String eventDateStr = event.getEventDate();
LocalDate eventDate = LocalDate.parse(eventDateStr, inputFormatter);
String formattedEventDate = eventDate.format(outputFormatter);
event.setEventDate(formattedEventDate);
}
model.addAttribute("mtmEventsList",mtmEventsList);
return "mayor/completed-petition-list";
}
@GetMapping("/mayor/partial-petition-list")
public String partialPetitionList(Model model) {
String Status = "partial";
model.addAttribute("title","Partially Completed Petition List");
model.addAttribute("baseURL", appConfig.getBaseUrl());
List<MTMEventsPetition> mtmEventsPetitionList;
if(userSession.getEventid() != null && !userSession.getEventid().isEmpty()){
String eventid = userSession.getEventid();
mtmEventsPetitionList = mtmEventsPetitionRep.showCompletedByMTMID(eventid,Status);
}
else{
mtmEventsPetitionList = mtmEventsPetitionRep.showCompleted(Status);
}
//model.addAttribute("petitionlist",mtmEventsPetitionList);
List<MTMComplaintTypes> mtmComplaintTypesList = mtmComplaintTypesRep.showAll();
model.addAttribute("complaintTypesList",mtmComplaintTypesList);
List<OfficerMaster> officerMasterList = officerMasterRep.showAll();
// Create a map to store the ID-name mappings from mtmComplaintTypesList
Map<Integer, String> complaintTypesMap = new HashMap<>();
for (MTMComplaintTypes complaintType : mtmComplaintTypesList) {
complaintTypesMap.put(complaintType.getComplaintTypeId(), complaintType.getComplaintType());
}
// Iterate over mtmEventsPetitionList and replace ID values with names
for (MTMEventsPetition petition : mtmEventsPetitionList) {
String[] complaintIds = petition.getPetitionerComplaint().split(",");
StringBuilder complaintNames = new StringBuilder();
for (String complaintId : complaintIds) {
int id = Integer.parseInt(complaintId);
if (complaintTypesMap.containsKey(id)) {
complaintNames.append(complaintTypesMap.get(id)).append(",");
}
}
if (complaintNames.length() > 0) {
complaintNames.deleteCharAt(complaintNames.length() - 1); // Remove the trailing comma
}
petition.setPetitionerComplaint_txt(complaintNames.toString());
}
model.addAttribute("petitionlist", mtmEventsPetitionList);
List<MTMEvents> mtmEventsList = mtmEventsRep.showAll();
DateTimeFormatter inputFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
DateTimeFormatter outputFormatter = DateTimeFormatter.ofPattern("dd-MM-yyyy");
for (MTMEvents event : mtmEventsList) {
String eventDateStr = event.getEventDate();
LocalDate eventDate = LocalDate.parse(eventDateStr, inputFormatter);
String formattedEventDate = eventDate.format(outputFormatter);
event.setEventDate(formattedEventDate);
}
model.addAttribute("mtmEventsList",mtmEventsList);
return "mayor/partial-petition-list";
}
@GetMapping("/mayor/pending-petition-list")
public String pendingPetitionList(Model model) {
//String Status = "partial";
model.addAttribute("title","Pending Petition List");
model.addAttribute("baseURL", appConfig.getBaseUrl());
List<MTMEventsPetition> mtmEventsPetitionList;
if(userSession.getEventid() != null && !userSession.getEventid().isEmpty()){
String eventid = userSession.getEventid();
mtmEventsPetitionList = mtmEventsPetitionRep.showNotCompletedByMTMID(eventid);
}
else{
mtmEventsPetitionList = mtmEventsPetitionRep.showNotCompleted();
}
//model.addAttribute("petitionlist",mtmEventsPetitionList);
List<MTMComplaintTypes> mtmComplaintTypesList = mtmComplaintTypesRep.showAll();
model.addAttribute("complaintTypesList",mtmComplaintTypesList);
List<OfficerMaster> officerMasterList = officerMasterRep.showAll();
// Create a map to store the ID-name mappings from mtmComplaintTypesList
Map<Integer, String> complaintTypesMap = new HashMap<>();
for (MTMComplaintTypes complaintType : mtmComplaintTypesList) {
complaintTypesMap.put(complaintType.getComplaintTypeId(), complaintType.getComplaintType());
}
// Iterate over mtmEventsPetitionList and replace ID values with names
for (MTMEventsPetition petition : mtmEventsPetitionList) {
String[] complaintIds = petition.getPetitionerComplaint().split(",");
StringBuilder complaintNames = new StringBuilder();
for (String complaintId : complaintIds) {
int id = Integer.parseInt(complaintId);
if (complaintTypesMap.containsKey(id)) {
complaintNames.append(complaintTypesMap.get(id)).append(",");
}
}
if (complaintNames.length() > 0) {
complaintNames.deleteCharAt(complaintNames.length() - 1); // Remove the trailing comma
}
petition.setPetitionerComplaint_txt(complaintNames.toString());
}
model.addAttribute("petitionlist", mtmEventsPetitionList);
List<MTMEvents> mtmEventsList = mtmEventsRep.showAll();
DateTimeFormatter inputFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
DateTimeFormatter outputFormatter = DateTimeFormatter.ofPattern("dd-MM-yyyy");
for (MTMEvents event : mtmEventsList) {
String eventDateStr = event.getEventDate();
LocalDate eventDate = LocalDate.parse(eventDateStr, inputFormatter);
String formattedEventDate = eventDate.format(outputFormatter);
event.setEventDate(formattedEventDate);
}
model.addAttribute("mtmEventsList",mtmEventsList);
return "mayor/pending-petition-list";
}
@GetMapping("/mayor/petition-search")
public String petitionSearch(Model model) {
model.addAttribute("title","Petition Search");
model.addAttribute("baseURL", appConfig.getBaseUrl());
List<MTMComplaintTypes> mtmComplaintTypesList = mtmComplaintTypesRep.showAll();
model.addAttribute("complaintTypesList",mtmComplaintTypesList);
return "mayor/petition-search";
}
@GetMapping("/mayor/complaint-list")
public String complaintList(Model model) {
model.addAttribute("title","Complaint List");
model.addAttribute("baseURL", appConfig.getBaseUrl());
String officer_id= userSession.getUserType();
List<MTMEventsPetitionMapping> mtmEventsPetitionMappingList;
if(userSession.getEventid() != null && !userSession.getEventid().isEmpty()){
String eventid = userSession.getEventid();
mtmEventsPetitionMappingList = mtmEventsPetitionMappingRep.showByMTMID(eventid);
}
else{
mtmEventsPetitionMappingList = mtmEventsPetitionMappingRep.showAll();
}
List<OfficerMaster> officerMasterList = officerMasterRep.showAll();
// Create a map of Officer IDs to Officer Names for easy lookup
Map<String, String> officerMap = new HashMap<>();
for (OfficerMaster officer : officerMasterList) {
officerMap.put(officer.getOffId(), officer.getOffNM());
}
// Iterate through the mtmEventsPetitionMappingList and add Officer Name
for (MTMEventsPetitionMapping mapping : mtmEventsPetitionMappingList) {
String officerId = mapping.getOffID();
String officerName = officerMap.get(officerId);
mapping.setOfficer_name(officerName);
if(mapping.getStatus()==null){
mapping.setStatus("Pending");
}
}
model.addAttribute("petitionlist", mtmEventsPetitionMappingList);
model.addAttribute("officerMasterList", officerMasterList);
List<MTMComplaintTypes> mtmComplaintTypesList = mtmComplaintTypesRep.showAll();
model.addAttribute("complaintTypesList",mtmComplaintTypesList);
List<MTMEvents> mtmEventsList = mtmEventsRep.showAll();
DateTimeFormatter inputFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
DateTimeFormatter outputFormatter = DateTimeFormatter.ofPattern("dd-MM-yyyy");
for (MTMEvents event : mtmEventsList) {
String eventDateStr = event.getEventDate();
LocalDate eventDate = LocalDate.parse(eventDateStr, inputFormatter);
String formattedEventDate = eventDate.format(outputFormatter);
event.setEventDate(formattedEventDate);
}
model.addAttribute("mtmEventsList",mtmEventsList);
return "mayor/complaint-list";
}
@GetMapping("/mayor/completed-complaint-list")
public String completedComplaintList(Model model) {
String Status = "close";
model.addAttribute("title","Completed Complaint List");
model.addAttribute("baseURL", appConfig.getBaseUrl());
String officer_id= userSession.getUserType();
List<MTMEventsPetitionMapping> mtmEventsPetitionMappingList;
if(userSession.getEventid() != null && !userSession.getEventid().isEmpty()){
String eventid = userSession.getEventid();
mtmEventsPetitionMappingList = mtmEventsPetitionMappingRep.showCompletedByMTMID(eventid,Status);
}
else{
mtmEventsPetitionMappingList = mtmEventsPetitionMappingRep.showCompleted(Status);
}
List<OfficerMaster> officerMasterList = officerMasterRep.showAll();
// Create a map of Officer IDs to Officer Names for easy lookup
Map<String, String> officerMap = new HashMap<>();
for (OfficerMaster officer : officerMasterList) {
officerMap.put(officer.getOffId(), officer.getOffNM());
}
// Iterate through the mtmEventsPetitionMappingList and add Officer Name
for (MTMEventsPetitionMapping mapping : mtmEventsPetitionMappingList) {
String officerId = mapping.getOffID();
String officerName = officerMap.get(officerId);
mapping.setOfficer_name(officerName);
if(mapping.getStatus()==null){
mapping.setStatus("Pending");
}
}
model.addAttribute("petitionlist", mtmEventsPetitionMappingList);
model.addAttribute("officerMasterList", officerMasterList);
List<MTMComplaintTypes> mtmComplaintTypesList = mtmComplaintTypesRep.showAll();
model.addAttribute("complaintTypesList",mtmComplaintTypesList);
List<MTMEvents> mtmEventsList = mtmEventsRep.showAll();
DateTimeFormatter inputFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
DateTimeFormatter outputFormatter = DateTimeFormatter.ofPattern("dd-MM-yyyy");
for (MTMEvents event : mtmEventsList) {
String eventDateStr = event.getEventDate();
LocalDate eventDate = LocalDate.parse(eventDateStr, inputFormatter);
String formattedEventDate = eventDate.format(outputFormatter);
event.setEventDate(formattedEventDate);
}
model.addAttribute("mtmEventsList",mtmEventsList);
return "mayor/completed-complaint-list";
}
@GetMapping("/mayor/pending-complaint-list")
public String pendingComplaintList(Model model) {
String Status = "close";
model.addAttribute("title","pending complaint list");
model.addAttribute("baseURL", appConfig.getBaseUrl());
String officer_id= userSession.getUserType();
List<MTMEventsPetitionMapping> mtmEventsPetitionMappingList;
if(userSession.getEventid() != null && !userSession.getEventid().isEmpty()){
String eventid = userSession.getEventid();
mtmEventsPetitionMappingList = mtmEventsPetitionMappingRep.showNotCompletedByMTMID(eventid);
}
else{
mtmEventsPetitionMappingList = mtmEventsPetitionMappingRep.showNotCompleted();
}
List<OfficerMaster> officerMasterList = officerMasterRep.showAll();
// Create a map of Officer IDs to Officer Names for easy lookup
Map<String, String> officerMap = new HashMap<>();
for (OfficerMaster officer : officerMasterList) {
officerMap.put(officer.getOffId(), officer.getOffNM());
}
// Iterate through the mtmEventsPetitionMappingList and add Officer Name
for (MTMEventsPetitionMapping mapping : mtmEventsPetitionMappingList) {
String officerId = mapping.getOffID();
String officerName = officerMap.get(officerId);
mapping.setOfficer_name(officerName);
if(mapping.getStatus()==null){
mapping.setStatus("Pending");
}
}
model.addAttribute("petitionlist", mtmEventsPetitionMappingList);
model.addAttribute("officerMasterList", officerMasterList);
List<MTMComplaintTypes> mtmComplaintTypesList = mtmComplaintTypesRep.showAll();
model.addAttribute("complaintTypesList",mtmComplaintTypesList);
List<MTMEvents> mtmEventsList = mtmEventsRep.showAll();
DateTimeFormatter inputFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
DateTimeFormatter outputFormatter = DateTimeFormatter.ofPattern("dd-MM-yyyy");
for (MTMEvents event : mtmEventsList) {
String eventDateStr = event.getEventDate();
LocalDate eventDate = LocalDate.parse(eventDateStr, inputFormatter);
String formattedEventDate = eventDate.format(outputFormatter);
event.setEventDate(formattedEventDate);
}
model.addAttribute("mtmEventsList",mtmEventsList);
return "mayor/pending-complaint-list";
}
}

767
src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/controller/OfficerController.java

@ -0,0 +1,767 @@
package com.gcc.mtm.Makkalai.Thedi.Mayor.controller;
import com.gcc.mtm.Makkalai.Thedi.Mayor.entity.*;
import com.gcc.mtm.Makkalai.Thedi.Mayor.login.UserSession;
import com.gcc.mtm.Makkalai.Thedi.Mayor.others.AppConfig;
import com.gcc.mtm.Makkalai.Thedi.Mayor.repository.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.client.RestTemplate;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Controller
public class OfficerController {
@Autowired
private AppConfig appConfig;
private final UserSession userSession;
@Autowired
public OfficerController(UserSession userSession) {
this.userSession = userSession;
}
//@Autowired
//private UserSession userSession;
@Autowired
private MTMComplaintTypesRep mtmComplaintTypesRep;
@Autowired
private OfficerMasterRep officerMasterRep;
@Autowired
private OfficerAccessRep officerAccessRep;
@Autowired
private MTMEventsPetitionRep mtmEventsPetitionRep;
@Autowired
private MTMEventsPetitionFilesRep mtmEventsPetitionFilesRep;
@Autowired
private MTMEventsPetitionMappingRep mtmEventsPetitionMappingRep;
@Autowired
private MTMEventsRep mtmEventsRep;
@GetMapping("/officer/dashboard")
public String viewDashboard(Model model) {
model.addAttribute("title", "Count By Complaint Type");
model.addAttribute("baseURL", appConfig.getBaseUrl());
//System.out.println(userSession.getUserId());
Integer Compliantcount;
Integer ComplaintCompletedcount;
//List<MTMEventsPetition> mtmEventsPetitionList;
String accessids = userSession.getAccessIds();
String[] accessids_array = accessids.split(",");
List<MTMEventsPetitionMapping> mtmEventsPetitionMappingList;
if(userSession.getEventid() != null && !userSession.getEventid().isEmpty()){
String eventid = userSession.getEventid();
mtmEventsPetitionMappingList = mtmEventsPetitionMappingRep.showByeventOfficer(eventid,accessids_array);
ComplaintCompletedcount = mtmEventsPetitionMappingRep.showCompletedByEventOfficer(eventid,accessids_array,"close").size();
}
else{
mtmEventsPetitionMappingList = mtmEventsPetitionMappingRep.showAllByOfficer(accessids_array);
ComplaintCompletedcount = mtmEventsPetitionMappingRep.showCompletedByOfficer(accessids_array,"close").size();
}
Compliantcount = mtmEventsPetitionMappingList.size();
model.addAttribute("Compliantcount", Compliantcount);
model.addAttribute("ComplaintCompletedcount", ComplaintCompletedcount);
model.addAttribute("ComplaintPendingcount", (Compliantcount-ComplaintCompletedcount));
List<MTMEvents> mtmEventsListcount;
String eventName ="All";
String eventid = officerAccessRep.getAccessOfficerIDs(userSession.getUserId()).get(0).getMtmId();
mtmEventsListcount = mtmEventsRep.eventsByID(eventid);
DateTimeFormatter inputFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
DateTimeFormatter outputFormatter = DateTimeFormatter.ofPattern("dd-MM-yyyy");
Long Petitioncount;
Long PetitionCompletedcount;
Long ComplaintCompletedcounttxt;
Long TotalComplaints = 0L;
for (MTMEvents event : mtmEventsListcount) {
String eventDateStr = event.getEventDate();
LocalDate eventDate = LocalDate.parse(eventDateStr, inputFormatter);
String formattedEventDate = eventDate.format(outputFormatter);
event.setEvent_date(formattedEventDate);
eventid = event.getMtmId().toString();
Petitioncount = mtmEventsPetitionRep.getPetitionCountByMTMID(eventid);
event.setTotal_petitions(Petitioncount.toString());
PetitionCompletedcount = mtmEventsPetitionRep.getPetitionCompletedCountByMTMID(eventid);
event.setPetitions_completed(PetitionCompletedcount.toString());
Long PetitionPendingCount = (Petitioncount-PetitionCompletedcount);
event.setPetitions_pending(PetitionPendingCount.toString());
event.setPetition_partially_completed(mtmEventsPetitionRep.getPetitionPartialCountByMTMID(eventid).toString());
ComplaintCompletedcounttxt = mtmEventsPetitionMappingRep.getCompletedCountByMTMID(eventid);
event.setCompliants_completed(ComplaintCompletedcounttxt.toString());
// Complaints
List<MTMEventsPetition> mtmEventsPetitionList = mtmEventsPetitionRep.showAllByMTMID(eventid);
Integer compliantCount = 0;
Integer totalCompliantTypes = mtmComplaintTypesRep.getComplaintCount()+1;
int[] byCompliantTypes = new int[totalCompliantTypes];
for (MTMEventsPetition petition : mtmEventsPetitionList) {
//System.out.println(petition.getPetitionerComplaint());
String compliant = petition.getPetitionerComplaint();
String[] compliantArray = compliant.split(",");
compliantCount+=compliantArray.length;
for (String compliantId : compliantArray) {
//System.out.println(compliantId);
int compliantIdInt = Integer.parseInt(compliantId);
byCompliantTypes[compliantIdInt]++;
}
}
TotalComplaints = TotalComplaints + compliantCount;
event.setTotal_compliants(compliantCount.toString());
Long pendingcount = (compliantCount-ComplaintCompletedcounttxt);
event.setCompliants_pending(pendingcount.toString());
}
model.addAttribute("mtmEventsTableList",mtmEventsListcount);
model.addAttribute("totalComplaintsCounts",TotalComplaints);
/*
List<MTMComplaintTypes> mtmComplaintTypesList = mtmComplaintTypesRep.showAll();
model.addAttribute("complaintTypesList",mtmComplaintTypesList);
//model.addAttribute("countByCompliantTypes",byCompliantTypes);
*/
List<MTMEvents> mtmEventsList = mtmEventsRep.showAll();
for (MTMEvents event : mtmEventsList) {
String eventDateStr = event.getEventDate();
LocalDate eventDate = LocalDate.parse(eventDateStr, inputFormatter);
String formattedEventDate = eventDate.format(outputFormatter);
event.setEventDate(formattedEventDate);
}
model.addAttribute("mtmEventsList",mtmEventsList);
//System.out.println(userSession.getEventid());
return "officer/dashboard";
}
/*
@GetMapping("/officer/petition-list")
public String petitionList(Model model) {
model.addAttribute("title","Petition List");
model.addAttribute("baseURL", appConfig.getBaseUrl());
List<MTMEventsPetition> mtmEventsPetitionList;
String accessids = userSession.getAccessIds();
String[] accessids_array = accessids.split(",");
if(userSession.getEventid() != null && !userSession.getEventid().isEmpty()){
String eventid = userSession.getEventid();
mtmEventsPetitionList = mtmEventsPetitionRep.showAllByOffId(eventid,accessids_array);
}
else{
mtmEventsPetitionList = mtmEventsPetitionRep.showAllOffId(accessids_array);
}
//model.addAttribute("petitionlist",mtmEventsPetitionList);
List<MTMComplaintTypes> mtmComplaintTypesList = mtmComplaintTypesRep.showAll();
model.addAttribute("complaintTypesList",mtmComplaintTypesList);
List<OfficerMaster> officerMasterList = officerMasterRep.showAll();
// Create a map to store the ID-name mappings from mtmComplaintTypesList
Map<Integer, String> complaintTypesMap = new HashMap<>();
for (MTMComplaintTypes complaintType : mtmComplaintTypesList) {
complaintTypesMap.put(complaintType.getComplaintTypeId(), complaintType.getComplaintType());
}
// Iterate over mtmEventsPetitionList and replace ID values with names
for (MTMEventsPetition petition : mtmEventsPetitionList) {
String[] complaintIds = petition.getPetitionerComplaint().split(",");
StringBuilder complaintNames = new StringBuilder();
for (String complaintId : complaintIds) {
int id = Integer.parseInt(complaintId);
if (complaintTypesMap.containsKey(id)) {
complaintNames.append(complaintTypesMap.get(id)).append(",");
}
}
if (complaintNames.length() > 0) {
complaintNames.deleteCharAt(complaintNames.length() - 1); // Remove the trailing comma
}
petition.setPetitionerComplaint_txt(complaintNames.toString());
}
model.addAttribute("petitionlist", mtmEventsPetitionList);
List<MTMEvents> mtmEventsList = mtmEventsRep.showAll();
DateTimeFormatter inputFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
DateTimeFormatter outputFormatter = DateTimeFormatter.ofPattern("dd-MM-yyyy");
for (MTMEvents event : mtmEventsList) {
String eventDateStr = event.getEventDate();
LocalDate eventDate = LocalDate.parse(eventDateStr, inputFormatter);
String formattedEventDate = eventDate.format(outputFormatter);
event.setEventDate(formattedEventDate);
}
model.addAttribute("mtmEventsList",mtmEventsList);
return "officer/petition-list";
}
@GetMapping("/officer/completed-petition-list")
public String completedPetitionList(Model model) {
String Status = "close";
model.addAttribute("title","Completed Petition List");
model.addAttribute("baseURL", appConfig.getBaseUrl());
List<MTMEventsPetition> mtmEventsPetitionList;
if(userSession.getEventid() != null && !userSession.getEventid().isEmpty()){
String eventid = userSession.getEventid();
mtmEventsPetitionList = mtmEventsPetitionRep.showCompletedByMTMID(eventid,Status);
}
else{
mtmEventsPetitionList = mtmEventsPetitionRep.showCompleted(Status);
}
//model.addAttribute("petitionlist",mtmEventsPetitionList);
List<MTMComplaintTypes> mtmComplaintTypesList = mtmComplaintTypesRep.showAll();
model.addAttribute("complaintTypesList",mtmComplaintTypesList);
List<OfficerMaster> officerMasterList = officerMasterRep.showAll();
// Create a map to store the ID-name mappings from mtmComplaintTypesList
Map<Integer, String> complaintTypesMap = new HashMap<>();
for (MTMComplaintTypes complaintType : mtmComplaintTypesList) {
complaintTypesMap.put(complaintType.getComplaintTypeId(), complaintType.getComplaintType());
}
// Iterate over mtmEventsPetitionList and replace ID values with names
for (MTMEventsPetition petition : mtmEventsPetitionList) {
String[] complaintIds = petition.getPetitionerComplaint().split(",");
StringBuilder complaintNames = new StringBuilder();
for (String complaintId : complaintIds) {
int id = Integer.parseInt(complaintId);
if (complaintTypesMap.containsKey(id)) {
complaintNames.append(complaintTypesMap.get(id)).append(",");
}
}
if (complaintNames.length() > 0) {
complaintNames.deleteCharAt(complaintNames.length() - 1); // Remove the trailing comma
}
petition.setPetitionerComplaint_txt(complaintNames.toString());
}
model.addAttribute("petitionlist", mtmEventsPetitionList);
List<MTMEvents> mtmEventsList = mtmEventsRep.showAll();
DateTimeFormatter inputFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
DateTimeFormatter outputFormatter = DateTimeFormatter.ofPattern("dd-MM-yyyy");
for (MTMEvents event : mtmEventsList) {
String eventDateStr = event.getEventDate();
LocalDate eventDate = LocalDate.parse(eventDateStr, inputFormatter);
String formattedEventDate = eventDate.format(outputFormatter);
event.setEventDate(formattedEventDate);
}
model.addAttribute("mtmEventsList",mtmEventsList);
return "officer/completed-petition-list";
}
@GetMapping("/officer/partial-petition-list")
public String partialPetitionList(Model model) {
String Status = "partial";
model.addAttribute("title","Partially Completed Petition List");
model.addAttribute("baseURL", appConfig.getBaseUrl());
List<MTMEventsPetition> mtmEventsPetitionList;
if(userSession.getEventid() != null && !userSession.getEventid().isEmpty()){
String eventid = userSession.getEventid();
mtmEventsPetitionList = mtmEventsPetitionRep.showCompletedByMTMID(eventid,Status);
}
else{
mtmEventsPetitionList = mtmEventsPetitionRep.showCompleted(Status);
}
//model.addAttribute("petitionlist",mtmEventsPetitionList);
List<MTMComplaintTypes> mtmComplaintTypesList = mtmComplaintTypesRep.showAll();
model.addAttribute("complaintTypesList",mtmComplaintTypesList);
List<OfficerMaster> officerMasterList = officerMasterRep.showAll();
// Create a map to store the ID-name mappings from mtmComplaintTypesList
Map<Integer, String> complaintTypesMap = new HashMap<>();
for (MTMComplaintTypes complaintType : mtmComplaintTypesList) {
complaintTypesMap.put(complaintType.getComplaintTypeId(), complaintType.getComplaintType());
}
// Iterate over mtmEventsPetitionList and replace ID values with names
for (MTMEventsPetition petition : mtmEventsPetitionList) {
String[] complaintIds = petition.getPetitionerComplaint().split(",");
StringBuilder complaintNames = new StringBuilder();
for (String complaintId : complaintIds) {
int id = Integer.parseInt(complaintId);
if (complaintTypesMap.containsKey(id)) {
complaintNames.append(complaintTypesMap.get(id)).append(",");
}
}
if (complaintNames.length() > 0) {
complaintNames.deleteCharAt(complaintNames.length() - 1); // Remove the trailing comma
}
petition.setPetitionerComplaint_txt(complaintNames.toString());
}
model.addAttribute("petitionlist", mtmEventsPetitionList);
List<MTMEvents> mtmEventsList = mtmEventsRep.showAll();
DateTimeFormatter inputFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
DateTimeFormatter outputFormatter = DateTimeFormatter.ofPattern("dd-MM-yyyy");
for (MTMEvents event : mtmEventsList) {
String eventDateStr = event.getEventDate();
LocalDate eventDate = LocalDate.parse(eventDateStr, inputFormatter);
String formattedEventDate = eventDate.format(outputFormatter);
event.setEventDate(formattedEventDate);
}
model.addAttribute("mtmEventsList",mtmEventsList);
return "officer/partial-petition-list";
}
@GetMapping("/officer/pending-petition-list")
public String pendingPetitionList(Model model) {
//String Status = "partial";
model.addAttribute("title","Pending Petition List");
model.addAttribute("baseURL", appConfig.getBaseUrl());
List<MTMEventsPetition> mtmEventsPetitionList;
if(userSession.getEventid() != null && !userSession.getEventid().isEmpty()){
String eventid = userSession.getEventid();
mtmEventsPetitionList = mtmEventsPetitionRep.showNotCompletedByMTMID(eventid);
}
else{
mtmEventsPetitionList = mtmEventsPetitionRep.showNotCompleted();
}
//model.addAttribute("petitionlist",mtmEventsPetitionList);
List<MTMComplaintTypes> mtmComplaintTypesList = mtmComplaintTypesRep.showAll();
model.addAttribute("complaintTypesList",mtmComplaintTypesList);
List<OfficerMaster> officerMasterList = officerMasterRep.showAll();
// Create a map to store the ID-name mappings from mtmComplaintTypesList
Map<Integer, String> complaintTypesMap = new HashMap<>();
for (MTMComplaintTypes complaintType : mtmComplaintTypesList) {
complaintTypesMap.put(complaintType.getComplaintTypeId(), complaintType.getComplaintType());
}
// Iterate over mtmEventsPetitionList and replace ID values with names
for (MTMEventsPetition petition : mtmEventsPetitionList) {
String[] complaintIds = petition.getPetitionerComplaint().split(",");
StringBuilder complaintNames = new StringBuilder();
for (String complaintId : complaintIds) {
int id = Integer.parseInt(complaintId);
if (complaintTypesMap.containsKey(id)) {
complaintNames.append(complaintTypesMap.get(id)).append(",");
}
}
if (complaintNames.length() > 0) {
complaintNames.deleteCharAt(complaintNames.length() - 1); // Remove the trailing comma
}
petition.setPetitionerComplaint_txt(complaintNames.toString());
}
model.addAttribute("petitionlist", mtmEventsPetitionList);
List<MTMEvents> mtmEventsList = mtmEventsRep.showAll();
DateTimeFormatter inputFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
DateTimeFormatter outputFormatter = DateTimeFormatter.ofPattern("dd-MM-yyyy");
for (MTMEvents event : mtmEventsList) {
String eventDateStr = event.getEventDate();
LocalDate eventDate = LocalDate.parse(eventDateStr, inputFormatter);
String formattedEventDate = eventDate.format(outputFormatter);
event.setEventDate(formattedEventDate);
}
model.addAttribute("mtmEventsList",mtmEventsList);
return "officer/pending-petition-list";
}
*/
@GetMapping("/officer/petition-search")
public String petitionSearch(Model model) {
model.addAttribute("title","Petition Search");
model.addAttribute("baseURL", appConfig.getBaseUrl());
List<MTMComplaintTypes> mtmComplaintTypesList = mtmComplaintTypesRep.showAll();
model.addAttribute("complaintTypesList",mtmComplaintTypesList);
return "officer/petition-search";
}
@GetMapping("/officer/complaint-list")
public String complaintList(Model model) {
model.addAttribute("title","Complaint List");
model.addAttribute("baseURL", appConfig.getBaseUrl());
String officer_id= userSession.getUserType();
List<MTMEventsPetitionMapping> mtmEventsPetitionMappingList;
String accessids = userSession.getAccessIds();
String[] accessids_array = accessids.split(",");
if(userSession.getEventid() != null && !userSession.getEventid().isEmpty()){
String eventid = userSession.getEventid();
mtmEventsPetitionMappingList = mtmEventsPetitionMappingRep.showByeventOfficer(eventid,accessids_array);
}
else{
mtmEventsPetitionMappingList = mtmEventsPetitionMappingRep.showAllByOfficer(accessids_array);
}
List<OfficerMaster> officerMasterList = officerMasterRep.showAll();
// Create a map of Officer IDs to Officer Names for easy lookup
Map<String, String> officerMap = new HashMap<>();
for (OfficerMaster officer : officerMasterList) {
officerMap.put(officer.getOffId(), officer.getOffNM());
}
// Iterate through the mtmEventsPetitionMappingList and add Officer Name
for (MTMEventsPetitionMapping mapping : mtmEventsPetitionMappingList) {
String officerId = mapping.getOffID();
String officerName = officerMap.get(officerId);
mapping.setOfficer_name(officerName);
if(mapping.getStatus()==null){
mapping.setStatus("Pending");
}
}
model.addAttribute("petitionlist", mtmEventsPetitionMappingList);
model.addAttribute("officerMasterList", officerMasterList);
List<MTMComplaintTypes> mtmComplaintTypesList = mtmComplaintTypesRep.showAll();
model.addAttribute("complaintTypesList",mtmComplaintTypesList);
List<MTMEvents> mtmEventsList = mtmEventsRep.showAll();
DateTimeFormatter inputFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
DateTimeFormatter outputFormatter = DateTimeFormatter.ofPattern("dd-MM-yyyy");
for (MTMEvents event : mtmEventsList) {
String eventDateStr = event.getEventDate();
LocalDate eventDate = LocalDate.parse(eventDateStr, inputFormatter);
String formattedEventDate = eventDate.format(outputFormatter);
event.setEventDate(formattedEventDate);
}
model.addAttribute("mtmEventsList",mtmEventsList);
return "officer/complaint-list";
}
@GetMapping("/officer/completed-complaint-list")
public String completedComplaintList(Model model) {
String Status = "close";
model.addAttribute("title","Completed Complaint List");
model.addAttribute("baseURL", appConfig.getBaseUrl());
String officer_id= userSession.getUserType();
List<MTMEventsPetitionMapping> mtmEventsPetitionMappingList;
String accessids = userSession.getAccessIds();
String[] accessids_array = accessids.split(",");
if(userSession.getEventid() != null && !userSession.getEventid().isEmpty()){
String eventid = userSession.getEventid();
mtmEventsPetitionMappingList = mtmEventsPetitionMappingRep.showCompletedByEventOfficer(eventid,accessids_array,"close");
}
else{
mtmEventsPetitionMappingList = mtmEventsPetitionMappingRep.showCompletedByOfficer(accessids_array,"close");
}
List<OfficerMaster> officerMasterList = officerMasterRep.showAll();
// Create a map of Officer IDs to Officer Names for easy lookup
Map<String, String> officerMap = new HashMap<>();
for (OfficerMaster officer : officerMasterList) {
officerMap.put(officer.getOffId(), officer.getOffNM());
}
// Iterate through the mtmEventsPetitionMappingList and add Officer Name
for (MTMEventsPetitionMapping mapping : mtmEventsPetitionMappingList) {
String officerId = mapping.getOffID();
String officerName = officerMap.get(officerId);
mapping.setOfficer_name(officerName);
if(mapping.getStatus()==null){
mapping.setStatus("Pending");
}
}
model.addAttribute("petitionlist", mtmEventsPetitionMappingList);
model.addAttribute("officerMasterList", officerMasterList);
List<MTMComplaintTypes> mtmComplaintTypesList = mtmComplaintTypesRep.showAll();
model.addAttribute("complaintTypesList",mtmComplaintTypesList);
List<MTMEvents> mtmEventsList = mtmEventsRep.showAll();
DateTimeFormatter inputFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
DateTimeFormatter outputFormatter = DateTimeFormatter.ofPattern("dd-MM-yyyy");
for (MTMEvents event : mtmEventsList) {
String eventDateStr = event.getEventDate();
LocalDate eventDate = LocalDate.parse(eventDateStr, inputFormatter);
String formattedEventDate = eventDate.format(outputFormatter);
event.setEventDate(formattedEventDate);
}
model.addAttribute("mtmEventsList",mtmEventsList);
return "officer/completed-complaint-list";
}
@GetMapping("/officer/pending-complaint-list")
public String pendingComplaintList(Model model) {
String Status = "close";
model.addAttribute("title","pending complaint list");
model.addAttribute("baseURL", appConfig.getBaseUrl());
String officer_id= userSession.getUserType();
List<MTMEventsPetitionMapping> mtmEventsPetitionMappingList;
String accessids = userSession.getAccessIds();
String[] accessids_array = accessids.split(",");
if(userSession.getEventid() != null && !userSession.getEventid().isEmpty()){
// String eventid = userSession.getEventid();
String eventid = officerAccessRep.getAccessOfficerIDs(userSession.getUserId()).get(0).getMtmId();
mtmEventsPetitionMappingList = mtmEventsPetitionMappingRep.showNotCompletedByEventOfficer(eventid,accessids_array);
}
else{
mtmEventsPetitionMappingList = mtmEventsPetitionMappingRep.showNotCompletedByOfficer(accessids_array);
}
List<OfficerMaster> officerMasterList = officerMasterRep.showAll();
// Create a map of Officer IDs to Officer Names for easy lookup
Map<String, String> officerMap = new HashMap<>();
for (OfficerMaster officer : officerMasterList) {
officerMap.put(officer.getOffId(), officer.getOffNM());
}
// Iterate through the mtmEventsPetitionMappingList and add Officer Name
for (MTMEventsPetitionMapping mapping : mtmEventsPetitionMappingList) {
String officerId = mapping.getOffID();
String officerName = officerMap.get(officerId);
mapping.setOfficer_name(officerName);
if(mapping.getStatus()==null){
mapping.setStatus("Pending");
}
}
model.addAttribute("petitionlist", mtmEventsPetitionMappingList);
model.addAttribute("officerMasterList", officerMasterList);
List<MTMComplaintTypes> mtmComplaintTypesList = mtmComplaintTypesRep.showAll();
model.addAttribute("complaintTypesList",mtmComplaintTypesList);
List<MTMEvents> mtmEventsList = mtmEventsRep.showAll();
DateTimeFormatter inputFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
DateTimeFormatter outputFormatter = DateTimeFormatter.ofPattern("dd-MM-yyyy");
for (MTMEvents event : mtmEventsList) {
String eventDateStr = event.getEventDate();
LocalDate eventDate = LocalDate.parse(eventDateStr, inputFormatter);
String formattedEventDate = eventDate.format(outputFormatter);
event.setEventDate(formattedEventDate);
}
model.addAttribute("mtmEventsList",mtmEventsList);
return "officer/pending-complaint-list";
}
@GetMapping("/officer/my-complaint-list")
public String myComplaintList(Model model) {
model.addAttribute("title","Complaint List");
model.addAttribute("baseURL", appConfig.getBaseUrl());
String officer_id= userSession.getUserType();
List<MTMEventsPetitionMapping> mtmEventsPetitionMappingList = null;
String accessids = userSession.getAccessIds();
String[] accessids_array = accessids.split(",");
if(userSession.getEventid() != null && !userSession.getEventid().isEmpty()){
//String eventid = userSession.getEventid();
String eventid = officerAccessRep.getAccessOfficerIDs(userSession.getUserId()).get(0).getMtmId();
mtmEventsPetitionMappingList = mtmEventsPetitionMappingRep.showByMTMID(eventid);
}
else{
String eventid = officerAccessRep.getAccessOfficerIDs(userSession.getUserId()).get(0).getMtmId();
mtmEventsPetitionMappingList = mtmEventsPetitionMappingRep.showByMTMID(eventid);
}
List<OfficerMaster> officerMasterList = officerMasterRep.showAll();
// Create a map of Officer IDs to Officer Names for easy lookup
Map<String, String> officerMap = new HashMap<>();
for (OfficerMaster officer : officerMasterList) {
officerMap.put(officer.getOffId(), officer.getOffNM());
}
// Iterate through the mtmEventsPetitionMappingList and add Officer Name
for (MTMEventsPetitionMapping mapping : mtmEventsPetitionMappingList) {
String officerId = mapping.getOffID();
String officerName = officerMap.get(officerId);
mapping.setOfficer_name(officerName);
if(mapping.getStatus()==null){
mapping.setStatus("Pending");
}
}
model.addAttribute("petitionlist", mtmEventsPetitionMappingList);
model.addAttribute("officerMasterList", officerMasterList);
List<MTMComplaintTypes> mtmComplaintTypesList = mtmComplaintTypesRep.showAll();
model.addAttribute("complaintTypesList",mtmComplaintTypesList);
List<MTMEvents> mtmEventsList = mtmEventsRep.showAll();
DateTimeFormatter inputFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
DateTimeFormatter outputFormatter = DateTimeFormatter.ofPattern("dd-MM-yyyy");
for (MTMEvents event : mtmEventsList) {
String eventDateStr = event.getEventDate();
LocalDate eventDate = LocalDate.parse(eventDateStr, inputFormatter);
String formattedEventDate = eventDate.format(outputFormatter);
event.setEventDate(formattedEventDate);
}
model.addAttribute("mtmEventsList",mtmEventsList);
return "officer/my-complaint-list";
}
@GetMapping("/officer/my-completed-complaint-list")
public String myCompletedComplaintList(Model model) {
String Status = "close";
model.addAttribute("title","Completed Complaint List");
model.addAttribute("baseURL", appConfig.getBaseUrl());
String officer_id= userSession.getUserType();
List<MTMEventsPetitionMapping> mtmEventsPetitionMappingList = null;
String accessids = userSession.getAccessIds();
String[] accessids_array = accessids.split(",");
if(userSession.getEventid() != null && !userSession.getEventid().isEmpty()){
//String eventid = userSession.getEventid();
String eventid = officerAccessRep.getAccessOfficerIDs(userSession.getUserId()).get(0).getMtmId();
mtmEventsPetitionMappingList = mtmEventsPetitionMappingRep.showCompletedByMTMID(eventid,"close");
}
else{
String eventid = officerAccessRep.getAccessOfficerIDs(userSession.getUserId()).get(0).getMtmId();
mtmEventsPetitionMappingList = mtmEventsPetitionMappingRep.showCompletedByMTMID(eventid,"close");
}
List<OfficerMaster> officerMasterList = officerMasterRep.showAll();
// Create a map of Officer IDs to Officer Names for easy lookup
Map<String, String> officerMap = new HashMap<>();
for (OfficerMaster officer : officerMasterList) {
officerMap.put(officer.getOffId(), officer.getOffNM());
}
// Iterate through the mtmEventsPetitionMappingList and add Officer Name
for (MTMEventsPetitionMapping mapping : mtmEventsPetitionMappingList) {
String officerId = mapping.getOffID();
String officerName = officerMap.get(officerId);
mapping.setOfficer_name(officerName);
if(mapping.getStatus()==null){
mapping.setStatus("Pending");
}
}
model.addAttribute("petitionlist", mtmEventsPetitionMappingList);
model.addAttribute("officerMasterList", officerMasterList);
List<MTMComplaintTypes> mtmComplaintTypesList = mtmComplaintTypesRep.showAll();
model.addAttribute("complaintTypesList",mtmComplaintTypesList);
List<MTMEvents> mtmEventsList = mtmEventsRep.showAll();
DateTimeFormatter inputFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
DateTimeFormatter outputFormatter = DateTimeFormatter.ofPattern("dd-MM-yyyy");
for (MTMEvents event : mtmEventsList) {
String eventDateStr = event.getEventDate();
LocalDate eventDate = LocalDate.parse(eventDateStr, inputFormatter);
String formattedEventDate = eventDate.format(outputFormatter);
event.setEventDate(formattedEventDate);
}
model.addAttribute("mtmEventsList",mtmEventsList);
return "officer/my-completed-complaint-list";
}
@GetMapping("/officer/my-pending-complaint-list")
public String myPendingComplaintList(Model model) {
String Status = "close";
model.addAttribute("title","pending complaint list");
model.addAttribute("baseURL", appConfig.getBaseUrl());
String officer_id= userSession.getUserType();
List<MTMEventsPetitionMapping> mtmEventsPetitionMappingList = null;
String accessids = userSession.getAccessIds();
String[] accessids_array = accessids.split(",");
if(userSession.getEventid() != null && !userSession.getEventid().isEmpty()){
String eventid = userSession.getEventid();
mtmEventsPetitionMappingList = mtmEventsPetitionMappingRep.showNotCompletedByMTMID(eventid);
}
else{
String eventid = officerAccessRep.getAccessOfficerIDs(userSession.getUserId()).get(0).getMtmId();
mtmEventsPetitionMappingList = mtmEventsPetitionMappingRep.showNotCompletedByMTMID(eventid);
}
List<OfficerMaster> officerMasterList = officerMasterRep.showAll();
// Create a map of Officer IDs to Officer Names for easy lookup
Map<String, String> officerMap = new HashMap<>();
for (OfficerMaster officer : officerMasterList) {
officerMap.put(officer.getOffId(), officer.getOffNM());
}
// Iterate through the mtmEventsPetitionMappingList and add Officer Name
for (MTMEventsPetitionMapping mapping : mtmEventsPetitionMappingList) {
String officerId = mapping.getOffID();
String officerName = officerMap.get(officerId);
mapping.setOfficer_name(officerName);
if(mapping.getStatus()==null){
mapping.setStatus("Pending");
}
}
model.addAttribute("petitionlist", mtmEventsPetitionMappingList);
model.addAttribute("officerMasterList", officerMasterList);
List<MTMComplaintTypes> mtmComplaintTypesList = mtmComplaintTypesRep.showAll();
model.addAttribute("complaintTypesList",mtmComplaintTypesList);
List<MTMEvents> mtmEventsList = mtmEventsRep.showAll();
DateTimeFormatter inputFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
DateTimeFormatter outputFormatter = DateTimeFormatter.ofPattern("dd-MM-yyyy");
for (MTMEvents event : mtmEventsList) {
String eventDateStr = event.getEventDate();
LocalDate eventDate = LocalDate.parse(eventDateStr, inputFormatter);
String formattedEventDate = eventDate.format(outputFormatter);
event.setEventDate(formattedEventDate);
}
model.addAttribute("mtmEventsList",mtmEventsList);
return "officer/my-pending-complaint-list";
}
}

BIN
src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/entity/._MTMComplaintTypes.java

BIN
src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/entity/._MTMEvents.java

BIN
src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/entity/._MTMEventsPetition.java

BIN
src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/entity/._MTMEventsPetitionAction.java

BIN
src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/entity/._MTMEventsPetitionFiles.java

BIN
src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/entity/._MTMEventsPetitionForwardLog.java

BIN
src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/entity/._MTMEventsPetitionMapping.java

BIN
src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/entity/._MTMUsers.java

BIN
src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/entity/._OfficerAccess.java

BIN
src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/entity/._OfficerMaster.java

76
src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/entity/MTMComplaintTypes.java

@ -0,0 +1,76 @@
package com.gcc.mtm.Makkalai.Thedi.Mayor.entity;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import jakarta.persistence.*;
@Entity
@Table(name = "mtm_complaint_types")
@JsonIgnoreProperties({"hibernateLazyInitializer"})
public class MTMComplaintTypes {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "complaint_typeid",nullable = false)
private Integer complaintTypeId;
@Column(name = "complaint_type", nullable = false, columnDefinition = "TEXT")
private String complaintType;
@Column(name = "isdelete",nullable = false, columnDefinition = "Boolean default false")
private Boolean isDelete;
@Column(name = "isactive",nullable = false, columnDefinition = "Boolean default true")
private Boolean isActive;
@Column(name = "created_by",nullable = false, columnDefinition = "Integer Default 0")
private Integer createdBy;
@Column(name = "cdate",nullable = false, columnDefinition = "DATETIME DEFAULT CURRENT_TIMESTAMP")
private String cDate;
public MTMComplaintTypes() {
}
public Integer getComplaintTypeId() {
return complaintTypeId;
}
public void setComplaintTypeId(Integer complaintTypeId) {
this.complaintTypeId = complaintTypeId;
}
public String getComplaintType() {
return complaintType;
}
public void setComplaintType(String complaintType) {
this.complaintType = complaintType;
}
public Boolean getIsActive() {
return isActive;
}
public void setIsActive(Boolean isActive) {
this.isActive = isActive;
}
public Boolean getIsDelete() {
return isDelete;
}
public void setIsDelete(Boolean isDelete) {
this.isDelete = isDelete;
}
public Integer getCreatedBy() {
return createdBy;
}
public void setCreatedBy(Integer createdBy) {
this.createdBy = createdBy;
}
public String getcDate() {
return cDate;
}
public void setcDate(String cDate) {
this.cDate = cDate;
}
}

207
src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/entity/MTMEvents.java

@ -0,0 +1,207 @@
package com.gcc.mtm.Makkalai.Thedi.Mayor.entity;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import jakarta.persistence.*;
@Table(name = "mtm_events")
@JsonIgnoreProperties({"hibernateLazyInitializer"})
@Entity
public class MTMEvents {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "mtm_id",nullable = false)
private Integer mtmId;
@Column(name = "eventname",nullable = false)
private String eventName;
@Column(name = "eventaddress",nullable = false)
private String eventAddress;
@Column(name = "eventdate",nullable = false, columnDefinition = "DATETIME DEFAULT CURRENT_TIMESTAMP")
private String eventDate;
@Column(name = "zone", nullable = false, columnDefinition = "VARCHAR(255) DEFAULT '0'")
private String zone;
@Column(name = "ackno",nullable = false)
private String ackNo;
@Column(name = "startpetid",nullable = false, columnDefinition = "Integer Default 0")
private Integer startPetId;
@Column(name = "isdelete",nullable = false, columnDefinition = "Boolean default false")
private Boolean isDelete;
@Column(name = "isactive",nullable = false, columnDefinition = "Boolean default true")
private Boolean isActive;
@Column(name = "created_by",nullable = false, columnDefinition = "Integer Default 0")
private Integer createdBy;
@Column(name = "cdate",nullable = false, columnDefinition = "DATETIME DEFAULT CURRENT_TIMESTAMP")
private String cDate;
@Transient
private String event_date;
@Transient
private String total_petitions;
@Transient
private String petitions_completed;
@Transient
private String petition_partially_completed;
@Transient
private String petitions_pending;
@Transient
private String total_compliants;
@Transient
private String compliants_completed;
@Transient
private String compliants_pending;
public MTMEvents() {
}
public Integer getMtmId() {
return mtmId;
}
public void setMtmId(Integer mtmId) {
this.mtmId = mtmId;
}
public String getEventName() {
return eventName;
}
public void setEventName(String eventName) {
this.eventName = eventName;
}
public String getZone() {
return zone;
}
public void setZone(String zone) {
this.zone = zone;
}
public String getEventAddress() {
return eventAddress;
}
public void setEventAddress(String eventAddress) {
this.eventAddress = eventAddress;
}
public String getEventDate() {
return eventDate;
}
public void setEventDate(String eventDate) {
this.eventDate = eventDate;
}
public Boolean getIsActive() {
return isActive;
}
public void setIsActive(Boolean isActive) {
this.isActive = isActive;
}
public Boolean getIsDelete() {
return isDelete;
}
public void setIsDelete(Boolean isDelete) {
this.isDelete = isDelete;
}
public Integer getCreatedBy() {
return createdBy;
}
public void setCreatedBy(Integer createdBy) {
this.createdBy = createdBy;
}
public String getcDate() {
return cDate;
}
public void setcDate(String cDate) {
this.cDate = cDate;
}
public String getEvent_date() {
return event_date;
}
public void setEvent_date(String event_date) {
this.event_date = event_date;
}
public String getTotal_petitions() {
return total_petitions;
}
public void setTotal_petitions(String total_petitions) {
this.total_petitions = total_petitions;
}
public String getPetitions_completed() {
return petitions_completed;
}
public void setPetitions_completed(String petitions_completed) {
this.petitions_completed = petitions_completed;
}
public String getPetition_partially_completed() {
return petition_partially_completed;
}
public void setPetition_partially_completed(String petition_partially_completed) {
this.petition_partially_completed = petition_partially_completed;
}
public String getPetitions_pending() {
return petitions_pending;
}
public void setPetitions_pending(String petitions_pending) {
this.petitions_pending = petitions_pending;
}
public String getTotal_compliants() {
return total_compliants;
}
public void setTotal_compliants(String total_compliants) {
this.total_compliants = total_compliants;
}
public String getCompliants_completed() {
return compliants_completed;
}
public void setCompliants_completed(String compliants_completed) {
this.compliants_completed = compliants_completed;
}
public String getCompliants_pending() {
return compliants_pending;
}
public void setCompliants_pending(String compliants_pending) {
this.compliants_pending = compliants_pending;
}
public String getAckNo() {
return ackNo;
}
public void setAckNo(String ackNo) {
this.ackNo = ackNo;
}
public Integer getStartPetId() {
return startPetId;
}
public void setStartPetId(Integer startPetId) {
this.startPetId = startPetId;
}
}

170
src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/entity/MTMEventsPetition.java

@ -0,0 +1,170 @@
package com.gcc.mtm.Makkalai.Thedi.Mayor.entity;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.google.gson.annotations.SerializedName;
import jakarta.persistence.*;
import org.hibernate.annotations.ManyToAny;
import org.w3c.dom.Text;
@Entity
@Table(name = "mtm_events_petition")
@JsonIgnoreProperties({"hibernateLazyInitializer"})
public class MTMEventsPetition {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "petition_id",nullable = false)
private Integer petitionId;
@ManyToOne
@JoinColumn(name="mtm_id",nullable = false)
private MTMEvents mtmEvents;
@Column(name = "petition_no",nullable = true)
private String petitionNumber;
@Column(name = "pet_name",nullable = false)
private String petitionerName;
@Column(name = "pet_mobile",nullable = false)
private String petitionerMobile;
@Column(name = "pet_complaint",nullable = true)
private String petitionerComplaint;
@Column(name = "pet_address",nullable = true)
private String petitionerAddress;
@Column(name = "pet_pincode",nullable = true)
private String petitionerPincode;
@Column(name = "pet_complaint_nature",nullable = true)
private String petitionerNatureOfComplaint;
@Column(name = "tableno",nullable = true)
private String tableNo;
@Column(name = "isdelete",nullable = false, columnDefinition = "Boolean default false")
private Boolean isDelete;
@Column(name = "isactive",nullable = false, columnDefinition = "Boolean default true")
private Boolean isActive;
@Column(name = "created_by",nullable = false, columnDefinition = "Integer Default 0")
private Integer createdBy;
@Column(name = "cdate",nullable = false, columnDefinition = "DATETIME DEFAULT CURRENT_TIMESTAMP")
private String cDate;
@Column(name = "status",nullable = false, columnDefinition = "VARCHAR(255) DEFAULT 'Under Progress'")
private String status;
public MTMEventsPetition() {
}
public Integer getPetitionId() {
return petitionId;
}
public void setPetitionId(Integer petitionId) {
this.petitionId = petitionId;
}
public MTMEvents getMtmEvents() {
return mtmEvents;
}
public void setMtmEvents(MTMEvents mtmEvents) {
this.mtmEvents = mtmEvents;
}
public String getPetitionNumber() {
return petitionNumber;
}
public void setPetitionNumber(String petitionNumber) {
this.petitionNumber = petitionNumber;
}
public String getPetitionerName() {
return petitionerName;
}
public void setPetitionerName(String petitionerName) {
this.petitionerName = petitionerName;
}
public String getPetitionerMobile() {
return petitionerMobile;
}
public void setPetitionerMobile(String petitionerMobile) {
this.petitionerMobile = petitionerMobile;
}
public String getPetitionerComplaint() {
return petitionerComplaint;
}
public void setPetitionerComplaint(String petitionerComplaint) {
this.petitionerComplaint = petitionerComplaint;
}
public String getPetitionerAddress() {
return petitionerAddress;
}
public String getTableNo() {
return tableNo;
}
public void setTableNo(String tableNo) {
this.tableNo = tableNo;
}
public void setPetitionerAddress(String petitionerAddress) {
this.petitionerAddress = petitionerAddress;
}
public String getPetitionerPincode() {
return petitionerPincode;
}
public void setPetitionerPincode(String petitionerPincode) {
this.petitionerPincode = petitionerPincode;
}
public Boolean getIsActive() {
return isActive;
}
public void setIsActive(Boolean isActive) {
this.isActive = isActive;
}
public Boolean getIsDelete() {
return isDelete;
}
public void setIsDelete(Boolean isDelete) {
this.isDelete = isDelete;
}
public Integer getCreatedBy() {
return createdBy;
}
public void setCreatedBy(Integer createdBy) {
this.createdBy = createdBy;
}
public String getcDate() {
return cDate;
}
public void setcDate(String cDate) {
this.cDate = cDate;
}
public String getPetitionerNatureOfComplaint() {
return petitionerNatureOfComplaint;
}
public void setPetitionerNatureOfComplaint(String petitionerNatureOfComplaint) {
this.petitionerNatureOfComplaint = petitionerNatureOfComplaint;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
@Transient
private String PetitionerComplaint_txt;
public String getPetitionerComplaint_txt() {
return PetitionerComplaint_txt;
}
public void setPetitionerComplaint_txt(String petitionerComplaint_txt) {
PetitionerComplaint_txt = petitionerComplaint_txt;
}
}

156
src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/entity/MTMEventsPetitionAction.java

@ -0,0 +1,156 @@
package com.gcc.mtm.Makkalai.Thedi.Mayor.entity;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import jakarta.persistence.*;
import java.sql.Blob;
@Entity
@Table(name = "mtm_events_petition_action")
@JsonIgnoreProperties({"hibernateLazyInitializer"})
public class MTMEventsPetitionAction {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "solmapid",nullable = false)
private Integer solMapId;
@ManyToOne
@JoinColumn(name = "mapid",nullable = false)
private MTMEventsPetitionMapping mtmEventsPetitionMapping;
@Column(name = "status",nullable = false)
private String status;
@Column(name = "comments", columnDefinition = "TEXT")
private String comments;
@Column(name = "fileName", nullable = true)
private String fileName;
@Lob
@Column(columnDefinition = "LONGBLOB")
private Blob data;
@Column(name = "OFF_ID",nullable = false)
private String offID;
@Column(name = "isdelete",nullable = false, columnDefinition = "Boolean default false")
private Boolean isDelete;
@Column(name = "isactive",nullable = false, columnDefinition = "Boolean default true")
private Boolean isActive;
@Column(name = "created_by",nullable = false, columnDefinition = "Integer Default 0")
private Integer createdBy;
@Column(name = "cdate",nullable = false, columnDefinition = "DATETIME DEFAULT CURRENT_TIMESTAMP")
private String cDate;
private long fileSize;
private String fileType;
public MTMEventsPetitionAction() {
}
public Integer getSolMapId() {
return solMapId;
}
public void setSolMapId(Integer solMapId) {
this.solMapId = solMapId;
}
public MTMEventsPetitionMapping getMtmEventsPetitionMapping() {
return mtmEventsPetitionMapping;
}
public void setMtmEventsPetitionMapping(MTMEventsPetitionMapping mtmEventsPetitionMapping) {
this.mtmEventsPetitionMapping = mtmEventsPetitionMapping;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getComments() {
return comments;
}
public void setComments(String comments) {
this.comments = comments;
}
public String getFileName() {
return fileName;
}
public void setFileName(String fileName) {
this.fileName = fileName;
}
public Blob getData() {
return data;
}
public void setData(Blob data) {
this.data = data;
}
public String getOffID() {
return offID;
}
public void setOffID(String offID) {
this.offID = offID;
}
public Boolean getIsActive() {
return isActive;
}
public void setIsActive(Boolean isActive) {
this.isActive = isActive;
}
public Boolean getIsDelete() {
return isDelete;
}
public void setIsDelete(Boolean isDelete) {
this.isDelete = isDelete;
}
public Integer getCreatedBy() {
return createdBy;
}
public void setCreatedBy(Integer createdBy) {
this.createdBy = createdBy;
}
public String getcDate() {
return cDate;
}
public void setcDate(String cDate) {
this.cDate = cDate;
}
@Transient
private String officer_name;
public String getOfficer_name() {
return officer_name;
}
public void setOfficer_name(String officer_name) {
this.officer_name = officer_name;
}
public long getFileSize() {
return fileSize;
}
public void setFileSize(long fileSize) {
this.fileSize = fileSize;
}
public String getFileType() {
return fileType;
}
public void setFileType(String fileType) {
this.fileType = fileType;
}
}

129
src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/entity/MTMEventsPetitionFiles.java

@ -0,0 +1,129 @@
package com.gcc.mtm.Makkalai.Thedi.Mayor.entity;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import jakarta.persistence.*;
import java.sql.Blob;
import java.time.LocalDateTime;
@Entity
@Table(name = "mtm_events_pentition_files")
@JsonIgnoreProperties({"hibernateLazyInitializer"})
public class MTMEventsPetitionFiles {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "mtm_pet_file_id",nullable = false)
private Integer mtmPetitionFileId;
@Column(name = "petition_no",nullable = false)
private String petitionNumber;
@ManyToOne
@JoinColumn(name="petition_id",nullable = false)
private MTMEventsPetition mtmEventsPetitionId;
@Column(name = "fileName", nullable = false)
private String fileName;
@Lob
@Column(columnDefinition = "LONGBLOB")
private Blob data;
@Column(name = "isdelete",nullable = false, columnDefinition = "Boolean default false")
private Boolean isdelete = false;
@Column(name = "isactive",nullable = false, columnDefinition = "Boolean default true")
private Boolean isactive = true;
@Column(name = "created_by",nullable = false, columnDefinition = "Integer Default 0")
private Integer createdBy = 0;
@Column(name = "cdate",nullable = false, columnDefinition = "DATETIME DEFAULT CURRENT_TIMESTAMP")
private java.time.LocalDateTime cDate;
private long fileSize;
private String fileType;
public MTMEventsPetitionFiles() {
}
public Integer getMtmPetitionFileId() {
return mtmPetitionFileId;
}
public void setMtmPetitionFileId(Integer mtmPetitionFileId) {
this.mtmPetitionFileId = mtmPetitionFileId;
}
public String getPetitionNumber() {
return petitionNumber;
}
public void setPetitionNumber(String petitionNumber) {
this.petitionNumber = petitionNumber;
}
public MTMEventsPetition getMtmEventsPetitionId() {
return mtmEventsPetitionId;
}
public void setMtmEventsPetitionId(MTMEventsPetition mtmEventsPetitionId) {
this.mtmEventsPetitionId = mtmEventsPetitionId;
}
public String getFileName() {
return fileName;
}
public void setFileName(String fileName) {
this.fileName = fileName;
}
public Blob getData() {
return data;
}
public void setData(Blob data) {
this.data = data;
}
public Boolean getIsdelete() {
return isdelete;
}
public void setIsdelete(Boolean isdelete) {
this.isdelete = isdelete;
}
public Boolean getIsactive() {
return isactive;
}
public void setIsactive(Boolean isactive) {
this.isactive = isactive;
}
public Integer getCreatedBy() {
return createdBy;
}
public void setCreatedBy(Integer createdBy) {
this.createdBy = createdBy;
}
public LocalDateTime getcDate() {
return cDate;
}
public void setcDate(LocalDateTime cDate) {
this.cDate = cDate;
}
public long getFileSize() {
return fileSize;
}
public void setFileSize(long fileSize) {
this.fileSize = fileSize;
}
public String getFileType() {
return fileType;
}
public void setFileType(String fileType) {
this.fileType = fileType;
}
}

171
src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/entity/MTMEventsPetitionForwardLog.java

@ -0,0 +1,171 @@
package com.gcc.mtm.Makkalai.Thedi.Mayor.entity;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import jakarta.persistence.*;
@Entity
@Table(name = "mtm_events_petition_forward_log")
@JsonIgnoreProperties({"hibernateLazyInitializer"})
public class MTMEventsPetitionForwardLog {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "logid",nullable = false)
private Integer logId;
@Column(name = "petition_no",nullable = false)
private String petitionNumber;
@ManyToOne
@JoinColumn(name="petition_id",nullable = false)
private MTMEventsPetition mtmEventsPetitionId;
@ManyToOne
@JoinColumn(name="mtm_id",nullable = false)
private MTMEvents mtmEvents;
@Column(name = "OFF_ID",nullable = false)
private String offID;
@Column(name = "OFF_ID_to",nullable = false)
private String offIDTo;
@Column(name = "comments", columnDefinition = "TEXT")
private String comments;
@ManyToOne
@JoinColumn(name = "mapid",nullable = false)
private MTMEventsPetitionMapping mtmEventsPetitionMapping;
@ManyToOne
@JoinColumn(name = "complaint_typeid",nullable = false)
private MTMComplaintTypes mtmComplaintTypes;
@Column(name = "isdelete",nullable = false, columnDefinition = "Boolean default false")
private Boolean isDelete;
@Column(name = "isactive",nullable = false, columnDefinition = "Boolean default true")
private Boolean isActive;
@Column(name = "created_by",nullable = false, columnDefinition = "Integer Default 0")
private Integer createdBy;
@Column(name = "cdate",nullable = false, columnDefinition = "DATETIME DEFAULT CURRENT_TIMESTAMP")
private String cDate;
public MTMEventsPetitionForwardLog() {
}
public Integer getLogId() {
return logId;
}
public void setLogId(Integer logId) {
this.logId = logId;
}
public String getPetitionNumber() {
return petitionNumber;
}
public void setPetitionNumber(String petitionNumber) {
this.petitionNumber = petitionNumber;
}
public MTMEventsPetition getMtmEventsPetitionId() {
return mtmEventsPetitionId;
}
public void setMtmEventsPetitionId(MTMEventsPetition mtmEventsPetitionId) {
this.mtmEventsPetitionId = mtmEventsPetitionId;
}
public MTMEventsPetitionMapping getMtmEventsPetitionMapping() {
return mtmEventsPetitionMapping;
}
public void setMtmEventsPetitionMapping(MTMEventsPetitionMapping mtmEventsPetitionMapping) {
this.mtmEventsPetitionMapping = mtmEventsPetitionMapping;
}
public String getOffID() {
return offID;
}
public void setOffID(String offID) {
this.offID = offID;
}
public MTMComplaintTypes getMtmComplaintTypes() {
return mtmComplaintTypes;
}
public void setMtmComplaintTypes(MTMComplaintTypes mtmComplaintTypes) {
this.mtmComplaintTypes = mtmComplaintTypes;
}
public Boolean getIsActive() {
return isActive;
}
public void setIsActive(Boolean isActive) {
this.isActive = isActive;
}
public Boolean getIsDelete() {
return isDelete;
}
public void setIsDelete(Boolean isDelete) {
this.isDelete = isDelete;
}
public Integer getCreatedBy() {
return createdBy;
}
public void setCreatedBy(Integer createdBy) {
this.createdBy = createdBy;
}
public String getcDate() {
return cDate;
}
public void setcDate(String cDate) {
this.cDate = cDate;
}
public String getOffIDTo() {
return offIDTo;
}
public void setOffIDTo(String offIDTo) {
this.offIDTo = offIDTo;
}
public String getComments() {
return comments;
}
public void setComments(String comments) {
this.comments = comments;
}
@Transient
private String officer_name;
public String getOfficer_name() {
return officer_name;
}
public void setOfficer_name(String officer_name) {
this.officer_name = officer_name;
}
@Transient
private String officer_to_name;
public String getOfficer_to_name() {
return officer_to_name;
}
public void setOfficer_to_name(String officer_to_name) {
this.officer_to_name = officer_to_name;
}
public MTMEvents getMtmEvents() {
return mtmEvents;
}
public void setMtmEvents(MTMEvents mtmEvents) {
this.mtmEvents = mtmEvents;
}
}

181
src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/entity/MTMEventsPetitionMapping.java

@ -0,0 +1,181 @@
package com.gcc.mtm.Makkalai.Thedi.Mayor.entity;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import jakarta.persistence.*;
@Entity
@Table(name = "mtm_events_petition_mapping")
@JsonIgnoreProperties({"hibernateLazyInitializer"})
public class MTMEventsPetitionMapping {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "mapid",nullable = false)
private Integer mapId;
@Column(name = "petition_no",nullable = false)
private String petitionNumber;
@ManyToOne
@JoinColumn(name="petition_id",nullable = false)
private MTMEventsPetition mtmEventsPetitionId;
@ManyToOne
@JoinColumn(name="mtm_id",nullable = false)
private MTMEvents mtmEvents;
@Column(name = "OFF_ID",nullable = false)
private String offID;
@Column(name = "status",nullable = false,columnDefinition = "VARCHAR(20) DEFAULT 'pending'")
private String status;
@ManyToOne
@JoinColumn(name = "complaint_typeid",nullable = false)
private MTMComplaintTypes mtmComplaintTypes;
@Column(name = "isdelete",nullable = false, columnDefinition = "Boolean default false")
private Boolean isDelete;
@Column(name = "isactive",nullable = false, columnDefinition = "Boolean default true")
private Boolean isActive;
@Column(name = "created_by",nullable = false, columnDefinition = "Integer Default 0")
private Integer createdBy;
@Column(name = "cdate",nullable = false, columnDefinition = "DATETIME DEFAULT CURRENT_TIMESTAMP")
private String cDate;
public MTMEventsPetitionMapping() {
}
public Integer getMapId() {
return mapId;
}
public void setMapId(Integer mapId) {
this.mapId = mapId;
}
public String getPetitionNumber() {
return petitionNumber;
}
public void setPetitionNumber(String petitionNumber) {
this.petitionNumber = petitionNumber;
}
public MTMEventsPetition getMtmEventsPetitionId() {
return mtmEventsPetitionId;
}
public void setMtmEventsPetitionId(MTMEventsPetition mtmEventsPetitionId) {
this.mtmEventsPetitionId = mtmEventsPetitionId;
}
public String getOffID() {
return offID;
}
public void setOffID(String offID) {
this.offID = offID;
}
public MTMComplaintTypes getMtmComplaintTypes() {
return mtmComplaintTypes;
}
public void setMtmComplaintTypes(MTMComplaintTypes mtmComplaintTypes) {
this.mtmComplaintTypes = mtmComplaintTypes;
}
public Boolean getIsActive() {
return isActive;
}
public void setIsActive(Boolean isActive) {
this.isActive = isActive;
}
public Boolean getIsDelete() {
return isDelete;
}
public void setIsDelete(Boolean isDelete) {
this.isDelete = isDelete;
}
public Integer getCreatedBy() {
return createdBy;
}
public void setCreatedBy(Integer createdBy) {
this.createdBy = createdBy;
}
public String getcDate() {
return cDate;
}
public void setcDate(String cDate) {
this.cDate = cDate;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public MTMEvents getMtmEvents() {
return mtmEvents;
}
public void setMtmEvents(MTMEvents mtmEvents) {
this.mtmEvents = mtmEvents;
}
@Transient
private String officer_name;
@Transient
private String event_name;
@Transient
private String officer_petition_count;
@Transient
private String officer_completed_count;
@Transient
private String officer_pending_count;
public String getOfficer_name() {
return officer_name;
}
public void setOfficer_name(String officer_name) {
this.officer_name = officer_name;
}
public String getOfficer_petition_count() {
return officer_petition_count;
}
public String getEvent_name() {
return event_name;
}
public void setEvent_name(String event_name) {
this.event_name = event_name;
}
public void setOfficer_petition_count(String officer_petition_count) {
this.officer_petition_count = officer_petition_count;
}
public String getOfficer_completed_count() {
return officer_completed_count;
}
public void setOfficer_completed_count(String officer_completed_count) {
this.officer_completed_count = officer_completed_count;
}
public String getOfficer_pending_count() {
return officer_pending_count;
}
public void setOfficer_pending_count(String officer_pending_count) {
this.officer_pending_count = officer_pending_count;
}
}

118
src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/entity/MTMUsers.java

@ -0,0 +1,118 @@
package com.gcc.mtm.Makkalai.Thedi.Mayor.entity;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import jakarta.persistence.*;
@Entity
@Table(name = "mtm_user_master")
@JsonIgnoreProperties({"hibernateLazyInitializer"})
public class MTMUsers {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "uid",nullable = false)
private Integer uId;
@Column(name = "uname",nullable = false)
private String userName;
@Column(name = "pword",nullable = false)
private String Password;
@Column(name = "table_no",nullable = false,columnDefinition = "VARCHAR(15) DEFAULT ")
private String tableNum;
@Column(name = "eventid",nullable = false)
private String eventid;
@Column(name = "userType",nullable = true, columnDefinition = "VARCHAR(255) DEFAULT 'user'")
private String userType;
@Column(name = "displayname",nullable = true, columnDefinition = "VARCHAR(255) DEFAULT 'user'")
private String displayName;
@Column(name = "isdelete",nullable = false, columnDefinition = "Boolean default false")
private Boolean isDelete;
@Column(name = "isactive",nullable = false, columnDefinition = "Boolean default true")
private Boolean isActive;
@Column(name = "created_by",nullable = false, columnDefinition = "Integer Default 0")
private Integer createdBy;
@Column(name = "cdate",nullable = false, columnDefinition = "DATETIME DEFAULT CURRENT_TIMESTAMP")
private String cDate;
public MTMUsers() {
}
public Integer getuId() {
return uId;
}
public void setuId(Integer uId) {
this.uId = uId;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getPassword() {
return Password;
}
public void setPassword(String password) {
Password = password;
}
public String getTableNum() {
return tableNum;
}
public void setTableNum(String tableNum) {
this.tableNum = tableNum;
}
public String getEventid() {
return eventid;
}
public void setEventid(String eventid) {
this.eventid = eventid;
}
public String getDisplayName() {
return displayName;
}
public void setDisplayName(String displayName) {
this.displayName = displayName;
}
public String getUserType() {
return userType;
}
public void setUserType(String userType) {
this.userType = userType;
}
public Boolean getIsActive() {
return isActive;
}
public void setIsActive(Boolean isActive) {
this.isActive = isActive;
}
public Boolean getIsDelete() {
return isDelete;
}
public void setIsDelete(Boolean isDelete) {
this.isDelete = isDelete;
}
public Integer getCreatedBy() {
return createdBy;
}
public void setCreatedBy(Integer createdBy) {
this.createdBy = createdBy;
}
public String getcDate() {
return cDate;
}
public void setcDate(String cDate) {
this.cDate = cDate;
}
}

58
src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/entity/OfficerAccess.java

@ -0,0 +1,58 @@
package com.gcc.mtm.Makkalai.Thedi.Mayor.entity;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import jakarta.persistence.*;
@Entity
@Table(name = "mtm_officer_access")
@JsonIgnoreProperties({"hibernateLazyInitializer"})
public class OfficerAccess {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "accessid",nullable = false)
private Integer accessId;
@ManyToOne
@JoinColumn(name="uid",nullable = false)
private MTMUsers mtmUsers;
@Column(name = "mtm_id", columnDefinition = "TEXT")
private String mtmId;
@Column(name = "officer_id", columnDefinition = "TEXT")
private String officerId;
public OfficerAccess() {
}
public Integer getAccessId() {
return accessId;
}
public void setAccessId(Integer accessId) {
this.accessId = accessId;
}
public MTMUsers getMtmUsers() {
return mtmUsers;
}
public void setMtmUsers(MTMUsers mtmUsers) {
this.mtmUsers = mtmUsers;
}
public String getOfficerId() {
return officerId;
}
public void setOfficerId(String officerId) {
this.officerId = officerId;
}
public String getMtmId() {
return mtmId;
}
public void setMtmId(String mtmId) {
this.mtmId = mtmId;
}
}

110
src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/entity/OfficerMaster.java

@ -0,0 +1,110 @@
package com.gcc.mtm.Makkalai.Thedi.Mayor.entity;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import jakarta.persistence.*;
@Entity
@Table(name = "mtm_officer_master")
@JsonIgnoreProperties({"hibernateLazyInitializer"})
public class OfficerMaster {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "uid",nullable = false)
private Integer uId;
@Column(name = "OFF_ID",nullable = false)
private String offId;
@Column(name = "ZONE_ID",nullable = false)
private String zoneId;
@Column(name = "OFF_NM",nullable = false)
private String offNM;
@Column(name = "ORDER_ID",nullable = true)
private String orderId;
@Column(name = "HQ_DESG_ID",nullable = true)
private String hqDescId;
@Column(name = "eventdate",nullable = false, columnDefinition = "DATETIME DEFAULT CURRENT_TIMESTAMP")
private String eventDate;
@Column(name = "isdelete",nullable = false, columnDefinition = "Boolean default false")
private Boolean isDelete;
@Column(name = "isactive",nullable = false, columnDefinition = "Boolean default true")
private Boolean isActive;
@Column(name = "created_by",nullable = false, columnDefinition = "Integer Default 0")
private Integer createdBy;
@Column(name = "cdate",nullable = false, columnDefinition = "DATETIME DEFAULT CURRENT_TIMESTAMP")
private String cDate;
public OfficerMaster() {
}
public Integer getuId() {
return uId;
}
public void setuId(Integer uId) {
this.uId = uId;
}
public String getOffId() {
return offId;
}
public void setOffId(String offId) {
this.offId = offId;
}
public String getZoneId() {
return zoneId;
}
public void setZoneId(String zoneId) {
this.zoneId = zoneId;
}
public String getOffNM() {
return offNM;
}
public void setOffNM(String offNM) {
this.offNM = offNM;
}
public String getOrderId() {
return orderId;
}
public void setOrderId(String orderId) {
this.orderId = orderId;
}
public String getHqDescId() {
return hqDescId;
}
public void setHqDescId(String hqDescId) {
this.hqDescId = hqDescId;
}
public Boolean getIsActive() {
return isActive;
}
public void setIsActive(Boolean isActive) {
this.isActive = isActive;
}
public Boolean getIsDelete() {
return isDelete;
}
public void setIsDelete(Boolean isDelete) {
this.isDelete = isDelete;
}
public Integer getCreatedBy() {
return createdBy;
}
public void setCreatedBy(Integer createdBy) {
this.createdBy = createdBy;
}
public String getcDate() {
return cDate;
}
public void setcDate(String cDate) {
this.cDate = cDate;
}
}

BIN
src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/error/._CustomErrorController.java

BIN
src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/error/._CustomExceptionHandler.java

35
src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/error/CustomErrorController.java

@ -0,0 +1,35 @@
package com.gcc.mtm.Makkalai.Thedi.Mayor.error;
import com.gcc.mtm.Makkalai.Thedi.Mayor.others.AppConfig;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.web.servlet.error.ErrorController;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
public class CustomErrorController implements ErrorController {
@Autowired
private AppConfig appConfig;
@RequestMapping("/error")
public String handleError(Exception ex, Model model) {
/*System.out.println(ex);
String errorMessage = ex.getMessage();
// Retrieve the error message and exception from the model
//String errorMessage = (String) model.getAttribute("error");
//Exception exception = (Exception) model.getAttribute("exception");
// Add the error message and exception to the model for rendering in the error page
model.addAttribute("error", errorMessage);
model.addAttribute("exception", ex);
*/
// Return the name of your custom error page template
model.addAttribute("title","Completed Petition List");
model.addAttribute("baseURL", appConfig.getBaseUrl());
return "error";
}
public String getErrorPath() {
return "/error";
}
}

16
src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/error/CustomExceptionHandler.java

@ -0,0 +1,16 @@
package com.gcc.mtm.Makkalai.Thedi.Mayor.error;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.servlet.ModelAndView;
@ControllerAdvice
public class CustomExceptionHandler {
@ExceptionHandler(Exception.class)
public ModelAndView handleException(Exception ex) {
ModelAndView modelAndView = new ModelAndView("error");
modelAndView.addObject("error", "An error occurred");
modelAndView.addObject("exception", ex.getMessage());
return modelAndView;
}
}

BIN
src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/login/._CheckUserSession.java

BIN
src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/login/._LoginController.java

BIN
src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/login/._UserService.java

BIN
src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/login/._UserSession.java

18
src/main/java/com/gcc/mtm/Makkalai/Thedi/Mayor/login/CheckUserSession.java

@ -0,0 +1,18 @@
package com.gcc.mtm.Makkalai.Thedi.Mayor.login;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class CheckUserSession {
@Autowired
UserSession userSession;
public String checkislogin(){
System.out.println("Check is login");
if(userSession.getUserId()==null || userSession.getUserType()==null ){
System.out.println("Check is login - Inside");
return "redirect:/login";
}
return "";
}
}

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save