|
|
@ -1,9 +1,12 @@ |
|
|
package com.gcc.communityHall.controller; |
|
|
package com.gcc.communityHall.controller; |
|
|
|
|
|
|
|
|
import java.util.*; |
|
|
import java.util.*; |
|
|
import java.util.function.Function; |
|
|
import java.util.function.Function; |
|
|
import java.util.function.Predicate; |
|
|
import java.util.function.Predicate; |
|
|
import java.util.stream.Collectors; |
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
|
|
|
import com.fasterxml.jackson.core.JsonProcessingException; |
|
|
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper; |
|
|
import com.gcc.communityHall.entity.GccBlockingDate; |
|
|
import com.gcc.communityHall.entity.GccBlockingDate; |
|
|
import com.gcc.communityHall.others.AppConfig; |
|
|
import com.gcc.communityHall.others.AppConfig; |
|
|
import com.gcc.communityHall.repository.GccBlockingDateRepository; |
|
|
import com.gcc.communityHall.repository.GccBlockingDateRepository; |
|
|
@ -87,8 +90,7 @@ public class HeadquartersController { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@GetMapping("/Reports") |
|
|
@GetMapping("/Reports") |
|
|
public String viewReports(Model model,HttpSession session) |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
public String viewReports(Model model, HttpSession session) { |
|
|
String headquartersname = (String) session.getAttribute("usertype"); |
|
|
String headquartersname = (String) session.getAttribute("usertype"); |
|
|
if (headquartersname != null) { |
|
|
if (headquartersname != null) { |
|
|
long mobileno = (long) session.getAttribute("mobileno"); |
|
|
long mobileno = (long) session.getAttribute("mobileno"); |
|
|
@ -102,8 +104,7 @@ public class HeadquartersController { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@GetMapping("/getReport") |
|
|
@GetMapping("/getReport") |
|
|
public String getReports(Model model,HttpSession session) |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
public String getReports(Model model, HttpSession session) { |
|
|
String headquartersname = (String) session.getAttribute("usertype"); |
|
|
String headquartersname = (String) session.getAttribute("usertype"); |
|
|
if (headquartersname != null) { |
|
|
if (headquartersname != null) { |
|
|
long mobileno = (long) session.getAttribute("mobileno"); |
|
|
long mobileno = (long) session.getAttribute("mobileno"); |
|
|
@ -115,6 +116,7 @@ public class HeadquartersController { |
|
|
return "redirect:/communityhall/login"; |
|
|
return "redirect:/communityhall/login"; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@GetMapping("/approval-history") |
|
|
@GetMapping("/approval-history") |
|
|
public String viewApproval(Model model, HttpSession session) { |
|
|
public String viewApproval(Model model, HttpSession session) { |
|
|
String headquartersname = (String) session.getAttribute("usertype"); |
|
|
String headquartersname = (String) session.getAttribute("usertype"); |
|
|
@ -185,9 +187,11 @@ public class HeadquartersController { |
|
|
@RequestParam(name = "filterby", required = false) String filterby, |
|
|
@RequestParam(name = "filterby", required = false) String filterby, |
|
|
@RequestParam(name = "zone1", required = false, defaultValue = "ALL") String zone, |
|
|
@RequestParam(name = "zone1", required = false, defaultValue = "ALL") String zone, |
|
|
@RequestParam(name = "division1", required = false, defaultValue = "ALL") String division, |
|
|
@RequestParam(name = "division1", required = false, defaultValue = "ALL") String division, |
|
|
@RequestParam(name = "hall1",required = false, defaultValue = "1000") Integer hallid, |
|
|
|
|
|
|
|
|
@RequestParam(name = "hall1", required = false) Integer hallid, |
|
|
@RequestParam(name = "basedon", required = false) String basedon, |
|
|
@RequestParam(name = "basedon", required = false) String basedon, |
|
|
@RequestParam(name = "bookingId", required = false) Long bookingId,HttpSession session) { |
|
|
|
|
|
|
|
|
@RequestParam(name = "bookingId", required = false) Long bookingId, |
|
|
|
|
|
@RequestParam(name = "reporttype", required = false) String reporttype, |
|
|
|
|
|
@RequestParam(name = "counterId", required = false) String counterId, HttpSession session) throws JsonProcessingException { |
|
|
String headquartersname = (String) session.getAttribute("usertype"); |
|
|
String headquartersname = (String) session.getAttribute("usertype"); |
|
|
if (headquartersname != null) { |
|
|
if (headquartersname != null) { |
|
|
long mobileno = (long) session.getAttribute("mobileno"); |
|
|
long mobileno = (long) session.getAttribute("mobileno"); |
|
|
@ -242,6 +246,30 @@ public class HeadquartersController { |
|
|
model.addAttribute("totalBookings", totalBookings); |
|
|
model.addAttribute("totalBookings", totalBookings); |
|
|
List<Object[]> hallbookingList = handleBookingHallDetailsReportRequest(request, fromDate, toDate, filterby, zone, division, hallid); |
|
|
List<Object[]> hallbookingList = handleBookingHallDetailsReportRequest(request, fromDate, toDate, filterby, zone, division, hallid); |
|
|
|
|
|
|
|
|
|
|
|
if ("9".equals(request)) { |
|
|
|
|
|
if("abstract".equals(reporttype)){ |
|
|
|
|
|
List<Object[]> counterBookingList = new ArrayList<>(); |
|
|
|
|
|
counterBookingList = bookingService.getCounterWiseBookingCount(fromDate, toDate); |
|
|
|
|
|
model.addAttribute("counterBookingList", counterBookingList); |
|
|
|
|
|
System.out.println("counterBookingList.." + counterBookingList); |
|
|
|
|
|
|
|
|
|
|
|
List<Object[]> hallBookingByCounter = bookingService.getHallWiseBookingDetails(fromDate, toDate, counterId); |
|
|
|
|
|
// Convert to JSON for JS usage |
|
|
|
|
|
String hallBookingJson = new ObjectMapper().writeValueAsString(hallBookingByCounter); |
|
|
|
|
|
model.addAttribute("hallBookingJson", hallBookingJson); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<Object[]> hallBookingDetails = bookingService.getBookingDetailsForAllHalls(fromDate, toDate, counterId, hallid); |
|
|
|
|
|
String hallBookingDetailsJson = new ObjectMapper().writeValueAsString(hallBookingDetails); |
|
|
|
|
|
model.addAttribute("hallBookingDetailsJson", hallBookingDetailsJson); |
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
List<Object[]> counterBookingList = new ArrayList<>(); |
|
|
|
|
|
counterBookingList = bookingService.getCounterWiseBookingDetails(fromDate, toDate); |
|
|
|
|
|
model.addAttribute("counterBookingList", counterBookingList); |
|
|
|
|
|
} |
|
|
|
|
|
model.addAttribute("reporttype", reporttype); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
model.addAttribute("filterby", filterby); |
|
|
model.addAttribute("filterby", filterby); |
|
|
model.addAttribute("users", userList); |
|
|
model.addAttribute("users", userList); |
|
|
@ -272,23 +300,19 @@ public class HeadquartersController { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private List<Object[]> handleBookingHallDetailsReportRequest(String request, String fromDate, String toDate,String filterby,String zone,String division,Integer hallid) |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
private List<Object[]> handleBookingHallDetailsReportRequest(String request, String fromDate, String toDate, String filterby, String zone, String division, Integer hallid) { |
|
|
if (!request.equals("5")) { |
|
|
if (!request.equals("5")) { |
|
|
return new ArrayList<>(); |
|
|
return new ArrayList<>(); |
|
|
} |
|
|
} |
|
|
if(filterby.isEmpty()) |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
if (filterby.isEmpty()) { |
|
|
return bookingService.getBookingHallDetailsReportByBookingDate(fromDate, toDate, zone, division, hallid); |
|
|
return bookingService.getBookingHallDetailsReportByBookingDate(fromDate, toDate, zone, division, hallid); |
|
|
} |
|
|
} |
|
|
if ("1".equals(filterby)) |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
if ("1".equals(filterby)) { |
|
|
|
|
|
|
|
|
return bookingService.getBookingHallDetailsReportByBookingDate(fromDate, toDate, zone, division, hallid); |
|
|
return bookingService.getBookingHallDetailsReportByBookingDate(fromDate, toDate, zone, division, hallid); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
if ("2".equals(filterby)) |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
if ("2".equals(filterby)) { |
|
|
|
|
|
|
|
|
return bookingService.getBookingHallDetailsReportByEventDate(fromDate, toDate, zone, division, hallid); |
|
|
return bookingService.getBookingHallDetailsReportByEventDate(fromDate, toDate, zone, division, hallid); |
|
|
|
|
|
|
|
|
@ -314,49 +338,36 @@ public class HeadquartersController { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private List<Object[]> handleBookingRequest(String request, String fromDate, String toDate, String bookingStatus, String filterby, Long bookingId, String zone, String division, Integer hallid) { |
|
|
private List<Object[]> handleBookingRequest(String request, String fromDate, String toDate, String bookingStatus, String filterby, Long bookingId, String zone, String division, Integer hallid) { |
|
|
if (!request.equals("2")) { |
|
|
if (!request.equals("2")) { |
|
|
return new ArrayList<>(); |
|
|
return new ArrayList<>(); |
|
|
} |
|
|
} |
|
|
if(filterby.isEmpty() && bookingStatus.isEmpty() && bookingId == null) |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
if (filterby.isEmpty() && bookingStatus.isEmpty() && bookingId == null) { |
|
|
return bookingService.getBookingDetailsByBookingDate(fromDate, toDate, zone, division, hallid); |
|
|
return bookingService.getBookingDetailsByBookingDate(fromDate, toDate, zone, division, hallid); |
|
|
} |
|
|
} |
|
|
if(bookingId!=null && bookingStatus.isEmpty()) |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
if (bookingId != null && bookingStatus.isEmpty()) { |
|
|
return bookingDetailsRepo.getAllBookingDetailsWithBookingId(fromDate, toDate, bookingId); |
|
|
return bookingDetailsRepo.getAllBookingDetailsWithBookingId(fromDate, toDate, bookingId); |
|
|
} |
|
|
} |
|
|
if(bookingId!=null && !bookingStatus.isEmpty()) |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
if (bookingId != null && !bookingStatus.isEmpty()) { |
|
|
return bookingDetailsRepo.getAllBookingDetailsWithBookingIdwithbookingStatus(fromDate, toDate, bookingId, bookingStatus); |
|
|
return bookingDetailsRepo.getAllBookingDetailsWithBookingIdwithbookingStatus(fromDate, toDate, bookingId, bookingStatus); |
|
|
} |
|
|
} |
|
|
if(bookingId==null && filterby.isEmpty() && !bookingStatus.isEmpty()) |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
if (bookingId == null && filterby.isEmpty() && !bookingStatus.isEmpty()) { |
|
|
return bookingService.getBookingDetailsByBookingDateWithStatus(fromDate, toDate, bookingStatus, zone, division, hallid); |
|
|
return bookingService.getBookingDetailsByBookingDateWithStatus(fromDate, toDate, bookingStatus, zone, division, hallid); |
|
|
} |
|
|
} |
|
|
if(!filterby.isEmpty()) |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
if (!filterby.isEmpty()) { |
|
|
|
|
|
|
|
|
if ("1".equals(filterby)) |
|
|
|
|
|
{ |
|
|
|
|
|
if(bookingStatus.isEmpty()) |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
if ("1".equals(filterby)) { |
|
|
|
|
|
if (bookingStatus.isEmpty()) { |
|
|
return bookingService.getBookingDetailsByBookingDate(fromDate, toDate, zone, division, hallid); |
|
|
return bookingService.getBookingDetailsByBookingDate(fromDate, toDate, zone, division, hallid); |
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
} else { |
|
|
return bookingService.getBookingDetailsByBookingDateWithStatus(fromDate, toDate, bookingStatus, zone, division, hallid); |
|
|
return bookingService.getBookingDetailsByBookingDateWithStatus(fromDate, toDate, bookingStatus, zone, division, hallid); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
if ("2".equals(filterby)) |
|
|
|
|
|
{ |
|
|
|
|
|
if(bookingStatus.isEmpty()) |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
if ("2".equals(filterby)) { |
|
|
|
|
|
if (bookingStatus.isEmpty()) { |
|
|
return bookingService.getBookingDetailsByEventDate(fromDate, toDate, zone, division, hallid); |
|
|
return bookingService.getBookingDetailsByEventDate(fromDate, toDate, zone, division, hallid); |
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
|
|
|
} else { |
|
|
return bookingService.getBookingDetailsByEventDateWithStatus(fromDate, toDate, bookingStatus, zone, division, hallid); |
|
|
return bookingService.getBookingDetailsByEventDateWithStatus(fromDate, toDate, bookingStatus, zone, division, hallid); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -371,36 +382,26 @@ public class HeadquartersController { |
|
|
if (!request.equals("6")) { |
|
|
if (!request.equals("6")) { |
|
|
return new ArrayList<>(); |
|
|
return new ArrayList<>(); |
|
|
} |
|
|
} |
|
|
if(filterby.isEmpty() && refundStatus.isEmpty()) |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
if (filterby.isEmpty() && refundStatus.isEmpty()) { |
|
|
return bookingService.getAllBookingsettlementDetailsByBookingDate(fromDate, toDate); |
|
|
return bookingService.getAllBookingsettlementDetailsByBookingDate(fromDate, toDate); |
|
|
} |
|
|
} |
|
|
if(filterby.isEmpty() && !refundStatus.isEmpty()) |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
if (filterby.isEmpty() && !refundStatus.isEmpty()) { |
|
|
return bookingService.getAllBookingsettlementDetailsByBookingDateWithStatus(fromDate, toDate, refundStatus); |
|
|
return bookingService.getAllBookingsettlementDetailsByBookingDateWithStatus(fromDate, toDate, refundStatus); |
|
|
} |
|
|
} |
|
|
if(!filterby.isEmpty()) |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
if (!filterby.isEmpty()) { |
|
|
|
|
|
|
|
|
if ("1".equals(filterby)) |
|
|
|
|
|
{ |
|
|
|
|
|
if(refundStatus.isEmpty()) |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
if ("1".equals(filterby)) { |
|
|
|
|
|
if (refundStatus.isEmpty()) { |
|
|
return bookingService.getAllBookingsettlementDetailsByBookingDate(fromDate, toDate); |
|
|
return bookingService.getAllBookingsettlementDetailsByBookingDate(fromDate, toDate); |
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
} else { |
|
|
return bookingService.getAllBookingsettlementDetailsByBookingDateWithStatus(fromDate, toDate, refundStatus); |
|
|
return bookingService.getAllBookingsettlementDetailsByBookingDateWithStatus(fromDate, toDate, refundStatus); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
if ("2".equals(filterby)) |
|
|
|
|
|
{ |
|
|
|
|
|
if(refundStatus.isEmpty()) |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
if ("2".equals(filterby)) { |
|
|
|
|
|
if (refundStatus.isEmpty()) { |
|
|
return bookingService.getAllBookingsettlementDetailsByEventDate(fromDate, toDate); |
|
|
return bookingService.getAllBookingsettlementDetailsByEventDate(fromDate, toDate); |
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
|
|
|
} else { |
|
|
return bookingService.getAllBookingsettlementDetailsByEventDateWithStatus(fromDate, toDate, refundStatus); |
|
|
return bookingService.getAllBookingsettlementDetailsByEventDateWithStatus(fromDate, toDate, refundStatus); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -410,6 +411,7 @@ public class HeadquartersController { |
|
|
// Handle default or error case |
|
|
// Handle default or error case |
|
|
return new ArrayList<>(); |
|
|
return new ArrayList<>(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@GetMapping("/ongoingevents") |
|
|
@GetMapping("/ongoingevents") |
|
|
public String viewRecentevents(Model model, HttpSession session) { |
|
|
public String viewRecentevents(Model model, HttpSession session) { |
|
|
String headquartersname = (String) session.getAttribute("usertype"); |
|
|
String headquartersname = (String) session.getAttribute("usertype"); |
|
|
@ -564,12 +566,12 @@ public String RefundFailedList(Model model,HttpSession session) { |
|
|
model.addAttribute("refundfailedcancelledbookings", refundfailedcancelledbookings); |
|
|
model.addAttribute("refundfailedcancelledbookings", refundfailedcancelledbookings); |
|
|
model.addAttribute("refundfailedrejectedbookings", refundfailedrejectedbookings); |
|
|
model.addAttribute("refundfailedrejectedbookings", refundfailedrejectedbookings); |
|
|
return "headquarters/refund-failedlist"; |
|
|
return "headquarters/refund-failedlist"; |
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
|
|
|
} else { |
|
|
session.invalidate(); |
|
|
session.invalidate(); |
|
|
return "redirect:/communityhall/login"; |
|
|
return "redirect:/communityhall/login"; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@GetMapping("/settlement-completedlist") |
|
|
@GetMapping("/settlement-completedlist") |
|
|
public String viewSettlementcompletedMaster(Model model, HttpSession session) { |
|
|
public String viewSettlementcompletedMaster(Model model, HttpSession session) { |
|
|
String headquartersname = (String) session.getAttribute("usertype"); |
|
|
String headquartersname = (String) session.getAttribute("usertype"); |
|
|
|