Commit 2068103e by 丁伟峰

Merge branch 'feature-dingwf-0715' into develop

2 parents 1dfaf6b1 df5651fa
...@@ -106,7 +106,7 @@ public class OrderCreateServiceImpl implements OrderCreateService { ...@@ -106,7 +106,7 @@ public class OrderCreateServiceImpl implements OrderCreateService {
String orderId = req.getOrderId(); String orderId = req.getOrderId();
if (StringUtils.isEmpty(orderId)) { if (StringUtils.isEmpty(orderId)) {
String s = UUID.randomUUID().toString().replace("-", ""); String s = UUID.randomUUID().toString().replace("-", "");
orderId = s.substring(s.length()-9); orderId = s.substring(s.length() - 9);
} }
entity.setOrderId(orderId); entity.setOrderId(orderId);
entity.setName(req.getName()); entity.setName(req.getName());
...@@ -131,7 +131,7 @@ public class OrderCreateServiceImpl implements OrderCreateService { ...@@ -131,7 +131,7 @@ public class OrderCreateServiceImpl implements OrderCreateService {
List<String> blockIds = null; List<String> blockIds = null;
List<String> layerIds = capacityUtils.getLayers(req.getBrand(), req.getType(), req.getSkill()); List<String> layerIds = capacityUtils.getLayers(req.getBrand(), req.getType(), req.getSkill());
if(req.getLocation() != null){ if (req.getLocation() != null) {
String loc = String.format("%f,%f", req.getLocation().getLng(), req.getLocation().getLat()); String loc = String.format("%f,%f", req.getLocation().getLng(), req.getLocation().getLat());
blockIds = saasUtils.queryBlocksByLocation(loc).stream().map(SaasUtils.BlockInfo::getBlockId).collect(Collectors.toList()); blockIds = saasUtils.queryBlocksByLocation(loc).stream().map(SaasUtils.BlockInfo::getBlockId).collect(Collectors.toList());
} else { } else {
...@@ -165,31 +165,30 @@ public class OrderCreateServiceImpl implements OrderCreateService { ...@@ -165,31 +165,30 @@ public class OrderCreateServiceImpl implements OrderCreateService {
entity.setAppointmentMethod("AUTO_NOW"); entity.setAppointmentMethod("AUTO_NOW");
orderRequestDao.save(entity); orderRequestDao.save(entity);
// 登记 // 登记
commonService.addOrderEvent(orderId, "", req.getSource(), "API", "创建订单", "创建订单", "" ); commonService.addOrderEvent(orderId, "", req.getSource(), "API", "创建订单", "创建订单", "");
// 指派检查,简单处理,遇到第一个可以指派的就停止检查 // 指派检查,简单处理,遇到第一个可以指派的就停止检查
tryVirtualAppointment(req, entity, orderId, teamId);
return Result.success(null);
}
private void tryVirtualAppointment(OrderCreateReqDTO req, OrderRequestEntity entity, String orderId, String teamId) {
try {
List<String> engineerCodes = engineerUtils.getEngineersByLevel("team", teamId).stream() List<String> engineerCodes = engineerUtils.getEngineersByLevel("team", teamId).stream()
.map(EngineerInfoEntity::getEngineerCode).collect(Collectors.toList()); .map(EngineerInfoEntity::getEngineerCode).collect(Collectors.toList());
List<String> matchEngineerCodes = engineerSkillDao.findAllByBrandAndTypeAndSkillAndEngineerCodeIn(req.getBrand(), req.getType(), req.getSkill(), engineerCodes).stream() List<String> matchEngineerCodes = engineerSkillDao.findAllByBrandAndTypeAndSkillAndEngineerCodeIn(req.getBrand(), req.getType(), req.getSkill(), engineerCodes).stream()
.map(EngineerSkillEntity::getEngineerCode).collect(Collectors.toList()); .map(EngineerSkillEntity::getEngineerCode).collect(Collectors.toList());
String assignEngineerCode = null; String assignEngineerCode = null;
for(String engineerCode: matchEngineerCodes){ for (String engineerCode : matchEngineerCodes) {
OrderAssignCheck.Result checkResult = orderAssignCheck.orderAssignCheck(entity.getOrderId(), engineerCode); OrderAssignCheck.Result checkResult = orderAssignCheck.orderAssignCheck(entity.getOrderId(), engineerCode);
if (checkResult.getCanAssign()){ if (checkResult.getCanAssign()) {
assignEngineerCode = engineerCode; assignEngineerCode = engineerCode;
break; break;
} }
} }
// 虚拟指派 // 虚拟指派登记
if (StringUtils.isNotBlank(assignEngineerCode)){ if (StringUtils.isNotBlank(assignEngineerCode)) {
tryVirtualAppointment(req, entity, orderId, assignEngineerCode);
}
return Result.success(null);
}
private void tryVirtualAppointment(OrderCreateReqDTO req, OrderRequestEntity entity, String orderId, String assignEngineerCode) {
try {
OrderAppointmentEntity oa = new OrderAppointmentEntity(); OrderAppointmentEntity oa = new OrderAppointmentEntity();
oa.setDt(entity.getDt()); oa.setDt(entity.getDt());
oa.setOrderId(entity.getOrderId()); oa.setOrderId(entity.getOrderId());
...@@ -215,12 +214,11 @@ public class OrderCreateServiceImpl implements OrderCreateService { ...@@ -215,12 +214,11 @@ public class OrderCreateServiceImpl implements OrderCreateService {
orderAppointmentDao.save(oa); orderAppointmentDao.save(oa);
// 登记 // 登记
commonService.addOrderEvent(orderId, "", req.getSource(), "API", "虚拟指派", "虚拟指派", ""); commonService.addOrderEvent(orderId, "", req.getSource(), "API", "虚拟指派", "虚拟指派", "");
}
log.info("==== 已经完成虚拟指派 ===="); log.info("==== 已经完成虚拟指派 ====");
} catch (Exception e){ } catch (Exception e) {
log.error("虚拟指派错误: {}", e.getMessage()); log.error("虚拟指派错误: {}", e.getMessage());
} }
} }
} }
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!