From d7b0f29296d8213973d2ba0ba63b757b51a74c2b Mon Sep 17 00:00:00 2001 From: HUANGBANGLIN Date: Fri, 3 Oct 2025 14:37:33 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E7=BB=9F=E8=AE=A1=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/ActivityStatisticsController.cs | 73 +++++++ web/admin/activity/statistics/index.aspx | 2 +- web/admin/activity/statistics/statistics.aspx | 186 ++++++++++++++++++ .../activity/statistics/statistics.aspx.cs | 14 ++ 4 files changed, 274 insertions(+), 1 deletion(-) create mode 100644 web/App_Code/api/ActivityStatisticsController.cs create mode 100644 web/admin/activity/statistics/statistics.aspx create mode 100644 web/admin/activity/statistics/statistics.aspx.cs diff --git a/web/App_Code/api/ActivityStatisticsController.cs b/web/App_Code/api/ActivityStatisticsController.cs new file mode 100644 index 0000000..9286277 --- /dev/null +++ b/web/App_Code/api/ActivityStatisticsController.cs @@ -0,0 +1,73 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.Http; + +/// +/// ActivityStatisticsController 的摘要描述 +/// +public class ActivityStatisticsController: ApiController +{ + private Model.ezEntities _db = new Model.ezEntities(); + + [HttpGet] + [Route("api/activity/statistics/summary")] + public IHttpActionResult GetStatisticsSummary([FromUri] int? activity_num =null) + { + if (activity_num == null) + { + return BadRequest("活动Id不能为空"); + } + var now = DateTime.Now; + var pre_order_query = _db.pro_order.Where(a => a.activity_num == activity_num); + var totalApplicants = pre_order_query.Count(); + var maleApplicants = pre_order_query.Where(a => a.follower.sex == "男眾").Count(); + + var pro_order_detail_query = _db.pro_order_detail + .Where(d => d.pro_order.activity_num == activity_num); + var result = new + { + reportDate = now.ToString("yyyy/MM/dd HH:mm:ss"), + totalApplicants = totalApplicants, //报名总人数 + maleApplicants = maleApplicants, //男 + femaleApplicants = totalApplicants - maleApplicants,//女 + donation = new + { + total = 158000,//总功德金 + received = 150000,//已收功德金 + unreceived = 8000//未收功德金 + }, + items = new[]//功德项目,这个的功德项目要根据活动预设的功德项目来做统计,就是这个活动有那些可报名的功德项目 + { + new { name = "總功德主", count = "10人" }, + new { name = "利益主", count = "15人" }, + new { name = "個人大牌", count = "50人" }, + new { name = "供僧", count = "45人" } + }, + plaques = new[]//牌位 + { + new { name = "總牌位數", count = pro_order_detail_query.Count() }, + new { name = "消災-大牌位", count = 101 }, + new { name = "超冤-大牌位", count =10 }, + new { name = "消災-個人大牌", count =10 }, + new { name = "超冤-個人大牌", count = 10 }, + new { name = "超薦-個人大牌", count = 10 }, + new { name = "消災-個人中牌", count = 10 }, + new { name = "超冤-個人中牌", count = 10 }, + new { name = "超薦-個人中牌", count = 10 }, + new { name = "消災-隨喜牌位", count = 10 }, + new { name = "超冤-隨喜牌位", count = 10 }, + new { name = "超薦-隨喜牌位", count = 10 }, + new { name = "消災-常年牌位", count = 10 }, + new { name = "超冤-常年牌位", count = 10 }, + new { name = "超薦-常年牌位", count = 10 }, + new { name = "消災-急立牌位", count = 10 }, + new { name = "超薦-急立牌位", count = 10 }, + new { name = "超冤-急立牌位", count = 101 }, + } + }; + + return Ok(result); + } +} \ No newline at end of file diff --git a/web/admin/activity/statistics/index.aspx b/web/admin/activity/statistics/index.aspx index f6a308a..ba2aea4 100644 --- a/web/admin/activity/statistics/index.aspx +++ b/web/admin/activity/statistics/index.aspx @@ -28,7 +28,7 @@ :server-items-length="activity_statistics.totalItems" :items="activity_statistics.items">