Skip to content

Commit

Permalink
Merge branch 'dev' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
Jyuung committed Aug 14, 2024
2 parents b5b822a + e68c3a6 commit fcab5b3
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,17 @@
import java.util.List;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import warehouse.common.utils.ImageUtils;
import warehouse.domain.goods.controller.model.GoodsResponse;
import warehouse.domain.goods.converter.GoodsConverter;
import warehouse.domain.goods.service.GoodsService;
import warehouse.domain.image.controller.model.ImageListResponse;
import warehouse.domain.image.converter.ImageConverter;
import warehouse.domain.image.service.ImageService;
import warehouse.domain.receiving.converter.receiving.ReceivingConverter;
import warehouse.domain.receiving.service.ReceivingService;
import warehouse.domain.takeback.controller.model.TakeBackListResponse;
import warehouse.domain.takeback.controller.model.TakeBackResponse;
import warehouse.domain.takeback.controller.model.TakeBackStatusResponse;
import warehouse.domain.takeback.converter.TakeBackConverter;
import warehouse.domain.takeback.service.TakeBackService;
import warehouse.domain.users.converter.UsersConverter;
import warehouse.domain.users.service.UsersService;

@Slf4j
Expand Down Expand Up @@ -113,4 +110,9 @@ public TakeBackListResponse getTakeBackListBy(String email) {

return takeBackConverter.toListResponse(takeBackResponseList);
}

public TakeBackStatusResponse getCurrentStatusBy(Long takeBackId) {
TakeBackEntity takeBackEntity = takeBackService.getTakeBackById(takeBackId);
return takeBackConverter.toCurrentStatusResponse(takeBackEntity);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import warehouse.domain.takeback.business.TakeBackBusiness;
import warehouse.domain.takeback.controller.model.TakeBackListResponse;
import warehouse.domain.takeback.controller.model.TakeBackResponse;
import warehouse.domain.takeback.controller.model.TakeBackStatusResponse;

@RestController
@RequiredArgsConstructor
Expand Down Expand Up @@ -54,4 +55,11 @@ public Api<TakeBackListResponse> getTakeBackRequestList(
return Api.OK(response);
}

@GetMapping("/process/{takeBackId}")
@Operation(summary = "[출고 상태 조회하기]")
public Api<TakeBackStatusResponse> getCurrentStatusBy(@PathVariable Long takeBackId) {
TakeBackStatusResponse response = takeBackBusiness.getCurrentStatusBy(takeBackId);
return Api.OK(response);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package warehouse.domain.takeback.controller.model;

import db.domain.takeback.enums.TakeBackStatus;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class TakeBackStatusResponse {

private Long takeBackId;
private long total;
private TakeBackStatus status;
private int current;
private String description;

}
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@
import db.domain.takeback.enums.TakeBackStatus;
import global.annotation.Converter;
import java.time.LocalDateTime;
import java.util.Arrays;
import java.util.List;
import warehouse.domain.goods.controller.model.GoodsResponse;
import warehouse.domain.takeback.controller.model.TakeBackListResponse;
import warehouse.domain.takeback.controller.model.TakeBackResponse;
import warehouse.domain.takeback.controller.model.TakeBackStatusResponse;

@Converter
public class TakeBackConverter {
Expand Down Expand Up @@ -46,4 +48,14 @@ public TakeBackListResponse toListResponse(List<TakeBackResponse> takeBackRespon
.takeBackResponseList(takeBackResponseList)
.build();
}

public TakeBackStatusResponse toCurrentStatusResponse(TakeBackEntity takeBackEntity) {
return TakeBackStatusResponse.builder()
.takeBackId(takeBackEntity.getId())
.total(Arrays.stream(TakeBackStatus.values()).count())
.status(takeBackEntity.getStatus())
.description(takeBackEntity.getStatus().getDescription())
.current(takeBackEntity.getStatus().getCurrent())
.build();
}
}

0 comments on commit fcab5b3

Please sign in to comment.