From 4250539ee55239ce3c22219b1a6507ba91ad7966 Mon Sep 17 00:00:00 2001 From: dyy <807692433@qq.com> Date: Wed, 21 Aug 2024 13:52:04 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E4=BF=AE=E6=94=B9=E3=80=91=E7=BB=9F?= =?UTF-8?q?=E4=B8=80=E8=AE=A4=E8=AF=81=E8=AE=BF=E9=97=AE=E6=97=A5=E5=BF=97?= =?UTF-8?q?=EF=BC=9A=E5=A2=9E=E5=8A=A0=E7=AC=AC=E4=B8=89=E6=96=B9=E9=80=80?= =?UTF-8?q?=E5=87=BA=E6=93=8D=E4=BD=9C=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Perm_FunctionVisitController.cs | 17 +++++ .../Views/Perm_FunctionVisit/Index.cshtml | 3 + .../Views/Perm_FunctionVisit/Index.js | 34 +++++++++- .../Perm_FunctionVisitBLL.cs | 24 +++++++ .../Perm_FunctionVisitEntity.cs | 9 ++- .../Perm_FunctionVisitIBLL.cs | 6 ++ .../Perm_FunctionVisitService.cs | 68 ++++++++++++++++++- 7 files changed, 155 insertions(+), 6 deletions(-) diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Permission/Controllers/Perm_FunctionVisitController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Permission/Controllers/Perm_FunctionVisitController.cs index f78fa4972..c16ad7e48 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Permission/Controllers/Perm_FunctionVisitController.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Permission/Controllers/Perm_FunctionVisitController.cs @@ -111,6 +111,23 @@ namespace Learun.Application.Web.Areas.Permission.Controllers perm_FunctionVisitIBLL.SaveEntity(keyValue,entity); return Success("保存成功!"); } + + /// + /// 退出实体数据 + /// 主键 + /// + /// + [HttpPost] + [AjaxOnly] + public ActionResult DoOutHandle(string keyValue) + { + var result = perm_FunctionVisitIBLL.DoOutHandle(keyValue); + if (!result) + { + return Fail("操作失败!"); + } + return Success("操作成功!"); + } #endregion } diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Permission/Views/Perm_FunctionVisit/Index.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Permission/Views/Perm_FunctionVisit/Index.cshtml index 3476f5c1a..a34f6f613 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Permission/Views/Perm_FunctionVisit/Index.cshtml +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Permission/Views/Perm_FunctionVisit/Index.cshtml @@ -31,6 +31,9 @@  修改  删除 +
+  退出 +
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Permission/Views/Perm_FunctionVisit/Index.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Permission/Views/Perm_FunctionVisit/Index.js index 19ed67ffe..925631512 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Permission/Views/Perm_FunctionVisit/Index.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Permission/Views/Perm_FunctionVisit/Index.js @@ -62,6 +62,30 @@ var bootstrap = function ($, learun) { }); } }); + + // 退出 + $('#lr_outhandle').on('click', function () { + var keyValue = $('#gridtable').jfGridValue('PVId'); + if (learun.checkrow(keyValue)) { + var PIsLoginSuccess = $('#gridtable').jfGridValue('PIsLoginSuccess'); + if (PIsLoginSuccess != true && PIsLoginSuccess != "true") { + learun.alert.warning("此应用无法退出!"); + return false; + } + var IsOut = $('#gridtable').jfGridValue('IsOut'); + if (IsOut == true || IsOut == "true") { + learun.alert.warning("此应用已退出!"); + return false; + } + learun.layerConfirm('是否确认退出该项!', function (res) { + if (res) { + learun.postForm(top.$.rootUrl + '/Permission/Perm_FunctionVisit/DoOutHandle', { keyValue: keyValue }, function () { + refreshGirdData(); + }); + } + }); + } + }); }, // 初始化列表 initGird: function () { @@ -77,11 +101,17 @@ var bootstrap = function ($, learun) { }, { label: "用户名称", name: "PUName", width: 100, align: "left" }, { label: "访问情况", name: "PContent", width: 400, align: "left" }, - { label: "是否已退出", name: "IsOut", width: 100, align: "left" }, + { + label: "是否退出", name: "IsOut", width: 70, align: "center", formatter: function (cellvalue) { + return cellvalue == true ? "" : ""; + } + }, + { label: "退出日期", name: "OutDate", width: 150, align: "left" }, ], mainId: 'PVId', isPage: true, - rows: 100 + rows: 100, + sidx: 'PDate desc', }); page.search(); }, diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/Permission/Perm_FunctionVisit/Perm_FunctionVisitBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/Permission/Perm_FunctionVisit/Perm_FunctionVisitBLL.cs index e10bf1d8b..0e2209df9 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/Permission/Perm_FunctionVisit/Perm_FunctionVisitBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/Permission/Perm_FunctionVisit/Perm_FunctionVisitBLL.cs @@ -118,6 +118,30 @@ namespace Learun.Application.TwoDevelopment.Permission } } + /// + /// 退出实体数据 + /// 主键 + /// + /// + public bool DoOutHandle(string keyValue) + { + try + { + return perm_FunctionVisitService.DoOutHandle(keyValue); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + #endregion } diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/Permission/Perm_FunctionVisit/Perm_FunctionVisitEntity.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/Permission/Perm_FunctionVisit/Perm_FunctionVisitEntity.cs index 07ae578eb..83910eb52 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/Permission/Perm_FunctionVisit/Perm_FunctionVisitEntity.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/Permission/Perm_FunctionVisit/Perm_FunctionVisitEntity.cs @@ -48,7 +48,7 @@ namespace Learun.Application.TwoDevelopment.Permission /// 是否登录成功 /// [Column("PISLOGINSUCCESS")] - public bool PIsLoginSuccess { get; set; } + public bool? PIsLoginSuccess { get; set; } /// /// 用户编号 /// @@ -58,7 +58,12 @@ namespace Learun.Application.TwoDevelopment.Permission /// 是否退出第三方应用 /// [Column("ISOUT")] - public bool IsOut { get; set; } + public bool? IsOut { get; set; } + /// + /// 退出时间 + /// + [Column("OUTDATE")] + public DateTime? OutDate { get; set; } #endregion #region 扩展操作 diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/Permission/Perm_FunctionVisit/Perm_FunctionVisitIBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/Permission/Perm_FunctionVisit/Perm_FunctionVisitIBLL.cs index d064d367f..9ae4789e3 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/Permission/Perm_FunctionVisit/Perm_FunctionVisitIBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/Permission/Perm_FunctionVisit/Perm_FunctionVisitIBLL.cs @@ -43,6 +43,12 @@ namespace Learun.Application.TwoDevelopment.Permission /// /// void SaveEntity(string keyValue, Perm_FunctionVisitEntity entity); + /// + /// 退出实体数据 + /// 主键 + /// + /// + bool DoOutHandle(string keyValue); #endregion } diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/Permission/Perm_FunctionVisit/Perm_FunctionVisitService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/Permission/Perm_FunctionVisit/Perm_FunctionVisitService.cs index 64ed1b0a2..115e9ffac 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/Permission/Perm_FunctionVisit/Perm_FunctionVisitService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/Permission/Perm_FunctionVisit/Perm_FunctionVisitService.cs @@ -3,7 +3,11 @@ using Learun.DataBase.Repository; using Learun.Util; using System; using System.Collections.Generic; +using System.Configuration; using System.Data; +using System.IO; +using System.Net; +using System.Net.Http; using System.Text; namespace Learun.Application.TwoDevelopment.Permission @@ -43,7 +47,7 @@ namespace Learun.Application.TwoDevelopment.Permission dp.Add("PUName", "%" + queryParam["PUName"].ToString() + "%", DbType.String); strSql.Append(" AND a.PUName Like @PUName "); } - return this.BaseRepository().FindList(strSql.ToString(),dp, pagination); + return this.BaseRepository().FindList(strSql.ToString(), dp, pagination); } catch (Exception ex) { @@ -95,7 +99,7 @@ namespace Learun.Application.TwoDevelopment.Permission { try { - this.BaseRepository().Delete(t=>t.PVId == keyValue); + this.BaseRepository().Delete(t => t.PVId == keyValue); } catch (Exception ex) { @@ -143,6 +147,66 @@ namespace Learun.Application.TwoDevelopment.Permission } } + /// + /// 退出实体数据 + /// 主键 + /// + /// + public bool DoOutHandle(string keyValue) + { + try + { + var entity = this.BaseRepository().FindEntity(keyValue); + if (entity != null && entity.PIsLoginSuccess == true && entity.IsOut != true) + { + var functionEntity = this.BaseRepository().FindEntity(entity.Fid); + if (functionEntity != null && !string.IsNullOrEmpty(functionEntity.FOutUrl)) + { + string outUrl = functionEntity.FOutUrl; + if (outUrl.Contains("?")) + { + outUrl = string.Format("{0}&no={1}", functionEntity.FOutUrl, DESEncrypt.Encrypt(entity.PUNo ?? " ", DESEncrypt.Decrypt(functionEntity.FSecret, ConfigurationManager.AppSettings["SSOPublicSecret"]), false)); + } + else + { + outUrl = string.Format("{0}?no={1}", functionEntity.FOutUrl, DESEncrypt.Encrypt(entity.PUNo ?? " ", DESEncrypt.Decrypt(functionEntity.FSecret, ConfigurationManager.AppSettings["SSOPublicSecret"]), false)); + } + try + { + HttpWebRequest webrequest = (HttpWebRequest)WebRequest.Create(outUrl); + HttpWebResponse response = (HttpWebResponse)webrequest.GetResponse(); + using (StreamReader streamReader = new StreamReader(response.GetResponseStream())) + { + string responseData = streamReader.ReadToEnd(); + if (!string.IsNullOrEmpty(responseData)) + { + this.BaseRepository().ExecuteBySql($"update Perm_FunctionVisit set IsOut=1,OutDate='{DateTime.Now}' where PVId='{entity.PVId}' "); + return true; + } + } + + } + catch (Exception) + { + return false; + } + } + } + return false; + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + #endregion }