Commit 3226b96f by wangli

修改

1 parent 48299c87
......@@ -10,12 +10,12 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.lang.management.PlatformManagedObject;
import java.sql.Timestamp;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
interface GroupTag {
......@@ -62,10 +62,10 @@ public class DispatchServiceImpl implements DispatchService {
item.setOrderId(o.getOrderId());
item.setCategory(String.format("%s-%s", o.getType(), o.getBrand()));
item.setSkill(o.getSkill());
item.setRemark(o.getDescription());
item.setRemark(o.getApplyNote());
item.setCustomerName(o.getName());
String description = String.format("%s:%s%s-%s %s:%s", o.getOrderId(), o.getSkill(),
String description = String.format("%s:%s%s-%s\n%s:%s", o.getOrderId(), o.getSkill(),
o.getType(), o.getBrand(), o.getName(), o.getAddress());
item.setDescription(description);
......@@ -94,12 +94,24 @@ public class DispatchServiceImpl implements DispatchService {
// 获取groupIds
List<String> groupIds = this.queryOrgGroupIds(levelType, levelIds);
// 获取engineer列表
List<EngineerInfo> engineers = this.queryEngineers(groupIds);
// 获取engineerCodes
List<String> engineerCodes = this.queryEngineerCodes(groupIds);
List<String> engineerCodes = engineers.stream().map(EngineerInfo::getEngineerCode).collect(Collectors.toList());
// 获取技术员订单ID列表
HashMap<String, List<String>> engineerOrders = this.queryEngineerOrderIds(engineerCodes, date);
// 获取订单列表
List<String> orderIds = new ArrayList<>();
List<String> orderIds = this.queryOrderAppointmentOrderIds(engineerCodes, date);
// 获取订单列表
List<OrderRequest> orders = this.queryOrderRequestByOrderIds(orderIds);
List<OrderRequest> orders = this.queryOrderRequestByOrderId(orderIds);
for (EngineerInfo e : engineers) {
}
return null;
}
......@@ -125,9 +137,9 @@ public class DispatchServiceImpl implements DispatchService {
return orderRequestMPDao.selectList(lqw);
}
private List<OrderRequest> queryOrderRequestByOrderId(List<String> orderIds) {
private List<OrderRequest> queryOrderRequestByOrderIds(List<String> orderIds) {
List<OrderRequest> orders = new ArrayList<>();
if (orderIds.isEmpty()){
if (orderIds.isEmpty()) {
return orders;
}
LambdaQueryWrapper<OrderRequest> lqw = new LambdaQueryWrapper<>();
......@@ -135,25 +147,36 @@ public class DispatchServiceImpl implements DispatchService {
return orderRequestMPDao.selectList(lqw);
}
private List<String> queryOrderAppointmentOrderIds(List<String> engineerCodes, String date) {
private HashMap<String, List<String>> queryEngineerOrderIds(List<String> engineerCodes, String date) {
// 获取工程师服务单列表
List<String> orderIds = new ArrayList<>();
HashMap<String, List<String>> map = new HashMap<>();
LambdaQueryWrapper<OrderAppointment> lqw = new LambdaQueryWrapper<>();
lqw.in(OrderAppointment::getEngineerCode, engineerCodes);
lqw.ge(OrderAppointment::getExpectTime, this.getTimestampFromDate(date, "00:00:00"));
lqw.le(OrderAppointment::getExpectTime, this.getTimestampFromDate(date, "23:59:59"));
lqw.select(OrderAppointment::getOrderId);
return orderAppointmentMPDao.selectList(lqw).stream().map(OrderAppointment::getOrderId).collect(Collectors.toList());
lqw.select(OrderAppointment::getEngineerCode, OrderAppointment::getOrderId);
List<OrderAppointment> records = orderAppointmentMPDao.selectList(lqw);
Map<String, List<OrderAppointment>> gg = records.stream().collect(Collectors.groupingBy(OrderAppointment::getEngineerCode));
for (String engineerCode : gg.keySet()) {
List<String> orderIds = new ArrayList<>();
for (OrderAppointment o : gg.get(engineerCode)) {
orderIds.add(o.getOrderId());
}
map.put(engineerCode, orderIds);
}
return map;
}
private List<String> queryEngineerCodes(List<String> groupIds) {
private List<EngineerInfo> queryEngineers(List<String> groupIds) {
// 通过groupIds获取技术员列表
LambdaQueryWrapper<EngineerInfo> lqw = new LambdaQueryWrapper<>();
lqw.in(EngineerInfo::getGroupId, groupIds);
lqw.eq(EngineerInfo::getBeanStatus, 1);
List<EngineerInfo> engineers = engineerInfoMPDao.selectList(lqw);
return engineers.stream().map(EngineerInfo::getEngineerCode).collect(Collectors.toList());
return engineerInfoMPDao.selectList(lqw);
}
private List<String> queryOrgGroupIds(String levelType, List<String> levelIds) {
......@@ -176,7 +199,7 @@ public class DispatchServiceImpl implements DispatchService {
return map;
}
public Timestamp getTimestampFromDate(String date, String time){
public Timestamp getTimestampFromDate(String date, String time) {
return Timestamp.valueOf(date + " " + time);
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!