1
This commit is contained in:
@@ -0,0 +1,170 @@
|
||||
using BLL;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Web.Http;
|
||||
|
||||
namespace WebAPI
|
||||
{
|
||||
/// <summary>
|
||||
/// 智能设备数据接收接口
|
||||
/// </summary>
|
||||
public class LOTController : ApiController
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 保存环境监测数据
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public Model.ResponeData SaveEnvironmentData(Model.EnvironmentalCheckInput input)
|
||||
{
|
||||
var responeData = new Model.ResponeData();
|
||||
try
|
||||
{
|
||||
if (BLL.APIProjectService.getProjectByProjectId(input.ProjectId)!=null)
|
||||
{
|
||||
responeData.data = LotAPIService.saveEnvironmentCheck(input);
|
||||
}
|
||||
else
|
||||
{
|
||||
responeData.code = 0;
|
||||
responeData.message = "此项目不存在!";
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
responeData.code = 0;
|
||||
responeData.message = ex.Message;
|
||||
}
|
||||
|
||||
return responeData;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 保存深基坑监测数据
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public Model.ResponeData SaveDeepPitCheckData(Model.DeepPitCheckInput input)
|
||||
{
|
||||
var responeData = new Model.ResponeData();
|
||||
try
|
||||
{
|
||||
if (BLL.APIProjectService.getProjectByProjectId(input.ProjectId) != null)
|
||||
{
|
||||
responeData.data = LotAPIService.saveDeepPitCheck(input);
|
||||
}
|
||||
else
|
||||
{
|
||||
responeData.code = 0;
|
||||
responeData.message = "此项目不存在!";
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
responeData.code = 0;
|
||||
responeData.message = ex.Message;
|
||||
}
|
||||
|
||||
return responeData;
|
||||
}
|
||||
/// <summary>
|
||||
/// 保存水电监测数据
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public Model.ResponeData SaveEnergyData(Model.EnergyInput input)
|
||||
{
|
||||
var responeData = new Model.ResponeData();
|
||||
try
|
||||
{
|
||||
if (BLL.APIProjectService.getProjectByProjectId(input.ProjectId) != null)
|
||||
{
|
||||
responeData.data = LotAPIService.saveWaterElectricityCheck(input);
|
||||
}
|
||||
else
|
||||
{
|
||||
responeData.code = 0;
|
||||
responeData.message = "此项目不存在!";
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
responeData.code = 0;
|
||||
responeData.message = ex.Message;
|
||||
}
|
||||
|
||||
return responeData;
|
||||
}
|
||||
/// <summary>
|
||||
/// 保存塔式起重机预警
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public Model.ResponeData SaveTowerCraneWarningData(Model.TowerCraneWarningInput input)
|
||||
{
|
||||
var responeData = new Model.ResponeData();
|
||||
try
|
||||
{
|
||||
if (BLL.APIProjectService.getProjectByProjectId(input.ProjectId) != null)
|
||||
{
|
||||
responeData.data = LotAPIService.saveTowerCraneWarning(input);
|
||||
}
|
||||
else
|
||||
{
|
||||
responeData.code = 0;
|
||||
responeData.message = "此项目不存在!";
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
responeData.code = 0;
|
||||
responeData.message = ex.Message;
|
||||
}
|
||||
|
||||
return responeData;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 保存车辆冲洗监测
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public Model.ResponeData SaveCarWashCheckIData(Model.CarWashCheckInput input)
|
||||
{
|
||||
var responeData = new Model.ResponeData();
|
||||
try
|
||||
{
|
||||
if (BLL.APIProjectService.getProjectByProjectId(input.ProjectId) != null)
|
||||
{
|
||||
responeData.data = LotAPIService.saveCarWashCheck(input);
|
||||
}
|
||||
else
|
||||
{
|
||||
responeData.code = 0;
|
||||
responeData.message = "此项目不存在!";
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
responeData.code = 0;
|
||||
responeData.message = ex.Message;
|
||||
}
|
||||
|
||||
return responeData;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,182 @@
|
||||
using BLL;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web.Http;
|
||||
|
||||
|
||||
namespace WebAPI
|
||||
{
|
||||
public class UnitHazardRegisterController : ApiController
|
||||
{
|
||||
// GET
|
||||
|
||||
#region 根据hazardRegisterId获取风险信息
|
||||
/// <summary>
|
||||
/// 根据hazardRegisterId获取风险信息
|
||||
/// </summary>
|
||||
/// <param name="hazardRegisterId"></param>
|
||||
/// <returns></returns>
|
||||
public Model.ResponeData getHazardRegisterByHazardRegisterId(string hazardRegisterId)
|
||||
{
|
||||
var responeData = new Model.ResponeData();
|
||||
try
|
||||
{
|
||||
responeData.data = BLL.APIUnitHazardRegisterService.getHazardRegisterByHazardRegisterId(hazardRegisterId);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
responeData.code = 0;
|
||||
responeData.message = ex.Message;
|
||||
}
|
||||
|
||||
return responeData;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 根据projectId、states获取风险信息
|
||||
/// <summary>
|
||||
/// 根据projectId、states获取风险信息
|
||||
/// </summary>
|
||||
/// <param name="projectId"></param>
|
||||
/// <param name="states"></param>
|
||||
/// <param name="pageIndex">页码</param>
|
||||
/// <returns></returns>
|
||||
public Model.ResponeData getHazardRegisterByProjectIdStates(string projectId, string states, int pageIndex)
|
||||
{
|
||||
var responeData = new Model.ResponeData();
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrEmpty(projectId) || projectId.Length == 0)
|
||||
{
|
||||
projectId = null;
|
||||
}
|
||||
List<Model.HazardRegisterItem> getDataList = new List<Model.HazardRegisterItem>();
|
||||
int pageCount = Funs.DB.HSSE_Hazard_HazardRegister.Count(x => (x.ProjectId == projectId || projectId == null) && (x.States == states || states == null));
|
||||
if (pageCount > 0 && pageIndex > 0)
|
||||
{
|
||||
getDataList = APIUnitHazardRegisterService.getHazardRegisterByProjectIdStates(projectId, states, pageIndex);
|
||||
}
|
||||
responeData.data = new { pageCount, getDataList };
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
responeData.code = 0;
|
||||
responeData.message = ex.Message;
|
||||
}
|
||||
|
||||
return responeData;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 根据projectId获取各状态风险数
|
||||
/// <summary>
|
||||
/// 根据projectId获取各状态风险数
|
||||
/// </summary>
|
||||
/// <param name="projectId"></param>
|
||||
/// <returns></returns>
|
||||
public Model.ResponeData getHazardRegisterCount(string projectId)
|
||||
{
|
||||
var responeData = new Model.ResponeData();
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrEmpty(projectId) || projectId.Length == 0)
|
||||
{
|
||||
projectId = null;
|
||||
}
|
||||
//总数
|
||||
var getDataList = Funs.DB.HSSE_Hazard_HazardRegister.Where(x => (x.ProjectId == projectId || projectId == null));
|
||||
int tatalCount = getDataList.Count();
|
||||
//待整改
|
||||
int count1 = getDataList.Where(x => x.States == "1").Count();
|
||||
//待确认
|
||||
int count2 = getDataList.Where(x => x.States == "2").Count();
|
||||
//已闭环
|
||||
int count3 = getDataList.Where(x => x.States == "3").Count();
|
||||
//已作废
|
||||
int count4 = getDataList.Where(x => x.States == "4").Count();
|
||||
|
||||
responeData.data = new { tatalCount, count1, count2, count3, count4 };
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
responeData.code = 0;
|
||||
responeData.message = ex.Message;
|
||||
}
|
||||
|
||||
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 = APIUnitHazardRegisterService.getHazardRegisterByProjectIdStates(pageIndex);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
responeData.code = 0;
|
||||
responeData.message = ex.Message;
|
||||
}
|
||||
|
||||
return responeData;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 保存HazardRegister
|
||||
/// <summary>
|
||||
/// 保存HazardRegister
|
||||
/// </summary>
|
||||
/// <param name="hazardRegister"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
|
||||
public Model.ResponeData SaveHazardRegister([FromBody] Model.HazardRegisterItem hazardRegister)
|
||||
{
|
||||
var responeData = new Model.ResponeData();
|
||||
try
|
||||
{
|
||||
BLL.APIUnitHazardRegisterService.SaveHazardRegister(hazardRegister);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
responeData.code = 0;
|
||||
responeData.message = ex.Message;
|
||||
}
|
||||
|
||||
return responeData;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user