Commit f275a5ac by 王力

Merge branch 'feature_OrderServiceList_wangl' into 'develop'

Feature order service list wangl

See merge request !14
2 parents 84450029 77dbabd2
package com.alibaba.cloud.integration.order.controller;
import com.alibaba.cloud.integration.common.Result;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
@Controller
public class OrderAssignController {
@GetMapping("/order/assign/recommend/engineers")
public Result<?> getOrderAssignRecommendEnginners(@RequestParam String orderId,
@RequestParam String key,
@RequestParam String distance,
@RequestParam String recommend) {
//服务单指派-推荐技术员列表
return null;
}
@PostMapping("/order/assign")
public Result<?> orderAssign(@RequestBody String orderId, @RequestBody String engineerCode) {
// 服务单指派-指派提交
return null;
}
}
package com.alibaba.cloud.integration.order.controller; package com.alibaba.cloud.integration.order.controller;
import com.alibaba.cloud.integration.common.BusinessException;
import com.alibaba.cloud.integration.common.Result; import com.alibaba.cloud.integration.common.Result;
import com.alibaba.cloud.integration.order.service.OrderServiceDetail; import com.alibaba.cloud.integration.order.service.OrderServiceDetail;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -15,6 +16,39 @@ public class OrderServiceDetailController { ...@@ -15,6 +16,39 @@ public class OrderServiceDetailController {
@GetMapping("/order/service/detail") @GetMapping("/order/service/detail")
public Result<?> GetOrderServiceDetail(@RequestParam String orderId) { public Result<?> GetOrderServiceDetail(@RequestParam String orderId) {
return orderServiceDetail.GetOrderServiceDetail(orderId); // 服务单详情
Result<?> res = null;
try {
res = orderServiceDetail.getOrderServiceDetail(orderId);
} catch (BusinessException e) {
Result.failed(e.getMessage());
}
return res;
}
@GetMapping("/order/service/dynamics")
public Result<?> getOrderServiceDynamicController(@RequestParam String orderId){
//服务单动态
Result<?> res = null;
try {
res = orderServiceDetail.getOrderServiceDynamics(orderId);
} catch (BusinessException e) {
Result.failed(e.getMessage());
}
return res;
}
@GetMapping("/order/appointment/list")
public Result<?> getOrderAppointmentList(@RequestParam String orderId) {
//工单预约单列表
Result<?> res = null;
try {
res = orderServiceDetail.getOrderAppointmentList(orderId);
} catch (BusinessException e) {
return Result.failed(e.getMessage());
}
return res;
} }
} }
\ No newline at end of file
package com.alibaba.cloud.integration.order.dto;
import lombok.Data;
import java.util.List;
@Data
public class OrderAppointmentListResp {
private String orderId;
private List<OrderAppointment> orders;
@Data
public static class OrderAppointment{
private String title;
private String expectTime;
private List<List<KV>> engineers;
private List<KV> timelines;
}
}
...@@ -11,14 +11,6 @@ public class OrderServiceDetailResp { ...@@ -11,14 +11,6 @@ public class OrderServiceDetailResp {
private String statusDesc; private String statusDesc;
private String risk; private String risk;
private String riskDesc; private String riskDesc;
private String location;
private List<KV> orderServiceItems; private List<KV> orderServiceItems;
private List<OrderAppointment> orderAppointments;
@Data
public static class OrderAppointment{
private String title;
private String expectTime;
private List<List<KV>> engineers;
private List<KV> timelines;
}
} }
package com.alibaba.cloud.integration.order.service;
import com.alibaba.cloud.integration.common.Result;
public interface OrderAssign {
// 服务单指派-推荐技术员列表
Result<?> getOrderAssignRecommendEngineers(String orderId, String key, String distance, String recommend);
// 服务单指派-指派提交
Result<?> orderAssign(String orderId, String engineerCode);
}
...@@ -3,5 +3,9 @@ package com.alibaba.cloud.integration.order.service; ...@@ -3,5 +3,9 @@ package com.alibaba.cloud.integration.order.service;
import com.alibaba.cloud.integration.common.Result; import com.alibaba.cloud.integration.common.Result;
public interface OrderServiceDetail { public interface OrderServiceDetail {
Result<?> GetOrderServiceDetail(String orderId); Result<?> getOrderServiceDetail(String orderId);
Result<?> getOrderServiceDynamics(String orderId);
Result<?> getOrderAppointmentList(String orderId);
} }
package com.alibaba.cloud.integration.order.service.impl;
import com.alibaba.cloud.integration.common.Result;
import com.alibaba.cloud.integration.order.service.OrderAssign;
import org.springframework.stereotype.Service;
@Service
public class OrderAssignImpl implements OrderAssign {
@Override
public Result<?> getOrderAssignRecommendEngineers(String orderId, String key, String distance, String recommend) {
return null;
}
@Override
public Result<?> orderAssign(String orderId, String engineerCode) {
return null;
}
}
\ No newline at end of file
...@@ -3,12 +3,9 @@ package com.alibaba.cloud.integration.order.service.impl; ...@@ -3,12 +3,9 @@ package com.alibaba.cloud.integration.order.service.impl;
import com.alibaba.cloud.integration.common.Result; import com.alibaba.cloud.integration.common.Result;
import com.alibaba.cloud.integration.order.dao.*; import com.alibaba.cloud.integration.order.dao.*;
import com.alibaba.cloud.integration.order.dto.KV; import com.alibaba.cloud.integration.order.dto.KV;
import com.alibaba.cloud.integration.order.dto.OrderAppointmentListResp;
import com.alibaba.cloud.integration.order.dto.OrderServiceDetailResp; import com.alibaba.cloud.integration.order.dto.OrderServiceDetailResp;
import com.alibaba.cloud.integration.order.entity.OrderRequest; import com.alibaba.cloud.integration.order.entity.*;
import com.alibaba.cloud.integration.order.entity.OrderAppointment;
import com.alibaba.cloud.integration.order.entity.EngineerInfo;
import com.alibaba.cloud.integration.order.entity.EngineerSkill;
import com.alibaba.cloud.integration.order.entity.OrderTimeline;
import com.alibaba.cloud.integration.order.service.OrderServiceDetail; import com.alibaba.cloud.integration.order.service.OrderServiceDetail;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -38,15 +35,36 @@ public class OrderServiceDetailImpl implements OrderServiceDetail { ...@@ -38,15 +35,36 @@ public class OrderServiceDetailImpl implements OrderServiceDetail {
@Transactional @Transactional
@Override @Override
public Result<?> GetOrderServiceDetail(String orderId) { public Result<?> getOrderServiceDetail(String orderId) {
// 查询订单详情 OrderRequest order = this.queryOrderDetail(orderId);
OrderRequest detail = this.GetOrderDetail(orderId);
// 查询指派列表 List<KV> items = this.packOrderDetail(order);
List<OrderServiceDetailResp.OrderAppointment> items = new ArrayList<>();
List<OrderAppointment> appoints = this.GetOrderAppointments(orderId); OrderServiceDetailResp res = new OrderServiceDetailResp();
res.setOrderId(orderId);
res.setLocation("");
res.setRisk("");
res.setStatusDesc("");
res.setStatus("");
res.setOrderServiceItems(items);
return Result.success(res);
}
@Transactional
@Override
public Result<?> getOrderServiceDynamics(String orderId) {
return null;
}
@Transactional
@Override
public Result<?> getOrderAppointmentList(String orderId) {
List<OrderAppointmentListResp.OrderAppointment> items = new ArrayList<>();
// 查询预约单列表
List<OrderAppointment> appoints = this.queryOrderAppointments(orderId);
// 工程师ID列表 // 工程师ID列表
List<String> egCodes = new ArrayList<>(); List<String> egCodes = new ArrayList<>();
...@@ -55,13 +73,13 @@ public class OrderServiceDetailImpl implements OrderServiceDetail { ...@@ -55,13 +73,13 @@ public class OrderServiceDetailImpl implements OrderServiceDetail {
} }
// 获取工程师基础信息列表 // 获取工程师基础信息列表
HashMap<String, EngineerInfo> egInfo = this.GetEngineerInfos(egCodes); HashMap<String, EngineerInfo> egInfo = this.getEngineerInfos(egCodes);
// 获取工程师技能列表 // 获取工程师技能列表
HashMap<String, EngineerSkill> egSkill = this.GetEngineerSkills(egCodes); HashMap<String, EngineerSkill> egSkill = this.getEngineerSkills(egCodes);
// 获取订单timeline // 获取订单timeline
Map<String, List<OrderTimeline>> timelines = this.GetOrderTimelines(orderId); Map<String, List<OrderTimeline>> timelines = this.getOrderTimelines(orderId);
// 对指派单列表按照subOrderId降序排序, 获取排序的subOrderId列表, 然后根据subOrderId分组 // 对指派单列表按照subOrderId降序排序, 获取排序的subOrderId列表, 然后根据subOrderId分组
Comparator<OrderAppointment> sbDesc = Comparator.comparing(OrderAppointment::getSuborderId, String.CASE_INSENSITIVE_ORDER).reversed(); Comparator<OrderAppointment> sbDesc = Comparator.comparing(OrderAppointment::getSuborderId, String.CASE_INSENSITIVE_ORDER).reversed();
...@@ -80,18 +98,18 @@ public class OrderServiceDetailImpl implements OrderServiceDetail { ...@@ -80,18 +98,18 @@ public class OrderServiceDetailImpl implements OrderServiceDetail {
List<OrderAppointment> orders = appointOrders.get(subOrderId); List<OrderAppointment> orders = appointOrders.get(subOrderId);
OrderAppointment order = orders.get(0); // 第一个订单 OrderAppointment order = orders.get(0); // 第一个订单
OrderServiceDetailResp.OrderAppointment op = new OrderServiceDetailResp.OrderAppointment(); OrderAppointmentListResp.OrderAppointment op = new OrderAppointmentListResp.OrderAppointment();
// 获取工程师列表信息 // 获取工程师列表信息
List<List<KV>> egInfos = new ArrayList<>(); List<List<KV>> egInfos = new ArrayList<>();
for (OrderAppointment o: orders) { for (OrderAppointment o: orders) {
String egCode = o.getEngineerCode(); String egCode = o.getEngineerCode();
egInfos.add(this.PackEngineerInfos(egInfo.get(egCode), egSkill.get(egCode))); egInfos.add(this.packEngineerInfos(egInfo.get(egCode), egSkill.get(egCode)));
} }
op.setEngineers(egInfos); op.setEngineers(egInfos);
//获取timeline信息 //获取timeline信息
op.setTimelines(this.PackOrderTimeline(timelines.get(subOrderId))); op.setTimelines(this.packOrderTimeline(timelines.get(subOrderId)));
op.setTitle(order.getSuborderId()); op.setTitle(order.getSuborderId());
op.setExpectTime(order.getExpectTime().toString()); op.setExpectTime(order.getExpectTime().toString());
...@@ -99,29 +117,29 @@ public class OrderServiceDetailImpl implements OrderServiceDetail { ...@@ -99,29 +117,29 @@ public class OrderServiceDetailImpl implements OrderServiceDetail {
} }
// 返回结果 // 返回结果
OrderServiceDetailResp res = new OrderServiceDetailResp(); OrderAppointmentListResp res = new OrderAppointmentListResp();
res.setOrderId(orderId); res.setOrderId(orderId);
res.setStatus(detail.getStatus()); res.setOrders(items);
res.setOrderServiceItems(this.PackOrderDetail(detail));
res.setOrderAppointments(items);
return Result.success(res); return Result.success(res);
} }
private OrderRequest GetOrderDetail(String orderId) { private OrderRequest queryOrderDetail(String orderId) {
// 获取服务单记录 // 获取服务单记录
LambdaQueryWrapper<OrderRequest> lqw = new LambdaQueryWrapper<>(); LambdaQueryWrapper<OrderRequest> lqw = new LambdaQueryWrapper<>();
lqw.eq(OrderRequest::getOrderId, orderId); lqw.eq(OrderRequest::getOrderId, orderId);
return orderRequestDao.selectOne(lqw); return orderRequestDao.selectOne(lqw);
} }
private List<OrderAppointment> GetOrderAppointments(String orderId) {
private List<OrderAppointment> queryOrderAppointments(String orderId) {
// 获取指派单记录列表 // 获取指派单记录列表
LambdaQueryWrapper<OrderAppointment> lqw = new LambdaQueryWrapper<>(); LambdaQueryWrapper<OrderAppointment> lqw = new LambdaQueryWrapper<>();
lqw.eq(OrderAppointment::getOrderId, orderId); lqw.eq(OrderAppointment::getOrderId, orderId);
return orderAppointmentDao.selectList(lqw); return orderAppointmentDao.selectList(lqw);
} }
private HashMap<String, EngineerInfo> GetEngineerInfos(List<String> egCodes){ private HashMap<String, EngineerInfo> getEngineerInfos(List<String> egCodes){
// 获取工程师信息列表 // 获取工程师信息列表
HashMap<String, EngineerInfo> map = new HashMap<>(); HashMap<String, EngineerInfo> map = new HashMap<>();
...@@ -135,7 +153,7 @@ public class OrderServiceDetailImpl implements OrderServiceDetail { ...@@ -135,7 +153,7 @@ public class OrderServiceDetailImpl implements OrderServiceDetail {
return map; return map;
} }
private HashMap<String, EngineerSkill> GetEngineerSkills(List<String> egCodes) { private HashMap<String, EngineerSkill> getEngineerSkills(List<String> egCodes) {
// 获取工程师技能列表 // 获取工程师技能列表
HashMap<String, EngineerSkill> map = new HashMap<>(); HashMap<String, EngineerSkill> map = new HashMap<>();
...@@ -150,8 +168,8 @@ public class OrderServiceDetailImpl implements OrderServiceDetail { ...@@ -150,8 +168,8 @@ public class OrderServiceDetailImpl implements OrderServiceDetail {
return map; return map;
} }
private Map<String, List<OrderTimeline>> GetOrderTimelines(String orderId) { private Map<String, List<OrderTimeline>> getOrderTimelines(String orderId) {
HashMap<String, List<OrderTimeline>> map = new HashMap<>(); // 获取订单时间线
LambdaQueryWrapper<OrderTimeline> lqw = new LambdaQueryWrapper<>(); LambdaQueryWrapper<OrderTimeline> lqw = new LambdaQueryWrapper<>();
lqw.eq(OrderTimeline::getOrderId, orderId); lqw.eq(OrderTimeline::getOrderId, orderId);
...@@ -167,22 +185,7 @@ public class OrderServiceDetailImpl implements OrderServiceDetail { ...@@ -167,22 +185,7 @@ public class OrderServiceDetailImpl implements OrderServiceDetail {
return results.stream().collect(Collectors.groupingBy(OrderTimeline::getSuborderId)); return results.stream().collect(Collectors.groupingBy(OrderTimeline::getSuborderId));
} }
private List<KV> PackOrderDetail(OrderRequest order) { private List<KV> packEngineerInfos(EngineerInfo eg, EngineerSkill skill) {
List<KV> items = new ArrayList<>();
items.add(this.PackOrderItem("客户姓名:", order.getName()));
items.add(this.PackOrderItem("标签:", order.getTags()));
items.add(this.PackOrderItem("客户电话:", order.getPhone()));
items.add(this.PackOrderItem("设备:", order.getType()));
items.add(this.PackOrderItem("服务:", order.getSkill()));
items.add(this.PackOrderItem("故障描述:", order.getFaultDescribe()));
items.add(this.PackOrderItem("备注:", order.getApplyNote()));
items.add(this.PackOrderItem("意向时间:", ""));
items.add(this.PackOrderItem("时间要求:", order.getExpectTimeDesc()));
items.add(this.PackOrderItem("预约方式:", order.getSource()));
return items;
}
private List<KV> PackEngineerInfos(EngineerInfo eg, EngineerSkill skill) {
// 获取工程师信息 // 获取工程师信息
String kind = ""; String kind = "";
...@@ -198,39 +201,54 @@ public class OrderServiceDetailImpl implements OrderServiceDetail { ...@@ -198,39 +201,54 @@ public class OrderServiceDetailImpl implements OrderServiceDetail {
age = eg.getBirth(); age = eg.getBirth();
} }
List<KV> items = new ArrayList<>(); List<KV> items = new ArrayList<>();
items.add(this.PackEngineer("技术员:", eg.getName(), "engineer")); items.add(this.packEngineer("技术员:", eg.getName(), "engineer"));
items.add(this.PackEngineer("小组:", "老王组", "")); items.add(this.packEngineer("小组:", "老王组", ""));
items.add(this.PackEngineer("类型:", kind, "")); items.add(this.packEngineer("类型:", kind, ""));
items.add(this.PackEngineer("性别/年龄:", eg.getGender()+"/"+age, "")); items.add(this.packEngineer("性别/年龄:", eg.getGender()+"/"+age, ""));
items.add(this.PackEngineer("手机号:", eg.getPhone(), "")); items.add(this.packEngineer("手机号:", eg.getPhone(), ""));
items.add(this.PackEngineer("工号:", eg.getEngineerCode(), "" )); items.add(this.packEngineer("工号:", eg.getEngineerCode(), "" ));
items.add(this.PackEngineer("技能:", skill.getSkill(), "")); items.add(this.packEngineer("技能:", skill.getSkill(), ""));
return items; return items;
} }
private List<KV> PackOrderTimeline(List<OrderTimeline> timelines) { private List<KV> packOrderDetail(OrderRequest order) {
List<KV> items = new ArrayList<>();
items.add(this.packOrderItem("客户姓名:", order.getName()));
items.add(this.packOrderItem("标签:", order.getTags()));
items.add(this.packOrderItem("客户电话:", order.getPhone()));
items.add(this.packOrderItem("设备:", order.getType()));
items.add(this.packOrderItem("服务:", order.getSkill()));
items.add(this.packOrderItem("故障描述:", order.getFaultDescribe()));
items.add(this.packOrderItem("备注:", order.getApplyNote()));
items.add(this.packOrderItem("意向时间:", ""));
items.add(this.packOrderItem("时间要求:", order.getExpectTimeDesc()));
items.add(this.packOrderItem("预约方式:", order.getSource()));
return items;
}
private List<KV> packOrderTimeline(List<OrderTimeline> timelines) {
List<KV> items = new ArrayList<>(); List<KV> items = new ArrayList<>();
if (timelines == null) { if (timelines == null) {
return items; return items;
} }
for (OrderTimeline o:timelines) { for (OrderTimeline o:timelines) {
items.add(this.PackTimeline(o.getEvent(), o.getHappen(), o.getStatus().toString())); items.add(this.packTimeline(o.getEvent(), o.getHappen(), o.getStatus().toString()));
} }
return items; return items;
} }
private KV PackOrderItem(String title, String value) { private KV packEngineer(String title, String value, Object params) {
return this.PackKV(title, value, null, null, null);
}
private KV PackEngineer(String title, String value, Object params) {
return this.PackKV(title, value, null, null, params); return this.PackKV(title, value, null, null, params);
} }
private KV PackTimeline(String title, String value, String status) { private KV packTimeline(String title, String value, String status) {
return this.PackKV(title, value, null, status, null); return this.PackKV(title, value, null, status, null);
} }
private KV packOrderItem(String title, String value) {
return this.PackKV(title, value, null, null, null);
}
private KV PackKV(String title, String value, String type, String status, Object params) { private KV PackKV(String title, String value, String type, String status, Object params) {
KV item = new KV(); KV item = new KV();
item.setTitle(title); item.setTitle(title);
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!