应急预案
parent
08148c093e
commit
3f5ba61410
|
|
@ -616,7 +616,7 @@ namespace OpenAuth.App
|
|||
{
|
||||
using (var uow = base.UnitWork.CreateContext())
|
||||
{
|
||||
foreach (var item in uow.Db.DbMaintenance.GetTableInfoList().Where(r => r.Name.ToLower().StartsWith("fm_camera") ))
|
||||
foreach (var item in uow.Db.DbMaintenance.GetTableInfoList().Where(r => r.Name.ToLower().StartsWith("fm_preventionplan") ))
|
||||
{
|
||||
string entityName = item.Name.Substring(0, 1).ToUpper() + item.Name.Substring(1, 1).ToLower() + item.Name.Substring(3, 1).ToUpper() + item.Name.Substring(4).ToLower();/*实体名大写*/
|
||||
// string entityName = "DroneCaseInfoSTHX";
|
||||
|
|
@ -626,7 +626,7 @@ namespace OpenAuth.App
|
|||
// db.MappingColumns.Add(col.DbColumnName.ToUpper() /*类的属性大写*/, col.DbColumnName, entityName);
|
||||
//}
|
||||
}
|
||||
uow.Db.DbFirst.Where(r => r.ToLower().StartsWith("fm_camera")).IsCreateAttribute().CreateClassFile("E:\\森林防火数据维护\\code\\OpenAuth.Repository\\Domain", "OpenAuth.Repository.Domain");
|
||||
uow.Db.DbFirst.Where(r => r.ToLower().StartsWith("fm_preventionplan")).IsCreateAttribute().CreateClassFile("E:\\森林防火数据维护\\code\\OpenAuth.Repository\\Domain", "OpenAuth.Repository.Domain");
|
||||
uow.Commit();
|
||||
}
|
||||
return "更新实体成功";
|
||||
|
|
|
|||
|
|
@ -0,0 +1,75 @@
|
|||
using OpenAuth.App.BaseApp.Base;
|
||||
using OpenAuth.Repository.Domain.FireManagement;
|
||||
using OpenAuth.Repository;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using OpenAuth.Repository.Domain;
|
||||
using Microsoft.Extensions.Options;
|
||||
using OpenAuth.App.Common;
|
||||
using OpenAuth.App.Interface;
|
||||
using SqlSugar;
|
||||
using System.Net.WebSockets;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Infrastructure;
|
||||
using OpenAuth.App.ServiceApp.FireManagement.Request;
|
||||
using OpenAuth.App.ServiceApp.FmPreventionPlanManage.Request;
|
||||
|
||||
namespace OpenAuth.App.ServiceApp.FmPreventionPlanManage
|
||||
{
|
||||
public class FmPreventionPlanApp : SqlSugarBaseApp<FmPreventionplan, SugarDbContext>
|
||||
{
|
||||
|
||||
private ClientWebSocket _socket;
|
||||
private IConfiguration _configuration;
|
||||
|
||||
public FmPreventionPlanApp(IConfiguration configuration, ISugarUnitOfWork<SugarDbContext> unitWork,ISimpleClient<FmPreventionplan> repository, IAuth auth) : base(unitWork, repository, auth)
|
||||
{
|
||||
_auth = auth;
|
||||
_configuration = configuration;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 分页查询预案列表
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<Response<PageInfo<List<FmPreventionplan>>>> GetPreventionplanPageList(FmPreventionplanReq req)
|
||||
{
|
||||
using (var db = base.UnitWork.CreateContext())
|
||||
{
|
||||
RefAsync<int> totalNumber = 0;
|
||||
var infos = await db.FmPreventionplan.AsQueryable()
|
||||
.WhereIF(req.state != null, r => r.Status == req.state)
|
||||
.WhereIF(req.plancategory != null, r => r.PlanCategory == req.plancategory)
|
||||
.WhereIF(req.createtimebegin != null && req.createtimeend != null, r => r.CreateTime >= req.createtimebegin && r.CreateTime <= req.createtimeend)
|
||||
.WhereIF(!string.IsNullOrEmpty(req.name), r => r.PlanName.Contains(req.name))
|
||||
.WhereIF(!string.IsNullOrEmpty(req.code), r => r.PlanCode.Contains(req.code))
|
||||
.ToPageListAsync(req.page, req.limit, totalNumber);
|
||||
return new Response<PageInfo<List<FmPreventionplan>>>
|
||||
{
|
||||
Result = new PageInfo<List<FmPreventionplan>> { Items = infos, Total = totalNumber }
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 查询应急预案详情
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<Response<FmPreventionplan>> LoadClueInfoById(string id)
|
||||
{
|
||||
using (var db = base.UnitWork.CreateContext())
|
||||
{
|
||||
var info = await db.FmPreventionplan.AsQueryable()
|
||||
.FirstAsync(r => r.Id == id);
|
||||
return new Response<FmPreventionplan> { Result = info };
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OpenAuth.App.ServiceApp.FmPreventionPlanManage.Request
|
||||
{
|
||||
public class FmPreventionplanReq
|
||||
{
|
||||
//当前页
|
||||
public int page { get; set; }
|
||||
//每页条数
|
||||
public int limit { get; set; }
|
||||
//预案名称
|
||||
public string name { get; set; }
|
||||
//预案编号
|
||||
public string code { get; set; }
|
||||
//预案状态,0草稿,1生效,2过期
|
||||
public int? state { get; set; }
|
||||
//预案类型 0总体应急预案、1专项应急预案、2部门预案
|
||||
public int? plancategory { get; set; }
|
||||
//创建时间开始时间
|
||||
public DateTime? createtimebegin { get; set; }
|
||||
//创建时间结束时间
|
||||
public DateTime? createtimeend { get; set; }
|
||||
|
||||
public FmPreventionplanReq()
|
||||
{
|
||||
page = 1;
|
||||
limit = 10;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,146 @@
|
|||
using System;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using SqlSugar;
|
||||
|
||||
namespace OpenAuth.Repository.Domain
|
||||
{
|
||||
///<summary>
|
||||
///防火应急预案表
|
||||
///</summary>
|
||||
[SugarTable("fm_preventionplan")]
|
||||
public partial class FmPreventionplan
|
||||
{
|
||||
public FmPreventionplan(){
|
||||
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// Desc:主键
|
||||
/// Default:
|
||||
/// Nullable:False
|
||||
/// </summary>
|
||||
[SugarColumn(IsPrimaryKey=true)]
|
||||
public string Id {get;set;}
|
||||
|
||||
/// <summary>
|
||||
/// Desc:预案名称
|
||||
/// Default:
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string PlanName {get;set;}
|
||||
|
||||
/// <summary>
|
||||
/// Desc:预案编号
|
||||
/// Default:
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string PlanCode {get;set;}
|
||||
|
||||
/// <summary>
|
||||
/// Desc:预案类别(0总体应急预案、1专项应急预案、2部门预案)
|
||||
/// Default:
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public int? PlanCategory {get;set;}
|
||||
|
||||
/// <summary>
|
||||
/// Desc:行政级别(省、市、区县、乡镇)
|
||||
/// Default:
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string AdmLevel {get;set;}
|
||||
|
||||
/// <summary>
|
||||
/// Desc:预案描述
|
||||
/// Default:
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string Description {get;set;}
|
||||
|
||||
/// <summary>
|
||||
/// Desc:预案内容
|
||||
/// Default:
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string Content {get;set;}
|
||||
|
||||
/// <summary>
|
||||
/// Desc:预案状态(0草稿,1生效,2过期)
|
||||
/// Default:
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public int? Status {get;set;}
|
||||
|
||||
/// <summary>
|
||||
/// Desc:预案版本
|
||||
/// Default:
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string Version {get;set;}
|
||||
|
||||
/// <summary>
|
||||
/// Desc:编制单位
|
||||
/// Default:
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string WriteUnit {get;set;}
|
||||
|
||||
/// <summary>
|
||||
/// Desc:编制时间
|
||||
/// Default:
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public DateTime? CreateTime {get;set;}
|
||||
|
||||
/// <summary>
|
||||
/// Desc:创建人
|
||||
/// Default:
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string CreateUser {get;set;}
|
||||
|
||||
/// <summary>
|
||||
/// Desc:生效日期
|
||||
/// Default:
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public DateTime? EffectiveDate {get;set;}
|
||||
|
||||
/// <summary>
|
||||
/// Desc:失效日期
|
||||
/// Default:
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public DateTime? expiry_date {get;set;}
|
||||
|
||||
/// <summary>
|
||||
/// Desc:具体负责人的姓名
|
||||
/// Default:
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string ResponsiblePerson {get;set;}
|
||||
|
||||
/// <summary>
|
||||
/// Desc:责任人联系电话
|
||||
/// Default:
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string Contact {get;set;}
|
||||
|
||||
/// <summary>
|
||||
/// Desc:预案附件
|
||||
/// Default:
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string Attachment {get;set;}
|
||||
|
||||
/// <summary>
|
||||
/// Desc:备注
|
||||
/// Default:
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string Remarks {get;set;}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -85,6 +85,7 @@ namespace OpenAuth.Repository
|
|||
public SugarRepositiry<FmSiteUser> FmSiteUser { get; set; }
|
||||
public SugarRepositiry<FmCamera> FmCamera { get; set; }
|
||||
public SugarRepositiry<FmCamera_yjj> FmCamera_yjj { get; set; }
|
||||
public SugarRepositiry<FmPreventionplan> FmPreventionplan { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,72 @@
|
|||
using Infrastructure;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using OpenAuth.App.ServiceApp.FireManagement;
|
||||
using OpenAuth.App.ServiceApp.FireManagement.Request;
|
||||
using OpenAuth.App.ServiceApp.FmPreventionPlanManage;
|
||||
using OpenAuth.App.ServiceApp.FmPreventionPlanManage.Request;
|
||||
using OpenAuth.Repository.Domain;
|
||||
using OpenAuth.Repository.Domain.FireManagement;
|
||||
|
||||
namespace OpenAuth.WebApi.Controllers.ServiceControllers.FireManagement
|
||||
{
|
||||
/// <summary>
|
||||
/// 防火应急预案模块
|
||||
/// </summary>
|
||||
[Route("api/[controller]/[action]")]
|
||||
[ApiController]
|
||||
public class FmPreventionPlanController : ControllerBase
|
||||
{
|
||||
private readonly FmPreventionPlanApp _app;
|
||||
|
||||
public FmPreventionPlanController(FmPreventionPlanApp app)
|
||||
{
|
||||
_app = app;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 分页查询防火应急预案列表
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[AllowAnonymous]
|
||||
public async Task<Response<PageInfo<List<FmPreventionplan>>>> GetPreventionplanPageList([FromQuery] FmPreventionplanReq req)
|
||||
{
|
||||
Response<PageInfo<List<FmPreventionplan>>> response = new Response<PageInfo<List<FmPreventionplan>>>();
|
||||
try
|
||||
{
|
||||
return await _app.GetPreventionplanPageList(req);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
response.Code = 500;
|
||||
response.Message = ex.InnerException?.Message ?? ex.Message;
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 查询应急预案详情
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[AllowAnonymous]
|
||||
public async Task<Response<FmPreventionplan>> LoadClueInfoById(string id)
|
||||
{
|
||||
Response<FmPreventionplan> response = new Response<FmPreventionplan>();
|
||||
try
|
||||
{
|
||||
return await _app.LoadClueInfoById(id);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
response.Code = 500;
|
||||
response.Message = ex.InnerException?.Message ?? ex.Message;
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue