更新报表接口

This commit is contained in:
何美荣 2024-04-02 11:04:48 +08:00
parent da7e5fb14d
commit 9428cc1ef3

View File

@ -7146,9 +7146,41 @@ namespace APT.SC.WebApi.Controllers.Api.BIController
{ {
return SafeExecute<List<T_BI_DEPARTMENT_MONTH_RUN>>(() => return SafeExecute<List<T_BI_DEPARTMENT_MONTH_RUN>>(() =>
{ {
if (string.IsNullOrEmpty(filter.Parameter1) || string.IsNullOrEmpty(filter.Parameter2))
{
throw new Exception("请先选择时间段");
}
if (string.IsNullOrEmpty(filter.Keyword))
{
throw new Exception("请先选择部门");
}
DateTime startTime = Convert.ToDateTime(filter.Parameter1);
DateTime endTime = Convert.ToDateTime(filter.Parameter2);
var diffTime = startTime.AddMonths(12).Date;
if (diffTime < endTime.Date)
{
throw new Exception("查询时间不能超过12个月!");
}
//int type = 1;
//if (dayDidd <= 31)
//{
// type = 5;//最近一周(显示最近一月的,最小单位为月)
//}
//if (dayDidd > 31 && dayDidd<=90)
//{
// type = 10;//最近三月
//}
//if (dayDidd > 90 && dayDidd <= 180)
//{
// type = 15;//最近半年
//}
//if (dayDidd > 180)
//{
// type = 20;//最近一年
//}
List<T_BI_DEPARTMENT_MONTH_RUN> completionLists = new List<T_BI_DEPARTMENT_MONTH_RUN>(); List<T_BI_DEPARTMENT_MONTH_RUN> completionLists = new List<T_BI_DEPARTMENT_MONTH_RUN>();
var orgId = APT.Infrastructure.Api.AppContext.CurrentSession.OrgId.Value; var orgId = APT.Infrastructure.Api.AppContext.CurrentSession.OrgId.Value;
var completions = GetEntities<T_BI_DEPARTMENT_MONTH_RUN>(t => !t.IS_DELETED, filter).OrderBy(m=>m.MONTH).ToList(); var completions = GetEntities<T_BI_DEPARTMENT_MONTH_RUN>(t => !t.IS_DELETED && t.DEPARTMENT_NAME == filter.Keyword && t.MONTH >= startTime && t.MONTH < endTime, new BaseFilter(filter.OrgId)).OrderBy(m => m.MONTH).ToList();
if (completions != null && completions.Any()) if (completions != null && completions.Any())
{ {
foreach (var item in completions) foreach (var item in completions)