| | |
| | | Double costHours = 0.0; |
| | | SysRosteringDto sysRostering = user.getSysRostering(); |
| | | |
| | | if (currentLocalDate.isEqual(enterProject.toLocalDate())) { |
| | | if (enterProject.toLocalTime().compareTo(sysRostering.getWorkStartTime()) <= 0) { |
| | | costHours = costHours + sysRostering.getLunchEndTime().until(sysRostering.getWorkEndTime(), ChronoUnit.HOURS) + sysRostering.getWorkStartTime().until(sysRostering.getLunchStartTime(), ChronoUnit.HOURS); |
| | | } else if (enterProject.toLocalTime().compareTo(sysRostering.getWorkStartTime()) > 0 && enterProject.toLocalTime().compareTo(sysRostering.getLunchStartTime()) <= 0) { |
| | | costHours = costHours + sysRostering.getLunchEndTime().until(sysRostering.getWorkEndTime(), ChronoUnit.HOURS) + enterProject.toLocalTime().until(sysRostering.getLunchStartTime(), ChronoUnit.HOURS); |
| | | } else if (enterProject.toLocalTime().compareTo(sysRostering.getLunchStartTime()) > 0 && enterProject.toLocalTime().compareTo(sysRostering.getWorkEndTime()) < 0) { |
| | | if (enterProject.toLocalTime().compareTo(sysRostering.getLunchEndTime()) < 0) { |
| | | enterProject = enterProject.with(sysRostering.getLunchEndTime()); |
| | | } |
| | | costHours = costHours + enterProject.toLocalTime().until(sysRostering.getWorkEndTime(), ChronoUnit.HOURS); |
| | | } |
| | | } else if (currentLocalDate.isEqual(exitProject.toLocalDate())) { |
| | | if (currentLocalDate.isEqual(exitProject.toLocalDate())) { |
| | | if (exitProject.toLocalTime().compareTo(sysRostering.getWorkStartTime()) > 0 && exitProject.toLocalTime().compareTo(sysRostering.getLunchEndTime()) <= 0) { |
| | | if (exitProject.toLocalTime().compareTo(sysRostering.getLunchStartTime()) > 0) { |
| | | exitProject = exitProject.with(sysRostering.getLunchStartTime()); |
| | |
| | | } else if (exitProject.toLocalTime().compareTo(sysRostering.getWorkEndTime()) >= 0) { |
| | | costHours = costHours + sysRostering.getLunchEndTime().until(sysRostering.getWorkEndTime(), ChronoUnit.HOURS) + sysRostering.getWorkStartTime().until(sysRostering.getLunchStartTime(), ChronoUnit.HOURS); |
| | | } |
| | | } else if (currentLocalDate.isEqual(enterProject.toLocalDate())) { |
| | | if (enterProject.toLocalTime().compareTo(sysRostering.getWorkStartTime()) <= 0) { |
| | | costHours = costHours + sysRostering.getLunchEndTime().until(sysRostering.getWorkEndTime(), ChronoUnit.HOURS) + sysRostering.getWorkStartTime().until(sysRostering.getLunchStartTime(), ChronoUnit.HOURS); |
| | | } else if (enterProject.toLocalTime().compareTo(sysRostering.getWorkStartTime()) > 0 && enterProject.toLocalTime().compareTo(sysRostering.getLunchStartTime()) <= 0) { |
| | | costHours = costHours + sysRostering.getLunchEndTime().until(sysRostering.getWorkEndTime(), ChronoUnit.HOURS) + enterProject.toLocalTime().until(sysRostering.getLunchStartTime(), ChronoUnit.HOURS); |
| | | } else if (enterProject.toLocalTime().compareTo(sysRostering.getLunchStartTime()) > 0 && enterProject.toLocalTime().compareTo(sysRostering.getWorkEndTime()) < 0) { |
| | | if (enterProject.toLocalTime().compareTo(sysRostering.getLunchEndTime()) < 0) { |
| | | enterProject = enterProject.with(sysRostering.getLunchEndTime()); |
| | | } |
| | | costHours = costHours + enterProject.toLocalTime().until(sysRostering.getWorkEndTime(), ChronoUnit.HOURS); |
| | | } |
| | | } else { |
| | | costHours = costHours + sysRostering.getLunchEndTime().until(sysRostering.getWorkEndTime(), ChronoUnit.HOURS) + sysRostering.getWorkStartTime().until(sysRostering.getLunchStartTime(), ChronoUnit.HOURS); |
| | | } |