11 changed files with 2594 additions and 86 deletions
-
19.mvn/wrapper/maven-wrapper.properties
-
220hs_err_pid29312.log
-
60src/main/java/com/gcc/commissionerreview/configuration/AppConfig.java
-
128src/main/java/com/gcc/commissionerreview/configuration/DataSourceConfig.java
-
142src/main/java/com/gcc/commissionerreview/controller/FoodSchemeController.java
-
16src/main/java/com/gcc/commissionerreview/controller/MainController.java
-
484src/main/java/com/gcc/commissionerreview/service/FoodSchemeService.java
-
4src/main/resources/application-dev.properties
-
348src/main/resources/templates/modules/food_scheme/driverreport.html
-
184src/main/resources/templates/modules/food_scheme/feedbackreport.html
-
1075src/main/resources/templates/modules/food_scheme/foodschemereport.html
@ -1,19 +0,0 @@ |
|||
# 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 |
|||
# |
|||
# http://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. |
|||
wrapperVersion=3.3.2 |
|||
distributionType=only-script |
|||
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.zip |
|||
@ -0,0 +1,220 @@ |
|||
# |
|||
# There is insufficient memory for the Java Runtime Environment to continue. |
|||
# Native memory allocation (mmap) failed to map 123731968 bytes for G1 virtual space |
|||
# Possible reasons: |
|||
# The system is out of physical RAM or swap space |
|||
# The process is running with CompressedOops enabled, and the Java Heap may be blocking the growth of the native heap |
|||
# Possible solutions: |
|||
# Reduce memory load on the system |
|||
# Increase physical memory or swap space |
|||
# Check if swap backing store is full |
|||
# Decrease Java heap size (-Xmx/-Xms) |
|||
# Decrease number of Java threads |
|||
# Decrease Java thread stack sizes (-Xss) |
|||
# Set larger code cache with -XX:ReservedCodeCacheSize= |
|||
# JVM is running with Unscaled Compressed Oops mode in which the Java heap is |
|||
# placed in the first 4GB address space. The Java Heap base address is the |
|||
# maximum limit for the native heap growth. Please use -XX:HeapBaseMinAddress |
|||
# to set the Java Heap base and to place the Java Heap above 4GB virtual address. |
|||
# This output file may be truncated or incomplete. |
|||
# |
|||
# Out of Memory Error (os_windows.cpp:3548), pid=29312, tid=28704 |
|||
# |
|||
# JRE version: (17.0.12+8) (build ) |
|||
# Java VM: Java HotSpot(TM) 64-Bit Server VM (17.0.12+8-LTS-286, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, windows-amd64) |
|||
# No core dump will be written. Minidumps are not enabled by default on client versions of Windows |
|||
# |
|||
|
|||
--------------- S U M M A R Y ------------ |
|||
|
|||
Command Line: -XX:+ShowCodeDetailsInExceptionMessages com.gcc.commissionerreview.DashboardserviceApplication |
|||
|
|||
Host: AMD Ryzen 3 5300U with Radeon Graphics , 8 cores, 7G, Windows 11 , 64 bit Build 22621 (10.0.22621.5415) |
|||
Time: Mon Dec 1 16:30:57 2025 India Standard Time elapsed time: 0.029072 seconds (0d 0h 0m 0s) |
|||
|
|||
--------------- T H R E A D --------------- |
|||
|
|||
Current thread (0x000001e9c9095530): JavaThread "Unknown thread" [_thread_in_vm, id=28704, stack(0x00000017b7800000,0x00000017b7900000)] |
|||
|
|||
Stack: [0x00000017b7800000,0x00000017b7900000] |
|||
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code) |
|||
V [jvm.dll+0x67a04a] |
|||
V [jvm.dll+0x7da4ed] |
|||
V [jvm.dll+0x7dbe33] |
|||
V [jvm.dll+0x7dc4a3] |
|||
V [jvm.dll+0x24508f] |
|||
V [jvm.dll+0x677089] |
|||
V [jvm.dll+0x66bd32] |
|||
V [jvm.dll+0x301fa6] |
|||
V [jvm.dll+0x309546] |
|||
V [jvm.dll+0x359d2e] |
|||
V [jvm.dll+0x359f5f] |
|||
V [jvm.dll+0x2d9078] |
|||
V [jvm.dll+0x2d9fe4] |
|||
V [jvm.dll+0x7aca21] |
|||
V [jvm.dll+0x367591] |
|||
V [jvm.dll+0x78b999] |
|||
V [jvm.dll+0x3ec83f] |
|||
V [jvm.dll+0x3ee471] |
|||
C [jli.dll+0x5297] |
|||
C [ucrtbase.dll+0x29333] |
|||
C [KERNEL32.DLL+0x1259d] |
|||
C [ntdll.dll+0x5af78] |
|||
|
|||
|
|||
--------------- P R O C E S S --------------- |
|||
|
|||
Threads class SMR info: |
|||
_java_thread_list=0x00007ffd7e0b7a18, length=0, elements={ |
|||
} |
|||
|
|||
Java Threads: ( => current thread ) |
|||
|
|||
Other Threads: |
|||
0x000001e9c90f3fe0 GCTaskThread "GC Thread#0" [stack: 0x00000017b7900000,0x00000017b7a00000] [id=13928] |
|||
0x000001e9c91049c0 ConcurrentGCThread "G1 Main Marker" [stack: 0x00000017b7a00000,0x00000017b7b00000] [id=21488] |
|||
0x000001e9c91053d0 ConcurrentGCThread "G1 Conc#0" [stack: 0x00000017b7b00000,0x00000017b7c00000] [id=26372] |
|||
|
|||
[error occurred during error reporting (printing all threads), id 0xc0000005, EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00007ffd7d8e9b67] |
|||
|
|||
VM state: not at safepoint (not fully initialized) |
|||
|
|||
VM Mutex/Monitor currently owned by a thread: ([mutex/lock_event]) |
|||
[0x000001e9c9090970] Heap_lock - owner thread: 0x000001e9c9095530 |
|||
|
|||
Heap address: 0x000000008ac00000, size: 1876 MB, Compressed Oops mode: 32-bit |
|||
|
|||
CDS archive(s) mapped at: [0x0000000000000000-0x0000000000000000-0x0000000000000000), size 0, SharedBaseAddress: 0x0000000800000000, ArchiveRelocationMode: 1. |
|||
Narrow klass base: 0x0000000000000000, Narrow klass shift: 0, Narrow klass range: 0x0 |
|||
|
|||
GC Precious Log: |
|||
<Empty> |
|||
|
|||
Heap: |
|||
garbage-first heap total 0K, used 0K [0x000000008ac00000, 0x0000000100000000) |
|||
region size 1024K, 0 young (0K), 0 survivors (0K) |
|||
|
|||
[error occurred during error reporting (printing heap information), id 0xc0000005, EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00007ffd7dcd3859] |
|||
|
|||
GC Heap History (0 events): |
|||
No events |
|||
|
|||
Deoptimization events (0 events): |
|||
No events |
|||
|
|||
Classes unloaded (0 events): |
|||
No events |
|||
|
|||
Classes redefined (0 events): |
|||
No events |
|||
|
|||
Internal exceptions (0 events): |
|||
No events |
|||
|
|||
VM Operations (0 events): |
|||
No events |
|||
|
|||
Events (1 events): |
|||
Event: 0.014 Loaded shared library C:\Program Files\Java\jdk-17\bin\java.dll |
|||
|
|||
|
|||
Dynamic libraries: |
|||
0x00007ff678e90000 - 0x00007ff678ea0000 C:\Program Files\Java\jdk-17\bin\java.exe |
|||
0x00007ffe2f0d0000 - 0x00007ffe2f2e8000 C:\windows\SYSTEM32\ntdll.dll |
|||
0x00007ffe2e0f0000 - 0x00007ffe2e1b4000 C:\windows\System32\KERNEL32.DLL |
|||
0x00007ffe2c460000 - 0x00007ffe2c833000 C:\windows\System32\KERNELBASE.dll |
|||
0x00007ffe2cc60000 - 0x00007ffe2cd71000 C:\windows\System32\ucrtbase.dll |
|||
0x00007ffd7f2e0000 - 0x00007ffd7f2fb000 C:\Program Files\Java\jdk-17\bin\VCRUNTIME140.dll |
|||
0x00007ffd7f280000 - 0x00007ffd7f299000 C:\Program Files\Java\jdk-17\bin\jli.dll |
|||
0x00007ffe2ec00000 - 0x00007ffe2ecb1000 C:\windows\System32\ADVAPI32.dll |
|||
0x00007ffe2efe0000 - 0x00007ffe2f087000 C:\windows\System32\msvcrt.dll |
|||
0x00007ffe2e7b0000 - 0x00007ffe2e858000 C:\windows\System32\sechost.dll |
|||
0x00007ffe2c1f0000 - 0x00007ffe2c218000 C:\windows\System32\bcrypt.dll |
|||
0x00007ffe2ecc0000 - 0x00007ffe2edd8000 C:\windows\System32\RPCRT4.dll |
|||
0x00007ffe2d210000 - 0x00007ffe2d3c2000 C:\windows\System32\USER32.dll |
|||
0x00007ffe2c8c0000 - 0x00007ffe2c8e6000 C:\windows\System32\win32u.dll |
|||
0x00007ffe2ee00000 - 0x00007ffe2ee29000 C:\windows\System32\GDI32.dll |
|||
0x00007ffe2c220000 - 0x00007ffe2c33b000 C:\windows\System32\gdi32full.dll |
|||
0x00007ffe2c3c0000 - 0x00007ffe2c45a000 C:\windows\System32\msvcp_win.dll |
|||
0x00007ffe12620000 - 0x00007ffe128bc000 C:\windows\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_6.0.22621.6060_none_2712eda17382d24b\COMCTL32.dll |
|||
0x00007ffe22db0000 - 0x00007ffe22dba000 C:\windows\SYSTEM32\VERSION.dll |
|||
0x00007ffe2e0a0000 - 0x00007ffe2e0d1000 C:\windows\System32\IMM32.DLL |
|||
0x00007ffd7f2b0000 - 0x00007ffd7f2bc000 C:\Program Files\Java\jdk-17\bin\vcruntime140_1.dll |
|||
0x00007ffd7e7a0000 - 0x00007ffd7e82e000 C:\Program Files\Java\jdk-17\bin\msvcp140.dll |
|||
0x00007ffd7d600000 - 0x00007ffd7e1e0000 C:\Program Files\Java\jdk-17\bin\server\jvm.dll |
|||
0x00007ffe2de60000 - 0x00007ffe2de68000 C:\windows\System32\PSAPI.DLL |
|||
0x00007ffd7f270000 - 0x00007ffd7f279000 C:\windows\SYSTEM32\WSOCK32.dll |
|||
0x00007ffe2eea0000 - 0x00007ffe2ef11000 C:\windows\System32\WS2_32.dll |
|||
0x00007ffe27b70000 - 0x00007ffe27ba4000 C:\windows\SYSTEM32\WINMM.dll |
|||
0x00007ffe2b1d0000 - 0x00007ffe2b1e8000 C:\windows\SYSTEM32\kernel.appcore.dll |
|||
0x00007ffd7f260000 - 0x00007ffd7f26a000 C:\Program Files\Java\jdk-17\bin\jimage.dll |
|||
0x00007ffe242e0000 - 0x00007ffe24513000 C:\windows\SYSTEM32\DBGHELP.DLL |
|||
0x00007ffe2e860000 - 0x00007ffe2ebf1000 C:\windows\System32\combase.dll |
|||
0x00007ffe2d3d0000 - 0x00007ffe2d4a8000 C:\windows\System32\OLEAUT32.dll |
|||
0x00007ffe13910000 - 0x00007ffe13942000 C:\windows\SYSTEM32\dbgcore.DLL |
|||
0x00007ffe2c340000 - 0x00007ffe2c3bb000 C:\windows\System32\bcryptPrimitives.dll |
|||
0x00007ffd7f230000 - 0x00007ffd7f255000 C:\Program Files\Java\jdk-17\bin\java.dll |
|||
|
|||
dbghelp: loaded successfully - version: 4.0.5 - missing functions: none |
|||
symbol engine: initialized successfully - sym options: 0x614 - pdb path: .;C:\Program Files\Java\jdk-17\bin;C:\windows\SYSTEM32;C:\windows\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_6.0.22621.6060_none_2712eda17382d24b;C:\Program Files\Java\jdk-17\bin\server |
|||
|
|||
VM Arguments: |
|||
jvm_args: -XX:+ShowCodeDetailsInExceptionMessages |
|||
java_command: com.gcc.commissionerreview.DashboardserviceApplication |
|||
java_class_path (initial): C:\Commisoner review may 2025\commissioner_review_1_may2025\target\classes;C:\Users\Ajith\.m2\repository\org\springframework\boot\spring-boot-starter-data-jdbc\3.4.5\spring-boot-starter-data-jdbc-3.4.5.jar;C:\Users\Ajith\.m2\repository\org\springframework\boot\spring-boot-starter-jdbc\3.4.5\spring-boot-starter-jdbc-3.4.5.jar;C:\Users\Ajith\.m2\repository\com\zaxxer\HikariCP\5.1.0\HikariCP-5.1.0.jar;C:\Users\Ajith\.m2\repository\org\springframework\spring-jdbc\6.2.6\spring-jdbc-6.2.6.jar;C:\Users\Ajith\.m2\repository\org\springframework\data\spring-data-jdbc\3.4.5\spring-data-jdbc-3.4.5.jar;C:\Users\Ajith\.m2\repository\org\springframework\data\spring-data-relational\3.4.5\spring-data-relational-3.4.5.jar;C:\Users\Ajith\.m2\repository\org\springframework\data\spring-data-commons\3.4.5\spring-data-commons-3.4.5.jar;C:\Users\Ajith\.m2\repository\org\springframework\spring-tx\6.2.6\spring-tx-6.2.6.jar;C:\Users\Ajith\.m2\repository\org\springframework\spring-context\6.2.6\spring-context-6.2.6.jar;C:\Users\Ajith\.m2\repository\org\springframework\spring-beans\6.2.6\spring-beans-6.2.6.jar;C:\Users\Ajith\.m2\repository\org\slf4j\slf4j-api\2.0.17\slf4j-api-2.0.17.jar;C:\Users\Ajith\.m2\repository\org\springframework\boot\spring-boot-starter-thymeleaf\3.4.5\spring-boot-starter-thymeleaf-3.4.5.jar;C:\Users\Ajith\.m2\repository\org\springframework\boot\spring-boot-starter\3.4.5\spring-boot-starter-3.4.5.jar;C:\Users\Ajith\.m2\repository\org\springframework\boot\spring-boot-starter-logging\3.4.5\spring-boot-starter-logging-3.4.5.jar;C:\Users\Ajith\.m2\repository\ch\qos\logback\logback-classic\1.5.18\logback-classic-1.5.18.jar;C:\Users\Ajith\.m2\repository\ch\qos\logback\logback-core\1.5.18\logback-core-1.5.18.jar;C:\Users\Ajith\.m2\repository\org\apache\logging\log4j\log4j-to-slf4j\2.24.3\log4j-to-slf4j-2.24.3.jar;C:\Users\Ajith\.m2\repository\org\apache\logging\log4j\log4j-api\2.24.3\log4j-api-2.24.3.jar;C:\Users\Ajith\.m2\repository\org\slf4j\jul-t |
|||
Launcher Type: SUN_STANDARD |
|||
|
|||
[Global flags] |
|||
intx CICompilerCount = 4 {product} {ergonomic} |
|||
uint ConcGCThreads = 2 {product} {ergonomic} |
|||
uint G1ConcRefinementThreads = 8 {product} {ergonomic} |
|||
size_t G1HeapRegionSize = 1048576 {product} {ergonomic} |
|||
uintx GCDrainStackTargetSize = 64 {product} {ergonomic} |
|||
size_t InitialHeapSize = 123731968 {product} {ergonomic} |
|||
size_t MarkStackSize = 4194304 {product} {ergonomic} |
|||
size_t MaxHeapSize = 1967128576 {product} {ergonomic} |
|||
size_t MinHeapDeltaBytes = 1048576 {product} {ergonomic} |
|||
size_t MinHeapSize = 8388608 {product} {ergonomic} |
|||
uintx NonNMethodCodeHeapSize = 5839372 {pd product} {ergonomic} |
|||
uintx NonProfiledCodeHeapSize = 122909434 {pd product} {ergonomic} |
|||
uintx ProfiledCodeHeapSize = 122909434 {pd product} {ergonomic} |
|||
uintx ReservedCodeCacheSize = 251658240 {pd product} {ergonomic} |
|||
bool SegmentedCodeCache = true {product} {ergonomic} |
|||
bool ShowCodeDetailsInExceptionMessages = true {manageable} {command line} |
|||
size_t SoftMaxHeapSize = 1967128576 {manageable} {ergonomic} |
|||
bool UseCompressedClassPointers = true {product lp64_product} {ergonomic} |
|||
bool UseCompressedOops = true {product lp64_product} {ergonomic} |
|||
bool UseG1GC = true {product} {ergonomic} |
|||
bool UseLargePagesIndividualAllocation = false {pd product} {ergonomic} |
|||
|
|||
Logging: |
|||
Log output configuration: |
|||
#0: stdout all=warning uptime,level,tags |
|||
#1: stderr all=off uptime,level,tags |
|||
|
|||
Environment Variables: |
|||
PATH=c:\Users\Ajith\AppData\Roaming\Code\User\globalStorage\github.copilot-chat\debugCommand;c:\Users\Ajith\AppData\Roaming\Code\User\globalStorage\github.copilot-chat\copilotCli;C:\Program Files\Common Files\Oracle\Java\javapath;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;C:\windows\System32\OpenSSH\;C:\Program Files\Docker\Docker\resources\bin;C:\Program Files\Java\jdk-17\bin;C:\Program Files\nodejs\;C:\Program Files (x86)\Microsoft SQL Server\160\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\160\Tools\Binn\;C:\Program Files\Microsoft SQL Server\160\Tools\Binn\;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn\;C:\Program Files\Microsoft SQL Server\160\DTS\Binn\;C:\Program Files\Apache\Maven\apache-maven-3.9.11\bin;C:\Users\Ajith\AppData\Local\Programs\Python\Python313\Scripts\;C:\Users\Ajith\AppData\Local\Programs\Python\Python313\;C:\Users\Ajith\AppData\Local\Programs\Python\Python312\Scripts\;C:\Users\Ajith\AppData\Local\Programs\Python\Python312\;C:\Users\Ajith\AppData\Local\Programs\Python\Launcher\;C:\Users\Ajith\AppData\Local\Microsoft\WindowsApps;C:\Users\Ajith\AppData\Local\Programs\Git\cmd;C:\Users\Ajith\Desktop;C:\Users\Ajith\Desktop\demo\terraform;C:\Users\Ajith\AppData\Roaming\npm;C:\Users\Ajith\AppData\Local\GitHubDesktop\bin;C:\Users\Ajith\AppData\Local\Programs\Microsoft VS Code\bin;c:\Users\Ajith\.vscode\extensions\vscjava.vscode-java-debug-0.58.3\bundled\scripts\noConfigScripts |
|||
USERNAME=Ajith |
|||
LANG=en_US.UTF-8 |
|||
OS=Windows_NT |
|||
PROCESSOR_IDENTIFIER=AMD64 Family 23 Model 104 Stepping 1, AuthenticAMD |
|||
|
|||
|
|||
|
|||
--------------- S Y S T E M --------------- |
|||
|
|||
OS: |
|||
Windows 11 , 64 bit Build 22621 (10.0.22621.5415) |
|||
OS uptime: 4 days 23:37 hours |
|||
Hyper-V role detected |
|||
|
|||
CPU: total 8 (initial active 8) (8 cores per cpu, 2 threads per core) family 23 model 104 stepping 1 microcode 0x0, cx8, cmov, fxsr, ht, mmx, 3dnowpref, sse, sse2, sse3, ssse3, sse4a, sse4.1, sse4.2, popcnt, lzcnt, tsc, tscinvbit, avx, avx2, aes, clmul, bmi1, bmi2, adx, sha, fma, vzeroupper, clflush, clflushopt, hv |
|||
|
|||
Memory: 4k page, system-wide physical 7502M (201M free) |
|||
TotalPageFile size 30030M (AvailPageFile size 94M) |
|||
current process WorkingSet (physical memory assigned to process): 11M, peak: 11M |
|||
current process commit charge ("private bytes"): 60M, peak: 178M |
|||
|
|||
vm_info: Java HotSpot(TM) 64-Bit Server VM (17.0.12+8-LTS-286) for windows-amd64 JRE (17.0.12+8-LTS-286), built on Jun 5 2024 06:46:59 by "mach5one" with MS VC++ 17.6 (VS2022) |
|||
|
|||
END. |
|||
@ -0,0 +1,60 @@ |
|||
package com.gcc.commissionerreview.configuration; |
|||
|
|||
import org.springframework.beans.factory.annotation.Value; |
|||
|
|||
import org.springframework.boot.context.properties.ConfigurationProperties; |
|||
import org.springframework.context.annotation.Bean; |
|||
import org.springframework.stereotype.Component; |
|||
import org.springframework.web.client.RestTemplate; |
|||
|
|||
|
|||
@Component |
|||
@ConfigurationProperties(prefix = "app") |
|||
public class AppConfig { |
|||
|
|||
|
|||
@Bean |
|||
public RestTemplate restTemplate() { |
|||
return new RestTemplate(); |
|||
} |
|||
|
|||
private String title; |
|||
private String baseUrl; |
|||
private String getOtpUrl; |
|||
private String erpUrl; |
|||
|
|||
|
|||
|
|||
public String getTitle() { |
|||
return title; |
|||
} |
|||
|
|||
public void setTitle(String title) { |
|||
this.title = title; |
|||
} |
|||
|
|||
public String getBaseUrl() { |
|||
return baseUrl; |
|||
} |
|||
|
|||
public void setBaseUrl(String baseUrl) { |
|||
this.baseUrl = baseUrl; |
|||
} |
|||
|
|||
public String getGetOtpUrl() { |
|||
return getOtpUrl; |
|||
} |
|||
|
|||
public void setGetOtpUrl(String getOtpUrl) { |
|||
this.getOtpUrl = getOtpUrl; |
|||
} |
|||
|
|||
public String getErpUrl() { |
|||
return erpUrl; |
|||
} |
|||
|
|||
public void setErpUrl(String erpUrl) { |
|||
this.erpUrl = erpUrl; |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,142 @@ |
|||
package com.gcc.commissionerreview.controller; |
|||
|
|||
import java.util.HashMap; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.http.HttpStatus; |
|||
import org.springframework.http.ResponseEntity; |
|||
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; |
|||
|
|||
import com.gcc.commissionerreview.service.FoodSchemeService; |
|||
|
|||
@RestController |
|||
@RequestMapping("/commissionerreview/api") |
|||
public class FoodSchemeController { |
|||
|
|||
@Autowired |
|||
private FoodSchemeService foodSchemeService; |
|||
|
|||
/* |
|||
* @GetMapping("/feedback-summary") |
|||
* public List<Map<String, Object>> getFeedbackSummary(@RequestParam String |
|||
* date) { |
|||
* return feedbackService.getFeedbackSummary(date); |
|||
* } |
|||
* |
|||
* @GetMapping("/driver-report") |
|||
* public List<Map<String, Object>> getDriverReport(@RequestParam String date) { |
|||
* //System.out.println("Date received in controller: " + date); |
|||
* return feedbackService.getDriverReport(date); |
|||
* } |
|||
*/ |
|||
// ak |
|||
@GetMapping("/feedback-summary") |
|||
public ResponseEntity<?> getFeedbackSummary(@RequestParam String date) { |
|||
try { |
|||
List<Map<String, Object>> data = foodSchemeService.getFeedbackSummary(date); |
|||
|
|||
Map<String, Object> response = new HashMap<>(); |
|||
response.put("status", "success"); |
|||
response.put("date", date); |
|||
response.put("data", data); |
|||
|
|||
return ResponseEntity.ok(response); |
|||
|
|||
} catch (Exception e) { |
|||
Map<String, Object> error = new HashMap<>(); |
|||
error.put("status", "error"); |
|||
error.put("message", e.getMessage()); |
|||
|
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(error); |
|||
} |
|||
} |
|||
|
|||
@GetMapping("/driver-report") |
|||
public ResponseEntity<?> getDriverReport(@RequestParam String date) { |
|||
try { |
|||
List<Map<String, Object>> data = foodSchemeService.getDriverReport(date); |
|||
|
|||
Map<String, Object> response = new HashMap<>(); |
|||
response.put("status", "success"); |
|||
response.put("date", date); |
|||
response.put("data", data); |
|||
|
|||
return ResponseEntity.ok(response); |
|||
|
|||
} catch (Exception e) { |
|||
Map<String, Object> error = new HashMap<>(); |
|||
error.put("status", "error"); |
|||
error.put("message", e.getMessage()); |
|||
|
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(error); |
|||
} |
|||
} |
|||
|
|||
/// yogi |
|||
@GetMapping("/abstract") |
|||
public ResponseEntity<?> getAbstractReport(@RequestParam String date) { |
|||
try { |
|||
List<Map<String, Object>> report = foodSchemeService.getAbstractReport(date); |
|||
// System.out.println("report : " + report); |
|||
|
|||
Map<String, Object> response = new HashMap<>(); |
|||
response.put("status", "success"); |
|||
response.put("date", date); |
|||
response.put("data", report); |
|||
|
|||
return ResponseEntity.ok(response); |
|||
|
|||
} catch (Exception e) { |
|||
Map<String, Object> error = new HashMap<>(); |
|||
error.put("status", "error"); |
|||
error.put("message", e.getMessage()); |
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(error); |
|||
} |
|||
} |
|||
|
|||
@GetMapping("/zoneandshiftbasedreport") |
|||
public ResponseEntity<?> getZoneWiseShiftBasedReport(@RequestParam String date, @RequestParam Integer shiftId) { |
|||
try { |
|||
List<Map<String, Object>> report = foodSchemeService.getZoneWiseShiftBasedReport(date, shiftId); |
|||
// System.out.println("report : " + report); |
|||
|
|||
Map<String, Object> response = new HashMap<>(); |
|||
response.put("status", "success"); |
|||
response.put("date", date); |
|||
response.put("data", report); |
|||
|
|||
return ResponseEntity.ok(response); |
|||
|
|||
} catch (Exception e) { |
|||
Map<String, Object> error = new HashMap<>(); |
|||
error.put("status", "error"); |
|||
error.put("message", e.getMessage()); |
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(error); |
|||
} |
|||
} |
|||
|
|||
@GetMapping("/wardlocationreport") |
|||
public ResponseEntity<?> getWardLocationReport(@RequestParam String date) { |
|||
try { |
|||
List<Map<String, Object>> report = foodSchemeService.getWardLocationWiseReport(date); |
|||
|
|||
Map<String, Object> response = new HashMap<>(); |
|||
response.put("status", "success"); |
|||
response.put("date", date); |
|||
response.put("data", report); |
|||
|
|||
return ResponseEntity.ok(response); |
|||
} catch (Exception e) { |
|||
Map<String, Object> error = new HashMap<>(); |
|||
error.put("status", "error"); |
|||
error.put("message", e.getMessage()); |
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(error); |
|||
} |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,484 @@ |
|||
package com.gcc.commissionerreview.service; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
import java.util.concurrent.ConcurrentHashMap; |
|||
|
|||
import javax.imageio.ImageIO; |
|||
import javax.sql.DataSource; |
|||
|
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.beans.factory.annotation.Qualifier; |
|||
import org.springframework.beans.factory.annotation.Value; |
|||
import org.springframework.core.env.Environment; |
|||
import org.springframework.jdbc.core.JdbcTemplate; |
|||
import org.springframework.stereotype.Service; |
|||
import java.net.URL; |
|||
import java.awt.image.BufferedImage; |
|||
import java.io.ByteArrayOutputStream; |
|||
import javax.imageio.ImageIO; |
|||
import java.util.Base64; |
|||
import java.util.concurrent.ConcurrentHashMap; |
|||
import java.util.Map; |
|||
|
|||
import com.gcc.commissionerreview.configuration.AppConfig; |
|||
|
|||
@Service |
|||
public class FoodSchemeService { |
|||
|
|||
@Autowired |
|||
private JdbcTemplate jdbcTemplate; |
|||
@Autowired |
|||
private Environment environment; |
|||
@Autowired |
|||
private AppConfig appConfig; |
|||
|
|||
@Autowired |
|||
@Value("${fileBaseUrl}") |
|||
|
|||
private String fileBaseUrl; |
|||
|
|||
// ak for pdf image render |
|||
// private final Map<String, String> imageCache = new ConcurrentHashMap<>(); |
|||
|
|||
@Autowired |
|||
public void setFeedbackDataSource(@Qualifier("mysqlFoodDistributionDataSource") DataSource dataSource) { |
|||
this.jdbcTemplate = new JdbcTemplate(dataSource); |
|||
} |
|||
|
|||
public FoodSchemeService(Environment environment) { |
|||
|
|||
this.environment = environment; |
|||
|
|||
this.fileBaseUrl = environment.getProperty("fileBaseUrl"); |
|||
} |
|||
/* |
|||
* private String convertUrlToBase64(String url) { |
|||
* try { |
|||
* if (imageCache.containsKey(url)) { |
|||
* return imageCache.get(url); |
|||
* } |
|||
* |
|||
* URL imageUrl = new URL(url); |
|||
* BufferedImage image = ImageIO.read(imageUrl); |
|||
* |
|||
* ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
|||
* ImageIO.write(image, "jpeg", baos); |
|||
* |
|||
* String base64 = "data:image/jpeg;base64," + |
|||
* Base64.getEncoder().encodeToString(baos.toByteArray()); |
|||
* |
|||
* imageCache.put(url, base64); |
|||
* return base64; |
|||
* |
|||
* } catch (Exception e) { |
|||
* e.printStackTrace(); |
|||
* return null; |
|||
* } |
|||
* } |
|||
*/ |
|||
|
|||
public List<Map<String, Object>> getFeedbackSummary(String date) { |
|||
|
|||
/* |
|||
* String sql = """ |
|||
* SELECT |
|||
* fq.qid, |
|||
* fq.question, |
|||
* |
|||
* -- YES Count |
|||
* SUM( |
|||
* CASE |
|||
* WHEN fq.qid = 1 AND fd.q1 = '1' THEN 1 |
|||
* WHEN fq.qid = 2 AND fd.q2 = '3' THEN 1 |
|||
* WHEN fq.qid = 3 AND fd.q3 = '5' THEN 1 |
|||
* ELSE 0 |
|||
* END |
|||
* ) AS yes_count, |
|||
* |
|||
* -- NO Count |
|||
* SUM( |
|||
* CASE |
|||
* WHEN fq.qid = 1 AND fd.q1 = '2' THEN 1 |
|||
* WHEN fq.qid = 2 AND fd.q2 = '4' THEN 1 |
|||
* WHEN fq.qid = 3 AND fd.q3 = '6' THEN 1 |
|||
* ELSE 0 |
|||
* END |
|||
* ) AS no_count |
|||
* |
|||
* FROM feedback_questions fq |
|||
* LEFT JOIN feedback_data fd |
|||
* ON fd.isactive = 1 |
|||
* AND fd.isdelete = 0 |
|||
* AND DATE(fd.feedback_date) = ? |
|||
* |
|||
* |
|||
* WHERE fq.isactive = 1 |
|||
* AND fq.isdelete = 0 |
|||
* |
|||
* GROUP BY fq.qid, fq.question |
|||
* ORDER BY fq.orderby |
|||
* """; |
|||
*/ |
|||
String sql = "SELECT " + |
|||
" fq.qid, " + |
|||
" fq.question, " + |
|||
|
|||
" SUM( " + |
|||
" CASE " + |
|||
" WHEN fq.qid = 1 AND fd.q1 = '1' THEN 1 " + |
|||
" WHEN fq.qid = 2 AND fd.q2 = '3' THEN 1 " + |
|||
" WHEN fq.qid = 3 AND fd.q3 = '5' THEN 1 " + |
|||
" ELSE 0 " + |
|||
" END " + |
|||
" ) AS yes_count, " + |
|||
|
|||
" SUM( " + |
|||
" CASE " + |
|||
" WHEN fq.qid = 1 AND fd.q1 = '2' THEN 1 " + |
|||
" WHEN fq.qid = 2 AND fd.q2 = '4' THEN 1 " + |
|||
" WHEN fq.qid = 3 AND fd.q3 = '6' THEN 1 " + |
|||
" ELSE 0 " + |
|||
" END " + |
|||
" ) AS no_count " + |
|||
|
|||
"FROM feedback_questions fq " + |
|||
"LEFT JOIN feedback_data fd " + |
|||
" ON fd.isactive = 1 " + |
|||
" AND fd.isdelete = 0 " + |
|||
" AND DATE(fd.feedback_date) = ? " + |
|||
|
|||
"WHERE fq.isactive = 1 " + |
|||
"AND fq.isdelete = 0 " + |
|||
|
|||
"GROUP BY fq.qid, fq.question " + |
|||
"ORDER BY fq.orderby"; |
|||
|
|||
return jdbcTemplate.queryForList(sql, date); |
|||
} |
|||
|
|||
public List<Map<String, Object>> getDriverReport(String date) { |
|||
// System.out.println("File Base URL: " + fileBaseUrl); |
|||
|
|||
String sql = "SELECT lm.location AS LocationDescription, " + |
|||
"dl.username AS DriverName, " + |
|||
"CONCAT('" + fileBaseUrl + "/gccofficialapp/files', dss_start.image) AS upload_image_url, " + |
|||
"CONCAT(dss_start.latitude, ', ', dss_start.longitude) AS StartPoint, " + |
|||
"Date(dss_start.datetime) AS StartTime, " + |
|||
"CONCAT(dss_stop.latitude, ', ', dss_stop.longitude) AS EndPoint, " + |
|||
"Date(dss_stop.datetime) AS EndTime " + |
|||
|
|||
"FROM location_mapping lm " + |
|||
"INNER JOIN driver_login dl ON dl.loginid = lm.driverid " + |
|||
|
|||
"LEFT JOIN driver_start_stop dss_start " + |
|||
"ON dss_start.loginid = lm.driverid " + |
|||
"AND dss_start.action = 'Start' " + |
|||
|
|||
"LEFT JOIN driver_start_stop dss_stop " + |
|||
"ON dss_stop.loginid = lm.driverid " + |
|||
"AND dss_stop.action = 'Stop' " + |
|||
"AND dss_stop.startid = dss_start.locationid " + |
|||
|
|||
"WHERE DATE(dss_start.datetime) = ?"; |
|||
|
|||
return jdbcTemplate.queryForList(sql, date); |
|||
} |
|||
|
|||
// yogi |
|||
public List<Map<String, Object>> getAbstractReport(String date) { |
|||
|
|||
String sql = """ |
|||
SELECT * FROM ( |
|||
|
|||
SELECT |
|||
|
|||
sm.name AS shift_name, |
|||
sm.Code as shift_code, |
|||
sm.shiftid as shiftid, |
|||
IFNULL(SUM(gru.total_food_requested), 0) AS food_requested, |
|||
IFNULL(SUM(gru.total_food_received), 0) AS food_delivered, |
|||
IFNULL(SUM(dr.nulm + dr.private + dr.permanent), 0) AS overall_count, |
|||
IFNULL(SUM(dr.nulm + dr.private + dr.permanent), 0) AS present_count, |
|||
IFNULL(SUM(gru.today_absentees_nulm + gru.today_absentees_private + gru.today_absentees_permanent), 0) AS unplanned_count, |
|||
IFNULL(SUM(dr.absentees_nulm + dr.absentees_private + dr.absentees_permanent), 0) AS absent_count, |
|||
IFNULL(SUM(gru.total_box_shortfall), 0) AS food_shortfall |
|||
FROM shift_master sm |
|||
LEFT JOIN daily_request dr |
|||
ON sm.shiftid = dr.shiftid AND dr.required_date = ? |
|||
LEFT JOIN gcc_received_update gru |
|||
ON gru.requestid = dr.requestid |
|||
GROUP BY sm.shiftid, sm.name |
|||
|
|||
UNION ALL |
|||
|
|||
SELECT |
|||
'Total' AS shift_name, |
|||
'TOTAL' AS shift_code, |
|||
'TOTAL' as shift_id, |
|||
IFNULL(SUM(gru.total_food_requested), 0), |
|||
IFNULL(SUM(gru.total_food_received), 0), |
|||
IFNULL(SUM(dr.nulm + dr.private + dr.permanent), 0), |
|||
IFNULL(SUM(dr.nulm + dr.private + dr.permanent), 0), |
|||
IFNULL(SUM(gru.today_absentees_nulm + gru.today_absentees_private + gru.today_absentees_permanent), 0), |
|||
IFNULL(SUM(dr.absentees_nulm + dr.absentees_private + dr.absentees_permanent), 0), |
|||
IFNULL(SUM(gru.total_box_shortfall), 0) |
|||
FROM shift_master sm |
|||
LEFT JOIN daily_request dr |
|||
ON sm.shiftid = dr.shiftid AND dr.required_date = ? |
|||
LEFT JOIN gcc_received_update gru |
|||
ON gru.requestid = dr.requestid |
|||
) AS final_result |
|||
"""; |
|||
|
|||
return jdbcTemplate.queryForList(sql, date, date); |
|||
} |
|||
|
|||
// yogi |
|||
public List<Map<String, Object>> getZoneWiseShiftBasedReport(String date, int shiftId) { |
|||
|
|||
String sql = """ |
|||
SELECT * |
|||
FROM ( |
|||
|
|||
/* ==================== 1. ZONE-WISE SUMMARY ===================== */ |
|||
SELECT |
|||
z.zone, |
|||
|
|||
/* FOOD REQUESTED */ |
|||
( |
|||
SELECT IFNULL(SUM(gru.total_food_requested), 0) |
|||
FROM gcc_received_update gru |
|||
WHERE gru.shiftid = ? |
|||
AND gru.received_by IN ( |
|||
SELECT siloginid FROM location_mapping WHERE zone = z.zone |
|||
) |
|||
AND gru.requestid IN ( |
|||
SELECT requestid FROM daily_request WHERE required_date = ? |
|||
) |
|||
) AS food_requested, |
|||
|
|||
/* FOOD DELIVERED */ |
|||
( |
|||
SELECT IFNULL(SUM(gru.total_food_received), 0) |
|||
FROM gcc_received_update gru |
|||
WHERE gru.shiftid = ? |
|||
AND gru.received_by IN ( |
|||
SELECT siloginid FROM location_mapping WHERE zone = z.zone |
|||
) |
|||
AND gru.requestid IN ( |
|||
SELECT requestid FROM daily_request WHERE required_date = ? |
|||
) |
|||
) AS food_delivered, |
|||
|
|||
/* PRESENT */ |
|||
( |
|||
SELECT IFNULL(SUM(dr.nulm + dr.private + dr.permanent), 0) |
|||
FROM daily_request dr |
|||
WHERE dr.required_date = ? |
|||
AND dr.shiftid = ? |
|||
AND dr.request_by IN ( |
|||
SELECT siloginid FROM location_mapping WHERE zone = z.zone |
|||
) |
|||
) AS present_count, |
|||
|
|||
/* ABSENT */ |
|||
( |
|||
SELECT IFNULL(SUM(dr.absentees_nulm + dr.absentees_private + dr.absentees_permanent), 0) |
|||
FROM daily_request dr |
|||
WHERE dr.required_date = ? |
|||
AND dr.shiftid = ? |
|||
AND dr.request_by IN ( |
|||
SELECT siloginid FROM location_mapping WHERE zone = z.zone |
|||
) |
|||
) AS absent_count, |
|||
|
|||
/* UNPLANNED */ |
|||
( |
|||
SELECT IFNULL(SUM(gru.today_absentees_nulm |
|||
+ gru.today_absentees_private |
|||
+ gru.today_absentees_permanent), 0) |
|||
FROM gcc_received_update gru |
|||
WHERE gru.shiftid = ? |
|||
AND gru.requestid IN ( |
|||
SELECT requestid FROM daily_request WHERE required_date = ? |
|||
) |
|||
AND gru.received_by IN ( |
|||
SELECT siloginid FROM location_mapping WHERE zone = z.zone |
|||
) |
|||
) AS unplanned_count, |
|||
|
|||
/* FOOD SHORTFALL */ |
|||
( |
|||
SELECT IFNULL(SUM(gru.total_box_shortfall), 0) |
|||
FROM gcc_received_update gru |
|||
WHERE gru.shiftid = ? |
|||
AND gru.received_by IN ( |
|||
SELECT siloginid FROM location_mapping WHERE zone = z.zone |
|||
) |
|||
AND gru.requestid IN ( |
|||
SELECT requestid FROM daily_request WHERE required_date = ? |
|||
) |
|||
) AS food_shortfall |
|||
|
|||
FROM ( |
|||
SELECT DISTINCT zone |
|||
FROM location_mapping |
|||
WHERE zone IS NOT NULL |
|||
) z |
|||
|
|||
|
|||
UNION ALL |
|||
|
|||
/* ==================== 2. GRAND TOTAL ===================== */ |
|||
SELECT |
|||
'TOTAL' AS zone, |
|||
|
|||
(SELECT IFNULL(SUM(total_food_requested), 0) |
|||
FROM gcc_received_update |
|||
WHERE shiftid = ? |
|||
AND requestid IN (SELECT requestid FROM daily_request WHERE required_date = ?) |
|||
) AS food_requested, |
|||
|
|||
(SELECT IFNULL(SUM(total_food_received), 0) |
|||
FROM gcc_received_update |
|||
WHERE shiftid = ? |
|||
AND requestid IN (SELECT requestid FROM daily_request WHERE required_date = ?) |
|||
) AS food_delivered, |
|||
|
|||
(SELECT IFNULL(SUM(nulm + private + permanent), 0) |
|||
FROM daily_request |
|||
WHERE required_date = ? AND shiftid = ? |
|||
) AS present_count, |
|||
|
|||
(SELECT IFNULL(SUM(absentees_nulm + absentees_private + absentees_permanent), 0) |
|||
FROM daily_request |
|||
WHERE required_date = ? AND shiftid = ? |
|||
) AS absent_count, |
|||
|
|||
(SELECT IFNULL(SUM(today_absentees_nulm |
|||
+ today_absentees_private |
|||
+ today_absentees_permanent), 0) |
|||
FROM gcc_received_update |
|||
WHERE shiftid = ? |
|||
AND requestid IN (SELECT requestid FROM daily_request WHERE required_date = ?) |
|||
) AS unplanned_count, |
|||
|
|||
(SELECT IFNULL(SUM(total_box_shortfall), 0) |
|||
FROM gcc_received_update |
|||
WHERE shiftid = ? |
|||
AND requestid IN (SELECT requestid FROM daily_request WHERE required_date = ?) |
|||
) AS food_shortfall |
|||
|
|||
) AS final_output |
|||
|
|||
ORDER BY |
|||
CASE WHEN zone = 'TOTAL' THEN 1 ELSE 0 END, |
|||
CAST(zone AS UNSIGNED); |
|||
"""; |
|||
|
|||
// parameters repeated in correct order |
|||
return jdbcTemplate.queryForList(sql, |
|||
shiftId, date, |
|||
shiftId, date, |
|||
date, shiftId, |
|||
date, shiftId, |
|||
shiftId, date, |
|||
shiftId, date, |
|||
|
|||
/* total section */ |
|||
shiftId, date, |
|||
shiftId, date, |
|||
date, shiftId, |
|||
date, shiftId, |
|||
shiftId, date, |
|||
shiftId, date); |
|||
} |
|||
|
|||
// yogi |
|||
public List<Map<String, Object>> getWardLocationWiseReport(String date) { |
|||
|
|||
String sql = "SELECT ward, location, food_requested, food_delivered, present_count, absent_count, unplanned_count, food_shortfall " |
|||
+ |
|||
"FROM (" + |
|||
" SELECT lm.driverid, lm.ward, lm.location, " + |
|||
" (SELECT IFNULL(SUM(gru.total_food_requested),0) FROM gcc_received_update gru " + |
|||
" WHERE gru.received_by IN (SELECT siloginid FROM location_mapping WHERE ward=lm.ward AND location=lm.location) " |
|||
+ |
|||
" AND gru.requestid IN (SELECT requestid FROM daily_request WHERE required_date = ?)) AS food_requested, " |
|||
+ |
|||
" (SELECT IFNULL(SUM(gru.total_food_received),0) FROM gcc_received_update gru " + |
|||
" WHERE gru.received_by IN (SELECT siloginid FROM location_mapping WHERE ward=lm.ward AND location=lm.location) " |
|||
+ |
|||
" AND gru.requestid IN (SELECT requestid FROM daily_request WHERE required_date = ?)) AS food_delivered, " |
|||
+ |
|||
" (SELECT IFNULL(SUM(dr.nulm + dr.private + dr.permanent),0) FROM daily_request dr " + |
|||
" WHERE dr.required_date = ? " + |
|||
" AND dr.request_by IN (SELECT siloginid FROM location_mapping WHERE ward=lm.ward AND location=lm.location)) AS present_count, " |
|||
+ |
|||
" (SELECT IFNULL(SUM(dr.absentees_nulm + dr.absentees_private + dr.absentees_permanent),0) FROM daily_request dr " |
|||
+ |
|||
" WHERE dr.required_date = ? " + |
|||
" AND dr.request_by IN (SELECT siloginid FROM location_mapping WHERE ward=lm.ward AND location=lm.location)) AS absent_count, " |
|||
+ |
|||
" (SELECT IFNULL(SUM(gru.today_absentees_nulm + gru.today_absentees_private + gru.today_absentees_permanent),0) FROM gcc_received_update gru " |
|||
+ |
|||
" WHERE gru.requestid IN (SELECT requestid FROM daily_request WHERE required_date = ?) " + |
|||
" AND gru.received_by IN (SELECT siloginid FROM location_mapping WHERE ward=lm.ward AND location=lm.location)) AS unplanned_count, " |
|||
+ |
|||
" (SELECT IFNULL(SUM(gru.total_box_shortfall),0) FROM gcc_received_update gru " + |
|||
" WHERE gru.received_by IN (SELECT siloginid FROM location_mapping WHERE ward=lm.ward AND location=lm.location) " |
|||
+ |
|||
" AND gru.requestid IN (SELECT requestid FROM daily_request WHERE required_date = ?)) AS food_shortfall " |
|||
+ |
|||
" FROM location_mapping lm " + |
|||
" WHERE lm.ward IS NOT NULL AND lm.location IS NOT NULL " + |
|||
" GROUP BY lm.driverid, lm.ward, lm.location " + |
|||
" UNION ALL " + |
|||
" SELECT 999999 AS driverid, 'TOTAL' AS ward, 'TOTAL' AS location, " + |
|||
" (SELECT IFNULL(SUM(total_food_requested),0) FROM gcc_received_update WHERE requestid IN (SELECT requestid FROM daily_request WHERE required_date = ?)), " |
|||
+ |
|||
" (SELECT IFNULL(SUM(total_food_received),0) FROM gcc_received_update WHERE requestid IN (SELECT requestid FROM daily_request WHERE required_date = ?)), " |
|||
+ |
|||
" (SELECT IFNULL(SUM(nulm + private + permanent),0) FROM daily_request WHERE required_date = ?), " |
|||
+ |
|||
" (SELECT IFNULL(SUM(absentees_nulm + absentees_private + absentees_permanent),0) FROM daily_request WHERE required_date = ?), " |
|||
+ |
|||
" (SELECT IFNULL(SUM(today_absentees_nulm + today_absentees_private + today_absentees_permanent),0) FROM gcc_received_update WHERE requestid IN (SELECT requestid FROM daily_request WHERE required_date = ?)), " |
|||
+ |
|||
" (SELECT IFNULL(SUM(total_box_shortfall),0) FROM gcc_received_update WHERE requestid IN (SELECT requestid FROM daily_request WHERE required_date = ?)) " |
|||
+ |
|||
") AS final_output " + |
|||
"ORDER BY driverid ASC"; |
|||
|
|||
return jdbcTemplate.queryForList(sql, date, date, date, date, date, date, date, date, date, date, date, date); |
|||
} |
|||
|
|||
} |
|||
/* |
|||
* String sql = "SELECT lm.location AS LocationDescription, "+ |
|||
* "dl.username AS DriverName, "+ |
|||
* " CONCAT('" |
|||
* +fileBaseUrl+"/gccofficialapp/files',dss_start.image) as upload_image_url, "+ |
|||
* " CONCAT(dss_start.latitude, ', ', dss_start.longitude) AS StartPoint, "+ |
|||
* "Date(dss_start.datetime) AS StartTime, "+ |
|||
* |
|||
* " CONCAT(dss_stop.latitude, ', ', dss_stop.longitude) AS EndPoint, "+ |
|||
* Date(dss_stop.datetime) AS EndTime |
|||
* |
|||
* FROM location_mapping lm |
|||
* INNER JOIN driver_login dl |
|||
* ON dl.loginid = lm.driverid |
|||
* |
|||
* LEFT JOIN driver_start_stop dss_start |
|||
* ON dss_start.loginid = lm.driverid |
|||
* AND dss_start.action = 'Start' |
|||
* |
|||
* |
|||
* LEFT JOIN driver_start_stop dss_stop |
|||
* ON dss_stop.loginid = lm.driverid |
|||
* AND dss_stop.action = 'Stop' |
|||
* AND dss_stop.startid = dss_start.locationid |
|||
* WHERE DATE(dss_start.datetime) = ?"; |
|||
* change for full query |
|||
*/ |
|||
@ -0,0 +1,348 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="en" xmlns:th="http://www.thymeleaf.org"> |
|||
|
|||
<head> |
|||
<title>Food Scheme Operations Dashboard</title> |
|||
|
|||
|
|||
<!-- Bootstrap 5 CSS --> |
|||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet"> |
|||
|
|||
<!-- DataTables CSS --> |
|||
<link href="https://cdn.datatables.net/1.13.4/css/jquery.dataTables.min.css" rel="stylesheet" /> |
|||
<link href="https://cdn.datatables.net/buttons/2.3.6/css/buttons.dataTables.min.css" rel="stylesheet" /> |
|||
|
|||
<style> |
|||
table.dataTable th, |
|||
table.dataTable td { |
|||
text-align: center; |
|||
vertical-align: middle; |
|||
border: 1px solid #000; |
|||
} |
|||
|
|||
table.dataTable th { |
|||
background-color: #003366 !important; |
|||
color: white; |
|||
} |
|||
|
|||
.dataTables_wrapper .dt-buttons { |
|||
margin-bottom: 10px; |
|||
} |
|||
|
|||
.dataTables_filter { |
|||
margin-bottom: 25px; |
|||
/* adjust as needed */ |
|||
} |
|||
|
|||
.page-header-title h4 { |
|||
margin: 20px 0; |
|||
text-align: center; |
|||
} |
|||
|
|||
#zoneDetailsTable_wrapper .dataTables_scrollBody { |
|||
border: none !important; |
|||
} |
|||
|
|||
#zoneDetailsTable td, |
|||
#zoneDetailsTable th { |
|||
vertical-align: middle; |
|||
text-align: center; |
|||
white-space: nowrap; |
|||
} |
|||
</style> |
|||
</head> |
|||
|
|||
<body> |
|||
|
|||
<div class="page-header-title"> |
|||
<h4>Food Scheme Report</h4> |
|||
</div> |
|||
|
|||
|
|||
|
|||
<div class="container mt-4"> |
|||
<div class="card p-3 shadow-sm"> |
|||
|
|||
<div class="d-flex justify-content-between"> |
|||
<h5><strong>Driver Logistics Report</strong></h5> |
|||
|
|||
<div class="d-flex gap-2"> |
|||
<!-- DATE PICKER --> |
|||
<input type="date" id="driverDate" class="form-control" style="width: 160px;"> |
|||
|
|||
<!-- SHIFT DROPDOWN --> |
|||
<!-- <select id="driverShift" class="form-control" style="width: 140px;"> |
|||
<option value="">Select Shift</option> |
|||
<option value="A">Shift A</option> |
|||
<option value="B">Shift B</option> |
|||
<option value="C">Shift C</option> |
|||
</select>--> |
|||
|
|||
<button class="btn btn-primary" onclick="loadDriverReport()">Load Report</button> |
|||
<button class="btn btn-success" onclick="goToSchemereport()"> |
|||
Back |
|||
</button> |
|||
|
|||
</div> |
|||
</div> |
|||
|
|||
<table id="driverReportTable" class="table table-bordered table-hover mt-3 text-center" style="display:none"> |
|||
<thead class="table-primary"> |
|||
<tr> |
|||
<th>Driver Name</th> |
|||
<th>Driver Mobile Number</th> |
|||
<th>Location Description</th> |
|||
<!-- <th>Current Location of the Driver</th>--> |
|||
<th>Photo of the Vehicle</th> |
|||
|
|||
<th>Start Point</th> |
|||
<th>Start Time</th> |
|||
<th>End Point</th> |
|||
<th>End Time</th> |
|||
</tr> |
|||
</thead> |
|||
<tbody id="driverReportBody"> |
|||
<!-- Rows inserted dynamically --> |
|||
</tbody> |
|||
</table> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<div id="pageLoader" |
|||
style="display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(255, 255, 255, 0.8); z-index: 9999; text-align: center;"> |
|||
<div style="position: relative; top: 50%; transform: translateY(-50%);"> |
|||
<div class="spinner-border text-primary" role="status" style="width: 3rem; height: 3rem;"> |
|||
<span class="sr-only"></span> |
|||
</div> |
|||
<!-- Add the 'Please wait' text below the spinner --> |
|||
<p style="margin-top: 1rem; font-size: 1.2rem; color: #007bff;">Please wait...</p> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<!-- Scripts --> |
|||
<script src="https://cdn.jsdelivr.net/npm/jquery@3.6.0/dist/jquery.min.js"></script> |
|||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script> |
|||
|
|||
<!-- DataTables JS --> |
|||
<script src="https://cdn.datatables.net/1.13.4/js/jquery.dataTables.min.js"></script> |
|||
<script src="https://cdn.datatables.net/buttons/2.3.6/js/dataTables.buttons.min.js"></script> |
|||
<script src="https://cdn.datatables.net/buttons/2.3.6/js/buttons.html5.min.js"></script> |
|||
<script src="https://cdn.datatables.net/buttons/2.3.6/js/buttons.print.min.js"></script> |
|||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script> |
|||
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.36/pdfmake.min.js"></script> |
|||
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.36/vfs_fonts.js"></script> |
|||
|
|||
<!-- SweetAlert --> |
|||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script> |
|||
|
|||
<script> |
|||
|
|||
let today = new Date().toISOString().split("T")[0]; |
|||
document.getElementById("driverDate").setAttribute("max", today); |
|||
document.getElementById("driverDate").value = today; |
|||
$('#pageLoader').show(); |
|||
|
|||
|
|||
// Auto-load report for today |
|||
loadDriverReport(); |
|||
function goToSchemereport() { |
|||
window.location.href = "/commissionerreview/foodSchemeReport"; |
|||
} |
|||
|
|||
|
|||
|
|||
function loadDriverReport() { |
|||
|
|||
let date = document.getElementById("driverDate").value; |
|||
|
|||
if (!date) { |
|||
Swal.fire("Required!", "Please select Date", "warning"); |
|||
return; |
|||
} |
|||
|
|||
let tbody = document.getElementById("driverReportBody"); |
|||
|
|||
if ($.fn.DataTable.isDataTable("#driverReportTable")) { |
|||
$("#driverReportTable").DataTable().clear().destroy(); |
|||
} |
|||
tbody.innerHTML = ""; |
|||
|
|||
|
|||
$.ajax({ |
|||
url: "/commissionerreview/api/driver-report", |
|||
method: "GET", |
|||
data: { date: date }, |
|||
success: function(response) { |
|||
$('#pageLoader').hide(); |
|||
// console.log(response); |
|||
|
|||
// Build table rows |
|||
response.data.forEach(d => { |
|||
tbody.innerHTML += ` |
|||
<tr> |
|||
<td>${d.DriverName || ''}</td> |
|||
<td>-</td> |
|||
|
|||
<td>${d.LocationDescription || ''}</td> |
|||
|
|||
<td><img src="${d.upload_image_url}" width="80" class="img-thumbnail"></td> |
|||
|
|||
<td>${d.StartPoint || ''}</td> |
|||
<td>${d.StartTime || ''}</td> |
|||
<td>${d.EndPoint || ''}</td> |
|||
<td>${d.EndTime || ''}</td> |
|||
</tr> |
|||
`; |
|||
}); |
|||
|
|||
document.getElementById("driverReportTable").style.display = "table"; |
|||
|
|||
|
|||
|
|||
// Reinitialize DataTable WITH PDF & EXCEL |
|||
setTimeout(() => { |
|||
$("#driverReportTable").DataTable({ |
|||
dom: 'Bfrtip', |
|||
paging: false, |
|||
searching: false, |
|||
ordering: false, |
|||
info: false, |
|||
buttons: [ |
|||
{ |
|||
extend: 'excelHtml5', |
|||
title: 'Driver_Report_' + date, |
|||
className: 'btn btn-success btn-sm', |
|||
text: 'Download Excel' |
|||
}, |
|||
{ |
|||
extend: 'pdfHtml5', |
|||
title: 'Driver_Report_' + date, |
|||
className: 'btn btn-danger btn-sm', |
|||
orientation: 'landscape', |
|||
pageSize: 'A4', |
|||
text: 'Download PDF' |
|||
} |
|||
] |
|||
}); |
|||
}, 150); |
|||
}, |
|||
|
|||
error: function() { |
|||
Swal.fire("Error!", "Unable to fetch driver report.", "error"); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
|
|||
|
|||
// Allow TODAY + PAST only (Restrict future) |
|||
// Restrict future dates |
|||
/*let today = new Date().toISOString().split("T")[0]; |
|||
document.getElementById("driverDate").setAttribute("max", today); |
|||
document.getElementById("driverDate").value = today; |
|||
|
|||
|
|||
// Auto-load report for today |
|||
loadDriverReport(); |
|||
|
|||
|
|||
function loadDriverReport() { |
|||
|
|||
let date = document.getElementById("driverDate").value; |
|||
|
|||
if (!date) { |
|||
Swal.fire("Required!", "Please select Date", "warning"); |
|||
return; |
|||
} |
|||
|
|||
let tbody = document.getElementById("driverReportBody"); |
|||
|
|||
if ($.fn.DataTable.isDataTable("#driverReportTable")) { |
|||
$("#driverReportTable").DataTable().clear().destroy(); |
|||
} |
|||
tbody.innerHTML = ""; |
|||
|
|||
|
|||
$.ajax({ |
|||
url: "/commissionerreview/api/feedback/driver-report", |
|||
method: "GET", |
|||
data: { date: date }, |
|||
success: function(data) { |
|||
console.log(data); |
|||
|
|||
// Build table rows |
|||
data.forEach(d => { |
|||
tbody.innerHTML += ` |
|||
<tr> |
|||
<td>${d.DriverName || ''}</td> |
|||
<td>-</td> |
|||
|
|||
<td>${d.LocationDescription || ''}</td> |
|||
|
|||
<td><img src="${d.upload_image_url}" width="80" class="img-thumbnail"></td> |
|||
|
|||
<td>${d.StartPoint || ''}</td> |
|||
<td>${d.StartTime || ''}</td> |
|||
<td>${d.EndPoint || ''}</td> |
|||
<td>${d.EndTime || ''}</td> |
|||
</tr> |
|||
`; |
|||
}); |
|||
|
|||
document.getElementById("driverReportTable").style.display = "table"; |
|||
|
|||
|
|||
|
|||
// Reinitialize DataTable WITH PDF & EXCEL |
|||
setTimeout(() => { |
|||
$("#driverReportTable").DataTable({ |
|||
dom: 'Bfrtip', |
|||
paging: false, |
|||
searching: false, |
|||
ordering: false, |
|||
info: false, |
|||
buttons: [ |
|||
{ |
|||
extend: 'excelHtml5', |
|||
title: 'Driver_Report_' + date, |
|||
className: 'btn btn-success btn-sm', |
|||
text: 'Download Excel' |
|||
}, |
|||
{ |
|||
extend: 'pdfHtml5', |
|||
title: 'Driver_Report_' + date, |
|||
className: 'btn btn-danger btn-sm', |
|||
orientation: 'landscape', |
|||
pageSize: 'A4', |
|||
text: 'Download PDF' |
|||
} |
|||
] |
|||
}); |
|||
}, 150); |
|||
}, |
|||
|
|||
error: function() { |
|||
Swal.fire("Error!", "Unable to fetch driver report.", "error"); |
|||
} |
|||
}); |
|||
}*/ |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
</script> |
|||
|
|||
</body> |
|||
|
|||
</html> |
|||
@ -0,0 +1,184 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="en" xmlns:th="http://www.thymeleaf.org"> |
|||
|
|||
<head> |
|||
<title>Feedback Summary Report</title> |
|||
|
|||
<!-- Bootstrap 5 --> |
|||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet"> |
|||
|
|||
<!-- DataTables CSS --> |
|||
<link href="https://cdn.datatables.net/1.13.4/css/jquery.dataTables.min.css" rel="stylesheet" /> |
|||
<link href="https://cdn.datatables.net/buttons/2.3.6/css/buttons.dataTables.min.css" rel="stylesheet" /> |
|||
|
|||
<style> |
|||
table.dataTable th, |
|||
table.dataTable td { |
|||
text-align: center; |
|||
vertical-align: middle; |
|||
border: 1px solid #000; |
|||
} |
|||
|
|||
table.dataTable th { |
|||
background-color: #003366 !important; |
|||
color: white; |
|||
} |
|||
|
|||
.page-header-title h4 { |
|||
margin-top: 20px; |
|||
text-align: center; |
|||
} |
|||
</style> |
|||
</head> |
|||
|
|||
<body> |
|||
|
|||
<div class="page-header-title"> |
|||
<h4><strong>Food Scheme – Feedback Summary</strong></h4> |
|||
</div> |
|||
|
|||
<div class="container mt-4"> |
|||
<div class="card shadow-sm p-3"> |
|||
|
|||
<div class="d-flex justify-content-between align-items-center mb-3"> |
|||
|
|||
<h5 class="mb-0"><strong>Feedback Questions Summary</strong></h5> |
|||
|
|||
<div class="d-flex align-items-center gap-2"> |
|||
<input type="date" id="reportDate" class="form-control" style="width: 200px;"> |
|||
<button class="btn btn-success" onclick="goToSchemereport()">Back</button> |
|||
</div> |
|||
|
|||
</div> |
|||
|
|||
|
|||
<!----------------------- TABLE -------------------------> |
|||
<table id="feedbackSummaryTable" class="table table-bordered mt-3"> |
|||
<thead> |
|||
<tr> |
|||
<th>Question</th> |
|||
<th>Yes Count</th> |
|||
<th>No Count</th> |
|||
</tr> |
|||
</thead> |
|||
<tbody id="feedbackSummaryBody"></tbody> |
|||
</table> |
|||
|
|||
</div> |
|||
</div> |
|||
<div id="pageLoader" |
|||
style="display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(255, 255, 255, 0.8); z-index: 9999; text-align: center;"> |
|||
<div style="position: relative; top: 50%; transform: translateY(-50%);"> |
|||
<div class="spinner-border text-primary" role="status" style="width: 3rem; height: 3rem;"> |
|||
<span class="sr-only"></span> |
|||
</div> |
|||
<!-- Add the 'Please wait' text below the spinner --> |
|||
<p style="margin-top: 1rem; font-size: 1.2rem; color: #007bff;">Please wait...</p> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<!-- jQuery --> |
|||
<script src="https://cdn.jsdelivr.net/npm/jquery@3.6.0/dist/jquery.min.js"></script> |
|||
|
|||
<!-- Bootstrap JS --> |
|||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script> |
|||
|
|||
<!-- DataTables --> |
|||
<script src="https://cdn.datatables.net/1.13.4/js/jquery.dataTables.min.js"></script> |
|||
<script src="https://cdn.datatables.net/buttons/2.3.6/js/dataTables.buttons.min.js"></script> |
|||
<script src="https://cdn.datatables.net/buttons/2.3.6/js/buttons.html5.min.js"></script> |
|||
<script src="https://cdn.datatables.net/buttons/2.3.6/js/buttons.print.min.js"></script> |
|||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script> |
|||
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.36/pdfmake.min.js"></script> |
|||
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.36/vfs_fonts.js"></script> |
|||
|
|||
<script> |
|||
$(document).ready(function () { |
|||
$('#pageLoader').show(); |
|||
|
|||
// Set date picker to today (and restrict future) |
|||
let today = new Date().toISOString().split("T")[0]; |
|||
$("#reportDate").val(today); |
|||
$("#reportDate").attr("max", today); |
|||
|
|||
// Load initial data |
|||
loadFeedbackSummary(today); |
|||
|
|||
// On date change |
|||
$("#reportDate").on("change", function () { |
|||
loadFeedbackSummary(this.value); |
|||
}); |
|||
}); |
|||
function goToSchemereport() { |
|||
window.location.href = "/commissionerreview/foodSchemeReport"; |
|||
} |
|||
|
|||
|
|||
|
|||
/* ------------------------------- |
|||
LOAD SUMMARY AJAX FUNCTION |
|||
--------------------------------*/ |
|||
function loadFeedbackSummary(date) { |
|||
|
|||
$.ajax({ |
|||
url: "/commissionerreview/api/feedback-summary", |
|||
method: "GET", |
|||
data: { date: date }, |
|||
|
|||
success: function (response) { |
|||
$('#pageLoader').hide(); |
|||
// console.log("Feedback Summary Data:", response); |
|||
|
|||
// 1. Destroy existing DataTable FIRST |
|||
if ($.fn.DataTable.isDataTable("#feedbackSummaryTable")) { |
|||
$("#feedbackSummaryTable").DataTable().clear().destroy(); |
|||
} |
|||
|
|||
// 2. Clear old rows |
|||
$("#feedbackSummaryBody").empty(); |
|||
|
|||
// 3. Append new rows |
|||
// response.forEach(row => { |
|||
response.data.forEach(row => { |
|||
$("#feedbackSummaryBody").append(` |
|||
<tr> |
|||
<td>${row.question}</td> |
|||
<td class="text-success fw-bold">${row.yes_count}</td> |
|||
<td class="text-danger fw-bold">${row.no_count}</td> |
|||
</tr> |
|||
`); |
|||
}); |
|||
|
|||
// 4. Initialize DataTable AFTER inserting new rows |
|||
$("#feedbackSummaryTable").DataTable({ |
|||
dom: 'Bfrtip', |
|||
paging: false, |
|||
searching: false, |
|||
ordering: false, |
|||
info: false, |
|||
buttons: [ |
|||
{ |
|||
extend: 'excelHtml5', |
|||
text: 'Download Excel', |
|||
className: 'btn btn-success btn-sm', |
|||
title: 'Feedback_Summary_' + date |
|||
}, |
|||
{ |
|||
extend: 'pdfHtml5', |
|||
text: 'Download PDF', |
|||
className: 'btn btn-danger btn-sm', |
|||
title: 'Feedback_Summary_' + date, |
|||
orientation: 'landscape' |
|||
} |
|||
] |
|||
}); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
</script> |
|||
|
|||
</body> |
|||
|
|||
</html> |
|||
1075
src/main/resources/templates/modules/food_scheme/foodschemereport.html
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
Write
Preview
Loading…
Cancel
Save
Reference in new issue