Browse Source

初始代码提交(去掉读取缓存和写日志功能)

master
王瑞 9 months ago
parent
commit
f829c08e33
  1. 401
      Code/ClassLib/ZHYQ/BLL/SysOperationLogHelp.cs
  2. 1
      Code/智慧营区/DOCManageAPP(阿克苏)/DocManageAPP.csproj
  3. 28
      Code/智慧营区/DOCManageAPP(阿克苏)/Web.config
  4. 102
      Code/智慧营区/DOCManageAPP(阿克苏)/WebCommon/RedisHelp.cs
  5. 11
      Code/智慧营区/DOCManageAPP(阿克苏)/ashx/AppHandler.ashx.cs
  6. 146
      Code/智慧营区/DOCManageAPP(阿克苏)/ashx/LoginHandler.ashx.cs
  7. 3
      Code/智慧营区/DOCManageAPP(阿克苏)/ashx/SysEmpHandler.ashx.cs
  8. 368
      Code/智慧营区/DOCManageAPP(阿克苏)/ashx/SysUpdPartyEmpPhotoHandler.ashx.cs
  9. 3
      Code/智慧营区/DOCManageAPP(阿克苏)/ashx/SysUserHandler.ashx.cs
  10. BIN
      Code/智慧营区/WebApiTools/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
  11. BIN
      Code/智慧营区/WebApiTools/obj/Debug/WebApiTools.csproj.AssemblyReference.cache
  12. BIN
      Code/智慧营区/营区OpenAPI/CampOpenWebAPI/obj/Debug/CampOpenWebAPI.csproj.AssemblyReference.cache
  13. BIN
      Code/智慧营区/营区OpenAPI/CampOpenWebAPI/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
  14. BIN
      Code/智慧营区/营区OpenAPI/WebAPILib/LibCommonUtil/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
  15. BIN
      Code/智慧营区/营区OpenAPI/WebAPILib/LibCommonUtil/obj/Debug/LibCommonUtil.csproj.AssemblyReference.cache
  16. BIN
      Code/智慧营区/营区OpenAPI/WebAPILib/烽火项目对接/LibFengHuoAPI/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
  17. BIN
      Code/智慧营区/营区OpenAPI/WebAPILib/烽火项目对接/LibFengHuoAPI/obj/Debug/LibFengHuoAPI.csproj.AssemblyReference.cache
  18. BIN
      Code/智慧营区/营区OpenAPI/WebAPILib/西藏总队餐厅/LibDiningXZZD/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
  19. BIN
      Code/智慧营区/营区OpenAPI/WebAPILib/西藏总队餐厅/LibDiningXZZD/obj/Debug/LibDiningXZZD.csproj.AssemblyReference.cache

401
Code/ClassLib/ZHYQ/BLL/SysOperationLogHelp.cs

@ -17,24 +17,8 @@ namespace FangYar.BLL
/// </summary> /// </summary>
public class SysOperationLogHelp public class SysOperationLogHelp
{ {
/// <summary>
/// 管理员账号数据库连接字符串
/// </summary>
private static string connStr = System.Configuration.ConfigurationManager.ConnectionStrings["MySqlConnStrLog"].ConnectionString;
/// <summary>
/// 设置是否记录操作日志到Kafka
/// </summary>
public static string IsKafkaLog = System.Configuration.ConfigurationManager.AppSettings["IsKafkaLog"] + "";
/// <summary>
/// 系统日志记录
/// </summary>
private static SysOperationLogBLL syslogBll = new SysOperationLogBLL();
/// <summary>
/// 设置是否记录操作日志:0、记录;其他、不记录
/// </summary>
public static string IsOperationLogDebug = System.Configuration.ConfigurationManager.AppSettings["IsOperationLogDebug"] + "";
/// <summary> /// <summary>
@ -48,391 +32,6 @@ namespace FangYar.BLL
public static void AddSysOperationLog(HttpContext context, EnumOperationLogType logType, string Info_Name, string Info_Msg, string ClientType = "0") public static void AddSysOperationLog(HttpContext context, EnumOperationLogType logType, string Info_Name, string Info_Msg, string ClientType = "0")
{ {
// 将线程丢进线程池,参数是线程要做的事情
ThreadPool.QueueUserWorkItem(t =>
{
//new Thread(() =>
//{
try
{
using (var ms = new System.IO.MemoryStream())
{
//判断如果信息内容为空则不记录
if (string.IsNullOrWhiteSpace(Info_Msg))
{
return;
}
//判断是否需要记录日志
if (!IsOperationLogDebug.Equals("0"))
{
return;
}
Tbl_Sys_Operation_Log_Model addMo = GetLogMoByHttpContext(context);
//Tbl_Sys_Operation_Log_Model addMo = GetLogMoByHttpContext(HttpContext.Current);
addMo.Info_Type = ((int)logType) + "";
addMo.Info_Msg = Info_Msg;
addMo.Info_Name = Info_Name;
if (string.IsNullOrWhiteSpace(addMo.Url_Str))
{
string a = "";
}
addMo.Headers_Str1 = ClientType;
syslogBll.Add(addMo, connStr);
//添加到ClickHouse数据库
//ClickHouseHelper.AddSysOperationLog(addMo);
if (!IsKafkaLog.Equals("0"))
{
return;
}
//添加到Kafka后添加到Click数据库
KafkaHelper.SendKafKaMsg(addMo);
}
}
catch (Exception ex)
{
string str = "系统日志记录异常:" + ex;
FangYar.Common.MyLogHelper.WriteMsg(new FangYar.Common.LogInfoMo()
{
message = str,
msgType = FangYar.Common.EnumLogMsgTypeEnum.Error,
path = "SysOperationLog"
});
}
//}).Start();
});
} }
private static Tbl_Sys_Operation_Log_Model GetLogMoByHttpContext(HttpContext context)
{
Tbl_Sys_Operation_Log_Model retMo = new Tbl_Sys_Operation_Log_Model();
try
{
var Request = context.Request;
var cookUserMo = GetCookUserByHttpContext(context);
retMo = new Tbl_Sys_Operation_Log_Model();
retMo.ID = "";
retMo.Info_Msg = "";
retMo.Info_Name = "";
retMo.createtime = "";
retMo.Info_Type = null;
try
{
retMo.Url_Form = GetFormStr(context);
}
catch (Exception ex)
{
string str = "系统日志记录HttpContext获取Form参数信息异常:" + ex;
FangYar.Common.MyLogHelper.WriteMsg(new FangYar.Common.LogInfoMo() { message = str, msgType = FangYar.Common.EnumLogMsgTypeEnum.Error, path = "SysOperationLog" });
}
try
{
retMo.User_Uid = cookUserMo.usersUid;
}
catch (Exception ex)
{
string str = "系统日志记录HttpContext获取登录用户账号异常:" + ex;
FangYar.Common.MyLogHelper.WriteMsg(new FangYar.Common.LogInfoMo() { message = str, msgType = FangYar.Common.EnumLogMsgTypeEnum.Error, path = "SysOperationLog" });
}
try
{
retMo.Browser = Request.Browser.Browser;
retMo.Browser_Type = Request.Browser.Type;
retMo.System_Type = Request.Browser.Platform;
retMo.Browser_VerSion = Request.Browser.Version;
}
catch (Exception ex)
{
string str = "系统日志记录HttpContext获取客户端浏览器异常:" + ex;
FangYar.Common.MyLogHelper.WriteMsg(new FangYar.Common.LogInfoMo() { message = str, msgType = FangYar.Common.EnumLogMsgTypeEnum.Error, path = "SysOperationLog" });
}
//获取用户IC
retMo.Client_IP = GetClientIp(context);
//获取用户端UUID
retMo.UUID_Str = GetUUID(context);
try
{
retMo.Client_Name = Request.UserHostName;
}
catch (Exception ex)
{
string str = "系统日志记录HttpContext获取用户IP信息异常:" + ex;
FangYar.Common.MyLogHelper.WriteMsg(new FangYar.Common.LogInfoMo() { message = str, msgType = FangYar.Common.EnumLogMsgTypeEnum.Error, path = "SysOperationLog" });
}
try
{
retMo.Url_Str = Request.Url.AbsoluteUri;
}
catch (Exception ex)
{
string str = "系统日志记录HttpContext获取请求路径信息异常:" + ex;
FangYar.Common.MyLogHelper.WriteMsg(new FangYar.Common.LogInfoMo()
{
message = str,
msgType = FangYar.Common.EnumLogMsgTypeEnum.Error,
path = "SysOperationLog"
});
}
try
{
string Headers_Str = Request.ServerVariables["All_Http"];
if (Headers_Str.IndexOf(".SessionCookie=") > 0)
{
string Headers_StrHead = Headers_Str.Substring(0, Headers_Str.IndexOf(".SessionCookie="));
string Headers_StrEnd = Headers_Str.Substring(Headers_Str.IndexOf("HTTP_HOST:"));
Headers_Str = Headers_StrHead + Headers_StrEnd;
retMo.Headers_Str = Headers_Str;
}
else
{
retMo.Headers_Str = Headers_Str;
}
}
catch (Exception ex)
{
string str = "系统日志记录HttpContext获取Header信息异常:" + ex;
FangYar.Common.MyLogHelper.WriteMsg(new FangYar.Common.LogInfoMo()
{
message = str,
msgType = FangYar.Common.EnumLogMsgTypeEnum.Error,
path = "SysOperationLog"
});
}
//string Headers_Str1 = Request.ServerVariables["All_Raw"];
//string Headers_Str1Head = Headers_Str1.Substring(0, Headers_Str1.IndexOf(".SessionCookie"));
//string Headers_Str1End = Headers_Str1.Substring(Headers_Str1.IndexOf("Host:"));
//Headers_Str1 = Headers_Str1Head + Headers_Str1End;
//retMo.Headers_Str1 = Headers_Str1;
retMo.Action_Str = context.Request.Params["Action"] + "";
retMo.Url_Parameter = Request.Url.Query;
retMo.Browser_System_Str = Request.ServerVariables["HTTP_USER_AGENT"];
retMo.Org_ID = cookUserMo.orgId;
retMo.Org_Name = cookUserMo.orgName;
retMo.roles = cookUserMo.roles;
retMo.UserMobile = cookUserMo.userMobile;
retMo.User_Name = cookUserMo.usersName;
retMo.Post_Parameter = GetPostParam(Request);
}
catch (Exception ex)
{
string str = "系统日志记录HttpContext转换异常:" + ex;
FangYar.Common.MyLogHelper.WriteMsg(new FangYar.Common.LogInfoMo()
{
message = str,
msgType = FangYar.Common.EnumLogMsgTypeEnum.Error,
path = "SysOperationLog"
});
}
return retMo;
}
private static string GetPostParam(HttpRequest Request)
{
string postParam = ""; //post的所有参数
try
{
using (System.IO.StreamReader sr = new System.IO.StreamReader(Request.InputStream))
{
postParam = sr.ReadLine();
}
}
catch (Exception ex)
{
string str = "系统日志记录获取Post参数异常:" + ex;
FangYar.Common.MyLogHelper.WriteMsg(new FangYar.Common.LogInfoMo()
{
message = str,
msgType = FangYar.Common.EnumLogMsgTypeEnum.Error,
path = "SysOperationLog"
});
}
return postParam;
}
/// <summary>
/// 返回客户端IP
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
private static string GetClientIp(HttpContext context)
{
string retStr = "";
try
{
string ipStr = context.Request.ServerVariables["All_Http"];
if (ipStr.IndexOf("HTTP_X_ORIGINAL_FORWARDED_FOR:") < 0)
{
if (ipStr.IndexOf("HTTP_X_FORWARDED_FOR:") < 0)
{
if (ipStr.IndexOf("HTTP_X_CLIENT_IP:") < 0)
{
return "未获取";
}
else
{
ipStr = ipStr.Substring(ipStr.IndexOf("HTTP_X_CLIENT_IP:") + 17);
retStr = ipStr.Substring(0, ipStr.IndexOf("HTTP_"));
}
}
else
{
ipStr = ipStr.Substring(ipStr.IndexOf("HTTP_X_FORWARDED_FOR:") + 21);
retStr = ipStr.Substring(0, ipStr.IndexOf("HTTP_"));
}
}
else
{
ipStr = ipStr.Substring(ipStr.IndexOf("HTTP_X_ORIGINAL_FORWARDED_FOR:") + 30);
retStr = ipStr.Substring(0, ipStr.IndexOf("HTTP_"));
}
}
catch (Exception ex)
{
string str = "系统日志记录HttpContext获取用户IP信息异常:" + ex;
FangYar.Common.MyLogHelper.WriteMsg(new FangYar.Common.LogInfoMo() { message = str, msgType = FangYar.Common.EnumLogMsgTypeEnum.Error, path = "SysOperationLog" });
}
return retStr;
}
/// <summary>
/// 返回客户端UUID
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
private static string GetUUID(HttpContext context)
{
string retStr = "";
try
{
string ipStr = context.Request.ServerVariables["All_Http"];
if (ipStr.IndexOf("HTTP_X5_UUID:") < 0)
{
return "未获取";
}
retStr = ipStr.Substring(ipStr.IndexOf("HTTP_X5_UUID:") + 13);
}
catch (Exception ex)
{
string str = "系统日志记录HttpContext获取客户端UUID异常:" + ex;
FangYar.Common.MyLogHelper.WriteMsg(new FangYar.Common.LogInfoMo() { message = str, msgType = FangYar.Common.EnumLogMsgTypeEnum.Error, path = "SysOperationLog" });
}
return retStr;
}
/// <summary>
/// 获取Cook缓存信息
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
private static CookUserMo GetCookUserByHttpContext(HttpContext context)
{
CookUserMo retMo = new CookUserMo();
try
{
//if (context.Request.Cookies["kn_root_cookie"] == null)
//{
// return new CookUserMo() { cityId = "", deptId = "", deptName = "", orgId = "", orgName = "", roles = "", userMobile = "", usersName = "", usersUid = "" };
//}
//string CookStr = context.Request.Cookies["kn_root_cookie"].Value + "";
string CookStr = context.Request.ServerVariables["All_Http"];
if (CookStr.IndexOf("kn_root_cookie=") < 0)
{
return new CookUserMo() { cityId = "", deptId = "", deptName = "", orgId = "", orgName = "", roles = "", userMobile = "", usersName = "", usersUid = "" };
}
CookStr = CookStr.Substring(CookStr.IndexOf("kn_root_cookie=") + 15);
CookStr = CookStr.Substring(0, CookStr.IndexOf("}") + 1);
//CookStr = CookStr.Replace("kn_root_cookie=", "");
retMo = JsonHelper.FromJSON<CookUserMo>(CookStr);
}
catch (Exception ex)
{
retMo = new CookUserMo() { cityId = "", deptId = "", deptName = "", orgId = "", orgName = "", roles = "", userMobile = "", usersName = "", usersUid = "" };
string str = "系统日志记录获取Cook信息异常:" + ex;
FangYar.Common.MyLogHelper.WriteMsg(new FangYar.Common.LogInfoMo()
{
message = str,
msgType = FangYar.Common.EnumLogMsgTypeEnum.Error,
path = "SysOperationLog"
});
}
return retMo;
}
private static string GetFormStr(HttpContext context)
{
string retStr = "";
try
{
foreach (var item in context.Request.Params)
{
try
{
if (item.Equals(".SessionCookie"))
{
continue;
}
if (item.Equals("ALL_HTTP"))
{
continue;
}
if (item.Equals("ALL_RAW"))
{
continue;
}
if (item.Equals("HTTP_COOKIE"))
{
continue;
}
if (item.Equals("ASP.NET_SessionId"))
{
continue;
}
string a = "";
if (!string.IsNullOrWhiteSpace(retStr))
{
retStr += "&";
}
// retStr += item + "=" + GetParams(context.Request.Params[item + ""] + "");
retStr += item + "=" + context.Request.Params[item + ""];
}
catch (Exception ex) { }
}
}
catch (Exception ex)
{
string str = "系统日志记录后去Form参数异常:" + ex;
FangYar.Common.MyLogHelper.WriteMsg(new FangYar.Common.LogInfoMo()
{
message = str,
msgType = FangYar.Common.EnumLogMsgTypeEnum.Error,
path = "SysOperationLog"
});
}
return retStr;
}
} }
} }

1
Code/智慧营区/DOCManageAPP(阿克苏)/DocManageAPP.csproj

@ -6356,7 +6356,6 @@
</Compile> </Compile>
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Startup.cs" /> <Compile Include="Startup.cs" />
<Compile Include="WebCommon\RedisHelp.cs" />
<Compile Include="WebCommon\WebThreadUtil.cs" /> <Compile Include="WebCommon\WebThreadUtil.cs" />
<Compile Include="WebModel\DutyDiyTemplateMo.cs" /> <Compile Include="WebModel\DutyDiyTemplateMo.cs" />
<Compile Include="WorkFlow\Common\BasePage.cs"> <Compile Include="WorkFlow\Common\BasePage.cs">

28
Code/智慧营区/DOCManageAPP(阿克苏)/Web.config

@ -8,27 +8,7 @@
<!--MySql数据库连接--> <!--MySql数据库连接-->
<!-- 局域网高版本数据库 --> <!-- 局域网高版本数据库 -->
<add name="MySqlConnString" connectionString="server=192.168.31.18;port=3306;user=root;password=123456; database=smartcamp;pooling=false;min pool size=5;max pool size=200;connect timeout = 3000; SslMode=None;Allow User Variables=True;Charset=utf8;" /> <add name="MySqlConnString" connectionString="server=192.168.31.18;port=3306;user=root;password=123456; database=smartcamp_ceping;pooling=false;min pool size=5;max pool size=200;connect timeout = 3000; SslMode=None;Allow User Variables=True;Charset=utf8;" />
<!-- 政务网 -->
<!--<add name="MySqlConnString" connectionString="server=221.13.83.52;port=18204;user=smartcamp;password=C@mp_Smart#2022;database=smartcamp;pooling=false;min pool size=5;max pool size=1000;connect timeout = 3000; SslMode=None;Allow User Variables=True;Charset=utf8;" />-->
<!--<add name="MySqlConnString" connectionString="server=221.13.83.52;port=18204;user=smartcamp;password=C@mp_Smart#2022; database=smartcamp;SslMode=None;Allow User Variables=True;Charset=utf8;" />-->
<!--<add name="MySqlConnString" connectionString="server=192.168.31.12;port=3306;user=root;password=P@ssw0rd; database=smartcamp;SslMode=None;Allow User Variables=True;Charset=utf8;"/>-->
<!--<add name="MySqlConnString" connectionString="server=172.24.100.246;port=3306;user=smartcamp;password=C@mp_Smart#2022; database=smartcamp;SslMode=None;Allow User Variables=True;Charset=utf8;" />-->
<!--<add name="MySqlConnString" connectionString="server=47.92.168.204;port=3547;user=root;password=KeNing_P@ssw0rd!; database=smartcamp20230106zx;SslMode=None;Allow User Variables=True;Charset=utf8;" />-->
<!--<add name="MySqlConnString" connectionString="server=47.92.168.204;port=3547;user=root;password=KeNing_P@ssw0rd!; database=smartcamp;SslMode=None;Allow User Variables=True;Charset=utf8;" />-->
<!--<add name="MySqlConnString" connectionString="server=192.168.31.198;port=3306;user=root;password=123456; database=smartcamp2;SslMode=None;Allow User Variables=True;Charset=utf8;" />-->
<!--<add name="MySqlConnString" connectionString="server=172.28.70.132;port=6033;user=smartcamp;password=C@mp_Smart#2022; database=smartcamp;SslMode=None;Allow User Variables=True;Charset=utf8;" />-->
<!--<add name="MySqlConnString" connectionString="server=192.168.31.12;port=3306;user=root;password=P@ssw0rd; database=smartcamp;SslMode=None;Allow User Variables=True;Charset=utf8;" />-->
<!--<add name="MySqlConnString" connectionString="server=8.142.16.8;port=4002;user=root;password=P@ssw0rd; database=smartcamp;SslMode=None;Allow User Variables=True;Charset=utf8;" />-->
<!--<add name="MySqlConnString" connectionString="server=8.142.16.8;port=6033;user=smartcamp;password=C@mp_Smart#2022; database=smartcamp;SslMode=None;Allow User Variables=True;Charset=utf8;" />-->
<!--<add name="MySqlConnString" connectionString="server=192.168.31.44;port=3306;user=root;password=root; database=smartcamp;SslMode=None;Allow User Variables=True;Charset=utf8;" />-->
<!--<add name="MySqlConnString" connectionString="server=192.168.31.196;port=3306;user=root;password=123456; database=smartcamp2;SslMode=None;Allow User Variables=True;Charset=utf8;Old Guids=true;Pooling=false;allowPublicKeyRetrieval=true;" />-->
<!--<add name="MySqlConnString" connectionString="server=localhost;port=3306;user=root;password=root; database=smartcamp20220819;SslMode=None;Allow User Variables=True;Charset=utf8;Old Guids=true;Pooling=false;allowPublicKeyRetrieval=true;" />-->
<!--MySql具有管理员权限的数据库连接字符串,党建同步数据用-->
<!--<add name="MySqlConnStrAdmin" connectionString="server=172.28.70.132;port=6033;user=admin;password=KeNing_P@ssw0rd!; database=smartcamp;SslMode=None;Allow User Variables=True;Charset=utf8;" />-->
<add name="MySqlConnStrAdmin" connectionString="server=47.92.168.204;port=3547;user=root;password=KeNing_P@ssw0rd!; database=smartcamp;SslMode=None;Allow User Variables=True;Charset=utf8;" />
<!--MySql日志表保存库连接-->
<add name="MySqlConnStrLog" connectionString="server=221.13.83.52;port=18203;user=root;password=KeNing_P@ssw0rd!; database=smartcamp_log;SslMode=None;Allow User Variables=True;Charset=utf8;" />
</connectionStrings> </connectionStrings>
<appSettings> <appSettings>
<!--value即是程序集名称,也是命名空间名称--> <!--value即是程序集名称,也是命名空间名称-->
@ -115,12 +95,6 @@
<add key="EmailKey" value="NQSHBYEUMRAPFDGI" /> <add key="EmailKey" value="NQSHBYEUMRAPFDGI" />
<!-- 邮件发送SMTP --> <!-- 邮件发送SMTP -->
<add key="EmailHost" value="smtp.163.com" /> <add key="EmailHost" value="smtp.163.com" />
<!-- redisIP地址 -->
<add key="redisIp" value="192.168.31.16" />
<!-- redis端口 -->
<add key="redisPort" value="6379" />
<!-- redis密码 -->
<add key="redisPwd" value="" />
<!-- 人员出入记录不查询人员 --> <!-- 人员出入记录不查询人员 -->
<add key="empInOutLogNot" value="'120797b0-b9b0-11ec-93b0-00163e122c79','40f709de-b9b0-11ec-93b0-00163e122c79','4b90287fd4184f20b30717613d7ffd35','8185ec69-b9b0-11ec-a7b5-00163e12a600','941d86a29aa24612a32e60efc6771874','a531078846e747d5aa0c63589a96e6cb','a81f9e26-b9af-11ec-a7b5-00163e12a600','b2642f5c-b9b0-11ec-9318-00163e0ff88e','df4b343a-b9af-11ec-93b0-00163e122c79'" /> <add key="empInOutLogNot" value="'120797b0-b9b0-11ec-93b0-00163e122c79','40f709de-b9b0-11ec-93b0-00163e122c79','4b90287fd4184f20b30717613d7ffd35','8185ec69-b9b0-11ec-a7b5-00163e12a600','941d86a29aa24612a32e60efc6771874','a531078846e747d5aa0c63589a96e6cb','a81f9e26-b9af-11ec-a7b5-00163e12a600','b2642f5c-b9b0-11ec-9318-00163e0ff88e','df4b343a-b9af-11ec-93b0-00163e122c79'" />

102
Code/智慧营区/DOCManageAPP(阿克苏)/WebCommon/RedisHelp.cs

@ -1,102 +0,0 @@
using ServiceStack.Redis;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace FangYar.WebUI.WebCommon
{
public class RedisHelp
{
//邮件发送账号
string redisIp = System.Configuration.ConfigurationManager.AppSettings["redisIp"] + "";
//邮件发送授权码
string redisPort = System.Configuration.ConfigurationManager.AppSettings["redisPort"] + "";
//邮件发送SMTP
string redisPwd = System.Configuration.ConfigurationManager.AppSettings["redisPwd"] + "";
public void SetRedis(string key, string Val)
{
try
{
int.TryParse(redisPort, out int redisPortNum);
redisPwd = string.IsNullOrWhiteSpace(redisPwd) ? null : redisPwd;
using (RedisClient client = new RedisClient(redisIp, redisPortNum, redisPwd))
{
if (client == null)
{
return;
}
if (client.ContainsKey(key))
{
client.Replace<string>(key, Val);
}
else
{
client.Set<string>(key, Val);
}
}
}
catch (Exception ex)
{
string str = "写入Redis异常:" + ex;
FangYar.Common.MyLogHelper.WriteMsg(new FangYar.Common.LogInfoMo()
{
message = str,
msgType = FangYar.Common.EnumLogMsgTypeEnum.Error,
path = "RedisLog"
});
}
}
public string GetRedis(string key)
{
try
{
int.TryParse(redisPort, out int redisPortNum);
redisPwd = string.IsNullOrWhiteSpace(redisPwd) ? null : redisPwd;
using (RedisClient client = new RedisClient(redisIp, redisPortNum, redisPwd))
{
return client.Get<string>(key);
}
}
catch (Exception ex)
{
string str = "读取Redis异常:" + ex;
FangYar.Common.MyLogHelper.WriteMsg(new FangYar.Common.LogInfoMo()
{
message = str,
msgType = FangYar.Common.EnumLogMsgTypeEnum.Error,
path = "RedisLog"
});
}
return "";
}
public string RemoveLoginAllReids(string usersId)
{
try
{
SetRedis("XJAPPlogin_" + usersId, "");
SetRedis("XCXlogin_" + usersId, "");
SetRedis("AppLoginByAppId_" + usersId, "");
SetRedis("XCXLoginByOpenId_" + usersId, "");
SetRedis("pwdCache_" + usersId, "");
}
catch (Exception ex)
{
string str = "读取Redis异常:" + ex;
FangYar.Common.MyLogHelper.WriteMsg(new FangYar.Common.LogInfoMo()
{
message = str,
msgType = FangYar.Common.EnumLogMsgTypeEnum.Error,
path = "RedisLog"
});
}
return "";
}
}
}

11
Code/智慧营区/DOCManageAPP(阿克苏)/ashx/AppHandler.ashx.cs

@ -8068,13 +8068,6 @@ namespace FangYar.WebUI.ashx
string userUid = context.Request.Params["userUid"]; string userUid = context.Request.Params["userUid"];
string orgId = context.Request.Params["orgId"]; string orgId = context.Request.Params["orgId"];
//读取缓存信息
string retStr = new WebCommon.RedisHelp().GetRedis("AppGetCornerMarkSta_" + userUid);
if (!string.IsNullOrEmpty(retStr))
{
return retStr;
}
string sqlStr = " with t1 as ( SELECT count(1) as dbCount FROM WorkFlowTask t WHERE ReceiveID = '" + userUid + "' AND STATUS IN(0, 1)),"; string sqlStr = " with t1 as ( SELECT count(1) as dbCount FROM WorkFlowTask t WHERE ReceiveID = '" + userUid + "' AND STATUS IN(0, 1)),";
@ -8093,7 +8086,6 @@ namespace FangYar.WebUI.ashx
returnstr += FangYar.Common.JsonHelper.ToJson(dt); returnstr += FangYar.Common.JsonHelper.ToJson(dt);
returnstr += "}"; returnstr += "}";
new WebCommon.RedisHelp().SetRedis("AppGetCornerMarkSta_" + userUid, returnstr);
} }
catch (Exception e) catch (Exception e)
{ {
@ -8137,8 +8129,7 @@ SELECT u,SUM(dbCount) dbCount,SUM(fkCount) fkCount,SUM(jhxcCount) jhxcCount,SUM(
string returnstr = "{\"code\":0,\"msg\":\"\",\"count\":1,\"data\":[{" + string returnstr = "{\"code\":0,\"msg\":\"\",\"count\":1,\"data\":[{" +
"\"DBCOUNT\":" + dt.Rows[i]["dbCount"] + ",\"FKCOUNT\":" + dt.Rows[i]["fkCount"] + ",\"JHXCCOUNT\":" + dt.Rows[i]["jhxcCount"] + "\"DBCOUNT\":" + dt.Rows[i]["dbCount"] + ",\"FKCOUNT\":" + dt.Rows[i]["fkCount"] + ",\"JHXCCOUNT\":" + dt.Rows[i]["jhxcCount"] +
",\"YHZGCOUNT\":" + dt.Rows[i]["yhzgCount"] + ",\"CPCSCOUNT\":" + dt.Rows[i]["cpcsCount"] + ",\"XJCOUNT\":" + dt.Rows[i]["xjCount"] + "}]}"; ",\"YHZGCOUNT\":" + dt.Rows[i]["yhzgCount"] + ",\"CPCSCOUNT\":" + dt.Rows[i]["cpcsCount"] + ",\"XJCOUNT\":" + dt.Rows[i]["xjCount"] + "}]}";
new WebCommon.RedisHelp().SetRedis("AppGetCornerMarkSta_" + userUid, returnstr);
} }
catch (Exception ex) catch (Exception ex)
{ {

146
Code/智慧营区/DOCManageAPP(阿克苏)/ashx/LoginHandler.ashx.cs

@ -307,41 +307,10 @@ namespace FangYar.WebUI.ashx
string usersPwd = UserPwd; string usersPwd = UserPwd;
string revlue = ""; string revlue = "";
//读取缓存信息
string retStr = new WebCommon.RedisHelp().GetRedis("XJAPPlogin_" + UserID);
//密码原始字符串 //密码原始字符串
string pwdStr = context.Request.Params["strPwd"]; string pwdStr = context.Request.Params["strPwd"];
if (!string.IsNullOrWhiteSpace(retStr))
{
//密码缓存字符串
string pwdCacheStr = new WebCommon.RedisHelp().GetRedis("pwdCache_" + UserID);
if (string.IsNullOrWhiteSpace(pwdStr))
{
new WebCommon.RedisHelp().RemoveLoginAllReids(UserID);
return "{\"code\":0,\"msg\":\"用户名或密码错误\"}";
}
if (string.IsNullOrWhiteSpace(pwdCacheStr))
{
new WebCommon.RedisHelp().SetRedis("pwdCache_" + UserID, pwdStr);
return retStr;
}
if (pwdStr.Equals(pwdCacheStr))
{
return retStr;
}
else
{
return "{\"code\":0,\"msg\":\"用户名或密码错误\"}";
}
}
//if (!string.IsNullOrEmpty(retStr))
//{
// return retStr;
//}
Model.LoginUserModel buser = new Model.LoginUserModel(); Model.LoginUserModel buser = new Model.LoginUserModel();
BLL.TBL.SysUsersBLL bll = new BLL.TBL.SysUsersBLL(); BLL.TBL.SysUsersBLL bll = new BLL.TBL.SysUsersBLL();
@ -403,8 +372,6 @@ namespace FangYar.WebUI.ashx
revlue += ",\"MENUARRAY\":" + userMenuList; revlue += ",\"MENUARRAY\":" + userMenuList;
bool isupcid = new BLL.TBL.SysEmpBLL().updateCid(UserID, AppId); bool isupcid = new BLL.TBL.SysEmpBLL().updateCid(UserID, AppId);
revlue += ",\"isUpdateCid\":\"" + isupcid + "\"}"; revlue += ",\"isUpdateCid\":\"" + isupcid + "\"}";
new WebCommon.RedisHelp().SetRedis("XJAPPlogin_" + UserID, revlue);
new WebCommon.RedisHelp().SetRedis("pwdCache_" + UserID, pwdStr);
} }
else else
{ {
@ -635,41 +602,8 @@ namespace FangYar.WebUI.ashx
string usersPwd = UserPwd; string usersPwd = UserPwd;
string revlue = ""; string revlue = "";
//读取缓存信息
string retStr = new WebCommon.RedisHelp().GetRedis("XCXlogin_" + UserID);
//密码原始字符串 //密码原始字符串
string pwdStr = context.Request.Params["strPwd"]; string pwdStr = context.Request.Params["strPwd"];
if (!string.IsNullOrWhiteSpace(retStr))
{
//密码缓存字符串
string pwdCacheStr = new WebCommon.RedisHelp().GetRedis("pwdCache_" + UserID);
if (string.IsNullOrWhiteSpace(pwdStr))
{
new WebCommon.RedisHelp().RemoveLoginAllReids(UserID);
return "{\"code\":0,\"msg\":\"用户名或密码错误\"}";
}
if (string.IsNullOrWhiteSpace(pwdCacheStr))
{
new WebCommon.RedisHelp().SetRedis("pwdCache_" + UserID, pwdStr);
return retStr;
}
if (pwdStr.Equals(pwdCacheStr))
{
return retStr;
}
else
{
return "{\"code\":0,\"msg\":\"用户名或密码错误\"}";
}
}
//if (!string.IsNullOrEmpty(retStr))
//{
// return retStr;
//}
Model.LoginUserModel buser = new Model.LoginUserModel(); Model.LoginUserModel buser = new Model.LoginUserModel();
BLL.TBL.SysUsersBLL bll = new BLL.TBL.SysUsersBLL(); BLL.TBL.SysUsersBLL bll = new BLL.TBL.SysUsersBLL();
@ -696,8 +630,6 @@ namespace FangYar.WebUI.ashx
string userMenuList = GetUserMenu(buser, "1"); string userMenuList = GetUserMenu(buser, "1");
revlue += ",\"MENUARRAY\":" + userMenuList + "}"; revlue += ",\"MENUARRAY\":" + userMenuList + "}";
new WebCommon.RedisHelp().SetRedis("XCXlogin_" + UserID, revlue);
new WebCommon.RedisHelp().SetRedis("pwdCache_" + UserID, pwdStr);
} }
else else
{ {
@ -734,41 +666,6 @@ namespace FangYar.WebUI.ashx
string usersPwd = UserPwd; string usersPwd = UserPwd;
string revlue = ""; string revlue = "";
//读取缓存信息
string retStr = new WebCommon.RedisHelp().GetRedis("AppLoginByAppId_" + UserID);
//密码原始字符串
string pwdStr = context.Request.Params["strPwd"];
if (!string.IsNullOrWhiteSpace(retStr))
{
//密码缓存字符串
string pwdCacheStr = new WebCommon.RedisHelp().GetRedis("pwdCache_" + UserID);
if (string.IsNullOrWhiteSpace(pwdStr))
{
new WebCommon.RedisHelp().RemoveLoginAllReids(UserID);
return "{\"code\":0,\"msg\":\"用户名或密码错误\"}";
}
if (string.IsNullOrWhiteSpace(pwdCacheStr))
{
new WebCommon.RedisHelp().SetRedis("pwdCache_" + UserID, pwdStr);
return retStr;
}
if (pwdStr.Equals(pwdCacheStr))
{
return retStr;
}
else
{
return "{\"code\":0,\"msg\":\"用户名或密码错误\"}";
}
}
//if (!string.IsNullOrEmpty(retStr))
//{
// return retStr;
//}
Model.LoginUserModel buser = new Model.LoginUserModel(); Model.LoginUserModel buser = new Model.LoginUserModel();
@ -823,8 +720,6 @@ namespace FangYar.WebUI.ashx
string userMenuList = GetUserMenu(buser, "0"); string userMenuList = GetUserMenu(buser, "0");
revlue += ",\"MENUARRAY\":" + userMenuList + "\"}"; revlue += ",\"MENUARRAY\":" + userMenuList + "\"}";
new WebCommon.RedisHelp().SetRedis("AppLoginByAppId_" + UserID, revlue);
new WebCommon.RedisHelp().SetRedis("pwdCache_" + UserID, pwdStr);
} }
else else
{ {
@ -866,43 +761,6 @@ namespace FangYar.WebUI.ashx
} }
catch (Exception ex) { } catch (Exception ex) { }
//读取缓存信息
string retStr = new WebCommon.RedisHelp().GetRedis("XCXLoginByOpenId_" + UserID);
//密码原始字符串
string pwdStr = context.Request.Params["strPwd"];
if (!string.IsNullOrWhiteSpace(retStr))
{
//密码缓存字符串
string pwdCacheStr = new WebCommon.RedisHelp().GetRedis("pwdCache_" + UserID);
if (string.IsNullOrWhiteSpace(pwdStr))
{
new WebCommon.RedisHelp().RemoveLoginAllReids(UserID);
return "{\"code\":0,\"msg\":\"用户名或密码错误\"}";
}
if (string.IsNullOrWhiteSpace(pwdCacheStr))
{
new WebCommon.RedisHelp().SetRedis("pwdCache_" + UserID, pwdStr);
return retStr;
}
if (pwdStr.Equals(pwdCacheStr))
{
return retStr;
}
else
{
return "{\"code\":0,\"msg\":\"用户名或密码错误\"}";
}
}
//if (!string.IsNullOrEmpty(retStr))
//{
// return retStr;
//}
Model.LoginUserModel buser = new Model.LoginUserModel(); Model.LoginUserModel buser = new Model.LoginUserModel();
BLL.TBL.SysUsersBLL bll = new BLL.TBL.SysUsersBLL(); BLL.TBL.SysUsersBLL bll = new BLL.TBL.SysUsersBLL();
try try
@ -937,8 +795,6 @@ namespace FangYar.WebUI.ashx
string userMenuList = GetUserMenu(buser, "1"); string userMenuList = GetUserMenu(buser, "1");
revlue += ",\"MENUARRAY\":" + userMenuList + "}"; revlue += ",\"MENUARRAY\":" + userMenuList + "}";
new WebCommon.RedisHelp().SetRedis("XCXLoginByOpenId_" + UserID, revlue);
new WebCommon.RedisHelp().SetRedis("pwdCache_" + UserID, pwdStr);
} }
else else
{ {
@ -1222,7 +1078,6 @@ namespace FangYar.WebUI.ashx
string UserID = context.Request.Params["strUser"]; string UserID = context.Request.Params["strUser"];
string AppId = context.Request.Params["AppId"].Trim(); string AppId = context.Request.Params["AppId"].Trim();
bool isupcid = new BLL.TBL.SysEmpBLL().updateCid(UserID, AppId); bool isupcid = new BLL.TBL.SysEmpBLL().updateCid(UserID, AppId);
new WebCommon.RedisHelp().RemoveLoginAllReids(UserID);
return "\"isUpdateCid\":\"" + isupcid + "\""; return "\"isUpdateCid\":\"" + isupcid + "\"";
} }
@ -1244,7 +1099,6 @@ namespace FangYar.WebUI.ashx
string UserID = context.Request.Params["strUser"]; string UserID = context.Request.Params["strUser"];
string OpenId = context.Request.Params["OpenId"].Trim(); string OpenId = context.Request.Params["OpenId"].Trim();
bool isupcid = new BLL.TBL.SysEmpBLL().updateOpenId(UserID, OpenId); bool isupcid = new BLL.TBL.SysEmpBLL().updateOpenId(UserID, OpenId);
new WebCommon.RedisHelp().RemoveLoginAllReids(UserID);
return "\"isUpdateCid\":\"" + isupcid + "\""; return "\"isUpdateCid\":\"" + isupcid + "\"";
} }
catch (Exception e) catch (Exception e)

3
Code/智慧营区/DOCManageAPP(阿克苏)/ashx/SysEmpHandler.ashx.cs

@ -871,8 +871,7 @@ namespace FangYar.WebUI.ashx
FangYar.BLL.TBL.SysUsersBLL ubll = new BLL.TBL.SysUsersBLL(); FangYar.BLL.TBL.SysUsersBLL ubll = new BLL.TBL.SysUsersBLL();
ubll.UpdateOrgId(model.USERS_UID, model.ORG_ID); ubll.UpdateOrgId(model.USERS_UID, model.ORG_ID);
msg = "修改成功!"; msg = "修改成功!";
code = 1; code = 1;
new WebCommon.RedisHelp().RemoveLoginAllReids(model.USERS_UID);
} }
else { msg = "修改失败!"; } else { msg = "修改失败!"; }
} }

368
Code/智慧营区/DOCManageAPP(阿克苏)/ashx/SysUpdPartyEmpPhotoHandler.ashx.cs

@ -12,10 +12,6 @@ namespace FangYar.WebUI.ashx
/// </summary> /// </summary>
public class SysUpdPartyEmpPhotoHandler : IHttpHandler public class SysUpdPartyEmpPhotoHandler : IHttpHandler
{ {
/// <summary>
/// 管理员账号数据库连接字符串
/// </summary>
private static string connStr = System.Configuration.ConfigurationManager.ConnectionStrings["MySqlConnStrAdmin"].ConnectionString;
public void ProcessRequest(HttpContext context) public void ProcessRequest(HttpContext context)
{ {
@ -23,372 +19,8 @@ namespace FangYar.WebUI.ashx
string action = context.Request.Params["Action"]; string action = context.Request.Params["Action"];
string returnstr = ""; string returnstr = "";
switch (action)
{
//更新党建库人员照片信息
case "UpdPartyEmpPhoto":
returnstr = UpdPartyEmpPhoto(context);
break;
//查询党建考试统计
case "GetPartyExam":
returnstr = GetPartyExam(context);
break;
//查询党建考试成绩查询
case "GetPartyExamResult":
returnstr = GetPartyExamResult(context);
break;
}
context.Response.Write(returnstr); context.Response.Write(returnstr);
} }
/// <summary>
/// 查询党建考试
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
private string GetPartyExam(HttpContext context)
{
string returnstr = "{\"code\":0,\"msg\":\"error\",\"count\":0,\"data\":[]}";
try
{
// 分页
string page = context.Request.Params["page"];
// 分页大小
string limit = context.Request.Params["limit"];
// 组织机构ID
string orgId = context.Request.Params["orgId"];
// 考试ID
string paperinfoId = context.Request.Params["paperinfoId"];
// 成绩是否为空
string isExam = context.Request.Params["isExam"];
//人员名称查询
string name = context.Request.Params["name"];
string whereStr = " ";
if (!string.IsNullOrWhiteSpace(name))
{
whereStr += " and EMP_NAME like '%" + name + "%' ";
}
int pageIndex = 1;
int pageSize = 10;
if (!string.IsNullOrEmpty(page)) { pageIndex = int.Parse(page); }
if (!string.IsNullOrEmpty(limit)) { pageSize = int.Parse(limit); }
pageIndex = pageIndex - 1;
pageIndex = pageIndex < 0 ? 0 : pageIndex;
pageSize = pageSize < 1 ? 1 : pageSize;
int startNum = pageIndex * pageSize;
// 查询信息总数
string sqlCount = " WITH t1 AS ( SELECT EMP_NAME, ORG_ID, USERS_UID, EMP_MOBILE FROM tbl_sys_emp,( SELECT get_Org_child_list ( '" + orgId + @"' ) cids ) s
WHERE find_in_set( org_id, cids ) and IS_ADMIN='0' and IS_DEL='0' " + whereStr + @" )
SELECT count(1) n FROM t1 LEFT JOIN fire_org o ON t1.ORG_ID = o.ORG_ID
LEFT JOIN ( select MAX(r.USERS_SCORE + 0) as USERS_SCORE, MAX(r.PAPERINFO_ID) as PAPERINFO_ID, MAX(r.QUESTION_ANSWER) as QUESTION_ANSWER,
r.USERS_UID as USERS_UID, MAX(r.id) as id from campparty.tbl_material_result r where r.PAPERINFO_ID = '" + paperinfoId +
"' GROUP BY r.USERS_UID ) t on t1.USERS_UID = t.USERS_UID ";
//if (!string.IsNullOrWhiteSpace(paperinfoId))
//{
// sqlCount += " and t.PAPERINFO_ID = '" + paperinfoId + "' ";
//}
if (!string.IsNullOrWhiteSpace(isExam))
{
switch (isExam)
{
case "0":
sqlCount += " WHERE LENGTH( IFNULL(t.id,''))<1 ";
break;
case "1":
sqlCount += " WHERE LENGTH( IFNULL(t.id,''))>0 ";
break;
}
}
sqlCount += " ORDER BY t.USERS_SCORE desc,t1.ORG_ID, t1.USERS_UID ";
var dtNum = QueryTable(sqlCount);
string sql = " WITH t1 AS ( SELECT ID,EMP_NAME, ORG_ID, USERS_UID, EMP_MOBILE FROM tbl_sys_emp,( SELECT get_Org_child_list ( '" + orgId + @"' ) cids ) s
WHERE find_in_set( org_id, cids ) and IS_ADMIN='0' and IS_DEL='0' " + whereStr + @" )
SELECT t1.*, o.ORG_NAME, t.PAPERINFO_ID, t.QUESTION_ANSWER, t.USERS_SCORE, case when t.id is null then 0 else 1 end as is_exam
FROM t1 LEFT JOIN fire_org o ON t1.ORG_ID = o.ORG_ID
LEFT JOIN ( select MAX(r.USERS_SCORE + 0) as USERS_SCORE, MAX(r.PAPERINFO_ID) as PAPERINFO_ID, MAX(r.QUESTION_ANSWER) as QUESTION_ANSWER,
r.USERS_UID as USERS_UID, MAX(r.id) as id from campparty.tbl_material_result r where r.PAPERINFO_ID = '" + paperinfoId +
"' GROUP BY r.USERS_UID ) t on t1.USERS_UID = t.USERS_UID ";
//if (!string.IsNullOrWhiteSpace(paperinfoId))
//{
// sql += " and t.PAPERINFO_ID = '" + paperinfoId + "' ";
//}
if (!string.IsNullOrWhiteSpace(isExam))
{
switch (isExam)
{
case "0":
sql += " WHERE LENGTH( IFNULL(t.id,''))<1 ";
break;
case "1":
sql += " WHERE LENGTH( IFNULL(t.id,''))>0 ";
break;
}
}
sql += " ORDER BY t.USERS_SCORE desc,t1.ORG_ID, t1.id limit " + startNum + " ," + pageSize + " ";
var dt = QueryTable(sql);
returnstr = "{\"code\":0,\"msg\":\"success\",\"count\":" + dtNum.Rows[0][0] + ",\"data\":" + FangYar.Common.JsonHelper.ToJson(dt) + "}";
}
catch (Exception ex)
{
returnstr = "{\"code\":1,\"msg\":\"error\",\"count\":0,\"data\":[]}";
string str = "查询党建考试异常:" + ex;
FangYar.Common.MyLogHelper.WriteMsg(new FangYar.Common.LogInfoMo()
{
message = str,
msgType = FangYar.Common.EnumLogMsgTypeEnum.Error,
path = "UpdPartyEmpPhoto"
});
}
return returnstr;
}
/// <summary>
/// 查询党建考试成绩
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
private string GetPartyExamResult(HttpContext context)
{
string returnstr = "{\"code\":0,\"msg\":\"error\",\"count\":0,\"data\":[]}";
try
{
// 分页
string page = context.Request.Params["page"];
// 分页大小
string limit = context.Request.Params["limit"];
// 组织机构ID
string orgId = context.Request.Params["orgId"];
// 考试ID
string paperinfoId = context.Request.Params["paperinfoId"];
// 成绩是否为空
string isExam = context.Request.Params["isExam"];
//人员名称查询
string name = context.Request.Params["name"];
string whereStr = " ";
if (!string.IsNullOrWhiteSpace(name))
{
whereStr += " and EMP_NAME like '%" + name + "%' ";
}
int pageIndex = 1;
int pageSize = 10;
if (!string.IsNullOrEmpty(page)) { pageIndex = int.Parse(page); }
if (!string.IsNullOrEmpty(limit)) { pageSize = int.Parse(limit); }
pageIndex = pageIndex - 1;
pageIndex = pageIndex < 0 ? 0 : pageIndex;
pageSize = pageSize < 1 ? 1 : pageSize;
int startNum = pageIndex * pageSize;
// 查询信息总数
string sqlCount = " WITH t1 AS ( SELECT EMP_NAME, ORG_ID, USERS_UID, EMP_MOBILE FROM tbl_sys_emp,( SELECT get_Org_child_list ( '" + orgId + @"' ) cids ) s
WHERE find_in_set( org_id, cids ) and IS_ADMIN='0' and IS_DEL='0' " + whereStr + @" )
SELECT count(1) n FROM t1 LEFT JOIN fire_org o ON t1.ORG_ID = o.ORG_ID
LEFT JOIN (select MAX(i.score+0) as score,MAX(i.id) as id,i.JOB_NUMBER from campparty.tbl_score_info i where i.paper_id = '" + paperinfoId
+ "' group by i.job_number ) t on t1.USERS_UID = t.job_number ";
//if (!string.IsNullOrWhiteSpace(paperinfoId))
//{
// sqlCount += " AND t.paper_id = '" + paperinfoId + "' ";
//}
if (!string.IsNullOrWhiteSpace(isExam))
{
switch (isExam)
{
case "0":
sqlCount += " WHERE LENGTH( IFNULL(t.id,''))<1 ";
break;
case "1":
sqlCount += " WHERE LENGTH( IFNULL(t.id,''))>0 ";
break;
}
}
var dtNum = QueryTable(sqlCount);
string sql = " WITH t1 AS ( SELECT ID,EMP_NAME, ORG_ID, USERS_UID, EMP_MOBILE FROM tbl_sys_emp,( SELECT get_Org_child_list ( '" + orgId + @"' ) cids ) s
WHERE find_in_set( org_id, cids ) and IS_ADMIN='0' and IS_DEL='0' " + whereStr + @" )
SELECT t1.*, o.ORG_NAME, t.score,CASE WHEN t.id IS NULL THEN 0 ELSE 1 END AS is_exam
FROM t1 LEFT JOIN fire_org o ON t1.ORG_ID = o.ORG_ID
LEFT JOIN (select MAX(i.score+0) as score,MAX(i.id) as id,i.JOB_NUMBER from campparty.tbl_score_info i where i.paper_id = '" + paperinfoId
+ "' group by i.job_number ) t on t1.USERS_UID = t.job_number ";
//if (!string.IsNullOrWhiteSpace(paperinfoId))
//{
// sql += " AND t.paper_id = '" + paperinfoId + "' ";
//}
if (!string.IsNullOrWhiteSpace(isExam))
{
switch (isExam)
{
case "0":
sql += " WHERE LENGTH( IFNULL(t.id,''))<1 ";
break;
case "1":
sql += " WHERE LENGTH( IFNULL(t.id,''))>0 ";
break;
}
}
sql += " ORDER BY t.score+0 desc,t1.ORG_ID, t1.id limit " + startNum + " ," + pageSize + " ";
var dt = QueryTable(sql);
returnstr = "{\"code\":0,\"msg\":\"success\",\"count\":" + dtNum.Rows[0][0] + ",\"data\":" + FangYar.Common.JsonHelper.ToJson(dt) + "}";
}
catch (Exception ex)
{
returnstr = "{\"code\":1,\"msg\":\"error\",\"count\":0,\"data\":[]}";
string str = "查询党建考试异常:" + ex;
FangYar.Common.MyLogHelper.WriteMsg(new FangYar.Common.LogInfoMo()
{
message = str,
msgType = FangYar.Common.EnumLogMsgTypeEnum.Error,
path = "UpdPartyEmpPhoto"
});
}
return returnstr;
}
/// <summary>
/// 更新党建库人员照片信息
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
private string UpdPartyEmpPhoto(HttpContext context)
{
string returnstr = "{}";
try
{
string sqlStr = " SELECT e.USERS_UID,e.EMP_NAME,e.PHOTO, d.emp_id,d.emp_photo from tbl_sys_emp e " +
" left JOIN campparty.tbl_party_member d on e.USERS_UID=d.emp_id WHERE e.PHOTO<> d.emp_photo and e.PHOTO is not NULL and EMP_ID is not NULL " +
" or ( e.PHOTO is not NULL and d.emp_photo is NULL and EMP_ID is not NULL ) ";
var dt = QueryTable(sqlStr);
for (int i = 0; i < dt.Rows.Count; i++)
{
string emp_id = dt.Rows[i]["USERS_UID"] + "";
string emp_photo = dt.Rows[i]["PHOTO"] + "";
string sqlUpd = " UPDATE campparty.tbl_party_member SET emp_photo='" + emp_photo + "' WHERE emp_id='" + emp_id + "' ";
Execute(sqlUpd);
}
}
catch (Exception ex)
{
string str = "同步党建人员照片异常:" + ex;
FangYar.Common.MyLogHelper.WriteMsg(new FangYar.Common.LogInfoMo()
{
message = str,
msgType = FangYar.Common.EnumLogMsgTypeEnum.Error,
path = "UpdPartyEmpPhoto"
});
}
return returnstr;
}
/// <summary>
/// 执行查询语句,返回DataTable
/// </summary>
/// <param name="SQLString">查询语句</param>
/// <returns>DataTable</returns>
private static DataTable QueryTable(string SQLString)
{
using (MySqlConnection connection = new MySqlConnection(connStr))
{
var dt = new DataTable();
try
{
connection.Open();
MySqlDataAdapter command = new MySqlDataAdapter(SQLString, connection);
command.Fill(dt);
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
finally
{
if (connection.State == ConnectionState.Open)
{
connection.Close();
MySqlConnection.ClearPool(connection);//加入此行可释放连接
connection.Dispose();
}
GC.Collect();
}
return dt;
}
}
/// <summary>
/// 执行SQL语句,返回影响的记录数
/// </summary>
/// <param name="SQLString">SQL语句</param>
/// <returns>影响的记录数</returns>
private int Execute(string SQLString)
{
using (MySqlConnection connection = new MySqlConnection(connStr))
{
try
{
using (MySqlCommand cmd = new MySqlCommand())
{
connection.Open();
cmd.Connection = connection;
cmd.CommandText = SQLString;
int rows = cmd.ExecuteNonQuery();
cmd.Parameters.Clear();
//cmd.Prepare();
return rows;
}
}
catch (Exception E)
{
//throw new Exception(E.Message);
return 0;
}
finally
{
if (connection.State == ConnectionState.Open)
{
connection.Close();
MySqlConnection.ClearPool(connection);//加入此行可释放连接
connection.Dispose();
}
GC.Collect();
}
}
}
public bool IsReusable public bool IsReusable
{ {

3
Code/智慧营区/DOCManageAPP(阿克苏)/ashx/SysUserHandler.ashx.cs

@ -549,7 +549,6 @@ namespace FangYar.WebUI.ashx
model.ID = usID; model.ID = usID;
bool flag1 = bll.Edit(model); bool flag1 = bll.Edit(model);
new WebCommon.RedisHelp().RemoveLoginAllReids(model.USERS_UID);
//修改人员角色表里的数据 //修改人员角色表里的数据
FangYar.BLL.TBL.SysUSerRulesBLL bll_ur = new BLL.TBL.SysUSerRulesBLL(); FangYar.BLL.TBL.SysUSerRulesBLL bll_ur = new BLL.TBL.SysUSerRulesBLL();
@ -926,7 +925,6 @@ namespace FangYar.WebUI.ashx
if (bll.ChangePwd(model)) if (bll.ChangePwd(model))
{ {
new WebCommon.RedisHelp().RemoveLoginAllReids(model.USERS_UID);
msg = "修改成功!"; msg = "修改成功!";
code = 1; code = 1;
} }
@ -966,7 +964,6 @@ namespace FangYar.WebUI.ashx
if (bll.ChangePwd(model)) if (bll.ChangePwd(model))
{ {
new WebCommon.RedisHelp().RemoveLoginAllReids(model.USERS_UID);
msg = "修改成功!"; msg = "修改成功!";
code = 1; code = 1;
} }

BIN
Code/智慧营区/WebApiTools/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache

Binary file not shown.

BIN
Code/智慧营区/WebApiTools/obj/Debug/WebApiTools.csproj.AssemblyReference.cache

Binary file not shown.

BIN
Code/智慧营区/营区OpenAPI/CampOpenWebAPI/obj/Debug/CampOpenWebAPI.csproj.AssemblyReference.cache

Binary file not shown.

BIN
Code/智慧营区/营区OpenAPI/CampOpenWebAPI/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache

Binary file not shown.

BIN
Code/智慧营区/营区OpenAPI/WebAPILib/LibCommonUtil/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache

Binary file not shown.

BIN
Code/智慧营区/营区OpenAPI/WebAPILib/LibCommonUtil/obj/Debug/LibCommonUtil.csproj.AssemblyReference.cache

Binary file not shown.

BIN
Code/智慧营区/营区OpenAPI/WebAPILib/烽火项目对接/LibFengHuoAPI/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache

Binary file not shown.

BIN
Code/智慧营区/营区OpenAPI/WebAPILib/烽火项目对接/LibFengHuoAPI/obj/Debug/LibFengHuoAPI.csproj.AssemblyReference.cache

Binary file not shown.

BIN
Code/智慧营区/营区OpenAPI/WebAPILib/西藏总队餐厅/LibDiningXZZD/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache

Binary file not shown.

BIN
Code/智慧营区/营区OpenAPI/WebAPILib/西藏总队餐厅/LibDiningXZZD/obj/Debug/LibDiningXZZD.csproj.AssemblyReference.cache

Binary file not shown.
Loading…
Cancel
Save