Commit c33395f6 authored by Md Suleman's avatar Md Suleman

Resource service updates

parent 4fdb4f5f
......@@ -143,31 +143,31 @@ public class ResourceService implements IResourceService {
if (resource != null) {
if(!resource.getStatus().equalsIgnoreCase(MyTeamUtils.STATUS_RELEASED)){
if(validateResourceForProposedToEngage(resourceReq)){
this.updateExistedResource(resourceReq);
return;
}else{
// return;
}else {
if (isDatesAvailableForAllocation(resourceReq)) {
Resource prevAllocation = getFirstOfListOrNull(resourceRepo.findByEmployeeId(resourceReq.getEmployeeId()).stream().
filter(a -> a.getBillingEndDate().compareTo(MyTeamDateUtils.getDayLessThanDate(resource.getBillingStartDate())) == 0).collect(Collectors.toList()));
Resource nextAllocation = getFirstOfListOrNull(resourceRepo.findByEmployeeId(resourceReq.getEmployeeId()).stream().filter(a ->
a.getBillingStartDate().compareTo(MyTeamDateUtils.getDayMoreThanDate(resource.getBillingEndDate())) == 0).collect(Collectors.toList()));
if (prevAllocation != null && prevAllocation.getProjectId().equalsIgnoreCase(MyTeamUtils.BENCH_PROJECT_ID)) {
prevAllocation.setBillingEndDate(MyTeamDateUtils.getDayLessThanDate(resourceReq.getBillingStartDate()));
this.updateExistedResource(prevAllocation);
}
if (nextAllocation != null && nextAllocation.getProjectId().equalsIgnoreCase(MyTeamUtils.BENCH_PROJECT_ID)) {
nextAllocation.setBillingStartDate(MyTeamDateUtils.getDayMoreThanDate(resourceReq.getBillingEndDate()));
this.updateExistedResource(nextAllocation);
}
resource.setBillableStatus(resourceReq.getBillableStatus());
resource.setBillingStartDate(resourceReq.getBillingStartDate());
resource.setBillingEndDate(resourceReq.getBillingEndDate());
this.updateExistedResource(resource);
}
if(isDatesAvailableForAllocation(resourceReq)) {
Resource prevAllocation = getFirstOfListOrNull(resourceRepo.findByEmployeeId(resourceReq.getEmployeeId()).stream().
filter(a -> a.getBillingEndDate().compareTo(MyTeamDateUtils.getDayLessThanDate(resource.getBillingStartDate()))==0).collect(Collectors.toList()));
Resource nextAllocation = getFirstOfListOrNull(resourceRepo.findByEmployeeId(resourceReq.getEmployeeId()).stream().filter(a ->
a.getBillingStartDate().compareTo(MyTeamDateUtils.getDayMoreThanDate(resource.getBillingEndDate()))==0).collect(Collectors.toList()));
if(prevAllocation!=null && prevAllocation.getProjectId().equalsIgnoreCase(MyTeamUtils.BENCH_PROJECT_ID)){
prevAllocation.setBillingEndDate(MyTeamDateUtils.getDayLessThanDate(resourceReq.getBillingStartDate()));
this.updateExistedResource(prevAllocation);
}
if(nextAllocation != null && nextAllocation.getProjectId().equalsIgnoreCase(MyTeamUtils.BENCH_PROJECT_ID)){
nextAllocation.setBillingStartDate(MyTeamDateUtils.getDayMoreThanDate(resourceReq.getBillingEndDate()));
this.updateExistedResource(nextAllocation);
}
resource.setBillableStatus(resourceReq.getBillableStatus());
resource.setBillingStartDate(resourceReq.getBillingStartDate());
resource.setBillingEndDate(resourceReq.getBillingEndDate());
this.updateExistedResource(resource);
}
}else{
respMap.put("statusCode", 811);
respMap.put("message", "Resource is already released from you, And you can't update this allocation");
......@@ -184,6 +184,8 @@ public class ResourceService implements IResourceService {
if (resource != null) {
Resource resourcePers = resourceRepo.save(resource);
respMap.put("statusCode", 801);
respMap.put("message", "Resource updated successfully");
respMap.put("resourceObj", resourcePers);
}
......@@ -350,6 +352,7 @@ public class ResourceService implements IResourceService {
if(lastAllocation != null && !lastAllocation.getStatus().equals(MyTeamUtils.STATUS_RELEASED)){
message = "Resource is not released form last allocation";
}else{
message = "Resource updated successfully";
isValid = true;
}
......
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