8efe030f47
为收敛当前分支代码范围并统一人员服务目录,移除历史模块与静态资源,减少无效代码和目录分散带来的维护成本。
57 lines
1.8 KiB
C#
57 lines
1.8 KiB
C#
using BLL;
|
|
using System;
|
|
using System.Linq;
|
|
using System.Web.Http;
|
|
|
|
namespace WebAPI.Controllers
|
|
{
|
|
/// <summary>
|
|
/// 人员首页数据
|
|
/// </summary>
|
|
public class PageDataController : ApiController
|
|
{
|
|
/// <summary>
|
|
/// 获取当天入场人数。
|
|
/// </summary>
|
|
public Model.ResponeData getPageDataInPersonCoutt(string projectId)
|
|
{
|
|
var responeData = new Model.ResponeData();
|
|
try
|
|
{
|
|
var getPrsonLists = Funs.DB.SitePerson_PersonInOutNow.Where(x => x.ProjectId == projectId && x.IsIn == true
|
|
&& x.ChangeTime.Value.Year == DateTime.Now.Year && x.ChangeTime.Value.Month == DateTime.Now.Month
|
|
&& x.ChangeTime.Value.Day == DateTime.Now.Day);
|
|
int personCout = getPrsonLists.Select(x => x.PersonId).Distinct().Count();
|
|
responeData.data = new { personCout };
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
responeData.code = 0;
|
|
responeData.message = ex.Message;
|
|
}
|
|
|
|
return responeData;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取项目当前在场人数。
|
|
/// </summary>
|
|
public Model.ResponeData getPersonNum(string projectId)
|
|
{
|
|
var responeData = new Model.ResponeData();
|
|
try
|
|
{
|
|
int sitePersonNum = APIPageDataService.getPersonNum(projectId, DateTime.Now).Count();
|
|
responeData.data = new { SitePersonNum = sitePersonNum };
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
responeData.code = 0;
|
|
responeData.message = ex.Message;
|
|
}
|
|
|
|
return responeData;
|
|
}
|
|
}
|
|
}
|