Commit c3f5b81c by huangjinxin

fix:指定工程师,取消工单相关

1 parent 6e1de546
...@@ -34,4 +34,6 @@ public interface OrgTeamEngineerDao extends JpaRepository<OrgTeamEngineerEntity, ...@@ -34,4 +34,6 @@ public interface OrgTeamEngineerDao extends JpaRepository<OrgTeamEngineerEntity,
@Modifying @Modifying
@Query("UPDATE OrgTeamEngineerEntity tt SET tt.status = :status WHERE tt.teamId = :teamId AND tt.engineerCode IN :engineerCodes") @Query("UPDATE OrgTeamEngineerEntity tt SET tt.status = :status WHERE tt.teamId = :teamId AND tt.engineerCode IN :engineerCodes")
void updateStatusByEngineerCodes(String teamId, List<String> engineerCodes, int status); void updateStatusByEngineerCodes(String teamId, List<String> engineerCodes, int status);
OrgTeamEngineerEntity findByEngineerCode(String engineerCode);
} }
...@@ -80,6 +80,9 @@ public class OrderCreateServiceImpl implements OrderCreateService { ...@@ -80,6 +80,9 @@ public class OrderCreateServiceImpl implements OrderCreateService {
private EngineerInfoDao engineerInfoDao; private EngineerInfoDao engineerInfoDao;
@Autowired @Autowired
private OrgTeamEngineerDao orgTeamEngineerDao;
@Autowired
private OrderInfoDao orderInfoDao; private OrderInfoDao orderInfoDao;
@Autowired @Autowired
...@@ -147,7 +150,7 @@ public class OrderCreateServiceImpl implements OrderCreateService { ...@@ -147,7 +150,7 @@ public class OrderCreateServiceImpl implements OrderCreateService {
entity.setExpectTimeBegin(DateUtil.fromDate(req.getExpectBegin())); entity.setExpectTimeBegin(DateUtil.fromDate(req.getExpectBegin()));
entity.setExpectTimeEnd(DateUtil.fromDate(req.getExpectEnd())); entity.setExpectTimeEnd(DateUtil.fromDate(req.getExpectEnd()));
entity.setAppointmentStatus(OrderFlowEnum.INIT.name()); entity.setAppointmentStatus(OrderFlowEnum.INIT.name());
entity.setAppointmentMethod(AppointmentMethodEnum.AUTO_NOW.name()); entity.setAppointmentMethod(AppointmentMethodEnum.AUTO_BATCH.name());
//获取省市区 //获取省市区
AdministrativeDistrictReq administrativeDistrictReq = new AdministrativeDistrictReq(); AdministrativeDistrictReq administrativeDistrictReq = new AdministrativeDistrictReq();
administrativeDistrictReq.setPoints(location.getLongitude() + "," + location.getLatitude()); administrativeDistrictReq.setPoints(location.getLongitude() + "," + location.getLatitude());
...@@ -157,6 +160,32 @@ public class OrderCreateServiceImpl implements OrderCreateService { ...@@ -157,6 +160,32 @@ public class OrderCreateServiceImpl implements OrderCreateService {
entity.setCity(adminDistrict.getResult().getSubNames().getCity()); entity.setCity(adminDistrict.getResult().getSubNames().getCity());
entity.setCounty(adminDistrict.getResult().getSubNames().getCounty()); entity.setCounty(adminDistrict.getResult().getSubNames().getCounty());
} }
// 处理指派工程师
entity.setIsAppointEngineer(req.getIsAppointEngineer());
String appointEngineerCodes = CollectionUtils.isEmpty(req.getAppointEngineerCodes()) ? "" : String.join(",", req.getAppointEngineerCodes());
entity.setAppointEngineerCodes(appointEngineerCodes);
if (req.getIsAppointEngineer() == 1) {
EngineerInfoEntity engineerInfo = engineerInfoDao.getByEngineerCode(req.getAppointEngineerCodes().get(0));
OrgTeamEngineerEntity orgTeamEngineer = orgTeamEngineerDao.findByEngineerCode(req.getAppointEngineerCodes().get(0));
OrgTeamEntity byTeamId = orgTeamDao.getByTeamId(orgTeamEngineer.getTeamId());
entity.setEngineerCode(engineerInfo.getEngineerCode());
entity.setEngineerName(engineerInfo.getName());
entity.setEngineerPhone(engineerInfo.getPhone());
entity.setEngineerPhone(engineerInfo.getPhone());
entity.setOrgClusterId(byTeamId.getClusterId());
entity.setOrgBranchId(byTeamId.getBranchId());
entity.setOrgGroupId(byTeamId.getGroupId());
entity.setOrgTeamId(byTeamId.getTeamId());
entity.setAppointmentMethod(AppointmentMethodEnum.AUTO_NOW.name());
entity.setAppointmentStatus(OrderFlowEnum.CONFIRM.name());
//特殊时间段
Integer special = CommonUtil.isSpecial(entity.getExpectTimeBegin().toLocalTime(),
entity.getExpectTimeEnd().toLocalTime(), byTeamId.getWorkOn(), byTeamId.getWorkOff());
Integer cutoff = CommonUtil.isCutoff(LocalDateTime.now(), byTeamId.getWorkOff());
entity.setIsCutoff(cutoff);
entity.setIsSpecialTime(special);
} else {
// 分单处理 // 分单处理
Result<OrgTeamInfo> fendanResult = fendanService.fendanToGroupCapacity(req, 2, entity.getExpectTimeBegin().toLocalDate(), entity.getExpectTimeBegin().toLocalTime(), entity.getExpectTimeEnd().toLocalTime()); Result<OrgTeamInfo> fendanResult = fendanService.fendanToGroupCapacity(req, 2, entity.getExpectTimeBegin().toLocalDate(), entity.getExpectTimeBegin().toLocalTime(), entity.getExpectTimeEnd().toLocalTime());
if (fendanResult.getCode().equals(StatusCodeEnum.ORDER_SKILL_NOT_EXISTS.getCode())) { if (fendanResult.getCode().equals(StatusCodeEnum.ORDER_SKILL_NOT_EXISTS.getCode())) {
...@@ -194,10 +223,13 @@ public class OrderCreateServiceImpl implements OrderCreateService { ...@@ -194,10 +223,13 @@ public class OrderCreateServiceImpl implements OrderCreateService {
entity.setIsCutoff(cutoff); entity.setIsCutoff(cutoff);
entity.setIsSpecialTime(special); entity.setIsSpecialTime(special);
entity.setAppointmentMethod(AppointmentMethodEnum.MANUAL.name()); entity.setAppointmentMethod(AppointmentMethodEnum.MANUAL.name());
entity.setAppointmentStatus(OrderFlowEnum.INIT.name());
//发送通知分部消息 //发送通知分部消息
sendMsg(teamInfo.getBranchId(), orderId, entity.getExpectTimeBegin().toLocalDate()); sendMsg(teamInfo.getBranchId(), orderId, entity.getExpectTimeBegin().toLocalDate());
} }
} }
}
// 字段转换 // 字段转换
entity.setSource(req.getSource()); entity.setSource(req.getSource());
entity.setOrderId(orderId); entity.setOrderId(orderId);
...@@ -226,11 +258,6 @@ public class OrderCreateServiceImpl implements OrderCreateService { ...@@ -226,11 +258,6 @@ public class OrderCreateServiceImpl implements OrderCreateService {
entity.setBeanSubStatus(""); entity.setBeanSubStatus("");
entity.setWorkshop(false); entity.setWorkshop(false);
// 处理工程师
entity.setIsAppointEngineer(req.getIsAppointEngineer());
String appointEngineerCodes = CollectionUtils.isEmpty(req.getAppointEngineerCodes()) ? "" : String.join(",", req.getAppointEngineerCodes());
entity.setAppointEngineerCodes(appointEngineerCodes);
// 处理技能和标签 // 处理技能和标签
SkillInfoEntity skillInfoEntity = skillInfoDao.getByBrandAndTypeAndSkill(peaBrand, req.getProductType(), req.getServiceType()); SkillInfoEntity skillInfoEntity = skillInfoDao.getByBrandAndTypeAndSkill(peaBrand, req.getProductType(), req.getServiceType());
assert skillInfoEntity != null; assert skillInfoEntity != null;
......
...@@ -154,8 +154,9 @@ public class OrderInfoServiceImpl implements OrderInfoService { ...@@ -154,8 +154,9 @@ public class OrderInfoServiceImpl implements OrderInfoService {
//记录流程 //记录流程
commonService.addOrderEvent(request.getOrderId(), "", "BEAN", "BEAN", OrderStatusEnum.NORMAL.getDescription(), request.getStage(), "", LocalDateTimeUtil.of(request.getHappen())); commonService.addOrderEvent(request.getOrderId(), "", "BEAN", "BEAN", OrderStatusEnum.NORMAL.getDescription(), request.getStage(), "", LocalDateTimeUtil.of(request.getHappen()));
} else if (request.getOrderStatus().equalsIgnoreCase(OrderStatusEnum.CANCELED.getCode())) { } else if (request.getOrderStatus().equalsIgnoreCase(OrderStatusEnum.CANCELED.getCode())) {
orderInfo.setServiceStatus(BeanServiceFlowEnum.FINISHED.getStatus()); orderInfo.setServiceStatus("");
orderInfo.setOrderStatus(OrderStatusEnum.CANCELED.getDescription()); orderInfo.setOrderStatus(OrderStatusEnum.CANCELED.getCode());
orderInfo.setAppointmentStatus("");
if (StringUtils.isBlank(request.getDescription())) { if (StringUtils.isBlank(request.getDescription())) {
orderInfo.setDescription(request.getDescription()); orderInfo.setDescription(request.getDescription());
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!