260310_01_ENH: PCSI 검증일지 바디 파라미터 기반으로 돌도록 수정
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using JSAPI.classes;
|
||||
using JSAPI.classes;
|
||||
using JSAPI.Dtos;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Data;
|
||||
using IHostingEnvironment = Microsoft.AspNetCore.Hosting.IHostingEnvironment;
|
||||
using System.Net;
|
||||
using IHostingEnvironment = Microsoft.AspNetCore.Hosting.IHostingEnvironment;
|
||||
|
||||
namespace JSAPI.Controllers
|
||||
{
|
||||
@@ -20,14 +21,16 @@ namespace JSAPI.Controllers
|
||||
|
||||
[HttpPost]
|
||||
[Route("pcsi/catidata")]
|
||||
public IActionResult nhisExcel()
|
||||
public IActionResult nhisExcel([FromBody] PcsiCatiDataRequestDto req)
|
||||
{
|
||||
//var context = hcAccessor.HttpContext;
|
||||
try
|
||||
{
|
||||
if(req.pkeyArray.Length == 0) return BadRequest("empty pkeyArray");
|
||||
|
||||
GoPark goPark = new GoPark();
|
||||
string fileName = "[PCSK]data_" + DateTime.Now.ToString("yyyy-MM-dd HHmmss") + ".xlsx";
|
||||
return File(goPark.pcsiDataExcel(), "application/octet-stream", fileName);
|
||||
return File(goPark.pcsiDataExcel(req), "application/octet-stream", fileName);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
@@ -1,17 +1,18 @@
|
||||
using System.Data;
|
||||
using HtmlAgilityPack;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Net;
|
||||
using System.Drawing;
|
||||
using HtmlAgilityPack;
|
||||
using JSAPI.Dtos;
|
||||
using OfficeOpenXml;
|
||||
using OfficeOpenXml.Style;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.IO.Compression;
|
||||
using System.Net;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace JSAPI.classes
|
||||
{
|
||||
public class GoPark
|
||||
{
|
||||
public byte[] pcsiDataExcel()
|
||||
public byte[] pcsiDataExcel(PcsiCatiDataRequestDto req)
|
||||
{
|
||||
ExcelPackage excelPackage = new ExcelPackage();
|
||||
|
||||
@@ -19,8 +20,7 @@ namespace JSAPI.classes
|
||||
var connection = dal.Connect("Persist Security Info=True;Data Source=1.235.195.34;Initial Catalog=new_cati;User ID=sa;Password=krco#51304;");
|
||||
try
|
||||
{
|
||||
string[] pkeyArray = new string[] { "2301008_1", "2301008_2", "2301008_3", "2301008_4", "2301008_5", "2301008_6", "2301008_7", "2301008_8", "2301008_9", "2301008_10", "2301008_11", "2301008_12", "2301008_13", "2301008_14", "2301008_15", "2301008_16", "2301008_17", "2301008_18", "2301009_1", "2301009_2", "2301009_3", "2301009_4", "2301009_5", "2301009_6", "2301009_7", "2301009_8", "2301009_9", "2301009_10", "2301009_11", "2301009_12", "2301009_13" };
|
||||
foreach(string pkey in pkeyArray)
|
||||
foreach(string pkey in req.pkeyArray)
|
||||
{
|
||||
string sql = string.Empty;
|
||||
sql += " SELECT A.prj_code, " + Environment.NewLine;
|
||||
@@ -99,6 +99,11 @@ namespace JSAPI.classes
|
||||
sql += " AND Isjson(tel_cli_error_notice) = 1) D " + Environment.NewLine;
|
||||
sql += " ON A.tel_cnt = D.tel_cnt " + Environment.NewLine;
|
||||
|
||||
if (req.onlySuccessData)
|
||||
{
|
||||
sql += " WHERE tel_stat = 1 " + Environment.NewLine;
|
||||
}
|
||||
|
||||
DataTable excelTable = dal.GetDataTable(sql, connection);
|
||||
ExcelWorksheet worksheet = excelPackage.Workbook.Worksheets.Add(pkey);
|
||||
worksheet.Cells["A1"].LoadFromDataTable(excelTable, true);
|
||||
|
||||
Reference in New Issue
Block a user