Commit c634219c by 丁伟峰

技术员甘特图要素修改

1 parent 7a8fc959
package com.alibaba.cloud.integration.order.dao;
import com.alibaba.cloud.integration.order.entity.CapacityEngineerStatEntity;
import org.springframework.data.jpa.repository.JpaRepository;
public interface CapacityEngineerStatDao extends JpaRepository<CapacityEngineerStatEntity, Integer> {
CapacityEngineerStatEntity getByEngineerCodeAndWorkday(String engineerCode, String workday);
}
......@@ -26,6 +26,10 @@ public class WorkbenchEngineersGanttRespDTO {
* 工程师工号
*/
private String engineerCode;
private String engineerName;
private String capTotal;
private String capUsed;
private String grade;
/**
* 延误原因展示说明
*/
......@@ -38,28 +42,35 @@ public class WorkbenchEngineersGanttRespDTO {
* 上班时间
*/
private String startTime;
private List<?> timeline;
private List<?> orders;
}
@lombok.Data
@Accessors(chain = true)
public static class Timeline {
public static class Order {
/**
* 结束时间
* 工单ID
*/
private Date endTime;
private String orderId;
/**
* 服务单ID
* 工单状态值
*/
private String serviceOrderId;
private String orderStatus;
/**
* 服务单状态值
* 工单状态描述
*/
private String serviceOrderStatus;
private String orderStatusDesc;
/**
* 开始时间
*/
private Date startTime;
/**
* 结束时间
*/
private Date endTime;
/**
* 鼠标悬停提示
*/
private List<?> tips;
}
......
package com.alibaba.cloud.integration.order.entity;
import lombok.Data;
import javax.persistence.*;
import java.util.Date;
@Data
@Entity
@Table(name="capacity_engineer_stat")
public class CapacityEngineerStatEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
/**
* 日期
*/
private String workday;
/**
* 技术员id
*/
private String engineerCode;
/**
* 总容量(分钟)
*/
private Integer capTotal;
/**
* 已占容量
*/
private Integer capUsed;
/**
* 已占容量-路途
*/
private Integer capUsedTravel;
/**
* 剩余可约容量
*/
private Integer capLeft;
/**
* 已约单量
*/
private Integer orderCount;
/**
* 最大连续时长
*/
private Integer maxDuration;
/**
* 备注
*/
private String memo;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新时间
*/
private Date updateTime;
}
package com.alibaba.cloud.integration.order.service.impl;
import com.alibaba.cloud.integration.common.Result;
import com.alibaba.cloud.integration.order.dao.OrderAppointmentDao;
import com.alibaba.cloud.integration.order.dao.OrderChangeDao;
import com.alibaba.cloud.integration.order.dao.OrderRequestDao;
import com.alibaba.cloud.integration.order.dao.*;
import com.alibaba.cloud.integration.order.dto.WorkbenchEngineersGanttReqDTO;
import com.alibaba.cloud.integration.order.dto.WorkbenchEngineersGanttRespDTO;
import com.alibaba.cloud.integration.order.dto.WorkbenchOrderChangeListReqDTO;
import com.alibaba.cloud.integration.order.dto.WorkbenchOrderChangeListRespDTO;
import com.alibaba.cloud.integration.order.entity.OrderAppointmentEntity;
import com.alibaba.cloud.integration.order.entity.OrderChangeEntity;
import com.alibaba.cloud.integration.order.entity.OrderRequestEntity;
import com.alibaba.cloud.integration.order.entity.*;
import com.alibaba.cloud.integration.order.service.WorkbenchService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -36,6 +32,12 @@ public class WorkbenchServiceImpl implements WorkbenchService {
@Autowired
private OrderAppointmentDao orderAppointmentDao;
@Autowired
private EngineerInfoDao engineerInfoDao;
@Autowired
private CapacityEngineerStatDao capacityEngineerStatDao;
@Override
public Result<?> getOrderChangeList(WorkbenchOrderChangeListReqDTO orderChangeListReqDTO) {
Pageable pageable = PageRequest.of(orderChangeListReqDTO.getPage() - 1, orderChangeListReqDTO.getSize());
......@@ -82,19 +84,26 @@ public class WorkbenchServiceImpl implements WorkbenchService {
if (!mapEngineers.containsKey(entity.getEngineerCode())) {
mapEngineers.put(entity.getEngineerCode(), new ArrayList<>());
}
WorkbenchEngineersGanttRespDTO.Timeline timeline = new WorkbenchEngineersGanttRespDTO.Timeline();
timeline.setStartTime(entity.getStartTime()).setEndTime(entity.getEndTime())
.setServiceOrderId(entity.getOrderId()).setServiceOrderStatus(entity.getStatus());
timeline.setTips(getOrderTips(entity.getOrderId()));
WorkbenchEngineersGanttRespDTO.Order order = new WorkbenchEngineersGanttRespDTO.Order();
order.setStartTime(entity.getStartTime()).setEndTime(entity.getEndTime())
.setOrderId(entity.getOrderId()).setOrderStatus(entity.getStatus());
order.setTips(getOrderTips(entity.getOrderId()));
}
List<WorkbenchEngineersGanttRespDTO.GanttChart> engineers = new ArrayList<>();
for (String e : mapEngineers.keySet()) {
for (String engineerCode : mapEngineers.keySet()) {
EngineerInfoEntity engineerInfo = engineerInfoDao.getByEngineerCode(engineerCode);
WorkbenchEngineersGanttRespDTO.GanttChart engineer = new WorkbenchEngineersGanttRespDTO.GanttChart();
engineer.setEngineerCode(e);
engineer.setStartTime(String.format("%s 00:00", ganttReqDTO.getDate())).setEndTime(String.format("%s 23:59", ganttReqDTO.getDate()));
engineer.setHoliday(false); // todo
engineer.setTimeline(mapEngineers.get(e));
engineer.setEngineerCode(engineerCode)
.setStartTime(String.format("%s 00:00", ganttReqDTO.getDate()))
.setEndTime(String.format("%s 23:59", ganttReqDTO.getDate()))
.setHoliday(false) // todo
.setOrders(mapEngineers.get(engineerCode))
.setEngineerName(engineerInfo.getName())
.setGrade(engineerInfo.getGrade());
CapacityEngineerStatEntity capacityEngineerStat = capacityEngineerStatDao.getByEngineerCodeAndWorkday(engineerCode, ganttReqDTO.getDate());
engineer.setCapTotal(capacityEngineerStat.getCapTotal().toString()).setCapUsed(capacityEngineerStat.getCapUsed().toString());
// engineer.setErrorTip(); todo
engineers.add(engineer);
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!