From 8f12443eeef0ad02cbd58587aeaee63568c7ebd6 Mon Sep 17 00:00:00 2001
From: yaozc <unbelievers@yeah.net>
Date: Wed, 22 Feb 2023 09:18:26 +0000
Subject: [PATCH] BUG改修

---
 eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/service/impl/ProjectCostServiceImpl.java |   24 ++++++++++++------------
 1 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/service/impl/ProjectCostServiceImpl.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/service/impl/ProjectCostServiceImpl.java
index b9f0190..90ed71f 100644
--- a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/service/impl/ProjectCostServiceImpl.java
+++ b/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);
         	}

--
Gitblit v1.9.3