Commit 1b16b517 authored by Vijay Akula's avatar Vijay Akula

Update on resource status engaged validation

parent 071b0d85
...@@ -216,11 +216,11 @@ public class ResourceService implements IResourceService { ...@@ -216,11 +216,11 @@ public class ResourceService implements IResourceService {
respMap.put("message", "Billing start date should be after previous allocation billing end date in this project"); respMap.put("message", "Billing start date should be after previous allocation billing end date in this project");
isValid = false; isValid = false;
} }
if (prevAllocation.getBillableStatus().equalsIgnoreCase(resourceReq.getBillableStatus())) { // if (prevAllocation.getBillableStatus().equalsIgnoreCase(resourceReq.getBillableStatus())) {
respMap.put("statusCode", 811); // respMap.put("statusCode", 811);
respMap.put("message", "Resource is already in " + prevAllocation.getBillableStatus() + " status only"); // respMap.put("message", "Resource is already in " + prevAllocation.getBillableStatus() + " status only");
isValid = false; // isValid = false;
} // }
} }
return isValid; return isValid;
} }
...@@ -318,6 +318,9 @@ public class ResourceService implements IResourceService { ...@@ -318,6 +318,9 @@ public class ResourceService implements IResourceService {
}else if(!isDatesAvailableForAllocation(resourceReq)){ }else if(!isDatesAvailableForAllocation(resourceReq)){
message = respMap.get("message").toString(); message = respMap.get("message").toString();
isAssigned = false; isAssigned = false;
}else if(!isReleased(resourceReq)){
message = respMap.get("message").toString();
isAssigned = false;
} }
respMap.put("statusCode", 815); respMap.put("statusCode", 815);
respMap.put("message", message); respMap.put("message", message);
...@@ -368,6 +371,24 @@ public class ResourceService implements IResourceService { ...@@ -368,6 +371,24 @@ public class ResourceService implements IResourceService {
return isValid; return isValid;
} }
public boolean isReleased(Resource resourceReq){
boolean released = false;
List<Resource> resourceList = resourceRepo.findByEmployeeId(resourceReq.getEmployeeId());
Resource currentAllocation = getCurrentAllocationIfNotReturnNull(resourceReq.getEmployeeId());
if(currentAllocation == null){
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
respMap.put("statusCode", 810);
respMap.put("message", "Resource is not released from "+projectService.getProjectByProjectId(latestAllocation.getProjectId()).getProjectName());
}else{
released = true;
}
}
return released;
}
public boolean validateResourceBillingEndDateAgainstBench(Resource resourceReq){ public boolean validateResourceBillingEndDateAgainstBench(Resource resourceReq){
boolean isValid = true; boolean isValid = true;
String message = ""; String message = "";
......
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