@ -97,10 +97,7 @@ import lombok.AllArgsConstructor;
/ / @RestController
/ / @RequestMapping ( "/admin/api" )
@Tag (
name = "CRUD REST APIs for Admin in CommunityHall" ,
description = "CRUD REST APIs in CommunityHall to CREATE, UPDATE, FETCH AND DELETE Booking details"
)
@Tag ( name = "CRUD REST APIs for Admin in CommunityHall" , description = "CRUD REST APIs in CommunityHall to CREATE, UPDATE, FETCH AND DELETE Booking details" )
@RestController
@RequestMapping ( "/victoriahallbooking/admin/api" )
@AllArgsConstructor
@ -168,32 +165,10 @@ public class AdminAPIController {
@Autowired
private ApplicationLogsRepository applicationLogsRepository ;
@Operation (
summary = "Update HallDetails REST API" ,
description = "REST API to update the Hall Details"
)
@Operation ( summary = "Update HallDetails REST API" , description = "REST API to update the Hall Details" )
@ApiResponses ( {
@ApiResponse (
responseCode = "200" ,
description = "HTTP Status UPDATED" ,
content = @Content (
mediaType = "text/plain" ,
schema = @Schema ( implementation = HallDetails . class ) ,
examples = @ExampleObject ( value = "Hall details updated successfully" )
)
) ,
@ApiResponse (
responseCode = "500" ,
description = "HTTP Status Internal Server Error" ,
content = @Content (
mediaType = "application/json" ,
schema = @Schema ( implementation = ErrorResponseDto . class ) ,
examples = @ExampleObject (
name = "Internal Server Error Example" ,
value = "{ \"path\": \"/updateHallDetails\", \"status\": 500, \"error\": \"Internal Server Error\", \"timestamp\": \"2024-06-22T05:47:04.347+00:00\" }"
)
)
)
@ApiResponse ( responseCode = "200" , description = "HTTP Status UPDATED" , content = @Content ( mediaType = "text/plain" , schema = @Schema ( implementation = HallDetails . class ) , examples = @ExampleObject ( value = "Hall details updated successfully" ) ) ) ,
@ApiResponse ( responseCode = "500" , description = "HTTP Status Internal Server Error" , content = @Content ( mediaType = "application/json" , schema = @Schema ( implementation = ErrorResponseDto . class ) , examples = @ExampleObject ( name = "Internal Server Error Example" , value = "{ \"path\": \"/updateHallDetails\", \"status\": 500, \"error\": \"Internal Server Error\", \"timestamp\": \"2024-06-22T05:47:04.347+00:00\" }" ) ) )
} )
@PostMapping ( "/updateHallDetails" )
public ResponseEntity < String > updateHallInfo (
@ -270,43 +245,18 @@ public class AdminAPIController {
return ResponseEntity . ok ( "Success" ) ;
}
@Operation (
summary = "Update Settlement Status REST API" ,
description = "REST API to update the Settlement Status to INITIATED"
)
@Operation ( summary = "Update Settlement Status REST API" , description = "REST API to update the Settlement Status to INITIATED" )
@ApiResponses ( {
@ApiResponse (
responseCode = "200" ,
description = "HTTP Status UPDATED" ,
content = @Content (
mediaType = "application/json" ,
schema = @Schema ( implementation = Settlement . class ) ,
examples = @ExampleObject (
name = "Settlement Example" ,
value = "{\"settlementId\": Id, \"Refundstatus\": \"INITIATED\", \"comments\": \"Settlement initiated successfully\"}"
)
)
) ,
@ApiResponse (
responseCode = "500" ,
description = "HTTP Status Internal Server Error" ,
content = @Content (
mediaType = "application/json" ,
schema = @Schema ( implementation = ErrorResponseDto . class ) ,
examples = @ExampleObject (
name = "Internal Server Error Example" ,
value = "{ \"path\": \"/updateInitiatedSettlementStatus/{settlementId}\", \"status\": 500, \"error\": \"Internal Server Error\", \"timestamp\": \"2024-06-22T05:47:04.347+00:00\" }"
)
)
)
@ApiResponse ( responseCode = "200" , description = "HTTP Status UPDATED" , content = @Content ( mediaType = "application/json" , schema = @Schema ( implementation = Settlement . class ) , examples = @ExampleObject ( name = "Settlement Example" , value = "{\"settlementId\": Id, \"Refundstatus\": \"INITIATED\", \"comments\": \"Settlement initiated successfully\"}" ) ) ) ,
@ApiResponse ( responseCode = "500" , description = "HTTP Status Internal Server Error" , content = @Content ( mediaType = "application/json" , schema = @Schema ( implementation = ErrorResponseDto . class ) , examples = @ExampleObject ( name = "Internal Server Error Example" , value = "{ \"path\": \"/updateInitiatedSettlementStatus/{settlementId}\", \"status\": 500, \"error\": \"Internal Server Error\", \"timestamp\": \"2024-06-22T05:47:04.347+00:00\" }" ) ) )
} )
@PostMapping ( "/updateInitiatedSettlementStatus/{settlementId}" )
public ResponseEntity < Settlement > updateInitiatedSettlementStatus (
@PathVariable ( "settlementId" ) int settlementId ,
@RequestParam ( "status" ) BookingDetails . RefundStatus status ,
@RequestParam ( "comments" ) String comments ) {
Settlement updateInitialiseSettlement = settlementService . updateSettlementStatus ( settlementId , status , comments ) ;
Settlement updateInitialiseSettlement = settlementService . updateSettlementStatus ( settlementId , status ,
comments ) ;
String adminname = ( String ) session . getAttribute ( "usertype" ) ;
Integer loginid = ( Integer ) session . getAttribute ( "id" ) ;
ApplicationLogs logs = new ApplicationLogs ( ) ;
@ -330,27 +280,11 @@ public class AdminAPIController {
}
}
@Operation (
summary = "HallDetails by HallId REST API" ,
description = "REST API to Retrieving the Hall Details by hallId"
)
@Operation ( summary = "HallDetails by HallId REST API" , description = "REST API to Retrieving the Hall Details by hallId" )
@ApiResponses ( {
@ApiResponse (
responseCode = "200" ,
description = "HTTP Status OK" ,
content = @Content (
mediaType = "application/json" ,
schema = @Schema ( implementation = HallDetails . class )
)
) ,
@ApiResponse (
responseCode = "400" ,
description = "Bad Request"
) ,
@ApiResponse (
responseCode = "404" ,
description = "Not Found"
)
@ApiResponse ( responseCode = "200" , description = "HTTP Status OK" , content = @Content ( mediaType = "application/json" , schema = @Schema ( implementation = HallDetails . class ) ) ) ,
@ApiResponse ( responseCode = "400" , description = "Bad Request" ) ,
@ApiResponse ( responseCode = "404" , description = "Not Found" )
} )
@GetMapping ( "/getHallDetails/{hallId}" )
public ResponseEntity < HallDetails > getHallDetails ( @PathVariable String hallId ) {
@ -362,7 +296,7 @@ public class AdminAPIController {
}
HallDetails hallDetails = hallDetailsRepository . findHallDetailsById ( id ) ;
/ / System . out . println ( hallDetails . isActive ( ) ) ;
/ / System . out . println ( hallDetails . isActive ( ) ) ;
if ( hallDetails ! = null ) {
return ResponseEntity . ok ( hallDetails ) ;
} else {
@ -370,10 +304,7 @@ public class AdminAPIController {
}
}
@Operation (
summary = "Saving the DiscountRange REST API" ,
description = "REST API to Saving the Discount Range for usertypes"
)
@Operation ( summary = "Saving the DiscountRange REST API" , description = "REST API to Saving the Discount Range for usertypes" )
@PostMapping ( "/savediscountrange" )
public String saveDiscountrange (
@RequestParam String userType ,
@ -427,12 +358,10 @@ public class AdminAPIController {
return "success" ;
}
@Operation (
summary = " Update the DiscountRange REST API" ,
description = "REST API to Updating the Discount Range for usertypes"
)
@Operation ( summary = " Update the DiscountRange REST API" , description = "REST API to Updating the Discount Range for usertypes" )
@PutMapping ( "/updateById/{id}" )
public String updateDiscountRangeById ( @PathVariable int id , @RequestParam float discountRange , HttpSession session ) {
public String updateDiscountRangeById ( @PathVariable int id , @RequestParam float discountRange ,
HttpSession session ) {
String adminname = ( String ) session . getAttribute ( "usertype" ) ;
Optional < DiscountRange > existingDiscount = discountRangeRepo . findById ( id ) ;
if ( existingDiscount . isPresent ( ) ) {
@ -462,11 +391,7 @@ public class AdminAPIController {
}
}
@Operation (
summary = " Delete the DiscountRange REST API" ,
description = "REST API to Deleting the Discount for usertypes"
)
@Operation ( summary = " Delete the DiscountRange REST API" , description = "REST API to Deleting the Discount for usertypes" )
@DeleteMapping ( "/deleteById/{id}" )
public ResponseEntity < String > deleteDiscountRangeById ( @PathVariable int id ) {
if ( discountRangeRepo . existsById ( id ) ) {
@ -523,70 +448,61 @@ public class AdminAPIController {
}
@Operation (
summary = "Retrieving the Discount Details REST API" ,
description = "REST API to Retrieve the Discount Details for usertypes"
)
/ / Retrieving the Discount Details
@Operation ( summary = "Retrieving the Discount Details REST API" , description = "REST API to Retrieve the Discount Details for usertypes" )
/ / Retrieving the Discount Details
@GetMapping ( "/getDiscountDetails" )
public Optional < DiscountRange > getDIscountDetails ( @RequestParam ( "id" ) int id ) {
Optional < DiscountRange > discountdetails = discountRangeRepo . findById ( id ) ;
return discountdetails ;
}
@Operation (
summary = "Save Reasons REST API" ,
description = "REST API to save the reasons"
)
/ / saving the Reason
@Operation ( summary = "Save Reasons REST API" , description = "REST API to save the reasons" )
/ / saving the Reason
@PostMapping ( "/saveReason" )
public ResponseEntity < ? > saveReason ( @RequestBody ReasonMaster reasaon ) {
return ResponseEntity . ok ( reasonMasterService . saveTheReason ( reasaon ) ) ;
}
@Operation (
summary = "All Reasons REST API" ,
description = "REST API to retrie the allreasons"
)
/ / retrieving the allreasons
@Operation ( summary = "All Reasons REST API" , description = "REST API to retrie the allreasons" )
/ / retrieving the allreasons
@GetMapping ( "/getReasons" )
@ResponseBody
public List < ReasonMaster > getAllReasons ( ) {
return reasonMasterService . getAllReasons ( ) ;
/ / return reasonMasterService . getAllReasons ( ) ;
return reasonMasterService . getAllReasonsWithStatus ( ) ;
}
@Operation (
summary = "Reason Documents by reasonId REST API" ,
description = "REST API to Get the ReasonDocuments By reasonId"
)
/ / Getting ReasonDocuments By reasonId
@Operation ( summary = "Reason Documents by reasonId REST API" , description = "REST API to Get the ReasonDocuments By reasonId" )
/ / Getting ReasonDocuments By reasonId
@GetMapping ( "/getReasonDocumentDetails" )
public List < ReasonDocumentMaster > getReasonDocumentDetails ( @RequestParam int reasonId ) {
return reasonMasterService . getReasonDocumentDetailsByReasonId ( reasonId ) ;
}
@Operation (
summary = "Booking Details by Fromdate,toDate and HallId REST API" ,
description = "REST API to get the Booking Details by Fromdate,toDate and HallId for GccBlokcing"
)
/ / @GetMapping ( "/filter" )
/ / public ResponseEntity < List < BookingResponseDTO > > getFilteredBookings (
/ / @RequestParam ( "fromDate" ) @DateTimeFormat ( pattern = "yyyy-MM-dd" ) LocalDate fromDate ,
/ / @RequestParam ( "toDate" ) @DateTimeFormat ( pattern = "yyyy-MM-dd" ) LocalDate toDate ,
/ / @RequestParam ( "hallIds" ) List < Long > hallIds ) {
/ /
/ / List < BookingDetails > bookings = bookingService . getFilteredBookings ( fromDate , toDate , hallIds ) ;
/ /
/ / List < BookingResponseDTO > responses = new ArrayList < > ( ) ;
/ / for ( BookingDetails bookingDetails : bookings ) {
/ / / / Fetch GccBlockingDate records for each bookingId
/ / List < GccBlockingDate > gccBlockedList = blockingDateRepository . getByBookingId ( bookingDetails . getBookingId ( ) ) ;
/ / Integer blockingId = gccBlockedList . isEmpty ( ) ? null : gccBlockedList . get ( 0 ) . getBlockingId ( ) ;
/ / responses . add ( new BookingResponseDTO ( bookingDetails , blockingId ) ) ;
/ / }
/ /
/ / return ResponseEntity . ok ( responses ) ;
/ / }
@Operation ( summary = "Booking Details by Fromdate,toDate and HallId REST API" , description = "REST API to get the Booking Details by Fromdate,toDate and HallId for GccBlokcing" )
/ / @GetMapping ( "/filter" )
/ / public ResponseEntity < List < BookingResponseDTO > > getFilteredBookings (
/ / @RequestParam ( "fromDate" ) @DateTimeFormat ( pattern = "yyyy-MM-dd" ) LocalDate
/ / fromDate ,
/ / @RequestParam ( "toDate" ) @DateTimeFormat ( pattern = "yyyy-MM-dd" ) LocalDate
/ / toDate ,
/ / @RequestParam ( "hallIds" ) List < Long > hallIds ) {
/ /
/ / List < BookingDetails > bookings = bookingService . getFilteredBookings ( fromDate ,
/ / toDate , hallIds ) ;
/ /
/ / List < BookingResponseDTO > responses = new ArrayList < > ( ) ;
/ / for ( BookingDetails bookingDetails : bookings ) {
/ / / / Fetch GccBlockingDate records for each bookingId
/ / List < GccBlockingDate > gccBlockedList =
/ / blockingDateRepository . getByBookingId ( bookingDetails . getBookingId ( ) ) ;
/ / Integer blockingId = gccBlockedList . isEmpty ( ) ? null :
/ / gccBlockedList . get ( 0 ) . getBlockingId ( ) ;
/ / responses . add ( new BookingResponseDTO ( bookingDetails , blockingId ) ) ;
/ / }
/ /
/ / return ResponseEntity . ok ( responses ) ;
/ / }
@GetMapping ( "/filter" )
public ResponseEntity < Map < String , Object > > getFilteredBookings (
@RequestParam ( "fromDate" ) @DateTimeFormat ( pattern = "yyyy-MM-dd" ) LocalDate fromDate ,
@ -594,7 +510,8 @@ public class AdminAPIController {
@RequestParam ( "hallIds" ) List < Long > hallIds ) {
List < BookingDetails > bookings = bookingService . getFilteredBookings ( fromDate , toDate , hallIds ) ;
List < GccBlockingDate > gccBlockedList = blockingDateRepository . findByFromDateAndToDateBetweenAndHallIdIn ( fromDate , toDate , hallIds ) ;
List < GccBlockingDate > gccBlockedList = blockingDateRepository
. findByFromDateAndToDateBetweenAndHallIdIn ( fromDate , toDate , hallIds ) ;
Map < String , Object > response = new HashMap < > ( ) ;
response . put ( "bookings" , bookings ) ;
@ -603,22 +520,19 @@ public class AdminAPIController {
return ResponseEntity . ok ( response ) ;
}
@Operation (
summary = " GCC Blocked Booking Details REST API" ,
description = "REST API to get the GCC Blocked BookingDetails"
)
/ / retrieving the GCC Blocked BookingDetails
@Operation ( summary = " GCC Blocked Booking Details REST API" , description = "REST API to get the GCC Blocked BookingDetails" )
/ / retrieving the GCC Blocked BookingDetails
@GetMapping ( "/blockedevents" )
public ResponseEntity < List < GccBlockingDate > > getBlockedEvents (
@RequestParam ( "fromDate" ) @DateTimeFormat ( pattern = "yyyy-MM-dd" ) LocalDate fromDate ,
@RequestParam ( "toDate" ) @DateTimeFormat ( pattern = "yyyy-MM-dd" ) LocalDate toDate ,
@RequestParam ( "hallIds" ) List < Long > hallIds
) {
/ / System . out . println ( "Blocked Events Request - fromDate: " + fromDate + ", toDate: " + toDate + ", hallIds: " + hallIds ) ;
@RequestParam ( "hallIds" ) List < Long > hallIds ) {
/ / System . out . println ( "Blocked Events Request - fromDate: " + fromDate + " ,
/ / toDate : " + toDate + " , hallIds : " + hallIds ) ;
List < GccBlockingDate > blockedBookings = bookingService . getBlockedEvents ( fromDate , toDate , hallIds ) ;
/ / List < BookingDetails > bookingDetails = bookingService . getByBookingId ( fromDate , toDate , hallIds , blockingId , bookingId ) ;
/ / List < BookingDetails > bookingDetails =
/ / bookingService . getByBookingId ( fromDate , toDate , hallIds , blockingId , bookingId ) ;
if ( blockedBookings . isEmpty ( ) ) {
/ / System . out . println ( "No blocked bookings found." ) ;
@ -632,15 +546,11 @@ public class AdminAPIController {
return ResponseEntity . ok ( blockedBookings ) ;
}
@Operation (
summary = "UNBLOCK the gcc Blocked Event REST API" ,
description = "REST API to unblocking the Gcc blocked Events for blocking"
)
@Operation ( summary = "UNBLOCK the gcc Blocked Event REST API" , description = "REST API to unblocking the Gcc blocked Events for blocking" )
@GetMapping ( "/cancelByid" )
public ResponseEntity < String > cancellationById ( @RequestParam int blockingId ,
@RequestParam ( "fromDate" ) @DateTimeFormat ( pattern = "yyyy-MM-dd" ) LocalDate fromDate ,
@RequestParam ( "endDate" ) @DateTimeFormat ( pattern = "yyyy-MM-dd" ) LocalDate endDate ) {
@RequestParam ( "fromDate" ) @DateTimeFormat ( pattern = "yyyy-MM-dd" ) LocalDate fromDate ,
@RequestParam ( "endDate" ) @DateTimeFormat ( pattern = "yyyy-MM-dd" ) LocalDate endDate ) {
/ / Fetch the blocking date entity
GccBlockingDate blockingDate = blockingDateRepository . findById ( blockingId ) . orElse ( null ) ;
@ -668,7 +578,8 @@ public class AdminAPIController {
List < BookingCalendar > bookingCalendars = bookingService . getBookedslots ( fromDate , endDate , hallIdList ) ;
if ( bookingCalendars . isEmpty ( ) ) {
return ResponseEntity . status ( HttpStatus . NOT_FOUND ) . body ( "No booking slots found for the given date range and hall IDs." ) ;
return ResponseEntity . status ( HttpStatus . NOT_FOUND )
. body ( "No booking slots found for the given date range and hall IDs." ) ;
}
/ / Iterate over bookingCalendars and update them as needed
@ -712,118 +623,120 @@ public class AdminAPIController {
applicationLogsRepository . save ( logs ) ;
return ResponseEntity . ok ( "Success" ) ;
}
/ / @GetMapping ( "/cancelByid" )
/ / public ResponseEntity < String > cancellationById (
/ / @RequestParam int blockingId ,
/ / @RequestParam int bookingId ,
/ / @RequestParam ( "fromDate" ) @DateTimeFormat ( pattern = "yyyy-MM-dd" ) LocalDate fromDate ,
/ / @RequestParam ( "endDate" ) @DateTimeFormat ( pattern = "yyyy-MM-dd" ) LocalDate endDate ,
/ / @RequestParam ( value = "hallId" , required = false ) List < Long > hallId ) {
/ /
/ / System . out . println ( "Received blockingId: " + blockingId ) ;
/ / System . out . println ( "Received bookingId: " + bookingId ) ;
/ / System . out . println ( "Received fromDate: " + fromDate ) ;
/ / System . out . println ( "Received hallId: " + hallId ) ;
/ /
/ / / / Retrieve blocking date
/ / GccBlockingDate blockingDate = blockingDateRepository . findById ( blockingId ) . orElse ( null ) ;
/ /
/ / if ( blockingDate = = null ) {
/ / return ResponseEntity . status ( HttpStatus . NOT_FOUND ) . body ( "Blocking ID not found." ) ;
/ / }
/ /
/ / if ( hallId ! = null & & bookingId > 0 ) {
/ / / / Specific bookingId and hallId selected
/ /
/ / / / Retrieve and update booking calendar
/ / List < BookingCalendar > bookingCalendar = bookingService . getBookedslots ( fromDate , endDate , hallId ) ;
/ / if ( bookingCalendar . isEmpty ( ) ) {
/ / return ResponseEntity . status ( HttpStatus . NOT_FOUND ) . body ( "No booking slots found for the given date and hall ID." ) ;
/ / }
/ /
/ / BookingCalendar bookingSlots = bookingCalendar . get ( 0 ) ;
/ / bookingSlots . setBookingId_1 ( null ) ;
/ / bookingSlots . setBookingId_2 ( null ) ;
/ / bookingSlots . setMorningSlot ( false ) ;
/ / bookingSlots . setEveningSlot ( false ) ;
/ /
/ / / / Process hallIds and bookingIds
/ / List < String > hallIdList = Arrays . asList ( blockingDate . getHallId ( ) . split ( "," ) ) ;
/ / hallIdList . remove ( hallId . toString ( ) ) ;
/ / String updatedHallIds = String . join ( "," , hallIdList ) ;
/ /
/ / List < String > bookingIdList = Arrays . asList ( blockingDate . getBookingIds ( ) . split ( "," ) ) ;
/ / bookingIdList . remove ( Integer . toString ( bookingId ) ) ;
/ / String updatedBookingIds = String . join ( "," , bookingIdList ) ;
/ /
/ / / / Update blockingDate with new values
/ / blockingDate . setHallId ( updatedHallIds ) ;
/ / blockingDate . setBookingIds ( updatedBookingIds ) ;
/ /
/ / / / Create an entry in GccBlockingHistory
/ / GccBlockingHistory blockingHistory = new GccBlockingHistory ( ) ;
/ / blockingHistory . setBlockedStatus ( GccBlockingHistory . BlockedStatus . UNBLOCKED ) ;
/ / blockingHistory . setBlockingReason ( blockingHistory . getBlockingReason ( ) ) ;
/ / blockingHistory . setCdate ( new Date ( ) ) ;
/ / blockingHistory . setStartDate ( blockingHistory . getStartDate ( ) ) ;
/ / blockingHistory . setEndDate ( blockingHistory . getEndDate ( ) ) ;
/ / blockingHistory . setUpdatedBy ( blockingHistory . getUpdatedBy ( ) ) ;
/ / blockingHistory . setBookingIds ( updatedBookingIds ) ;
/ / blockingHistory . setHallId ( updatedHallIds ) ;
/ / blockingHistoryRepository . save ( blockingHistory ) ;
/ /
/ / / / Update the blocking date status
/ / blockingDate . setBlockedStatus ( GccBlockingDate . BlockedStatus . UNBLOCKED ) ;
/ / blockingDateRepository . save ( blockingDate ) ;
/ /
/ / / / Save booking calendar updates
/ / bookingCalendarRepository . save ( bookingSlots ) ;
/ /
/ / } else {
/ / / / All halls and bookings selected
/ / / / Retrieve and clear all bookings for the date range
/ / List < BookingCalendar > bookingCalendars = bookingService . getBookedslots ( fromDate , endDate , hallId ) ;
/ / for ( BookingCalendar bookingCalendar : bookingCalendars ) {
/ / bookingCalendar . setBookingId_1 ( null ) ;
/ / bookingCalendar . setBookingId_2 ( null ) ;
/ / bookingCalendar . setMorningSlot ( false ) ;
/ / bookingCalendar . setEveningSlot ( false ) ;
/ / bookingCalendarRepository . save ( bookingCalendar ) ;
/ / }
/ /
/ / / / Update blocking date status to UNBLOCKED
/ / blockingDate . setBlockedStatus ( GccBlockingDate . BlockedStatus . UNBLOCKED ) ;
/ / blockingDateRepository . save ( blockingDate ) ;
/ /
/ / / / Create an entry in GccBlockingHistory
/ / GccBlockingHistory blockingHistory = new GccBlockingHistory ( ) ;
/ / blockingHistory . setBlockedStatus ( GccBlockingHistory . BlockedStatus . UNBLOCKED ) ;
/ / blockingHistory . setBlockingReason ( blockingHistory . getBlockingReason ( ) ) ;
/ / blockingHistory . setCdate ( new Date ( ) ) ;
/ / blockingHistory . setStartDate ( blockingHistory . getStartDate ( ) ) ;
/ / blockingHistory . setEndDate ( blockingHistory . getEndDate ( ) ) ;
/ / blockingHistory . setUpdatedBy ( blockingHistory . getUpdatedBy ( ) ) ;
/ / blockingHistoryRepository . save ( blockingHistory ) ;
/ / }
/ /
/ / return ResponseEntity . ok ( "Success" ) ;
/ / }
@Operation (
summary = "HAll IMAGES by HallId REST API" ,
description = "REST API to get the hall Images by Hall Id"
)
/ / retrieving Hall Images by Hallid
/ / @GetMapping ( "/cancelByid" )
/ / public ResponseEntity < String > cancellationById (
/ / @RequestParam int blockingId ,
/ / @RequestParam int bookingId ,
/ / @RequestParam ( "fromDate" ) @DateTimeFormat ( pattern = "yyyy-MM-dd" ) LocalDate
/ / fromDate ,
/ / @RequestParam ( "endDate" ) @DateTimeFormat ( pattern = "yyyy-MM-dd" ) LocalDate
/ / endDate ,
/ / @RequestParam ( value = "hallId" , required = false ) List < Long > hallId ) {
/ /
/ / System . out . println ( "Received blockingId: " + blockingId ) ;
/ / System . out . println ( "Received bookingId: " + bookingId ) ;
/ / System . out . println ( "Received fromDate: " + fromDate ) ;
/ / System . out . println ( "Received hallId: " + hallId ) ;
/ /
/ / / / Retrieve blocking date
/ / GccBlockingDate blockingDate =
/ / blockingDateRepository . findById ( blockingId ) . orElse ( null ) ;
/ /
/ / if ( blockingDate = = null ) {
/ / return ResponseEntity . status ( HttpStatus . NOT_FOUND ) . body ( " Blocking ID not
/ / found . " ) ;
/ / }
/ /
/ / if ( hallId ! = null & & bookingId > 0 ) {
/ / / / Specific bookingId and hallId selected
/ /
/ / / / Retrieve and update booking calendar
/ / List < BookingCalendar > bookingCalendar =
/ / bookingService . getBookedslots ( fromDate , endDate , hallId ) ;
/ / if ( bookingCalendar . isEmpty ( ) ) {
/ / return ResponseEntity . status ( HttpStatus . NOT_FOUND ) . body ( " No booking slots
/ / found for the given date and hall ID . " ) ;
/ / }
/ /
/ / BookingCalendar bookingSlots = bookingCalendar . get ( 0 ) ;
/ / bookingSlots . setBookingId_1 ( null ) ;
/ / bookingSlots . setBookingId_2 ( null ) ;
/ / bookingSlots . setMorningSlot ( false ) ;
/ / bookingSlots . setEveningSlot ( false ) ;
/ /
/ / / / Process hallIds and bookingIds
/ / List < String > hallIdList = Arrays . asList ( blockingDate . getHallId ( ) . split ( "," ) ) ;
/ / hallIdList . remove ( hallId . toString ( ) ) ;
/ / String updatedHallIds = String . join ( "," , hallIdList ) ;
/ /
/ / List < String > bookingIdList =
/ / Arrays . asList ( blockingDate . getBookingIds ( ) . split ( "," ) ) ;
/ / bookingIdList . remove ( Integer . toString ( bookingId ) ) ;
/ / String updatedBookingIds = String . join ( "," , bookingIdList ) ;
/ /
/ / / / Update blockingDate with new values
/ / blockingDate . setHallId ( updatedHallIds ) ;
/ / blockingDate . setBookingIds ( updatedBookingIds ) ;
/ /
/ / / / Create an entry in GccBlockingHistory
/ / GccBlockingHistory blockingHistory = new GccBlockingHistory ( ) ;
/ / blockingHistory . setBlockedStatus ( GccBlockingHistory . BlockedStatus . UNBLOCKED ) ;
/ / blockingHistory . setBlockingReason ( blockingHistory . getBlockingReason ( ) ) ;
/ / blockingHistory . setCdate ( new Date ( ) ) ;
/ / blockingHistory . setStartDate ( blockingHistory . getStartDate ( ) ) ;
/ / blockingHistory . setEndDate ( blockingHistory . getEndDate ( ) ) ;
/ / blockingHistory . setUpdatedBy ( blockingHistory . getUpdatedBy ( ) ) ;
/ / blockingHistory . setBookingIds ( updatedBookingIds ) ;
/ / blockingHistory . setHallId ( updatedHallIds ) ;
/ / blockingHistoryRepository . save ( blockingHistory ) ;
/ /
/ / / / Update the blocking date status
/ / blockingDate . setBlockedStatus ( GccBlockingDate . BlockedStatus . UNBLOCKED ) ;
/ / blockingDateRepository . save ( blockingDate ) ;
/ /
/ / / / Save booking calendar updates
/ / bookingCalendarRepository . save ( bookingSlots ) ;
/ /
/ / } else {
/ / / / All halls and bookings selected
/ / / / Retrieve and clear all bookings for the date range
/ / List < BookingCalendar > bookingCalendars =
/ / bookingService . getBookedslots ( fromDate , endDate , hallId ) ;
/ / for ( BookingCalendar bookingCalendar : bookingCalendars ) {
/ / bookingCalendar . setBookingId_1 ( null ) ;
/ / bookingCalendar . setBookingId_2 ( null ) ;
/ / bookingCalendar . setMorningSlot ( false ) ;
/ / bookingCalendar . setEveningSlot ( false ) ;
/ / bookingCalendarRepository . save ( bookingCalendar ) ;
/ / }
/ /
/ / / / Update blocking date status to UNBLOCKED
/ / blockingDate . setBlockedStatus ( GccBlockingDate . BlockedStatus . UNBLOCKED ) ;
/ / blockingDateRepository . save ( blockingDate ) ;
/ /
/ / / / Create an entry in GccBlockingHistory
/ / GccBlockingHistory blockingHistory = new GccBlockingHistory ( ) ;
/ / blockingHistory . setBlockedStatus ( GccBlockingHistory . BlockedStatus . UNBLOCKED ) ;
/ / blockingHistory . setBlockingReason ( blockingHistory . getBlockingReason ( ) ) ;
/ / blockingHistory . setCdate ( new Date ( ) ) ;
/ / blockingHistory . setStartDate ( blockingHistory . getStartDate ( ) ) ;
/ / blockingHistory . setEndDate ( blockingHistory . getEndDate ( ) ) ;
/ / blockingHistory . setUpdatedBy ( blockingHistory . getUpdatedBy ( ) ) ;
/ / blockingHistoryRepository . save ( blockingHistory ) ;
/ / }
/ /
/ / return ResponseEntity . ok ( "Success" ) ;
/ / }
@Operation ( summary = "HAll IMAGES by HallId REST API" , description = "REST API to get the hall Images by Hall Id" )
/ / retrieving Hall Images by Hallid
@GetMapping ( "/getImageById" )
public List < HallImages > getImageDetails ( @RequestParam int hallId ) {
return hallService . getHallImages ( hallId ) ;
}
@Operation (
summary = "GCC Blocking REST API" ,
description = "REST API to Block the Halls by Admin"
)
/ / GccBlocking Api
@Operation ( summary = "GCC Blocking REST API" , description = "REST API to Block the Halls by Admin" )
/ / GccBlocking Api
@PostMapping ( "/cancelAll" )
public ResponseEntity < String > cancelAllBookings (
@RequestParam ( "fromDate" ) String fromDate ,
@ -844,7 +757,8 @@ public class AdminAPIController {
. collect ( Collectors . toList ( ) ) ;
/ / Call the service with descriptions and documents
bookingService . cancelAllBookings ( fromDate , toDate , hallIdsList , reasonforblocking , selectedBookings , updatedBy , descriptions , documents ) ;
bookingService . cancelAllBookings ( fromDate , toDate , hallIdsList , reasonforblocking , selectedBookings , updatedBy ,
descriptions , documents ) ;
String adminname = ( String ) session . getAttribute ( "usertype" ) ;
Integer loginid = ( Integer ) session . getAttribute ( "id" ) ;
ApplicationLogs logs = new ApplicationLogs ( ) ;
@ -864,35 +778,39 @@ public class AdminAPIController {
return ResponseEntity . ok ( "Success" ) ;
}
/ / @PostMapping ( "/blockhall" )
/ / public ResponseEntity < String > blockHall (
/ / @RequestParam ( "blockingId" ) Integer blockingId ,
/ / @RequestParam ( "hallID" ) String hallID , / / Ensure this matches the parameter name used in AJAX
/ / @RequestParam ( value = "selectedBookings" , required = false ) List < String > selectedBookings ,
/ / HttpSession session ) {
/ /
/ / String updatedBy = ( String ) session . getAttribute ( "employeeId" ) ;
/ / Optional < GccBlockingDate > gccblocking = blockingDateRepository . findById ( blockingId ) ;
/ / GccBlockingDate gccblockingdata = gccblocking . get ( ) ;
/ /
/ / / / Convert startDate and endDate to String
/ / SimpleDateFormat sdf = new SimpleDateFormat ( "yyyy-MM-dd" ) ;
/ / String startDateString = sdf . format ( gccblockingdata . getStartDate ( ) ) ;
/ / String endDateString = sdf . format ( gccblockingdata . getEndDate ( ) ) ;
/ /
/ / / / Split and convert hall IDs
/ / List < Long > hallIdsList = Arrays . stream ( hallID . split ( "," ) )
/ / . map ( Long : : parseLong )
/ / . collect ( Collectors . toList ( ) ) ;
/ /
/ / System . out . println ( "selected BookingIds: " + selectedBookings ) ;
/ /
/ / / / Pass the formatted date strings
/ / bookingService . cancelAllBookings ( startDateString , endDateString , hallIdsList , gccblockingdata . getDepartment ( ) , gccblockingdata . getBlockingReason ( ) , selectedBookings , updatedBy ) ;
/ /
/ / return ResponseEntity . ok ( "Success" ) ;
/ / }
/ / @PostMapping ( "/blockhall" )
/ / public ResponseEntity < String > blockHall (
/ / @RequestParam ( "blockingId" ) Integer blockingId ,
/ / @RequestParam ( "hallID" ) String hallID , / / Ensure this matches the parameter
/ / name used in AJAX
/ / @RequestParam ( value = "selectedBookings" , required = false ) List < String >
/ / selectedBookings ,
/ / HttpSession session ) {
/ /
/ / String updatedBy = ( String ) session . getAttribute ( "employeeId" ) ;
/ / Optional < GccBlockingDate > gccblocking =
/ / blockingDateRepository . findById ( blockingId ) ;
/ / GccBlockingDate gccblockingdata = gccblocking . get ( ) ;
/ /
/ / / / Convert startDate and endDate to String
/ / SimpleDateFormat sdf = new SimpleDateFormat ( "yyyy-MM-dd" ) ;
/ / String startDateString = sdf . format ( gccblockingdata . getStartDate ( ) ) ;
/ / String endDateString = sdf . format ( gccblockingdata . getEndDate ( ) ) ;
/ /
/ / / / Split and convert hall IDs
/ / List < Long > hallIdsList = Arrays . stream ( hallID . split ( "," ) )
/ / . map ( Long : : parseLong )
/ / . collect ( Collectors . toList ( ) ) ;
/ /
/ / System . out . println ( "selected BookingIds: " + selectedBookings ) ;
/ /
/ / / / Pass the formatted date strings
/ / bookingService . cancelAllBookings ( startDateString , endDateString , hallIdsList ,
/ / gccblockingdata . getDepartment ( ) , gccblockingdata . getBlockingReason ( ) ,
/ / selectedBookings , updatedBy ) ;
/ /
/ / return ResponseEntity . ok ( "Success" ) ;
/ / }
@GetMapping ( "/bookingdetailsByuserId" )
public List < BookingDetails > getuserDetails ( @RequestParam Integer userId ) {
@ -901,55 +819,64 @@ public class AdminAPIController {
@GetMapping ( "/settlement-approved" )
public ResponseEntity < List < Settlement > > getApprovedSettlements ( HttpSession session ) {
List < Settlement > approvedSettlements = settlementRepository . findByBookingDetailsRefundStatus ( RefundStatus . APPROVED ) ;
List < Settlement > approvedSettlements = settlementRepository
. findByBookingDetailsRefundStatus ( RefundStatus . APPROVED ) ;
return ResponseEntity . ok ( approvedSettlements ) ;
}
/ / @PostMapping ( "/complete-refund" )
/ / public ResponseEntity < String > completeRefund ( @RequestBody List < String > bookingIds , HttpSession session , HttpServletResponse response ) throws IOException {
/ / String token = ( String ) session . getAttribute ( "jwtToken" ) ;
/ / / / System . out . println ( "tokensssssssss" + token ) ;
/ /
/ / / / Validate JWT token
/ / if ( token ! = null & & jwtUtil . validateToken ( token ) ) {
/ / / / System . out . println ( "tokennnnnnnnnnnnnnns" + token ) ;
/ / try {
/ / / / System . out . println ( "Received booking IDs for refund: " + bookingIds ) ;
/ /
/ / List < String > bookids = bookingService . processRefundRequests ( bookingIds ) ;
/ /
/ / if ( ! bookids . isEmpty ( ) ) {
/ / / / Prepare and return error response if there are errors
/ / StringBuilder errorResponse = new StringBuilder ( "Errors processing refund for IDs: " ) ;
/ / for ( String bookId : bookids ) {
/ / errorResponse . append ( bookId ) . append ( ", " ) ;
/ / }
/ / return ResponseEntity . status ( HttpStatus . INTERNAL_SERVER_ERROR ) . body ( errorResponse . toString ( ) ) ;
/ / }
/ /
/ / return ResponseEntity . ok ( "Refund completed successfully" ) ;
/ / } catch ( Exception e ) {
/ / e . printStackTrace ( ) ;
/ / return ResponseEntity . status ( HttpStatus . INTERNAL_SERVER_ERROR ) . body ( "Error processing refund: " + e . getMessage ( ) ) ;
/ / }
/ / } else {
/ / / / Token is invalid or not present , redirect to login
/ / session . invalidate ( ) ; / / Invalidate the session to clear all session attributes
/ / response . sendRedirect ( "/login" ) ; / / Redirect to the login page
/ / return ResponseEntity . status ( HttpStatus . UNAUTHORIZED ) . build ( ) ; / / Return HTTP 401 Unauthorized
/ / }
/ / }
/ / @GetMapping ( "/Gccblocking" )
/ / public ResponseEntity < List < Object > > getGccBlockingEvents ( @RequestParam ( "hallId" ) int hallId ) {
/ / System . out . println ( "Received hallId: " + hallId ) ;
/ /
/ / List < Object > results = bookingService . getGccBlockingEvents ( hallId ) ;
/ /
/ / return ResponseEntity . ok ( results ) ;
/ / }
/ / @PostMapping ( "/complete-refund" )
/ / public ResponseEntity < String > completeRefund ( @RequestBody List < String >
/ / bookingIds , HttpSession session , HttpServletResponse response ) throws
/ / IOException {
/ / String token = ( String ) session . getAttribute ( "jwtToken" ) ;
/ / / / System . out . println ( "tokensssssssss" + token ) ;
/ /
/ / / / Validate JWT token
/ / if ( token ! = null & & jwtUtil . validateToken ( token ) ) {
/ / / / System . out . println ( "tokennnnnnnnnnnnnnns" + token ) ;
/ / try {
/ / / / System . out . println ( "Received booking IDs for refund: " + bookingIds ) ;
/ /
/ / List < String > bookids = bookingService . processRefundRequests ( bookingIds ) ;
/ /
/ / if ( ! bookids . isEmpty ( ) ) {
/ / / / Prepare and return error response if there are errors
/ / StringBuilder errorResponse = new StringBuilder ( " Errors processing refund for
/ / IDs : " ) ;
/ / for ( String bookId : bookids ) {
/ / errorResponse . append ( bookId ) . append ( ", " ) ;
/ / }
/ / return
/ / ResponseEntity . status ( HttpStatus . INTERNAL_SERVER_ERROR ) . body ( errorResponse . toString ( ) ) ;
/ / }
/ /
/ / return ResponseEntity . ok ( "Refund completed successfully" ) ;
/ / } catch ( Exception e ) {
/ / e . printStackTrace ( ) ;
/ / return ResponseEntity . status ( HttpStatus . INTERNAL_SERVER_ERROR ) . body ( " Error
/ / processing refund : " + e . getMessage ( ) ) ;
/ / }
/ / } else {
/ / / / Token is invalid or not present , redirect to login
/ / session . invalidate ( ) ; / / Invalidate the session to clear all session
/ / attributes
/ / response . sendRedirect ( "/login" ) ; / / Redirect to the login page
/ / return ResponseEntity . status ( HttpStatus . UNAUTHORIZED ) . build ( ) ; / / Return HTTP
/ / 401 Unauthorized
/ / }
/ / }
/ / @GetMapping ( "/Gccblocking" )
/ / public ResponseEntity < List < Object > >
/ / getGccBlockingEvents ( @RequestParam ( "hallId" ) int hallId ) {
/ / System . out . println ( "Received hallId: " + hallId ) ;
/ /
/ / List < Object > results = bookingService . getGccBlockingEvents ( hallId ) ;
/ /
/ / return ResponseEntity . ok ( results ) ;
/ / }
@GetMapping ( "/Gccblocking" )
public ResponseEntity < List < Object > > getGccBlockingEvents ( @RequestParam ( "hallId" ) String hallId ) {
/ / System . out . println ( "Received hallId: " + hallId ) ;
/ / System . out . println ( "Received hallId: " + hallId ) ;
List < Object > results = bookingService . getGccBlockingEvents ( hallId ) ;
@ -962,7 +889,7 @@ public class AdminAPIController {
@RequestParam int blockingId ) {
/ / System . out . println ( "Received hallIds: " + hallIds ) ;
/ / System . out . println ( "Received blockingId: " + blockingId ) ;
/ / System . out . println ( "Received blockingId: " + blockingId ) ;
List < Integer > hallIdList ;
try {
@ -987,13 +914,15 @@ public class AdminAPIController {
for ( int hallId : hallIdList ) {
int bookingCount = bookingDetailsRepository . countByHallIdAndBookingDateBetween ( hallId , startDate , endDate ) ;
/ / System . out . println ( "bookingCount===" + bookingCount ) ;
/ / System . out . println ( "bookingCount===" + bookingCount ) ;
Optional < HallDetails > hallDetailsOpt = hallDetailsRepository . findById ( hallId ) ;
if ( hallDetailsOpt . isPresent ( ) ) {
HallDetails hallDetails = hallDetailsOpt . get ( ) ;
List < Integer > bookingIds = bookingDetailsRepository . findBookingIdsByHallIdAndBookingDateBetween ( hallId , startDate , endDate ) ;
/ / System . out . println ( "Booking IDs for hallId " + hallId + ": " + bookingIds ) ; / / Add this line
List < Integer > bookingIds = bookingDetailsRepository . findBookingIdsByHallIdAndBookingDateBetween ( hallId ,
startDate , endDate ) ;
/ / System . out . println ( "Booking IDs for hallId " + hallId + ": " + bookingIds ) ;
/ / / / Add this line
Map < String , Object > hallInfo = new HashMap < > ( ) ;
hallInfo . put ( "hallName" , hallDetails . getHallName ( ) ) ;
@ -1012,10 +941,10 @@ public class AdminAPIController {
@GetMapping ( "/getbookingdetails" )
public ResponseEntity < List < BookingDetails > > getBookingDetails ( @RequestParam ( "bookingId" ) Long bookingId ) {
/ / System . out . println ( "Received bookingId: " + bookingId ) ;
/ / System . out . println ( "Received bookingId: " + bookingId ) ;
try {
List < BookingDetails > details = bookingService . findBookingDetailsByBookingId ( bookingId ) ;
/ / System . out . println ( "bookingdetails===" + details ) ;
/ / System . out . println ( "bookingdetails===" + details ) ;
return ResponseEntity . ok ( details ) ;
} catch ( Exception e ) {
e . printStackTrace ( ) ;
@ -1023,7 +952,6 @@ public class AdminAPIController {
}
}
@GetMapping ( "/blockedHallsByHallIdAndReason" )
@ResponseBody
public Map < String , Object > viewBlockedHallsByHallIdAndReason (
@ -1032,11 +960,13 @@ public class AdminAPIController {
@RequestParam @DateTimeFormat ( iso = DateTimeFormat . ISO . DATE_TIME ) Date startDate ,
@RequestParam @DateTimeFormat ( iso = DateTimeFormat . ISO . DATE_TIME ) Date endDate ) {
List < GccBlockingDate > blockedHalls = blockingDateRepository . findByBlockingReasonAndDateRange ( blockingReason , startDate , endDate ) ;
List < GccBlockingDate > blockedHalls = blockingDateRepository . findByBlockingReasonAndDateRange ( blockingReason ,
startDate , endDate ) ;
/ / Ensure distinct by hallId and other keys
List < GccBlockingDate > uniqueGccBlockingDates = blockedHalls . stream ( )
. filter ( distinctByKey ( g - > Arrays . asList ( g . getHallId ( ) , g . getBlockingReason ( ) , g . getStartDate ( ) , g . getEndDate ( ) ) ) )
. filter ( distinctByKey (
g - > Arrays . asList ( g . getHallId ( ) , g . getBlockingReason ( ) , g . getStartDate ( ) , g . getEndDate ( ) ) ) )
. collect ( Collectors . toList ( ) ) ;
/ / Prepare response data
@ -1083,7 +1013,6 @@ public class AdminAPIController {
return response ;
}
/ / Utility method to ensure distinct by a key
private static < T > Predicate < T > distinctByKey ( Function < ? super T , ? > keyExtractor ) {
Set < Object > seen = new HashSet < > ( ) ;
@ -1092,7 +1021,8 @@ public class AdminAPIController {
/ / Method to calculate number of bookings
private int calculateBookings ( HallDetails hall , GccBlockingDate blockedHall ) {
return blockingDateRepository . countBlockedBookings ( hall . getHallId ( ) , blockedHall . getStartDate ( ) , blockedHall . getEndDate ( ) ) ;
return blockingDateRepository . countBlockedBookings ( hall . getHallId ( ) , blockedHall . getStartDate ( ) ,
blockedHall . getEndDate ( ) ) ;
}
private double calculateRefund ( HallDetails hall , GccBlockingDate blockedHall ) {
@ -1100,7 +1030,7 @@ public class AdminAPIController {
return 0 . 0 ;
}
/ / admin dashboard
/ / admin dashboard
@GetMapping ( "/bookingstatistics" )
public ResponseEntity < Map < String , Map < String , Integer > > > getBookingStatistics (
@RequestParam ( required = false ) @DateTimeFormat ( iso = DateTimeFormat . ISO . DATE ) LocalDate fromDate ,
@ -1111,7 +1041,8 @@ public class AdminAPIController {
@RequestParam ( required = false , defaultValue = "ALL" ) String userType ) {
try {
Map < String , Map < String , Integer > > statistics = bookingService . getBookingStatistics ( fromDate , toDate , zone , division , hallid , userType ) ;
Map < String , Map < String , Integer > > statistics = bookingService . getBookingStatistics ( fromDate , toDate , zone ,
division , hallid , userType ) ;
return ResponseEntity . ok ( statistics ) ;
} catch ( Exception e ) {
/ / Log the exception and return an appropriate error response
@ -1135,18 +1066,18 @@ public class AdminAPIController {
@PostMapping ( "/savenewHallImages" )
public ResponseEntity < ? > updateHallImages ( @RequestParam ( "hallId" ) Integer hallId ,
@RequestParam ( "newHallImages" ) MultipartFile [ ] newHallImages ) {
@RequestParam ( "newHallImages" ) MultipartFile [ ] newHallImages ) {
/ / Call the service method to update the hall images
hallService . updatenewHallImages ( hallId , newHallImages ) ;
return ResponseEntity . ok ( ) . build ( ) ;
}
/ / @DeleteMapping ( "/deleteHallImage/{hallImageId}" )
/ / public ResponseEntity < ? > deleteHallImage ( @PathVariable Long hallImageId ) {
/ / / / Call the service method to delete the hall image
/ / hallService . deleteHallImage ( hallImageId ) ;
/ / return ResponseEntity . ok ( ) . build ( ) ;
/ / }
/ / @DeleteMapping ( "/deleteHallImage/{hallImageId}" )
/ / public ResponseEntity < ? > deleteHallImage ( @PathVariable Long hallImageId ) {
/ / / / Call the service method to delete the hall image
/ / hallService . deleteHallImage ( hallImageId ) ;
/ / return ResponseEntity . ok ( ) . build ( ) ;
/ / }
@PutMapping ( "/updateHallImage/{hallImageId}" )
public ResponseEntity < Map < String , String > > updateHallImage (
@ -1161,7 +1092,8 @@ public class AdminAPIController {
} catch ( IllegalArgumentException e ) {
return ResponseEntity . status ( HttpStatus . NOT_FOUND ) . body ( Collections . singletonMap ( "error" , e . getMessage ( ) ) ) ;
} catch ( IOException e ) {
return ResponseEntity . status ( HttpStatus . INTERNAL_SERVER_ERROR ) . body ( Collections . singletonMap ( "error" , "Failed to update image" ) ) ;
return ResponseEntity . status ( HttpStatus . INTERNAL_SERVER_ERROR )
. body ( Collections . singletonMap ( "error" , "Failed to update image" ) ) ;
}
}
@ -1223,7 +1155,7 @@ public class AdminAPIController {
}
}
/ / gccapps
/ / gccapps
@GetMapping ( "/viewsettlement-pending" )
public ResponseEntity < Map < String , Object > > viewSettlementPendingMaster ( HttpSession session ) {
@ -1239,7 +1171,6 @@ public class AdminAPIController {
return ResponseEntity . ok ( response ) ;
}
@GetMapping ( "/viewsettlement-complete" )
public ResponseEntity < Map < String , Object > > viewSettlementcompleteMaster ( HttpSession session ) {
@ -1342,10 +1273,16 @@ public class AdminAPIController {
List < Users > userList = handleUserRequest ( request , fromDate , toDate , userstatus , usertype ) ;
List < Object [ ] > bookingList = handleBookingRequest ( request , fromDate , toDate , bookingStatus , bookingId ) ;
List < BookingDetails > bookingSettlementList = handleBookingSettlementRequest ( request , fromDate , toDate , refundStatus ) ;
List < Object [ ] > paymentList = request . equals ( "3" ) ? bookingService . getAllPaymentsDetails ( fromDate , toDate ) : new ArrayList < > ( ) ;
List < Object [ ] > userbookingList = request . equals ( "4" ) ? bookingService . getBookingUserDetailsReport ( fromDate , toDate ) : new ArrayList < > ( ) ;
List < Object [ ] > hallbookingList = request . equals ( "5" ) ? bookingService . getBookingHallDetailsReport ( fromDate , toDate ) : new ArrayList < > ( ) ;
List < BookingDetails > bookingSettlementList = handleBookingSettlementRequest ( request , fromDate , toDate ,
refundStatus ) ;
List < Object [ ] > paymentList = request . equals ( "3" ) ? bookingService . getAllPaymentsDetails ( fromDate , toDate )
: new ArrayList < > ( ) ;
List < Object [ ] > userbookingList = request . equals ( "4" )
? bookingService . getBookingUserDetailsReport ( fromDate , toDate )
: new ArrayList < > ( ) ;
List < Object [ ] > hallbookingList = request . equals ( "5" )
? bookingService . getBookingHallDetailsReport ( fromDate , toDate )
: new ArrayList < > ( ) ;
response . put ( "users" , userList ) ;
response . put ( "bookings" , bookingList ) ;
@ -1365,7 +1302,8 @@ public class AdminAPIController {
return new ResponseEntity < > ( response , HttpStatus . OK ) ;
}
private List < Users > handleUserRequest ( String request , String fromDate , String toDate , String userstatus , String usertype ) {
private List < Users > handleUserRequest ( String request , String fromDate , String toDate , String userstatus ,
String usertype ) {
if ( ! request . equals ( "1" ) ) {
return new ArrayList < > ( ) ;
}
@ -1381,7 +1319,8 @@ public class AdminAPIController {
return userService . getAllUsers ( fromDate , toDate ) ;
}
private List < Object [ ] > handleBookingRequest ( String request , String fromDate , String toDate , String bookingStatus , Long bookingId ) {
private List < Object [ ] > handleBookingRequest ( String request , String fromDate , String toDate , String bookingStatus ,
Long bookingId ) {
if ( ! request . equals ( "2" ) ) {
return new ArrayList < > ( ) ;
}
@ -1394,7 +1333,8 @@ public class AdminAPIController {
}
}
private List < BookingDetails > handleBookingSettlementRequest ( String request , String fromDate , String toDate , String refundStatus ) {
private List < BookingDetails > handleBookingSettlementRequest ( String request , String fromDate , String toDate ,
String refundStatus ) {
if ( ! request . equals ( "6" ) ) {
return new ArrayList < > ( ) ;
}
@ -1410,7 +1350,6 @@ public class AdminAPIController {
return ResponseEntity . ok ( halldetails ) ;
}
@GetMapping ( "/listgccblocking" )
public ResponseEntity < Map < String , Object > > getGccBlocking ( ) {
@ -1495,7 +1434,7 @@ public class AdminAPIController {
@PostMapping ( "/uploadnoc" )
public ResponseEntity < String > uploadnoc ( @RequestParam ( "nocFile" ) MultipartFile file ,
@RequestParam ( "bookingid" ) int bookingId ) {
@RequestParam ( "bookingid" ) int bookingId ) {
try {
System . out . println ( "Received file: " + file . getOriginalFilename ( ) ) ;
System . out . println ( "Booking ID: " + bookingId ) ;
@ -1504,7 +1443,8 @@ public class AdminAPIController {
return ResponseEntity . ok ( "File uploaded and saved successfully" ) ;
} catch ( Exception e ) {
System . err . println ( "Error during file upload: " + e . getMessage ( ) ) ;
return ResponseEntity . status ( HttpStatus . INTERNAL_SERVER_ERROR ) . body ( "File upload failed: " + e . getMessage ( ) ) ;
return ResponseEntity . status ( HttpStatus . INTERNAL_SERVER_ERROR )
. body ( "File upload failed: " + e . getMessage ( ) ) ;
}
}
}