Commit 8363d5f6 by 刘鑫

fix(工程师时间片容量): 时间片容量存在负值情况, 修订计算订单与休息时间时进行已用时间段并集运算,避免重复时间交叉计算

1 parent 049f4fd0
......@@ -2,6 +2,7 @@ package com.dituhui.pea.order.common.jackson;
import com.dituhui.pea.order.common.DateSplit;
import com.dituhui.pea.order.common.OccupyInfo;
import com.dituhui.pea.order.common.OccupyInfoDetail;
import lombok.experimental.UtilityClass;
import org.springframework.util.Assert;
......@@ -490,14 +491,14 @@ public class DateUtil {
// 计算两个时间片的交集
public OccupyInfo intersection(LocalDateTime dynaStartTime, LocalDateTime dynaEndTime,
public OccupyInfoDetail intersection(LocalDateTime dynaStartTime, LocalDateTime dynaEndTime,
LocalDateTime fixedStartTime, LocalDateTime fixedEndTime) {
// 如果两个时间片没有交集,返回null
if (!checkTimesHasOverlap(dynaStartTime, dynaEndTime, fixedStartTime, fixedEndTime)) {
return null;
}
// 否则,返回一个新的时间片,其开始时间是两个时间片中较晚的开始时间,其结束时间是两个时间片中较早的结束时间
return new OccupyInfo(dynaStartTime.isAfter(fixedStartTime) ? dynaStartTime : fixedStartTime,
return new OccupyInfoDetail(dynaStartTime.isAfter(fixedStartTime) ? dynaStartTime : fixedStartTime,
dynaEndTime.isBefore(fixedEndTime) ? dynaEndTime : fixedEndTime);
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!