20230606新增费用申请页面、项目列表按活跃度排序

This commit is contained in:
2023-06-06 17:01:34 +08:00
parent 5984687629
commit e4871bc690
105 changed files with 63242 additions and 2216 deletions
+72 -16
View File
@@ -1,8 +1,10 @@
namespace BLL
{
using Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
public static class ProjectService
{
@@ -272,31 +274,85 @@
orderby x.ProjectCode descending
select x).ToList();
}
List<Model.Base_Project> getLists = new List<Model.Base_Project>();
var getUser = Person_PersonsService.GetPerson_PersonsById(userId);
if (getUser != null)
if (getUser != null && !string.IsNullOrEmpty(getUser.Account))
{
List<string> roleidList = Funs.GetStrListByStr(getUser.RoleIds, ',');
/// 获取角色类型
var getRoleP = Funs.DB.Sys_RolePower.FirstOrDefault(x => roleidList.Contains(x.RoleId) && x.IsOffice == false);
if (getRoleP != null)
//List<string> roleidList = Funs.GetStrListByStr(getUser.RoleIds, ',');
///// 获取角色类型
//var getRoleP = Funs.DB.Sys_RolePower.FirstOrDefault(x => roleidList.Contains(x.RoleId) && x.IsOffice == false);
if (getUser.IsOffice == true)
{
return (from x in Funs.DB.Base_Project
where x.ProjectState == null || x.ProjectState == BLL.Const.ProjectState_1
orderby x.ProjectCode descending
select x).ToList();
getLists = (from x in Funs.DB.Base_Project
where x.ProjectState == null || x.ProjectState == BLL.Const.ProjectState_1
orderby x.ProjectCode descending
select x).ToList();
}
else
{
return (from x in Funs.DB.Base_Project
join y in Funs.DB.SitePerson_Person on x.ProjectId equals y.ProjectId
where x.ProjectState == null || x.ProjectState == BLL.Const.ProjectState_1 && y.PersonId == userId
orderby x.ProjectCode descending
select x).ToList();
var getProjectIdList = Funs.DB.SitePerson_Person.Where(x => x.PersonId == userId && x.RoleIds != null).Select(x => x.ProjectId);
if (getProjectIdList.Count() > 0)
{
getLists = (from x in Funs.DB.Base_Project
where x.ProjectState == null || x.ProjectState == BLL.Const.ProjectState_1 && getProjectIdList.Contains(x.ProjectId)
orderby x.ProjectCode descending
select x).ToList();
}
}
}
else
return getLists;
}
/// <summary>
/// 获取userId参与项目下拉框 -- 按操作频率排序
/// </summary>
/// <returns></returns>
public static List<Model.Base_Project> GetSortIndexProjectByUserIdDropDownList(string userId)
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
return null;
IQueryable<Model.Base_Project> getProjects = null;
getProjects = from x in db.Base_Project
where x.ProjectState == null || x.ProjectState == BLL.Const.ProjectState_1
select x;
if (userId != Const.sysglyId && userId != Const.hfnbdId && userId != Const.sedinId)
{
var getUser = Person_PersonsService.GetPerson_PersonsById(userId);
if (getUser != null && !string.IsNullOrEmpty(getUser.Account))
{
//List<string> roleidList = Funs.GetStrListByStr(getUser.RoleIds, ',');
///// 获取角色类型
//var getRoleP = db.Sys_RolePower.FirstOrDefault(x => roleidList.Contains(x.RoleId) && x.IsOffice == false);
if (getUser.IsOffice != true)
{
var getProjectIdList = db.SitePerson_Person.Where(x => x.PersonId == userId && x.RoleIds != null).Select(x => x.ProjectId);
if (getProjectIdList.Count() > 0)
{
getProjects = getProjects.Where(x => getProjectIdList.Contains(x.ProjectId));
}
}
}
}
var pcount = from x in db.Sys_Log
where x.ProjectId != null && x.OperationTime > DateTime.Now.AddDays(-3)
group x by x.ProjectId into g
select new { g.First().ProjectId, count = g.Count() };
List<Model.Base_Project> getList = new List<Base_Project>();
if (getProjects.Count() > 0)
{
getList = (from x in getProjects
join y in pcount on x.ProjectId equals y.ProjectId into PP
from p in PP.DefaultIfEmpty()
orderby p.count descending
select x).ToList();
}
return getList;
}
}