설계의뢰 목록 API 개발
This commit is contained in:
parent
e554ab72de
commit
eb7e947728
@ -18,7 +18,7 @@ public class ObjectController {
|
|||||||
// @Autowired private ObjectService objectService;
|
// @Autowired private ObjectService objectService;
|
||||||
private final ObjectService objectService;
|
private final ObjectService objectService;
|
||||||
|
|
||||||
@Operation(description = "물건정보 도도부현을 조회한다.2")
|
@Operation(description = "물건정보 도도부현을 조회한다.")
|
||||||
@GetMapping("/prefecture/list")
|
@GetMapping("/prefecture/list")
|
||||||
@ResponseStatus(HttpStatus.OK)
|
@ResponseStatus(HttpStatus.OK)
|
||||||
public List<PrefResponse> selectPrefList() throws Exception {
|
public List<PrefResponse> selectPrefList() throws Exception {
|
||||||
@ -100,4 +100,11 @@ public class ObjectController {
|
|||||||
|
|
||||||
objectService.deletePlan(planRequest);
|
objectService.deletePlan(planRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Operation(description = "설계의뢰 목록을 조회한다.")
|
||||||
|
@GetMapping("/planReq/list")
|
||||||
|
@ResponseStatus(HttpStatus.OK)
|
||||||
|
public PlanReqResponse selectPlanReqList(PlanReqRequest planReqRequest) throws Exception {
|
||||||
|
return objectService.selectPlanReqList(planReqRequest);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,25 +1,39 @@
|
|||||||
package com.interplug.qcast.biz.object;
|
package com.interplug.qcast.biz.object;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||||
import com.interplug.qcast.biz.object.dto.*;
|
import com.interplug.qcast.biz.object.dto.*;
|
||||||
|
import com.interplug.qcast.config.Exception.ErrorCode;
|
||||||
|
import com.interplug.qcast.config.Exception.QcastException;
|
||||||
|
import com.interplug.qcast.config.message.Messages;
|
||||||
|
import com.interplug.qcast.util.InterfaceQsp;
|
||||||
import io.micrometer.common.util.StringUtils;
|
import io.micrometer.common.util.StringUtils;
|
||||||
|
import java.net.URLEncoder;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.RandomStringUtils;
|
import org.apache.commons.lang3.RandomStringUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.http.HttpMethod;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.web.util.UriComponentsBuilder;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class ObjectService {
|
public class ObjectService {
|
||||||
|
private final InterfaceQsp interfaceQsp;
|
||||||
|
|
||||||
|
@Autowired Messages message;
|
||||||
|
|
||||||
@Value("${file.ini.root.path}")
|
@Value("${file.ini.root.path}")
|
||||||
private String baseDirPath;
|
private String baseDirPath;
|
||||||
|
|
||||||
@Value("${file.ini.base.filename}")
|
@Value("${qsp.url}")
|
||||||
private String baseFileName;
|
private String QSP_API_URL;
|
||||||
|
|
||||||
private final ObjectMapper objectMapper;
|
private final ObjectMapper objectMapper;
|
||||||
|
|
||||||
@ -203,4 +217,55 @@ public class ObjectService {
|
|||||||
// Plan 삭제
|
// Plan 삭제
|
||||||
objectMapper.deletePlan(planRequest);
|
objectMapper.deletePlan(planRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public PlanReqResponse selectPlanReqList(PlanReqRequest planReqRequest) throws Exception {
|
||||||
|
|
||||||
|
PlanReqResponse response = null;
|
||||||
|
|
||||||
|
/* [1]. QSP API (url + param) Setting */
|
||||||
|
String encodedSchTitle =
|
||||||
|
URLEncoder.encode(planReqRequest.getSchTitle(), StandardCharsets.UTF_8);
|
||||||
|
String encodedSchAddress =
|
||||||
|
URLEncoder.encode(planReqRequest.getSchAddress(), StandardCharsets.UTF_8);
|
||||||
|
String encodedSchSaleStoreName =
|
||||||
|
URLEncoder.encode(planReqRequest.getSchSaleStoreName(), StandardCharsets.UTF_8);
|
||||||
|
String encodedSchPlanReqName =
|
||||||
|
URLEncoder.encode(planReqRequest.getSchPlanReqName(), StandardCharsets.UTF_8);
|
||||||
|
|
||||||
|
String url = QSP_API_URL + "/api/planReq/list";
|
||||||
|
System.out.println(url);
|
||||||
|
String apiUrl =
|
||||||
|
UriComponentsBuilder.fromHttpUrl(url)
|
||||||
|
.queryParam("saleStoreId", planReqRequest.getSaleStoreId())
|
||||||
|
.queryParam("saleStoreLevel", planReqRequest.getSaleStoreLevel())
|
||||||
|
.queryParam("schPlanReqNo", planReqRequest.getSchPlanReqNo())
|
||||||
|
.queryParam("schTitle", encodedSchTitle)
|
||||||
|
.queryParam("schAddress", encodedSchAddress)
|
||||||
|
.queryParam("schSaleStoreName", encodedSchSaleStoreName)
|
||||||
|
.queryParam("schPlanReqName", encodedSchPlanReqName)
|
||||||
|
.queryParam("schPlanStatCd", planReqRequest.getSchPlanStatCd())
|
||||||
|
.queryParam("schDateGbn", planReqRequest.getSchDateGbn())
|
||||||
|
.queryParam("schStartDt", planReqRequest.getSchStartDt())
|
||||||
|
.queryParam("schEndDt", planReqRequest.getSchEndDt())
|
||||||
|
.queryParam("startRow", planReqRequest.getStartRow())
|
||||||
|
.queryParam("endRow", planReqRequest.getEndRow())
|
||||||
|
.build()
|
||||||
|
.toUriString();
|
||||||
|
|
||||||
|
/* [2]. QSP API CALL -> Response */
|
||||||
|
String strResponse = interfaceQsp.callApi(HttpMethod.GET, apiUrl, null);
|
||||||
|
|
||||||
|
if (!"".equals(strResponse)) {
|
||||||
|
com.fasterxml.jackson.databind.ObjectMapper om =
|
||||||
|
new com.fasterxml.jackson.databind.ObjectMapper()
|
||||||
|
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||||
|
|
||||||
|
response = om.readValue(strResponse, PlanReqResponse.class);
|
||||||
|
} else {
|
||||||
|
// [msg] No data
|
||||||
|
throw new QcastException(ErrorCode.NOT_FOUND, message.getMessage("common.message.no.data"));
|
||||||
|
}
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,47 @@
|
|||||||
|
package com.interplug.qcast.biz.object.dto;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class PlanReqRequest {
|
||||||
|
@Schema(description = "판매점 ID")
|
||||||
|
private String saleStoreId;
|
||||||
|
|
||||||
|
@Schema(description = "판매점 레벨")
|
||||||
|
private String saleStoreLevel;
|
||||||
|
|
||||||
|
@Schema(description = "검색 - 설계의뢰번호")
|
||||||
|
private String schPlanReqNo;
|
||||||
|
|
||||||
|
@Schema(description = "검색 - 안건명")
|
||||||
|
private String schTitle;
|
||||||
|
|
||||||
|
@Schema(description = "검색 - 도도부현")
|
||||||
|
private String schAddress;
|
||||||
|
|
||||||
|
@Schema(description = "검색 - 판매대리점명")
|
||||||
|
private String schSaleStoreName;
|
||||||
|
|
||||||
|
@Schema(description = "검색 - 의뢰자명")
|
||||||
|
private String schPlanReqName;
|
||||||
|
|
||||||
|
@Schema(description = "검색 - 설계의뢰 상태코드")
|
||||||
|
private String schPlanStatCd;
|
||||||
|
|
||||||
|
@Schema(description = "검색 - 날짜구분(S/R)")
|
||||||
|
private String schDateGbn;
|
||||||
|
|
||||||
|
@Schema(description = "검색 - 시작일")
|
||||||
|
private String schStartDt;
|
||||||
|
|
||||||
|
@Schema(description = "검색 - 종료일")
|
||||||
|
private String schEndDt;
|
||||||
|
|
||||||
|
// 페이징정보
|
||||||
|
@Schema(description = "시작 Row")
|
||||||
|
private String startRow;
|
||||||
|
|
||||||
|
@Schema(description = "종료 Row")
|
||||||
|
private String endRow;
|
||||||
|
}
|
||||||
@ -0,0 +1,12 @@
|
|||||||
|
package com.interplug.qcast.biz.object.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class PlanReqResponse {
|
||||||
|
/** API response result */
|
||||||
|
private Object result;
|
||||||
|
|
||||||
|
/** API response data */
|
||||||
|
private Object data;
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user