Commit ba63351b by wangli

未实现完成,暂时注释

1 parent 04f51056
......@@ -6,7 +6,6 @@ import com.alibaba.cloud.integration.order.dto.*;
import com.alibaba.cloud.integration.order.entity.*;
import com.alibaba.cloud.integration.order.service.OrderServiceDetail;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.aspectj.weaver.ast.Or;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
......@@ -76,16 +75,21 @@ public class OrderServiceDetailImpl implements OrderServiceDetail {
@Transactional
@Override
public Result<?> getOrderAppointmentList(String orderId) {
List<OrderAppointmentListResp.OrderAppointment> items = new ArrayList<>();
// 获取预约单里列表
OrderAppointmentListResp res = new OrderAppointmentListResp();
// 查询预约单列表
List<OrderAppointment> appoints = this.queryOrderAppointments(orderId);
if(appoints.isEmpty()){
// 没有指派单列表,返回
res.setOrderId(orderId);
res.setOrders(List.of());
return Result.success(res);
}
// 工程师ID列表
List<String> egCodes = new ArrayList<>();
for(OrderAppointment o: appoints) {
egCodes.add(o.getEngineerCode());
}
List<String> egCodes = appoints.stream().map(OrderAppointment::getEngineerCode).collect(Collectors.toList());
// 获取工程师基础信息列表
HashMap<String, EngineerInfo> egInfo = this.getEngineerInfos(egCodes);
......@@ -93,49 +97,42 @@ public class OrderServiceDetailImpl implements OrderServiceDetail {
// 获取工程师技能列表
HashMap<String, EngineerSkill> egSkill = this.getEngineerSkills(egCodes);
// 获取订单timeline
// 获取subOrder订单timeline
Map<String, List<OrderTimeline>> timelines = this.getOrderTimelines(orderId);
// 对指派单列表按照subOrderId降序排序, 获取排序的subOrderId列表, 然后根据subOrderId分组
Comparator<OrderAppointment> sbDesc = Comparator.comparing(OrderAppointment::getSuborderId, String.CASE_INSENSITIVE_ORDER).reversed();
List<OrderAppointment> results = appoints.stream().sorted(sbDesc).collect(Collectors.toList());
// 根据subOrderId分组
Map<String, List<OrderAppointment>> appointOrders = results.stream().collect(Collectors.groupingBy(OrderAppointment::getSuborderId));
// Map<String, List<OrderAppointment>> appointOrders = results.stream().collect(Collectors.groupingBy(OrderAppointment::getSuborderId));
// 获取排序的subOrderId(降序)
List<String> subOrderIds = new ArrayList<>();
for (String k: appointOrders.keySet()){
subOrderIds.add(k);
}
Collections.reverse(subOrderIds);
/*
String lastSubOrderId = results.get(0).getSuborderId();
for(OrderAppointment o: results) {
String subOrderId = o.getSuborderId();
for(String subOrderId: subOrderIds){
List<OrderAppointment> orders = appointOrders.get(subOrderId);
OrderAppointment order = orders.get(0); // 第一个订单
EngineerInfo eg = egInfo.getOrDefault(o.getEngineerCode(), null);
EngineerSkill es = egSkill.getOrDefault(o.getEngineerCode(), null);
OrderAppointmentListResp.OrderAppointment op = new OrderAppointmentListResp.OrderAppointment();
// 获取工程师姓名
String engineerName = (eg != null) ? eg.getName(): o.getEngineerCode();
// 获取工程师列表信息
List<List<KV>> egInfos = new ArrayList<>();
for (OrderAppointment o: orders) {
String egCode = o.getEngineerCode();
egInfos.add(this.packEngineerInfos(egInfo.get(egCode), egSkill.get(egCode)));
// 获取title
String title = engineerName;
if (lastSubOrderId.equals(subOrderId)) {
title = String.format("%s_%s", engineerName, this.Timestamp2Datetime(o.getExpectTime(), "yyyyMMdd"));
}
op.setEngineers(egInfos);
//获取timeline信息
OrderAppointmentListResp.OrderAppointment op = new OrderAppointmentListResp.OrderAppointment();
op.setTitle(title);
op.setEngineerCode(o.getEngineerCode());
op.setExpectTime(o.getExpectTime().toString());
op.setTimelines(this.packOrderTimeline(timelines.get(subOrderId)));
op.setTitle(order.getSuborderId());
op.setExpectTime(order.getExpectTime().toString());
items.add(op);
op.setItems(this.packEngineerInfos(eg, es));
}
*/
// 返回结果
OrderAppointmentListResp res = new OrderAppointmentListResp();
res.setOrderId(orderId);
res.setOrders(items);
return Result.success(res);
return null;
}
@Transactional
......@@ -228,26 +225,28 @@ public class OrderServiceDetailImpl implements OrderServiceDetail {
private List<KV> packEngineerInfos(EngineerInfo eg, EngineerSkill skill) {
// 获取工程师信息
List<KV> items = new ArrayList<>();
String kind = "";
String age = "";
if (eg.getKind() == 1) {
kind = "全职";
} else {
kind = "兼职";
if (eg == null && skill == null) {
return items;
}
if (eg != null) {
items.add(this.packEngineer("技术员:", eg.getName(), "engineer"));
items.add(this.packEngineer("工号:", eg.getEngineerCode(), "" ));
items.add(this.packEngineer("类型:", (eg.getKind() == 1) ? "全职" : "兼职", ""));
items.add(this.packEngineer("手机号:", eg.getPhone(), ""));
}
String age = "";
if (age.isEmpty()) {
age="未知";
} else {
age = eg.getBirth();
}
List<KV> items = new ArrayList<>();
items.add(this.packEngineer("技术员:", eg.getName(), "engineer"));
items.add(this.packEngineer("小组:", "老王组", ""));
items.add(this.packEngineer("类型:", kind, ""));
items.add(this.packEngineer("性别/年龄:", eg.getGender()+"/"+age, ""));
items.add(this.packEngineer("手机号:", eg.getPhone(), ""));
items.add(this.packEngineer("工号:", eg.getEngineerCode(), "" ));
items.add(this.packEngineer("技能:", "TODO", "")); // TODO
return items;
}
......@@ -295,8 +294,8 @@ public class OrderServiceDetailImpl implements OrderServiceDetail {
return items;
}
private KV packEngineer(String title, String value, Object params) {
return this.PackKV(title, value, null, null, params);
private KV packEngineer(String title, String value, String type) {
return this.PackKV(title, value, type, null, null);
}
private KV packTimeline(String title, String value, String status) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!