Commit d4e5c674 by 王力

Merge branch 'dev_order_info0725' into 'develop'

Dev order info0725

See merge request !261
2 parents e024cfee 4251365e
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.entity.*;
import lombok.Data;
......@@ -21,11 +22,6 @@ import java.util.stream.Collectors;
@Component
@Slf4j
public class OrderAssignCheck {
@Autowired
OrderRequestMPDao orderRequestMPDao;
@Autowired
OrderAppointmentMPDao orderAppointmentMPDao;
@Autowired
SkillInfoMPDao skillInfoMPDao;
......@@ -39,6 +35,9 @@ public class OrderAssignCheck {
@Autowired
OrgGroupMPDao orgGroupMPDao;
@Autowired
OrderInfoMPDao orderInfoMPDao;
@Data
public class Result {
private Boolean canAssign;
......@@ -63,7 +62,7 @@ public class OrderAssignCheck {
public Result orderAssignCheck(String orderId, String 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 curY = Double.parseDouble(order.getY());
......@@ -142,33 +141,22 @@ public class OrderAssignCheck {
private List<OrderSegment> getEngineerOrderSegments(String engineerCode, LocalDate dt) {
List<OrderSegment> orderSegments = new ArrayList<>();
List<OrderAppointment> appointments = orderAppointmentMPDao.selectByEngineerCodeAndDt(engineerCode, dt);
List<String> orderIds = new ArrayList<>();
for (OrderAppointment o: appointments) {
// 过滤掉已经取消的订单
if(o.getStatus().equals("NOT_ASSIGNED") || o.getStatus().equals("CANCELED")) {
continue;
}
orderIds.add(o.getOrderId());
}
if(orderIds.isEmpty()){
LambdaQueryWrapper<OrderInfo> lqw = new LambdaQueryWrapper<>();
lqw.eq(OrderInfo::getDt, dt);
lqw.eq(OrderInfo::getEngineerCode, engineerCode);
lqw.eq(OrderInfo::getOrderStatus, "NORMAL");
lqw.in(OrderInfo::getAppointmentStatus, List.of("PRE", "CONFIRM"));
List<OrderInfo> appointments = orderInfoMPDao.selectList(lqw);
if(appointments.isEmpty()){
return orderSegments;
}
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);
for(OrderInfo o: appointments) {
OrderSegment seg = new OrderSegment();
seg.setOrderId(o.getOrderId());
seg.setX(Double.parseDouble(o.getX()));
seg.setY(Double.parseDouble(o.getY()));
seg.setStart(this.timestamp2Point(oa.getExpectStartTime()));
seg.setEnd(this.timestamp2Point(oa.getExpectEndTime()));
seg.setStart(this.timestamp2Point(o.getPlanStartTime()));
seg.setEnd(this.timestamp2Point(o.getPlanEndTime()));
orderSegments.add(seg);
}
......
......@@ -149,7 +149,7 @@ public class OrderAssignImpl implements OrderAssign {
Timestamp planStartTime = Timestamp.valueOf(result.getStart());
Timestamp planEndTime = Timestamp.valueOf(result.getEnd());
// 更新order_request表状态
// 更新order_info表状态
LambdaUpdateWrapper<OrderInfo> wrapper = new LambdaUpdateWrapper<>();
wrapper.set(OrderInfo::getAppointmentStatus, "CONFIRM");
wrapper.set(OrderInfo::getAppointmentMethod, "MANUAL");
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!