251209_01_ENH: net ver 8로 높임, Contact 조회용 프로젝트 조회 API 추가
This commit is contained in:
@@ -37,6 +37,38 @@ namespace REPORT_API_ver6.Controllers
|
|||||||
return Content(null);
|
return Content(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Route("list/{intranetCd}/{gkey}/{isKiwi}")]
|
||||||
|
[HttpGet]
|
||||||
|
public IActionResult GetProjectList
|
||||||
|
(
|
||||||
|
[FromHeader(Name = "token")] string? token,
|
||||||
|
[FromHeader(Name = "X-API-Key")] string? xApiKey,
|
||||||
|
[FromRoute] string intranetCd,
|
||||||
|
[FromRoute] string gkey,
|
||||||
|
[FromRoute] int isKiwi,
|
||||||
|
[FromQuery(Name = "keyword")] string keyword = ""
|
||||||
|
)
|
||||||
|
{
|
||||||
|
var configuration = Common.GetConfiguration();
|
||||||
|
var value = configuration.GetSection("X-API-Key")[xApiKey ?? ""];
|
||||||
|
UserInfo? userInfo = String.IsNullOrEmpty(token)? null : Security.ValidateToken(token);
|
||||||
|
|
||||||
|
if (userInfo != null || !String.IsNullOrEmpty(value))
|
||||||
|
{
|
||||||
|
intranetCd = intranetCd.Split("_")[0];
|
||||||
|
Project project = new Project();
|
||||||
|
DataTable resultTable = project.getProjectList(intranetCd, gkey, isKiwi, keyword);
|
||||||
|
string returnString = Common.GetJsonFromObject(resultTable);
|
||||||
|
|
||||||
|
hcAccessor.HttpContext.Response.ContentType = "application/json";
|
||||||
|
Response.StatusCode = (int)HttpStatusCode.OK;
|
||||||
|
return Content(returnString);
|
||||||
|
}
|
||||||
|
|
||||||
|
Response.StatusCode = (int)HttpStatusCode.Unauthorized;
|
||||||
|
return Content(null);
|
||||||
|
}
|
||||||
|
|
||||||
[Route("assign")]
|
[Route("assign")]
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public IActionResult GetAssignList([FromHeader] string token)
|
public IActionResult GetAssignList([FromHeader] string token)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|||||||
@@ -18,6 +18,12 @@ namespace REPORT_API_ver6.Services
|
|||||||
{
|
{
|
||||||
static readonly log4net.ILog logger = log4net.LogManager.GetLogger(typeof(Common));
|
static readonly log4net.ILog logger = log4net.LogManager.GetLogger(typeof(Common));
|
||||||
|
|
||||||
|
public static IConfiguration GetConfiguration()
|
||||||
|
{
|
||||||
|
var builder = new ConfigurationBuilder().SetBasePath(Directory.GetCurrentDirectory()).AddJsonFile("appsettings.json", optional: true, reloadOnChange: true);
|
||||||
|
return builder.Build();
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Request 변수값 반환
|
/// Request 변수값 반환
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -11,16 +11,6 @@ namespace REPORT_API_ver6.Services
|
|||||||
{
|
{
|
||||||
static readonly log4net.ILog logger = log4net.LogManager.GetLogger(typeof(DAL));
|
static readonly log4net.ILog logger = log4net.LogManager.GetLogger(typeof(DAL));
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Config 파일 로드
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
public IConfiguration GetConfiguration()
|
|
||||||
{
|
|
||||||
var builder = new ConfigurationBuilder().SetBasePath(Directory.GetCurrentDirectory()).AddJsonFile("appsettings.json", optional: true, reloadOnChange: true);
|
|
||||||
return builder.Build();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Report DB 연결
|
/// Report DB 연결
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -30,7 +20,7 @@ namespace REPORT_API_ver6.Services
|
|||||||
SqlConnection connection = new SqlConnection();
|
SqlConnection connection = new SqlConnection();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var configuration = GetConfiguration();
|
var configuration = Common.GetConfiguration();
|
||||||
connection.ConnectionString = configuration.GetSection("ConnectionStrings").GetSection("ReportString").Value;
|
connection.ConnectionString = configuration.GetSection("ConnectionStrings").GetSection("ReportString").Value;
|
||||||
connection.Open();
|
connection.Open();
|
||||||
}
|
}
|
||||||
@@ -52,7 +42,7 @@ namespace REPORT_API_ver6.Services
|
|||||||
string connectionString = string.Empty;
|
string connectionString = string.Empty;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var configuration = GetConfiguration();
|
var configuration = Common.GetConfiguration();
|
||||||
|
|
||||||
if (isKiwi == 0)
|
if (isKiwi == 0)
|
||||||
{
|
{
|
||||||
@@ -82,7 +72,7 @@ namespace REPORT_API_ver6.Services
|
|||||||
SqlConnection connection = new SqlConnection();
|
SqlConnection connection = new SqlConnection();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var configuration = GetConfiguration();
|
var configuration = Common.GetConfiguration();
|
||||||
connection.ConnectionString = configuration.GetSection("ConnectionStrings").GetSection("IntraString").Value;
|
connection.ConnectionString = configuration.GetSection("ConnectionStrings").GetSection("IntraString").Value;
|
||||||
connection.Open();
|
connection.Open();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -117,6 +117,59 @@ namespace REPORT_API_ver6.Services
|
|||||||
return returnTable;
|
return returnTable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public DataTable getProjectList(string intranetCd, string gkey, int iskiwi, string keyword)
|
||||||
|
{
|
||||||
|
DataTable returnTable = new DataTable();
|
||||||
|
|
||||||
|
DAL dal = new DAL();
|
||||||
|
var connection = dal.ConnectKonKiwi(iskiwi);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string sqlString = "";
|
||||||
|
sqlString += $" SELECT pkey," + Environment.NewLine;
|
||||||
|
sqlString += $" JSON_VALUE(PROJECTJSON, '$.must.title_inner') as title," + Environment.NewLine;
|
||||||
|
sqlString += $" JSON_VALUE(PROJECTJSON, '$.must.surveytype') as [surveyType]," + Environment.NewLine;
|
||||||
|
sqlString += $" JSON_VALUE(PROJECTJSON, '$.must.status') as [status]," + Environment.NewLine;
|
||||||
|
sqlString += $" gkey, mkey, create_date as createDate " + Environment.NewLine;
|
||||||
|
sqlString += $" FROM PROJECT with(nolock) " + Environment.NewLine;
|
||||||
|
sqlString += $" WHERE PKEY <> '' " + Environment.NewLine;
|
||||||
|
|
||||||
|
if (gkey.StartsWith("R"))
|
||||||
|
{
|
||||||
|
sqlString += $" AND GKEY = '{gkey}' " + Environment.NewLine;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sqlString += $" AND GKEY <> 'M101'" + Environment.NewLine;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (String.IsNullOrEmpty(keyword))
|
||||||
|
{
|
||||||
|
sqlString += $" AND PKEY like '%{intranetCd}%' " + Environment.NewLine;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sqlString += $" AND ( " + Environment.NewLine;
|
||||||
|
sqlString += $" PKEY like '%{keyword}%'" + Environment.NewLine;
|
||||||
|
sqlString += $" OR JSON_VALUE(PROJECTJSON, '$.must.title_inner') like '%{keyword}%'" + Environment.NewLine;
|
||||||
|
sqlString += $" )" + Environment.NewLine;
|
||||||
|
}
|
||||||
|
sqlString += " ORDER BY create_date DESC" + Environment.NewLine;
|
||||||
|
|
||||||
|
returnTable = dal.GetDataTable(sqlString, connection);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
logger.Fatal(this.GetType().Name + " > " + System.Reflection.MethodBase.GetCurrentMethod().Name + " : " + ex.Message);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
dal.Disconnect(connection);
|
||||||
|
}
|
||||||
|
|
||||||
|
return returnTable;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// KON 프로젝트 상세 정보 반환
|
/// KON 프로젝트 상세 정보 반환
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -12,5 +12,9 @@
|
|||||||
"KonString": "Persist Security Info=True;Data Source=1.235.195.8,20022;Initial Catalog=KON;User Id=kon;Password=kon#51304;",
|
"KonString": "Persist Security Info=True;Data Source=1.235.195.8,20022;Initial Catalog=KON;User Id=kon;Password=kon#51304;",
|
||||||
"KiwiString": "Persist Security Info=True;Data Source=mssql-7sq2n-kr.vpc-pub-cdb.ntruss.com;Initial Catalog=konkiwi;User Id=kadmin;Password=it#51304;"
|
"KiwiString": "Persist Security Info=True;Data Source=mssql-7sq2n-kr.vpc-pub-cdb.ntruss.com;Initial Catalog=konkiwi;User Id=kadmin;Password=it#51304;"
|
||||||
},
|
},
|
||||||
|
"X-API-Key": {
|
||||||
|
"4B726963-436F6E74616374-53657276696365-402531213230" : "Contact Service",
|
||||||
|
"4B726963-436F6E74616374-46726F6E74-402531213230" : "Contact Front"
|
||||||
|
},
|
||||||
"AllowedHosts": "*"
|
"AllowedHosts": "*"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user