20220601 修改Global调用定时器、修改考勤导入列表及导入方法
This commit is contained in:
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Collections;
|
||||
using FineUIPro;
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
@@ -10,6 +11,72 @@ namespace BLL
|
||||
{
|
||||
public static Model.SGGLDB db = Funs.DB;
|
||||
|
||||
#region 现场考勤列表
|
||||
/// <summary>
|
||||
/// 记录数
|
||||
/// </summary>
|
||||
public static int count
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 定义变量
|
||||
/// </summary>
|
||||
private static IQueryable<Model.SitePerson_Checking> getDataLists = from x in db.SitePerson_Checking
|
||||
select x;
|
||||
|
||||
/// <summary>
|
||||
/// 数据列表
|
||||
/// </summary>
|
||||
/// <param name="unitId"></param>
|
||||
/// <param name="Grid1"></param>
|
||||
/// <returns></returns>
|
||||
public static IEnumerable getListData(string projectId, string unitId, string personName, string startDate, string endDate, Grid Grid1)
|
||||
{
|
||||
IQueryable<Model.SitePerson_Checking> getDataList = getDataLists.Where(x => x.ProjectId == projectId);
|
||||
if (!string.IsNullOrEmpty(unitId) && unitId != Const._Null)
|
||||
{
|
||||
getDataList = getDataList.Where(x => x.UnitId == unitId);
|
||||
}
|
||||
if (!string.IsNullOrEmpty(personName))
|
||||
{
|
||||
getDataList = getDataList.Where(x => x.PersonName.Contains(personName));
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(startDate))
|
||||
{
|
||||
DateTime? startDateD = Funs.GetNewDateTime(startDate);
|
||||
if (startDateD.HasValue)
|
||||
{
|
||||
getDataList = getDataList.Where(x => x.IntoOutTime >= startDateD.Value);
|
||||
}
|
||||
}
|
||||
if (!string.IsNullOrEmpty(endDate))
|
||||
{
|
||||
DateTime? endDateD = Funs.GetNewDateTime(endDate);
|
||||
if (endDateD.HasValue)
|
||||
{
|
||||
getDataList = getDataList.Where(x => x.IntoOutTime < endDateD.Value);
|
||||
}
|
||||
}
|
||||
count = getDataList.Count();
|
||||
if (count == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
getDataList = SortConditionHelper.SortingAndPaging(getDataList, Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize);
|
||||
return from x in getDataList
|
||||
select new
|
||||
{
|
||||
x.CheckingId, x.ProjectId, x.UnitId, x.UnitName, x.PersonId,
|
||||
x.PersonName, x.CardNo, x.IdentityCard, x.WorkAreaId, x.WorkAreaName,
|
||||
x.IntoOut, x.IntoOutTime, x.Address,
|
||||
};
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 根据人员考勤主键获取人员考勤管理信息
|
||||
/// </summary>
|
||||
@@ -30,12 +97,15 @@ namespace BLL
|
||||
Model.SitePerson_Checking newPersonInfo = new Model.SitePerson_Checking
|
||||
{
|
||||
CheckingId = personInfo.CheckingId,
|
||||
PersonId = personInfo.PersonId,
|
||||
CardNo = personInfo.CardNo,
|
||||
ProjectId = personInfo.ProjectId,
|
||||
WorkAreaId = personInfo.WorkAreaId,
|
||||
WorkAreaName = personInfo.WorkAreaName,
|
||||
UnitId = personInfo.UnitId,
|
||||
UnitName = personInfo.UnitName,
|
||||
PersonId = personInfo.PersonId,
|
||||
PersonName = personInfo.PersonName,
|
||||
IdentityCard = personInfo.IdentityCard,
|
||||
CardNo = personInfo.CardNo,
|
||||
WorkAreaId = personInfo.WorkAreaId,
|
||||
WorkAreaName = personInfo.WorkAreaName,
|
||||
IntoOutTime = personInfo.IntoOutTime,
|
||||
IntoOut = personInfo.IntoOut,
|
||||
Address = personInfo.Address,
|
||||
@@ -62,12 +132,14 @@ namespace BLL
|
||||
Model.SitePerson_Checking newPersonInfo = db.SitePerson_Checking.FirstOrDefault(e => e.CheckingId == personInfo.CheckingId);
|
||||
if (newPersonInfo != null)
|
||||
{
|
||||
newPersonInfo.CardNo = personInfo.CardNo;
|
||||
newPersonInfo.UnitId = personInfo.UnitId;
|
||||
newPersonInfo.UnitName = personInfo.UnitName;
|
||||
newPersonInfo.PersonId = personInfo.PersonId;
|
||||
newPersonInfo.ProjectId = personInfo.ProjectId;
|
||||
newPersonInfo.WorkAreaId = personInfo.WorkAreaId;
|
||||
newPersonInfo.WorkAreaName = personInfo.WorkAreaName;
|
||||
newPersonInfo.PersonName = personInfo.PersonName;
|
||||
newPersonInfo.CardNo = personInfo.CardNo;
|
||||
newPersonInfo.IdentityCard = personInfo.IdentityCard;
|
||||
newPersonInfo.WorkAreaId = personInfo.WorkAreaId;
|
||||
newPersonInfo.WorkAreaName = personInfo.WorkAreaName;
|
||||
newPersonInfo.IntoOutTime = personInfo.IntoOutTime;
|
||||
newPersonInfo.IntoOut = personInfo.IntoOut;
|
||||
newPersonInfo.Address = personInfo.Address;
|
||||
|
||||
@@ -22,18 +22,26 @@ namespace BLL
|
||||
/// <returns>是否登录成功</returns>
|
||||
public static bool UserLogOn(string account, string password, bool rememberMe, System.Web.UI.Page page)
|
||||
{
|
||||
List<Sys_User> x = (from y in Funs.DB.Sys_User
|
||||
where y.Account == account && y.IsPost == true && y.Password == Funs.EncryptionPassword(password)
|
||||
select y).ToList();
|
||||
if (x.Any())
|
||||
try
|
||||
{
|
||||
string accValue = HttpUtility.UrlEncode(account);
|
||||
FormsAuthentication.SetAuthCookie(accValue, false);
|
||||
page.Session[SessionName.CurrUser] = x.First();
|
||||
return true;
|
||||
List<Sys_User> x = (from y in Funs.DB.Sys_User
|
||||
where y.Account == account && y.IsPost == true && y.Password == Funs.EncryptionPassword(password)
|
||||
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;
|
||||
}
|
||||
}
|
||||
else
|
||||
catch (Exception ex)
|
||||
{
|
||||
ErrLogInfo.WriteLog("用户登陆错误:" + ex.Message);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,19 +7,23 @@ namespace BLL
|
||||
{
|
||||
public class RealNameMonitorService
|
||||
{
|
||||
#region 启动监视器 系统启动5分钟
|
||||
#region 启动监视器 系统启动5分钟
|
||||
/// <summary>
|
||||
/// 监视组件
|
||||
/// </summary>
|
||||
// private static Timer messageTimer;
|
||||
private static Timer messageTimer;
|
||||
|
||||
/// <summary>
|
||||
/// 启动监视器,不一定能成功,根据系统设置决定对监视器执行的操作 系统启动5分钟
|
||||
/// </summary>
|
||||
public static void StartMonitor(string jtProCode)
|
||||
{
|
||||
int adTimeJ = Funs.GetNewInt(ConfigurationManager.AppSettings["Intervaltime"]) ?? 30;
|
||||
Timer messageTimer = new Timer();
|
||||
public static void StartMonitor()
|
||||
{
|
||||
int adTimeJ = Funs.GetNewInt(ConfigurationManager.AppSettings["Intervaltime"]) ?? 30;
|
||||
//var getSynchroSet = Funs.DB.RealName_SynchroSet.FirstOrDefault();
|
||||
//if (getSynchroSet != null && getSynchroSet.Intervaltime.HasValue)
|
||||
//{
|
||||
// adTimeJ = getSynchroSet.Intervaltime.Value;
|
||||
//}
|
||||
if (messageTimer != null)
|
||||
{
|
||||
messageTimer.Stop();
|
||||
@@ -32,8 +36,7 @@ namespace BLL
|
||||
{
|
||||
AutoReset = true
|
||||
};
|
||||
messageTimer.Elapsed += (sender, args) => AdUserInProcess(sender, jtProCode);
|
||||
//messageTimer.Elapsed += new ElapsedEventHandler(AdUserInProcess);
|
||||
messageTimer.Elapsed += new ElapsedEventHandler(AdUserInProcess);
|
||||
messageTimer.Interval = 1000 * 60 * adTimeJ;// 60分钟 60000 * adTimeJ;
|
||||
messageTimer.Start();
|
||||
}
|
||||
@@ -44,25 +47,34 @@ namespace BLL
|
||||
/// </summary>
|
||||
/// <param name="sender">Timer组件</param>
|
||||
/// <param name="e">事件参数</param>
|
||||
public static void AdUserInProcess(object sender, string jtProCode)
|
||||
private static void AdUserInProcess(object sender, ElapsedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
SynchroSetService.PushCollCompany();
|
||||
if (!string.IsNullOrEmpty(jtProCode))
|
||||
var getRProjects = from x in Funs.DB.RealName_Project
|
||||
select x;
|
||||
if (getRProjects.Count() > 0)
|
||||
{
|
||||
SynchroSetService.PushProCollCompany(jtProCode);
|
||||
SynchroSetService.PushCollTeam(jtProCode);
|
||||
SynchroSetService.getCollTeam(jtProCode);
|
||||
SynchroSetService.PushPersons(Const.BtnAdd, jtProCode, null);
|
||||
SynchroSetService.PushPersons(Const.BtnModify, jtProCode, null);
|
||||
SynchroSetService.PushAttendance(jtProCode);
|
||||
SynchroSetService.updatePersonsExitTime(jtProCode);
|
||||
foreach (var item in getRProjects)
|
||||
{
|
||||
var getSynchroSet = Funs.DB.RealName_SynchroSet.FirstOrDefault(x => x.ProCode == item.JTproCode);
|
||||
if (getSynchroSet != null && !string.IsNullOrEmpty(item.JTproCode))
|
||||
{
|
||||
SynchroSetService.PushProCollCompany(item.JTproCode);
|
||||
//SynchroSetService.PushCollTeam(item.ProCode);
|
||||
//SynchroSetService.getCollTeam(item.ProCode);
|
||||
//SynchroSetService.PushPersons(Const.BtnAdd, item.JTproCode, null);
|
||||
//SynchroSetService.PushPersons(Const.BtnModify, item.JTproCode, null);
|
||||
SynchroSetService.PushAttendance(item.JTproCode);
|
||||
SynchroSetService.updatePersonsExitTime(item.JTproCode);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
StartMonitor(jtProCode);
|
||||
StartMonitor();
|
||||
ErrLogInfo.WriteLog(ex, "数据接口定时器", "RealNameMonitorService.AdUserInProcess");
|
||||
}
|
||||
}
|
||||
@@ -176,7 +188,7 @@ namespace BLL
|
||||
/// </summary>
|
||||
public static void StartMonitorDeletePushLog()
|
||||
{
|
||||
int adTimeJ = 60 * 12;
|
||||
int adTimeJ = 60 * 4;
|
||||
if (messageTimer1 != null)
|
||||
{
|
||||
messageTimer1.Stop();
|
||||
@@ -205,21 +217,21 @@ namespace BLL
|
||||
try
|
||||
{
|
||||
/// 3天推送实名制日志
|
||||
var getPushLogs = Funs.DB.RealName_PushLog.Where(x => x.PushTime.Value.AddDays(3) < DateTime.Now);
|
||||
var getPushLogs = Funs.DB.RealName_PushLog.Where(x => x.PushTime.Value.AddHours(6) < DateTime.Now);
|
||||
if (getPushLogs.Count() > 0)
|
||||
{
|
||||
Funs.DB.RealName_PushLog.DeleteAllOnSubmit(getPushLogs);
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
/// 3个月操作日志
|
||||
var getSys_Logs = Funs.DB.Sys_Log.Where(x => x.OperationTime.Value.AddMonths(3) < DateTime.Now);
|
||||
var getSys_Logs = Funs.DB.Sys_Log.Where(x => x.OperationTime.Value.AddDays(15) < DateTime.Now);
|
||||
if (getSys_Logs.Count() > 0)
|
||||
{
|
||||
Funs.DB.Sys_Log.DeleteAllOnSubmit(getSys_Logs);
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
/// 1个月推送消息日志
|
||||
var getSys_HttpLogs = Funs.DB.Sys_HttpLog.Where(x => x.LogTime.Value.AddMonths(1) < DateTime.Now);
|
||||
var getSys_HttpLogs = Funs.DB.Sys_HttpLog.Where(x => x.LogTime.Value.AddDays(15) < DateTime.Now);
|
||||
if (getSys_HttpLogs.Count() > 0)
|
||||
{
|
||||
Funs.DB.Sys_HttpLog.DeleteAllOnSubmit(getSys_HttpLogs);
|
||||
|
||||
@@ -213,7 +213,7 @@ namespace BLL
|
||||
{
|
||||
access_token = obj["data"].ToString();
|
||||
SynchroSet.Token = access_token;
|
||||
SynchroSet.Tokenendtime = DateTime.Now.AddHours(23);
|
||||
SynchroSet.Tokenendtime = DateTime.Now.AddHours(12);
|
||||
SynchroSet.Timestamp = Funs.GetNewDateTime(timestamp);
|
||||
SaveSynchroSet(SynchroSet);
|
||||
InsertRealNamePushLog(null, SynchroSet.ProCode, "获取凭证", obj["success"].ToString(), obj["code"].ToString(), obj["message"].ToString(),access_token, pushContent);
|
||||
@@ -809,7 +809,8 @@ namespace BLL
|
||||
}
|
||||
}
|
||||
}
|
||||
InsertRealNamePushLog(null, proCode, "推送项目参建企业数据", sucess, code, mess, data, pushContent);
|
||||
|
||||
InsertRealNamePushLog(null, proCode, "推送项目参建企业数据", sucess, code, mess, data, pushContent);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1087,10 +1088,14 @@ namespace BLL
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 推送人员数据
|
||||
/// 推送人员数据
|
||||
/// </summary>
|
||||
/// <param name="type"></param>
|
||||
/// <param name="proCode"></param>
|
||||
/// <param name="identityCard"></param>
|
||||
/// <param name="isLog">是否写日志</param>
|
||||
/// <returns></returns>
|
||||
public static string PushPersonsByIdentityCard(string type, string proCode, string identityCard)
|
||||
public static string PushPersonsByIdentityCard(string type, string proCode, string identityCard,bool isLog)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -1220,17 +1225,23 @@ namespace BLL
|
||||
}
|
||||
else if (data.Contains("人员不存在"))
|
||||
{
|
||||
SynchroSetService.PushPersonsByIdentityCard(Const.BtnAdd, proCode, identityCard);
|
||||
SynchroSetService.PushPersonsByIdentityCard(Const.BtnAdd, proCode, identityCard, isLog);
|
||||
}
|
||||
else
|
||||
{
|
||||
InsertRealNamePushLog(null, proCode, "推送人员数据", sucess, code, mess, data, pushContent);
|
||||
if (isLog)
|
||||
{
|
||||
InsertRealNamePushLog(null, proCode, "推送人员数据", sucess, code, mess, data, pushContent);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
InsertRealNamePushLog(null, proCode, "推送人员数据", sucess, code, mess, data, pushContent);
|
||||
if (isLog)
|
||||
{
|
||||
InsertRealNamePushLog(null, proCode, "推送人员数据", sucess, code, mess, data, pushContent);
|
||||
}
|
||||
}
|
||||
|
||||
if (data.Contains("已存在") || mess.Contains("已存在"))
|
||||
@@ -1435,8 +1446,8 @@ namespace BLL
|
||||
var getPersonS = getData.Select(x => x.idcardNumber).Distinct().ToList();
|
||||
foreach (var pitem in getPersonS)
|
||||
{
|
||||
PushPersonsByIdentityCard(Const.BtnAdd, proCode, pitem);
|
||||
PushPersonsByIdentityCard(Const.BtnModify, proCode, pitem);
|
||||
PushPersonsByIdentityCard(Const.BtnAdd, proCode, pitem, false);
|
||||
PushPersonsByIdentityCard(Const.BtnModify, proCode, pitem, false);
|
||||
}
|
||||
|
||||
pushContent = JsonConvert.SerializeObject(listObject);
|
||||
|
||||
Reference in New Issue
Block a user