use of com.ncedu.fooddelivery.api.v1.dto.user.CourierInfoDTO in project 2021-msk-food-delivery by netcracker-edu.
the class DeliverySessionServiceImpl method convertToInfoDto.
public DeliverySessionInfoDTO convertToInfoDto(DeliverySession deliverySession) {
Duration d = deliverySession.getAverageTimePerOrder();
Courier c = deliverySession.getCourier();
String formattedDuration = null;
if (d != null)
formattedDuration = DurationFormatUtils.formatDuration(deliverySession.getAverageTimePerOrder().toMillis(), "HH:mm:ss", true);
return new DeliverySessionInfoDTO(deliverySession.getId(), new CourierInfoDTO(c.getId(), Role.COURIER.name(), c.getUser().getFullName(), c.getUser().getEmail(), c.getUser().getLastSigninDate(), c.getUser().getAvatarId(), c.getPhoneNumber(), c.getRating(), c.getWarehouse().getId(), c.getAddress(), c.getCurrentBalance()), deliverySession.getStartTime(), deliverySession.getEndTime(), deliverySession.getOrdersCompleted(), formattedDuration, deliverySession.getMoneyEarned());
}
use of com.ncedu.fooddelivery.api.v1.dto.user.CourierInfoDTO in project 2021-msk-food-delivery by netcracker-edu.
the class DeliverySessionServiceTest method getFakeSessionInfoDTOs.
private List<DeliverySessionInfoDTO> getFakeSessionInfoDTOs() {
Courier c = UserUtils.courierHowardWolowitz(100L).getCourier();
CourierInfoDTO targetCourierInfoDTO = new CourierInfoDTO(targetCourier.getId(), Role.COURIER.name(), user.getFullName(), user.getEmail(), user.getLastSigninDate(), user.getAvatarId(), targetCourier.getPhoneNumber(), targetCourier.getRating(), targetCourier.getWarehouse().getId(), targetCourier.getAddress(), targetCourier.getCurrentBalance());
DeliverySessionInfoDTO dto1 = new DeliverySessionInfoDTO(userId, targetCourierInfoDTO, currDateTime, currDateTime.plusHours(1L), 1, "01:00:00", 1000.0F);
dto1.setId(1L);
DeliverySessionInfoDTO dto2 = new DeliverySessionInfoDTO(userId, targetCourierInfoDTO, currDateTime.minusHours(3), currDateTime.minusHours(2), 2, "00:30:00", 2000.0F);
dto2.setId(2L);
DeliverySessionInfoDTO dto3 = new DeliverySessionInfoDTO(userId, targetCourierInfoDTO, currDateTime.minusDays(1), currDateTime.minusDays(1).plusHours(4), 7, "00:34:17", 5000.0F);
dto3.setId(3L);
return new ArrayList<>(Arrays.asList(dto1, dto2, dto3));
}
Aggregations