diff --git a/src/main/java/cokr/xit/adds/cmm/model/ApiBaseResponse.java b/src/main/java/cokr/xit/adds/cmm/model/ApiBaseResponse.java index 887e422..9deab7a 100644 --- a/src/main/java/cokr/xit/adds/cmm/model/ApiBaseResponse.java +++ b/src/main/java/cokr/xit/adds/cmm/model/ApiBaseResponse.java @@ -1,10 +1,5 @@ package cokr.xit.adds.cmm.model; -import java.time.LocalDateTime; -import java.time.format.DateTimeFormatter; -import java.util.Collection; -import java.util.Objects; - import com.fasterxml.jackson.annotation.JsonRootName; import lombok.AccessLevel; @@ -33,17 +28,16 @@ import lombok.NoArgsConstructor; @AllArgsConstructor @Builder @JsonRootName("result") -//@JsonInclude(JsonInclude.Include.NON_NULL) public class ApiBaseResponse { /** - * 결과 코드 - 필수 + * 결과 코드 - 필수(200: 성공) */ - private Integer code = ResultCode.SUCCESS.getStatusCode(); + private Integer code; /** * 결과 메세지 - 필수 */ - private String message = ResultCode.SUCCESS.getMessage(); + private String message; /** * 결과 데이터 @@ -58,70 +52,8 @@ public class ApiBaseResponse { /** * API 실행 성공 or 실패 */ - private Boolean success = Objects.equals(code, ResultCode.SUCCESS.getStatusCode()); - - /** - * API 실행 시간 - */ - @Builder.Default - private String responseTime = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); - - // public static ApiBaseResponse of() { - // return new ApiBaseResponse<>(); - // } - // - // public static ApiBaseResponse of(T data) { - // return new ApiBaseResponse<>(data); - // } - // - // public static ApiBaseResponse empty() { - // return new ApiBaseResponse<>(null, ResultCode.NO_CONTENT); - // } - // - // private ApiBaseResponse(T data) { - // - // if(ObjectUtils.isEmpty(data)) { - // this.code = ResultCode.NO_CONTENT.getStatusCode(); - // this.message = ResultCode.NO_CONTENT.getMessage(); - // this.data = null; - // }else{ - // this.code = ResultCode.SUCCESS.getStatusCode(); - // this.message = ResultCode.findByStatusCode(code).getMessage(); - // this.data = data; - // } - // } - // - // private ApiBaseResponse(T data, ResultCode resultCode) { - // this.success = true; - // this.code = resultCode.getStatusCode(); - // this.message = resultCode.getMessage(); - // this.data = null; - // } - // - // public ApiBaseResponse(Integer code, String message) { - // this.code = code; - // this.message = message; - // } - // - // public ApiBaseResponse(Integer code, String message, T data) { - // this.code = code; - // this.message = message; - // this.data = data; - // } - - public int getTotalCount() { - if(data == null){ - this.totalCount = 0; - - }else { + private Boolean success; - if (Collection.class.isAssignableFrom(data.getClass())) { - this.totalCount = ((Collection) data).size(); - } else { - this.totalCount = 1; - } - } - return totalCount; - } + private String responseTime; } diff --git a/src/main/java/cokr/xit/adds/nims/web/ProductController.java b/src/main/java/cokr/xit/adds/nims/web/ProductController.java index 3a66191..8c5508b 100644 --- a/src/main/java/cokr/xit/adds/nims/web/ProductController.java +++ b/src/main/java/cokr/xit/adds/nims/web/ProductController.java @@ -4,6 +4,7 @@ import java.net.http.HttpResponse; import java.util.List; import java.util.function.Consumer; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.servlet.ModelAndView; @@ -31,9 +32,11 @@ import cokr.xit.foundation.web.WebClient.Request.ContentType; value = {"/adds/nims"} ) public class ProductController extends AbstractController { + @Value("${app.api.host:}") + private String apiHost; - public static final String CLASS_URL = "/adds/nims"; - JSON json = new JSON(); + private static final String CLASS_URL = "/adds/nims"; + private final JSON json = new JSON(); public class METHOD_URL { public static final String @@ -55,8 +58,8 @@ public class ProductController extends AbstractController { .addObject("pageName", "productMain") // View(jsp)에서 사용할 id 뒤에 붙일 suffix .addObject("infoPrefix", "product") // prefix .addObject("infoPrefixUrl", "/adds/nims") // prefixUrl - .addObject("openPage", openPage) - ; + .addObject("openPage", openPage) + .addObject("apiHost", apiHost); } @RequestMapping(name="마약류폐기 신청서 접수 조회", value=METHOD_URL.getProductList) diff --git a/src/main/webapp/WEB-INF/jsp/adds/nims/product-main.jsp b/src/main/webapp/WEB-INF/jsp/adds/nims/product-main.jsp index 57038f0..3315942 100644 --- a/src/main/webapp/WEB-INF/jsp/adds/nims/product-main.jsp +++ b/src/main/webapp/WEB-INF/jsp/adds/nims/product-main.jsp @@ -94,7 +94,7 @@ $P.control = new DatasetControl({ urls : { //load : wctx.url("/adds/nims/product-list.do") - load : '', + load : '', } , prefix: "productMain" , prefixName: "마약류 제품 조회"