diff --git a/src/main/java/org/upsmf/grievance/model/reponse/Response.java b/src/main/java/org/upsmf/grievance/model/reponse/Response.java index 480ebd1aa8c1116072603773d4843d37f15d0c19..d4bd939219f5faf91fd1a2d6708c6d5b234b0229 100644 --- a/src/main/java/org/upsmf/grievance/model/reponse/Response.java +++ b/src/main/java/org/upsmf/grievance/model/reponse/Response.java @@ -1,10 +1,14 @@ package org.upsmf.grievance.model.reponse; import lombok.AllArgsConstructor; +import lombok.Builder; import lombok.Data; +import lombok.ToString; @Data @AllArgsConstructor +@Builder +@ToString public class Response { private int status; diff --git a/src/main/java/org/upsmf/grievance/service/impl/IntegrationServiceImpl.java b/src/main/java/org/upsmf/grievance/service/impl/IntegrationServiceImpl.java index 3a25ae0e5d611a600e029e513544aaac5db2c6ad..e7aebb5ef0722b8deac7dc7f557406190c20f007 100644 --- a/src/main/java/org/upsmf/grievance/service/impl/IntegrationServiceImpl.java +++ b/src/main/java/org/upsmf/grievance/service/impl/IntegrationServiceImpl.java @@ -37,6 +37,7 @@ import org.upsmf.grievance.model.Role; import org.upsmf.grievance.model.User; import org.upsmf.grievance.model.UserDepartment; import org.upsmf.grievance.model.UserRole; +import org.upsmf.grievance.model.reponse.Response; import org.upsmf.grievance.repository.RoleRepository; import org.upsmf.grievance.repository.UserDepartmentRepository; import org.upsmf.grievance.repository.UserRepository; @@ -842,7 +843,7 @@ public class IntegrationServiceImpl implements IntegrationService { User userDetails = user.get(); // if role is admin/secretary/Grievance Admin // then only one user can be active at a time - ResponseEntity<String> checkRoleAndActiveCount = checkRoleAndActiveCount(userDetails); + ResponseEntity<Response> checkRoleAndActiveCount = checkRoleAndActiveCount(userDetails); if(checkRoleAndActiveCount.getStatusCode().value() != HttpStatus.OK.value()) { return checkRoleAndActiveCount; } @@ -866,19 +867,20 @@ public class IntegrationServiceImpl implements IntegrationService { if(superadmin) { updateMailConfigEmail(data.getEmail()); } - return ResponseEntity.ok(data); + return ResponseEntity.ok(Response.builder().body(data).status(HttpStatus.OK.value()).build()); } - return ResponseEntity.internalServerError().body("Error in activating user."); + + return ResponseEntity.internalServerError().body(Response.builder().body("Error in activating user.").status(HttpStatus.INTERNAL_SERVER_ERROR.value()).build()); } catch (Exception e) { e.printStackTrace(); - return ResponseEntity.internalServerError().body("Error in activating user."); + return ResponseEntity.internalServerError().body(Response.builder().body("Error in activating user.").status(HttpStatus.INTERNAL_SERVER_ERROR.value()).build()); } } } return ResponseEntity.internalServerError().body("Unable to find user details for provided Id."); } - private ResponseEntity<String> checkRoleAndActiveCount(User userDetails) { + private ResponseEntity<Response> checkRoleAndActiveCount(User userDetails) { if(userDetails == null || userDetails.getRoles() == null || Arrays.stream(userDetails.getRoles()).count() <= 0) { log.error("Failed to check user role"); @@ -902,9 +904,9 @@ public class IntegrationServiceImpl implements IntegrationService { }); log.debug("match count for user role - {}", matchCount.get()); if(matchCount.get() > 0) { - return ResponseEntity.badRequest().body("Application is designed to have only one active Secretary or Admin or Grievance Nodal."); + return ResponseEntity.badRequest().body(Response.builder().body("Application is designed to have only one active Secretary or Admin or Grievance Nodal.").status(HttpStatus.BAD_REQUEST.value()).build()); } - return ResponseEntity.ok("Success"); + return ResponseEntity.ok(Response.builder().body("Success").status(HttpStatus.OK.value()).build()); } @Override diff --git a/src/main/java/org/upsmf/grievance/service/impl/TicketServiceImpl.java b/src/main/java/org/upsmf/grievance/service/impl/TicketServiceImpl.java index 73d97e455ca64bb61bdc89f14901583d8024c683..458c63b400078fd057cca4d0b3b8e69c9210f15b 100644 --- a/src/main/java/org/upsmf/grievance/service/impl/TicketServiceImpl.java +++ b/src/main/java/org/upsmf/grievance/service/impl/TicketServiceImpl.java @@ -485,8 +485,7 @@ public class TicketServiceImpl implements TicketService { || oldStatusValue.name().equalsIgnoreCase("CLOSED")) ) { // sending reopen ticket mail to nodal officer log.info("ticket is getting reopened we will reset escalation date time - {}", ticket.getId()); - LocalDateTime escalationDateTime = getEscalationDateFromMailConfig(); - ticket.setEscalatedDate(Timestamp.valueOf(escalationDateTime)); + ticket.setEscalatedDate(null); } // update ticket in DB ticketRepository.save(ticket); diff --git a/src/main/resources/templates/admin_create_ticket.vm b/src/main/resources/templates/admin_create_ticket.vm index a3e3683be140ef4cb57634ea4dfd37f8743a7715..c5f5233f48ea1b87deadf6fd8dd6d4bd85c4f9e1 100644 --- a/src/main/resources/templates/admin_create_ticket.vm +++ b/src/main/resources/templates/admin_create_ticket.vm @@ -85,7 +85,7 @@ <td align="justify" class="esd-block-text es-m-txt-l"> <p></br></p> <p>Dear ${first_name},</p> - <p>We hope this message finds you well. We wanted to inform you that a new grievance ticket has been created regarding ${ticket_description}.</br> The ticket has been assigned the following details:</p> + <p>We hope this message finds you well. We wanted to inform you that a new grievance ticket has been created regarding </br><strong>${ticket_description}</strong>.</br> </br>The ticket has been assigned the following details:</p> <p> <div>Grievance ID: <strong>${id}</strong></div> <div>Date Created: <strong>${created_date}</strong></div>