This commit is contained in:
2023-03-02 18:52:52 +08:00
24 changed files with 294 additions and 64 deletions
+140 -7
View File
@@ -257,9 +257,12 @@ namespace BLL
Code = Code, Code = Code,
Message = Message, Message = Message,
PushTime = DateTime.Now, PushTime = DateTime.Now,
ReturnData = ReturnData,
PushContent = PushContent,
}; };
if (Code != "200")
{
newLog.ReturnData = ReturnData;
newLog.PushContent = PushContent;
}
db.RealName_PushLog.InsertOnSubmit(newLog); db.RealName_PushLog.InsertOnSubmit(newLog);
db.SubmitChanges(); db.SubmitChanges();
} }
@@ -1029,6 +1032,7 @@ namespace BLL
x.RealNameAddTime, x.RealNameAddTime,
x.RealNameUpdateTime, x.RealNameUpdateTime,
x.PersonId, x.PersonId,
x.SitePersonId,
}).Take(200).ToList(); }).Take(200).ToList();
if (getData.Count() > 0) if (getData.Count() > 0)
{ {
@@ -1069,7 +1073,7 @@ namespace BLL
{ {
foreach (var item in getData) 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 != null)
{ {
if (!getPerson.RealNameAddTime.HasValue) if (!getPerson.RealNameAddTime.HasValue)
@@ -1162,6 +1166,7 @@ namespace BLL
x.RealNameAddTime, x.RealNameAddTime,
x.RealNameUpdateTime, x.RealNameUpdateTime,
x.PersonId, x.PersonId,
x.SitePersonId,
}).ToList(); }).ToList();
if (getData.Count() > 0) if (getData.Count() > 0)
{ {
@@ -1202,7 +1207,7 @@ namespace BLL
{ {
foreach (var item in getData) 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 != null)
{ {
if (!getPerson.RealNameAddTime.HasValue) if (!getPerson.RealNameAddTime.HasValue)
@@ -1228,7 +1233,7 @@ namespace BLL
} }
InsertRealNamePushLog(null, proCode, "推送人员数据", sucess, code, mess, data, pushContent); 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)) using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{ {
@@ -1236,7 +1241,133 @@ namespace BLL
{ {
if (data.Contains(item.idcardNumber) || mess.Contains(item.idcardNumber)) 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 != null)
{ {
if (!getPerson.RealNameAddTime.HasValue) if (!getPerson.RealNameAddTime.HasValue)
@@ -1295,6 +1426,7 @@ namespace BLL
x.RealNameUpdateTime, x.RealNameUpdateTime,
name = x.PersonName, name = x.PersonName,
x.PersonId, x.PersonId,
x.SitePersonId,
}); });
if (getData.Count() > 0) if (getData.Count() > 0)
{ {
@@ -1324,7 +1456,7 @@ namespace BLL
{ {
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) 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 != null)
{ {
if (!getPerson.RealNameAddTime.HasValue) if (!getPerson.RealNameAddTime.HasValue)
@@ -1637,6 +1769,7 @@ namespace BLL
x.RealNameAddTime, x.RealNameAddTime,
x.RealNameUpdateTime, x.RealNameUpdateTime,
x.PersonId, x.PersonId,
x.SitePersonId,
}).ToList(); }).ToList();
if (getData.Count() > 0) if (getData.Count() > 0)
{ {
+1 -1
View File
@@ -12820,7 +12820,7 @@
<AutoAssignPort>True</AutoAssignPort> <AutoAssignPort>True</AutoAssignPort>
<DevelopmentServerPort>0</DevelopmentServerPort> <DevelopmentServerPort>0</DevelopmentServerPort>
<DevelopmentServerVPath>/</DevelopmentServerVPath> <DevelopmentServerVPath>/</DevelopmentServerVPath>
<IISUrl>http://localhost:1783/</IISUrl> <IISUrl>http://localhost:2087/</IISUrl>
<NTLMAuthentication>False</NTLMAuthentication> <NTLMAuthentication>False</NTLMAuthentication>
<UseCustomServer>False</UseCustomServer> <UseCustomServer>False</UseCustomServer>
<CustomServerUrl> <CustomServerUrl>
@@ -31,6 +31,9 @@
</f:DatePicker> </f:DatePicker>
<f:DatePicker ID="txtEndDate" runat="server" Label="结束日期" LabelWidth="80px" Width="220px"> <f:DatePicker ID="txtEndDate" runat="server" Label="结束日期" LabelWidth="80px" Width="220px">
</f:DatePicker> </f:DatePicker>
<f:DropDownList runat="server" Width="320px" ID="drpProject" EnableEdit="true" Label="项目"
LabelWidth="60px" LabelAlign="Right" AutoPostBack="true" OnSelectedIndexChanged="drpProject_SelectedIndexChanged">
</f:DropDownList>
<f:TextBox runat="server" ID="txtConet" EmptyText="请输入查询条件" Width="220px"></f:TextBox> <f:TextBox runat="server" ID="txtConet" EmptyText="请输入查询条件" Width="220px"></f:TextBox>
<f:ToolbarFill runat="server"></f:ToolbarFill> <f:ToolbarFill runat="server"></f:ToolbarFill>
<f:Button ID="btnSearch" runat="server" Icon="SystemSearch" ToolTip="查询" OnClick="btnSearch_Click"> <f:Button ID="btnSearch" runat="server" Icon="SystemSearch" ToolTip="查询" OnClick="btnSearch_Click">
@@ -38,6 +41,8 @@
<f:Button ID="btnOut" OnClick="btnOut_Click" runat="server" ToolTip="导出" Icon="FolderUp" <f:Button ID="btnOut" OnClick="btnOut_Click" runat="server" ToolTip="导出" Icon="FolderUp"
EnableAjax="false" DisableControlBeforePostBack="false"> EnableAjax="false" DisableControlBeforePostBack="false">
</f:Button> </f:Button>
<f:Button ID="btnDele" runat="server" Icon="Delete" ToolTip="清理同步记录" OnClick="btnDele_Click">
</f:Button>
</Items> </Items>
</f:Toolbar> </f:Toolbar>
</Toolbars> </Toolbars>
@@ -5,6 +5,7 @@ using System.Data;
using System.Data.SqlClient; using System.Data.SqlClient;
using System.Text; using System.Text;
using AspNet = System.Web.UI.WebControls; using AspNet = System.Web.UI.WebControls;
using System.Linq;
namespace FineUIPro.Web.ZHGL.RealName namespace FineUIPro.Web.ZHGL.RealName
{ {
@@ -22,6 +23,12 @@ namespace FineUIPro.Web.ZHGL.RealName
Funs.DropDownPageSize(this.ddlPageSize); Funs.DropDownPageSize(this.ddlPageSize);
this.txtStartDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now); this.txtStartDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now);
this.txtEndDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now); this.txtEndDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now);
ProjectService.InitAllProjectShortNameDropDownList(this.drpProject, this.CurrUser.PersonId, true);
if (!string.IsNullOrEmpty(this.CurrUser.LoginProjectId))
{
this.drpProject.SelectedValue = this.CurrUser.LoginProjectId;
this.drpProject.Readonly = true;
}
this.GridBind(); this.GridBind();
} }
} }
@@ -46,6 +53,11 @@ namespace FineUIPro.Web.ZHGL.RealName
strSql += " AND PushTime < @EndDate"; strSql += " AND PushTime < @EndDate";
listStr.Add(new SqlParameter("@EndDate", Funs.GetNewDateTime(this.txtEndDate.Text).Value.AddDays(1))); listStr.Add(new SqlParameter("@EndDate", Funs.GetNewDateTime(this.txtEndDate.Text).Value.AddDays(1)));
} }
if (this.drpProject.SelectedValue != Const._Null && !string.IsNullOrEmpty(this.drpProject.SelectedValue))
{
strSql += " AND ProjectId = @ProjectId";
listStr.Add(new SqlParameter("@ProjectId", this.drpProject.SelectedValue));
}
if (!string.IsNullOrEmpty(this.txtConet.Text)) if (!string.IsNullOrEmpty(this.txtConet.Text))
{ {
strSql += " AND (Success LIKE @name OR Message LIKE @name OR ReturnData LIKE @name)"; strSql += " AND (Success LIKE @name OR Message LIKE @name OR ReturnData LIKE @name)";
@@ -154,5 +166,23 @@ namespace FineUIPro.Web.ZHGL.RealName
this.GridBind(); this.GridBind();
} }
#endregion #endregion
protected void drpProject_SelectedIndexChanged(object sender, EventArgs e)
{
GridBind();
}
protected void btnDele_Click(object sender, EventArgs e)
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
var getRealName_PushLog = from x in db.RealName_PushLog select x;
if (getRealName_PushLog.Count() > 0)
{
db.RealName_PushLog.DeleteAllOnSubmit(getRealName_PushLog);
db.SubmitChanges();
}
}
}
} }
} }
@@ -7,10 +7,12 @@
// </自动生成> // </自动生成>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
namespace FineUIPro.Web.ZHGL.RealName { namespace FineUIPro.Web.ZHGL.RealName
{
public partial class SynchroRecord { public partial class SynchroRecord
{
/// <summary> /// <summary>
/// form1 控件。 /// form1 控件。
@@ -75,6 +77,15 @@ namespace FineUIPro.Web.ZHGL.RealName {
/// </remarks> /// </remarks>
protected global::FineUIPro.DatePicker txtEndDate; protected global::FineUIPro.DatePicker txtEndDate;
/// <summary>
/// drpProject 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DropDownList drpProject;
/// <summary> /// <summary>
/// txtConet 控件。 /// txtConet 控件。
/// </summary> /// </summary>
@@ -102,6 +113,15 @@ namespace FineUIPro.Web.ZHGL.RealName {
/// </remarks> /// </remarks>
protected global::FineUIPro.Button btnOut; protected global::FineUIPro.Button btnOut;
/// <summary>
/// btnDele 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnDele;
/// <summary> /// <summary>
/// labNumber 控件。 /// labNumber 控件。
/// </summary> /// </summary>
@@ -41,11 +41,15 @@
</f:NumberBox> </f:NumberBox>
</Items> </Items>
</f:FormRow> </f:FormRow>
<f:FormRow ColumnWidths="90% 10%"> <f:FormRow ColumnWidths="80% 6% 6% 7%">
<Items> <Items>
<f:TextArea ID="txtIdentityCard" runat="server" Label="身份证号码" LabelWidth="120px"> <f:TextArea ID="txtIdentityCard" runat="server" Label="身份证号码" LabelWidth="120px">
</f:TextArea> </f:TextArea>
<f:Button ID="btnPushData" Icon="Accept" runat="server" Text="提交" ToolTip="多身份证用逗号(,)隔开;或直接复制日志中错误提示信息。" OnClick="btnPushData_Click"> <f:Button ID="btnPushData" Icon="Accept" runat="server" Text="提交" ToolTip="多身份证用逗号(,)隔开;或直接复制日志中错误提示信息。"
OnClick="btnPushData_Click">
</f:Button>
<f:Button ID="btnPushUpdate" Icon="Accept" runat="server" Text="更新" ToolTip="多身份证用逗号(,)隔开;或直接复制日志中错误提示信息。"
OnClick="btnPushUpdate_Click">
</f:Button> </f:Button>
<f:Button ID="btnDelete" Icon="Delete" runat="server" Text="删除" <f:Button ID="btnDelete" Icon="Delete" runat="server" Text="删除"
ToolTip="删除这些身份证号码对应的实名制考勤,多身份证用逗号(,)隔开。" OnClick="btnDelete_Click"> ToolTip="删除这些身份证号码对应的实名制考勤,多身份证用逗号(,)隔开。" OnClick="btnDelete_Click">
@@ -287,7 +287,33 @@ namespace FineUIPro.Web.ZHGL.RealName
} }
} }
} }
protected void btnPushUpdate_Click(object sender, EventArgs e)
{
string message = string.Empty;
string idText = this.txtIdentityCard.Text.Trim();
if (!string.IsNullOrEmpty(idText))
{
string proCode = ProjectService.GetContractNoByProjectId(this.drpProject.SelectedValue);
var getRProjects = Funs.DB.RealName_Project.FirstOrDefault(x => x.ProCode == proCode);
if (getRProjects != null && !string.IsNullOrEmpty(getRProjects.ProCode))
{
var getList = returnCardList();
if (getList != null && getList.Count > 0)
{
foreach (var item in getList)
{
message += ("项目" + getRProjects.ProCode + "更新" + BLL.SynchroSetService.PushPersonsByIdentityCardUpdate(getRProjects.ProCode, item) ?? "");
}
ShowNotify(message, MessageBoxIcon.Information);
}
}
else
{
ShowNotify("当前项目还没有与实名制对接!", MessageBoxIcon.Information);
}
}
}
protected void btnDelete_Click(object sender, EventArgs e) protected void btnDelete_Click(object sender, EventArgs e)
{ {
var getList = returnCardList(); var getList = returnCardList();
@@ -637,5 +663,7 @@ namespace FineUIPro.Web.ZHGL.RealName
ShowNotify("操作完成!" + count.ToString() + "条", MessageBoxIcon.Success); ShowNotify("操作完成!" + count.ToString() + "条", MessageBoxIcon.Success);
} }
} }
} }
} }
+13 -2
View File
@@ -7,10 +7,12 @@
// </自动生成> // </自动生成>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
namespace FineUIPro.Web.ZHGL.RealName { namespace FineUIPro.Web.ZHGL.RealName
{
public partial class SynchroSet { public partial class SynchroSet
{
/// <summary> /// <summary>
/// form1 控件。 /// form1 控件。
@@ -102,6 +104,15 @@ namespace FineUIPro.Web.ZHGL.RealName {
/// </remarks> /// </remarks>
protected global::FineUIPro.Button btnPushData; protected global::FineUIPro.Button btnPushData;
/// <summary>
/// btnPushUpdate 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnPushUpdate;
/// <summary> /// <summary>
/// btnDelete 控件。 /// btnDelete 控件。
/// </summary> /// </summary>
+2 -3
View File
@@ -50,9 +50,8 @@
<DocumentationFile>bin\WebAPI.xml</DocumentationFile> <DocumentationFile>bin\WebAPI.xml</DocumentationFile>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="Aspose.Words, Version=10.5.0.0, Culture=neutral, PublicKeyToken=fa9a48344f15a022, processorArchitecture=MSIL"> <Reference Include="Aspose.Words">
<SpecificVersion>False</SpecificVersion> <HintPath>..\FineUIPro\Reference BLL\Aspose.Words.dll</HintPath>
<HintPath>bin\Aspose.Words.dll</HintPath>
</Reference> </Reference>
<Reference Include="Microsoft.CSharp" /> <Reference Include="Microsoft.CSharp" />
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> <Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">