fix: API 호출 - 직접호출, 서버에서 호출 반영

dev
Jonguk. Lim 5 months ago
parent 7b9c0d0766
commit cc7b68944a

@ -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<T> {
/**
* -
* - (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<T> {
/**
* 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 <T> ApiBaseResponse<T> of() {
// return new ApiBaseResponse<>();
// }
//
// public static <T> ApiBaseResponse<T> of(T data) {
// return new ApiBaseResponse<>(data);
// }
//
// public static <T> ApiBaseResponse<T> 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;
// }
private Boolean success;
public int getTotalCount() {
if(data == null){
this.totalCount = 0;
}else {
if (Collection.class.isAssignableFrom(data.getClass())) {
this.totalCount = ((Collection<?>) data).size();
} else {
this.totalCount = 1;
}
}
return totalCount;
}
private String responseTime;
}

@ -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
@ -56,7 +59,7 @@ public class ProductController extends AbstractController {
.addObject("infoPrefix", "product") // prefix
.addObject("infoPrefixUrl", "/adds/nims") // prefixUrl
.addObject("openPage", openPage)
;
.addObject("apiHost", apiHost);
}
@RequestMapping(name="마약류폐기 신청서 접수 조회", value=METHOD_URL.getProductList)

@ -94,7 +94,7 @@
$P.control = new DatasetControl({
urls : {
//load : wctx.url("/adds/nims/product-list.do")
load : '<c:url value="http://localhost:9076/api/biz/nims/v1/getNimsProductInfoKd" />',
load : '<c:url value="${apiHost}/api/biz/nims/v1/getNimsProductInfoKd" />',
}
, prefix: "productMain"
, prefixName: "마약류 제품 조회"

Loading…
Cancel
Save