Commit 25bf4a87 by huangjinxin

fix:1:特殊时间判断

2:推荐工程师空位置处理
3:放回工单池推送
4:bean消息推送优化
1 parent ca328e5f
......@@ -83,6 +83,15 @@ public class OrderAssignCheck {
double[] location = this.getEngineerDepartureLocation(engineerCode);
double preX = location[0];
double preY = location[1];
if (preX == 0 || preY == 0) {
// 当前节点信息
OrderNode curOrder = new OrderNode();
curOrder.setOrderId(orderId);
curOrder.setArriveElapsed(0);
curOrder.setArriveDistance(0);
curOrder.setTakeTime(takeTime);
return new Result(index, true, true, orderId, "",0, 0, curOrder, null, null);
}
OrderSegment pre = new OrderSegment(480, 480, preX, preY, 0, 0, 0);
Pair p = this.getDistanceAndDuration(pre.getX(), pre.getY(), curX, curY);
......@@ -110,6 +119,15 @@ public class OrderAssignCheck {
double[] location = this.getEngineerDepartureLocation(engineerCode);
double preX = location[0];
double preY = location[1];
if (preX == 0 || preY == 0) {
// 当前节点信息
OrderNode curOrder = new OrderNode();
curOrder.setOrderId(orderId);
curOrder.setArriveElapsed(0);
curOrder.setArriveDistance(0);
curOrder.setTakeTime(takeTime);
return new Result(index, true, true, orderId, "",0, 0, curOrder, null, null);
}
OrderSegment pre = new OrderSegment(480, 480, preX, preY, 0, 0, 0);
OrderSegment cur = new OrderSegment(-1, -1, curX, curY, takeTime, -1, -1);
......@@ -254,6 +272,9 @@ public class OrderAssignCheck {
//从org_group中获取
EngineerInfoEntity e = engineerInfoDao.getByEngineerCode(engineerCode);
OrgGroupEntity g = orgGroupDao.getByGroupId(e.getGroupId());
if (StringUtils.isBlank(g.getX()) || StringUtils.isBlank(g.getY())) {
return new double[]{Double.parseDouble("0"), Double.parseDouble("0")};
}
return new double[]{Double.parseDouble(g.getX()), Double.parseDouble(g.getY())};
}
......
......@@ -77,10 +77,10 @@ public interface OrderInfoService {
*
* @param source 原订单
* @param target 改动后订单
* @param happened 变动发生时间
* @param rescheduled 工单计划时间
* @param reason 改约原因
* @param operator 操作人
* @return
*/
Boolean rescheduled(OrderInfoEntity source, OrderInfoEntity target, Date happened, String reason, String operator);
Boolean rescheduled(OrderInfoEntity source, OrderInfoEntity target, Date rescheduled, String reason, String operator);
}
......@@ -275,7 +275,7 @@ public class OrderAssignImpl implements OrderAssign {
return Result.failed(StatusCodeEnum.ORDER_FINISHED);
}
final OrderInfoEntity sourceOrder = new OrderInfoEntity();
BeanUtils.copyProperties(sourceOrder, sourceOrder);
BeanUtils.copyProperties(order, sourceOrder);
OrgTeamEntity orgTeam = orgTeamDao.getByTeamId(order.getOrgTeamId());
// 判断cutoff
Integer cutoff = CommonUtil.isCutoff(order.getExpectTimeBegin(), orgTeam.getWorkOff());
......
......@@ -493,7 +493,7 @@ public class OrderInfoServiceImpl implements OrderInfoService {
@Override
public Boolean rescheduled(OrderInfoEntity source, OrderInfoEntity target, Date happened, String reason, String operator) {
public Boolean rescheduled(OrderInfoEntity source, OrderInfoEntity target, Date rescheduledDate, String reason, String operator) {
if (source.getOrderId().startsWith("peatest") || Objects.equals(operator, "BEAN")) {
return true;
}
......@@ -502,13 +502,15 @@ public class OrderInfoServiceImpl implements OrderInfoService {
rescheduled.setInitiatorOfRescheduling(operator);
rescheduled.setReasonForRescheduling(OrderReschedulingReason.getReason(reason));
rescheduled.setRescheduledDate(happened.getTime());
rescheduled.setRescheduledDate(DateUtil.toMilliseconds(target.getPlanStartTime()));
rescheduled.setRequireApprove(Boolean.FALSE);
if (StringUtils.isNotBlank(target.getEngineerCode())) {
String engineerCode = target.getEngineerCode();
EngineerInfoEntity byEngineerCode = engineerInfoDao.getByEngineerCode(engineerCode);
rescheduled.setExecutorWorkNo(byEngineerCode.getCosmosId());
rescheduled.setOrgUnitId(byEngineerCode.getGroupId());
}
if (StringUtils.isNotBlank(target.getEngineerCodeSub())) {
EngineerInfoEntity code = engineerInfoDao.getByEngineerCode(target.getEngineerCodeSub());
rescheduled.setAssistantWorkNo(code.getCosmosId());
......@@ -516,7 +518,7 @@ public class OrderInfoServiceImpl implements OrderInfoService {
}
//判断是否是改派
if ((StringUtils.isNotBlank(target.getEngineerCode()) && !Objects.equals(engineerCode, source.getEngineerCode())) ||
if ((StringUtils.isNotBlank(target.getEngineerCode()) && !Objects.equals(target.getEngineerCode(), source.getEngineerCode())) ||
(StringUtils.isNotBlank(target.getEngineerCodeSub()) && !Objects.equals(target.getEngineerCodeSub(), source.getEngineerCodeSub()))) {
rescheduled.setReassignment(Boolean.TRUE);
} else {
......@@ -649,6 +651,8 @@ public class OrderInfoServiceImpl implements OrderInfoService {
continue;
}
OrderInfoEntity nestOrder = orderInfoDao.getByOrderId(orderSegment.getOrderId());
final OrderInfoEntity sourceOrder = new OrderInfoEntity();
BeanUtils.copyProperties(nestOrder, sourceOrder);
if (orderSegment.getIsSub()) {
nestOrder.setSubPlanStartTime(nestOrder.getSubPlanStartTime().plusMinutes(moveTime));
nestOrder.setSubPlanEndTime(nestOrder.getSubPlanEndTime().plusMinutes(moveTime));
......@@ -656,6 +660,13 @@ public class OrderInfoServiceImpl implements OrderInfoService {
nestOrder.setPlanStartTime(nestOrder.getPlanStartTime().plusMinutes(moveTime));
nestOrder.setPlanEndTime(nestOrder.getPlanEndTime().plusMinutes(moveTime));
}
//回调改约
Boolean boo = this.rescheduled(sourceOrder, nestOrder, new Date(), "", "PEA");
log.info("[insterEngineerOrders] orderId:{}, 通知bean结果: {}", nestOrder.getOrderId(), boo);
if (!boo) {
log.info("[insterEngineerOrders] orderId:{}, 服务工单变更结果通知BEAN失败", nestOrder.getOrderId());
throw new BusinessException("服务工单变更结果通知BEAN失败");
}
orderInfoDao.save(nestOrder);
continue;
}
......@@ -694,6 +705,8 @@ public class OrderInfoServiceImpl implements OrderInfoService {
}
OrderInfoEntity nestOrder = orderInfoDao.getByOrderId(nestOrderSegment.getOrderId());
final OrderInfoEntity sourceOrder = new OrderInfoEntity();
BeanUtils.copyProperties(nestOrder, sourceOrder);
nestOrder.setArriveElapsed(roadTime);
nestOrder.setArriveDistance(BigDecimal.valueOf(distanceDTO.getDis()).intValue());
if (orderSegment.getStart().plusMinutes(takeTime + roadTime).compareTo(nestOrder.getPlanStartTime()) > 0) {
......@@ -705,6 +718,13 @@ public class OrderInfoServiceImpl implements OrderInfoService {
isMove = true;
continue;
}
//回调改约
Boolean boo = this.rescheduled(sourceOrder, nestOrder, new Date(), "", "PEA");
log.info("[insterEngineerOrders] orderId:{}, 通知bean结果: {}", nestOrder.getOrderId(), boo);
if (!boo) {
log.info("[insterEngineerOrders] orderId:{}, 服务工单变更结果通知BEAN失败", nestOrder.getOrderId());
throw new BusinessException("服务工单变更结果通知BEAN失败");
}
orderInfoDao.save(nestOrder);
return Result.success(insertOrder);
}
......@@ -769,6 +789,8 @@ public class OrderInfoServiceImpl implements OrderInfoService {
}
OrderInfoEntity nestOrder = orderInfoDao.getByOrderId(orderSegment.getOrderId());
final OrderInfoEntity sourceOrder = new OrderInfoEntity();
BeanUtils.copyProperties(nestOrder, sourceOrder);
long minutes = Duration.between(nestOrder.getPlanStartTime(), planStartTime.plusMinutes(takeTime + roadTime)).toMinutes();
if (orderSegment.getIsSub()) {
nestOrder = handleSubOrder(nestOrder, nestOrder.getPlanStartTime().plusMinutes(minutes), roadTime, BigDecimal.valueOf(distanceDTO.getDis()).intValue());
......@@ -778,6 +800,13 @@ public class OrderInfoServiceImpl implements OrderInfoService {
nestOrder.setPlanStartTime(nestOrder.getPlanStartTime().plusMinutes(minutes));
nestOrder.setPlanEndTime(nestOrder.getPlanEndTime().plusMinutes(minutes));
}
//回调改约
Boolean boo = this.rescheduled(sourceOrder, nestOrder, new Date(), "", "PEA");
log.info("[insterEngineerOrders] orderId:{}, 通知bean结果: {}", nestOrder.getOrderId(), boo);
if (!boo) {
log.info("[insterEngineerOrders] orderId:{}, 服务工单变更结果通知BEAN失败", nestOrder.getOrderId());
throw new BusinessException("服务工单变更结果通知BEAN失败");
}
orderInfoDao.save(nestOrder);
//下一单为待插入订单且为最后一单直接返回
if (i == orderSegments.size() - 2) {
......
......@@ -78,7 +78,8 @@ public class CommonUtil {
public static Integer isSpecial(LocalTime expectBegin, LocalTime expectEnd, String strOn, String strOff) {
LocalTime workOn = LocalTime.parse(strOn + ":00", DateUtil.TIME_FORMATTER);
LocalTime workOff = LocalTime.parse(strOff + ":00", DateUtil.TIME_FORMATTER);
if (expectBegin.isBefore(workOn) || expectBegin.isAfter(workOff) || expectEnd.isAfter(workOff) || expectEnd.isBefore(workOn)) {
// if (expectBegin.isBefore(workOn) || expectBegin.isAfter(workOff) || expectEnd.isAfter(workOff) || expectEnd.isBefore(workOn)) {
if (expectBegin.isAfter(workOff) || expectEnd.isBefore(workOn)) {
return 1;
}
return 0;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!