Commit b7a21942 by huangjinxin

Merge remote-tracking branch 'origin/develop' into develop

2 parents 84c9d6f7 0a89d6ba
......@@ -101,8 +101,26 @@ public class CapacityUtils {
// 工单已使用的时间片
List<OccupyInfoDetail> order = Optional.ofNullable(orders).orElse(Collections.emptyList())
.stream()
.filter(t -> DateUtil.checkTimesHasOverlap(t.getPlanStartTime(), t.getPlanEndTime(), startTime, endTime))
.map(e -> DateUtil.intersection(e.getPlanStartTime(), e.getPlanEndTime(), startTime, endTime))
.filter(t -> {
String serviceStatus = t.getServiceStatus();
LocalDateTime checkStartTime = t.getPlanStartTime();
LocalDateTime checkEndTime = t.getPlanEndTime();
if (Objects.equals(serviceStatus, "FINISHED")) {
checkStartTime = t.getActualStartTime();
checkEndTime = t.getActualEndTime();
}
return DateUtil.checkTimesHasOverlap(checkStartTime, checkEndTime, startTime, endTime);
})
.map(e -> {
String serviceStatus = e.getServiceStatus();
LocalDateTime checkStartTime = e.getPlanStartTime();
LocalDateTime checkEndTime = e.getPlanEndTime();
if (Objects.equals(serviceStatus, "FINISHED")) {
checkStartTime = e.getActualStartTime();
checkEndTime = e.getActualEndTime();
}
return DateUtil.intersection(checkStartTime, checkEndTime, startTime, endTime);
})
.collect(Collectors.toList());
List<OccupyInfoDetail> resultList = Stream.of(calendar, order).flatMap(Collection::stream).collect(Collectors.toList());
......
......@@ -31,6 +31,7 @@ import java.time.LocalTime;
import java.time.ZoneId;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
......@@ -84,8 +85,9 @@ public class CalcEngineerCapacityScheduler {
return;
}
Set<String> ss = Set.of("CANCELED", "RESCHEDULED");
List<OrderInfoEntity> orders = orderInfoDao.findByDtAndEngineerCode(DateUtils.localDateFromStr(date), engineerCode);
final LocalDate nowDate = DateUtils.localDateFromStr(date);
Set<String> ss = Set.of("CANCELED");
List<OrderInfoEntity> orders = orderInfoDao.findByDtAndEngineerCode(nowDate, engineerCode);
// 根据capacity_engineer_calendar和order_info,来确定当天剩下的最大连续时间区块;
EngineerBusinessEntity businessEntity = engineerBusinessDao.getByEngineerCode(engineerCode);
// 就算单小时时间段工程师技能已用容量存储至时间切片工程师时间表内
......@@ -95,6 +97,15 @@ public class CalcEngineerCapacityScheduler {
orders = Optional.ofNullable(orders).orElse(Collections.emptyList())
.stream()
.filter(e -> !ss.contains(e.getOrderStatus()))
.filter(order -> {
if (!"RESCHEDULED".equals(order.getServiceStatus())) {
return true;
}
if (Objects.equals(nowDate, order.getPlanStartTime().toLocalDate())) {
return true;
}
return false;
})
.collect(Collectors.toList());
initOneEngineerTimeSlot(date, engineerCode, configs, orders);
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!