diff --git a/KART_API/Services/ProjectService.cs b/KART_API/Services/ProjectService.cs index 2dce1af..0cc9458 100644 --- a/KART_API/Services/ProjectService.cs +++ b/KART_API/Services/ProjectService.cs @@ -30,6 +30,8 @@ namespace KART_API.Services for (int i = 0; i < 2; i++) { + DataTable mustViewProject = getMustViewProject(i); + string konSqlString = "select '" + verArray[i]+ "' as [ver], '' AS ROWN,"; if (i == 1) { @@ -52,14 +54,19 @@ namespace KART_API.Services konSqlString += " (" + Environment.NewLine; konSqlString += " SELECT PKEY, GKEY, MKEY, JSON_QUERY(PROJECTJSON, '$.must') as PROJECTJSON, create_date" + Environment.NewLine; konSqlString += " FROM PROJECT with(nolock) where PKEY <> ''" + Environment.NewLine; - konSqlString += " and (create_date >= CONVERT(CHAR(10), DATEADD(YEAR, -1, GETDATE()), 23)"; + konSqlString += " and (create_date >= CONVERT(CHAR(10), DATEADD(YEAR, -1, GETDATE()), 23)"; if (i == 1) { konSqlString += " or JSON_VALUE(PROJECTJSON, '$.must.surveyclass') = '1'"; } - + if (mustViewProject.Rows.Count > 0) + { + string mustViewPkeys = string.Join(",", mustViewProject.Rows.OfType().Select(r => "'" + r["pkey"].ToString() + "'")); + konSqlString += " or PKEY in (" + mustViewPkeys + ")"; + } konSqlString += ")"; + konSqlString += " and JSON_VALUE(PROJECTJSON, '$.must.title_inner') not like '%사례비%'" + Environment.NewLine; konSqlString += " and JSON_VALUE(PROJECTJSON, '$.must.companytype') not in ('4', '5')" + Environment.NewLine; @@ -168,6 +175,29 @@ namespace KART_API.Services return returnTable; } + public DataTable getMustViewProject(int iskiwi) + { + + DataTable returnTable = new DataTable(); + MSDAL dal = new MSDAL(); + var connection = dal.ConnectReport(); + + try + { + returnTable = dal.GetDataTable($"SELECT pkey FROM REPORT_MUST_VIEW_PROJECT WHERE is_kiwi = {iskiwi}", connection); + } + catch (Exception ex) + { + logger.Fatal(this.GetType().Name + " > " + System.Reflection.MethodBase.GetCurrentMethod().Name + " : " + ex.Message); + } + finally + { + dal.Disconnect(connection); + } + + return returnTable; + } + /// /// User에게 배정된 프로젝트 Key들 반환 /// diff --git a/KART_API/Utils/Common.cs b/KART_API/Utils/Common.cs index df60ae2..170d94e 100644 --- a/KART_API/Utils/Common.cs +++ b/KART_API/Utils/Common.cs @@ -651,11 +651,19 @@ namespace KART_API.Utils /// 접속IP public static string GetRemoteIP() { - HttpContextAccessor hcAccessor = new HttpContextAccessor(); - var ip = hcAccessor.HttpContext.Connection.RemoteIpAddress.ToString(); - ip = ip.Split(',').Last().Trim(); + try + { + HttpContextAccessor hcAccessor = new HttpContextAccessor(); + var ip = hcAccessor.HttpContext.Connection.RemoteIpAddress.ToString(); + ip = ip.Split(',').Last().Trim(); - return ip; + return ip; + } + catch (Exception ex) + { + logger.Fatal("Common" + " > " + System.Reflection.MethodBase.GetCurrentMethod().Name + " : " + ex.Message); + return string.Empty; + } } ///