견적서 저장 에러시 오류코드 리턴 수정
This commit is contained in:
parent
b7d4729342
commit
a072d87b80
@ -618,7 +618,7 @@ public class EstimateService {
|
|||||||
estimateMapper.updateEstimateApi(estimateRequest);
|
estimateMapper.updateEstimateApi(estimateRequest);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
throw new QcastException(ErrorCode.INTERNAL_SERVER_ERROR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1062,7 +1062,7 @@ public class EstimateService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
throw new QcastException(ErrorCode.INTERNAL_SERVER_ERROR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -23,13 +23,13 @@ import org.springframework.stereotype.Component;
|
|||||||
public class ExcelUtil {
|
public class ExcelUtil {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* jxls을 이용한 엑셀다운로드
|
* jxls을 이용한 엑셀데이터 축출
|
||||||
*
|
*
|
||||||
* @param request HttpServletRequest
|
* @param request HttpServletRequest
|
||||||
* @param response HttpServletResponse
|
* @param response HttpServletResponse
|
||||||
* @param map 엑셀 출력데이터
|
* @param map 엑셀 출력데이터
|
||||||
* @param list 엑셀 출력 목록 데이터
|
* @param list 엑셀 출력 목록 데이터
|
||||||
* @param templateFileName
|
* @param templateFileName 템플릿 파일명
|
||||||
* @throws ParsePropertyException
|
* @throws ParsePropertyException
|
||||||
* @throws InvalidFormatException
|
* @throws InvalidFormatException
|
||||||
*/
|
*/
|
||||||
@ -49,8 +49,6 @@ public class ExcelUtil {
|
|||||||
InputStream templateStream =
|
InputStream templateStream =
|
||||||
PdfUtil.class.getClassLoader().getResourceAsStream(templateFilePath);
|
PdfUtil.class.getClassLoader().getResourceAsStream(templateFilePath);
|
||||||
|
|
||||||
// InputStream is = new BufferedInputStream(templateStream);
|
|
||||||
|
|
||||||
try (InputStream is = new BufferedInputStream(templateStream)) {
|
try (InputStream is = new BufferedInputStream(templateStream)) {
|
||||||
Context context = new Context();
|
Context context = new Context();
|
||||||
context.putVar("data", map);
|
context.putVar("data", map);
|
||||||
@ -68,6 +66,49 @@ public class ExcelUtil {
|
|||||||
return excelBytes;
|
return excelBytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* jxls을 이용한 엑셀다운로드
|
||||||
|
*
|
||||||
|
* @param request HttpServletRequest
|
||||||
|
* @param response HttpServletResponse
|
||||||
|
* @param map 엑셀 출력데이터
|
||||||
|
* @param list 엑셀 출력 목록 데이터
|
||||||
|
* @param fileName 다운로드 파일명
|
||||||
|
* @param templateFileName 템플릿 파일명
|
||||||
|
* @throws ParsePropertyException
|
||||||
|
* @throws InvalidFormatException
|
||||||
|
*/
|
||||||
|
public void download(
|
||||||
|
HttpServletRequest request,
|
||||||
|
HttpServletResponse response,
|
||||||
|
Map<String, Object> map,
|
||||||
|
List<Map<String, Object>> list,
|
||||||
|
String fileName,
|
||||||
|
String templateFileName)
|
||||||
|
throws ParsePropertyException, InvalidFormatException {
|
||||||
|
try {
|
||||||
|
|
||||||
|
String templateFilePath = "template/excel/" + templateFileName;
|
||||||
|
InputStream templateStream =
|
||||||
|
PdfUtil.class.getClassLoader().getResourceAsStream(templateFilePath);
|
||||||
|
|
||||||
|
InputStream is = new BufferedInputStream(templateStream);
|
||||||
|
|
||||||
|
response.setHeader("Content-Disposition", "attachment; filename=\"" + fileName + ".xlsx\"");
|
||||||
|
response.addHeader("Access-Control-Expose-Headers", "Content-Disposition");
|
||||||
|
|
||||||
|
try (OutputStream os = response.getOutputStream()) {
|
||||||
|
Context context = new Context();
|
||||||
|
context.putVar("data", map);
|
||||||
|
context.putVar("list", list);
|
||||||
|
|
||||||
|
JxlsHelper.getInstance().processTemplate(is, os, context);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.debug(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Object => Map 변환 함수
|
* Object => Map 변환 함수
|
||||||
*
|
*
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user