107 lines
3.8 KiB
C#
107 lines
3.8 KiB
C#
using Infrastructure;
|
|
using OpenAuth.App.BaseApp.Base;
|
|
using OpenAuth.App.Interface;
|
|
using OpenAuth.App.ServiceApp.DroneSsnydManage.Request;
|
|
using OpenAuth.Repository;
|
|
using OpenAuth.Repository.Domain;
|
|
using SqlSugar;
|
|
|
|
namespace OpenAuth.App.ServiceApp.DroneSsnydManage
|
|
{
|
|
public class DroneSsnyApp : SqlSugarBaseApp<DroneSsnyd, SugarDbContext>
|
|
{
|
|
public DroneSsnyApp(ISugarUnitOfWork<SugarDbContext> unitWork, ISimpleClient<DroneSsnyd> repository, IAuth auth)
|
|
: base(unitWork, repository, auth)
|
|
{
|
|
}
|
|
|
|
/// <summary>
|
|
/// 到期预警
|
|
/// </summary>
|
|
/// <param name="pageIndex"></param>
|
|
/// <param name="pageSize"></param>
|
|
/// <returns></returns>
|
|
public PageInfo<List<DroneSsnyd>> TimeoutWarning(int pageIndex, int pageSize)
|
|
{
|
|
int totalCount = 0;
|
|
var endTime = DateTime.Now.AddMonths(2);
|
|
|
|
var list = base.Repository.AsQueryable()
|
|
.Where(a => a.end_time <= endTime && a.end_time > DateTime.Now)
|
|
.OrderBy(a => a.end_time, OrderByType.Desc)
|
|
.ToPageList(pageIndex, pageSize, ref totalCount);
|
|
|
|
return new PageInfo<List<DroneSsnyd>>
|
|
{
|
|
Items = list,
|
|
Total = totalCount
|
|
};
|
|
}
|
|
|
|
/// <summary>
|
|
/// 超期报警
|
|
/// </summary>
|
|
/// <param name="pageIndex"></param>
|
|
/// <param name="pageSize"></param>
|
|
/// <returns></returns>
|
|
public PageInfo<List<DroneSsnyd>> TimeOutAlarmList(int pageIndex, int pageSize)
|
|
{
|
|
int totalCount = 0;
|
|
var endTime = DateTime.Now;
|
|
|
|
var list = base.Repository.AsQueryable()
|
|
.Where(a => a.end_time < endTime)
|
|
.OrderBy(a => a.end_time, OrderByType.Desc)
|
|
.ToPageList(pageIndex, pageSize, ref totalCount);
|
|
|
|
return new PageInfo<List<DroneSsnyd>>
|
|
{
|
|
Items = list,
|
|
Total = totalCount
|
|
};
|
|
}
|
|
|
|
/// <summary>
|
|
/// 历史项目
|
|
/// </summary>
|
|
/// <param name="req"></param>
|
|
/// <returns></returns>
|
|
/// <exception cref="NotImplementedException"></exception>
|
|
public PageInfo<List<DroneSsnyd>> HistoryProject(DroneSnnyAppPageReq req)
|
|
{
|
|
var totalCount = 0;
|
|
var list = Repository.AsQueryable()
|
|
.Where(a => a.handle_status_id == 99)
|
|
.WhereIF(!string.IsNullOrEmpty(req.xiangmu_no), a => a.xiangmu_no.Contains(req.xiangmu_no))
|
|
.WhereIF(!string.IsNullOrEmpty(req.xiangmumc), a => a.xiangmumc.Contains(req.xiangmumc))
|
|
.OrderBy(a => a.end_time, OrderByType.Desc)
|
|
.ToPageList(req.page, req.limit, ref totalCount);
|
|
return new PageInfo<List<DroneSsnyd>>
|
|
{
|
|
Items = list,
|
|
Total = totalCount
|
|
};
|
|
}
|
|
|
|
/// <summary>
|
|
/// 项目变更
|
|
/// </summary>
|
|
/// <param name="req"></param>
|
|
/// <returns></returns>
|
|
public PageInfo<List<DroneSsnyd>> ProjectChange(DroneSnnyAppPageReq req)
|
|
{
|
|
var totalCount = 0;
|
|
var list = Repository.AsQueryable()
|
|
.Where(a => a.handle_status_id != 99)
|
|
.WhereIF(!string.IsNullOrEmpty(req.xiangmu_no), a => a.xiangmu_no.Contains(req.xiangmu_no))
|
|
.WhereIF(!string.IsNullOrEmpty(req.xiangmumc), a => a.xiangmumc.Contains(req.xiangmumc))
|
|
.OrderBy(a => a.end_time, OrderByType.Desc)
|
|
.ToPageList(req.page, req.limit, ref totalCount);
|
|
return new PageInfo<List<DroneSsnyd>>
|
|
{
|
|
Items = list,
|
|
Total = totalCount
|
|
};
|
|
}
|
|
}
|
|
} |