Commit c9926b1d authored by Md Suleman's avatar Md Suleman

Sub status service changes

parent b5b23ffa
...@@ -9,6 +9,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -9,6 +9,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.Date; import java.util.Date;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -18,6 +19,8 @@ public class SubStatusService implements ISubStatusService { ...@@ -18,6 +19,8 @@ public class SubStatusService implements ISubStatusService {
@Autowired @Autowired
private EmployeeSubStatusRepo employeeSubStatusRepo; private EmployeeSubStatusRepo employeeSubStatusRepo;
public HashMap<String, Object> respMap = new HashMap<>();
@Override @Override
public EmployeeSubStatus getLatestEmployeeSubStatus(String empId) { public EmployeeSubStatus getLatestEmployeeSubStatus(String empId) {
...@@ -72,4 +75,18 @@ public class SubStatusService implements ISubStatusService { ...@@ -72,4 +75,18 @@ public class SubStatusService implements ISubStatusService {
return null; return null;
} }
public boolean isDatesValid(EmployeeSubStatus subStatus){
boolean isValid = false;
List<EmployeeSubStatus> subStatusList = employeeSubStatusRepo.findByEmployeeID(subStatus.getEmployeeID());
List<EmployeeSubStatus> matchedList = subStatusList.stream().filter(s -> (s.getFromDate().compareTo(subStatus.getFromDate())<=0 && s.getToDate().compareTo(subStatus.getFromDate())>=0) &&
(s.getFromDate().compareTo(subStatus.getToDate())<=0 && s.getToDate().compareTo(subStatus.getToDate())>=0)).collect(Collectors.toList());
if(!matchedList.isEmpty()){
//resource is already on substatus on these days
}else{
isValid = true;
}
return isValid;
}
} }
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