Commit c24594d8 by 丁伟峰

Merge branch 'dev-order-create' into develop

2 parents 6fd945d0 ab111cd5
......@@ -49,6 +49,9 @@ public class OrderInfoEntity {
@Column(name = "y", nullable = false, length = 20)
private String y="0";
@Column(name = "bean_brand", nullable = false, length = 20)
private String beanBrand;
@Column(name = "brand", nullable = false, length = 20)
private String brand;
......@@ -118,9 +121,12 @@ public class OrderInfoEntity {
@Column(name = "appointment_method", length = 20, columnDefinition = "varchar(20) default 'AUTO_BATCH'")
private String appointmentMethod;
@Column(name = "appointment_status", nullable = true, length = 20, columnDefinition = "varchar(20) default 'INIT'")
@Column(name = "appointment_status", length = 20, columnDefinition = "varchar(20) default 'INIT'")
private String appointmentStatus;
@Column(name = "dispatcher", length = 20, columnDefinition = "varchar(20) default ''")
private String dispatcher;
@Column(name = "order_status", length = 20, columnDefinition = "varchar(20) default 'NORMAL'")
private String orderStatus = "NORMAL";
......
......@@ -119,7 +119,8 @@ public class OrderCreateServiceImpl implements OrderCreateService {
entity.setOrderId(orderId);
entity.setName(req.getName());
entity.setPhone(req.getPhone());
entity.setBrand(req.getBrand());
entity.setBeanBrand(req.getBrand());
entity.setBrand(fixBrand(req.getBrand()));
entity.setType(req.getType());
entity.setSkill(req.getSkill());
entity.setFaultDescribe(req.getFaultDescribe());
......@@ -192,17 +193,17 @@ public class OrderCreateServiceImpl implements OrderCreateService {
commonService.addOrderEvent(orderId, "", req.getSource(), "API", "创建订单", "创建订单", "");
// 指派检查,简单处理,遇到第一个可以指派的就停止检查
tryVirtualAppointment(req, entity, teamId);
tryVirtualAppointment(entity, req.getSource(), teamId);
return Result.success(null);
}
private void tryVirtualAppointment(OrderCreateReqDTO req, OrderInfoEntity entity, String teamId) {
private void tryVirtualAppointment(OrderInfoEntity entity, String source, String teamId) {
// todo 等王力那边修改后,这边再进行整合,需要返回当前工单、后面的一个工单的数据情况,这边再进行修改
try {
List<String> engineerCodes = engineerUtils.getEngineersByLevel("team", teamId).stream()
.map(EngineerInfoEntity::getEngineerCode).collect(Collectors.toList());
List<String> matchEngineerCodes = engineerSkillDao.findAllByBrandAndTypeAndSkillAndEngineerCodeIn(req.getBrand(), req.getType(), req.getSkill(), engineerCodes).stream()
List<String> matchEngineerCodes = engineerSkillDao.findAllByBrandAndTypeAndSkillAndEngineerCodeIn(entity.getBrand(), entity.getType(), entity.getSkill(), engineerCodes).stream()
.map(EngineerSkillEntity::getEngineerCode).collect(Collectors.toList());
String assignEngineerCode = null;
OrderAssignCheck.Result checkResult = null;
......@@ -223,7 +224,8 @@ public class OrderCreateServiceImpl implements OrderCreateService {
EngineerInfoEntity engineerInfo = engineerInfoDao.getByEngineerCode(assignEngineerCode);
entity.setEngineerName(engineerInfo.getName());
entity.setEngineerPhone(engineerInfo.getPhone());
entity.setAppointmentStatus("VIRTUAL");
entity.setAppointmentStatus("PRE");
entity.setDispatcher("AUTO_NOW");
entity.setPlanStartTime(checkResult.getStart());
entity.setPlanEndTime(checkResult.getEnd());
entity.setArriveDistance(checkResult.getDistanceAddition());
......@@ -233,7 +235,7 @@ public class OrderCreateServiceImpl implements OrderCreateService {
// 如果影响到原有工单,修改原有工单
// 登记
commonService.addOrderEvent(entity.getOrderId(), entity.getSubId(), req.getSource(), "API", "虚拟指派", "虚拟指派", "");
commonService.addOrderEvent(entity.getOrderId(), entity.getSubId(), source, "API", "虚拟指派", "虚拟指派", "");
}
log.info("==== 已经完成虚拟指派 ====");
} catch (Exception e) {
......@@ -244,4 +246,12 @@ public class OrderCreateServiceImpl implements OrderCreateService {
private String newSubId(String orderId, LocalDate date) {
return String.format("%s_%s", orderId, DateUtils.formatDateTime(LocalDateTime.now(), "MMdd"));
}
private String fixBrand(String brand){
if (!brand.equals("嘉格纳")){
return "博世/西门子以及其他品牌";
} else {
return brand;
}
}
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!