update SwaggerOperation
Some checks failed
continuous-integration/drone/push Build is failing
continuous-integration/drone Build is passing

This commit is contained in:
kamonwan taengsuk
2023-08-18 15:30:37 +07:00
parent 1080400c34
commit b078d3ff42
11 changed files with 152 additions and 131 deletions

View File

@@ -25,7 +25,7 @@ namespace rmutr_report.Controllers
{
this._setting = setting;
}
[SwaggerOperation("ร5. คำชี้แจงงบลงทุน ค่าที่ดินและสิ่งก่อสร้าง")]
[HttpPost, Route("reports/ro_five/{type}")]
[ApiExplorerSettings(GroupName = "reports")]
public IActionResult GetRoFiveReport([FromRoute] string type, [FromBody] ro_five building_fours)
@@ -265,7 +265,7 @@ namespace rmutr_report.Controllers
return Ok();
}
[SwaggerOperation("ร8. ประมาณการรายรับจากงานวิจัยภายนอก")]
[HttpPost, Route("reports/external_research/{type}")]
[ApiExplorerSettings(GroupName = "reports")]
public IActionResult GetExReport([FromRoute] string type, [FromBody] external_research external)
@@ -352,7 +352,7 @@ namespace rmutr_report.Controllers
return Ok();
}
[SwaggerOperation("ร9. ประมาณการรายรับจากงานบริการวิชาการ")]
[HttpPost, Route("reports/ro_nine/{type}")]
[ApiExplorerSettings(GroupName = "reports")]
public IActionResult GetNineReport([FromRoute] string type, [FromBody] ro_nine external)
@@ -435,7 +435,7 @@ namespace rmutr_report.Controllers
return Ok();
}
[SwaggerOperation("ร10. ประมาณการรายรับจากการบริหารสินทรัพย์ที่ก่อให้เกิดรายได้")]
[HttpPost, Route("reports/ro_ten/{type}")]
[ApiExplorerSettings(GroupName = "reports")]
public IActionResult GetTenReport([FromRoute] string type, [FromBody] ro_ten ten)
@@ -496,7 +496,7 @@ namespace rmutr_report.Controllers
return Ok();
}
[SwaggerOperation("ร11. ประมาณการรายรับจากรายได้ประเภทอื่น ๆ")]
[HttpPost, Route("reports/ro_eleven/{type}")]
[ApiExplorerSettings(GroupName = "reports")]
public IActionResult GetEleReport([FromRoute] string type, [FromBody] ro_eleven eleven)
@@ -544,116 +544,7 @@ namespace rmutr_report.Controllers
return Ok();
}
[HttpPost, Route("reports/revenue_estimate_income_summary/{type}")]
[ApiExplorerSettings(GroupName = "reports")]
public IActionResult GetEstimateIncomeReport([FromRoute] string type,
[FromBody] revenue_estimate_income_summary estimate)
{
var s1 = estimate.data.Sum(d => d.science_1);
var s2 = estimate.data.Sum(d => d.social_1);
var s3 = estimate.data.Sum(d => d.science_2);
var s4 = estimate.data.Sum(d => d.social_2);
var s5 = estimate.data.Sum(d => d.total_register_fee);
var s6 = estimate.data.Sum(d => d.science_3);
var s7 = estimate.data.Sum(d => d.social_3);
var s8 = estimate.data.Sum(d => d.science_4);
var s9 = estimate.data.Sum(d => d.social_4);
var s10 = estimate.data.Sum(d => d.total_education_fee);
var s11 = estimate.data.Sum(d => d.total_science);
var s12 = estimate.data.Sum(d => d.total_social);
var s13 = estimate.data.Sum(d => d.total_science_social);
estimate.sum_1 = s1;
estimate.sum_2 = s2;
estimate.sum_3 = s3;
estimate.sum_4 = s4;
estimate.sum_5 = s5;
estimate.sum_6 = s6;
estimate.sum_7 = s7;
estimate.sum_8 = s8;
estimate.sum_9 = s9;
estimate.sum_10 = s10;
estimate.sum_11 = s11;
estimate.sum_12 = s12;
estimate.sum_13 = s13;
var estimateEducation = new List<revenue_estimate_income_summary>() { estimate };
Report report = new Report();
report.Load(_setting.report_path + "revenue_estimate_income_summary.frx");
report.RegisterData(estimateEducation, "revenue_estimate_income_summary");
report.Prepare();
MemoryStream stream = new MemoryStream();
switch (type)
{
case "pdf":
PDFExport pdf = new PDFExport();
report.Export(pdf, stream);
stream.Seek(0, SeekOrigin.Begin);
return File(stream, "application/pdf");
case "xls":
case "xlsx":
Excel2007Export excel = new Excel2007Export();
report.Export(excel, stream);
stream.Seek(0, SeekOrigin.Begin);
return File(
stream,
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
"estimateincome_" + ".xlsx");
}
return Ok();
}
[HttpPost, Route("reports/revenue_estimate_education_fee/{type}")]
[ApiExplorerSettings(GroupName = "reports")]
public IActionResult GetEstimateReport([FromRoute] string type,
[FromBody] revenue_estimate_education_fee estimate)
{
if (estimate.budget_project_name_th != null)
{
string myStr = estimate.budget_project_name_th;
string[] projectname = myStr.Split("ผู้สำเร็จการศึกษา");
foreach (string projectnames in projectname)
{
estimate.side = projectnames;
}
}
var estimateEducation = new List<revenue_estimate_education_fee>() { estimate };
Report report = new Report();
report.Load(_setting.report_path + "revenue_estimate_education_fee.frx");
report.RegisterData(estimateEducation, "revenue_estimate_education_fee");
report.Prepare();
MemoryStream stream = new MemoryStream();
switch (type)
{
case "pdf":
PDFExport pdf = new PDFExport();
report.Export(pdf, stream);
stream.Seek(0, SeekOrigin.Begin);
return File(stream, "application/pdf");
case "xls":
case "xlsx":
Excel2007Export excel = new Excel2007Export();
report.Export(excel, stream);
stream.Seek(0, SeekOrigin.Begin);
return File(
stream,
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
"estimateEducation" + ".xlsx");
}
return Ok();
}
[SwaggerOperation("ร12. ประมาณการรายรับภาคปกติของคณะศิลปศาสตร์จาก ค่าหน่วยกิตที่ลงทะเบียน")]
[HttpPost, Route("reports/revenue_estimate_register_credits/{type}")]
[ApiExplorerSettings(GroupName = "reports")]
public IActionResult GetRegisterCreditsReport([FromRoute] string type,
@@ -4068,7 +3959,117 @@ namespace rmutr_report.Controllers
"revenueEstimate_register" + ".xlsx");
}
}
[SwaggerOperation("ร13. ประมาณการรายรับภาคปกติของคณะศิลปศาสตร์จาก ค่าบำรุงการศึกษา")]
[HttpPost, Route("reports/revenue_estimate_education_fee/{type}")]
[ApiExplorerSettings(GroupName = "reports")]
public IActionResult GetEstimateReport([FromRoute] string type,
[FromBody] revenue_estimate_education_fee estimate)
{
if (estimate.budget_project_name_th != null)
{
string myStr = estimate.budget_project_name_th;
string[] projectname = myStr.Split("ผู้สำเร็จการศึกษา");
foreach (string projectnames in projectname)
{
estimate.side = projectnames;
}
}
var estimateEducation = new List<revenue_estimate_education_fee>() { estimate };
Report report = new Report();
report.Load(_setting.report_path + "revenue_estimate_education_fee.frx");
report.RegisterData(estimateEducation, "revenue_estimate_education_fee");
report.Prepare();
MemoryStream stream = new MemoryStream();
switch (type)
{
case "pdf":
PDFExport pdf = new PDFExport();
report.Export(pdf, stream);
stream.Seek(0, SeekOrigin.Begin);
return File(stream, "application/pdf");
case "xls":
case "xlsx":
Excel2007Export excel = new Excel2007Export();
report.Export(excel, stream);
stream.Seek(0, SeekOrigin.Begin);
return File(
stream,
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
"estimateEducation" + ".xlsx");
}
return Ok();
}
[SwaggerOperation("ร14. แบบฟอร์มสรุปรายรับคณะศิลปศาสตร์จากการจัดการศึกษาให้กับคณะอื่น")]
[HttpPost, Route("reports/revenue_estimate_income_summary/{type}")]
[ApiExplorerSettings(GroupName = "reports")]
public IActionResult GetEstimateIncomeReport([FromRoute] string type,
[FromBody] revenue_estimate_income_summary estimate)
{
var s1 = estimate.data.Sum(d => d.science_1);
var s2 = estimate.data.Sum(d => d.social_1);
var s3 = estimate.data.Sum(d => d.science_2);
var s4 = estimate.data.Sum(d => d.social_2);
var s5 = estimate.data.Sum(d => d.total_register_fee);
var s6 = estimate.data.Sum(d => d.science_3);
var s7 = estimate.data.Sum(d => d.social_3);
var s8 = estimate.data.Sum(d => d.science_4);
var s9 = estimate.data.Sum(d => d.social_4);
var s10 = estimate.data.Sum(d => d.total_education_fee);
var s11 = estimate.data.Sum(d => d.total_science);
var s12 = estimate.data.Sum(d => d.total_social);
var s13 = estimate.data.Sum(d => d.total_science_social);
estimate.sum_1 = s1;
estimate.sum_2 = s2;
estimate.sum_3 = s3;
estimate.sum_4 = s4;
estimate.sum_5 = s5;
estimate.sum_6 = s6;
estimate.sum_7 = s7;
estimate.sum_8 = s8;
estimate.sum_9 = s9;
estimate.sum_10 = s10;
estimate.sum_11 = s11;
estimate.sum_12 = s12;
estimate.sum_13 = s13;
var estimateEducation = new List<revenue_estimate_income_summary>() { estimate };
Report report = new Report();
report.Load(_setting.report_path + "revenue_estimate_income_summary.frx");
report.RegisterData(estimateEducation, "revenue_estimate_income_summary");
report.Prepare();
MemoryStream stream = new MemoryStream();
switch (type)
{
case "pdf":
PDFExport pdf = new PDFExport();
report.Export(pdf, stream);
stream.Seek(0, SeekOrigin.Begin);
return File(stream, "application/pdf");
case "xls":
case "xlsx":
Excel2007Export excel = new Excel2007Export();
report.Export(excel, stream);
stream.Seek(0, SeekOrigin.Begin);
return File(
stream,
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
"estimateincome_" + ".xlsx");
}
return Ok();
}
[SwaggerOperation("ร1. แบบฟอร์มเสนอขอปรับเปลี่ยนชื่อตำแหน่ง")]
[HttpPost, Route("reports/form_1_2/{type}")]
[ApiExplorerSettings(GroupName = "reports")]
public IActionResult GetForm2Report([FromRoute] string type,
@@ -4119,7 +4120,7 @@ namespace rmutr_report.Controllers
return Ok();
}
[SwaggerOperation("ร1. แบบฟอร์มเสนอขออัตราใหม่")]
[HttpPost, Route("reports/form_1_3/{type}")]
[ApiExplorerSettings(GroupName = "reports")]
public IActionResult GetForm3Report([FromRoute] string type,
@@ -4294,7 +4295,7 @@ namespace rmutr_report.Controllers
return Ok();
}
[SwaggerOperation("ร1. แบบฟอร์มเสนอขอปรับคุณวุฒิ")]
[HttpPost, Route("reports/budget_income_qualification/{type}")]
[ApiExplorerSettings(GroupName = "reports")]
public IActionResult GetForm1Report([FromRoute] string type,