Commit 0d7215d7 by 王力

Merge branch 'dev_dispatch_filter0711' into 'develop'

Dev dispatch filter0711

See merge request !203
2 parents 5365be9a 6e4b5239
...@@ -6,4 +6,8 @@ public class ListUtils { ...@@ -6,4 +6,8 @@ public class ListUtils {
public static <T> boolean isNotEmpty(List<T> list) { public static <T> boolean isNotEmpty(List<T> list) {
return list != null && !list.isEmpty(); return list != null && !list.isEmpty();
} }
public static <T> boolean isEmpty(List<T> list) {
return list == null || list.isEmpty();
}
} }
...@@ -46,12 +46,11 @@ public class DispatchServiceImpl implements DispatchService { ...@@ -46,12 +46,11 @@ public class DispatchServiceImpl implements DispatchService {
private EngineerInfoMPDao engineerInfoMPDao; private EngineerInfoMPDao engineerInfoMPDao;
@Autowired @Autowired
private ProductCategoryMPDao productCategoryMPDao; private SkillInfoMPDao skillInfoMPDao;
@Autowired @Autowired
private CapacityEngineerStatMPDao capacityEngineerStatMPDao; private CapacityEngineerStatMPDao capacityEngineerStatMPDao;
@Transactional @Transactional
@Override @Override
public Result<?> getDispatchOrderList(DispatchOrderListReq reqDTO) { public Result<?> getDispatchOrderList(DispatchOrderListReq reqDTO) {
...@@ -140,8 +139,11 @@ public class DispatchServiceImpl implements DispatchService { ...@@ -140,8 +139,11 @@ public class DispatchServiceImpl implements DispatchService {
} }
// 获取服务单/工单列表 // 获取服务单/工单列表
Map<String, List<OrderRequest>> orders = this.queryOrderRequestByOrderIds(new ArrayList<>(orderIds)).stream().collect( Map<String, List<OrderRequest>> orders = new HashMap<>();
if(!orderIds.isEmpty()) {
orders = orderRequestMPDao.selectByOrderIds(new ArrayList<>(orderIds)).stream().collect(
Collectors.groupingBy(OrderRequest::getOrderId)); Collectors.groupingBy(OrderRequest::getOrderId));
}
// 获取技术员已指派单列表 // 获取技术员已指派单列表
List<DispatchEngineerOrderListResp.EngineerInfo> egs = new ArrayList<>(); List<DispatchEngineerOrderListResp.EngineerInfo> egs = new ArrayList<>();
...@@ -152,12 +154,14 @@ public class DispatchServiceImpl implements DispatchService { ...@@ -152,12 +154,14 @@ public class DispatchServiceImpl implements DispatchService {
// 技术员已指派的订单列表 // 技术员已指派的订单列表
List<OrderAppointment> records = engineerOrders.getOrDefault(e.getEngineerCode(), new ArrayList<>()); List<OrderAppointment> records = engineerOrders.getOrDefault(e.getEngineerCode(), new ArrayList<>());
for (OrderAppointment r : records) { for (OrderAppointment r : records) {
DispatchEngineerOrderListResp.OrderInfo item = new DispatchEngineerOrderListResp.OrderInfo();
// 获取对应的工单信息 // 获取对应的工单信息
if (ListUtils.isEmpty(orders.get(r.getOrderId()))){
continue;
}
OrderRequest o = orders.get(r.getOrderId()).get(0); OrderRequest o = orders.get(r.getOrderId()).get(0);
DispatchEngineerOrderListResp.OrderInfo item = new DispatchEngineerOrderListResp.OrderInfo();
item.setOrderId(r.getOrderId()); item.setOrderId(r.getOrderId());
item.setCategory(String.format("%s-%s", o.getType(), o.getBrand())); item.setCategory(String.format("%s-%s", o.getType(), o.getBrand()));
item.setSkill(o.getSkill()); item.setSkill(o.getSkill());
...@@ -217,7 +221,7 @@ public class DispatchServiceImpl implements DispatchService { ...@@ -217,7 +221,7 @@ public class DispatchServiceImpl implements DispatchService {
throw new BusinessException("技术员不存在"); throw new BusinessException("技术员不存在");
} }
List<OrderRequest> orders = this.queryOrderRequestByOrderIds(orderIds); List<OrderRequest> orders = orderRequestMPDao.selectByOrderIds(orderIds);
if (orders.isEmpty()) { if (orders.isEmpty()) {
throw new BusinessException("订单号错误"); throw new BusinessException("订单号错误");
} }
...@@ -297,16 +301,6 @@ public class DispatchServiceImpl implements DispatchService { ...@@ -297,16 +301,6 @@ public class DispatchServiceImpl implements DispatchService {
return orderRequestMPDao.selectList(lqw); return orderRequestMPDao.selectList(lqw);
} }
private List<OrderRequest> queryOrderRequestByOrderIds(List<String> orderIds) {
List<OrderRequest> orders = new ArrayList<>();
if (orderIds.isEmpty()) {
return orders;
}
LambdaQueryWrapper<OrderRequest> lqw = new LambdaQueryWrapper<>();
lqw.in(OrderRequest::getOrderId, orderIds);
return orderRequestMPDao.selectList(lqw);
}
private Map<String, List<OrderAppointment>> queryEngineerOrders(List<String> engineerCodes, String date) { private Map<String, List<OrderAppointment>> queryEngineerOrders(List<String> engineerCodes, String date) {
// 获取工程师服务单列表 // 获取工程师服务单列表
...@@ -360,8 +354,8 @@ public class DispatchServiceImpl implements DispatchService { ...@@ -360,8 +354,8 @@ public class DispatchServiceImpl implements DispatchService {
private HashMap<String, Integer> querySkillTakeTime() { private HashMap<String, Integer> querySkillTakeTime() {
HashMap<String, Integer> map = new HashMap<>(); HashMap<String, Integer> map = new HashMap<>();
List<ProductCategory> records = productCategoryMPDao.selectList(null); List<SkillInfo> records = skillInfoMPDao.selectList(null);
for (ProductCategory r : records) { for (SkillInfo r : records) {
String key = String.format("%s%s%sd", r.getBrand(), r.getType(), r.getSkill()); String key = String.format("%s%s%sd", r.getBrand(), r.getType(), r.getSkill());
map.put(key, r.getTakeTime()); map.put(key, r.getTakeTime());
} }
......
...@@ -155,9 +155,7 @@ public class EngineerServiceImpl implements EngineerService { ...@@ -155,9 +155,7 @@ public class EngineerServiceImpl implements EngineerService {
Set<String> sInput = new HashSet<>(skillGroupIds); Set<String> sInput = new HashSet<>(skillGroupIds);
Set<String> sDB = new HashSet<>(engineerSkills.getOrDefault(engineerCode, new ArrayList<>())); Set<String> sDB = new HashSet<>(engineerSkills.getOrDefault(engineerCode, new ArrayList<>()));
log.info("before sInput:{}, sDB:{}", sInput, sDB);
sInput.removeAll(sDB); sInput.removeAll(sDB);
log.info("after sInput:{}", sInput);
for (String skillGroupId : sInput) { for (String skillGroupId : sInput) {
EngineerSkillGroup e = new EngineerSkillGroup(); EngineerSkillGroup e = new EngineerSkillGroup();
e.setEngineerCode(engineerCode); e.setEngineerCode(engineerCode);
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!