커뮤니티 qcast -> qsp 파일 다운로드 파라미터 수정
This commit is contained in:
parent
1ff3916b81
commit
f61c92fddd
@ -42,8 +42,8 @@ public class BoardController {
|
|||||||
@GetMapping("/file/download")
|
@GetMapping("/file/download")
|
||||||
@ResponseStatus(HttpStatus.OK)
|
@ResponseStatus(HttpStatus.OK)
|
||||||
public void getFileDownload(HttpServletResponse response,
|
public void getFileDownload(HttpServletResponse response,
|
||||||
@RequestParam(required = true) String encodeFileNo) throws Exception {
|
@RequestParam(required = true) String keyNo, @RequestParam String zipYn) throws Exception {
|
||||||
boardService.getFileDownload(response, encodeFileNo);
|
boardService.getFileDownload(response, keyNo, zipYn);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -71,7 +71,9 @@ public class BoardService {
|
|||||||
.queryParam("schNoticeTpCd", boardRequest.getSchNoticeTpCd())
|
.queryParam("schNoticeTpCd", boardRequest.getSchNoticeTpCd())
|
||||||
.queryParam("schNoticeClsCd", boardRequest.getSchNoticeClsCd())
|
.queryParam("schNoticeClsCd", boardRequest.getSchNoticeClsCd())
|
||||||
.queryParam("startRow", boardRequest.getStartRow())
|
.queryParam("startRow", boardRequest.getStartRow())
|
||||||
.queryParam("endRow", boardRequest.getEndRow()).build().toUriString();
|
.queryParam("endRow", boardRequest.getEndRow())
|
||||||
|
.queryParam("schMainYn", boardRequest.getSchMainYn()).build().toUriString();
|
||||||
|
|
||||||
|
|
||||||
/* [2]. QSP API CALL -> Response */
|
/* [2]. QSP API CALL -> Response */
|
||||||
String strResponse = interfaceQsp.callApi(HttpMethod.GET, apiUrl, null);
|
String strResponse = interfaceQsp.callApi(HttpMethod.GET, apiUrl, null);
|
||||||
@ -135,17 +137,24 @@ public class BoardService {
|
|||||||
* @param encodeFileNo
|
* @param encodeFileNo
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public void getFileDownload(HttpServletResponse response, String encodeFileNo) throws Exception {
|
public void getFileDownload(HttpServletResponse response, String keyNo, String zipYn)
|
||||||
|
throws Exception {
|
||||||
|
|
||||||
/* [0]. Validation Check */
|
/* [0]. Validation Check */
|
||||||
if ("".equals(encodeFileNo)) {
|
if ("".equals(keyNo)) {
|
||||||
// [msg] {0} is required input value.
|
// [msg] {0} is required input value.
|
||||||
|
String arg = "Y".equals(zipYn) ? "Notice No" : "File No";
|
||||||
throw new QcastException(ErrorCode.INVALID_INPUT_VALUE,
|
throw new QcastException(ErrorCode.INVALID_INPUT_VALUE,
|
||||||
message.getMessage("common.message.required.data", "File No"));
|
message.getMessage("common.message.required.data", arg));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* [1]. QSP API (url + fileNo) Setting */
|
/* [1]. QSP API (url + fileNo) Setting */
|
||||||
String url = QSP_API_URL + "/api/file/downloadFile" + "?encodeFileNo=" + encodeFileNo;
|
String url = QSP_API_URL + "/api/file/downloadFile";
|
||||||
|
if ("Y".equals(zipYn)) {
|
||||||
|
url += "?noticeNo=" + keyNo;
|
||||||
|
} else {
|
||||||
|
url += "?fileNo=" + keyNo;
|
||||||
|
}
|
||||||
|
|
||||||
/* [2]. QSP API CALL -> Response */
|
/* [2]. QSP API CALL -> Response */
|
||||||
Map<String, String> result = new HashMap<String, String>();
|
Map<String, String> result = new HashMap<String, String>();
|
||||||
@ -154,6 +163,7 @@ public class BoardService {
|
|||||||
if (byteResponse != null && byteResponse.length > 0) {
|
if (byteResponse != null && byteResponse.length > 0) {
|
||||||
try {
|
try {
|
||||||
/* [3]. API 응답 파일 처리 */
|
/* [3]. API 응답 파일 처리 */
|
||||||
|
response.addHeader("Access-Control-Expose-Headers", "Content-Disposition");
|
||||||
response.setContentType(
|
response.setContentType(
|
||||||
!"".equals(result.get("type")) && result.get("type") != null ? result.get("type")
|
!"".equals(result.get("type")) && result.get("type") != null ? result.get("type")
|
||||||
: "application/octet-stream");
|
: "application/octet-stream");
|
||||||
|
|||||||
@ -25,4 +25,7 @@ public class BoardRequest {
|
|||||||
/** 종료 행 */
|
/** 종료 행 */
|
||||||
private int endRow;
|
private int endRow;
|
||||||
|
|
||||||
|
/** 메인여부 */
|
||||||
|
private String schMainYn;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user