260320_01_ENH: Data Export에 날짜 범위 조회 추가, Data Export시 두번째 시트에 변수가이드 나오게 수정

This commit is contained in:
2026-03-20 11:25:58 +09:00
parent 0aa5be19ef
commit cc614fe5a1
5 changed files with 96 additions and 10 deletions

View File

@@ -128,12 +128,33 @@ namespace REPORT_API_ver6.Controllers
Project project = new Project();
PkeyInfo pkeyInfo = new PkeyInfo(skey);
DataTable headerTable = project.getExportHeader(pkeyInfo.Pkey, pkeyInfo.isKiwi, userInfo.IsAdmin);
DataTable bodyTable = project.getProjectData(pkeyInfo.Pkey, "", "", "", "", pkeyInfo.isKiwi, 1,"", "", type);
DataTable exportTable = project.makeExportTable(headerTable, bodyTable);
string fileName = "[DATA]" + pkeyInfo.Pkey + "_" + DateTime.Now.ToString("yyyy-MM-dd HHmmss") + ".xlsx";
byte[] fileByteArray = project.makeDataAndGuidFile(pkeyInfo, userInfo, type, "ALL");
Response.StatusCode = (int)HttpStatusCode.OK;
return File(fileByteArray, "application/octet-stream", fileName);
}
Response.StatusCode = (int)HttpStatusCode.Unauthorized;
return Content(null);
}
[Route("data/{start}/{end}")]
[HttpGet]
public IActionResult ExportDataWithDate(
[FromHeader] string token, [FromHeader] string skey, [FromHeader] string type
,[FromRoute] string start, [FromRoute] string end
)
{
UserInfo userInfo = Security.ValidateToken(token);
if (userInfo != null)
{
Project project = new Project();
PkeyInfo pkeyInfo = new PkeyInfo(skey);
string fileName = "[DATA]" + pkeyInfo.Pkey + "_" + DateTime.Now.ToString("yyyy-MM-dd HHmmss") + ".xlsx";
byte[] fileByteArray = Common.DataTableToExcel(exportTable);
byte[] fileByteArray = project.makeDataAndGuidFile(pkeyInfo, userInfo, type, "ALL", start, end);
Response.StatusCode = (int)HttpStatusCode.OK;
return File(fileByteArray, "application/octet-stream", fileName);
@@ -152,10 +173,9 @@ namespace REPORT_API_ver6.Controllers
{
Project project = new Project();
PkeyInfo pkeyInfo = new PkeyInfo(skey);
DataTable guideTable = project.makeGuideTable(pkeyInfo.Pkey, pkeyInfo.isKiwi, userInfo.IsAdmin);
string fileName = "[GUIDE]" + pkeyInfo.Pkey + "_" + DateTime.Now.ToString("yyyy-MM-dd HHmmss") + ".xlsx";
byte[] fileByteArray = Common.DataTableToExcel(guideTable);
byte[] fileByteArray = project.makeDataAndGuidFile(pkeyInfo, userInfo, "", "GUIDE");
Response.StatusCode = (int)HttpStatusCode.OK;
return File(fileByteArray, "application/octet-stream", fileName);