lixiaojun
2023-04-12 fc6b7c9852f18e42fb9bccaf0cc22fbe5389d179
Application/IStation.Application.OpenApi/test/report/Report_ShysController.cs
@@ -19,7 +19,9 @@
    [ApiDescriptionSettings("OpenApi", Name = "测试报表", Order = 1001)]
    public class Report_ShysController : IDynamicApiController
    {
        /// <summary>
        ///
        /// </summary>
        public readonly static Dictionary<string, string> ProvinceCodeDic = new Dictionary<string, string> { { "四川省", "510000" }, { "北京市", "110000" }, { "天津市", "120000" }, { "河北省", "130000" }, { "山西省", "140000" }, { "内蒙古自治区", "150000" }, { "辽宁省", "210000" }, { "吉林省", "220000" }, { "黑龙江省", "230000" }, { "上海市", "310000" }, { "江苏省", "320000" }, { "浙江省", "330000" }, { "安徽省", "340000" }, { "福建省", "350000" }, { "江西省", "360000" }, { "山东省", "370000" }, { "河南省", "410000" }, { "湖北省", "420000" }, { "湖南省", "430000" }, { "广东省", "440000" }, { "广西自治区", "450000" }, { "海南省", "460000" }, { "重庆市", "500000" }, { "贵州省", "520000" }, { "云南省", "530000" }, { "西藏自治区", "540000" }, { "陕西省", "610000" }, { "甘肃省", "620000" }, { "青海省", "630000" }, { "宁夏自治区", "640000" }, { "新疆自治区", "650000" }, { "台湾省", "710000" }, { "香港特别行政区", "810000" }, { "澳门特别行政区", "820000" } };
        /// <summary>
@@ -50,12 +52,12 @@
            dto.LogSummaryList = logs.GroupBy(x => x.LoginTime.Date).Select(x => new LogSummary() {Date = x.Key.ToString("d"), Visitors = x.Count() }).ToList();
       
        var uniqueVisitorList = logs.DistinctBy(x => x.UserID).ToList();
            var today = DateTime.Today;
            var last7Days = today.AddDays(-7);
            var last30Days = today.AddDays(-30);
            var yesterday = DateTime.Today.AddDays(-1);
            var last7Days = yesterday.AddDays(-7);
            var last30Days = yesterday.AddDays(-30);
            if (uniqueVisitorList != null && uniqueVisitorList.Count > 0)
            {
                dto.TodayUV = uniqueVisitorList.Where(x => x.LoginTime >= today).Count();
                dto.YesterdayUV = uniqueVisitorList.Where(x => x.LoginTime >= yesterday).Count();
                dto.Last7DaysUV = uniqueVisitorList.Where(x => x.LoginTime >= last7Days).Count();
                dto.Last30DaysUV = uniqueVisitorList.Where(x => x.LoginTime >= last30Days).Count();
            }
@@ -107,7 +109,8 @@
                if (!Directory.Exists(ReportPath))
                    Directory.CreateDirectory(ReportPath);
                var filePath = Path.Combine(ReportPath, "UserLoginLogReport" + ".xml");
                //var filePath = Path.Combine(ReportPath, "UserLoginLogReport" + ".xml");
                var filePath = "C:\\FineReport\\tomcat-win64\\webapps\\webroot\\WEB-INF\\reportlets\\file\\UserLoginLogReport.xml";
                if (File.Exists(filePath))
                {
                    File.Delete(filePath);