|
@@ -7,6 +7,7 @@ using OASystem.Domain.Entities.Groups;
|
|
using OASystem.Domain.ViewModels.Financial;
|
|
using OASystem.Domain.ViewModels.Financial;
|
|
using OASystem.Domain.ViewModels.Statistics;
|
|
using OASystem.Domain.ViewModels.Statistics;
|
|
using OASystem.Infrastructure.Repositories.Groups;
|
|
using OASystem.Infrastructure.Repositories.Groups;
|
|
|
|
+using OfficeOpenXml.Drawing;
|
|
using System.Data;
|
|
using System.Data;
|
|
using System.Linq;
|
|
using System.Linq;
|
|
using System.Security.Cryptography.Xml;
|
|
using System.Security.Cryptography.Xml;
|
|
@@ -4250,36 +4251,44 @@ ORDER BY
|
|
}
|
|
}
|
|
else if (_dto.Type == 2)
|
|
else if (_dto.Type == 2)
|
|
{
|
|
{
|
|
- var monthData = new List<dynamic>();
|
|
|
|
-
|
|
|
|
- //var data1 = opInfos.GroupBy(x => x.Month)
|
|
|
|
- // .Select(x => new
|
|
|
|
- // {
|
|
|
|
- // monthId = x.Key,
|
|
|
|
- // month = Enum.IsDefined(typeof(MonthEnum), (int)x.Key) ? ((MonthEnum)(int)x.Key).GetEnumDescription() : "",
|
|
|
|
- // monthData = x.GroupBy(x1 => x1.ParentFeeId)
|
|
|
|
- // .Select(x1 => new StatisticsOPYOY(
|
|
|
|
- // feeId: x1.Key,
|
|
|
|
- // feeName: x1.FirstOrDefault(x1 => x1.Year == thisYear)?.ParentFeeName ?? "",
|
|
|
|
- // currPeriodFee: x1.Where(x1 => x1.Year == thisYear).Sum(x1 => x1.Price),
|
|
|
|
- // samePeriodFee: x1.Where(x1 => x1.Year == lastYear).Sum(x1 => x1.Price),
|
|
|
|
- // currPeriodGroupTotal: x1.Where(x1 => x1.Year == thisYear).Select(x1 => x1.DiId).Distinct().Count(),
|
|
|
|
- // samePeriodGroupTotal: x1.Where(x1 => x1.Year == lastYear).Select(x1 => x1.DiId).Distinct().Count()
|
|
|
|
- // //cityData: x1.GroupBy(x2 => x2.City)
|
|
|
|
- // // .Select(x2 => new StatisticsOPCityYOY(
|
|
|
|
- // // cityName: x2.Key,
|
|
|
|
- // // currPeriodGroupTotal: x2.Where(x2 => x2.Year == thisYear).Select(x2 => x2.DiId).Distinct().Count(),
|
|
|
|
- // // samePeriodGroupTotal: x2.Where(x2 => x2.Year == lastYear).Select(x2 => x2.DiId).Distinct().Count(),
|
|
|
|
- // // currPeriodFee: x2.Where(x2 => x2.Year == thisYear).Sum(x2 => x2.Price),
|
|
|
|
- // // samePeriodFee: x2.Where(x2 => x2.Year == lastYear).Sum(x2 => x2.Price)
|
|
|
|
- // // )
|
|
|
|
- // // ).ToArray()
|
|
|
|
- // )
|
|
|
|
- // )
|
|
|
|
- // .OrderBy(x1 => x1.FeeId)
|
|
|
|
- // .ToList()
|
|
|
|
- // }).ToList();
|
|
|
|
- //return Ok(JsonView(true, "操作成功!", data1));
|
|
|
|
|
|
+ var monthData = opInfos.GroupBy(x => x.Month)
|
|
|
|
+ .Select(x => new StatisticsOPMonthYOY(
|
|
|
|
+ monthId: x.Key,
|
|
|
|
+ monthName: Enum.IsDefined(typeof(MonthEnum), (int)x.Key) ? ((MonthEnum)(int)x.Key).GetEnumDescription() : "",
|
|
|
|
+ feeDatas:x.GroupBy(x1 => x1.ParentFeeId)
|
|
|
|
+ .Select(x1 => new StatisticsOPYOY(
|
|
|
|
+ feeId:x1.Key,
|
|
|
|
+ feeName: x1.FirstOrDefault()?.ParentFeeName ?? "",
|
|
|
|
+ currPeriodFee: x1.Where(x1 => x1.Year == thisYear).Sum(x1 => x1.Price),
|
|
|
|
+ samePeriodFee: x1.Where(x1 => x1.Year == lastYear).Sum(x1 => x1.Price),
|
|
|
|
+ currPeriodGroupTotal: x1.Where(x1 => x1.Year == thisYear).Select(x1 => x1.DiId).Distinct().Count(),
|
|
|
|
+ samePeriodGroupTotal: x1.Where(x1 => x1.Year == lastYear).Select(x1 => x1.DiId).Distinct().Count(),
|
|
|
|
+ subFeeData:x1.GroupBy(x2 => x2.FeeSubType)
|
|
|
|
+ .Select(x2 => new StatisticsOPSubFeeYOY(
|
|
|
|
+ feeId: x2.Key,
|
|
|
|
+ feeName: x2.FirstOrDefault()?.FeeSubTypeName ?? "",
|
|
|
|
+ currPeriodFee: x2.Where(x2 => x2.Year == thisYear).Sum(x2 => x2.Price),
|
|
|
|
+ samePeriodFee: x2.Where(x2 => x2.Year == lastYear).Sum(x2 => x2.Price),
|
|
|
|
+ currPeriodGroupTotal: x2.Where(x2 => x2.Year == thisYear).Select(x2 => x2.DiId).Distinct().Count(),
|
|
|
|
+ samePeriodGroupTotal: x2.Where(x2 => x2.Year == lastYear).Select(x2 => x2.DiId).Distinct().Count(),
|
|
|
|
+ cityData: x2.GroupBy(x3 => x3.City)
|
|
|
|
+ .Select(x3 => new StatisticsOPCityYOY(
|
|
|
|
+ cityName: x3.Key,
|
|
|
|
+ currPeriodFee: x3.Where(x3 => x3.Year == thisYear).Sum(x3 => x3.Price),
|
|
|
|
+ samePeriodFee: x3.Where(x3 => x3.Year == lastYear).Sum(x3 => x3.Price),
|
|
|
|
+ currPeriodGroupTotal: x3.Where(x3 => x3.Year == thisYear).Select(x3 => x3.DiId).Distinct().Count(),
|
|
|
|
+ samePeriodGroupTotal: x3.Where(x3 => x3.Year == lastYear).Select(x3 => x3.DiId).Distinct().Count()
|
|
|
|
+ ))
|
|
|
|
+ .ToArray()
|
|
|
|
+ ))
|
|
|
|
+ .ToArray()
|
|
|
|
+
|
|
|
|
+ ))
|
|
|
|
+ .ToArray()
|
|
|
|
+ ))
|
|
|
|
+ .OrderBy(x => x.MonthId)
|
|
|
|
+ .ToList();
|
|
|
|
+ return Ok(JsonView(true, "操作成功!", monthData));
|
|
}
|
|
}
|
|
return Ok(JsonView(false, "操作失败!"));
|
|
return Ok(JsonView(false, "操作失败!"));
|
|
}
|
|
}
|