Commit bcf385b7 authored by Md Suleman's avatar Md Suleman

Changed Active and inactive condition for the resource allocated in the project

parent 00486ce3
...@@ -14,7 +14,6 @@ import org.springframework.web.cors.UrlBasedCorsConfigurationSource; ...@@ -14,7 +14,6 @@ import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
import org.springframework.web.filter.CorsFilter; import org.springframework.web.filter.CorsFilter;
@SpringBootApplication @SpringBootApplication
@EnableAutoConfiguration
@EnableMongoRepositories(basePackages = { "com.nisum.myteam.repository" }) @EnableMongoRepositories(basePackages = { "com.nisum.myteam.repository" })
public class MyTeamApplication extends SpringBootServletInitializer { public class MyTeamApplication extends SpringBootServletInitializer {
......
package com.nisum.myteam.model.dao;
import lombok.*;
import org.bson.types.ObjectId;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
import java.util.Date;
@Setter
@Getter
@AllArgsConstructor
@NoArgsConstructor
@ToString
@Document(collection = "employeeSubStatus")
public class EmployeeSubStatus {
@Id
private ObjectId id;
@NonNull
private String employeeID;
@NonNull
private String subStatus;
@NonNull
private Date fromDate;
@NonNull
private Date toDate;
}
...@@ -135,19 +135,19 @@ public class ResourceService implements IResourceService { ...@@ -135,19 +135,19 @@ public class ResourceService implements IResourceService {
respMap.put("statusCode", 811); respMap.put("statusCode", 811);
respMap.put("message", "Resource is already allocated after "+latestAllocation.getBillingStartDate()); respMap.put("message", "Resource is already allocated after "+latestAllocation.getBillingStartDate());
}else{ }else{
if (resourceReq.getBillingEndDate().compareTo(new Date()) < 0) { // if (resourceReq.getBillingEndDate().compareTo(new Date()) < 0) {
resourceReq.setStatus(MyTeamUtils.RELEASED_STATUS);//update Status of allocation // resourceReq.setStatus(MyTeamUtils.RELEASED_STATUS);//update Status of allocation
Resource resourceBench = new Resource(); // Resource resourceBench = new Resource();
resourceBench.setProjectId(MyTeamUtils.BENCH_PROJECT_ID); // resourceBench.setProjectId(MyTeamUtils.BENCH_PROJECT_ID);
resourceBench.setEmployeeId(resourceReq.getEmployeeId()); // resourceBench.setEmployeeId(resourceReq.getEmployeeId());
resourceBench.setResourceRole(resourceReq.getResourceRole()); // resourceBench.setResourceRole(resourceReq.getResourceRole());
resourceBench.setStatus(MyTeamUtils.RELEASED_STATUS);//add alocation status as Released // resourceBench.setStatus(MyTeamUtils.RELEASED_STATUS);//add alocation status as Released
resourceBench.setBillingStartDate(MyTeamDateUtils.getDayMoreThanDate(resourceReq.getBillingEndDate())); // resourceBench.setBillingStartDate(MyTeamDateUtils.getDayMoreThanDate(resourceReq.getBillingEndDate()));
resourceBench.setBillingEndDate(projectService.getProjectByProjectId(MyTeamUtils.BENCH_PROJECT_ID).getProjectEndDate()); // resourceBench.setBillingEndDate(projectService.getProjectByProjectId(MyTeamUtils.BENCH_PROJECT_ID).getProjectEndDate());
resourceBench.setBillableStatus(MyTeamUtils.BENCH_BILLABILITY_STATUS); // resourceBench.setBillableStatus(MyTeamUtils.BENCH_BILLABILITY_STATUS);
resourceBench.setAuditFields(loginEmpId, MyTeamUtils.CREATE); // resourceBench.setAuditFields(loginEmpId, MyTeamUtils.CREATE);
resourceRepo.save(resourceBench); // resourceRepo.save(resourceBench);
} // }
this.updateExistedResource(resourceReq); this.updateExistedResource(resourceReq);
} }
}else{ }else{
...@@ -500,11 +500,10 @@ public class ResourceService implements IResourceService { ...@@ -500,11 +500,10 @@ public class ResourceService implements IResourceService {
// Active // Active
if (statusFlag.equals(ResourceStatus.ACTIVE.getStatus()) && billingEndDate.compareTo(new Date()) >= 0 && if (statusFlag.equals(ResourceStatus.ACTIVE.getStatus()) && resource.getStatus().equals(MyTeamUtils.STATUS_ENGAGED)) {
!resource.getStatus().equals(MyTeamUtils.STATUS_PROPOSED)) {
resourceVO.setResourceStatus(ResourceStatus.ACTIVE.getStatus()); resourceVO.setResourceStatus(ResourceStatus.ACTIVE.getStatus());
resourcesList.add(resourceVO); resourcesList.add(resourceVO);
} else if (statusFlag.equals(ResourceStatus.IN_ACTIVE.getStatus()) && billingEndDate.compareTo(new Date()) < 0) { } else if (statusFlag.equals(ResourceStatus.IN_ACTIVE.getStatus()) && resource.getStatus().equals(MyTeamUtils.RELEASED_STATUS)) {
resourceVO.setResourceStatus(ResourceStatus.IN_ACTIVE.getStatus()); resourceVO.setResourceStatus(ResourceStatus.IN_ACTIVE.getStatus());
resourcesList.add(resourceVO); resourcesList.add(resourceVO);
} else if (statusFlag.equals(MyTeamUtils.STATUS_PROPOSED) && resource.getStatus().equals(MyTeamUtils.STATUS_PROPOSED)){ } else if (statusFlag.equals(MyTeamUtils.STATUS_PROPOSED) && resource.getStatus().equals(MyTeamUtils.STATUS_PROPOSED)){
......
...@@ -14,7 +14,7 @@ public class MyTeamUtils { ...@@ -14,7 +14,7 @@ public class MyTeamUtils {
//public final static String driverUrl = "jdbc:ucanaccess://"; //public final static String driverUrl = "jdbc:ucanaccess://";
//public final static String msdriveUrl ="jdbc:sqlserver://"; //public final static String msdriveUrl ="jdbc:sqlserver://";
public final static String RELEASED_STATUS="Released"; public final static String RELEASED_STATUS="Released";
public final static String Engaged_STATUS="Engaged"; public final static String STATUS_ENGAGED ="Engaged";
public static final String STATUS_PROPOSED ="Proposed" ; public static final String STATUS_PROPOSED ="Proposed" ;
public final static DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); public final static DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
......
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