Merge branch 'master' of https://gitee.com/frane-yang/SGGL_SeDin_New
This commit is contained in:
commit
cdec29792f
|
|
@ -133,5 +133,51 @@ namespace BLL
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 安全巡检
|
||||
/// </summary>
|
||||
/// <param name="pageIndex"></param>
|
||||
/// <returns></returns>
|
||||
public static List<Model.HazardRegisterItem> getHazardRegisterByProjectIdStates(int pageIndex)
|
||||
{
|
||||
string unitName = null, unitId = null;
|
||||
var getUnit = CommonService.GetIsThisUnit();
|
||||
if (getUnit != null)
|
||||
{
|
||||
unitId = getUnit.UnitId;
|
||||
unitName = getUnit.UnitName;
|
||||
}
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
var hazardRegisters = (from x in db.HSSE_Hazard_HazardRegister
|
||||
join y in db.Base_Project on x.ProjectId equals y.ProjectId
|
||||
join u in db.Base_Unit on x.ResponsibleUnit equals u.UnitId
|
||||
where x.ProjectId != null && x.States != null
|
||||
select new Model.HazardRegisterItem
|
||||
{
|
||||
HazardRegisterId = x.HazardRegisterId,
|
||||
ProjectId = x.ProjectId,
|
||||
ProjectName = y.ProjectName,
|
||||
ProjectAddress = y.ProjectAddress,
|
||||
UnitId = unitId,
|
||||
UnitName = unitName,
|
||||
PUnitId = y.UnitId,
|
||||
PUnitName = db.Base_Unit.First(U => y.UnitId == U.UnitId).UnitName,
|
||||
States = x.States,
|
||||
WorkAreaName = db.WBS_UnitWork.First(w => x.Place == w.UnitWorkId).UnitWorkName,
|
||||
CheckTime = x.CheckTime,
|
||||
RegisterDef = x.RegisterDef,
|
||||
RegisterTypesName = db.HSSE_Hazard_HazardRegisterTypes.First(T => x.RegisterTypesId == T.RegisterTypesId).RegisterTypesName,
|
||||
Rectification = x.Rectification,
|
||||
ResponsibilityUnitName = db.Base_Unit.First(U => x.ResponsibleUnit == U.UnitId).UnitName,
|
||||
ResponsibilityManName = "",
|
||||
RectificationTime = x.RectificationTime,
|
||||
Risk_Level = (x.HazardValue =="3"?"重大":"一般"),
|
||||
|
||||
}).OrderBy(x => x.CheckTime).Skip(Funs.PageSize * (pageIndex - 1)).Take(Funs.PageSize).ToList();
|
||||
return hazardRegisters;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3392,7 +3392,6 @@
|
|||
<Compile Include="res\umeditor\net\Uploader.cs" />
|
||||
<Compile Include="ZHGL\Plan\ActionPlanListEdit.aspx.cs">
|
||||
<DependentUpon>ActionPlanListEdit.aspx</DependentUpon>
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Compile>
|
||||
<Compile Include="ZHGL\Plan\ActionPlanListEdit.aspx.designer.cs">
|
||||
<DependentUpon>ActionPlanListEdit.aspx</DependentUpon>
|
||||
|
|
|
|||
|
|
@ -28,6 +28,46 @@ namespace Model
|
|||
get;
|
||||
set;
|
||||
}
|
||||
/// <summary>
|
||||
/// 单位ID
|
||||
/// </summary>
|
||||
public string UnitId
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
/// <summary>
|
||||
/// 单位名称
|
||||
/// </summary>
|
||||
public string UnitName
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
/// <summary>
|
||||
/// 项目单位ID
|
||||
/// </summary>
|
||||
public string PUnitId
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
/// <summary>
|
||||
/// 项目单位名称
|
||||
/// </summary>
|
||||
public string PUnitName
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
/// <summary>
|
||||
/// 项目名称
|
||||
/// </summary>
|
||||
public string ProjectAddress
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 状态
|
||||
|
|
@ -391,5 +431,14 @@ namespace Model
|
|||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 风险等级
|
||||
/// </summary>
|
||||
public string Risk_Level
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -123,5 +123,51 @@ namespace WebAPI.Controllers
|
|||
return responeData;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 获取总安全巡检
|
||||
/// <summary>
|
||||
/// 获取总安全巡检
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Model.ResponeData getHazardRegisterTotalCount()
|
||||
{
|
||||
var responeData = new Model.ResponeData();
|
||||
try
|
||||
{
|
||||
//总数
|
||||
responeData.data = Funs.DB.HSSE_Hazard_HazardRegister.Where(x => x.ProjectId != null && x.States != null).Count();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
responeData.code = 0;
|
||||
responeData.message = ex.Message;
|
||||
}
|
||||
|
||||
return responeData;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 获取总安全巡检
|
||||
/// <summary>
|
||||
/// 获取总安全巡检
|
||||
/// </summary>
|
||||
/// <param name="pageIndex">页码</param>
|
||||
/// <returns></returns>
|
||||
public Model.ResponeData getHazardRegisterByProjectIdStates(int pageIndex)
|
||||
{
|
||||
var responeData = new Model.ResponeData();
|
||||
try
|
||||
{
|
||||
responeData.data = APIHazardRegisterService.getHazardRegisterByProjectIdStates(pageIndex);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
responeData.code = 0;
|
||||
responeData.message = ex.Message;
|
||||
}
|
||||
|
||||
return responeData;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ namespace WebAPI.Filter
|
|||
{
|
||||
isOk = true;
|
||||
}
|
||||
|
||||
bool isWithOut = false;
|
||||
if (!isOk && token != null)
|
||||
{
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(BLL.Funs.ConnString))
|
||||
|
|
@ -34,29 +34,34 @@ namespace WebAPI.Filter
|
|||
if (getUser != null)
|
||||
{
|
||||
isOk = true;
|
||||
isWithOut = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
// base.OnActionExecuting(actionContext);
|
||||
if (isOk)
|
||||
{ // 在调用 Action 方法之前执行的代码,可获取请求的接口名称和参数
|
||||
IDictionary<string, object> arguments = actionContext.ActionArguments; // 获取参数
|
||||
foreach (KeyValuePair<string, object> item in arguments)
|
||||
{
|
||||
if (!isWithOut)
|
||||
{
|
||||
if (item.Key == "projectid" || item.Key == "ProjectId" || item.Key == "projectId" || item.Key == "Projectid")
|
||||
// 在调用 Action 方法之前执行的代码,可获取请求的接口名称和参数
|
||||
IDictionary<string, object> arguments = actionContext.ActionArguments; // 获取参数
|
||||
foreach (KeyValuePair<string, object> item in arguments)
|
||||
{
|
||||
var ProjectItems = APIProjectService.geProjectsByUserId(token.FirstOrDefault());
|
||||
List<string> projects = new List<string>();
|
||||
if (ProjectItems.Count > 0)
|
||||
{
|
||||
projects = ProjectItems.Select(x => x.ProjectId).ToList();
|
||||
}
|
||||
if (item.Value != null && !projects.Contains(item.Value.ToString()))
|
||||
if (item.Key == "projectid" || item.Key == "ProjectId" || item.Key == "projectId" || item.Key == "Projectid")
|
||||
{
|
||||
var ProjectItems = APIProjectService.geProjectsByUserId(token.FirstOrDefault());
|
||||
List<string> projects = new List<string>();
|
||||
if (ProjectItems.Count > 0)
|
||||
{
|
||||
projects = ProjectItems.Select(x => x.ProjectId).ToList();
|
||||
}
|
||||
if (item.Value != null && !projects.Contains(item.Value.ToString()))
|
||||
{
|
||||
|
||||
actionContext.Response = actionContext.Request.CreateResponse(System.Net.HttpStatusCode.OK,
|
||||
new { code = "0", message = "您没有该项目权限!" }, actionContext.ControllerContext.Configuration.Formatters.JsonFormatter);
|
||||
return;
|
||||
actionContext.Response = actionContext.Request.CreateResponse(System.Net.HttpStatusCode.OK,
|
||||
new { code = "0", message = "您没有该项目权限!" }, actionContext.ControllerContext.Configuration.Formatters.JsonFormatter);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -72,7 +77,7 @@ namespace WebAPI.Filter
|
|||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public static List<string> lists = new List<string> { "User*postLoginOn" };
|
||||
public static List<string> lists = new List<string> { "User*postLoginOn", "HazardRegister*getHazardRegisterCount", "HazardRegister*getHazardRegisterByProjectIdStates" };
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
|
|
|
|||
Loading…
Reference in New Issue