From 3f5ba6141074363940d9304a97a4221ee50eb1b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B4=81=20=E4=BB=BB?= Date: Wed, 14 Jan 2026 16:50:40 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BA=94=E6=80=A5=E9=A2=84=E6=A1=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BaseApp/UserManager/UserManagerApp.cs | 4 +- .../FmPreventionPlanApp.cs | 75 +++++++++ .../Request/FmPreventionplanReq.cs | 34 ++++ .../Domain/FmPreventionplan.cs | 146 ++++++++++++++++++ OpenAuth.Repository/SugarDbContext.cs | 1 + .../FmPreventionPlanController.cs | 72 +++++++++ 6 files changed, 330 insertions(+), 2 deletions(-) create mode 100644 OpenAuth.App/ServiceApp/FmPreventionPlanManage/FmPreventionPlanApp.cs create mode 100644 OpenAuth.App/ServiceApp/FmPreventionPlanManage/Request/FmPreventionplanReq.cs create mode 100644 OpenAuth.Repository/Domain/FmPreventionplan.cs create mode 100644 OpenAuth.WebApi/Controllers/ServiceControllers/FireManagement/FmPreventionPlanController.cs diff --git a/OpenAuth.App/BaseApp/UserManager/UserManagerApp.cs b/OpenAuth.App/BaseApp/UserManager/UserManagerApp.cs index 0862391..41a98da 100644 --- a/OpenAuth.App/BaseApp/UserManager/UserManagerApp.cs +++ b/OpenAuth.App/BaseApp/UserManager/UserManagerApp.cs @@ -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 "更新实体成功"; diff --git a/OpenAuth.App/ServiceApp/FmPreventionPlanManage/FmPreventionPlanApp.cs b/OpenAuth.App/ServiceApp/FmPreventionPlanManage/FmPreventionPlanApp.cs new file mode 100644 index 0000000..25a0ae2 --- /dev/null +++ b/OpenAuth.App/ServiceApp/FmPreventionPlanManage/FmPreventionPlanApp.cs @@ -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 + { + + private ClientWebSocket _socket; + private IConfiguration _configuration; + + public FmPreventionPlanApp(IConfiguration configuration, ISugarUnitOfWork unitWork,ISimpleClient repository, IAuth auth) : base(unitWork, repository, auth) + { + _auth = auth; + _configuration = configuration; + } + + /// + /// 分页查询预案列表 + /// + /// + public async Task>>> GetPreventionplanPageList(FmPreventionplanReq req) + { + using (var db = base.UnitWork.CreateContext()) + { + RefAsync 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>> + { + Result = new PageInfo> { Items = infos, Total = totalNumber } + }; + } + } + + + /// + /// 查询应急预案详情 + /// + /// + /// + public async Task> LoadClueInfoById(string id) + { + using (var db = base.UnitWork.CreateContext()) + { + var info = await db.FmPreventionplan.AsQueryable() + .FirstAsync(r => r.Id == id); + return new Response { Result = info }; + } + } + + + } +} diff --git a/OpenAuth.App/ServiceApp/FmPreventionPlanManage/Request/FmPreventionplanReq.cs b/OpenAuth.App/ServiceApp/FmPreventionPlanManage/Request/FmPreventionplanReq.cs new file mode 100644 index 0000000..4856414 --- /dev/null +++ b/OpenAuth.App/ServiceApp/FmPreventionPlanManage/Request/FmPreventionplanReq.cs @@ -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; + } + } +} diff --git a/OpenAuth.Repository/Domain/FmPreventionplan.cs b/OpenAuth.Repository/Domain/FmPreventionplan.cs new file mode 100644 index 0000000..8307e04 --- /dev/null +++ b/OpenAuth.Repository/Domain/FmPreventionplan.cs @@ -0,0 +1,146 @@ +using System; +using System.Linq; +using System.Text; +using SqlSugar; + +namespace OpenAuth.Repository.Domain +{ + /// + ///防火应急预案表 + /// + [SugarTable("fm_preventionplan")] + public partial class FmPreventionplan + { + public FmPreventionplan(){ + + + } + /// + /// Desc:主键 + /// Default: + /// Nullable:False + /// + [SugarColumn(IsPrimaryKey=true)] + public string Id {get;set;} + + /// + /// Desc:预案名称 + /// Default: + /// Nullable:True + /// + public string PlanName {get;set;} + + /// + /// Desc:预案编号 + /// Default: + /// Nullable:True + /// + public string PlanCode {get;set;} + + /// + /// Desc:预案类别(0总体应急预案、1专项应急预案、2部门预案) + /// Default: + /// Nullable:True + /// + public int? PlanCategory {get;set;} + + /// + /// Desc:行政级别(省、市、区县、乡镇) + /// Default: + /// Nullable:True + /// + public string AdmLevel {get;set;} + + /// + /// Desc:预案描述 + /// Default: + /// Nullable:True + /// + public string Description {get;set;} + + /// + /// Desc:预案内容 + /// Default: + /// Nullable:True + /// + public string Content {get;set;} + + /// + /// Desc:预案状态(0草稿,1生效,2过期) + /// Default: + /// Nullable:True + /// + public int? Status {get;set;} + + /// + /// Desc:预案版本 + /// Default: + /// Nullable:True + /// + public string Version {get;set;} + + /// + /// Desc:编制单位 + /// Default: + /// Nullable:True + /// + public string WriteUnit {get;set;} + + /// + /// Desc:编制时间 + /// Default: + /// Nullable:True + /// + public DateTime? CreateTime {get;set;} + + /// + /// Desc:创建人 + /// Default: + /// Nullable:True + /// + public string CreateUser {get;set;} + + /// + /// Desc:生效日期 + /// Default: + /// Nullable:True + /// + public DateTime? EffectiveDate {get;set;} + + /// + /// Desc:失效日期 + /// Default: + /// Nullable:True + /// + public DateTime? expiry_date {get;set;} + + /// + /// Desc:具体负责人的姓名 + /// Default: + /// Nullable:True + /// + public string ResponsiblePerson {get;set;} + + /// + /// Desc:责任人联系电话 + /// Default: + /// Nullable:True + /// + public string Contact {get;set;} + + /// + /// Desc:预案附件 + /// Default: + /// Nullable:True + /// + public string Attachment {get;set;} + + /// + /// Desc:备注 + /// Default: + /// Nullable:True + /// + public string Remarks {get;set;} + + } +} diff --git a/OpenAuth.Repository/SugarDbContext.cs b/OpenAuth.Repository/SugarDbContext.cs index 5987148..b6b0eed 100644 --- a/OpenAuth.Repository/SugarDbContext.cs +++ b/OpenAuth.Repository/SugarDbContext.cs @@ -85,6 +85,7 @@ namespace OpenAuth.Repository public SugarRepositiry FmSiteUser { get; set; } public SugarRepositiry FmCamera { get; set; } public SugarRepositiry FmCamera_yjj { get; set; } + public SugarRepositiry FmPreventionplan { get; set; } #endregion diff --git a/OpenAuth.WebApi/Controllers/ServiceControllers/FireManagement/FmPreventionPlanController.cs b/OpenAuth.WebApi/Controllers/ServiceControllers/FireManagement/FmPreventionPlanController.cs new file mode 100644 index 0000000..7b1a406 --- /dev/null +++ b/OpenAuth.WebApi/Controllers/ServiceControllers/FireManagement/FmPreventionPlanController.cs @@ -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 +{ + /// + /// 防火应急预案模块 + /// + [Route("api/[controller]/[action]")] + [ApiController] + public class FmPreventionPlanController : ControllerBase + { + private readonly FmPreventionPlanApp _app; + + public FmPreventionPlanController(FmPreventionPlanApp app) + { + _app = app; + } + + /// + /// 分页查询防火应急预案列表 + /// + /// + [HttpGet] + [AllowAnonymous] + public async Task>>> GetPreventionplanPageList([FromQuery] FmPreventionplanReq req) + { + Response>> response = new Response>>(); + try + { + return await _app.GetPreventionplanPageList(req); + } + catch (Exception ex) + { + response.Code = 500; + response.Message = ex.InnerException?.Message ?? ex.Message; + } + return response; + } + + + /// + /// 查询应急预案详情 + /// + /// + [HttpGet] + [AllowAnonymous] + public async Task> LoadClueInfoById(string id) + { + Response response = new Response(); + try + { + return await _app.LoadClueInfoById(id); + } + catch (Exception ex) + { + response.Code = 500; + response.Message = ex.InnerException?.Message ?? ex.Message; + } + return response; + } + + + } +}