parent
a50301e806
commit
c5179164fc
|
|
@ -3,6 +3,7 @@ using System.Text;
|
|||
using Hopetry.App.SugarModel.CommonModel;
|
||||
using Infrastructure;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Newtonsoft.Json;
|
||||
using NPOI.HSSF.UserModel;
|
||||
|
|
@ -79,6 +80,7 @@ namespace OpenAuth.App.ServiceApp.FireManagement
|
|||
fftuList.Add(fftu);
|
||||
});
|
||||
}
|
||||
|
||||
await db.FmFireTaskUser.InsertRangeAsync(fftuList);
|
||||
if (db.Commit())
|
||||
{
|
||||
|
|
@ -112,6 +114,7 @@ namespace OpenAuth.App.ServiceApp.FireManagement
|
|||
return new Response<List<SysUserResp>> { Result = users };
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询任务列表
|
||||
/// </summary>
|
||||
|
|
@ -126,6 +129,7 @@ namespace OpenAuth.App.ServiceApp.FireManagement
|
|||
return new Response<List<FmFireclueTask>> { Result = tasks };
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询人员单位信息
|
||||
/// </summary>
|
||||
|
|
@ -138,7 +142,9 @@ namespace OpenAuth.App.ServiceApp.FireManagement
|
|||
return new Response<List<FmUserUnit>> { Result = userunit };
|
||||
}
|
||||
}
|
||||
|
||||
#region 单位管理
|
||||
|
||||
//添加人员单位
|
||||
public async Task<Response<bool>> AddUserUnit(FmUserUnit info)
|
||||
{
|
||||
|
|
@ -156,6 +162,7 @@ namespace OpenAuth.App.ServiceApp.FireManagement
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
//编辑人员单位
|
||||
public async Task<Response<bool>> EditUserUnit(FmUserUnit info)
|
||||
{
|
||||
|
|
@ -172,6 +179,7 @@ namespace OpenAuth.App.ServiceApp.FireManagement
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
//获取单个人员单位
|
||||
public async Task<Response<FmUserUnit>> LoadUserUnitById(long id)
|
||||
{
|
||||
|
|
@ -181,6 +189,7 @@ namespace OpenAuth.App.ServiceApp.FireManagement
|
|||
return new Response<FmUserUnit> { Result = info };
|
||||
}
|
||||
}
|
||||
|
||||
//删除人员单位
|
||||
public async Task<Response<bool>> DeleteUserUnit(long id)
|
||||
{
|
||||
|
|
@ -279,10 +288,14 @@ namespace OpenAuth.App.ServiceApp.FireManagement
|
|||
response.Code = 400;
|
||||
response.Message = "上传文件类型错误";
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 火情线索
|
||||
|
||||
public async Task<Response<bool>> AddFireClueInfo(FmFireclueInfo info)
|
||||
{
|
||||
using (var db = base.UnitWork.CreateContext())
|
||||
|
|
@ -290,7 +303,8 @@ namespace OpenAuth.App.ServiceApp.FireManagement
|
|||
info.Id = YitIdHelper.NextId();
|
||||
info.State = (int)State.上报;
|
||||
info.ReportTime = DateTime.Now;
|
||||
var exitinfo = db.FmFireclueInfo.AsQueryable().Where(a => a.ReportTime.ToString("yyyy-MM-dd") == DateTime.Now.ToString("yyyy-MM-dd")).Count();
|
||||
var exitinfo = db.FmFireclueInfo.AsQueryable().Where(a =>
|
||||
a.ReportTime.ToString("yyyy-MM-dd") == DateTime.Now.ToString("yyyy-MM-dd")).Count();
|
||||
info.ClueNo = "H" + DateTime.Now.ToString("yyyyMMdd") + (exitinfo == 0 ? "01" : "0" + (exitinfo + 1));
|
||||
await db.FmFireclueInfo.InsertAsync(info);
|
||||
if (db.Commit())
|
||||
|
|
@ -303,6 +317,7 @@ namespace OpenAuth.App.ServiceApp.FireManagement
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询火情线索
|
||||
/// </summary>
|
||||
|
|
@ -317,6 +332,7 @@ namespace OpenAuth.App.ServiceApp.FireManagement
|
|||
return new Response<FmFireclueInfo> { Result = info };
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<Response<dynamic>> LoadClueWithInfoById(long id)
|
||||
{
|
||||
using (var db = base.UnitWork.CreateContext())
|
||||
|
|
@ -336,6 +352,7 @@ namespace OpenAuth.App.ServiceApp.FireManagement
|
|||
return new Response<dynamic> { Result = endInfo };
|
||||
}
|
||||
}
|
||||
|
||||
//查询火情线索列表
|
||||
public async Task<Response<List<FmFireclueInfo>>> GetFireClueList()
|
||||
{
|
||||
|
|
@ -345,6 +362,7 @@ namespace OpenAuth.App.ServiceApp.FireManagement
|
|||
return new Response<List<FmFireclueInfo>> { Result = list };
|
||||
}
|
||||
}
|
||||
|
||||
//按月统计火情线索
|
||||
public async Task<Response<List<FireInfoForChart>>> GetFireClueStatistics(int type)
|
||||
{
|
||||
|
|
@ -429,6 +447,7 @@ namespace OpenAuth.App.ServiceApp.FireManagement
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<Response<List<FireInfoDegreeForChart>>> GetFireClueStatisticsByDegreeType(int type)
|
||||
{
|
||||
using (var db = base.UnitWork.CreateContext())
|
||||
|
|
@ -477,7 +496,9 @@ namespace OpenAuth.App.ServiceApp.FireManagement
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 在线情况
|
||||
/// </summary>
|
||||
|
|
@ -498,10 +519,12 @@ namespace OpenAuth.App.ServiceApp.FireManagement
|
|||
{
|
||||
foreach (var item in orgid.Where(r => r.Level < 3))
|
||||
{
|
||||
var chileorg = (await db.SysOrg.AsQueryable().ToChildListAsync(it => it.ParentId, item)).Select(it => it.Id).ToList();
|
||||
var chileorg = (await db.SysOrg.AsQueryable().ToChildListAsync(it => it.ParentId, item))
|
||||
.Select(it => it.Id).ToList();
|
||||
chileorglist.AddRange(chileorg);
|
||||
}
|
||||
}
|
||||
|
||||
var userInfoQuery = db.User.AsQueryable()
|
||||
.LeftJoin<FmUserPoint>((a, b) => a.Id == b.CreateId)
|
||||
.LeftJoin<SysUserOrg>((a, b, c) => a.Id == c.UserId)
|
||||
|
|
@ -651,5 +674,42 @@ namespace OpenAuth.App.ServiceApp.FireManagement
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 保存地图标绘
|
||||
/// </summary>
|
||||
/// <param name="req"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<Response<bool>> SaveMapPlotting(MapPlottingReq req)
|
||||
{
|
||||
var record = req.MapTo<FmMapPlotting>();
|
||||
record.Id = YitIdHelper.NextId();
|
||||
using var db = Repository.AsSugarClient();
|
||||
await db.Insertable(record).IgnoreColumnsNull().ExecuteCommandAsync();
|
||||
return new Response<bool>()
|
||||
{
|
||||
Result = true,
|
||||
Message = "保存成功",
|
||||
Code = 200
|
||||
};
|
||||
}
|
||||
|
||||
public async Task<Response<PageInfo<dynamic>>> GetMapPlotting(PageReq req)
|
||||
{
|
||||
using var db = Repository.AsSugarClient();
|
||||
RefAsync<int> total = 0;
|
||||
var page = await db.Queryable<FmMapPlotting>()
|
||||
.OrderByDescending(r => r.CreateTime)
|
||||
.ToPageListAsync(req.page, req.limit, total);
|
||||
return new Response<PageInfo<dynamic>>
|
||||
{
|
||||
Code = 200,
|
||||
Message = "查询成功",
|
||||
Result = new PageInfo<dynamic>
|
||||
{
|
||||
Items = page,
|
||||
Total = total
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
namespace OpenAuth.App.ServiceApp.FireManagement.Request;
|
||||
|
||||
public class MapPlottingReq
|
||||
{
|
||||
public string Title { get;set; }
|
||||
public string Description { get;set; }
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
using SqlSugar;
|
||||
|
||||
namespace OpenAuth.Repository.Domain.FireManagement;
|
||||
|
||||
/// <summary>
|
||||
/// 地图标绘记录
|
||||
/// </summary>
|
||||
[SugarTable("fm_mapplotting")]
|
||||
public class FmMapPlotting
|
||||
{
|
||||
/// <summary>
|
||||
/// id 主键
|
||||
/// </summary>
|
||||
[SugarColumn(IsPrimaryKey = true,ColumnName = "id")]
|
||||
public long Id { get; set; }
|
||||
|
||||
[SugarColumn(ColumnName = "title")] public string Title { get; set; }
|
||||
|
||||
[SugarColumn(ColumnName = "description")]
|
||||
public string Description { get; set; }
|
||||
|
||||
[SugarColumn(ColumnName = "state")] public int? State { get; set; }
|
||||
|
||||
[SugarColumn(ColumnName = "create_time")]
|
||||
public DateTime? CreateTime { get; set; }
|
||||
}
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
using Infrastructure;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using OpenAuth.App.BaseApp.Base;
|
||||
using OpenAuth.App.ServiceApp.FireManagement;
|
||||
using OpenAuth.App.ServiceApp.FireManagement.Request;
|
||||
using OpenAuth.App.ServiceApp.FireManagement.Response;
|
||||
|
|
@ -382,5 +383,38 @@ namespace OpenAuth.WebApi.Controllers.ServiceControllers.FireManagement
|
|||
{
|
||||
return await _app.AddPointAsync(info);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 地图标绘保存
|
||||
/// </summary>
|
||||
/// <param name="req"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[AllowAnonymous]
|
||||
public async Task<Response<bool>> SaveMapPlotting(MapPlottingReq req)
|
||||
{
|
||||
if (string.IsNullOrEmpty(req.Title))
|
||||
{
|
||||
return new Response<bool>() { Code = 500, Message = "标题不能为空" };
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(req.Description))
|
||||
{
|
||||
return new Response<bool>() { Code = 500, Message = "描述不能为空" };
|
||||
}
|
||||
return await _app.SaveMapPlotting(req);
|
||||
}
|
||||
/// <summary>
|
||||
/// 地图村绘列表
|
||||
/// </summary>
|
||||
/// <param name="req"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[AllowAnonymous]
|
||||
public async Task<Response<PageInfo<dynamic>>> GetMapPlotting([FromQuery] PageReq req)
|
||||
{
|
||||
return await _app.GetMapPlotting(req);
|
||||
}
|
||||
/// 地图标绘关闭
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue