yaozc
2023-02-22 8f12443eeef0ad02cbd58587aeaee63568c7ebd6
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/service/impl/ProjectCostServiceImpl.java
@@ -341,18 +341,7 @@
           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());
@@ -363,6 +352,17 @@
              } 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);
           }