Commit 12cafb4f by 丁伟峰

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

2 parents bab426df fc17f03a
...@@ -15,9 +15,9 @@ public interface DispatchOrderRepository extends CrudRepository<DispatchOrder, L ...@@ -15,9 +15,9 @@ public interface DispatchOrderRepository extends CrudRepository<DispatchOrder, L
List<DispatchOrder> findNotAssigned(String groupId, String batchNo); List<DispatchOrder> findNotAssigned(String groupId, String batchNo);
// 查看算法指派成功非confirm状态的 // 查看算法指派成功(也有抹掉技术员、时间情况),非confirm状态的
@Query("from DispatchOrder where groupId=?1 and batchNo=?2 and status !='CONFIRM' and ( engineerCode is not null and engineerCode!='') ") @Query("from DispatchOrder where groupId=?1 and batchNo=?2 and status !='CONFIRM' ")
List<DispatchOrder> findAssigned(String groupId, String batchNo); List<DispatchOrder> findAllWithoutConfirm(String groupId, String batchNo);
Optional<DispatchOrder> findByGroupIdAndBatchNoAndOrderIdAndDt(String groupId, String batchNo, String orderId, String dt); Optional<DispatchOrder> findByGroupIdAndBatchNoAndOrderIdAndDt(String groupId, String batchNo, String orderId, String dt);
} }
\ No newline at end of file
...@@ -5,9 +5,10 @@ import cn.hutool.core.date.DateUtil; ...@@ -5,9 +5,10 @@ import cn.hutool.core.date.DateUtil;
import com.dituhui.pea.dispatch.dao.*; import com.dituhui.pea.dispatch.dao.*;
import com.dituhui.pea.dispatch.entity.*; import com.dituhui.pea.dispatch.entity.*;
import com.dituhui.pea.dispatch.service.ExtractService; import com.dituhui.pea.dispatch.service.ExtractService;
import com.mysql.cj.util.StringUtils; import cn.hutool.core.util.StrUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.aspectj.weaver.ast.Or; import org.aspectj.weaver.ast.Or;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -73,7 +74,7 @@ public class ExtractServiceImpl implements ExtractService { ...@@ -73,7 +74,7 @@ public class ExtractServiceImpl implements ExtractService {
Map<String, EngineerInfo> engineerInfoMap = engineerInfoRepo.findByGroupId(groupId).stream().collect(Collectors.toMap(EngineerInfo::getEngineerCode, y -> y)); Map<String, EngineerInfo> engineerInfoMap = engineerInfoRepo.findByGroupId(groupId).stream().collect(Collectors.toMap(EngineerInfo::getEngineerCode, y -> y));
List<DispatchOrder> dispatchOrderList = dispatchOrderRepo.findAssigned(groupId, batchNo); List<DispatchOrder> dispatchOrderList = dispatchOrderRepo.findAllWithoutConfirm(groupId, batchNo);
log.info("算法结果更新到工单, step1-开始处理, groupId:{}, batchNo:{}, order-size:{}", groupId, batchNo, dispatchOrderList.size()); log.info("算法结果更新到工单, step1-开始处理, groupId:{}, batchNo:{}, order-size:{}", groupId, batchNo, dispatchOrderList.size());
...@@ -81,8 +82,9 @@ public class ExtractServiceImpl implements ExtractService { ...@@ -81,8 +82,9 @@ public class ExtractServiceImpl implements ExtractService {
dispatchOrderList.forEach(dispatchOrder -> { dispatchOrderList.forEach(dispatchOrder -> {
int idx = atomicInteger.getAndIncrement(); int idx = atomicInteger.getAndIncrement();
String orderId = dispatchOrder.getOrderId(); String orderId = dispatchOrder.getOrderId();
String engCode = dispatchOrder.getEngineerCode();
String dt = dispatchOrder.getDt(); String dt = dispatchOrder.getDt();
String engCode = dispatchOrder.getEngineerCode();
log.info("算法结果更新到工单, step1.1-loop, {}/{}, groupId:{}, batchNo:{}, orderId:{}, dt:{}, engCode:{}", log.info("算法结果更新到工单, step1.1-loop, {}/{}, groupId:{}, batchNo:{}, orderId:{}, dt:{}, engCode:{}",
idx, dispatchOrderList.size(), groupId, batchNo, orderId, dt, engCode); idx, dispatchOrderList.size(), groupId, batchNo, orderId, dt, engCode);
...@@ -99,52 +101,66 @@ public class ExtractServiceImpl implements ExtractService { ...@@ -99,52 +101,66 @@ public class ExtractServiceImpl implements ExtractService {
if (!("OPEN".equals(orderInfo.getBeanStatus()) && if (!("OPEN".equals(orderInfo.getBeanStatus()) &&
Set.of("AUTO_NOW", "AUTO_BATCH").contains(orderInfo.getAppointmentMethod()) && Set.of("AUTO_NOW", "AUTO_BATCH").contains(orderInfo.getAppointmentMethod()) &&
Set.of("INIT", "VIRTUAL", "PRE").contains(orderInfo.getAppointmentStatus()) && Set.of("INIT", "VIRTUAL", "PRE").contains(orderInfo.getAppointmentStatus()) &&
"NORMAL".equals(orderInfo.getOrderStatus()) && "NORMAL".equals(orderInfo.getOrderStatus()) && "INIT".equals(orderInfo.getServiceStatus()))) {
"INIT".equals(orderInfo.getServiceStatus())
)) {
log.warn("算法结果更新到工单, step1.1-loop, 工单状态异常, groupId:{}, batchNo:{}, orderId:{}, bean-status:{}, appointment-status:{}, order-status:{}, service-status:{}", log.warn("算法结果更新到工单, step1.1-loop, 工单状态异常, groupId:{}, batchNo:{}, orderId:{}, bean-status:{}, appointment-status:{}, order-status:{}, service-status:{}",
groupId, batchNo, orderId, orderInfo.getBeanStatus(), orderInfo.getAppointmentStatus(), orderInfo.getOrderStatus(), orderInfo.getServiceStatus()); groupId, batchNo, orderId, orderInfo.getBeanStatus(), orderInfo.getAppointmentStatus(), orderInfo.getOrderStatus(), orderInfo.getServiceStatus());
return; return;
} }
// 未分配技术员时,清理原分配的信息
EngineerInfo engineerInfo = engineerInfoMap.get(engCode); if (!StrUtil.isEmpty(engCode)) {
if (engineerInfo == null) { EngineerInfo engineerInfo = engineerInfoMap.get(engCode);
log.warn("算法结果更新到工单, step1.1-loop, 未找到技术员, groupId:{}, batchNo:{}, engCode:{}", if (engineerInfo == null) {
groupId, batchNo, engCode); log.warn("算法结果更新到工单, step1.1-loop, 未找到技术员, groupId:{}, batchNo:{}, engCode:{}",
return; groupId, batchNo, engCode);
} return;
String engName = engineerInfo.getName(); }
String phone = engineerInfo.getPhone(); String engName = engineerInfo.getName();
/*int age = 0; String phone = engineerInfo.getPhone();
if (!StringUtils.isNullOrEmpty(engineerInfo.getBirth())) { /*int age = 0;
DateTime birthDate = DateUtil.parse(engineerInfo.getBirth(), "yyyy-MM-dd"); if (!StringUtils.isNullOrEmpty(engineerInfo.getBirth())) {
age = DateUtil.age(birthDate.toJdkDate(), DateUtil.date()); DateTime birthDate = DateUtil.parse(engineerInfo.getBirth(), "yyyy-MM-dd");
}*/ age = DateUtil.age(birthDate.toJdkDate(), DateUtil.date());
}*/
orderInfo.setEngineerCode(engCode);
orderInfo.setEngineerName(engName); orderInfo.setEngineerCode(engCode);
orderInfo.setEngineerPhone(phone); orderInfo.setEngineerName(engName);
orderInfo.setPlanStartTime(dispatchOrder.getTimeBegin()); orderInfo.setEngineerPhone(phone);
orderInfo.setPlanEndTime(dispatchOrder.getTimeEnd()); orderInfo.setPlanStartTime(dispatchOrder.getTimeBegin());
orderInfo.setArriveElapsed(dispatchOrder.getPathTime()); orderInfo.setPlanEndTime(dispatchOrder.getTimeEnd());
orderInfo.setArriveDistance(dispatchOrder.getPathDistance()); orderInfo.setArriveElapsed(dispatchOrder.getPathTime());
orderInfo.setAppointmentStatus(isConfirm ? "CONFIRM" : "PRE"); orderInfo.setArriveDistance(dispatchOrder.getPathDistance());
orderInfo.setUpdateTime(LocalDateTime.now()); orderInfo.setAppointmentStatus(isConfirm ? "CONFIRM" : "PRE");
orderInfoRepo.save(orderInfo); orderInfo.setUpdateTime(LocalDateTime.now());
orderInfoRepo.save(orderInfo);
OrderLog orderLog = new OrderLog().setOrderId(orderId).setSuborderId(orderInfo.getSubId()).setSource("PEA-DISPATCH").setOperator("DISPATCH")
.setContent(String.format("批量自动指派:<%s,%s>", engCode, engName)).setContentOld("") if (isConfirm) {
.setMemo("批量自动指派").setCreateTime(LocalDateTime.now()).setUpdateTime(LocalDateTime.now()); OrderEvent orderEvent = new OrderEvent().setOrderId(orderId).setSuborderId(orderInfo.getSubId()).setHappen(LocalDateTime.now())
orderLogRepo.save(orderLog); .setEvent("批量自动指派").setOperator("DISPATCH").setOperatorName("算法批量指派").setSource("PEA-DISPATCH")
.setDescription(String.format("批量自动指派:<%s,%s>", engCode, engName)).setMemo("")
if (isConfirm) { .setCreateTime(LocalDateTime.now()).setUpdateTime(LocalDateTime.now());
OrderEvent orderEvent = new OrderEvent().setOrderId(orderId).setSuborderId(orderInfo.getSubId()).setHappen(LocalDateTime.now()) orderEventRepo.save(orderEvent);
.setEvent("批量自动指派").setOperator("DISPATCH").setOperatorName("算法批量指派").setSource("PEA-DISPATCH") }
.setDescription(String.format("批量自动指派:<%s,%s>", engCode, engName)).setMemo("")
.setCreateTime(LocalDateTime.now()).setUpdateTime(LocalDateTime.now()); OrderLog orderLog = new OrderLog().setOrderId(orderId).setSuborderId(orderInfo.getSubId()).setSource("PEA-DISPATCH").setOperator("DISPATCH")
orderEventRepo.save(orderEvent); .setContent(String.format("批量自动指派:<%s,%s>", engCode, engName)).setContentOld("")
.setMemo("批量自动指派").setCreateTime(LocalDateTime.now()).setUpdateTime(LocalDateTime.now());
orderLogRepo.save(orderLog);
} else {
log.warn("算法结果更新到工单, step1.2-loop, 未能分配到技术员, groupId:{}, batchNo:{}, orderId:{}, dt:{}",
groupId, batchNo, orderId, dt);
orderInfo.setEngineerCode("");
orderInfo.setEngineerName("");
orderInfo.setEngineerPhone("");
orderInfo.setPlanStartTime(null);
orderInfo.setPlanEndTime(null);
orderInfo.setArriveElapsed(0);
orderInfo.setArriveDistance(0);
orderInfo.setAppointmentStatus("INIT");
orderInfo.setUpdateTime(LocalDateTime.now());
orderInfoRepo.save(orderInfo);
} }
}); });
......
...@@ -137,7 +137,7 @@ public class SolveServiceImpl implements SolveService { ...@@ -137,7 +137,7 @@ public class SolveServiceImpl implements SolveService {
customerList.add(customer); customerList.add(customer);
}); });
log.info("组织问题对象, customer-list, groupId:{}, batchNo:{}, customer-list:{}", groupId, batchNo, customerList); log.info("组织问题对象, customer-list, groupId:{}, batchNo:{}, customer-list:{}", groupId, batchNo, customerList.size());
// depotlist 技术员中收点列表 // depotlist 技术员中收点列表
ArrayList<Depot> depotList = new ArrayList<Depot>(); ArrayList<Depot> depotList = new ArrayList<Depot>();
...@@ -166,7 +166,6 @@ public class SolveServiceImpl implements SolveService { ...@@ -166,7 +166,6 @@ public class SolveServiceImpl implements SolveService {
log.info("组织问题对象, depotList-list, groupId:{}, batchNo:{}, depotList-list:{}", groupId, batchNo, depotList.size()); log.info("组织问题对象, depotList-list, groupId:{}, batchNo:{}, depotList-list:{}", groupId, batchNo, depotList.size());
log.info("组织问题对象, technician-list, groupId:{}, batchNo:{}, technician-list:{}", groupId, batchNo, technicianList.size()); log.info("组织问题对象, technician-list, groupId:{}, batchNo:{}, technician-list:{}", groupId, batchNo, technicianList.size());
log.info("组织问题对象, technician-list, groupId:{}, batchNo:{}, customer-list:{}", groupId, batchNo, customerList.size());
//locationlist //locationlist
List<Location> locationList = Stream.concat(depotList.stream().map(Depot::getLocation), customerList.stream().map(Customer::getLocation)).collect(Collectors.toList()); List<Location> locationList = Stream.concat(depotList.stream().map(Depot::getLocation), customerList.stream().map(Customer::getLocation)).collect(Collectors.toList());
......
...@@ -54,7 +54,7 @@ class SolveServiceTest { ...@@ -54,7 +54,7 @@ class SolveServiceTest {
SolverConfig solverConfig = new SolverConfig().withSolutionClass(DispatchSolution.class); SolverConfig solverConfig = new SolverConfig().withSolutionClass(DispatchSolution.class);
solverConfig.withEntityClassList(Arrays.asList(Technician.class, Customer.class));// 这里不能漏掉,否则约束不生效 solverConfig.withEntityClassList(Arrays.asList(Technician.class, Customer.class));// 这里不能漏掉,否则约束不生效
solverConfig.withConstraintProviderClass(DispatchConstraintProvider.class); solverConfig.withConstraintProviderClass(DispatchConstraintProvider.class);
solverConfig.withTerminationSpentLimit(Duration.ofSeconds(20)); solverConfig.withTerminationSpentLimit(Duration.ofSeconds(10));
solverFactory = SolverFactory.create(solverConfig); solverFactory = SolverFactory.create(solverConfig);
......
package com.dituhui.pea.order.common; package com.dituhui.pea.order.common;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.dituhui.pea.order.dao.*; import com.dituhui.pea.order.dao.*;
import com.dituhui.pea.order.entity.*; import com.dituhui.pea.order.entity.*;
import lombok.Data; import lombok.Data;
...@@ -21,11 +22,6 @@ import java.util.stream.Collectors; ...@@ -21,11 +22,6 @@ import java.util.stream.Collectors;
@Component @Component
@Slf4j @Slf4j
public class OrderAssignCheck { public class OrderAssignCheck {
@Autowired
OrderRequestMPDao orderRequestMPDao;
@Autowired
OrderAppointmentMPDao orderAppointmentMPDao;
@Autowired @Autowired
SkillInfoMPDao skillInfoMPDao; SkillInfoMPDao skillInfoMPDao;
...@@ -39,6 +35,9 @@ public class OrderAssignCheck { ...@@ -39,6 +35,9 @@ public class OrderAssignCheck {
@Autowired @Autowired
OrgGroupMPDao orgGroupMPDao; OrgGroupMPDao orgGroupMPDao;
@Autowired
OrderInfoMPDao orderInfoMPDao;
@Data @Data
public class Result { public class Result {
private Boolean canAssign; private Boolean canAssign;
...@@ -63,7 +62,7 @@ public class OrderAssignCheck { ...@@ -63,7 +62,7 @@ public class OrderAssignCheck {
public Result orderAssignCheck(String orderId, String engineerCode) { public Result orderAssignCheck(String orderId, String engineerCode) {
log.info("begin orderAssignCheck:orderId={}, engineerCode={}", orderId, engineerCode); log.info("begin orderAssignCheck:orderId={}, engineerCode={}", orderId, engineerCode);
OrderRequest order = orderRequestMPDao.getByOrderId(orderId); OrderInfo order = orderInfoMPDao.getByOrderId(orderId);
double curX = Double.parseDouble(order.getX()); double curX = Double.parseDouble(order.getX());
double curY = Double.parseDouble(order.getY()); double curY = Double.parseDouble(order.getY());
...@@ -142,33 +141,22 @@ public class OrderAssignCheck { ...@@ -142,33 +141,22 @@ public class OrderAssignCheck {
private List<OrderSegment> getEngineerOrderSegments(String engineerCode, LocalDate dt) { private List<OrderSegment> getEngineerOrderSegments(String engineerCode, LocalDate dt) {
List<OrderSegment> orderSegments = new ArrayList<>(); List<OrderSegment> orderSegments = new ArrayList<>();
List<OrderAppointment> appointments = orderAppointmentMPDao.selectByEngineerCodeAndDt(engineerCode, dt); LambdaQueryWrapper<OrderInfo> lqw = new LambdaQueryWrapper<>();
List<String> orderIds = new ArrayList<>(); lqw.eq(OrderInfo::getDt, dt);
for (OrderAppointment o: appointments) { lqw.eq(OrderInfo::getEngineerCode, engineerCode);
// 过滤掉已经取消的订单 lqw.eq(OrderInfo::getOrderStatus, "NORMAL");
if(o.getStatus().equals("NOT_ASSIGNED") || o.getStatus().equals("CANCELED")) { lqw.in(OrderInfo::getAppointmentStatus, List.of("PRE", "CONFIRM"));
continue; List<OrderInfo> appointments = orderInfoMPDao.selectList(lqw);
} if(appointments.isEmpty()){
orderIds.add(o.getOrderId());
}
if(orderIds.isEmpty()){
return orderSegments; return orderSegments;
} }
for(OrderInfo o: appointments) {
Map<String, List<OrderAppointment>> m = appointments.stream().collect(Collectors.groupingBy(OrderAppointment::getOrderId));
List<OrderRequest> orderRequests = orderRequestMPDao.selectByOrderIds(orderIds);
for(OrderRequest o: orderRequests) {
List<OrderAppointment> tmp = m.getOrDefault(o.getOrderId(), new ArrayList<>());
if(tmp.isEmpty()) {
continue;
}
OrderAppointment oa = tmp.get(0);
OrderSegment seg = new OrderSegment(); OrderSegment seg = new OrderSegment();
seg.setOrderId(o.getOrderId()); seg.setOrderId(o.getOrderId());
seg.setX(Double.parseDouble(o.getX())); seg.setX(Double.parseDouble(o.getX()));
seg.setY(Double.parseDouble(o.getY())); seg.setY(Double.parseDouble(o.getY()));
seg.setStart(this.timestamp2Point(oa.getExpectStartTime())); seg.setStart(this.timestamp2Point(o.getPlanStartTime()));
seg.setEnd(this.timestamp2Point(oa.getExpectEndTime())); seg.setEnd(this.timestamp2Point(o.getPlanEndTime()));
orderSegments.add(seg); orderSegments.add(seg);
} }
......
...@@ -302,11 +302,11 @@ public class DispatchServiceImpl implements DispatchService { ...@@ -302,11 +302,11 @@ public class DispatchServiceImpl implements DispatchService {
private List<OrderInfo> queryOrders(DispatchOrderListReq reqDTO) { private List<OrderInfo> queryOrders(DispatchOrderListReq reqDTO) {
// 获取服务单列表 // 获取服务单列表
LambdaQueryWrapper<OrderInfo> lqw = new LambdaQueryWrapper<>(); LambdaQueryWrapper<OrderInfo> lqw = new LambdaQueryWrapper<>();
lqw.eq(OrderInfo::getAppointmentStatus, "NOT_ASSIGNED"); // 明确未派工订单 lqw.eq(OrderInfo::getDt, TimeUtils.IsoDate2LocalDate(reqDTO.getDate()));
lqw.eq(OrderInfo::getAppointmentStatus, "INIT"); // 明确未派工订单
lqw.eq(reqDTO.getLevelType().equals("cluster"), OrderInfo::getOrgClusterId, reqDTO.getLevelValue()); 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("branch"), OrderInfo::getOrgBranchId, reqDTO.getLevelValue());
lqw.eq(reqDTO.getLevelType().equals("group"), OrderInfo::getOrgGroupId, reqDTO.getLevelValue()); lqw.eq(reqDTO.getLevelType().equals("group"), OrderInfo::getOrgGroupId, reqDTO.getLevelValue());
lqw.eq(OrderInfo::getDt, TimeUtils.IsoDate2LocalDate(reqDTO.getDate()));
//筛选项 //筛选项
lqw.eq(StringUtils.isNotEmpty(reqDTO.getPhone()), OrderInfo::getPhone, reqDTO.getPhone()); lqw.eq(StringUtils.isNotEmpty(reqDTO.getPhone()), OrderInfo::getPhone, reqDTO.getPhone());
lqw.eq(StringUtils.isNotEmpty(reqDTO.getOrderId()), OrderInfo::getOrderId, reqDTO.getOrderId()); lqw.eq(StringUtils.isNotEmpty(reqDTO.getOrderId()), OrderInfo::getOrderId, reqDTO.getOrderId());
...@@ -362,6 +362,7 @@ public class DispatchServiceImpl implements DispatchService { ...@@ -362,6 +362,7 @@ public class DispatchServiceImpl implements DispatchService {
LambdaQueryWrapper<OrderInfo> lqw = new LambdaQueryWrapper<>(); LambdaQueryWrapper<OrderInfo> lqw = new LambdaQueryWrapper<>();
lqw.eq(OrderInfo::getDt, date); lqw.eq(OrderInfo::getDt, date);
lqw.in(OrderInfo::getAppointmentStatus, List.of("VIRTUAL", "PRE", "CONFIRM"));
lqw.in(OrderInfo::getEngineerCode, engineerCodes); lqw.in(OrderInfo::getEngineerCode, engineerCodes);
lqw.orderByAsc(OrderInfo::getEngineerCode); lqw.orderByAsc(OrderInfo::getEngineerCode);
......
...@@ -149,7 +149,7 @@ public class OrderAssignImpl implements OrderAssign { ...@@ -149,7 +149,7 @@ public class OrderAssignImpl implements OrderAssign {
Timestamp planStartTime = Timestamp.valueOf(result.getStart()); Timestamp planStartTime = Timestamp.valueOf(result.getStart());
Timestamp planEndTime = Timestamp.valueOf(result.getEnd()); Timestamp planEndTime = Timestamp.valueOf(result.getEnd());
// 更新order_request表状态 // 更新order_info表状态
LambdaUpdateWrapper<OrderInfo> wrapper = new LambdaUpdateWrapper<>(); LambdaUpdateWrapper<OrderInfo> wrapper = new LambdaUpdateWrapper<>();
wrapper.set(OrderInfo::getAppointmentStatus, "CONFIRM"); wrapper.set(OrderInfo::getAppointmentStatus, "CONFIRM");
wrapper.set(OrderInfo::getAppointmentMethod, "MANUAL"); wrapper.set(OrderInfo::getAppointmentMethod, "MANUAL");
......
...@@ -3,6 +3,7 @@ package com.dituhui.pea.order.service.impl; ...@@ -3,6 +3,7 @@ package com.dituhui.pea.order.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.dituhui.pea.common.BusinessException; import com.dituhui.pea.common.BusinessException;
import com.dituhui.pea.common.Result; import com.dituhui.pea.common.Result;
import com.dituhui.pea.order.common.ListUtils;
import com.dituhui.pea.order.common.TimeUtils; import com.dituhui.pea.order.common.TimeUtils;
import com.dituhui.pea.order.dao.*; import com.dituhui.pea.order.dao.*;
import com.dituhui.pea.order.dto.*; import com.dituhui.pea.order.dto.*;
...@@ -127,11 +128,18 @@ public class OrderServiceDetailImpl implements OrderServiceDetail { ...@@ -127,11 +128,18 @@ public class OrderServiceDetailImpl implements OrderServiceDetail {
Comparator<OrderInfo> dtDesc = Comparator.comparing(OrderInfo::getDt).reversed(); Comparator<OrderInfo> dtDesc = Comparator.comparing(OrderInfo::getDt).reversed();
List<OrderInfo> results = orders.stream().sorted(dtDesc).collect(Collectors.toList()); List<OrderInfo> results = orders.stream().sorted(dtDesc).collect(Collectors.toList());
LocalDate lastDt = results.get(0).getDt(); LocalDate lastDt = results.get(0).getDt(); //最新预约
List<OrderAppointmentListResp.OrderAppointment> items = new ArrayList<>(); List<OrderAppointmentListResp.OrderAppointment> items = new ArrayList<>();
for (OrderInfo o : results) { for (OrderInfo o : results) {
EngineerInfo eg = egInfo.getOrDefault(o.getEngineerCode(), null); EngineerInfo eg = egInfo.getOrDefault(o.getEngineerCode(), null);
if(eg == null) {
log.warn("未获得工程师{}基础信息, 订单:{}", o.getEngineerCode(), o.getOrderId());
continue;
}
String skill = egSkill.getOrDefault(o.getEngineerCode(), null); String skill = egSkill.getOrDefault(o.getEngineerCode(), null);
if(skill == null) {
log.warn("未获得工程师{}基础技能, 订单:{}", o.getEngineerCode(), o.getOrderId());
}
// 获取工程师姓名 // 获取工程师姓名
String engineerName = (eg != null) ? eg.getName() : o.getEngineerCode(); String engineerName = (eg != null) ? eg.getName() : o.getEngineerCode();
...@@ -146,7 +154,7 @@ public class OrderServiceDetailImpl implements OrderServiceDetail { ...@@ -146,7 +154,7 @@ public class OrderServiceDetailImpl implements OrderServiceDetail {
item.setTitle(title); item.setTitle(title);
item.setEngineerCode(o.getEngineerCode()); item.setEngineerCode(o.getEngineerCode());
item.setExpectTime(TimeUtils.IsoTimestamp2DateTime(o.getExpectTimeBegin())); item.setExpectTime(TimeUtils.IsoTimestamp2DateTime(o.getExpectTimeBegin()));
item.setTimelines(this.packOrderTimeline(timelines.get(o.getSubId()))); item.setTimelines(this.packOrderTimeline(timelines.getOrDefault(o.getSubId(), null)));
item.setItems(this.packEngineerItems(eg, skill, groups.get(eg.getGroupId()))); item.setItems(this.packEngineerItems(eg, skill, groups.get(eg.getGroupId())));
items.add(item); items.add(item);
...@@ -365,7 +373,7 @@ public class OrderServiceDetailImpl implements OrderServiceDetail { ...@@ -365,7 +373,7 @@ public class OrderServiceDetailImpl implements OrderServiceDetail {
private List<KV> packOrderTimeline(List<OrderTimeline> timelines) { private List<KV> packOrderTimeline(List<OrderTimeline> timelines) {
List<KV> items = new ArrayList<>(); List<KV> items = new ArrayList<>();
if (timelines == null) { if(ListUtils.isEmpty(timelines)){
return items; return items;
} }
for (OrderTimeline o : timelines) { for (OrderTimeline o : timelines) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!