Commit a34d57f7 authored by Md Suleman's avatar Md Suleman

small fixes in effective time period

parent 5a24c359
......@@ -10,6 +10,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import javax.transaction.Transactional;
import java.util.List;
@Component
......@@ -23,6 +24,7 @@ public class EffectiveLoginTimeScheduler {
@Scheduled(cron = "${effective.login.time.cron}")
@Transactional
public void calculateLoginTime() throws MyTeamException {
List<Employee> allEmployees = employeeService.getActiveEmployees();
for(Employee employee:allEmployees){
......
......@@ -9,6 +9,7 @@ import com.nisum.myteam.service.IEffectiveLoginTimeService;
import com.nisum.myteam.utils.CommomUtil;
import com.nisum.myteam.utils.MyTeamLogger;
import com.nisum.myteam.utils.MyTeamUtils;
import lombok.extern.slf4j.Slf4j;
import org.assertj.core.util.Strings;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -20,6 +21,7 @@ import java.sql.Time;
import java.text.ParseException;
import java.util.*;
@Slf4j
@Service
public class EffectiveLoginTimeService implements IEffectiveLoginTimeService {
......@@ -61,6 +63,8 @@ public class EffectiveLoginTimeService implements IEffectiveLoginTimeService {
effectiveLoginData.setEmployeeId(employeeLoginData.getEmployeeId());
effectiveLoginData.setDate(employeeLoginData.getDate());
effectiveLoginData.setLoginTime(employeeLoginData.getTime().toString());
if(entryType.equals("OUT"))
effectiveLoginData.getOrphanLogin().add("OUT-"+employeeLoginData.getTime().toString());
}
if(entryType.equals("IN") && employeeLoginData.getEntryType().equals("OUT")){
differenceTime = employeeLoginData.getTime().getTime() - time;
......@@ -72,9 +76,7 @@ public class EffectiveLoginTimeService implements IEffectiveLoginTimeService {
entryType = employeeLoginData.getEntryType();
}
if(Objects.nonNull(effectiveLoginData)){
if(!Strings.isNullOrEmpty(times.toString()))
times.deleteCharAt(times.length()-1);
// effectiveLoginData.setOrphanLogin(times.toString());
log.info("Storing effective login time for employee:{}",effectiveLoginData.getEmployeeId());
effectiveLoginDataRepo.save(effectiveLoginData);
}
......
......@@ -69,6 +69,7 @@ email.workAnniversary.notification.from=mytime.nisum@gmail.com
email.workAnniversary.notification.subject=Happy Work Anniversary
email.workAnniversary.notification.cron=00 00 06 * * 1-7
effective.login.time.cron=00 05 00 * * 1-7
email.holidays.list.2020=01-01-2020,15-01-2020,25-03-2020,10-04-2020,25-05-2020,02-06-2020,31-07-2020,02-10-2020,26-10-2020,25-12-2020
......
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