Auto stash before merge of "dev" and "origin/dev"
This commit is contained in:
parent
0271a145c9
commit
c7c90a2a5d
@ -6,10 +6,8 @@ import com.interplug.qcast.config.Exception.CanvasStatusException;
|
|||||||
|
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
@ -48,7 +46,7 @@ public class CanvasStatusController {
|
|||||||
@Operation(description = "견적서를 삭제 한다.")
|
@Operation(description = "견적서를 삭제 한다.")
|
||||||
@DeleteMapping("/canvas-statuses/by-object/{objectNo}")
|
@DeleteMapping("/canvas-statuses/by-object/{objectNo}")
|
||||||
@ResponseStatus(HttpStatus.NO_CONTENT)
|
@ResponseStatus(HttpStatus.NO_CONTENT)
|
||||||
public void deleteObjectNoCanvasStatus(@PathVariable String objectNo) {
|
public void deleteObjectNoCanvasStatus(@PathVariable String objectNo) throws QcastException {
|
||||||
canvasStatusService.deleteObjectNoCanvasStatus(objectNo);
|
canvasStatusService.deleteObjectNoCanvasStatus(objectNo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -7,18 +7,18 @@ import com.interplug.qcast.config.Exception.CanvasStatusException;
|
|||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class CanvasStatusService {
|
public class CanvasStatusService {
|
||||||
private final CanvasStatusMapper canvasStatusMapper;
|
private final CanvasStatusMapper canvasStatusMapper;
|
||||||
|
|
||||||
// 전체 견적서 조회
|
// 전체 견적서 조회
|
||||||
public List<CanvasStatusResponse> selectAllCanvasStatus(String userId) {
|
public List<CanvasStatusResponse> selectAllCanvasStatus(String userId) {
|
||||||
return canvasStatusMapper.selectAllCanvasStatus(userId);
|
return canvasStatusMapper.selectAllCanvasStatus(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 견적서 조회(objectNo)
|
// 견적서 조회(objectNo)
|
||||||
public List<CanvasStatusResponse> selectObjectNoCanvasStatus(String objectNo, String userId) {
|
public List<CanvasStatusResponse> selectObjectNoCanvasStatus(String objectNo, String userId) {
|
||||||
|
|||||||
@ -2,20 +2,30 @@ package com.interplug.qcast.config.Exception;
|
|||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
|
|
||||||
public class BaseException extends Exception{
|
public class BaseException extends Exception {
|
||||||
|
|
||||||
@Serial
|
@Serial private static final long serialVersionUID = 6263785244527827114L;
|
||||||
private static final long serialVersionUID = 6263785244527827114L;
|
|
||||||
|
|
||||||
public BaseException() {
|
private ErrorCode errorCode;
|
||||||
super();
|
|
||||||
}
|
|
||||||
|
|
||||||
public BaseException(String message) {
|
public BaseException() {
|
||||||
super(message);
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
public BaseException(Throwable cause) {
|
public BaseException(String message) {
|
||||||
super(cause);
|
super(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public BaseException(ErrorCode errorCode, String message) {
|
||||||
|
super(message);
|
||||||
|
this.errorCode = errorCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BaseException(Throwable cause) {
|
||||||
|
super(cause);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ErrorCode getErrorCode() {
|
||||||
|
return errorCode;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,20 @@
|
|||||||
|
package com.interplug.qcast.config.Exception;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
public enum ErrorCode {
|
||||||
|
INVALID_INPUT_VALUE(HttpStatus.BAD_REQUEST, "올바르지 않은 입력값입니다."),
|
||||||
|
METHOD_NOT_ALLOWED(HttpStatus.METHOD_NOT_ALLOWED, "허용되지 않은 메소드입니다."),
|
||||||
|
INTERNAL_SERVER_ERROR(HttpStatus.INTERNAL_SERVER_ERROR, "서버에러입니다."),
|
||||||
|
NOT_FOUND(HttpStatus.NOT_FOUND, "데이터를 찾을 수 없습니다.");
|
||||||
|
|
||||||
|
private final String message;
|
||||||
|
private final HttpStatus status;
|
||||||
|
|
||||||
|
ErrorCode(final HttpStatus status, final String message) {
|
||||||
|
this.status = status;
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
package com.interplug.qcast.config.Exception;
|
||||||
|
|
||||||
|
import lombok.AccessLevel;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@NoArgsConstructor(access = AccessLevel.PROTECTED)
|
||||||
|
public class ErrorResponse {
|
||||||
|
private String message;
|
||||||
|
|
||||||
|
public ErrorResponse(String message) {
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ErrorResponse of(String message) {
|
||||||
|
return new ErrorResponse(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,30 @@
|
|||||||
|
package com.interplug.qcast.config.Exception;
|
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.web.HttpRequestMethodNotSupportedException;
|
||||||
|
import org.springframework.web.bind.annotation.ControllerAdvice;
|
||||||
|
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@ControllerAdvice
|
||||||
|
public class GlobalExceptionHandler {
|
||||||
|
@ExceptionHandler(HttpRequestMethodNotSupportedException.class)
|
||||||
|
protected ResponseEntity<ErrorResponse> handle(HttpRequestMethodNotSupportedException e) {
|
||||||
|
return ResponseEntity.badRequest()
|
||||||
|
.body(ErrorResponse.of(ErrorCode.METHOD_NOT_ALLOWED.getMessage()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ExceptionHandler(BaseException.class)
|
||||||
|
protected ResponseEntity<ErrorResponse> handle(BaseException e) {
|
||||||
|
final ErrorCode errorCode = e.getErrorCode();
|
||||||
|
return ResponseEntity.status(errorCode.getStatus())
|
||||||
|
.body(ErrorResponse.of(errorCode.getMessage()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ExceptionHandler(Exception.class)
|
||||||
|
protected ResponseEntity<ErrorResponse> handle(Exception e) {
|
||||||
|
return ResponseEntity.internalServerError()
|
||||||
|
.body(ErrorResponse.of(ErrorCode.INTERNAL_SERVER_ERROR.getMessage()));
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,15 @@
|
|||||||
|
package com.interplug.qcast.config.Exception;
|
||||||
|
|
||||||
|
public class QcastException extends BaseException {
|
||||||
|
public QcastException() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public QcastException(ErrorCode errorCode) {
|
||||||
|
super(errorCode, errorCode.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
public QcastException(ErrorCode errorCode, String message) {
|
||||||
|
super(errorCode, message);
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user