This commit is contained in:
李鹏飞 2026-04-07 18:54:22 +08:00
parent 040efd5b4a
commit 89ff7db623
3 changed files with 105 additions and 1 deletions

View File

@ -648,6 +648,88 @@ namespace BLL
}
}
}
public static List<Model.PersonItem> getTrainingPersonListByTrainTypeId(string projectId, string unitIds, string workPostIds, string trainTypeId, string name)
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
var getPersons = from x in db.View_SitePerson_Person
where x.ProjectId == projectId && x.States == Const.ProjectPersonStates_1
select new Model.PersonItem
{
SitePersonId = x.SitePersonId,
PersonId = x.PersonId,
CardNo = x.CardNo,
PersonName = x.PersonName,
SexName = x.SexName,
IdentityCard = x.IdentityCard,
Address = x.Address,
ProjectId = x.ProjectId,
ProjectCode = x.ProjectCode,
ProjectName = x.ProjectName,
UnitId = x.UnitId,
UnitCode = x.UnitCode,
UnitName = x.UnitName,
TeamGroupId = x.TeamGroupId,
TeamGroupName = x.TeamGroupName,
WorkPostId = x.WorkPostId,
WorkPostName = x.WorkPostName,
InTime = string.Format("{0:yyyy-MM-dd}", x.InTime),
OutTime = string.Format("{0:yyyy-MM-dd}", x.OutTime),
OutResult = x.OutResult,
Telephone = x.Telephone,
PhotoUrl = x.PhotoUrl,
DepartName = x.DepartName,
};
if (!string.IsNullOrEmpty(unitIds))
{
List<string> unitIdList = Funs.GetStrListByStr(unitIds, ',');
getPersons = getPersons.Where(x => unitIdList.Contains(x.UnitId));
}
if (!string.IsNullOrEmpty(workPostIds))
{
List<string> workPostIdList = Funs.GetStrListByStr(workPostIds, ',');
getPersons = getPersons.Where(x => workPostIdList.Contains(x.WorkPostId));
}
if (!string.IsNullOrEmpty(name))
{
getPersons = getPersons.Where(x => x.PersonName.Contains(name));
}
List<Model.PersonItem> getTrainPersonList = new List<Model.PersonItem>();
var getTrainType = TrainTypeService.GetTrainTypeById(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 == projectId && 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 == projectId && 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

View File

@ -17019,7 +17019,7 @@
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v15.0\WebApplications\Microsoft.WebApplication.targets" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v18.0\WebApplications\Microsoft.WebApplication.targets" />
<ProjectExtensions>
<VisualStudio>

View File

@ -404,6 +404,28 @@ namespace WebAPI.Controllers
return responeData;
}
public Model.ResponeData getTrainingPersonListByTrainTypeId(string projectId, string unitIds, string workPostIds, string trainTypeId, int pageIndex)
{
var responeData = new Model.ResponeData();
try
{
var getDataList = APIPersonService.getTrainingPersonListByTrainTypeId(projectId, unitIds, workPostIds, trainTypeId, null).OrderBy(x => x.UnitName).ThenBy(x => x.ProjectName).ToList();
int pageCount = getDataList.Count;
if (pageCount > 0 && pageIndex > 0)
{
getDataList = getDataList.OrderBy(u => u.UnitName).ThenBy(u => u.PersonName).Skip(Funs.PageSize * (pageIndex - 1)).Take(Funs.PageSize).ToList(); ////200 ->Funs.PageSize
}
responeData.data = new { pageCount, getDataList };
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
/// <summary>
///
/// </summary>