Commit e024cfee by 丁伟峰

Merge branch 'dev-gantt' into develop

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