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 21, 2024
2 parents b074dcd + cbcbbeb commit d71d5e8
Show file tree
Hide file tree
Showing 35 changed files with 907 additions and 65 deletions.
2 changes: 1 addition & 1 deletion db/src/main/java/db/domain/goods/GoodsRepository.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public interface GoodsRepository extends JpaRepository<GoodsEntity,Long> {

List<GoodsEntity> findAllByIdIn(List<Long> goodsIdList);

List<GoodsEntity> findAllByStatusOrderByIdDesc(GoodsStatus status);
List<GoodsEntity> findAllByStatusAndUserIdOrderByIdDesc(GoodsStatus status, Long userId);

List<GoodsEntity> findAllByTakeBackIdOrderByIdDesc(Long takeBackId);

Expand Down
4 changes: 4 additions & 0 deletions db/src/main/java/db/domain/receiving/ReceivingRepository.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package db.domain.receiving;

import db.domain.receiving.enums.ReceivingStatus;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Optional;
import jdk.jshell.Snippet.Kind;
import org.springframework.data.jpa.repository.JpaRepository;

public interface ReceivingRepository extends JpaRepository<ReceivingEntity, Long> {
Expand All @@ -12,4 +14,6 @@ public interface ReceivingRepository extends JpaRepository<ReceivingEntity, Long
List<ReceivingEntity> findAllByUserIdOrderByIdDesc(Long userId);

List<ReceivingEntity> findAllByStatusOrderByVisitDate(ReceivingStatus receivingStatus);

List<ReceivingEntity> findAllByStatusAndVisitDateBetweenOrderByUserId (ReceivingStatus receivingStatus, LocalDateTime startDate, LocalDateTime dueDate);
}
4 changes: 3 additions & 1 deletion db/src/main/java/db/domain/shipping/ShippingRepository.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package db.domain.shipping;

import db.domain.receiving.ReceivingEntity;
import db.domain.shipping.enums.ShippingStatus;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Optional;
import org.springframework.data.jpa.repository.JpaRepository;
Expand All @@ -14,4 +14,6 @@ public interface ShippingRepository extends JpaRepository<ShippingEntity, Long>

List<ShippingEntity> findAllByStatusOrderByDeliveryDate(ShippingStatus shippingStatus);

List<ShippingEntity> findAllByStatusAndDeliveryDateBetweenOrderByUserId(ShippingStatus status,
LocalDateTime startDate, LocalDateTime dueDate);
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ public enum GoodsErrorCode implements ErrorCodeIfs {
GOODS_NOT_FOUND(HttpStatus.NOT_FOUND.value(), 1200, "물품이 존재하지 않습니다."),
INVALID_GOODS_STATUS(HttpStatus.BAD_REQUEST.value(),1201,"잘못된 물품 상태입니다."),
INVALID_GOODS_STRATEGY(HttpStatus.BAD_REQUEST.value(), 1202, "요청서 종류가 잘못되었습니다."),
NOT_OWNER(HttpStatus.NOT_ACCEPTABLE.value(), 1203, "소유자가 아닙니다.")
NOT_OWNER(HttpStatus.NOT_ACCEPTABLE.value(), 1203, "소유자가 아닙니다."),
GOODS_NOT_IN_STORAGE(HttpStatus.NOT_FOUND.value(),1253,"입고 확정 상태가 아닙니다."),
GOODS_NOT_IN_SHIPPING_ING(HttpStatus.NOT_FOUND.value(),1253,"상품이 출고 진행 상태가 아닙니다."),
GOODS_NOT_IN_RECEIVING(HttpStatus.NOT_FOUND.value(),1253,"상품이 입고 진행 상태가 아닙니다."),
;

private final Integer httpCode;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ public enum ReceivingErrorCode implements ErrorCodeIfs {

RECEIVING_REQUEST_NOT_FOUND(HttpStatus.NOT_FOUND.value(), 1250, "입고 요청서가 존재하지 않습니다."),
NO_OWNERSHIP(HttpStatus.BAD_REQUEST.value(), 1251, "사용자의 물품이 아닙니다."),
RECEIVING_NOT_IN_TAKING(HttpStatus.BAD_REQUEST.value(), 1252,"입고요청서 상태가 절적하지 않습니다.")
RECEIVING_NOT_IN_TAKING(HttpStatus.BAD_REQUEST.value(), 1252,"입고 요청 상태가 아닙니다."),
RECEIVING_NOT_IN_CONFIRMATION(HttpStatus.NOT_FOUND.value(),1253,"입고 확정 상태가 아닙니다."),
RECEIVING_NOT_IN_DELIVERY(HttpStatus.NOT_FOUND.value(),1254,"입고 배송 상태가 아닙니다."),
;

private final Integer httpCode;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
public enum ShippingErrorCode implements ErrorCodeIfs {

SHIPPING_REQUEST_NOT_FOUND(HttpStatus.NOT_FOUND.value(), 1500, "출고 요청서가 존재하지 않습니다."),
SHIPPING_NOT_IN_PENDING(HttpStatus.NOT_FOUND.value(),1501,"출고 요청 상태가 아닙니다.")
SHIPPING_NOT_IN_PENDING(HttpStatus.NOT_FOUND.value(),1501,"출고 요청 상태가 아닙니다."),
SHIPPING_NOT_IN_REGISTERED(HttpStatus.NOT_FOUND.value(),1502,"출고 접수 상태가 아닙니다."),
SHIPPING_NOT_IN_DELIVERY(HttpStatus.NOT_FOUND.value(),1503,"출고 배송 상태가 아닙니다."),
;

private final Integer httpCode;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

import delivery.common.error.GoodsErrorCode;
import delivery.common.exception.goods.GoodsNotFoundException;
import delivery.common.exception.goods.GoodsNotInReceivingException;
import delivery.common.exception.goods.GoodsNotInShippingIngException;
import delivery.common.exception.goods.GoodsNotInStorageException;
import delivery.common.exception.goods.InvalidGoodsStatusException;
import delivery.common.exception.receiving.NotOwnerException;
import global.api.Api;
Expand Down Expand Up @@ -37,4 +40,25 @@ public ResponseEntity<Api<Object>> notOwnerException(NotOwnerException e) {
return ResponseEntity.status(HttpStatus.BAD_REQUEST)
.body(Api.ERROR(GoodsErrorCode.NOT_OWNER));
}

@ExceptionHandler(value = GoodsNotInStorageException.class)
public ResponseEntity<Api<Object>> goodsNotInStorageException(GoodsNotInStorageException e) {
log.info("", e);
return ResponseEntity.status(HttpStatus.BAD_REQUEST)
.body(Api.ERROR(GoodsErrorCode.GOODS_NOT_IN_STORAGE));
}

@ExceptionHandler(value = GoodsNotInShippingIngException.class)
public ResponseEntity<Api<Object>> goodsNotInShippingIngException(GoodsNotInShippingIngException e) {
log.info("", e);
return ResponseEntity.status(HttpStatus.BAD_REQUEST)
.body(Api.ERROR(GoodsErrorCode.GOODS_NOT_IN_SHIPPING_ING));
}

@ExceptionHandler(value = GoodsNotInReceivingException.class)
public ResponseEntity<Api<Object>> goodsNotInReceivingException(GoodsNotInReceivingException e) {
log.info("", e);
return ResponseEntity.status(HttpStatus.BAD_REQUEST)
.body(Api.ERROR(GoodsErrorCode.GOODS_NOT_IN_RECEIVING));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import delivery.common.error.ReceivingErrorCode;
import delivery.common.exception.receiving.NoOwnershipException;
import delivery.common.exception.receiving.ReceivingNotFoundException;
import delivery.common.exception.receiving.ReceivingNotInConfirmationException;
import delivery.common.exception.receiving.ReceivingNotInDeliveryException;
import delivery.common.exception.receiving.ReceivingNotInTakingException;
import global.api.Api;
import lombok.extern.slf4j.Slf4j;
Expand Down Expand Up @@ -37,5 +39,19 @@ public ResponseEntity<Api<Object>> receivingNotInTakingException(ReceivingNotInT
return ResponseEntity.status(HttpStatus.BAD_REQUEST)
.body(Api.ERROR(ReceivingErrorCode.RECEIVING_NOT_IN_TAKING));
}

@ExceptionHandler(value = ReceivingNotInConfirmationException.class)
public ResponseEntity<Api<Object>> receivingNotInConfirmationException(ReceivingNotInConfirmationException e) {
log.info("", e);
return ResponseEntity.status(HttpStatus.BAD_REQUEST)
.body(Api.ERROR(ReceivingErrorCode.RECEIVING_NOT_IN_CONFIRMATION));
}

@ExceptionHandler(value = ReceivingNotInDeliveryException.class)
public ResponseEntity<Api<Object>> receivingNotInDeliveryException(ReceivingNotInDeliveryException e) {
log.info("", e);
return ResponseEntity.status(HttpStatus.BAD_REQUEST)
.body(Api.ERROR(ReceivingErrorCode.RECEIVING_NOT_IN_DELIVERY));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

import delivery.common.error.ShippingErrorCode;
import delivery.common.exception.shipping.ShippingNotFoundException;
import delivery.common.exception.shipping.ShippingNotInDeliveryException;
import delivery.common.exception.shipping.ShippingNotInPendingException;
import delivery.common.exception.shipping.ShippingNotInRegisteredException;
import global.api.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpStatus;
Expand All @@ -28,5 +30,18 @@ public ResponseEntity<Api<Object>> shippingNotFoundException(ShippingNotInPendin
.body(Api.ERROR(ShippingErrorCode.SHIPPING_NOT_IN_PENDING));
}

@ExceptionHandler(value = ShippingNotInRegisteredException.class)
public ResponseEntity<Api<Object>> shippingNotInRegisteredException(ShippingNotInRegisteredException e) {
log.info("", e);
return ResponseEntity.status(HttpStatus.NOT_FOUND)
.body(Api.ERROR(ShippingErrorCode.SHIPPING_NOT_IN_REGISTERED));
}

@ExceptionHandler(value = ShippingNotInDeliveryException.class)
public ResponseEntity<Api<Object>> shippingNotInDeliveryException(ShippingNotInDeliveryException e) {
log.info("", e);
return ResponseEntity.status(HttpStatus.NOT_FOUND)
.body(Api.ERROR(ShippingErrorCode.SHIPPING_NOT_IN_DELIVERY));
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package delivery.common.exception.goods;

import global.errorcode.ErrorCodeIfs;

public class GoodsNotInReceivingException extends RuntimeException {

private final ErrorCodeIfs errorCodeIfs;
private final String description;

public GoodsNotInReceivingException(ErrorCodeIfs errorCodeIfs) {
super(errorCodeIfs.getDescription());
this.errorCodeIfs = errorCodeIfs;
this.description = errorCodeIfs.getDescription();
}

public GoodsNotInReceivingException(ErrorCodeIfs errorCodeIfs, String errorDescription) {
this.errorCodeIfs = errorCodeIfs;
this.description = errorDescription;
}

public GoodsNotInReceivingException(ErrorCodeIfs errorCodeIfs, Throwable throwable) {
super(throwable);
this.errorCodeIfs = errorCodeIfs;
this.description = errorCodeIfs.getDescription();
}

public GoodsNotInReceivingException(ErrorCodeIfs errorCodeIfs, Throwable throwable,
String errorDescription) {
super(throwable);
this.errorCodeIfs = errorCodeIfs;
this.description = errorDescription;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package delivery.common.exception.goods;

import global.errorcode.ErrorCodeIfs;

public class GoodsNotInShippingIngException extends RuntimeException {

private final ErrorCodeIfs errorCodeIfs;
private final String description;

public GoodsNotInShippingIngException(ErrorCodeIfs errorCodeIfs) {
super(errorCodeIfs.getDescription());
this.errorCodeIfs = errorCodeIfs;
this.description = errorCodeIfs.getDescription();
}

public GoodsNotInShippingIngException(ErrorCodeIfs errorCodeIfs, String errorDescription) {
this.errorCodeIfs = errorCodeIfs;
this.description = errorDescription;
}

public GoodsNotInShippingIngException(ErrorCodeIfs errorCodeIfs, Throwable throwable) {
super(throwable);
this.errorCodeIfs = errorCodeIfs;
this.description = errorCodeIfs.getDescription();
}

public GoodsNotInShippingIngException(ErrorCodeIfs errorCodeIfs, Throwable throwable,
String errorDescription) {
super(throwable);
this.errorCodeIfs = errorCodeIfs;
this.description = errorDescription;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package delivery.common.exception.goods;

import global.errorcode.ErrorCodeIfs;

public class GoodsNotInStorageException extends RuntimeException {

private final ErrorCodeIfs errorCodeIfs;
private final String description;

public GoodsNotInStorageException(ErrorCodeIfs errorCodeIfs) {
super(errorCodeIfs.getDescription());
this.errorCodeIfs = errorCodeIfs;
this.description = errorCodeIfs.getDescription();
}

public GoodsNotInStorageException(ErrorCodeIfs errorCodeIfs, String errorDescription) {
this.errorCodeIfs = errorCodeIfs;
this.description = errorDescription;
}

public GoodsNotInStorageException(ErrorCodeIfs errorCodeIfs, Throwable throwable) {
super(throwable);
this.errorCodeIfs = errorCodeIfs;
this.description = errorCodeIfs.getDescription();
}

public GoodsNotInStorageException(ErrorCodeIfs errorCodeIfs, Throwable throwable,
String errorDescription) {
super(throwable);
this.errorCodeIfs = errorCodeIfs;
this.description = errorDescription;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package delivery.common.exception.receiving;

import global.errorcode.ErrorCodeIfs;

public class ReceivingNotInConfirmationException extends RuntimeException {

private final ErrorCodeIfs errorCodeIfs;
private final String description;

public ReceivingNotInConfirmationException(ErrorCodeIfs errorCodeIfs) {
super(errorCodeIfs.getDescription());
this.errorCodeIfs = errorCodeIfs;
this.description = errorCodeIfs.getDescription();
}

public ReceivingNotInConfirmationException(ErrorCodeIfs errorCodeIfs, String errorDescription) {
this.errorCodeIfs = errorCodeIfs;
this.description = errorDescription;
}

public ReceivingNotInConfirmationException(ErrorCodeIfs errorCodeIfs, Throwable throwable) {
super(throwable);
this.errorCodeIfs = errorCodeIfs;
this.description = errorCodeIfs.getDescription();
}

public ReceivingNotInConfirmationException(ErrorCodeIfs errorCodeIfs, Throwable throwable,
String errorDescription) {
super(throwable);
this.errorCodeIfs = errorCodeIfs;
this.description = errorDescription;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package delivery.common.exception.receiving;

import global.errorcode.ErrorCodeIfs;
import lombok.Getter;

@Getter
public class ReceivingNotInDeliveryException extends RuntimeException {

private final ErrorCodeIfs errorCodeIfs;
private final String description;

public ReceivingNotInDeliveryException(ErrorCodeIfs errorCodeIfs) {
super(errorCodeIfs.getDescription());
this.errorCodeIfs = errorCodeIfs;
this.description = errorCodeIfs.getDescription();
}

public ReceivingNotInDeliveryException(ErrorCodeIfs errorCodeIfs, String errorDescription) {
this.errorCodeIfs = errorCodeIfs;
this.description = errorDescription;
}

public ReceivingNotInDeliveryException(ErrorCodeIfs errorCodeIfs, Throwable throwable) {
super(throwable);
this.errorCodeIfs = errorCodeIfs;
this.description = errorCodeIfs.getDescription();
}

public ReceivingNotInDeliveryException(ErrorCodeIfs errorCodeIfs, Throwable throwable,
String errorDescription) {
super(throwable);
this.errorCodeIfs = errorCodeIfs;
this.description = errorDescription;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package delivery.common.exception.shipping;

import global.errorcode.ErrorCodeIfs;

public class ShippingNotInDeliveryException extends RuntimeException {

private final ErrorCodeIfs errorCodeIfs;
private final String description;

public ShippingNotInDeliveryException(ErrorCodeIfs errorCodeIfs) {
super(errorCodeIfs.getDescription());
this.errorCodeIfs = errorCodeIfs;
this.description = errorCodeIfs.getDescription();
}

public ShippingNotInDeliveryException(ErrorCodeIfs errorCodeIfs, String errorDescription) {
this.errorCodeIfs = errorCodeIfs;
this.description = errorDescription;
}

public ShippingNotInDeliveryException(ErrorCodeIfs errorCodeIfs, Throwable throwable) {
super(throwable);
this.errorCodeIfs = errorCodeIfs;
this.description = errorCodeIfs.getDescription();
}

public ShippingNotInDeliveryException(ErrorCodeIfs errorCodeIfs, Throwable throwable,
String errorDescription) {
super(throwable);
this.errorCodeIfs = errorCodeIfs;
this.description = errorDescription;
}

}
Loading

0 comments on commit d71d5e8

Please sign in to comment.