Commit a4ceddd2 by wangli

修改

1 parent a98a12ad
......@@ -13,6 +13,7 @@ import com.dituhui.pea.order.dto.DispatchOrderListReq;
import com.dituhui.pea.order.dto.DispatchOrderListResp;
import com.dituhui.pea.order.entity.*;
import com.dituhui.pea.order.service.DispatchService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -31,6 +32,7 @@ interface GroupTag {
}
@Slf4j
@Service
public class DispatchServiceImpl implements DispatchService {
......@@ -132,6 +134,7 @@ public class DispatchServiceImpl implements DispatchService {
List<EngineerInfo> engineers = this.queryEngineers(teamIds, reqDTO.getEngineerCodes(), reqDTO.getKey());
if (engineers.isEmpty()) {
// 该group下没有技术员,返回空
log.warn("没有找到技术员");
DispatchEngineerOrderListResp res = new DispatchEngineerOrderListResp();
List<DispatchEngineerOrderListResp.EngineerInfo> egs = new ArrayList<>();
res.setEngineers(egs);
......@@ -147,21 +150,6 @@ public class DispatchServiceImpl implements DispatchService {
// 获取技术员的容量
HashMap<String, CapacityEngineerStat> engineerCap = this.queryCapacityEngineerStat(engineerCodes, reqDTO.getDate());
// 获取订单ID
Set<String> orderIds = new HashSet<>();
for (String k : engineerOrders.keySet()) {
for (OrderInfo o : engineerOrders.get(k)) {
orderIds.add(o.getOrderId());
}
}
// 获取服务单/工单列表
Map<String, List<OrderInfo>> orders = new HashMap<>();
if (!orderIds.isEmpty()) {
orders = orderInfoMPDao.selectByDtAndOrderIds(date, new ArrayList<>(orderIds)).stream().collect(
Collectors.groupingBy(OrderInfo::getOrderId));
}
// 获取技术员已指派单列表
List<DispatchEngineerOrderListResp.EngineerInfo> egs = new ArrayList<>();
for (EngineerInfo e : engineers) {
......@@ -170,13 +158,7 @@ public class DispatchServiceImpl implements DispatchService {
// 技术员已指派的订单列表
List<OrderInfo> records = engineerOrders.getOrDefault(e.getEngineerCode(), new ArrayList<>());
for (OrderInfo r : records) {
// 获取对应的工单信息
if (ListUtils.isEmpty(orders.get(r.getOrderId()))) {
continue;
}
OrderInfo o = orders.get(r.getOrderId()).get(0);
for (OrderInfo o : records) {
DispatchEngineerOrderListResp.OrderInfo item = new DispatchEngineerOrderListResp.OrderInfo();
item.setOrderId(o.getOrderId());
......@@ -207,15 +189,15 @@ public class DispatchServiceImpl implements DispatchService {
item.setName(o.getName());
item.setPhone(o.getPhone());
String time = TimeUtils.timestamp2DateTime(r.getPlanStartTime(), "HH:mm");
String timeSlot = this.parseTimeSlot(r.getPlanStartTime());
String time = TimeUtils.timestamp2DateTime(o.getPlanStartTime(), "HH:mm");
String timeSlot = this.parseTimeSlot(o.getPlanStartTime());
item.setExpectTimeDesc(String.format("%s/%s", time, timeSlot));
item.setSource(o.getSource());
item.setAppointmentStatus(o.getAppointmentStatus());
item.setAppointmentType(o.getAppointmentMethod());
item.setOrderStatus(r.getOrderStatus()); // 预约单状态
item.setOrderStatusDesc(r.getOrderStatus()); // 预约单状态描述, TODO
item.setOrderStatus(o.getOrderStatus()); // 预约单状态
item.setOrderStatusDesc(o.getOrderStatus()); // 预约单状态描述, TODO
item.setCreateTime(TimeUtils.IsoTimestamp2DateTime(o.getCreateTime()));
items.add(item);
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!