Commit 6ce8c504 by 丁伟峰

根据工单的服务状态,选择使用计划时间或者实际时间

1 parent 2082a728
......@@ -24,10 +24,8 @@ public class EngineerGanttServiceImpl implements EngineerGanttService {
@Autowired
private CapacityEngineerStatDao capacityEngineerStatDao;
@Autowired
private EngineerInfoDao engineerInfoDao;
@Autowired
private EngineerUtils engineerUtils;
@Autowired
......@@ -38,9 +36,11 @@ public class EngineerGanttServiceImpl implements EngineerGanttService {
private String getHourMinute(LocalDateTime time){
return this.getHourMinute(time, 0);
}
private String getHourMinute(LocalDateTime time, int deltaMinute){
return DateUtils.formatDateTime(time.plusMinutes(deltaMinute), "HH:mm");
}
@Override
public Result<?> getEngineersGanttList(EngineersGanttDTO.Request reqDTO) {
// 按日期返回技术员们当天的服务甘特图,不需要翻页
......@@ -59,8 +59,13 @@ public class EngineerGanttServiceImpl implements EngineerGanttService {
EngineersGanttDTO.Slot slot = new EngineersGanttDTO.Slot();
// todo 需要根据订单时间和状态,采用expectXXXX或者actualXXXX
slot.setOrderId(e.getOrderId());
if (checkOrderIsFinish(e.getServiceStatus())) {
slot.setBtime(getHourMinute(e.getActualStartTime()));
slot.setEtime(getHourMinute(e.getActualEndTime()));
} else {
slot.setBtime(getHourMinute(e.getPlanStartTime()));
slot.setEtime(getHourMinute(e.getPlanEndTime()));
}
slot.setTooltip(getOrderTips(e.getOrderId()));
OrderSkillProjection orderSkill = orderInfoDao.getOrderSkillCaptionByOrderId(e.getOrderId());
if (orderSkill != null) {
......@@ -78,8 +83,13 @@ public class EngineerGanttServiceImpl implements EngineerGanttService {
if(e.getArriveElapsed() > 0) {
// 有在途,起止时间,分别是订单的开始时间减去在途时间、订单的开始时间
slot = new EngineersGanttDTO.Slot();
if (checkOrderIsFinish(e.getServiceStatus())) {
slot.setBtime(getHourMinute(e.getActualStartTime(), -e.getArriveElapsed()));
slot.setEtime(getHourMinute(e.getActualStartTime()));
} else {
slot.setBtime(getHourMinute(e.getPlanStartTime(), -e.getArriveElapsed()));
slot.setEtime(getHourMinute(e.getPlanStartTime()));
}
slot.setShapeSize("mini");
slot.setBgColor(getColor("ONWAY"));
slots.add(slot);
......@@ -150,12 +160,6 @@ public class EngineerGanttServiceImpl implements EngineerGanttService {
}
}
public Map<String, OrderInfoEntity> getOrdersByOrderIds(List<String> orderIds) {
List<OrderInfoEntity> orders = orderInfoDao.findAllByOrderIdIn(orderIds);
return orders.stream().collect(Collectors.toMap(OrderInfoEntity::getOrderId, order -> order));
}
private List<LabelValueDTO> getOrderTips(String orderId) {
// log.info("==> getOrderTips: orderId[{}]", orderId);
OrderInfoEntity order = orderInfoDao.getByOrderId(orderId);
......@@ -174,6 +178,10 @@ public class EngineerGanttServiceImpl implements EngineerGanttService {
return tips;
}
private boolean checkOrderIsFinish(String serviceStatus){
String[] array = {"FINISHED", "UNFINISHED"};
return Arrays.asList(array).contains(serviceStatus);
}
private String getColor(String colorType){
String[][] bgColor = {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!