20220928新增单条考勤推送
This commit is contained in:
parent
3a62ed2219
commit
18ed8e8833
|
@ -88,6 +88,9 @@ namespace BLL
|
||||||
CheckType = "ZHENGCHANG_KAOQINLEIBIE",
|
CheckType = "ZHENGCHANG_KAOQINLEIBIE",
|
||||||
CheckWay = "FACE_FANGSHI",
|
CheckWay = "FACE_FANGSHI",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (SynchroSetService.PushAttendanceS(newR) != "True")
|
||||||
|
{
|
||||||
db.RealName_PersonInOutNow.InsertOnSubmit(newR);
|
db.RealName_PersonInOutNow.InsertOnSubmit(newR);
|
||||||
db.SubmitChanges();
|
db.SubmitChanges();
|
||||||
}
|
}
|
||||||
|
@ -95,6 +98,7 @@ namespace BLL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 根据人员主键删除一个人员出入场记录
|
/// 根据人员主键删除一个人员出入场记录
|
||||||
|
|
|
@ -1133,11 +1133,9 @@ namespace BLL
|
||||||
join z in db.RealName_Project on y.JTProjectCode equals z.ProCode
|
join z in db.RealName_Project on y.JTProjectCode equals z.ProCode
|
||||||
join v in db.ProjectData_TeamGroup on x.TeamGroupId equals v.TeamGroupId
|
join v in db.ProjectData_TeamGroup on x.TeamGroupId equals v.TeamGroupId
|
||||||
join w in db.Base_WorkPost on x.WorkPostId equals w.WorkPostId
|
join w in db.Base_WorkPost on x.WorkPostId equals w.WorkPostId
|
||||||
join p in db.Project_ProjectUnit on new { x.UnitId, x.ProjectId } equals new { p.UnitId, p.ProjectId }
|
|
||||||
where x.IdentityCard == identityCard && y.JTProjectCode == proCode
|
where x.IdentityCard == identityCard && y.JTProjectCode == proCode
|
||||||
&& v.TeamId.HasValue && z.JTproCode != null
|
&& v.TeamId.HasValue && z.JTproCode != null
|
||||||
&& ((type == Const.BtnAdd && x.HeadImage != null && x.HeadImage.Length > 0) || type == Const.BtnModify)
|
&& ((type == Const.BtnAdd && x.HeadImage != null && x.HeadImage.Length > 0) || type == Const.BtnModify)
|
||||||
&& p.IsSynchro == true
|
|
||||||
select new
|
select new
|
||||||
{
|
{
|
||||||
name = x.PersonName,
|
name = x.PersonName,
|
||||||
|
@ -1694,5 +1692,107 @@ namespace BLL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region 推送考勤数据
|
||||||
|
/// <summary>
|
||||||
|
/// 推送考勤数据
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static string PushAttendanceS(Model.RealName_PersonInOutNow inOut)
|
||||||
|
{
|
||||||
|
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||||
|
{
|
||||||
|
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";
|
||||||
|
string url = Funs.RealNameApiUrl + "/foreignApi/accept/attendance";
|
||||||
|
var getData = (from x in db.RealName_PersonInOutNow
|
||||||
|
join p in db.SitePerson_Person on x.PersonId equals p.PersonId
|
||||||
|
join v in db.ProjectData_TeamGroup on p.TeamGroupId equals v.TeamGroupId
|
||||||
|
join z in db.RealName_Project on x.ProCode equals z.ProCode
|
||||||
|
where x.IdcardNumber != null && x.IdcardType != null && x.ChangeTime.HasValue &&
|
||||||
|
x.ProCode == inOut.ProCode && p.HeadImage != null && p.HeadImage.Length > 0
|
||||||
|
&& v.TeamId.HasValue && p.HeadImage != null
|
||||||
|
&& p.IsCardNoOK == true && z.JTproCode != null
|
||||||
|
&& (!p.OutTime.HasValue || p.OutTime > x.ChangeTime)
|
||||||
|
select new
|
||||||
|
{
|
||||||
|
p.PersonId,
|
||||||
|
proCode = z.JTproCode,
|
||||||
|
name = x.Name,
|
||||||
|
idcardType = x.IdcardType,
|
||||||
|
idcardNumber = x.IdcardNumber,
|
||||||
|
checkType = x.CheckType,
|
||||||
|
checkTime = string.Format("{0:yyyy-MM-dd HH:mm:ss}", x.ChangeTime),
|
||||||
|
dierction = x.IsIn == true ? "JINCHANG_JINCHU" : "TUICHANG_JINCHU",
|
||||||
|
checkWay = x.CheckWay,
|
||||||
|
checkLocation = x.CheckLocation,
|
||||||
|
longitude = x.Longitude,
|
||||||
|
latitude = x.Latitude,
|
||||||
|
x.RealNamePushTime,
|
||||||
|
x.PersonInOutId,
|
||||||
|
v.TeamGroupId,
|
||||||
|
}).ToList();
|
||||||
|
if (getData.Count() > 0)
|
||||||
|
{
|
||||||
|
var listObject = new
|
||||||
|
{
|
||||||
|
list = getData.Select(x => new { x.proCode, x.name, x.idcardType, x.idcardNumber, x.checkType, x.checkTime, x.dierction, x.checkWay, x.checkLocation, x.longitude, x.latitude })
|
||||||
|
};
|
||||||
|
Hashtable newToken = new Hashtable
|
||||||
|
{
|
||||||
|
{ "token", getaccess_token(inOut.ProCode) }
|
||||||
|
};
|
||||||
|
|
||||||
|
addTeam(getData.Select(x => x.TeamGroupId).ToList(), newToken);
|
||||||
|
getTeam(inOut.ProCode, newToken);
|
||||||
|
|
||||||
|
var getPersonS = getData.Select(x => x.idcardNumber).ToList();
|
||||||
|
foreach (var pitem in getPersonS)
|
||||||
|
{
|
||||||
|
PushPersonsByIdentityCard(Const.BtnAdd, inOut.ProCode, pitem, false);
|
||||||
|
PushPersonsByIdentityCard(Const.BtnModify, inOut.ProCode, pitem, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
pushContent = JsonConvert.SerializeObject(listObject);
|
||||||
|
var returndata = BLL.APIGetHttpService.OutsideHttp(url, "POST", null, 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()))
|
||||||
|
{
|
||||||
|
foreach (var item in getData)
|
||||||
|
{
|
||||||
|
var getPersonInOutNow = db.RealName_PersonInOutNow.FirstOrDefault(x => x.PersonInOutId == item.PersonInOutId);
|
||||||
|
if (getPersonInOutNow != null)
|
||||||
|
{
|
||||||
|
//getPersonInOutNow.RealNamePushTime = DateTime.Now;
|
||||||
|
db.RealName_PersonInOutNow.DeleteOnSubmit(getPersonInOutNow);
|
||||||
|
db.SubmitChanges();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return sucess;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
ErrLogInfo.WriteLog(ex, "单条推送考勤数据", "SynchroSetService.PushAttendance");
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue