20220220 实名制退场、更新上报优化
This commit is contained in:
@@ -1103,7 +1103,7 @@ namespace BLL
|
||||
join p in Funs.DB.Project_ProjectUnit on new { x.UnitId,x.ProjectId } equals new { p.UnitId,p.ProjectId }
|
||||
where x.IdentityCard == identityCard && y.JTProjectCode == proCode
|
||||
&& v.TeamId.HasValue && z.JTproCode != null
|
||||
&& ((type ==Const.BtnAdd && x.HeadImage != null && x.HeadImage.Length > 0) || (type == Const.BtnModify && x.RealNameAddTime.HasValue))
|
||||
&& ((type ==Const.BtnAdd && x.HeadImage != null && x.HeadImage.Length > 0) || type == Const.BtnModify)
|
||||
&& p.UnitType != Const.ProjectUnitType_3 && p.UnitType != Const.ProjectUnitType_4
|
||||
select new
|
||||
{
|
||||
@@ -1170,7 +1170,7 @@ namespace BLL
|
||||
code = obj["code"].ToString();
|
||||
sucess = obj["success"].ToString();
|
||||
data = obj["data"].ToString();
|
||||
if (obj["success"] != null && Convert.ToBoolean(obj["success"].ToString()))
|
||||
if (obj["success"] != null && Convert.ToBoolean(obj["success"].ToString()) && code == "200")
|
||||
{
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
@@ -1189,8 +1189,45 @@ namespace BLL
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (data.Contains("历史项目进退场时间重合") || data.Contains("已推送"))
|
||||
{
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
foreach (var item in getData)
|
||||
{
|
||||
var getPerson = db.SitePerson_Person.FirstOrDefault(x => x.PersonId == item.PersonId);
|
||||
if (getPerson != null)
|
||||
{
|
||||
if (!getPerson.RealNameAddTime.HasValue)
|
||||
{
|
||||
getPerson.RealNameAddTime = DateTime.Now;
|
||||
}
|
||||
if (type == Const.BtnModify)
|
||||
{
|
||||
getPerson.RealNameUpdateTime = DateTime.Now;
|
||||
}
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (data.Contains("人员不存在"))
|
||||
{
|
||||
SynchroSetService.PushPersonsByIdentityCard(Const.BtnAdd, proCode, identityCard);
|
||||
}
|
||||
else
|
||||
{
|
||||
InsertRealNamePushLog(null, proCode, "推送人员数据", sucess, code, mess, data, pushContent);
|
||||
}
|
||||
}
|
||||
}
|
||||
InsertRealNamePushLog(null, proCode, "推送人员数据", sucess, code, mess, data, pushContent);
|
||||
else
|
||||
{
|
||||
InsertRealNamePushLog(null, proCode, "推送人员数据", sucess, code, mess, data, pushContent);
|
||||
}
|
||||
|
||||
if (data.Contains("已存在") || mess.Contains("已存在"))
|
||||
{
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
@@ -1226,6 +1263,106 @@ namespace BLL
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 推送人员数据
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static string updatePersonsExitTime(string proCode)
|
||||
{
|
||||
try
|
||||
{
|
||||
string mess = string.Empty;
|
||||
string sucess = string.Empty;
|
||||
string code = string.Empty;
|
||||
string data = string.Empty;
|
||||
string pushContent = string.Empty;
|
||||
string contenttype = "application/json;charset=unicode";
|
||||
int okcount = 0;
|
||||
var getData = (from x in Funs.DB.SitePerson_Person
|
||||
join y in Funs.DB.Base_Project on x.ProjectId equals y.ProjectId
|
||||
join z in Funs.DB.RealName_Project on y.JTProjectCode equals z.ProCode
|
||||
where y.JTProjectCode == proCode && x.OutTime.HasValue
|
||||
&& !x.RealNameUpdateTime.HasValue
|
||||
&& x.RealNameAddTime.HasValue
|
||||
select new
|
||||
{
|
||||
idcardNumber = x.IdentityCard,
|
||||
proCode=z.JTproCode,
|
||||
entryTime = x.InTime.HasValue ? string.Format("{0:yyyy-MM-dd}", x.InTime) : null,
|
||||
exitTime = x.OutTime.HasValue ? string.Format("{0:yyyy-MM-dd}", x.OutTime) : null,
|
||||
x.RealNameAddTime,
|
||||
x.RealNameUpdateTime,
|
||||
name = x.PersonName,
|
||||
x.PersonId,
|
||||
});
|
||||
if (getData.Count() > 0)
|
||||
{
|
||||
foreach (var itemData in getData)
|
||||
{
|
||||
string returndata = string.Empty;
|
||||
Hashtable newToken = new Hashtable
|
||||
{
|
||||
{ "token", getaccess_token(proCode) }
|
||||
};
|
||||
var getItemList = getData.Where(x => x.idcardNumber == itemData.idcardNumber).ToList();
|
||||
var addlistObject = new
|
||||
{
|
||||
list = getItemList.Select(x => new { x.idcardNumber, x.proCode, x.entryTime, x.exitTime, x.name })
|
||||
};
|
||||
pushContent = JsonConvert.SerializeObject(addlistObject);
|
||||
returndata = BLL.APIGetHttpService.OutsideHttp(Funs.RealNameApiUrl + "/foreignApi/accept/updatePersonsExitTime", "POST", contenttype, newToken, pushContent);
|
||||
|
||||
if (!string.IsNullOrEmpty(returndata))
|
||||
{
|
||||
JObject obj = JObject.Parse(returndata);
|
||||
mess = obj["message"].ToString();
|
||||
code = obj["code"].ToString();
|
||||
sucess = obj["success"].ToString();
|
||||
data = obj["data"].ToString();
|
||||
if (obj["success"] != null && Convert.ToBoolean(obj["success"].ToString()))
|
||||
{
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
var getPerson = db.SitePerson_Person.FirstOrDefault(x => x.PersonId == itemData.PersonId);
|
||||
if (getPerson != null)
|
||||
{
|
||||
if (!getPerson.RealNameAddTime.HasValue)
|
||||
{
|
||||
getPerson.RealNameAddTime = DateTime.Now;
|
||||
}
|
||||
getPerson.RealNameUpdateTime = DateTime.Now;
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
okcount++;
|
||||
}
|
||||
else
|
||||
{
|
||||
mess += itemData.name + "退场失败";
|
||||
}
|
||||
}
|
||||
|
||||
if (okcount > 0)
|
||||
{
|
||||
mess += "退场成功人数"+okcount.ToString();
|
||||
}
|
||||
InsertRealNamePushLog(null, proCode, "推送更新离岗人员", sucess, code, mess, data, pushContent);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
mess = "没有符合条件的数据!";
|
||||
}
|
||||
|
||||
return mess;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ErrLogInfo.WriteLog(ex, "推送未更新离岗人员", "SynchroSetService.updatePersonsExitTime");
|
||||
return "推送人员异常";
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 推送考勤数据
|
||||
|
||||
Reference in New Issue
Block a user