diff --git a/Server/Git/AbstractGit.cs b/Server/Git/AbstractGit.cs index 2013180..2b97cd3 100644 --- a/Server/Git/AbstractGit.cs +++ b/Server/Git/AbstractGit.cs @@ -32,9 +32,6 @@ namespace Server.Git Push(excel); if (isRestart) goto restart; - - //최종 데이터 세팅 - DataSet(); } /// @@ -100,19 +97,16 @@ namespace Server.Git //암호화 ProtocolProcessor.cryptoData = crypto.Compress(excel); - using (DynamicDataSQL sql = new DynamicDataSQL()) + logger.Info("version : " + ProtocolProcessor.version); + if (ProtocolProcessor.version == "") { - logger.Info("version : " + ProtocolProcessor.version); - if (ProtocolProcessor.version == "") - { - ProtocolProcessor.version = sql.SelectName("version").value; - logger.Info("Select version : " + ProtocolProcessor.version); - } - else - { - sql.Update(1, ProtocolProcessor.version); - logger.Info("Update version : " + ProtocolProcessor.version); - } + ProtocolProcessor.version = Statics.dynamicData.SelectName("version").value; + logger.Info("Select version : " + ProtocolProcessor.version); + } + else + { + Statics.dynamicData.Update(1, ProtocolProcessor.version); + logger.Info("Update version : " + ProtocolProcessor.version); } // 스테이징 @@ -165,14 +159,5 @@ namespace Server.Git return xlsxFileList; } - - /// - /// 엑셀 데이터 저장 - /// - public void DataSet() - { - EquipmentDataSQL equipmentDataSQL = new EquipmentDataSQL(); - equipmentDataSQL.init(); - } } } diff --git a/Server/Git/XlsxToJson.cs b/Server/Git/XlsxToJson.cs index 67bff60..01ef7b5 100644 --- a/Server/Git/XlsxToJson.cs +++ b/Server/Git/XlsxToJson.cs @@ -7,12 +7,10 @@ namespace Server.Git public override string ChangeScript() { //저장경로 : repositoryPath - //작업할것 - //데이터 db에 업로드 List fileList = GetFiles(repositoryPath, ".xlsx"); - Dictionary>> sheetList = new Dictionary>>(); + Dictionary>> clientSheetList = new Dictionary>>(); List sheets = null; for (int n = 0; n < fileList.Count; n++) { @@ -22,9 +20,26 @@ namespace Server.Git sheets = em.sheets; for (int m = 0; m < sheets.Count; m++) { + if (sheets[m].dataEnum[0] == "server") continue; - sheetList.Add(sheets[m].name, sheets[m].dicViewer); + string name = sheets[m].name; + Dictionary> sheet = sheets[m].dicViewer; + + + for(int i = 1; i < sheets[m].dataEnum.Count; i++) + { + if(sheets[m].dataEnum[i] == "server") + { + foreach(var item in sheet) + { + item.Value.Remove(sheets[m].variable[i]); + } + } + } + + clientSheetList.Add(name, sheet); + } } else @@ -40,7 +55,7 @@ namespace Server.Git ExcelSQL sql = new ExcelSQL(sheets); sql.DataUpdate(); } - return JsonConvert.SerializeObject(sheetList); + return JsonConvert.SerializeObject(clientSheetList); } } } \ No newline at end of file diff --git a/Server/Program.cs b/Server/Program.cs index 960d971..208f7ed 100644 --- a/Server/Program.cs +++ b/Server/Program.cs @@ -6,15 +6,15 @@ var app = builder.Build(); // ʱȭ -//ProtocolProcessor.Init(); +ProtocolProcessor.Init(); // ʱȭ -//GItWebhook.Init(); +GItWebhook.Init(); //http -//app.MapPost("/", ProtocolProcessor.Process); +app.MapPost("/", ProtocolProcessor.Process); //git ٿ -//app.MapPost("/git", GItWebhook.Process); +app.MapPost("/git", GItWebhook.Process); //app.MapPost("/update", GItWebhook.Process); @@ -25,3 +25,7 @@ app.MapPost("/spin/random", Spin.Random); #endif app.Run(Statics.URL); + + +// ̺ Ŭ̾Ʈ ̺ ã εΰ +// Ʈ db ѹ ޾ƿ° ƴ ٷ ϴ \ No newline at end of file diff --git a/Server/SQL/EquipmentData.cs b/Server/SQL/EquipmentData.cs index 0c236ac..4df99c0 100644 --- a/Server/SQL/EquipmentData.cs +++ b/Server/SQL/EquipmentData.cs @@ -2,34 +2,34 @@ using Server.System; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; +using System.Linq; namespace Server.SQL { - [Table("equipmentdata", Schema = "excel")] public class EquipmentData { - [Key] public long index { get; set; } public int part { get; set; } } - public class EquipmentDataSQL : SQL + public class EquipmentDataSQL { - public override DbSet table { get; set; } + private Dictionary equipmentData; - public override List SelectUid(long user_id) + public string sheetName = "equipment"; + + public EquipmentData getEquipmentData(long key) { - return null; + return equipmentData[key]; } + public List getEquipmentData() + { + return equipmentData.Values.ToList(); + } public void init() { - Statics.equipmentData = new Dictionary(); - List equipmentDatas = table.ToList(); - for(int n = 0; n < equipmentDatas.Count; n++) - { - Statics.equipmentData.Add(equipmentDatas[n].index, equipmentDatas[n]); - } + } } } diff --git a/Server/System/Statics.cs b/Server/System/Statics.cs index 9ac7f4c..21beaf0 100644 --- a/Server/System/Statics.cs +++ b/Server/System/Statics.cs @@ -19,15 +19,15 @@ namespace Server.System public static readonly string PATTERN = "[^a-zA-Z0-9가-힣 ]"; - public static Dictionary equipmentData = new Dictionary(); - //SQL public static DeckInfoSQL deckInfoSQL = new DeckInfoSQL(); public static DeckUnitInfoSQL deckUnitInfoSQL = new DeckUnitInfoSQL(); - public static DynamicDataSQL dynamicDataSQL = new DynamicDataSQL(); public static EquipmentrSQL equipmentrSQL = new EquipmentrSQL(); - public static EquipmentDataSQL equipmentDataSQL = new EquipmentDataSQL(); public static UserSQL userSQL = new UserSQL(); + //DATA + + public static DynamicDataSQL dynamicData = new DynamicDataSQL(); + public static EquipmentDataSQL equipmentData = new EquipmentDataSQL(); } }