Merge branch 'master' of https://gitee.com/frane-yang/SGGL_SeDin_New
This commit is contained in:
@@ -46,7 +46,7 @@ namespace BLL
|
||||
/// <param name="personType">人员类型</param>
|
||||
/// <param name="Grid1"></param>
|
||||
/// <returns></returns>
|
||||
public static IEnumerable getListData(string unitId, string departId, string projetcId, string name, string idCard, string isPost, string personType, Grid Grid1)
|
||||
public static IEnumerable getListData(string unitId, string departId, string projetcId, string name, string idCard, string isPost, string personType,string account, Grid Grid1)
|
||||
{
|
||||
IQueryable<Model.Person_Persons> getDataList = getDataLists.OrderBy(x => x.UnitId).ThenBy(x => x.DepartId);
|
||||
if (!string.IsNullOrEmpty(unitId) && unitId != Const._Null)
|
||||
@@ -73,6 +73,10 @@ namespace BLL
|
||||
{
|
||||
getDataList = getDataList.Where(e => e.PersonName.Contains(name));
|
||||
}
|
||||
if (!string.IsNullOrEmpty(account))
|
||||
{
|
||||
getDataList = getDataList.Where(e => e.Account.Contains(account));
|
||||
}
|
||||
if (!string.IsNullOrEmpty(idCard))
|
||||
{
|
||||
getDataList = getDataList.Where(e => e.IdentityCard.Contains(idCard));
|
||||
|
||||
@@ -256,10 +256,13 @@ namespace BLL
|
||||
Success = Success,
|
||||
Code = Code,
|
||||
Message = Message,
|
||||
PushTime = DateTime.Now,
|
||||
ReturnData = ReturnData,
|
||||
PushContent = PushContent,
|
||||
PushTime = DateTime.Now,
|
||||
};
|
||||
if (Code != "200")
|
||||
{
|
||||
newLog.ReturnData = ReturnData;
|
||||
newLog.PushContent = PushContent;
|
||||
}
|
||||
db.RealName_PushLog.InsertOnSubmit(newLog);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
@@ -890,6 +893,7 @@ namespace BLL
|
||||
var getCollTeam = (from x in Funs.DB.ProjectData_TeamGroup
|
||||
join y in Funs.DB.Base_Project on x.ProjectId equals y.ProjectId
|
||||
join z in Funs.DB.RealName_Project on y.ContractNo equals z.ProCode
|
||||
join p in Funs.DB.Project_ProjectUnit on new { x.UnitId, x.ProjectId } equals new { p.UnitId, p.ProjectId }
|
||||
join u in Funs.DB.Base_Unit on x.UnitId equals u.UnitId
|
||||
join s in Funs.DB.SitePerson_Person on x.GroupLeaderId equals s.PersonId into jonPerson
|
||||
from s in jonPerson.DefaultIfEmpty()
|
||||
@@ -897,6 +901,7 @@ namespace BLL
|
||||
&& (proCode == null || y.ContractNo == proCode)
|
||||
&& u.CollCropCode != null && u.CollCropCode != ""
|
||||
&& z.JTproCode != null
|
||||
&& p.UnitType != Const.ProjectUnitType_3 && p.UnitType != Const.ProjectUnitType_4
|
||||
select new
|
||||
{
|
||||
proCode = z.JTproCode,
|
||||
@@ -1027,6 +1032,7 @@ namespace BLL
|
||||
x.RealNameAddTime,
|
||||
x.RealNameUpdateTime,
|
||||
x.PersonId,
|
||||
x.SitePersonId,
|
||||
}).Take(200).ToList();
|
||||
if (getData.Count() > 0)
|
||||
{
|
||||
@@ -1067,7 +1073,7 @@ namespace BLL
|
||||
{
|
||||
foreach (var item in getData)
|
||||
{
|
||||
var getPerson = db.SitePerson_Person.FirstOrDefault(x => x.PersonId == item.PersonId);
|
||||
var getPerson = db.SitePerson_Person.FirstOrDefault(x => x.SitePersonId == item.SitePersonId);
|
||||
if (getPerson != null)
|
||||
{
|
||||
if (!getPerson.RealNameAddTime.HasValue)
|
||||
@@ -1160,6 +1166,7 @@ namespace BLL
|
||||
x.RealNameAddTime,
|
||||
x.RealNameUpdateTime,
|
||||
x.PersonId,
|
||||
x.SitePersonId,
|
||||
}).ToList();
|
||||
if (getData.Count() > 0)
|
||||
{
|
||||
@@ -1200,7 +1207,7 @@ namespace BLL
|
||||
{
|
||||
foreach (var item in getData)
|
||||
{
|
||||
var getPerson = db.SitePerson_Person.FirstOrDefault(x => x.PersonId == item.PersonId);
|
||||
var getPerson = db.SitePerson_Person.FirstOrDefault(x => x.SitePersonId == item.SitePersonId);
|
||||
if (getPerson != null)
|
||||
{
|
||||
if (!getPerson.RealNameAddTime.HasValue)
|
||||
@@ -1226,7 +1233,7 @@ namespace BLL
|
||||
}
|
||||
|
||||
InsertRealNamePushLog(null, proCode, "推送人员数据", sucess, code, mess, data, pushContent);
|
||||
if (data.Contains("已存在") || mess.Contains("已存在"))
|
||||
if (data.Contains("已存在") || mess.Contains("已存在") || mess.Contains("重合") || data.Contains("重合"))
|
||||
{
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
@@ -1234,7 +1241,133 @@ namespace BLL
|
||||
{
|
||||
if (data.Contains(item.idcardNumber) || mess.Contains(item.idcardNumber))
|
||||
{
|
||||
var getPerson = db.SitePerson_Person.FirstOrDefault(x => x.PersonId == item.PersonId);
|
||||
var getPerson = db.SitePerson_Person.FirstOrDefault(x => x.SitePersonId == item.SitePersonId);
|
||||
if (getPerson != null)
|
||||
{
|
||||
if (!getPerson.RealNameAddTime.HasValue)
|
||||
{
|
||||
getPerson.RealNameAddTime = DateTime.Now;
|
||||
}
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
mess = "没有符合条件的数据!";
|
||||
}
|
||||
|
||||
return mess;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ErrLogInfo.WriteLog(ex, "推送人员数据", "SynchroSetService.PushPersons");
|
||||
return "推送人员异常";
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 推送人员数据
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static string PushPersonsByIdentityCardUpdate(string proCode, string identityCard)
|
||||
{
|
||||
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";
|
||||
var getData = (from x in Funs.DB.SitePerson_Person
|
||||
join y in Funs.DB.Base_Project on x.ProjectId equals y.ProjectId
|
||||
join Persons in Funs.DB.Person_Persons on x.IdentityCard equals Persons.IdentityCard
|
||||
join z in Funs.DB.RealName_Project on y.ContractNo equals z.ProCode
|
||||
join v in Funs.DB.ProjectData_TeamGroup on x.TeamGroupId equals v.TeamGroupId
|
||||
join w in Funs.DB.Base_WorkPost on x.WorkPostId equals w.WorkPostId
|
||||
where x.IdentityCard == identityCard && y.ContractNo == proCode
|
||||
&& v.TeamId.HasValue
|
||||
&& z.JTproCode != null
|
||||
select new
|
||||
{
|
||||
name = x.PersonName,
|
||||
idcardType = "SHENFEN_ZHENGJIAN",
|
||||
idcardNumber = x.IdentityCard,
|
||||
proCode = z.JTproCode,
|
||||
teamId = v.TeamId,
|
||||
userType = ((w.PostType == "1" || w.PostType == "4") ? "LAB_USER_MANAGE" : "LAB_USER_BULIDER"),
|
||||
workType = w.WorkPostCode,
|
||||
isLeave = x.OutTime.HasValue ? "Y" : "N",
|
||||
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,
|
||||
x.PersonId,
|
||||
x.SitePersonId,
|
||||
}).ToList();
|
||||
if (getData.Count() > 0)
|
||||
{
|
||||
string returndata = string.Empty;
|
||||
Hashtable newToken = new Hashtable
|
||||
{
|
||||
{ "token", getaccess_token(proCode) }
|
||||
};
|
||||
var updatelistObject = new
|
||||
{
|
||||
list = getData.Select(x => new { x.name, x.idcardType, x.idcardNumber, x.proCode, x.teamId, x.userType, x.workType, x.isLeave, x.entryTime, x.exitTime })
|
||||
};
|
||||
pushContent = JsonConvert.SerializeObject(updatelistObject);
|
||||
returndata = BLL.APIGetHttpService.OutsideHttp(Funs.RealNameApiUrl + "/foreignApi/accept/updatePersons", "POST", contenttype, newToken, JsonConvert.SerializeObject(updatelistObject));
|
||||
|
||||
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))
|
||||
{
|
||||
foreach (var item in getData)
|
||||
{
|
||||
var getPerson = db.SitePerson_Person.FirstOrDefault(x => x.SitePersonId == item.SitePersonId);
|
||||
if (getPerson != null)
|
||||
{
|
||||
if (!getPerson.RealNameAddTime.HasValue)
|
||||
{
|
||||
getPerson.RealNameAddTime = DateTime.Now;
|
||||
}
|
||||
getPerson.RealNameUpdateTime = DateTime.Now;
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (mess.Contains("token无效"))
|
||||
{
|
||||
getaccess_token_New(proCode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
InsertRealNamePushLog(null, proCode, "推送人员数据", sucess, code, mess, data, pushContent);
|
||||
if (data.Contains("已存在") || mess.Contains("已存在") || mess.Contains("重合") || data.Contains("重合"))
|
||||
{
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
foreach (var item in getData)
|
||||
{
|
||||
if (data.Contains(item.idcardNumber) || mess.Contains(item.idcardNumber))
|
||||
{
|
||||
var getPerson = db.SitePerson_Person.FirstOrDefault(x => x.SitePersonId == item.SitePersonId);
|
||||
if (getPerson != null)
|
||||
{
|
||||
if (!getPerson.RealNameAddTime.HasValue)
|
||||
@@ -1293,6 +1426,7 @@ namespace BLL
|
||||
x.RealNameUpdateTime,
|
||||
name = x.PersonName,
|
||||
x.PersonId,
|
||||
x.SitePersonId,
|
||||
});
|
||||
if (getData.Count() > 0)
|
||||
{
|
||||
@@ -1322,7 +1456,7 @@ namespace BLL
|
||||
{
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
var getPerson = db.SitePerson_Person.FirstOrDefault(x => x.PersonId == itemData.PersonId);
|
||||
var getPerson = db.SitePerson_Person.FirstOrDefault(x => x.SitePersonId == itemData.SitePersonId);
|
||||
if (getPerson != null)
|
||||
{
|
||||
if (!getPerson.RealNameAddTime.HasValue)
|
||||
@@ -1635,6 +1769,7 @@ namespace BLL
|
||||
x.RealNameAddTime,
|
||||
x.RealNameUpdateTime,
|
||||
x.PersonId,
|
||||
x.SitePersonId,
|
||||
}).ToList();
|
||||
if (getData.Count() > 0)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user