Browse Source

Implemented staff update module

main
AJITHKUMAR12 7 months ago
parent
commit
a0dc38c70a
  1. 280
      gcc_officer_portal/src/main/java/in/gov/chennaicorporation/gccoffice/nulm/controller/NulmAPIController.java
  2. 500
      gcc_officer_portal/src/main/java/in/gov/chennaicorporation/gccoffice/nulm/controller/NulmController.java
  3. 1098
      gcc_officer_portal/src/main/java/in/gov/chennaicorporation/gccoffice/nulm/service/NulmService.java
  4. 1509
      gcc_officer_portal/src/main/resources/templates/modules/nulm/staffupdate.html
  5. 63
      gcc_officer_portal/src/main/resources/templates/modules/nulm/staffupdatenoacess.html

280
gcc_officer_portal/src/main/java/in/gov/chennaicorporation/gccoffice/nulm/controller/NulmAPIController.java

@ -30,6 +30,7 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
@ -513,17 +514,16 @@ public class NulmAPIController {
@RequestParam(value = "year", required = false) String year, @RequestParam(value = "year", required = false) String year,
@RequestParam(value = "inchargeName", required = false) String inchargeName, @RequestParam(value = "inchargeName", required = false) String inchargeName,
@RequestParam(value = "enrollmentIds", required = false) List<Integer> enrollmentIds) { @RequestParam(value = "enrollmentIds", required = false) List<Integer> enrollmentIds) {
System.out.println("inchargeName="+inchargeName);
System.out.println("inchargeName=" + inchargeName);
List<Map<String, Object>> staffList = nulmService.getAttendanceWithInitiatedSalary(inchargeId, month, year, List<Map<String, Object>> staffList = nulmService.getAttendanceWithInitiatedSalary(inchargeId, month, year,
inchargeName, enrollmentIds); inchargeName, enrollmentIds);
return ResponseEntity.ok(staffList); return ResponseEntity.ok(staffList);
} }
///// /////
@GetMapping("/staffInititeadList-park") @GetMapping("/staffInititeadList-park")
public ResponseEntity<List<Map<String, Object>>> getAttendanceWithInitiatedSalaryByGroupId_Park( public ResponseEntity<List<Map<String, Object>>> getAttendanceWithInitiatedSalaryByGroupId_Park(
@RequestParam(value = "inchargeId", required = false) Integer inchargeId, @RequestParam(value = "inchargeId", required = false) Integer inchargeId,
@ -536,9 +536,8 @@ public class NulmAPIController {
inchargeName, enrollmentIds); inchargeName, enrollmentIds);
return ResponseEntity.ok(staffList); return ResponseEntity.ok(staffList);
} }
/////
/////
/* /*
* @PostMapping("/salaryDetailUpdate") * @PostMapping("/salaryDetailUpdate")
* public ResponseEntity<String> addSalaryDetails(@RequestBody List<Map<String, * public ResponseEntity<String> addSalaryDetails(@RequestBody List<Map<String,
@ -645,18 +644,16 @@ public class NulmAPIController {
.body("Invalid request data: " + e.getMessage()); .body("Invalid request data: " + e.getMessage());
} }
} }
/// ///
@PostMapping("/salaryDetailUpdate_Park") @PostMapping("/salaryDetailUpdate_Park")
public ResponseEntity<String> addSalaryDetails_Park(@RequestBody List<Map<String, Object>> requestList) { public ResponseEntity<String> addSalaryDetails_Park(@RequestBody List<Map<String, Object>> requestList) {
System.out.println("Received POST request with data: " + requestList); System.out.println("Received POST request with data: " + requestList);
try { try {
for (Map<String, Object> request : requestList) { for (Map<String, Object> request : requestList) {
System.out.println("enrollment_id = " + request.get("enrollment_id").toString());
System.out.println("enrollment_id = " + request.get("enrollment_id").toString());
int totalDaysPresent = Integer.parseInt(request.get("total_days_present").toString()); int totalDaysPresent = Integer.parseInt(request.get("total_days_present").toString());
int totalDaysOd = Integer.parseInt(request.get("total_days_od").toString()); int totalDaysOd = Integer.parseInt(request.get("total_days_od").toString());
int totalDaysSalary = Integer.parseInt(request.get("total_days_salary").toString()); int totalDaysSalary = Integer.parseInt(request.get("total_days_salary").toString());
@ -691,7 +688,8 @@ public class NulmAPIController {
.body("Failed to add salary details for enrollment ID: " + enrollmentId); .body("Failed to add salary details for enrollment ID: " + enrollmentId);
} }
} else { } else {
int rowsAffected = nulmService.updateSalaryDetails_park(totalDaysPresent, totalDaysOd, totalDaysSalary,
int rowsAffected = nulmService.updateSalaryDetails_park(totalDaysPresent, totalDaysOd,
totalDaysSalary,
totalDaysAbsent, month, year, salaryAmount, salaryStatus, enrollmentId, groupId, wageId, totalDaysAbsent, month, year, salaryAmount, salaryStatus, enrollmentId, groupId, wageId,
inchargeID); inchargeID);
if (rowsAffected <= 0) { if (rowsAffected <= 0) {
@ -708,12 +706,8 @@ public class NulmAPIController {
.body("Invalid request data: " + e.getMessage()); .body("Invalid request data: " + e.getMessage());
} }
} }
/// ///
// Helper method to check if the month is future or current // Helper method to check if the month is future or current
private boolean isFutureOrCurrentMonth(String month, int year) { private boolean isFutureOrCurrentMonth(String month, int year) {
@ -787,28 +781,32 @@ public class NulmAPIController {
nulmService.updateSalaryStatusToApproved(enrollmentIds, month, year); nulmService.updateSalaryStatusToApproved(enrollmentIds, month, year);
return ResponseEntity.ok("Salary status updated to 'Approved' for the provided enrollments."); return ResponseEntity.ok("Salary status updated to 'Approved' for the provided enrollments.");
} }
//// ////
@GetMapping("/salary-approve-park-testdata") @GetMapping("/salary-approve-park-testdata")
public List<Map<String, Object>> getsalaryInitiatedCounts(@RequestParam(required = false) String month, public List<Map<String, Object>> getsalaryInitiatedCounts(@RequestParam(required = false) String month,
@RequestParam(required = false) Integer year,
@RequestParam(required = false) String salaryStatus,
@RequestParam (required = false) String LoginUserId){
List<Map<String, Object>> salaryInitiatedCounts;
// Fetch data if both month and year are provided, otherwise return an empty list
if (month != null && year != null) {
salaryInitiatedCounts = nulmService.getFilteredSalaryDetails_park(month, year, salaryStatus,LoginUserId); // Pass department to the service method
} else {
salaryInitiatedCounts = Collections.emptyList(); // Empty list if no month and year are provided
}
return salaryInitiatedCounts;
@RequestParam(required = false) Integer year,
@RequestParam(required = false) String salaryStatus,
@RequestParam(required = false) String LoginUserId) {
List<Map<String, Object>> salaryInitiatedCounts;
// Fetch data if both month and year are provided, otherwise return an empty
// list
if (month != null && year != null) {
salaryInitiatedCounts = nulmService.getFilteredSalaryDetails_park(month, year, salaryStatus, LoginUserId); // Pass
// department
// to
// the
// service
// method
} else {
salaryInitiatedCounts = Collections.emptyList(); // Empty list if no month and year are provided
}
return salaryInitiatedCounts;
} }
@PostMapping("/update-salary-status-park") @PostMapping("/update-salary-status-park")
public ResponseEntity<String> updateSalaryStatus_Park( public ResponseEntity<String> updateSalaryStatus_Park(
@RequestParam List<Integer> enrollmentIds, @RequestParam List<Integer> enrollmentIds,
@ -820,7 +818,7 @@ public class NulmAPIController {
nulmService.updateSalaryStatusToApproved_Park(enrollmentIds, month, year); nulmService.updateSalaryStatusToApproved_Park(enrollmentIds, month, year);
return ResponseEntity.ok("Salary status updated to 'Approved' for the provided enrollments."); return ResponseEntity.ok("Salary status updated to 'Approved' for the provided enrollments.");
} }
//// ////
/*************** API For Mobile Application *********************************/ /*************** API For Mobile Application *********************************/
@ -864,12 +862,13 @@ public class NulmAPIController {
try { try {
//List<Map<String, Object>> attendanceWithSalary = new ArrayList<>();
//Integer check = nulmService.checkInchargeID(inchargeId);
// if (check == 1) {
// Call the service method to fetch the data
List<Map<String, Object>> attendanceWithSalary = nulmService.getAttendanceWithSalaryByInchargeId(month, year, inchargeId);
//}
// List<Map<String, Object>> attendanceWithSalary = new ArrayList<>();
// Integer check = nulmService.checkInchargeID(inchargeId);
// if (check == 1) {
// Call the service method to fetch the data
List<Map<String, Object>> attendanceWithSalary = nulmService.getAttendanceWithSalaryByInchargeId(month,
year, inchargeId);
// }
// If no data is found, return a NOT FOUND response total_days_salary, // If no data is found, return a NOT FOUND response total_days_salary,
// total_salary and total_days_absent // total_salary and total_days_absent
if (attendanceWithSalary.isEmpty()) { if (attendanceWithSalary.isEmpty()) {
@ -900,10 +899,9 @@ public class NulmAPIController {
List.of(Map.of("error", "An error occurred while fetching attendance data: " + ex.getMessage()))); List.of(Map.of("error", "An error occurred while fetching attendance data: " + ex.getMessage())));
} }
} }
//// ////
@GetMapping("/attendanceWithSalary_New") @GetMapping("/attendanceWithSalary_New")
public ResponseEntity<List<Map<String, Object>>> getAttendanceWithSalaryByInchargeId_New( public ResponseEntity<List<Map<String, Object>>> getAttendanceWithSalaryByInchargeId_New(
@RequestParam(value = "month", required = false) String month, @RequestParam(value = "month", required = false) String month,
@ -915,10 +913,11 @@ public class NulmAPIController {
List<Map<String, Object>> attendanceWithSalary = new ArrayList<>(); List<Map<String, Object>> attendanceWithSalary = new ArrayList<>();
String ids = nulmService.checkInchargeID(inchargeId); String ids = nulmService.checkInchargeID(inchargeId);
System.out.println("IDS = "+ids);
if (ids != null || !ids.trim().isEmpty()) {
// Call the service method to fetch the data
attendanceWithSalary = nulmService.getAttendanceWithSalaryByInchargeId_New(month, year, inchargeId, type, ids);
System.out.println("IDS = " + ids);
if (ids != null || !ids.trim().isEmpty()) {
// Call the service method to fetch the data
attendanceWithSalary = nulmService.getAttendanceWithSalaryByInchargeId_New(month, year, inchargeId,
type, ids);
} }
// If no data is found, return a NOT FOUND response total_days_salary, // If no data is found, return a NOT FOUND response total_days_salary,
// total_salary and total_days_absent // total_salary and total_days_absent
@ -950,8 +949,7 @@ public class NulmAPIController {
List.of(Map.of("error", "An error occurred while fetching attendance data: " + ex.getMessage()))); List.of(Map.of("error", "An error occurred while fetching attendance data: " + ex.getMessage())));
} }
} }
//// ////
@PostMapping("/salaryDetailInitiate") @PostMapping("/salaryDetailInitiate")
@ -1000,62 +998,60 @@ public class NulmAPIController {
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body("Invalid request data: " + e.getMessage()); return ResponseEntity.status(HttpStatus.BAD_REQUEST).body("Invalid request data: " + e.getMessage());
} }
} }
//// ////
// @PostMapping("/salaryDetailInitiate_park")
// public ResponseEntity<String> addInitiatedSalaryDetails_park(
// @RequestParam("total_days_present") List<Integer> totalDaysPresentList,
// @RequestParam("total_days_od") List<Integer> totalDaysOdList,
// @RequestParam("total_days_salary") List<Integer> totalDaysSalaryList,
// @RequestParam("total_days_absent") List<Integer> totalDaysAbsentList,
// @RequestParam("month") List<String> monthList,
// @RequestParam("year") List<Integer> yearList,
// @RequestParam("salary_amount") List<Integer> salaryAmountList,
// @RequestParam("enrollment_id") List<Integer> enrollmentIdList,
// @RequestParam("group_id") List<Integer> groupIdList,
// @RequestParam("wage_id") List<Integer> wageIdList) {
// // System.out.println("Received POST request with form-data");
//
// try {
// // Iterate through each list to process the form data
// for (int i = 0; i < totalDaysPresentList.size(); i++) {
// int totalDaysPresent = totalDaysPresentList.get(i);
// int totalDaysOd = totalDaysOdList.get(i);
// int total_days_salary = totalDaysSalaryList.get(i);
// int totalDaysAbsent = totalDaysAbsentList.get(i);
// String month = monthList.get(i);
// int year = yearList.get(i);
// int salaryAmount = salaryAmountList.get(i);
// int enrollmentId = enrollmentIdList.get(i);
// int groupId = groupIdList.get(i);
// int wageId = wageIdList.get(i);
//
// String salaryStatus = "Initiated";
//
// // Call the service method to insert the salary details
// int rowsAffected = nulmService.addSalaryDetails_park(totalDaysPresent, totalDaysOd, total_days_salary,
// totalDaysAbsent, month, year, salaryAmount, salaryStatus, enrollmentId, groupId, wageId);
//
// if (rowsAffected <= 0) {
// return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR)
// .body("Failed to add salary details for enrollment ID: " + enrollmentId);
// }
// }
// return ResponseEntity.status(HttpStatus.CREATED)
// .body("Salary details added successfully for all selected entries in park.");
// } catch (Exception e) {
// e.printStackTrace(); // Log the exception for debugging
// return ResponseEntity.status(HttpStatus.BAD_REQUEST).body("Invalid request data: " + e.getMessage());
// }
// }
// @PostMapping("/salaryDetailInitiate_park")
// public ResponseEntity<String> addInitiatedSalaryDetails_park(
// @RequestParam("total_days_present") List<Integer> totalDaysPresentList,
// @RequestParam("total_days_od") List<Integer> totalDaysOdList,
// @RequestParam("total_days_salary") List<Integer> totalDaysSalaryList,
// @RequestParam("total_days_absent") List<Integer> totalDaysAbsentList,
// @RequestParam("month") List<String> monthList,
// @RequestParam("year") List<Integer> yearList,
// @RequestParam("salary_amount") List<Integer> salaryAmountList,
// @RequestParam("enrollment_id") List<Integer> enrollmentIdList,
// @RequestParam("group_id") List<Integer> groupIdList,
// @RequestParam("wage_id") List<Integer> wageIdList) {
// // System.out.println("Received POST request with form-data");
//
// try {
// // Iterate through each list to process the form data
// for (int i = 0; i < totalDaysPresentList.size(); i++) {
// int totalDaysPresent = totalDaysPresentList.get(i);
// int totalDaysOd = totalDaysOdList.get(i);
// int total_days_salary = totalDaysSalaryList.get(i);
// int totalDaysAbsent = totalDaysAbsentList.get(i);
// String month = monthList.get(i);
// int year = yearList.get(i);
// int salaryAmount = salaryAmountList.get(i);
// int enrollmentId = enrollmentIdList.get(i);
// int groupId = groupIdList.get(i);
// int wageId = wageIdList.get(i);
//
// String salaryStatus = "Initiated";
//
// // Call the service method to insert the salary details
// int rowsAffected = nulmService.addSalaryDetails_park(totalDaysPresent,
// totalDaysOd, total_days_salary,
// totalDaysAbsent, month, year, salaryAmount, salaryStatus, enrollmentId,
// groupId, wageId);
//
// if (rowsAffected <= 0) {
// return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR)
// .body("Failed to add salary details for enrollment ID: " + enrollmentId);
// }
// }
// return ResponseEntity.status(HttpStatus.CREATED)
// .body("Salary details added successfully for all selected entries in park.");
// } catch (Exception e) {
// e.printStackTrace(); // Log the exception for debugging
// return ResponseEntity.status(HttpStatus.BAD_REQUEST).body("Invalid request
// data: " + e.getMessage());
// }
// }
//// ////
// @GetMapping("/filtered-details") // @GetMapping("/filtered-details")
// public List<Map<String, Object>> getFilteredSalaryDetails( // public List<Map<String, Object>> getFilteredSalaryDetails(
@ -1066,4 +1062,74 @@ public class NulmAPIController {
// // Call the service method to get the filtered salary details // // Call the service method to get the filtered salary details
// return nulmService.getFilteredSalaryDetails(month, year, salaryStatus); // return nulmService.getFilteredSalaryDetails(month, year, salaryStatus);
// } // }
// ak
// 1. Get Zones
@GetMapping("/zones")
public List<Integer> getZones() {
return nulmService.getZones();
}
// 2. Get Divisions by Zone
@GetMapping("/divisions")
public List<Integer> getDivisions(@RequestParam int zone) {
return nulmService.getDivisions(zone);
}
// 3. Get Parks by Zone and Division
@GetMapping("/list")
public List<Map<String, Object>> getParks(
@RequestParam int zone,
// @RequestParam int division) {
@RequestParam(required = false) Integer division) {
return nulmService.getParks(zone, division);
}
@GetMapping("/staff")
public List<Map<String, Object>> getStaffByPark(@RequestParam int parkId) {
return nulmService.getStaffByPark(parkId);
}
@GetMapping("/staff-details")
public Map<String, Object> getStaffDetails(@RequestParam int enrollmentId) {
return nulmService.getStaffDetails(enrollmentId);
}
@PostMapping("/update-staff")
public ResponseEntity<?> updateStaff(
@RequestParam int enrollmentId,
@RequestParam(required = false) String fhName,
@RequestParam(required = false) String designation,
@RequestParam(required = false) Integer designationId,
@RequestParam(required = false) String aadharNo,
@RequestParam(required = false) String bankAccNo,
@RequestParam(required = false) String phoneNumber,
@RequestParam(required = false) String address,
// ak
@RequestParam(required = false) String bankName,
@RequestParam(required = false) String ifscCode,
@RequestParam(required = false) String branch,
@RequestParam(required = false) String branchAddress,
@RequestParam(required = false) Integer notFound,
@RequestParam(required = false) Integer error,
@RequestParam(required = false) String remarks,
@RequestParam(required = false) MultipartFile uploadform,
@RequestParam(required = false) MultipartFile aadharcard,
@RequestParam(required = false) MultipartFile bankpassbook, @RequestParam String createdBy) {
return ResponseEntity.ok(nulmService.updateStaff(
enrollmentId, fhName, designation, designationId,
aadharNo, bankAccNo, bankName, ifscCode, branch, branchAddress, phoneNumber, address,
uploadform, aadharcard, bankpassbook, notFound, error, remarks, createdBy));
}
@GetMapping("/designations")
@ResponseBody
public List<Map<String, Object>> getDesignations() {
return nulmService.getDesignations();
}
} }

500
gcc_officer_portal/src/main/java/in/gov/chennaicorporation/gccoffice/nulm/controller/NulmController.java

@ -21,10 +21,10 @@ import in.gov.chennaicorporation.gccoffice.service.LoginUserInfo;
@Controller @Controller
@RequestMapping("/gcc/nulm") @RequestMapping("/gcc/nulm")
public class NulmController { public class NulmController {
@Autowired @Autowired
private NulmService nulmService; private NulmService nulmService;
@GetMapping("/appointment") @GetMapping("/appointment")
public String viewappoinmentMaster(Model model) { public String viewappoinmentMaster(Model model) {
System.out.println("appointment"); System.out.println("appointment");
@ -42,118 +42,135 @@ public class NulmController {
System.out.println("create-order"); System.out.println("create-order");
return "modules/nulm/create-order"; return "modules/nulm/create-order";
} }
@GetMapping("/scheme-group") @GetMapping("/scheme-group")
public String viewschemegroup(Model model) { public String viewschemegroup(Model model) {
System.out.println("scheme-group"); System.out.println("scheme-group");
return "modules/nulm/scheme-group"; return "modules/nulm/scheme-group";
} }
@GetMapping("/dropout") @GetMapping("/dropout")
public String viewappointmentscreengroup(Model model) { public String viewappointmentscreengroup(Model model) {
System.out.println("dropout"); System.out.println("dropout");
return "modules/nulm/dropout"; return "modules/nulm/dropout";
} }
@GetMapping("/updateStaff") @GetMapping("/updateStaff")
public String viewUpdateScreen(
@RequestParam(value = "department", required = false) String department,
@RequestParam(value = "division", required = false) String division,
Model model) {
// Fetch the full list or filtered list based on parameters
List<Map<String, Object>> enrollments = nulmService.getEnrollments(department, null);
// Add the list to the model to be accessed in the view
model.addAttribute("enrollments", enrollments);
model.addAttribute("selectedDepartment", department); // Pass the selected department
// Return the view name
return "modules/nulm/updated-staff";
}
public String viewUpdateScreen(
@RequestParam(value = "department", required = false) String department,
@RequestParam(value = "division", required = false) String division,
Model model) {
// Fetch the full list or filtered list based on parameters
List<Map<String, Object>> enrollments = nulmService.getEnrollments(department, null);
// Add the list to the model to be accessed in the view
model.addAttribute("enrollments", enrollments);
model.addAttribute("selectedDepartment", department); // Pass the selected department
// Return the view name
return "modules/nulm/updated-staff";
}
@GetMapping("/salaryDetails") @GetMapping("/salaryDetails")
public String getSalaryDetails( public String getSalaryDetails(
@RequestParam(value = "month", required = false) String month,
@RequestParam(value = "year", required = false) Integer year, // Use Integer instead of int
Model model) {
List<Map<String, Object>> salaryDetails = new ArrayList<>();
// Check if month and year are provided
if (month != null && year != null) {
salaryDetails = nulmService.getAttendanceWithSalary(month, year);
} else {
// Handle case when no month or year is provided
model.addAttribute("message", "Please select a month and year.");
}
model.addAttribute("salaryCounts", salaryDetails);
System.out.println("salarydetails for month: " + month + ", year: " + year);
return "modules/nulm/salary-details";
@RequestParam(value = "month", required = false) String month,
@RequestParam(value = "year", required = false) Integer year, // Use Integer instead of int
Model model) {
List<Map<String, Object>> salaryDetails = new ArrayList<>();
// Check if month and year are provided
if (month != null && year != null) {
salaryDetails = nulmService.getAttendanceWithSalary(month, year);
} else {
// Handle case when no month or year is provided
model.addAttribute("message", "Please select a month and year.");
}
model.addAttribute("salaryCounts", salaryDetails);
System.out.println("salarydetails for month: " + month + ", year: " + year);
return "modules/nulm/salary-details";
} }
/* /*
* @GetMapping("/salary-approve")
* public String viewSalaryApproveScreen(@RequestParam(required = false) String
* month,
*
* @RequestParam(required = false) Integer year,
*
* @RequestParam(required = false) String salaryStatus,
* Model model) {
* List<Map<String, Object>> salaryInitiatedCounts;
*
* // If both month and year are provided, fetch the data; otherwise, return an
* empty list
* if (month != null && year != null) {
* salaryInitiatedCounts = nulmService.getFilteredSalaryDetails(month, year,
* salaryStatus);
* } else {
* salaryInitiatedCounts = Collections.emptyList(); // Empty list if no month
* and year are provided
* }
*
* model.addAttribute("salaryInitiatedCounts", salaryInitiatedCounts);
* return "modules/nulm/salary-approve";
* }
*/
@GetMapping("/salary-approve") @GetMapping("/salary-approve")
public String viewSalaryApproveScreen(@RequestParam(required = false) String month, public String viewSalaryApproveScreen(@RequestParam(required = false) String month,
@RequestParam(required = false) Integer year,
@RequestParam(required = false) String salaryStatus,
Model model) {
List<Map<String, Object>> salaryInitiatedCounts;
// If both month and year are provided, fetch the data; otherwise, return an empty list
if (month != null && year != null) {
salaryInitiatedCounts = nulmService.getFilteredSalaryDetails(month, year, salaryStatus);
} else {
salaryInitiatedCounts = Collections.emptyList(); // Empty list if no month and year are provided
}
model.addAttribute("salaryInitiatedCounts", salaryInitiatedCounts);
return "modules/nulm/salary-approve";
}
*/
@GetMapping("/salary-approve")
public String viewSalaryApproveScreen(@RequestParam(required = false) String month,
@RequestParam(required = false) Integer year,
@RequestParam(required = false) String salaryStatus, // Added department parameter
Model model) {
String LoginUserId = LoginUserInfo.getLoginUserId();
model.addAttribute("LoginUserId",LoginUserId);
System.out.println("LoginUserId=="+LoginUserId);
@RequestParam(required = false) Integer year,
@RequestParam(required = false) String salaryStatus, // Added department parameter
Model model) {
String LoginUserId = LoginUserInfo.getLoginUserId();
model.addAttribute("LoginUserId", LoginUserId);
System.out.println("LoginUserId==" + LoginUserId);
List<Map<String, Object>> salaryInitiatedCounts; List<Map<String, Object>> salaryInitiatedCounts;
// Fetch data if both month and year are provided, otherwise return an empty list
if (month != null && year != null) {
salaryInitiatedCounts = nulmService.getFilteredSalaryDetails(month, year, salaryStatus,LoginUserId); // Pass department to the service method
} else {
salaryInitiatedCounts = Collections.emptyList(); // Empty list if no month and year are provided
}
// Fetch data if both month and year are provided, otherwise return an empty
// list
if (month != null && year != null) {
salaryInitiatedCounts = nulmService.getFilteredSalaryDetails(month, year, salaryStatus, LoginUserId); // Pass
// department
// to
// the
// service
// method
} else {
salaryInitiatedCounts = Collections.emptyList(); // Empty list if no month and year are provided
}
model.addAttribute("salaryInitiatedCounts", salaryInitiatedCounts);
model.addAttribute("salaryInitiatedCounts", salaryInitiatedCounts);
return "modules/nulm/salary-approve";
return "modules/nulm/salary-approve";
} }
//// ////
@GetMapping("/salary-approve-park") @GetMapping("/salary-approve-park")
public String viewSalaryApproveScreen_park(@RequestParam(required = false) String month, public String viewSalaryApproveScreen_park(@RequestParam(required = false) String month,
@RequestParam(required = false) Integer year,
@RequestParam(required = false) String salaryStatus, // Added department parameter
Model model) {
@RequestParam(required = false) Integer year,
@RequestParam(required = false) String salaryStatus, // Added department parameter
Model model) {
String LoginUserId = LoginUserInfo.getLoginUserId();
model.addAttribute("LoginUserId",LoginUserId);
String LoginUserId = LoginUserInfo.getLoginUserId();
model.addAttribute("LoginUserId", LoginUserId);
List<Map<String, Object>> salaryInitiatedCounts; List<Map<String, Object>> salaryInitiatedCounts;
// Fetch data if both month and year are provided, otherwise return an empty list
// Fetch data if both month and year are provided, otherwise return an empty
// list
if (month != null && year != null) { if (month != null && year != null) {
salaryInitiatedCounts = nulmService.getFilteredSalaryDetails_park(month, year, salaryStatus,LoginUserId); // Pass department to the service method
salaryInitiatedCounts = nulmService.getFilteredSalaryDetails_park(month, year, salaryStatus, LoginUserId); // Pass
// department
// to
// the
// service
// method
} else { } else {
salaryInitiatedCounts = Collections.emptyList(); // Empty list if no month and year are provided salaryInitiatedCounts = Collections.emptyList(); // Empty list if no month and year are provided
} }
@ -162,185 +179,202 @@ public class NulmController {
return "modules/nulm/salary-approve-park"; return "modules/nulm/salary-approve-park";
} }
//// ////
@GetMapping("/salary-report") @GetMapping("/salary-report")
public String viewSalaryReport( public String viewSalaryReport(
@RequestParam(required = false) String month,
@RequestParam(required = false) Integer year,
@RequestParam(required = false) String salaryStatus,
@RequestParam(required = false) String groupName,
Model model) {
String LoginUserId = LoginUserInfo.getLoginUserId();
model.addAttribute("LoginUserId",LoginUserId);
// Initialize an empty salaryReport list
List<Map<String, Object>> salaryReport = new ArrayList<>();
// Only fetch the report if month and year are provided
if (month != null && year != null) {
salaryReport = nulmService.getSalaryReport(month, year, salaryStatus, groupName, LoginUserId);
}
// Add the fetched data to the model
model.addAttribute("salaryReport", salaryReport);
return "modules/nulm/salary-report"; // Returns the view 'salary-report'
@RequestParam(required = false) String month,
@RequestParam(required = false) Integer year,
@RequestParam(required = false) String salaryStatus,
@RequestParam(required = false) String groupName,
Model model) {
String LoginUserId = LoginUserInfo.getLoginUserId();
model.addAttribute("LoginUserId", LoginUserId);
// Initialize an empty salaryReport list
List<Map<String, Object>> salaryReport = new ArrayList<>();
// Only fetch the report if month and year are provided
if (month != null && year != null) {
salaryReport = nulmService.getSalaryReport(month, year, salaryStatus, groupName, LoginUserId);
}
// Add the fetched data to the model
model.addAttribute("salaryReport", salaryReport);
return "modules/nulm/salary-report"; // Returns the view 'salary-report'
} }
//// ////
@GetMapping("/salary-report-park")
@GetMapping("/salary-report-park")
public String viewSalaryReport_Park( public String viewSalaryReport_Park(
@RequestParam(required = false) String month,
@RequestParam(required = false) Integer year,
@RequestParam(required = false) String salaryStatus,
@RequestParam(required = false) String groupName,
Model model) {
String LoginUserId = LoginUserInfo.getLoginUserId();
model.addAttribute("LoginUserId",LoginUserId);
// Initialize an empty salaryReport list
List<Map<String, Object>> salaryReport = new ArrayList<>();
// Only fetch the report if month and year are provided
if (month != null && year != null) {
salaryReport = nulmService.getSalaryReport_park(month, year, salaryStatus, groupName, LoginUserId);
}
// Add the fetched data to the model
model.addAttribute("salaryReport", salaryReport);
return "modules/nulm/salary-report-park"; // Returns the view 'salary-report'
@RequestParam(required = false) String month,
@RequestParam(required = false) Integer year,
@RequestParam(required = false) String salaryStatus,
@RequestParam(required = false) String groupName,
Model model) {
String LoginUserId = LoginUserInfo.getLoginUserId();
model.addAttribute("LoginUserId", LoginUserId);
// Initialize an empty salaryReport list
List<Map<String, Object>> salaryReport = new ArrayList<>();
// Only fetch the report if month and year are provided
if (month != null && year != null) {
salaryReport = nulmService.getSalaryReport_park(month, year, salaryStatus, groupName, LoginUserId);
}
// Add the fetched data to the model
model.addAttribute("salaryReport", salaryReport);
return "modules/nulm/salary-report-park"; // Returns the view 'salary-report'
} }
//// ////
@GetMapping("/salary-zonereport") @GetMapping("/salary-zonereport")
public String viewZoneWiseReport( public String viewZoneWiseReport(
@RequestParam(required = false) String month,
@RequestParam(required = false) Integer year,
@RequestParam(required = false) String salaryStatus,
@RequestParam(required = false) String groupName,
@RequestParam(required = false) String zone,
@RequestParam(required = false) String division,
Model model) {
//System.out.println("Zone: "+zone);
// Initialize an empty salaryReport list
List<Map<String, Object>> zoneWiseReport = new ArrayList<>();
// Only fetch the report if month, year and zone are provided
if (month != null && year != null && zone!= null) {
zoneWiseReport = nulmService.getZoneWiseReport(month, year, salaryStatus ,groupName, zone, division);
}
// Add the fetched data to the model
model.addAttribute("zonewiseReport", zoneWiseReport);
return "modules/nulm/zone-wise-report"; // Returns the view 'salary-zonereport'
@RequestParam(required = false) String month,
@RequestParam(required = false) Integer year,
@RequestParam(required = false) String salaryStatus,
@RequestParam(required = false) String groupName,
@RequestParam(required = false) String zone,
@RequestParam(required = false) String division,
Model model) {
// System.out.println("Zone: "+zone);
// Initialize an empty salaryReport list
List<Map<String, Object>> zoneWiseReport = new ArrayList<>();
// Only fetch the report if month, year and zone are provided
if (month != null && year != null && zone != null) {
zoneWiseReport = nulmService.getZoneWiseReport(month, year, salaryStatus, groupName, zone, division);
}
// Add the fetched data to the model
model.addAttribute("zonewiseReport", zoneWiseReport);
return "modules/nulm/zone-wise-report"; // Returns the view 'salary-zonereport'
} }
@GetMapping("/attendance-report") @GetMapping("/attendance-report")
public String viewAttendanceReport(
@RequestParam(required = false) String fromdate,
@RequestParam(required = false) String todate,
@RequestParam(required = false) String groupName,
@RequestParam(required = false) String zone,
@RequestParam(required = false) String division,
Model model) {
// Initialize an empty salaryReport list
List<Map<String, Object>> attendanceReport = new ArrayList<>();
// Only fetch the report if month, year and zone are provided
if (division != null && zone!= null) {
attendanceReport = nulmService.getAttendanceReport(fromdate ,todate ,groupName, zone, division);
}
// Add the fetched data to the model
model.addAttribute("attendanceReport", attendanceReport);
return "modules/nulm/attendance-report";
public String viewAttendanceReport(
@RequestParam(required = false) String fromdate,
@RequestParam(required = false) String todate,
@RequestParam(required = false) String groupName,
@RequestParam(required = false) String zone,
@RequestParam(required = false) String division,
Model model) {
// Initialize an empty salaryReport list
List<Map<String, Object>> attendanceReport = new ArrayList<>();
// Only fetch the report if month, year and zone are provided
if (division != null && zone != null) {
attendanceReport = nulmService.getAttendanceReport(fromdate, todate, groupName, zone, division);
}
// Add the fetched data to the model
model.addAttribute("attendanceReport", attendanceReport);
return "modules/nulm/attendance-report";
} }
@GetMapping("/consolidated-attendance-report") // need to add @GetMapping("/consolidated-attendance-report") // need to add
public String viewConsolidatedAttendanceReport(
@RequestParam(required = false) String fromdate,
@RequestParam(required = false) String todate,
@RequestParam(required = false) String groupName,
@RequestParam(required = false) String zone,
@RequestParam(required = false) String division,
Model model) {
public String viewConsolidatedAttendanceReport(
@RequestParam(required = false) String fromdate,
@RequestParam(required = false) String todate,
@RequestParam(required = false) String groupName,
@RequestParam(required = false) String zone,
@RequestParam(required = false) String division,
Model model) {
// Initialize an empty salaryReport list
List<Map<String, Object>> consolidatedAttendanceReport = new ArrayList<>();
// Only fetch the report if month, year and zone are provided
if (division != null && zone != null) {
consolidatedAttendanceReport = nulmService.getConsolidatedAttendanceReport(fromdate, todate, groupName,
zone, division);
}
// Add the fetched data to the model
model.addAttribute("consolidatedAttendanceReport", consolidatedAttendanceReport);
model.addAttribute("fromdate", fromdate);
model.addAttribute("todate", todate);
return "modules/nulm/attendance-report";
}
@GetMapping("/attendance-dates") // need to add
public ResponseEntity<Map<String, List<String>>> getAttendanceDates(
@RequestParam(required = false) String enrollmentId,
@RequestParam(required = false) String fromdate,
@RequestParam(required = false) String todate,
@RequestParam(required = false) String type,
Model model) {
return ResponseEntity.ok(nulmService.fetchAttendanceDates(enrollmentId, fromdate, todate, type));
// Initialize an empty salaryReport list
List<Map<String, Object>> consolidatedAttendanceReport = new ArrayList<>();
}
// Only fetch the report if month, year and zone are provided
if (division != null && zone != null) {
consolidatedAttendanceReport = nulmService.getConsolidatedAttendanceReport(fromdate, todate, groupName, zone, division);
}
@GetMapping("/self-help-group") // need to add
public String viewSelfHelpGroup(Model model) {
// Add the fetched data to the model
model.addAttribute("consolidatedAttendanceReport", consolidatedAttendanceReport);
model.addAttribute("fromdate", fromdate);
model.addAttribute("todate", todate);
// Fetch the full list or filtered list based on parameters
List<Map<String, Object>> selfHelpGroup = nulmService.getSelfHelpGroupDetails();
return "modules/nulm/attendance-report";
}
// Add the list to the model to be accessed in the view
model.addAttribute("selfHelpGroup", selfHelpGroup);
@GetMapping("/attendance-dates") //need to add
public ResponseEntity<Map<String, List<String>>> getAttendanceDates(
@RequestParam(required = false) String enrollmentId,
@RequestParam(required = false) String fromdate,
@RequestParam(required = false) String todate,
@RequestParam(required = false) String type,
Model model) {
// Return the view name
return "modules/nulm/selfHelpGroup";
}
return ResponseEntity.ok(nulmService.fetchAttendanceDates(enrollmentId, fromdate, todate, type));
@GetMapping("/salary-nonInitiated")
public String viewSalaryNotInitiatedReport(
@RequestParam(required = false) String month,
@RequestParam(required = false) Integer year,
@RequestParam(required = false) String groupName,
Model model) {
System.out.println(" salary-nonInitiated groupname====" + groupName);
if (groupName != null && !groupName.isEmpty()) {
groupName = URLDecoder.decode(groupName, StandardCharsets.UTF_8);
}
}
List<Map<String, Object>> salaryNotInitiatedReport = new ArrayList<>();
if (month != null && year != null) {
salaryNotInitiatedReport = nulmService.getSalaryNotInitiatedReport(month, year, groupName);
}
@GetMapping("/self-help-group") // need to add
public String viewSelfHelpGroup(Model model) {
model.addAttribute("salaryNonInitiatedReport", salaryNotInitiatedReport);
// Fetch the full list or filtered list based on parameters
List<Map<String, Object>> selfHelpGroup = nulmService.getSelfHelpGroupDetails();
return "modules/nulm/salary-nonInitiatedreport";
}
// Add the list to the model to be accessed in the view
model.addAttribute("selfHelpGroup", selfHelpGroup);
@GetMapping("/staffupdate")
public String viewSalaryReport(Model model) {
// Return the view name
return "modules/nulm/selfHelpGroup";
}
String LoginUserId = LoginUserInfo.getLoginUserId();
System.out.println("===" + LoginUserId);
model.addAttribute("LoginUserId", LoginUserId);
boolean hasAccess = nulmService.hasStaffUpdateAccess(LoginUserId);
@GetMapping("/salary-nonInitiated")
public String viewSalaryNotInitiatedReport(
@RequestParam(required = false) String month,
@RequestParam(required = false) Integer year,
@RequestParam(required = false) String groupName,
Model model) {
System.out.println(" salary-nonInitiated groupname====" + groupName);
if (groupName != null && !groupName.isEmpty()) {
groupName = URLDecoder.decode(groupName, StandardCharsets.UTF_8);
}
if (hasAccess) {
List<Map<String, Object>> salaryNotInitiatedReport = new ArrayList<>();
model.addAttribute("LoginUserId", LoginUserId);
return "modules/nulm/staffupdate";
if (month != null && year != null) {
salaryNotInitiatedReport = nulmService.getSalaryNotInitiatedReport(month, year, groupName);
}
} else {
model.addAttribute("salaryNonInitiatedReport", salaryNotInitiatedReport);
return "modules/nulm/staffupdatenoacess";
}
}
return "modules/nulm/salary-nonInitiatedreport";
}
} }

1098
gcc_officer_portal/src/main/java/in/gov/chennaicorporation/gccoffice/nulm/service/NulmService.java
File diff suppressed because it is too large
View File

1509
gcc_officer_portal/src/main/resources/templates/modules/nulm/staffupdate.html
File diff suppressed because it is too large
View File

63
gcc_officer_portal/src/main/resources/templates/modules/nulm/staffupdatenoacess.html

@ -0,0 +1,63 @@
<!DOCTYPE html>
<html lang="en" dir="">
<html xmlns:th="http://www.thymeleaf.org">
<head th:replace="~{fragments/modules/base/head :: head}"></head>
<body>
<div class="wrapper">
<header th:replace="~{fragments/modules/base/header :: header}"></header>
<div class="page-wrap">
<div th:replace="~{fragments/modules/base/menu :: menu}"></div>
<div class="main-content">
<div class="container-fluid">
<div class="page-header">
<div class="row align-items-end">
<div class="col-lg-6">
<div class="page-header-title">
<i class="ik ik-thumbs-up bg-blue"></i>
<div class="d-inline">
<h5>NULM STAFF</h5>
<span>Salary Report</span>
</div>
</div>
</div>
<div class="col-lg-6">
<nav class="breadcrumb-container" aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item">
<a href="/index"><i class="ik ik-home"></i></a>
</li>
<li class="breadcrumb-item active" aria-current="page">Salary Report</li>
</ol>
</nav>
</div>
</div>
</div>
<hr>
<div class="card-block mt-3">
<div class="text-center text-danger" style="font-size:20px; font-weight:bold;">
You Have No access for staff Update, Please contact admin...
</div>
</div>
</div>
</div>
<footer th:replace="~{fragments/modules/base/footer :: footer}"></footer>
</div>
</div>
<div th:replace="~{fragments/modules/base/script :: script}"></div>
</body>
</html>
Loading…
Cancel
Save