Commit e416065c authored by Vijay Akula's avatar Vijay Akula

Bug fix:Resolved the response problem while adding engage resource to project

parent 60934eb4
......@@ -53,7 +53,7 @@ public class ResourceController {
if (resourceService.validateAllocationAgainstPrevAllocation(resourceAllocationReq)) {
Resource resourcePersisted = resourceService.addResource(resourceAllocationReq, loginEmpId);
ResponseDetails createResponseDetails = new ResponseDetails(new Date(), 800, "Resource has been created",
ResponseDetails createResponseDetails = new ResponseDetails(new Date(), 800, resourceService.respMap.get("message").toString(),
"Resource description", null, request.getContextPath(), "details", resourcePersisted);
return new ResponseEntity<ResponseDetails>(createResponseDetails, HttpStatus.OK);
}
......
......@@ -93,6 +93,7 @@ public class ResourceService implements IResourceService {
//resource is not yet released from latest project
}else{
resourcePers = resourceRepo.save(resourceReq);
respMap.put("message","Resource has been created");
}
return resourcePers;
}
......@@ -372,6 +373,7 @@ public class ResourceService implements IResourceService {
}
public boolean isReleased(Resource resourceReq){
String message = "";
boolean released = false;
List<Resource> resourceList = resourceRepo.findByEmployeeId(resourceReq.getEmployeeId());
Resource currentAllocation = getCurrentAllocationIfNotReturnNull(resourceReq.getEmployeeId());
......@@ -379,13 +381,16 @@ public class ResourceService implements IResourceService {
Resource latestAllocation = getLatestAllocation(resourceList.stream().filter(r -> r.getBillingEndDate().compareTo(resourceReq.getBillingStartDate()) < 0).collect(Collectors.toList()));
if(latestAllocation != null && latestAllocation.getStatus().equals(MyTeamUtils.STATUS_ENGAGED)){
//not released
message = "Resource is not released from "+projectService.getProjectByProjectId(latestAllocation.getProjectId()).getProjectName();
respMap.put("statusCode", 810);
respMap.put("message", "Resource is not released from "+projectService.getProjectByProjectId(latestAllocation.getProjectId()).getProjectName());
}else{
released = true;
}
}else{
released = true;
}
respMap.put("message", message);
return released;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment