合并最新

This commit is contained in:
2022-12-20 09:32:32 +08:00
parent 844e9f1488
commit 1abdaa9476
654 changed files with 73563 additions and 9746 deletions
+119 -20
View File
@@ -23,7 +23,7 @@ namespace BLL
var getUser = from x in db.SitePerson_Person
where (x.Telephone == userInfo.Account || x.PersonName == userInfo.Account)
&& (x.Password == Funs.EncryptionPassword(userInfo.Password) || (x.IdentityCard != null && x.IdentityCard.Substring(x.IdentityCard.Length - 4) == userInfo.Password))
&& x.InTime <= DateTime.Now && (!x.OutTime.HasValue || x.OutTime >= DateTime.Now) && x.IsUsed == true
&& x.InTime <= DateTime.Now && (!x.OutTime.HasValue || x.OutTime >= DateTime.Now) && x.IsUsed == 1
select x;
if (!string.IsNullOrEmpty(userInfo.LoginProjectId))
{
@@ -95,8 +95,8 @@ namespace BLL
Telephone = x.Telephone,
PhotoUrl = x.PhotoUrl,
DepartName = x.DepartName,
IsUsed = x.IsUsed,
IsUsedName = x.IsUsed == false ? "不启用" : "启用",
IsUsed = x.IsUsed == 1 ? true : false,
IsUsedName = x.IsUsed == 0 ? "不启用" : "启用",
AuditorId = x.AuditorId,
AuditorName = db.Sys_User.First(z => z.UserId == x.AuditorId).UserName,
IsForeign = x.IsForeign.HasValue ? x.IsForeign : false,
@@ -202,8 +202,8 @@ namespace BLL
Telephone = x.Telephone,
PhotoUrl = x.PhotoUrl,
DepartName = x.DepartName,
IsUsed = x.IsUsed,
IsUsedName = x.IsUsed == false ? "不启用" : "启用",
IsUsed = x.IsUsed==1?true:false,
IsUsedName = x.IsUsed == 0 ? "不启用" : "启用",
AuditorId = x.AuditorId,
AuditorName = db.Sys_User.First(z => z.UserId == x.AuditorId).UserName,
IsForeign = x.IsForeign.HasValue ? x.IsForeign : false,
@@ -257,7 +257,7 @@ namespace BLL
var getPerson = db.SitePerson_Person.FirstOrDefault(x => x.PersonId == personId);
if (getPerson != null)
{
getPerson.IsUsed = false;
getPerson.IsUsed = 0;
getPerson.AuditorId = userId;
getPerson.AuditorDate = DateTime.Now;
db.SubmitChanges();
@@ -277,7 +277,7 @@ namespace BLL
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
var persons = from x in db.View_SitePerson_Person
where x.ProjectId == projectId && (x.UnitId == unitId || unitId == null) && x.IsUsed == true
where x.ProjectId == projectId && (x.UnitId == unitId || unitId == null) && x.IsUsed == 1
&& x.InTime <= DateTime.Now && (!x.OutTime.HasValue || x.OutTime >= DateTime.Now)
orderby x.CardNo descending
select new Model.PersonItem
@@ -354,19 +354,19 @@ namespace BLL
}
if (states == "0")
{
getViews = getViews.Where(x => x.IsUsed == false && !x.AuditorDate.HasValue);
getViews = getViews.Where(x => x.IsUsed == 0 && !x.AuditorDate.HasValue);
}
else if (states == "1")
{
getViews = getViews.Where(x => x.IsUsed == true && x.InTime <= DateTime.Now && (!x.OutTime.HasValue || x.OutTime >= DateTime.Now));
getViews = getViews.Where(x => x.IsUsed == 1 && x.InTime <= DateTime.Now && (!x.OutTime.HasValue || x.OutTime >= DateTime.Now));
}
else if (states == "2")
{
getViews = getViews.Where(x => x.IsUsed == true && x.OutTime <= DateTime.Now);
getViews = getViews.Where(x => x.IsUsed == 1 && x.OutTime <= DateTime.Now);
}
else if (states == "-1")
{
getViews = getViews.Where(x => x.IsUsed == false && x.AuditorDate.HasValue);
getViews = getViews.Where(x => x.IsUsed == 0 && x.AuditorDate.HasValue);
}
getPersonListCount = getViews.Count();
@@ -400,8 +400,8 @@ namespace BLL
OutResult = x.OutResult,
Telephone = x.Telephone,
PhotoUrl = x.PhotoUrl,
IsUsed = x.IsUsed,
IsUsedName = (x.IsUsed == true ? "启用" : "未启用"),
IsUsed = x.IsUsed==1?true:false,
IsUsedName = (x.IsUsed == 1 ? "启用" : "未启用"),
WorkAreaId = x.WorkAreaId,
WorkAreaName = UnitWorkService.GetUnitWorkName(x.WorkAreaId),
PostType = ReturnQuality(x.PersonId, x.WorkPostId),
@@ -464,6 +464,100 @@ namespace BLL
}
#endregion
#region
/// <summary>
/// 根据培训类型获取项目培训人员信息
/// </summary>
/// <param name="projectId">项目ID</param>
/// <param name="unitIds">培训单位ID</param>
/// <param name="departIds">培训岗位ID</param>
/// <param name="trainTypeId">培训类型ID</param>
/// <returns></returns>
public static List<Model.PersonItem> getTrainingPersonListByDepartAndTrainTypeId( string unitIds, string departIds, string trainTypeId)
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
List<string> unitIdList = Funs.GetStrListByStr(unitIds, ',');
var getPersons = from x in db.Sys_User
where unitIdList.Contains(x.UnitId)
select new Model.PersonItem
{
PersonId = x.UserId,
PersonName = x.UserName,
SexName = x.Sex,
IdentityCard = x.IdentityCard,
UnitId = x.UnitId,
WorkPostId = x.WorkPostId,
Telephone = x.Telephone,
PhotoUrl = x.PhotoUrl,
DepartId = x.DepartId
};
if (!string.IsNullOrEmpty(departIds))
{
List<string> departIdList = Funs.GetStrListByStr(departIds, ',');
getPersons = getPersons.Where(x => departIdList.Contains(x.DepartId));
}
foreach (var item in getPersons)
{
Model.Base_Unit unit = db.Base_Unit.FirstOrDefault(x => x.UnitId == item.UnitId);
if (!string.IsNullOrEmpty(item.UnitId))
{
if (unit != null)
{
item.UnitCode = unit.UnitCode;
item.UnitName = unit.UnitName;
}
}
if (!string.IsNullOrEmpty(item.DepartId))
{
Model.Base_Depart depart = db.Base_Depart.FirstOrDefault(x => x.DepartId == item.DepartId);
if (depart != null)
{
item.DepartName = depart.DepartName;
}
}
}
//List<Model.PersonItem> getTrainPersonList = new List<Model.PersonItem>();
//var getTrainType = db.Base_TrainType.FirstOrDefault(e => e.TrainTypeId == trainTypeId);
//if (getTrainType != null && (!getTrainType.IsRepeat.HasValue || getTrainType.IsRepeat == false))
//{
// foreach (var item in getPersons)
// {
// var getTrainPersonIdList1 = (from x in db.EduTrain_TrainRecordDetail
// join y in db.EduTrain_TrainRecord on x.TrainingId equals y.TrainingId
// where y.ProjectId ==null && y.TrainTypeId == trainTypeId && x.CheckResult == true && x.PersonId == item.PersonId
// select x).FirstOrDefault();
// if (getTrainPersonIdList1 == null)
// {
// var getTrainPersonIdList2 = (from x in db.Training_Task
// join y in db.Training_Plan on x.PlanId equals y.PlanId
// where y.ProjectId == null && y.TrainTypeId == trainTypeId && y.States != "3" && x.UserId == item.PersonId
// select x).FirstOrDefault();
// if (getTrainPersonIdList2 == null)
// {
// getTrainPersonList.Add(item);
// }
// }
// }
// return getTrainPersonList;
//}
//else
{
return getPersons.ToList();
}
}
}
#endregion
#region
/// <summary>
/// 根据培训类型获取项目培训人员信息
@@ -473,13 +567,13 @@ namespace BLL
/// <param name="workPostIds">培训岗位ID</param>
/// <param name="trainTypeId">培训类型ID</param>
/// <returns></returns>
public static List<Model.PersonItem> getTrainingPersonListByTrainTypeId(string projectId, string unitIds, string workPostIds, string trainTypeId)
public static List<Model.PersonItem> getTrainingPersonListByTrainTypeId(string projectId, string unitIds, string workPostIds, string departIds, string trainTypeId)
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
List<string> unitIdList = Funs.GetStrListByStr(unitIds, ',');
var getPersons = from x in db.View_SitePerson_Person
where x.ProjectId == projectId && unitIdList.Contains(x.UnitId) && x.IsUsed == true
where x.ProjectId == projectId && unitIdList.Contains(x.UnitId) && x.IsUsed == 1
&& x.InTime <= DateTime.Now && (!x.OutTime.HasValue || x.OutTime >= DateTime.Now)
select new Model.PersonItem
{
@@ -542,6 +636,11 @@ namespace BLL
}
}
}
#endregion
#region
@@ -626,11 +725,11 @@ namespace BLL
}
if (person.IsUsed == true)
{
newPerson.IsUsed = true;
newPerson.IsUsed = 1;
}
else
{
newPerson.IsUsed = false;
newPerson.IsUsed = 0;
}
newPerson.Password = PersonService.GetPersonPassWord(person.IdentityCard);
string rootUrl = ConfigurationManager.AppSettings["localRoot"];
@@ -703,13 +802,13 @@ namespace BLL
{
getPerson.WorkAreaId = person.WorkAreaId;
}
if (getPerson.AuditorDate.HasValue && getPerson.IsUsed == false)
if (getPerson.AuditorDate.HasValue && getPerson.IsUsed == 0)
{
getPerson.AuditorDate = null;
}
else
{
getPerson.IsUsed = person.IsUsed;
getPerson.IsUsed = person.IsUsed?1:0;
getPerson.AuditorDate = DateTime.Now;
}
getPerson.AuditorId = person.AuditorId;
@@ -1449,7 +1548,7 @@ namespace BLL
else message = "识别不到人脸";
if (isOK)
{
var faceResult = FaceClass.add(person.PersonId, person.IdentityCard, System.Configuration.ConfigurationManager.AppSettings["CEMS_IMG_URL"].ToString() + person.PhotoUrl, AccessToken.getAccessToken());
var faceResult = FaceClass.add(person.PersonId, person.IdentityCard, System.Configuration.ConfigurationManager.AppSettings["SGGLUrl"].ToString() + person.PhotoUrl, AccessToken.getAccessToken());
var face = JsonConvert.DeserializeObject<dynamic>(faceResult);
// JsonConvert.DeserializeObject<dynamic>(myPunishItem);
if (face.error_code == 0 || face.error_code == 223105)