Commit 398ccd2c by 丁伟峰

Merge branch 'feat-dingwf-mvp616' into develop

2 parents 5a02b1a8 82ca7f40
......@@ -2,7 +2,7 @@ package com.alibaba.cloud.integration.order.controller;
import com.alibaba.cloud.integration.common.BusinessException;
import com.alibaba.cloud.integration.common.Result;
import com.alibaba.cloud.integration.order.dto.WorkbenchEngineersGanttReqDTO;
import com.alibaba.cloud.integration.order.dto.EngineersGanttReqDTO;
import com.alibaba.cloud.integration.order.dto.WorkbenchOrderChangeListReqDTO;
import com.alibaba.cloud.integration.order.service.WorkbenchService;
import lombok.extern.slf4j.Slf4j;
......@@ -30,7 +30,7 @@ public class WorkbenchController {
}
@GetMapping("/engineer/schedule/gantt")
public Result<?> getEngineersGanttList(@Validated WorkbenchEngineersGanttReqDTO reqDTO) {
public Result<?> getEngineersGanttList(@Validated EngineersGanttReqDTO reqDTO) {
// todo 待移到 controller的engineer中
log.info("getEngineersGanttList: {}", reqDTO);
Result<?> res = null;
......
......@@ -17,8 +17,8 @@ public class CapacityOrderQueryReqDTO {
private String type;
@NotNull(message = "skill不能为空")
private String skill;
@NotNull(message = "beginDate不能为空")
private String beginDate;
@NotNull(message = "startDate不能为空")
private String startDate;
@NotNull(message = "endDate不能为空")
private String endDate;
}
......@@ -7,8 +7,8 @@ import java.util.List;
@Data
@Accessors(chain = true)
public class CapacityQueryOrderRespDTO {
private String beginDate;
public class CapacityOrderQueryRespDTO {
private String startDate;
private String endDate;
private String remark;
private List<LegendDTO> legend;
......
......@@ -3,7 +3,7 @@ package com.alibaba.cloud.integration.order.dto;
@lombok.Data
public class CapacityStatQueryReqDTO {
private String beginDate;
private String startDate;
private String endDate;
/**
* cluster/branch/group
......@@ -14,5 +14,5 @@ public class CapacityStatQueryReqDTO {
*/
private String levelValue;
private Integer page;
private Integer pageSize;
private Integer size;
}
......@@ -4,7 +4,7 @@ package com.alibaba.cloud.integration.order.dto;
import java.util.List;
@lombok.Data
public class WorkbenchEngineersGanttReqDTO {
public class EngineersGanttReqDTO {
private String levelType;
private String levelValue;
......
package com.alibaba.cloud.integration.order.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.experimental.Accessors;
......@@ -9,7 +8,7 @@ import java.util.List;
@lombok.Data
@Accessors(chain = true)
public class WorkbenchEngineersGanttRespDTO {
public class EngineersGanttRespDTO {
private String date;
private List<?> engineers;
......
package com.alibaba.cloud.integration.order.service;
import com.alibaba.cloud.integration.common.Result;
import com.alibaba.cloud.integration.order.dto.WorkbenchEngineersGanttReqDTO;
import com.alibaba.cloud.integration.order.dto.EngineersGanttReqDTO;
import com.alibaba.cloud.integration.order.dto.WorkbenchOrderChangeListReqDTO;
public interface WorkbenchService {
Result<?> getOrderChangeList(WorkbenchOrderChangeListReqDTO orderChangeListReqDTO);
Result<?> getEngineersGanttList(WorkbenchEngineersGanttReqDTO ganttReqDTO);
Result<?> getEngineersGanttList(EngineersGanttReqDTO ganttReqDTO);
}
......@@ -3,7 +3,7 @@ package com.alibaba.cloud.integration.order.service.impl;
import com.alibaba.cloud.integration.common.Result;
import com.alibaba.cloud.integration.order.dao.*;
import com.alibaba.cloud.integration.order.dto.CapacityOrderQueryReqDTO;
import com.alibaba.cloud.integration.order.dto.CapacityQueryOrderRespDTO;
import com.alibaba.cloud.integration.order.dto.CapacityOrderQueryRespDTO;
import com.alibaba.cloud.integration.order.dto.CapacityStatQueryReqDTO;
import com.alibaba.cloud.integration.order.dto.CapacityStatQueryRespDTO;
import com.alibaba.cloud.integration.order.entity.*;
......@@ -57,19 +57,19 @@ public class CapacityQueryServiceImpl implements CapacityQueryService {
String layer = productCategoryDao.getLayerByBrandAndTypeAndSkill(reqDTO.getBrand(), reqDTO.getType(), reqDTO.getSkill());
String teamId = commonService.getTeamIdByInput(reqDTO.getLocation(), reqDTO.getAddress(), layer);
log.info("teamId[{}]layer[{}]", teamId, layer);
CapacityQueryOrderRespDTO capacityQueryRespDTO = new CapacityQueryOrderRespDTO();
capacityQueryRespDTO.setBeginDate(reqDTO.getBeginDate()).setEndDate(reqDTO.getEndDate());
capacityQueryRespDTO.setCalendar(getTeamCapacityByLayerAndDays(teamId, layer, reqDTO.getBeginDate(), reqDTO.getEndDate()));
CapacityOrderQueryRespDTO capacityQueryRespDTO = new CapacityOrderQueryRespDTO();
capacityQueryRespDTO.setStartDate(reqDTO.getStartDate()).setEndDate(reqDTO.getEndDate());
capacityQueryRespDTO.setCalendar(getTeamCapacityByLayerAndDays(teamId, layer, reqDTO.getStartDate(), reqDTO.getEndDate()));
capacityQueryRespDTO.setLegend(getLengends());
capacityQueryRespDTO.setRemark(String.format("%s-%s", teamId, layer));
return Result.success(capacityQueryRespDTO);
}
private List<CapacityQueryOrderRespDTO.LegendDTO> getLengends() {
List<CapacityQueryOrderRespDTO.LegendDTO> legends = new ArrayList<>();
legends.add(new CapacityQueryOrderRespDTO.LegendDTO().setType(1).setMemo("剩余30%以上"));
legends.add(new CapacityQueryOrderRespDTO.LegendDTO().setType(2).setMemo("剩余60%以上"));
legends.add(new CapacityQueryOrderRespDTO.LegendDTO().setType(3).setMemo("剩余30%以内"));
private List<CapacityOrderQueryRespDTO.LegendDTO> getLengends() {
List<CapacityOrderQueryRespDTO.LegendDTO> legends = new ArrayList<>();
legends.add(new CapacityOrderQueryRespDTO.LegendDTO().setType(1).setMemo("剩余30%以上"));
legends.add(new CapacityOrderQueryRespDTO.LegendDTO().setType(2).setMemo("剩余60%以上"));
legends.add(new CapacityOrderQueryRespDTO.LegendDTO().setType(3).setMemo("剩余30%以内"));
return legends;
}
......@@ -77,19 +77,19 @@ public class CapacityQueryServiceImpl implements CapacityQueryService {
public Result<?> getTeamStatData(CapacityStatQueryReqDTO reqDTO) {
// 根据大区/分部/分站查询,分别返回分部/分站/工作队的容量
Page<?> stats = null;
Pageable pageable = PageRequest.of(reqDTO.getPage() - 1, reqDTO.getPageSize());
Pageable pageable = PageRequest.of(reqDTO.getPage() - 1, reqDTO.getSize());
if ("cluster".equals(reqDTO.getLevelType())) {
List<String> branchIds = getBranchIdsByClusterId(reqDTO.getLevelValue());
log.info("levelType: {} ==> branchIds: {}", reqDTO.getLevelType(), branchIds);
stats = capacityOrgStatDao.findByBranchIdsAndWorkdayBetween(branchIds, reqDTO.getBeginDate(), reqDTO.getEndDate(), pageable);
stats = capacityOrgStatDao.findByBranchIdsAndWorkdayBetween(branchIds, reqDTO.getStartDate(), reqDTO.getEndDate(), pageable);
} else if ("branch".equals(reqDTO.getLevelType())) {
List<String> groupIds = getGroupIdsByBranchId(reqDTO.getLevelValue());
log.info("levelType: {} ==> groupIds: {}", reqDTO.getLevelType(), groupIds);
stats = capacityOrgStatDao.findByGroupIdsAndWorkdayBetween(groupIds, reqDTO.getBeginDate(), reqDTO.getEndDate(), pageable);
stats = capacityOrgStatDao.findByGroupIdsAndWorkdayBetween(groupIds, reqDTO.getStartDate(), reqDTO.getEndDate(), pageable);
} else {
List<String> teamIds = getTeamIdsByGroupId(reqDTO.getLevelValue());
log.info("levelType: {} ==> teamIds: {}", reqDTO.getLevelType(), teamIds);
stats = capacityTeamStatDao.findByTeamIdsAndWorkdayBetween(teamIds, reqDTO.getBeginDate(), reqDTO.getEndDate(), pageable);
stats = capacityTeamStatDao.findByTeamIdsAndWorkdayBetween(teamIds, reqDTO.getStartDate(), reqDTO.getEndDate(), pageable);
}
CapacityStatQueryRespDTO data = new CapacityStatQueryRespDTO();
data.setLevelType(reqDTO.getLevelType());
......@@ -181,24 +181,24 @@ public class CapacityQueryServiceImpl implements CapacityQueryService {
* @param endDate
* @return
*/
private List<CapacityQueryOrderRespDTO.CalendarDTO> getTeamCapacityByLayerAndDays(String teamId, String layer, String beginDate, String endDate) {
private List<CapacityOrderQueryRespDTO.CalendarDTO> getTeamCapacityByLayerAndDays(String teamId, String layer, String beginDate, String endDate) {
log.info("==> getTimeRangeByTeamSkill({}, {}, {}, {})", teamId, layer, beginDate, endDate);
Map<String, CapacityQueryOrderRespDTO.CalendarDTO> dayMaps = new HashMap<>();
Map<String, CapacityOrderQueryRespDTO.CalendarDTO> dayMaps = new HashMap<>();
List<CapacityTeamStatEntity> capacityTeamStatEntityList = capacityTeamStatDao.findAllByTeamIdAndLayerAndWorkdayBetween(teamId, layer, beginDate, endDate);
for (CapacityTeamStatEntity e : capacityTeamStatEntityList) {
log.info("CapacityTeamStatEntity ==> {}", e);
CapacityQueryOrderRespDTO.TimeDTO timeDTO = new CapacityQueryOrderRespDTO.TimeDTO();
CapacityOrderQueryRespDTO.TimeDTO timeDTO = new CapacityOrderQueryRespDTO.TimeDTO();
timeDTO.setType(getSpanType(e.getCapLeft(), e.getCapTotal()));
Object[] timeSpans = getTimeSpanInfo(e.getWorkday(), e.getTimeSpan(), e.getTimeSpanDetail());
timeDTO.setText((String) timeSpans[0]);
timeDTO.setBegin((String) timeSpans[1]);
timeDTO.setEnd((String) timeSpans[2]);
List<CapacityQueryOrderRespDTO.TimeDTO> times = null;
CapacityQueryOrderRespDTO.CalendarDTO calendarDTO = null;
List<CapacityOrderQueryRespDTO.TimeDTO> times = null;
CapacityOrderQueryRespDTO.CalendarDTO calendarDTO = null;
if (dayMaps.containsKey(e.getWorkday())) {
calendarDTO = dayMaps.get(e.getWorkday());
} else {
calendarDTO = new CapacityQueryOrderRespDTO.CalendarDTO();
calendarDTO = new CapacityOrderQueryRespDTO.CalendarDTO();
calendarDTO.setDate(e.getWorkday()).setWeek(getWeekday(e.getWorkday()));
calendarDTO.setTimes(new ArrayList<>());
}
......
......@@ -72,22 +72,22 @@ public class WorkbenchServiceImpl implements WorkbenchService {
}
@Override
public Result<?> getEngineersGanttList(WorkbenchEngineersGanttReqDTO reqDTO) {
public Result<?> getEngineersGanttList(EngineersGanttReqDTO reqDTO) {
// 按日期返回技术员们当天的服务甘特图,不需要翻页
log.info("getEngineersGanttList: {}", reqDTO);
List<OrderAppointmentEntity> orderAppointments = orderAppointmentDao.findByDateAndEngineerCodeIn(reqDTO.getDate(), reqDTO.getEngineerCodes());
List<String> orderIds = orderAppointments.stream().map(OrderAppointmentEntity::getOrderId).collect(Collectors.toList());
Map<String, OrderRequestEntity> mapOrderRequest = getOrdersByOrderIds(orderIds);
HashMap<String, List<WorkbenchEngineersGanttRespDTO.Order>> mapEngineers = new HashMap<>();
HashMap<String, List<EngineersGanttRespDTO.Order>> mapEngineers = new HashMap<>();
for (OrderAppointmentEntity e : orderAppointments) {
log.info("===== order_id: [{}]", e.getOrderId());
WorkbenchEngineersGanttRespDTO.Order order = new WorkbenchEngineersGanttRespDTO.Order();
EngineersGanttRespDTO.Order order = new EngineersGanttRespDTO.Order();
// todo 需要根据订单时间和状态,采用expectXXXX或者actualXXXX
order.setStartTime(e.getExpectStartTime()).setEndTime(e.getExpectEndTime());
order.setOrderId(e.getOrderId()).setPreStatus(e.getPreStatus());
order.setTips(getOrderTips(e.getOrderId()));
order.setAppointmentStatus(mapOrderRequest.get(e.getOrderId()).getAppointmentStatus());
List<WorkbenchEngineersGanttRespDTO.Order> orders = null;
List<EngineersGanttRespDTO.Order> orders = null;
if (mapEngineers.containsKey(e.getEngineerCode())) {
orders = mapEngineers.get(e.getEngineerCode());
} else {
......@@ -97,10 +97,10 @@ public class WorkbenchServiceImpl implements WorkbenchService {
mapEngineers.put(e.getEngineerCode(), orders);
}
List<WorkbenchEngineersGanttRespDTO.GanttChart> engineers = new ArrayList<>();
List<EngineersGanttRespDTO.GanttChart> engineers = new ArrayList<>();
for (String engineerCode : mapEngineers.keySet()) {
EngineerInfoEntity engineerInfo = engineerInfoDao.getByEngineerCode(engineerCode);
WorkbenchEngineersGanttRespDTO.GanttChart engineer = new WorkbenchEngineersGanttRespDTO.GanttChart();
EngineersGanttRespDTO.GanttChart engineer = new EngineersGanttRespDTO.GanttChart();
engineer.setEngineerCode(engineerCode)
.setStartTime(String.format("%s 08:00", reqDTO.getDate()))
.setEndTime(String.format("%s 18:00", reqDTO.getDate()))
......@@ -118,7 +118,7 @@ public class WorkbenchServiceImpl implements WorkbenchService {
// engineer.setErrorTip(); todo
engineers.add(engineer);
}
WorkbenchEngineersGanttRespDTO data = new WorkbenchEngineersGanttRespDTO().setDate(reqDTO.getDate()).setEngineers(engineers);
EngineersGanttRespDTO data = new EngineersGanttRespDTO().setDate(reqDTO.getDate()).setEngineers(engineers);
return Result.success(data);
}
......@@ -133,6 +133,7 @@ public class WorkbenchServiceImpl implements WorkbenchService {
log.info("==> getOrdertips: orderId[{}]", orderId);
OrderRequestEntity order = orderRequestDao.getByOrderId(orderId);
List<LabelValueDTO> tips = new ArrayList<>();
tips.add(new LabelValueDTO().setLabel("工单号码").setValue(orderId));
tips.add(new LabelValueDTO().setLabel("类型/品牌").setValue(String.format("%s %s", order.getBrand(), order.getType())));
tips.add(new LabelValueDTO().setLabel("电话/地址").setValue(String.format("%s %s\n %s", order.getName(), order.getPhone(), order.getAddress())));
if (!order.getApplyNote().isBlank()) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!