From 91912ad24d477ff24be56f0a22438303a8eae552 Mon Sep 17 00:00:00 2001 From: wzp <2880584989@qq.com> Date: 星期四, 16 九月 2021 16:12:52 +0800 Subject: [PATCH] Merge branch 'Release' of ssh://8.129.227.30:29418/SMGW_NewWeb into Release --- web/web/GwSm.ashx | 291 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 291 insertions(+), 0 deletions(-) diff --git a/web/web/GwSm.ashx b/web/web/GwSm.ashx new file mode 100644 index 0000000..8cd9c11 --- /dev/null +++ b/web/web/GwSm.ashx @@ -0,0 +1,291 @@ +锘�<%@ WebHandler Language="C#" Class="GwSm" %> + +using System; +using System.Web; +using Model; +using Dao; +using System.Data; +using System.Collections.Generic; +using Common; + +public class GwSm : PageHandler<SysUser> +{ + public override JsonPageResult ProcessRequestInternal(PageContext<Model.SysUser> context) + { + string action = context.GetString("action"); + + switch (action) + { + case "loadGwSmPageList"://鐭俊涓嬪彂璁板綍 + return LoadGwSmPageList(context); + case "loadGwSmResendPageList"://鐭俊閲嶅彂璁板綍 + return LoadGwSmResendPageList(context); + default: + throw new Exception("Invalid Action=" + action); + } + } + + GwSmDao dao = new GwSmDao(); + private JsonPageResult LoadGwSmPageList(PageContext<SysUser> context) + { + // context.CheckRight("401", FailedOperation.HistoryGoBack);//鏂板姞 + // string privnce = context.GetString("privnce");//鏂板姞鍖哄煙 + string selectedApMID = context.GetString("SelectedApMID"); + string selectedDate = context.GetString("SelectedDate"); + if (string.IsNullOrEmpty(selectedDate)) + { + selectedDate = DateTime.Today.ToString("yyyy-MM-dd"); + } + string selectedContent = context.GetString("SelectedContent"); + string selectedOpStat = context.GetString("SelectedOpStat"); + string selectedOpName = context.GetString("SelectedOpName"); + string selectedDestnationID = context.GetString("SelectedDestnationID"); + string selectedSpID = context.GetString("SelectedSpID"); + string selectedClientID = context.GetString("SelectedClientID"); + string selectedBeginTime = context.GetString("BeginTime"); + if (string.IsNullOrEmpty(selectedBeginTime)) + { + if (DateTime.Now.AddHours(-1).Day != DateTime.Now.Day) + { + selectedBeginTime = "00:00:00"; + } + else + { + selectedBeginTime = DateTime.Now.AddHours(-1).ToString("HH:mm:ss"); + } + } + string selectedEndTime = context.GetString("EndTime"); + if (string.IsNullOrEmpty(selectedEndTime)) + { + selectedEndTime = DateTime.Now.Date.AddSeconds(-1).ToString("HH:mm:ss"); + } + int TStatus = context.GetInt("TStatus", -1); + int recordCount = 0; + int pageSize = context.GetInt("pageSize", 20); + int pageIndex = context.GetInt("pageIndex", 1); + + List<Model.GwSm> list = dao.LoadInfoList(selectedApMID, selectedOpName, selectedClientID, selectedSpID, selectedDestnationID, selectedDate, selectedBeginTime, selectedEndTime, selectedContent, selectedOpStat, TStatus, out recordCount, pageSize, pageIndex); + + string str = ""; + + if (list != null && list.Count > 0) + { + int i = 0; + foreach (Model.GwSm item in list) + { + i++; + string css = string.Empty; + string errorMsg = string.Empty; + string InterfaceName = string.Empty; + + GetSendInfo(item.APResult, item.OPResult, item.Stat, out css, out errorMsg); + GetInterface(item.ApID.ToString(), out InterfaceName); + + str += @"<tr>"; + str += "<td>" + item.APMID + "</td>"; + str += "<td>" + item.ClientID + "-" + item.SPID + "</td>"; + str += "<td>" + InterfaceName + " - " + item.OpName + "</td>"; + str += "<td><span>" + StringHelper.TrimEnd(item.AccessCode, item.ExtNo) + @"</span><span class=""text-danger"">" + item.ExtNo + "</span></td>"; + str += "<td>" + item.Mobile + "</td>"; + str += "<td>" + item.PkNumber + "/" + item.PkTotal + "/" + item.Tpudhi + "/" + item.MsgFormat + "/" + item.MsgLength + "</td>"; + + string resendStatusText = "<span class='text-muted'>姝e父</span>"; + if (item.ResendStatus == 1 && item.ResendFlag == 1) { resendStatusText = "<span class='text-danger'>澶辫触鐭俊宸茶ˉ鍙�</span>"; } + if (item.ResendStatus == 1 && item.ResendFlag == 0) { resendStatusText = "<span class='text-success'>琛ュ彂璁板綍</span>"; } + str += "<td>" + resendStatusText + "</td>"; + if (item.OpDeliverTime.ToString() == "0001/1/1 0:00:00" || item.OpDeliverTime == null) + { + str += "<td>" + "鏃犳硶璁$畻" + "</td>"; + } + else + { + str += "<td>" + (item.OpDeliverTime - item.SubmitTime).TotalSeconds + "</td>"; + } + + str += "<td>" + item.APFeeCount + "/" + item.OPFeeCount + "</td>"; + str += "<td>" + item.APResult + "/" + item.OPResult + "</td>"; + str += @"<td class=""text-right"">" + (item.SubmitTime == DateTime.MinValue ? string.Empty : item.SubmitTime.ToString("yy-MM-dd HH:mm:ss")) + "</td>"; + str += @"<td class=""text-right"">" + (item.OpSubmitTime == DateTime.MinValue ? string.Empty : item.OpSubmitTime.ToString("yy-MM-dd HH:mm:ss")) + "</td>"; + str += @"</tr>"; + str += @"<tr>"; + str += @"<td>" + item.OPMID + "</td>"; + str += @"<td><span class=""label " + css + @""">" + errorMsg + "</span></td>"; + str += @"<td colspan=""9"" class=""text-right"">" + item.MsgContent + "</td>"; + str += @"<td class=""text-right text-info"">" + (item.OpDeliverTime == DateTime.MinValue ? string.Empty : item.OpDeliverTime.ToString("yy-MM-dd HH:mm:ss")) + "</td>"; + str += "</tr>"; + } + } + else + { + str += "<tr><td colspan=\"22\" style=\"padding-left:5px;\">鏆傛棤淇℃伅</td></tr>"; + } + + return new JsonPageResult(true, new { Table = str.ToString(), TotalCount = recordCount }); + } + + /// <summary> + /// 鐭俊閲嶅彂璁板綍 + /// </summary> + /// <param name="context"></param> + /// <returns></returns> + private JsonPageResult LoadGwSmResendPageList(PageContext<SysUser> context) + { + // context.CheckRight("401", FailedOperation.HistoryGoBack);//鏂板姞 + // string privnce = context.GetString("privnce");//鏂板姞鍖哄煙 + string selectedApMID = context.GetString("SelectedApMID"); + string selectedDate = context.GetString("SelectedDate"); + if (string.IsNullOrEmpty(selectedDate)) + { + selectedDate = DateTime.Today.ToString("yyyy-MM-dd"); + } + string selectedContent = context.GetString("SelectedContent"); + string selectedOpStat = context.GetString("SelectedOpStat"); + string selectedOpName = context.GetString("SelectedOpName"); + string selectedDestnationID = context.GetString("SelectedDestnationID"); + string selectedSpID = context.GetString("SelectedSpID"); + string selectedClientID = context.GetString("SelectedClientID"); + string selectedBeginTime = context.GetString("BeginTime"); + if (string.IsNullOrEmpty(selectedBeginTime)) + { + if (DateTime.Now.AddHours(-1).Day != DateTime.Now.Day) + { + selectedBeginTime = "00:00:00"; + } + else + { + selectedBeginTime = DateTime.Now.AddHours(-1).ToString("HH:mm:ss"); + } + } + string selectedEndTime = context.GetString("EndTime"); + if (string.IsNullOrEmpty(selectedEndTime)) + { + selectedEndTime = DateTime.Now.Date.AddSeconds(-1).ToString("HH:mm:ss"); + } + int TStatus = context.GetInt("TStatus", -1); + int recordCount = 0; + int pageSize = context.GetInt("pageSize", 20); + int pageIndex = context.GetInt("pageIndex", 1); + + List<Model.GwSm> list = dao.LoadInfoList(selectedApMID, selectedOpName, selectedClientID, selectedSpID, selectedDestnationID, selectedDate, selectedBeginTime, selectedEndTime, selectedContent, selectedOpStat, TStatus, out recordCount, pageSize, pageIndex, "ReSend"); + + string str = ""; + + if (list != null && list.Count > 0) + { + int i = 0; + int j = 0; + foreach (Model.GwSm item in list) + { + + if (item.ResendStatus == 1 && item.ResendFlag == 0) + { + i++; + string css = string.Empty; + string errorMsg = string.Empty; + string InterfaceName = string.Empty; + + GetSendInfo(item.APResult, item.OPResult, item.Stat, out css, out errorMsg); + GetInterface(item.ApID.ToString(), out InterfaceName); + + str += @"<tr>"; + str += "<td>" + item.APMID + "</td>"; + str += "<td>" + item.ClientID + "-" + item.SPID + "</td>"; + str += "<td>" + InterfaceName + " - " + item.OpName + "</td>"; + str += "<td><span>" + StringHelper.TrimEnd(item.AccessCode, item.ExtNo) + @"</span><span class=""text-danger"">" + item.ExtNo + "</span></td>"; + str += "<td>" + item.Mobile + "</td>"; + str += "<td>" + item.PkNumber + "/" + item.PkTotal + "/" + item.Tpudhi + "/" + item.MsgFormat + "/" + item.MsgLength + "</td>"; + + string resendStatusText = "<span class='text-muted'>姝e父</span>"; + if (item.ResendStatus == 1 && item.ResendFlag == 1) { resendStatusText = "<span class='text-danger'>澶辫触鐭俊宸茶ˉ鍙�</span>"; } + if (item.ResendStatus == 1 && item.ResendFlag == 0) { resendStatusText = "<span class='text-success'>琛ュ彂璁板綍</span>"; } + str += "<td>" + resendStatusText + "</td>"; + str += "<td>" + (item.OpDeliverTime - item.SubmitTime).TotalSeconds + "</td>"; + str += "<td>" + item.APFeeCount + "/" + item.OPFeeCount + "</td>"; + str += "<td>" + item.APResult + "/" + item.OPResult + "</td>"; + str += @"<td class=""text-right"">" + (item.SubmitTime == DateTime.MinValue ? string.Empty : item.SubmitTime.ToString("yy-MM-dd HH:mm:ss")) + "</td>"; + str += @"<td class=""text-right"">" + (item.OpSubmitTime == DateTime.MinValue ? string.Empty : item.OpSubmitTime.ToString("yy-MM-dd HH:mm:ss")) + "</td>"; + str += @"</tr>"; + str += @"<tr>"; + str += @"<td>" + item.OPMID + "</td>"; + str += @"<td><span class=""label " + css + @""">" + errorMsg + "</span></td>"; + str += @"<td colspan=""9"" class=""text-right"">" + item.MsgContent + "</td>"; + str += @"<td class=""text-right text-info"">" + (item.OpDeliverTime == DateTime.MinValue ? string.Empty : item.OpDeliverTime.ToString("yy-MM-dd HH:mm:ss")) + "</td>"; + str += "</tr>"; + }//琛ュ彂鐘舵�佹樉绀� + + + + } + } + else + { + str += "<tr><td colspan=\"22\" style=\"padding-left:5px;\">鏆傛棤淇℃伅</td></tr>"; + } + + return new JsonPageResult(true, new { Table = str.ToString(), TotalCount = recordCount }); + } + + + /// <summary> + /// 鑾峰彇璐﹀彿鐨勬彁浜ょ殑鎺ュ彛淇℃伅 + /// </summary> + /// <param name="apid"></param> + /// <param name="InterfaceName"></param> + private void GetInterface(string apid, out string InterfaceName) + { + switch (apid) + { + case "230000": InterfaceName = "HTTP"; break; + case "230001": InterfaceName = "CMPP"; break; + case "230002": InterfaceName = "HTTP"; break; + default: InterfaceName = "鏈煡"; break; + } + } + + + /// <summary> + /// 鑾峰彇鍙戦�佺粨鏋� + /// </summary> + /// <param name="apStatus"></param> + /// <param name="opStatus"></param> + /// <param name="stat"></param> + /// <param name="css"></param> + /// <param name="errMsg"></param> + private void GetSendInfo(long apStatus, long opStatus, string stat, out string css, out string errMsg) + { + if (apStatus != 0) + { + css = "label-danger"; + errMsg = string.Format("AP鎻愪氦澶辫触({0})", apStatus); + } + else if (opStatus != 0) + { + css = "label-danger"; + errMsg = string.Format("OP鎻愪氦澶辫触({0})", opStatus); + } + else if (opStatus == 0 && apStatus == 0 && stat == "") + { + css = "label"; + errMsg = string.Format("鏈煡"); + } + else if (stat != "DELIVRD") + { + css = "label-warning"; + errMsg = string.Format("鍙戦�佸け璐�({0})", stat); + } + else + { + css = "label-primary"; + errMsg = string.Format("鍙戦�佹垚鍔�({0})", stat); + } + } + + public bool IsReusable + { + get + { + return false; + } + } + +} \ No newline at end of file -- Gitblit v1.9.1