Commit 04a30973 by 刘鑫

Merge branch 'develop' of https://gitlab.dituhui.com/bsh/project/project into develop

2 parents 3bf5db3f 978f483f
......@@ -13,10 +13,12 @@ public class OrderServiceListReq {
private String levelType;
@NotNull
private String levelValue;
// @NotNull
// private String startDate;
// @NotNull
// private String endDate;
@NotNull
private String startDate;
@NotNull
private String endDate;
private String date;
@NotNull
private long page;
@NotNull
......
......@@ -460,11 +460,13 @@ public class OrderInfoServiceImpl implements OrderInfoService {
LocalDateTime workStartTime = insertOrder.getExpectTimeBegin();
LocalDateTime workEndTime = insertOrder.getExpectTimeEnd();
//查询工程师当天出勤时间
List<OccupyInfoDetail> engineerWorkTimeSlice = engineerCalendarService.timeWindowsSlice(engineer.getEngineerCode(), orgTeam.getTeamId(), insertOrder.getDt());
log.info("【engineerWorkTimeSlice】结果------------->{}", JsonUtil.toJson(engineerWorkTimeSlice));
// List<OccupyInfoDetail> engineerWorkTimeSlice = engineerCalendarService.timeWindowsSlice(engineer.getEngineerCode(), orgTeam.getTeamId(), insertOrder.getDt());
//查询工程师当天请假时间
List<OccupyInfoDetail> engineerLeaveTimeSlice = engineerCalendarService.getEngineerWorkDayCalendar(engineer.getEngineerCode(), insertOrder.getDt());
log.info("【engineerWorkTimeSlice】结果------------->{}", JsonUtil.toJson(engineerLeaveTimeSlice));
// 没有单直接返回
if (CollectionUtils.isEmpty(engineerOrders)) {
LocalDateTime planStartTime = handleWorkTime(engineerWorkTimeSlice, insertOrder.getExpectTimeBegin(), insertOrder.getExpectTimeBegin().plusMinutes(skillInfo.getTakeTime()));
LocalDateTime planStartTime = handleLeaveTime(engineerLeaveTimeSlice, insertOrder.getExpectTimeBegin(), insertOrder.getExpectTimeEnd(), skillInfo.getTakeTime());
if (ObjectUtil.isNull(planStartTime)) {
return Result.failed(insertOrder);
}
......@@ -493,7 +495,7 @@ public class OrderInfoServiceImpl implements OrderInfoService {
}
// 没有单直接返回
if (CollectionUtils.isEmpty(orderSegments)) {
LocalDateTime planStartTime = handleWorkTime(engineerWorkTimeSlice, insertOrder.getExpectTimeBegin(), insertOrder.getExpectTimeBegin().plusMinutes(skillInfo.getTakeTime()));
LocalDateTime planStartTime = handleLeaveTime(engineerLeaveTimeSlice, insertOrder.getExpectTimeBegin(), insertOrder.getExpectTimeEnd(), skillInfo.getTakeTime());
if (ObjectUtil.isNull(planStartTime)) {
return Result.failed(insertOrder);
}
......@@ -515,7 +517,7 @@ public class OrderInfoServiceImpl implements OrderInfoService {
int roadTime = distanceDTO.getTime() / 1000;
// 先判断第一单开始时间
if (i == 0 && orderSegment.getStart().compareTo(workStartTime.plusMinutes(takeTime + roadTime)) >= 0) {
LocalDateTime planStartTime = handleWorkTime(engineerWorkTimeSlice, insertOrder.getExpectTimeBegin(), insertOrder.getExpectTimeBegin().plusMinutes(skillInfo.getTakeTime()));
LocalDateTime planStartTime = handleLeaveTime(engineerLeaveTimeSlice, insertOrder.getExpectTimeBegin(), insertOrder.getExpectTimeEnd(), skillInfo.getTakeTime());
if (ObjectUtil.isNull(planStartTime)) {
return Result.failed(insertOrder);
}
......@@ -538,11 +540,11 @@ public class OrderInfoServiceImpl implements OrderInfoService {
// 判断工单开始时间
LocalDateTime planStartTime = insertOrder.getExpectTimeBegin().compareTo(orderSegment.getEnd().plusMinutes(roadTime)) >= 0 ?
insertOrder.getExpectTimeBegin() : orderSegment.getEnd().plusMinutes(roadTime);
planStartTime = handleWorkTime(engineerWorkTimeSlice, planStartTime, planStartTime.plusMinutes(skillInfo.getTakeTime()));
planStartTime = handleLeaveTime(engineerLeaveTimeSlice, planStartTime, insertOrder.getExpectTimeEnd(), skillInfo.getTakeTime());
if (ObjectUtil.isNull(planStartTime)) {
return Result.failed(insertOrder);
}
insertOrder.setArriveDistance(roadTime);
insertOrder.setArriveElapsed(roadTime);
insertOrder.setArriveDistance(BigDecimal.valueOf(distanceDTO.getDis() * 1000).intValue());
insertOrder.setTakeTime(skillInfo.getTakeTime());
insertOrder.setPlanStartTime(planStartTime);
......@@ -561,19 +563,19 @@ public class OrderInfoServiceImpl implements OrderInfoService {
// 判断工单开始时间
LocalDateTime planStartTime = insertOrder.getExpectTimeBegin().compareTo(orderSegment.getEnd().plusMinutes(roadTime)) >= 0 ?
insertOrder.getExpectTimeBegin() : orderSegment.getEnd().plusMinutes(roadTime);
planStartTime = handleWorkTime(engineerWorkTimeSlice, planStartTime, planStartTime.plusMinutes(skillInfo.getTakeTime()));
planStartTime = handleLeaveTime(engineerLeaveTimeSlice, planStartTime, insertOrder.getExpectTimeEnd(), skillInfo.getTakeTime());
if (ObjectUtil.isNull(planStartTime)) {
return Result.failed(insertOrder);
}
insertOrder.setArriveDistance(roadTime);
insertOrder.setArriveElapsed(roadTime);
insertOrder.setArriveDistance(BigDecimal.valueOf(distanceDTO.getDis() * 1000).intValue());
insertOrder.setTakeTime(skillInfo.getTakeTime());
insertOrder.setPlanStartTime(planStartTime);
insertOrder.setPlanEndTime(planStartTime.plusMinutes(skillInfo.getTakeTime()));
OrderInfoEntity nestOrder = orderInfoDao.getByOrderId(nestOrderSegment.getOrderId());
nestOrder.setArriveDistance(roadResult2.getResult().getTime() / 1000);
nestOrder.setArriveElapsed(BigDecimal.valueOf(roadResult2.getResult().getDis() * 1000).intValue());
nestOrder.setArriveElapsed(roadResult2.getResult().getTime() / 1000);
nestOrder.setArriveDistance(BigDecimal.valueOf(roadResult2.getResult().getDis() * 1000).intValue());
orderInfoDao.save(nestOrder);
return Result.success(insertOrder);
}
......@@ -582,6 +584,32 @@ public class OrderInfoServiceImpl implements OrderInfoService {
}
/**
* 处理工程师请假时间和工单计划开始时间
*
* @param engineerLeaveTimeSlice
* @param expectTimeBegin
* @param expectTimeEnd
* @return 工单计划开始时间
*/
private LocalDateTime handleLeaveTime(List<OccupyInfoDetail> engineerLeaveTimeSlice, LocalDateTime expectTimeBegin, LocalDateTime expectTimeEnd, Integer takeTime) {
if (CollectionUtils.isEmpty(engineerLeaveTimeSlice)) {
return expectTimeBegin;
}
for (int i = 0; i < engineerLeaveTimeSlice.size(); i++) {
OccupyInfoDetail occupyInfoDetail = engineerLeaveTimeSlice.get(i);
// 处理请假开始时间
if (expectTimeBegin.plusMinutes(takeTime).compareTo(occupyInfoDetail.getBeginTime()) <= 0) {
return expectTimeBegin;
}
if (expectTimeEnd.compareTo(occupyInfoDetail.getEndTime().plusMinutes(takeTime)) >= 0) {
return expectTimeBegin.compareTo(occupyInfoDetail.getEndTime()) >= 0 ? expectTimeBegin : occupyInfoDetail.getEndTime();
}
return null;
}
return null;
}
/**
* 处理工程师出勤时间和工单计划开始时间
*
* @param engineerWorkTimeSlice
......@@ -589,16 +617,18 @@ public class OrderInfoServiceImpl implements OrderInfoService {
* @param expectTimeEnd
* @return 工单计划开始时间
*/
private LocalDateTime handleWorkTime(List<OccupyInfoDetail> engineerWorkTimeSlice, LocalDateTime expectTimeBegin, LocalDateTime expectTimeEnd) {
private LocalDateTime handleWorkTime(List<OccupyInfoDetail> engineerWorkTimeSlice, LocalDateTime expectTimeBegin, LocalDateTime expectTimeEnd, Integer takeTime) {
if (CollectionUtils.isEmpty(engineerWorkTimeSlice)) {
return null;
}
for (int i = 0; i < engineerWorkTimeSlice.size(); i++) {
OccupyInfoDetail occupyInfoDetail = engineerWorkTimeSlice.get(i);
if (expectTimeBegin.compareTo(occupyInfoDetail.getBeginTime()) < 0 || expectTimeEnd.compareTo(occupyInfoDetail.getEndTime()) > 0) {
LocalDateTime planStartTime = expectTimeBegin.compareTo(occupyInfoDetail.getBeginTime()) >= 0 ? expectTimeBegin : occupyInfoDetail.getBeginTime();
LocalDateTime planEndTime = expectTimeEnd.compareTo(occupyInfoDetail.getEndTime()) <= 0 ? expectTimeEnd : occupyInfoDetail.getEndTime();
if (planStartTime.plusMinutes(takeTime).compareTo(planEndTime) > 0) {
continue;
}
return expectTimeBegin.compareTo(occupyInfoDetail.getBeginTime()) >= 0 ? expectTimeBegin : occupyInfoDetail.getBeginTime();
return planStartTime;
}
return null;
}
......
......@@ -44,15 +44,11 @@ public class OrderServiceListServiceImpl implements OrderServiceListService {
//分页
Page<OrderInfo> pg = new Page(reqDTO.getPage(), reqDTO.getSize());
LocalDate startDate = TimeUtils.IsoDate2LocalDate(reqDTO.getStartDate());
LocalDate endDate = TimeUtils.IsoDate2LocalDate(reqDTO.getEndDate());
LambdaQueryWrapper<OrderInfo> lqw = new LambdaQueryWrapper<>();
lqw.eq(reqDTO.getLevelType().equals("cluster"), OrderInfo::getOrgClusterId, reqDTO.getLevelValue());
lqw.eq(reqDTO.getLevelType().equals("branch"), OrderInfo::getOrgBranchId, reqDTO.getLevelValue());
lqw.eq(reqDTO.getLevelType().equals("group"), OrderInfo::getOrgGroupId, reqDTO.getLevelValue());
lqw.ge(OrderInfo::getDt, startDate); //预约开始日期
lqw.le(OrderInfo::getDt, endDate); //预约开始日期
lqw.eq(OrderInfo::getDt, reqDTO.getDate()); //预约开始日期
//筛选项
if (StringUtils.isNotBlank(reqDTO.getOrderId())) {
lqw.in(StringUtils.isNotEmpty(reqDTO.getOrderId()), OrderInfo::getOrderId, reqDTO.getOrderId().split(","));
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!