From b98df034707a61fd2857dbccd5a232605076ca59 Mon Sep 17 00:00:00 2001
From: lg <123456>
Date: 星期四, 20 十一月 2025 10:26:08 +0800
Subject: [PATCH] 标准版初始化
---
WebApi/Gs.Report/ReportController.cs | 116 +++++++++++++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 107 insertions(+), 9 deletions(-)
diff --git a/WebApi/Gs.Report/ReportController.cs b/WebApi/Gs.Report/ReportController.cs
index 5c65426..8a27b27 100644
--- a/WebApi/Gs.Report/ReportController.cs
+++ b/WebApi/Gs.Report/ReportController.cs
@@ -16,7 +16,7 @@
{
private readonly IHttpContextAccessor _http;
private readonly string _userCode, _userGuid, _orgFids;
-
+ private readonly string _customTag = "瀹㈡埛妯℃澘";
public ReportController(IHttpContextAccessor httpContextAccessor)
{
_http = httpContextAccessor;
@@ -25,7 +25,7 @@
}
/// <summary>
- /// 鏍规嵁鎶ヨ〃鍙傛暟璇诲彇鎶ヨ〃鍚嶅瓧
+ /// 鏍规嵁鎶ヨ〃鍙傛暟璇诲彇鎶ヨ〃鍚嶅瓧(瀵瑰簲鐨勫瓨鍌ㄨ繃绋�)
/// </summary>
/// <returns></returns>
private string _rptGetParameterName(string str)
@@ -87,7 +87,6 @@
m.zb = new List<dynamic>();
m.mx1 = new List<dynamic>();
m.mx2 = new List<dynamic>();
- var sbSql = new StringBuilder();
var _blDate = false;
try
{
@@ -111,7 +110,14 @@
if (_blDate == false)
return ReturnDto<dynamic>.QuickReturn(m, ReturnCode.Default,
"璇诲彇澶辫触锛屾病鏈夊垵濮嬪寲妯℃澘锛�");
- //璇绘暟鎹�
+ //濡傛灉鏄璁℃ā寮忥紝閫�鍑�
+ if (isDesign == 1)
+ {
+ return ReturnDto<dynamic>.QuickReturn(m, ReturnCode.Success, "璇诲彇鎴愬姛锛�");
+ }
+ //璇婚渶瑕佹墦鍗扮殑鏁版嵁锛岀敤鏉ュ~鍏呮ā鏉�
+ if (_rptParameter.StartsWith(_customTag))
+ rptParameterName = "rpt_hgm";
var dset = new DataSet();
using (var conn = new SqlConnection(DbHelperSQL.strConn))
{
@@ -139,10 +145,6 @@
}
}
conn.Close();
- }
- if (isDesign == 1)
- {
- return ReturnDto<dynamic>.QuickReturn(m, ReturnCode.Success, "璇诲彇鎴愬姛锛�");
}
//0鏄姸鎬侊紝1鏄富琛紝2鏄槑缁嗚〃锛�3鏄槑缁嗚〃
if (dset.Tables[0].Rows[0]["msgState"].ToString() == "-1")
@@ -222,6 +224,8 @@
return ReturnDto<dynamic>.QuickReturn(m, ReturnCode.Success, "鎿嶄綔鎴愬姛锛�");
}
+
+ #region MyRegion
/// <summary>
///
/// </summary>
@@ -230,9 +234,17 @@
[RequestMethod(RequestMethods.POST)]
public ReturnDto<List<dynamic>> GetTemplateList([FromBody] dynamic model)
{
+ string keyType = model.keyType;
+
List<dynamic> lst = new List<dynamic>();
System.Text.StringBuilder sbSql = new StringBuilder();
- sbSql.Append("select [GUID],[REPORT_TYPE],[REPORT_NAME] from [dbo].[SYS_REPORT_TEMPLATE] order by [REPORT_NAME] asc");
+ if (keyType == "瀹㈡埛妯℃澘")
+ {
+ sbSql.Append("select [GUID],[REPORT_TYPE],[REPORT_NAME] from [dbo].[SYS_REPORT_TEMPLATE] where REPORT_TYPE like '" + _customTag + "%' ");
+ sbSql.Append(" union all select [GUID],[REPORT_TYPE],[REPORT_NAME] from [dbo].[SYS_REPORT_TEMPLATE] where REPORT_TYPE='rpt_hgm' order by REPORT_TYPE asc");
+ }
+ else
+ sbSql.Append("select [GUID],[REPORT_TYPE],[REPORT_NAME] from [dbo].[SYS_REPORT_TEMPLATE] order by [REPORT_TYPE] desc");
var dset = new DataSet();
try
{
@@ -248,4 +260,90 @@
return ReturnDto<List<dynamic>>.QuickReturn(lst, ReturnCode.Success,
"璇诲彇鎴愬姛锛�");
}
+
+ /// <summary>
+ /// 鍔犲叆
+ /// </summary>
+ /// <param name="model"></param>
+ /// <returns></returns>
+ [RequestMethod(RequestMethods.POST)]
+ public ReturnDto<int?> AddModel([FromBody] dynamic model)
+ {
+ string reportName = model.reportName;
+ string reportType = _customTag + DateTime.Now.ToString("MMddHHmmff");
+ int rtnInt = (int)ReturnCode.Default;
+ using (var conn = new SqlConnection(DbHelperSQL.strConn))
+ {
+ using (var cmd = new SqlCommand("[prc_report_edt]", conn))
+ {
+ try
+ {
+ conn.Open();
+ cmd.CommandType = CommandType.StoredProcedure;
+ SqlParameter[] parameters =
+ {
+ new("@outGuid", SqlDbType.NVarChar, 100),
+ new("@outMsg", SqlDbType.NVarChar, 300),
+ new("@edtUserGuid", _userGuid),
+ //new("@rptData", rptData),
+ new("@rptType", reportType),
+ new("@reportName", reportName)
+ };
+ parameters[0].Direction = ParameterDirection.Output;
+ parameters[1].Direction = ParameterDirection.Output;
+ foreach (var parameter in parameters)
+ cmd.Parameters.Add(parameter);
+ rtnInt = cmd.ExecuteNonQuery();
+ }
+ catch (Exception ex)
+ {
+ LogHelper.Debug(ToString(),
+ "AddModel error锛�" + ex.Message);
+ }
+ finally
+ {
+ conn.Close();
+ }
+ }
+ }
+ if (rtnInt > 0)
+ return ReturnDto<int>.QuickReturn(default(int?), ReturnCode.Success, "鎿嶄綔鎴愬姛锛�");
+ else
+ return ReturnDto<int>.QuickReturn(default(int?), ReturnCode.Exception, "鎿嶄綔澶辫触锛岃閲嶈瘯锛�");
+ }
+
+ /// <summary>
+ /// 绉诲嚭
+ /// </summary>
+ /// <param name="model"></param>
+ /// <returns></returns>
+ [RequestMethod(RequestMethods.POST)]
+ public ReturnDto<int?> DeleteModel([FromBody] dynamic model)
+ {
+ string guid = model.guid;
+ int rtnInt = (int)ReturnCode.Default;
+ if (guid.ToUpper() == "AF1105F3-1CFA-4E48-BE07-6EC3A184918C".ToUpper())
+ {
+ return ReturnDto<int>.QuickReturn(default(int?), ReturnCode.Exception, "鎿嶄綔澶辫触锛岄粯璁ゆā鐗堬紝涓嶈兘鍒犻櫎锛�");
+ }
+ try
+ {
+ StringBuilder strSql = new StringBuilder();
+ strSql.Append(" delete from SYS_REPORT_TEMPLATE ");
+ strSql.Append(" where guid='" + guid + "'");
+ rtnInt = DbHelperSQL.ExecuteSql(strSql.ToString());
+ }
+ catch (Exception ex)
+ {
+ LogHelper.Debug(this.ToString(), "DeleteModel error锛�" + ex.Message);
+ rtnInt = (int)ReturnCode.Exception;
+ return ReturnDto<int>.QuickReturn(default(int?), ReturnCode.Exception, "鎿嶄綔澶辫触锛�" + ex.Message);
+ }
+ if (rtnInt > 0)
+ return ReturnDto<int>.QuickReturn(default(int?), ReturnCode.Success, "鎿嶄綔鎴愬姛锛�");
+ else
+ return ReturnDto<int>.QuickReturn(default(int?), ReturnCode.Exception, "鎿嶄綔澶辫触锛岃閲嶈瘯锛�");
+ }
+ #endregion
+
}
\ No newline at end of file
--
Gitblit v1.9.3