Commit e24874d9 by 刘鑫

Merge branch 'develop' of https://gitlab.dituhui.com/bsh/project/project into develop-16542

2 parents 087edfee d5ab6e90
...@@ -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,47 +160,76 @@ public class OrderCreateServiceImpl implements OrderCreateService { ...@@ -157,47 +160,76 @@ 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());
} }
// 分单处理
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())) { entity.setIsAppointEngineer(req.getIsAppointEngineer());
return fendanResult; String appointEngineerCodes = CollectionUtils.isEmpty(req.getAppointEngineerCodes()) ? "" : String.join(",", req.getAppointEngineerCodes());
} entity.setAppointEngineerCodes(appointEngineerCodes);
if (!fendanResult.getCode().equals(ResultEnum.SUCCESS.getCode()) || ObjectUtil.isNull(fendanResult.getResult())) { if (req.getIsAppointEngineer() == 1) {
if (fendanResult.getCode().equals(StatusCodeEnum.FENDAN_IS_TRANSCEND.getCode())) { EngineerInfoEntity engineerInfo = engineerInfoDao.getByEngineerCode(req.getAppointEngineerCodes().get(0));
// 处理超派 OrgTeamEngineerEntity orgTeamEngineer = orgTeamEngineerDao.findByEngineerCode(req.getAppointEngineerCodes().get(0));
entity.setTranscend(1); OrgTeamEntity byTeamId = orgTeamDao.getByTeamId(orgTeamEngineer.getTeamId());
} entity.setEngineerCode(engineerInfo.getEngineerCode());
OrgBranchEntity branchEntity = orgBranchDao.findByCitycodeListLike("%" + adminDistrict.getResult().getSubNames().getCity() + "%"); entity.setEngineerName(engineerInfo.getName());
entity.setOrgClusterId(branchEntity.getClusterId()); entity.setEngineerPhone(engineerInfo.getPhone());
entity.setOrgBranchId(branchEntity.getBranchId()); entity.setEngineerPhone(engineerInfo.getPhone());
entity.setAppointmentMethod(AppointmentMethodEnum.MANUAL.name()); entity.setOrgClusterId(byTeamId.getClusterId());
//发送通知分部消息 entity.setOrgBranchId(byTeamId.getBranchId());
sendMsg(branchEntity.getBranchId(), orderId, entity.getExpectTimeBegin().toLocalDate()); entity.setOrgGroupId(byTeamId.getGroupId());
} else { entity.setOrgTeamId(byTeamId.getTeamId());
// 根据分单工作队,填写clusterId/branchId/groupId/teamId等 entity.setAppointmentMethod(AppointmentMethodEnum.AUTO_NOW.name());
OrgTeamInfo teamInfo = fendanResult.getResult(); entity.setAppointmentStatus(OrderFlowEnum.CONFIRM.name());
entity.setOrgClusterId(teamInfo.getClusterId());
entity.setOrgBranchId(teamInfo.getBranchId());
entity.setOrgGroupId(teamInfo.getGroupId());
entity.setOrgTeamId(teamInfo.getTeamId());
entity.setAppointmentStatus(OrderFlowEnum.PRE.name());
//特殊时间段 //特殊时间段
Integer special = CommonUtil.isSpecial(entity.getExpectTimeBegin().toLocalTime(), Integer special = CommonUtil.isSpecial(entity.getExpectTimeBegin().toLocalTime(),
entity.getExpectTimeEnd().toLocalTime(), teamInfo.getWorkOn(), teamInfo.getWorkOff()); entity.getExpectTimeEnd().toLocalTime(), byTeamId.getWorkOn(), byTeamId.getWorkOff());
Integer cutoff = CommonUtil.isCutoff(LocalDateTime.now(), teamInfo.getWorkOff()); Integer cutoff = CommonUtil.isCutoff(LocalDateTime.now(), byTeamId.getWorkOff());
// 处理cutoff 动态排班结束后创建的当日单和次日单 entity.setIsCutoff(cutoff);
boolean isToday = DateUtil.judgeTimeIsToday(entity.getExpectTimeBegin()); entity.setIsSpecialTime(special);
boolean isTomorrow = DateUtil.judgeTimeIsisTomorrow(entity.getExpectTimeBegin()); } else {
// 特殊时间段,当天单,cutoff需要人工处理 // 分单处理
if (isToday || (isTomorrow && cutoff == 1) || special == 1) { Result<OrgTeamInfo> fendanResult = fendanService.fendanToGroupCapacity(req, 2, entity.getExpectTimeBegin().toLocalDate(), entity.getExpectTimeBegin().toLocalTime(), entity.getExpectTimeEnd().toLocalTime());
//判断是否在今天cutoff之后 if (fendanResult.getCode().equals(StatusCodeEnum.ORDER_SKILL_NOT_EXISTS.getCode())) {
entity.setIsCutoff(cutoff); return fendanResult;
entity.setIsSpecialTime(special); }
if (!fendanResult.getCode().equals(ResultEnum.SUCCESS.getCode()) || ObjectUtil.isNull(fendanResult.getResult())) {
if (fendanResult.getCode().equals(StatusCodeEnum.FENDAN_IS_TRANSCEND.getCode())) {
// 处理超派
entity.setTranscend(1);
}
OrgBranchEntity branchEntity = orgBranchDao.findByCitycodeListLike("%" + adminDistrict.getResult().getSubNames().getCity() + "%");
entity.setOrgClusterId(branchEntity.getClusterId());
entity.setOrgBranchId(branchEntity.getBranchId());
entity.setAppointmentMethod(AppointmentMethodEnum.MANUAL.name()); entity.setAppointmentMethod(AppointmentMethodEnum.MANUAL.name());
//发送通知分部消息 //发送通知分部消息
sendMsg(teamInfo.getBranchId(), orderId, entity.getExpectTimeBegin().toLocalDate()); sendMsg(branchEntity.getBranchId(), orderId, entity.getExpectTimeBegin().toLocalDate());
} else {
// 根据分单工作队,填写clusterId/branchId/groupId/teamId等
OrgTeamInfo teamInfo = fendanResult.getResult();
entity.setOrgClusterId(teamInfo.getClusterId());
entity.setOrgBranchId(teamInfo.getBranchId());
entity.setOrgGroupId(teamInfo.getGroupId());
entity.setOrgTeamId(teamInfo.getTeamId());
entity.setAppointmentStatus(OrderFlowEnum.PRE.name());
//特殊时间段
Integer special = CommonUtil.isSpecial(entity.getExpectTimeBegin().toLocalTime(),
entity.getExpectTimeEnd().toLocalTime(), teamInfo.getWorkOn(), teamInfo.getWorkOff());
Integer cutoff = CommonUtil.isCutoff(LocalDateTime.now(), teamInfo.getWorkOff());
// 处理cutoff 动态排班结束后创建的当日单和次日单
boolean isToday = DateUtil.judgeTimeIsToday(entity.getExpectTimeBegin());
boolean isTomorrow = DateUtil.judgeTimeIsisTomorrow(entity.getExpectTimeBegin());
// 特殊时间段,当天单,cutoff需要人工处理
if (isToday || (isTomorrow && cutoff == 1) || special == 1) {
//判断是否在今天cutoff之后
entity.setIsCutoff(cutoff);
entity.setIsSpecialTime(special);
entity.setAppointmentMethod(AppointmentMethodEnum.MANUAL.name());
entity.setAppointmentStatus(OrderFlowEnum.INIT.name());
//发送通知分部消息
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!