diff --git a/SGGL/BLL/Common/Const.cs b/SGGL/BLL/Common/Const.cs
index cbed3410..ec046d44 100644
--- a/SGGL/BLL/Common/Const.cs
+++ b/SGGL/BLL/Common/Const.cs
@@ -62,6 +62,11 @@ namespace BLL
/// 微信订阅模板ID
///
public const string WX_TemplateID = "hKFrcahyXEjGSrLM4qBPpjXAkFldnrqxU_mARd1IF4o";
+
+ ///
+ /// 五环OA 私钥
+ ///
+ public const string OAPrivateKey_CWCEC = "nq6pYDFkcrpzVtMrLbf2dvDPs2FDo5yeDub6YCnl0hXov3MVEVMbVe3NCnC5Thl3dwm14yI9/vNIGdH5M4getAkMnkG8tNA60NPjtHUzyoZSpVYCUOmB30s5vx+4IBkPh8R4ynkJYyUxkl61/0h6y7A86qz4jNivxAKt2a0vQxk=AQABy/DiC9r3AfTlJzuwk2BBT3X2YpVN0LE/lUIHJs64GW2siQow/k9BRcPOkBwLuVOp/YrwYPCh/XGLxjukqxCjNw==xzA32jeRGMthXVbkmn0YvFKV6O9IS7Toee2cRN8x1qRPwwnN5yOq7lunMcZyWLfCimsKmYwRe9Uw5fHMPScULw==DIzRTEt4Qd2RMH3i2t7khgBLXjuz4zDVKdk7WW8FM0Nlh7Vh2HSGHsXy8zlWm1wDrP+c1UpZnaAcKuHGu2Q1tw==jFW3dAHkM0DPFzDqHMH4FG5m+dbj65rIk2bJy2got93J6FLXA3sIqahfMl1rIIBPCrCBpk6d3s4EBm2GBKustw==ux8JAVqXtCjtaNgahpa0AK73tp+kGEkHyvt/hzp8C8LmXicNGNZtgDDHHLwxN+Lzp3z6ThfzY44oQtymljRu1g==Ye2Oj9PLltYkKhgmFI/sZZjVxXEoKgeUr8OyDrisoUtuGQCvpsJwI0affGr2oREsXeU7P9I5CmcfPvgLX9cIgsAtOcDMM81Hs6WhfbkryjyFj1CfKTI9gYZnApPInYYMew8wvUX23K6Hq+rIyHxMnSAhLvoqXor4KVQj6QRtdOU=";
#endregion
#region 按钮描述
diff --git a/SGGL/BLL/Common/Funs.cs b/SGGL/BLL/Common/Funs.cs
index b649b3e9..654dca1a 100644
--- a/SGGL/BLL/Common/Funs.cs
+++ b/SGGL/BLL/Common/Funs.cs
@@ -1131,6 +1131,16 @@ namespace BLL
}
return value;
}
+
+ ///
+ /// ʱת
+ ///
+ ///
+ ///
+ public static DateTime IntToDateTime(int timestamp)
+ {
+ return TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1)).AddSeconds(timestamp);
+ }
}
}
diff --git a/SGGL/BLL/LoginService.cs b/SGGL/BLL/LoginService.cs
index e29c1b5b..5ba04f38 100644
--- a/SGGL/BLL/LoginService.cs
+++ b/SGGL/BLL/LoginService.cs
@@ -38,6 +38,32 @@ namespace BLL
}
}
+ ///
+ /// OA ˺ŵ½
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static bool UserLogOn_OA(string account, bool rememberMe, System.Web.UI.Page page)
+ {
+ List x = (from y in Funs.DB.Sys_User
+ where y.Account == account && y.IsPost == true
+ select y).ToList();
+ if (x.Any())
+ {
+ string accValue = HttpUtility.UrlEncode(account);
+ FormsAuthentication.SetAuthCookie(accValue, false);
+ page.Session[SessionName.CurrUser] = x.First();
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
///
/// û¼ɹ
///
diff --git a/SGGL/FineUIPro.Web/ErrLog.txt b/SGGL/FineUIPro.Web/ErrLog.txt
index 5f282702..8591e8d9 100644
--- a/SGGL/FineUIPro.Web/ErrLog.txt
+++ b/SGGL/FineUIPro.Web/ErrLog.txt
@@ -1 +1,33 @@
-
\ No newline at end of file
+
+错误信息开始=====>
+错误类型:FormatException
+错误信息:输入的不是有效的 Base-64 字符串,因为它包含非 Base-64 字符、两个以上的填充字符,或者填充字符间包含非法字符。
+错误堆栈:
+ 在 System.Convert.FromBase64_Decode(Char* startInputPtr, Int32 inputLength, Byte* startDestPtr, Int32 destLength)
+ 在 System.Convert.FromBase64CharPtr(Char* inputPtr, Int32 inputLength)
+ 在 System.Convert.FromBase64String(String s)
+ 在 System.Security.Cryptography.RSA.FromXmlString(String xmlString)
+ 在 FineUIPro.Web.Login.RSADecrypt(String privatekey, String content) 位置 D:\CWCEC\SGGL_CWCEC\SGGL\FineUIPro.Web\Login.aspx.cs:行号 161
+ 在 FineUIPro.Web.Login.Page_Load(Object sender, EventArgs e) 位置 D:\CWCEC\SGGL_CWCEC\SGGL\FineUIPro.Web\Login.aspx.cs:行号 74
+ 在 System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)
+ 在 System.EventHandler.Invoke(Object sender, EventArgs e)
+ 在 System.Web.UI.Control.OnLoad(EventArgs e)
+ 在 System.Web.UI.Control.LoadRecursive()
+ 在 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
+出错时间:09/17/2021 14:54:20
+出错文件:http://localhost:8118/Login.aspx?data=****&database=userName=sysgly×pan=1256015312
+IP地址:::1
+
+出错时间:09/17/2021 14:54:20
+
+
+错误信息开始=====>
+错误类型:FormatException
+错误信息:该字符串未被识别为有效的 DateTime。
+错误堆栈:
+ 在 System.DateTimeParse.Parse(String s, DateTimeFormatInfo dtfi, DateTimeStyles styles)
+ 在 System.DateTime.Parse(String s)
+ 在 BLL.Funs.GetNewDateTime(String time) 位置 D:\CWCEC\SGGL_CWCEC\SGGL\BLL\Common\Funs.cs:行号 554
+出错时间:09/17/2021 14:56:12
+出错时间:09/17/2021 14:56:12
+
diff --git a/SGGL/FineUIPro.Web/Login.aspx.cs b/SGGL/FineUIPro.Web/Login.aspx.cs
index c5dfef7b..b9d06940 100644
--- a/SGGL/FineUIPro.Web/Login.aspx.cs
+++ b/SGGL/FineUIPro.Web/Login.aspx.cs
@@ -4,6 +4,8 @@
using System;
using System.Configuration;
using System.Linq;
+ using System.Security.Cryptography;
+ using System.Text;
using System.Web;
using System.Web.Services;
@@ -65,6 +67,32 @@
{
if (!IsPostBack)
{
+ string userdata = Request.Params["basedata"];
+ if (!string.IsNullOrEmpty(userdata))
+ {
+ string result = RSADecrypt(Const.OAPrivateKey_CWCEC, userdata); //经过RSA解密后获得的域登录名+时间戳
+ if (!string.IsNullOrEmpty(result))
+ {
+ var value = Funs.GetStrListByStr(result, '|');
+ if (value.Count > 1)
+ {
+ var userValues = Funs.GetStrListByStr(value[0], '=');
+ var timespan = Funs.GetStrListByStr(value[1], '=');
+ if (userValues.Count > 1 && timespan.Count > 1)
+ {
+ DateTime? dateTimeS = Funs.IntToDateTime(Funs.GetNewIntOrZero(timespan[1]));
+ if (dateTimeS.HasValue && DateTime.Now.AddSeconds(-30) < dateTimeS)
+ {
+ if (LoginService.UserLogOn_OA(userValues[1], true, this.Page))
+ {
+ string url = getUrl();
+ Response.Redirect(url);
+ }
+ }
+ }
+ }
+ }
+ }
}
}
#endregion
@@ -80,28 +108,59 @@
string url = "";
if (LoginService.UserLogOn(user, pwd, true, this.Page))
{
- this.CurrUser.RoleType = RoleService.GetRoleTypeByRoleId(this.CurrUser.RoleId);
- if (!this.CurrUser.LastIsOffice.HasValue)
- {
- this.CurrUser.LastIsOffice = this.CurrUser.IsOffice;
- }
- if (this.CurrUser.LastIsOffice == true)
- {
- this.CurrUser.LoginProjectId = null;
- ////本部菜单
- url = "index.aspx";
- }
- else
- {
- this.CurrUser.LoginProjectId = this.CurrUser.LastProjectId;
- //// 项目菜单
- url = "indexProject.aspx?projectId=" + this.CurrUser.LastProjectId;
- }
-
- LogService.AddSys_Log(this.CurrUser, this.CurrUser.UserName, this.CurrUser.UserId, Const.UserMenuId, Const.BtnLogin);
+ url = getUrl();
}
return url;
}
+
+ ///
+ /// 获取跳转页面
+ ///
+ ///
+ private string getUrl()
+ {
+ string url = "";
+ this.CurrUser.RoleType = RoleService.GetRoleTypeByRoleId(this.CurrUser.RoleId);
+ if (!this.CurrUser.LastIsOffice.HasValue)
+ {
+ this.CurrUser.LastIsOffice = this.CurrUser.IsOffice;
+ }
+ if (this.CurrUser.LastIsOffice == true)
+ {
+ this.CurrUser.LoginProjectId = null;
+ ////本部菜单
+ url = "index.aspx";
+ }
+ else
+ {
+ this.CurrUser.LoginProjectId = this.CurrUser.LastProjectId;
+ //// 项目菜单
+ url = "indexProject.aspx?projectId=" + this.CurrUser.LastProjectId;
+ }
+
+ LogService.AddSys_Log(this.CurrUser, this.CurrUser.UserName, this.CurrUser.UserId, Const.UserMenuId, Const.BtnLogin);
+
+ return url;
+ }
+
+
+ ///
+ ///
+ /// 用私钥对数据进行RSA解密
+ ///
+ ///
+ ///
+ ///
+ public static string RSADecrypt(string privatekey, string content)
+ {
+
+ RSACryptoServiceProvider rsa = new RSACryptoServiceProvider();
+ byte[] cipherbytes;
+ rsa.FromXmlString(privatekey);
+ //对参数content进行两次base64解密
+ cipherbytes = rsa.Decrypt(Convert.FromBase64String(Encoding.UTF8.GetString(Convert.FromBase64String(content))), false);
+ return Encoding.UTF8.GetString(cipherbytes);
+ }
}
}
diff --git a/开发需求/OA对接密钥.txt b/开发需求/OA对接密钥.txt
new file mode 100644
index 00000000..02c0d16f
--- /dev/null
+++ b/开发需求/OA对接密钥.txt
@@ -0,0 +1,7 @@
+publickey
+
+rnq6pYDFkcrpzVtMrLbf2dvDPs2FDo5yeDub6YCnl0hXov3MVEVMbVe3NCnC5Thl3dwm14yI9/vNIGdH5M4getAkMnkG8tNA60NPjtHUzyoZSpVYCUOmB30s5vx+4IBkPh8R4ynkJYyUxkl61/0h6y7A86qz4jNivxAKt2a0vQxk=AQAB
+
+
+privatekey:nq6pYDFkcrpzVtMrLbf2dvDPs2FDo5yeDub6YCnl0hXov3MVEVMbVe3NCnC5Thl3dwm14yI9/vNIGdH5M4getAkMnkG8tNA60NPjtHUzyoZSpVYCUOmB30s5vx+4IBkPh8R4ynkJYyUxkl61/0h6y7A86qz4jNivxAKt2a0vQxk=AQAB
+y/DiC9r3AfTlJzuwk2BBT3X2YpVN0LE/lUIHJs64GW2siQow/k9BRcPOkBwLuVOp/YrwYPCh/XGLxjukqxCjNw==xzA32jeRGMthXVbkmn0YvFKV6O9IS7Toee2cRN8x1qRPwwnN5yOq7lunMcZyWLfCimsKmYwRe9Uw5fHMPScULw==DIzRTEt4Qd2RMH3i2t7khgBLXjuz4zDVKdk7WW8FM0Nlh7Vh2HSGHsXy8zlWm1wDrP+c1UpZnaAcKuHGu2Q1tw==jFW3dAHkM0DPFzDqHMH4FG5m+dbj65rIk2bJy2got93J6FLXA3sIqahfMl1rIIBPCrCBpk6d3s4EBm2GBKustw==ux8JAVqXtCjtaNgahpa0AK73tp+kGEkHyvt/hzp8C8LmXicNGNZtgDDHHLwxN+Lzp3z6ThfzY44oQtymljRu1g==Ye2Oj9PLltYkKhgmFI/sZZjVxXEoKgeUr8OyDrisoUtuGQCvpsJwI0affGr2oREsXeU7P9I5CmcfPvgLX9cIgsAtOcDMM81Hs6WhfbkryjyFj1CfKTI9gYZnApPInYYMew8wvUX23K6Hq+rIyHxMnSAhLvoqXor4KVQj6QRtdOU=
\ No newline at end of file
diff --git a/开发需求/智慧工地与五环OA集成说明文档(1).docx b/开发需求/智慧工地与五环OA集成说明文档(1).docx
new file mode 100644
index 00000000..e71dbdbf
--- /dev/null
+++ b/开发需求/智慧工地与五环OA集成说明文档(1).docx
@@ -0,0 +1,38 @@
+ 单点登录的方式
+ 五环系统点击链接:https://zhgd.cwcec.com/Login.html?data=****&basedata=****
+ 免登录进入智慧工地的系统
+ data参数说明
+ data字符串是用户名和时间戳用RSA公钥加密后的字符串。例如:
+ userName=zhangsan×pan=1256015312用公钥加密后生成****
+ basedata参数说明
+ basedata字符串是用户名和时间戳用RSA公钥加密后再用Base64加密一次
+ 生成的加密字符串。例如:
+ userName=zhangsan×pan=1256015312用公钥加密后再用Base64加密
+ 为了解决有的解密过程中出现"+"或者"="这样的特殊字符。推荐截取basedata的
+ 字符串解密。
+
+ 解密方式
+ data或者basedata都是用公钥进行RSA加密,需要用我们提供的私钥对加密文件进行解密,判断用户名是否在系统中并且当前时间-时间戳<30秒钟,才能登录到系统中,否则需要输入账号密码
+三、.net解密的函数参考
+string userdata = context.Request["database"].ToString();
+string privatekey = ****(我们会提供)
+string result = RSADecrypt(privatekey, userdata); //经过RSA解密后获得的域登录名+时间戳
+
+
+///
+///
+/// 用私钥对数据进行RSA解密
+///
+///
+///
+///
+public static string RSADecrypt(string privatekey, string content)
+{
+
+RSACryptoServiceProvider rsa = new RSACryptoServiceProvider();
+byte[] cipherbytes;
+rsa.FromXmlString(privatekey);
+//对参数content进行两次base64解密
+cipherbytes = rsa.Decrypt(Convert.FromBase64String(Encoding.UTF8.GetString(Convert.FromBase64String(content))), false);
+return Encoding.UTF8.GetString(cipherbytes);
+}