20230426新增功能:分公司且本部角色账号能在本部和项目登录、切换。

This commit is contained in:
杨红卫 2023-04-26 15:50:30 +08:00
parent 418ef0bd4a
commit 71028ea932
27 changed files with 112 additions and 194 deletions

View File

@ -0,0 +1,3 @@
--ADD BY YangHongwei 2023-04-26
1、新增功能分公司且本部角色账号能在本部和项目登录、切换。
--END

View File

@ -56,12 +56,12 @@ namespace BLL
/// </summary> /// </summary>
/// <param name="sitePersonId"></param> /// <param name="sitePersonId"></param>
/// <returns></returns> /// <returns></returns>
public static Model.PersonItem getPersonBySitePersonId(string sitePersonId) public static Model.PersonItem getPersonBySitePersonId(string sitePersonId, string projectId, string idcard)
{ {
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{ {
Model.PersonItem person = new Model.PersonItem(); Model.PersonItem person = new Model.PersonItem();
var getProjectPerson = db.SitePerson_Person.FirstOrDefault(x => x.SitePersonId == sitePersonId); var getProjectPerson = db.SitePerson_Person.FirstOrDefault(x => x.SitePersonId == sitePersonId || (x.ProjectId == projectId && x.IdentityCard == idcard));
if (getProjectPerson != null) if (getProjectPerson != null)
{ {
person.SitePersonId = getProjectPerson.SitePersonId; person.SitePersonId = getProjectPerson.SitePersonId;
@ -70,6 +70,7 @@ namespace BLL
person.CardNo = getProjectPerson.CardNo; person.CardNo = getProjectPerson.CardNo;
person.PersonName = getProjectPerson.PersonName; person.PersonName = getProjectPerson.PersonName;
person.IdentityCard = getProjectPerson.IdentityCard; person.IdentityCard = getProjectPerson.IdentityCard;
idcard = getProjectPerson.IdentityCard;
person.ProjectId = getProjectPerson.ProjectId; person.ProjectId = getProjectPerson.ProjectId;
var getProject = db.Base_Project.FirstOrDefault(x => x.ProjectId == getProjectPerson.ProjectId); var getProject = db.Base_Project.FirstOrDefault(x => x.ProjectId == getProjectPerson.ProjectId);
if (getProject != null) if (getProject != null)
@ -124,74 +125,90 @@ namespace BLL
{ {
person.AuditorId = getA.PersonId; person.AuditorId = getA.PersonId;
person.AuditorName = getA.PersonName; person.AuditorName = getA.PersonName;
} }
} }
} }
person.AuditorDate = string.Format("{0:yyyy-MM-dd}", getProjectPerson.AuditorDate); person.AuditorDate = string.Format("{0:yyyy-MM-dd}", getProjectPerson.AuditorDate);
person.AttachUrl2 = APIUpLoadFileService.getFileUrl(getProjectPerson.PersonId + "#2", null); person.AttachUrl2 = APIUpLoadFileService.getFileUrl(getProjectPerson.PersonId + "#2", null);
person.AttachUrl3 = APIUpLoadFileService.getFileUrl(getProjectPerson.PersonId + "#3", null); person.AttachUrl3 = APIUpLoadFileService.getFileUrl(getProjectPerson.PersonId + "#3", null);
person.AttachUrl4 = getAttachUrl4(getProjectPerson.PersonId); person.AttachUrl4 = getAttachUrl4(getProjectPerson.PersonId);
//person.AttachUrl5 = APIUpLoadFileService.getFileUrl(personId + "#5", null); //person.AttachUrl5 = APIUpLoadFileService.getFileUrl(personId + "#5", null);
}
var getPerson = db.Person_Persons.FirstOrDefault(x => x.PersonId == getProjectPerson.PersonId); var getPerson = db.Person_Persons.FirstOrDefault(x => x.IdentityCard == idcard);
if (getPerson != null) if (getPerson != null)
{
person.PersonId = getPerson.PersonId;
person.PersonName = getPerson.PersonName;
person.IdentityCard = getPerson.IdentityCard;
person.Sex = getPerson.Sex;
person.SexName = getPerson.Sex == "1" ? "男" : "女";
person.Address = getPerson.Address;
person.Telephone = getPerson.Telephone;
person.PhotoUrl = getPerson.PhotoUrl;
person.IsForeign = getPerson.IsForeign.HasValue ? getPerson.IsForeign : false;
person.PersonType = getPerson.PersonType;
person.PersonTypeName = DropListService.getPersonTypeNameByValue(getPerson.PersonType);
person.AttachUrl1 = getPerson.IDCardUrl == null ? APIUpLoadFileService.getFileUrl(getProjectPerson.PersonId + "#1", null) : getPerson.IDCardUrl.Replace('\\', '/');
person.AttachUrl5 = getPerson.IDCardBackUrl == null ? APIUpLoadFileService.getFileUrl(getProjectPerson.PersonId + "#5", null) : getPerson.IDCardBackUrl.Replace('\\', '/');
person.IdcardType = getPerson.IdcardType;
person.IdcardTypeName = "身份证";
person.IdcardStartDate = string.Format("{0:yyyy-MM-dd}", getPerson.IdcardStartDate);
person.IdcardEndDate = string.Format("{0:yyyy-MM-dd}", getPerson.IdcardEndDate);
person.IdcardForever = getPerson.IdcardForever;
person.IdcardForeverStr = getPerson.IdcardForever == "Y" ? "是" : "否";
person.PoliticsStatus = getPerson.PoliticsStatus;
person.UnitId = getPerson.UnitId;
var gettUnit = db.Base_Unit.FirstOrDefault(x => x.UnitId == getPerson.UnitId);
if (gettUnit != null)
{ {
person.Sex = getPerson.Sex; person.UnitCode = gettUnit.UnitCode;
person.SexName = getPerson.Sex == "1" ? "男" : "女"; person.UnitName = gettUnit.UnitName;
person.Address = getPerson.Address; }
person.Telephone = getPerson.Telephone; person.WorkPostId = getPerson.WorkPostId;
person.PhotoUrl = getPerson.PhotoUrl; var getWorkPost = db.Base_WorkPost.FirstOrDefault(x => x.WorkPostId == getPerson.WorkPostId);
person.IsForeign = getPerson.IsForeign.HasValue ? getPerson.IsForeign : false; if (getWorkPost != null)
person.PersonType = getPerson.PersonType; {
person.PersonTypeName = DropListService.getPersonTypeNameByValue(getPerson.PersonType); person.WorkPostName = getWorkPost.WorkPostName;
person.AttachUrl1 = getPerson.IDCardUrl == null ? APIUpLoadFileService.getFileUrl(getProjectPerson.PersonId + "#1", null) : getPerson.IDCardUrl.Replace('\\', '/'); }
person.AttachUrl5 = getPerson.IDCardBackUrl == null ? APIUpLoadFileService.getFileUrl(getProjectPerson.PersonId + "#5", null) : getPerson.IDCardBackUrl.Replace('\\', '/'); var getRealName_BasicData = db.RealName_BasicData.FirstOrDefault(x => x.DictCode == getPerson.PoliticsStatus);
person.IdcardType = getPerson.IdcardType; if (getRealName_BasicData != null)
person.IdcardTypeName = "身份证"; {
person.IdcardStartDate = string.Format("{0:yyyy-MM-dd}", getPerson.IdcardStartDate); person.PoliticsStatusName = getRealName_BasicData.DictName;
person.IdcardEndDate = string.Format("{0:yyyy-MM-dd}", getPerson.IdcardEndDate); }
person.IdcardForever = getPerson.IdcardForever; person.IdcardAddress = getPerson.IdcardAddress;
person.IdcardForeverStr = getPerson.IdcardForever == "Y" ? "是" : "否"; person.Nation = getPerson.Nation;
person.PoliticsStatus = getPerson.PoliticsStatus; var getRealName_BasicData1 = db.RealName_BasicData.FirstOrDefault(x => x.DictCode == getPerson.Nation);
var getRealName_BasicData = db.RealName_BasicData.FirstOrDefault(x => x.DictCode == getPerson.PoliticsStatus); if (getRealName_BasicData1 != null)
if (getRealName_BasicData != null) {
{ person.NationName = getRealName_BasicData1.DictName;
person.PoliticsStatusName = getRealName_BasicData.DictName; }
} person.EduLevel = getPerson.EduLevel;
person.IdcardAddress = getPerson.IdcardAddress; var getRealName_BasicData2 = db.RealName_BasicData.FirstOrDefault(x => x.DictCode == getPerson.EduLevel);
person.Nation = getPerson.Nation; if (getRealName_BasicData2 != null)
var getRealName_BasicData1 = db.RealName_BasicData.FirstOrDefault(x => x.DictCode == getPerson.Nation); {
if (getRealName_BasicData1 != null) person.EduLevelName = getRealName_BasicData2.DictName;
{ }
person.NationName = getRealName_BasicData1.DictName; person.MaritalStatus = getPerson.MaritalStatus;
} var getRealName_BasicData3 = db.RealName_BasicData.FirstOrDefault(x => x.DictCode == getPerson.MaritalStatus);
person.EduLevel = getPerson.EduLevel; if (getRealName_BasicData3 != null)
var getRealName_BasicData2 = db.RealName_BasicData.FirstOrDefault(x => x.DictCode == getPerson.EduLevel); {
if (getRealName_BasicData2 != null) person.MaritalStatusName = getRealName_BasicData3.DictName;
{ }
person.EduLevelName = getRealName_BasicData1.DictName; person.CountryCode = getPerson.CountryCode;
} var getRealName_Country = db.RealName_Country.FirstOrDefault(x => x.CountryId == getPerson.CountryCode);
person.MaritalStatus = getPerson.MaritalStatus; if (getRealName_Country != null)
var getRealName_BasicData3 = db.RealName_BasicData.FirstOrDefault(x => x.DictCode == getPerson.MaritalStatus); {
if (getRealName_BasicData3 != null) person.CountryName = getRealName_Country.Cname;
{ }
person.MaritalStatusName = getRealName_BasicData1.DictName; person.ProvinceCode = getPerson.ProvinceCode;
} var getRealName_City = db.RealName_City.FirstOrDefault(x => x.CountryId == getPerson.CountryCode && x.ProvinceCode == getPerson.ProvinceCode);
person.CountryCode = getPerson.CountryCode; if (getRealName_City != null)
var getRealName_Country = db.RealName_Country.FirstOrDefault(x => x.CountryId == getPerson.CountryCode); {
if (getRealName_Country != null) person.ProvinceName = getRealName_City.Cname;
{
person.CountryName = getRealName_Country.Cname;
}
person.ProvinceCode = getPerson.ProvinceCode;
var getRealName_City = db.RealName_City.FirstOrDefault(x => x.CountryId == getPerson.CountryCode && x.ProvinceCode == getPerson.ProvinceCode);
if (getRealName_City != null)
{
person.ProvinceName = getRealName_City.Cname;
}
} }
} }
return person; return person;
} }
} }
@ -227,132 +244,6 @@ namespace BLL
#endregion #endregion
#region personId获取人员信息
/// <summary>
/// 根据personId获取人员信息
/// </summary>
/// <param name="personId"></param>
/// <returns></returns>
public static Model.PersonItem getPersonByPersonId(string personId)
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
Model.PersonItem person = new Model.PersonItem();
var getPerson = db.Person_Persons.FirstOrDefault(x => x.PersonId == personId);
if (getPerson != null)
{
person.PersonId = getPerson.PersonId;
person.IdentityCard = getPerson.IdentityCard;
person.PersonName = getPerson.PersonName;
person.UnitId = getPerson.UnitId;
var gettUnit = db.Base_Unit.FirstOrDefault(x => x.UnitId == getPerson.UnitId);
if (gettUnit != null)
{
person.UnitCode = gettUnit.UnitCode;
person.UnitName = gettUnit.UnitName;
}
person.WorkPostId = getPerson.WorkPostId;
var getWorkPost = db.Base_WorkPost.FirstOrDefault(x => x.WorkPostId == getPerson.WorkPostId);
if (getWorkPost != null)
{
person.WorkPostName = getWorkPost.WorkPostName;
}
person.Sex = getPerson.Sex;
person.SexName = getPerson.Sex == "1" ? "男" : "女";
person.Address = getPerson.Address;
person.Telephone = getPerson.Telephone;
person.PhotoUrl = getPerson.PhotoUrl;
person.IsForeign = getPerson.IsForeign.HasValue ? getPerson.IsForeign : false;
person.PersonType = getPerson.PersonType;
person.PersonTypeName = DropListService.getPersonTypeNameByValue(getPerson.PersonType);
person.AttachUrl1 = getPerson.IDCardUrl == null ? APIUpLoadFileService.getFileUrl(getPerson.PersonId + "#1", null) : getPerson.IDCardUrl.Replace('\\', '/');
person.AttachUrl5 = getPerson.IDCardBackUrl == null ? APIUpLoadFileService.getFileUrl(getPerson.PersonId + "#5", null) : getPerson.IDCardBackUrl.Replace('\\', '/');
person.IdcardType = getPerson.IdcardType;
person.IdcardTypeName = "身份证";
person.IdcardStartDate = string.Format("{0:yyyy-MM-dd}", getPerson.IdcardStartDate);
person.IdcardEndDate = string.Format("{0:yyyy-MM-dd}", getPerson.IdcardEndDate);
person.IdcardForever = getPerson.IdcardForever;
person.IdcardForeverStr = getPerson.IdcardForever == "Y" ? "是" : "否";
person.PoliticsStatus = getPerson.PoliticsStatus;
var getRealName_BasicData = db.RealName_BasicData.FirstOrDefault(x => x.DictCode == getPerson.PoliticsStatus);
if (getRealName_BasicData != null)
{
person.PoliticsStatusName = getRealName_BasicData.DictName;
}
person.IdcardAddress = getPerson.IdcardAddress;
person.Nation = getPerson.Nation;
var getRealName_BasicData1 = db.RealName_BasicData.FirstOrDefault(x => x.DictCode == getPerson.Nation);
if (getRealName_BasicData1 != null)
{
person.NationName = getRealName_BasicData1.DictName;
}
person.EduLevel = getPerson.EduLevel;
var getRealName_BasicData2 = db.RealName_BasicData.FirstOrDefault(x => x.DictCode == getPerson.EduLevel);
if (getRealName_BasicData2 != null)
{
person.EduLevelName = getRealName_BasicData1.DictName;
}
person.MaritalStatus = getPerson.MaritalStatus;
var getRealName_BasicData3 = db.RealName_BasicData.FirstOrDefault(x => x.DictCode == getPerson.MaritalStatus);
if (getRealName_BasicData3 != null)
{
person.MaritalStatusName = getRealName_BasicData1.DictName;
}
person.CountryCode = getPerson.CountryCode;
var getRealName_Country = db.RealName_Country.FirstOrDefault(x => x.CountryId == getPerson.CountryCode);
if (getRealName_Country != null)
{
person.CountryName = getRealName_Country.Cname;
}
person.ProvinceCode = getPerson.ProvinceCode;
var getRealName_City = db.RealName_City.FirstOrDefault(x => x.CountryId == getPerson.CountryCode && x.ProvinceCode == getPerson.ProvinceCode);
if (getRealName_City != null)
{
person.ProvinceName = getRealName_City.Cname;
}
person.AttachUrl2 = APIUpLoadFileService.getFileUrl(getPerson.PersonId + "#2", null);
person.AttachUrl3 = APIUpLoadFileService.getFileUrl(getPerson.PersonId + "#3", null);
person.AttachUrl4 = getAttachUrl4(getPerson.PersonId);
}
return person;
}
}
#endregion
#region personId获取人员信息
/// <summary>
/// 根据personId获取人员信息
/// </summary>
/// <param name="personId"></param>
/// <returns></returns>
public static Model.PersonItem getPersonByProjectIdIdentityCard(string projectId, string identityCard)
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
var getPerson = db.SitePerson_Person.FirstOrDefault(x => x.ProjectId == projectId && (x.PersonId == identityCard || x.IdentityCard == identityCard));
if (getPerson != null)
{
return getPersonBySitePersonId(getPerson.SitePersonId);
}
else
{
var getPersons = db.Person_Persons.FirstOrDefault(x => x.IdentityCard == identityCard || x.PersonId == identityCard);
if (getPersons != null)
{
return getPersonByPersonId(getPersons.PersonId);
}
else
{
return null;
}
}
}
}
#endregion
#region projectIdunitid获取人员信息 #region projectIdunitid获取人员信息
/// <summary> /// <summary>
/// 根据projectId、unitid获取人员信息 /// 根据projectId、unitid获取人员信息

View File

@ -327,6 +327,29 @@ namespace BLL
} }
#endregion #endregion
/// <summary>
/// 是否赛鼎或分公司
/// </summary>
/// <param name="unitId"></param>
/// <returns></returns>
public static bool IsSedinOrSub(string unitId)
{
bool result = false;
if (unitId == Const.UnitId_SEDIN)
{
result = true;
}
else
{
var uinit =UnitService.GetUnitByUnitId(unitId);
if (uinit != null && uinit.IsBranch ==true)
{
result = true;
}
}
return result;
}
#region Id判断是否为本单位用户或管理员 #region Id判断是否为本单位用户或管理员
/// <summary> /// <summary>
/// 根据用户UnitId判断是否为本单位用户或管理员 /// 根据用户UnitId判断是否为本单位用户或管理员

View File

@ -596,14 +596,14 @@ namespace FineUIPro.Web
protected void btnHome_Click(object sender, EventArgs e) protected void btnHome_Click(object sender, EventArgs e)
{ {
if (string.IsNullOrEmpty(this.CurrUser.LastProjectId) if (string.IsNullOrEmpty(this.CurrUser.LastProjectId)
&& ((this.CurrUser.UnitId == Const.UnitId_SEDIN && (this.CurrUser.IsOffice == true || this.CurrUser.RoleIds != null)) || this.CurrUser.PersonId == Const.sysglyId || this.CurrUser.PersonId == Const.hfnbdId)) && ((CommonService.IsSedinOrSub(this.CurrUser.UnitId) && (this.CurrUser.IsOffice == true || this.CurrUser.RoleIds != null)) || this.CurrUser.PersonId == Const.sysglyId || this.CurrUser.PersonId == Const.hfnbdId))
{ {
Person_PersonsService.UpdateLastUserInfo(this.CurrUser.PersonId, null, true, this.CurrUser.LoginProjectId); Person_PersonsService.UpdateLastUserInfo(this.CurrUser.PersonId, null, true, this.CurrUser.LoginProjectId);
this.CurrUser.LastProjectId = this.CurrUser.LoginProjectId; this.CurrUser.LastProjectId = this.CurrUser.LoginProjectId;
PageContext.Redirect("~/index.aspx", "_top"); PageContext.Redirect("~/index.aspx", "_top");
} }
else else
{ {
this.MenuSwitchMethod(string.Empty); this.MenuSwitchMethod(string.Empty);
} }
} }

View File

@ -23,7 +23,7 @@ namespace WebAPI.Controllers
var responeData = new Model.ResponeData(); var responeData = new Model.ResponeData();
try try
{ {
responeData.data = APIPersonService.getPersonBySitePersonId(sitePersonId); responeData.data = APIPersonService.getPersonBySitePersonId(sitePersonId, null, null);
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -47,7 +47,7 @@ namespace WebAPI.Controllers
var responeData = new Model.ResponeData(); var responeData = new Model.ResponeData();
try try
{ {
responeData.data = APIPersonService.getPersonByProjectIdIdentityCard(projectId, identityCard); responeData.data = APIPersonService.getPersonBySitePersonId(null, projectId, identityCard);
} }
catch (Exception ex) catch (Exception ex)
{ {

View File

@ -4,13 +4,14 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
--> -->
<Project> <Project>
<PropertyGroup> <PropertyGroup>
<DeleteExistingFiles>False</DeleteExistingFiles> <DeleteExistingFiles>true</DeleteExistingFiles>
<ExcludeApp_Data>False</ExcludeApp_Data> <ExcludeApp_Data>false</ExcludeApp_Data>
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish> <LaunchSiteAfterPublish>true</LaunchSiteAfterPublish>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration> <LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform> <LastUsedPlatform>Any CPU</LastUsedPlatform>
<PublishProvider>FileSystem</PublishProvider> <PublishProvider>FileSystem</PublishProvider>
<PublishUrl>E:\Package\赛鼎工程有限公司\SGGLAPI</PublishUrl> <PublishUrl>E:\Package\赛鼎工程有限公司\SGGLAPI</PublishUrl>
<WebPublishMethod>FileSystem</WebPublishMethod> <WebPublishMethod>FileSystem</WebPublishMethod>
<SiteUrlToLaunchAfterPublish />
</PropertyGroup> </PropertyGroup>
</Project> </Project>

View File

@ -360,7 +360,7 @@
<AutoAssignPort>True</AutoAssignPort> <AutoAssignPort>True</AutoAssignPort>
<DevelopmentServerPort>0</DevelopmentServerPort> <DevelopmentServerPort>0</DevelopmentServerPort>
<DevelopmentServerVPath>/</DevelopmentServerVPath> <DevelopmentServerVPath>/</DevelopmentServerVPath>
<IISUrl>http://localhost:3070/</IISUrl> <IISUrl>http://localhost:7655/</IISUrl>
<NTLMAuthentication>False</NTLMAuthentication> <NTLMAuthentication>False</NTLMAuthentication>
<UseCustomServer>False</UseCustomServer> <UseCustomServer>False</UseCustomServer>
<CustomServerUrl> <CustomServerUrl>