excel처리 최적화

This commit is contained in:
김민서 2024-02-06 11:01:07 +09:00
parent 63b86328bc
commit a8ab7ae6c5
3 changed files with 43 additions and 30 deletions

View File

@ -44,9 +44,6 @@ namespace Server.Git
query = ""; query = "";
for (int n = 0; n < sheets.Count; n++) for (int n = 0; n < sheets.Count; n++)
{ {
if (sheets[n].dataEnum[0] == "client")
continue;
//초기화 //초기화
newTableQuery = ""; newTableQuery = "";
tableDatas = "("; tableDatas = "(";

View File

@ -11,6 +11,7 @@ namespace Server.Git
List<string> fileList = GetFiles(repositoryPath, ".xlsx"); List<string> fileList = GetFiles(repositoryPath, ".xlsx");
Dictionary<string, Dictionary<long, Dictionary<string, object>>> clientSheetList = new Dictionary<string, Dictionary<long, Dictionary<string, object>>>(); Dictionary<string, Dictionary<long, Dictionary<string, object>>> clientSheetList = new Dictionary<string, Dictionary<long, Dictionary<string, object>>>();
List<sheet> serverSheetList = new List<sheet>();
for (int n = 0; n < fileList.Count; n++) for (int n = 0; n < fileList.Count; n++)
{ {
@ -21,25 +22,40 @@ namespace Server.Git
for (int m = 0; m < sheets.Count; m++) for (int m = 0; m < sheets.Count; m++)
{ {
if (sheets[m].dataEnum[0] == "server") switch (sheets[m].dataEnum[0])
continue; {
case "server":
serverSheetList.Add(sheets[m]);
break;
case "client":
clientSheetList.Add(sheets[m].name, sheets[m].dicViewer);
break;
case "all":
string name = sheets[m].name; string name = sheets[m].name;
Dictionary<long, Dictionary<string, object>> sheet = sheets[m].dicViewer; Dictionary<long, Dictionary<string, object>> serverSheet = sheets[m].dicViewer;
Dictionary<long, Dictionary<string, object>> clientSheet = sheets[m].dicViewer;
for (int i = 1; i < sheets[m].dataEnum.Count; i++) for (int i = 1; i < sheets[m].dataEnum.Count; i++)
{ {
if(sheets[m].dataEnum[i] == "server") if (sheets[m].dataEnum[i] == "client")
{ {
foreach(var item in sheet) foreach (var item in serverSheet)
{ {
item.Value.Remove(sheets[m].variable[i]); item.Value.Remove(sheets[m].variable[i]);
} }
} }
if (sheets[m].dataEnum[i] == "server")
{
foreach (var item in clientSheet)
{
item.Value.Remove(sheets[m].variable[i]);
}
} }
clientSheetList.Add(name, sheet); }
serverSheetList.Add(sheets[m]);
clientSheetList.Add(name, clientSheet);
break;
}
} }
} }
else else
@ -50,9 +66,9 @@ namespace Server.Git
} }
//현재 서버는 PostgreSQL기준으로 쿼리를 생성하는 코드와 패키지가 세팅되어 있습니다 이점 참고바랍니다 //현재 서버는 PostgreSQL기준으로 쿼리를 생성하는 코드와 패키지가 세팅되어 있습니다 이점 참고바랍니다
//추가로 해당 기능을 사용하려면 서버에 excel이라는 스키마가 존재하여야 합니다. //추가로 해당 기능을 사용하려면 서버에 excel이라는 스키마가 존재하여야 합니다.
if (sheets != null) if (sheets != null && serverSheetList.Count != 0)
{ {
ExcelSQL sql = new ExcelSQL(sheets); ExcelSQL sql = new ExcelSQL(serverSheetList);
sql.DataUpdate(); sql.DataUpdate();
} }
return JsonConvert.SerializeObject(clientSheetList); return JsonConvert.SerializeObject(clientSheetList);

View File

@ -8,20 +8,20 @@ var app = builder.Build();
//웹서버 초기화 //웹서버 초기화
ProtocolProcessor.Init(); ProtocolProcessor.Init();
//깃 웹훅 초기화 //깃 웹훅 초기화
GItWebhook.Init(); //GItWebhook.Init();
//http용 데이터 ////http용 데이터
app.MapPost("/", ProtocolProcessor.Process); //app.MapPost("/", ProtocolProcessor.Process);
//git 접근용 웹훅 ////git 접근용 웹훅
app.MapPost("/git", GItWebhook.Process); //app.MapPost("/git", GItWebhook.Process);
//app.MapPost("/update", GItWebhook.Process); ////app.MapPost("/update", GItWebhook.Process);
#if DEBUG //#if DEBUG
app.MapGet("/spin", Spin.Main); //app.MapGet("/spin", Spin.Main);
app.MapPost("/spin/random", Spin.Random); //app.MapPost("/spin/random", Spin.Random);
#endif //#endif
app.Run(Statics.URL); app.Run(Statics.URL);