统计修改
This commit is contained in:
73
web/App_Code/api/ActivityStatisticsController.cs
Normal file
73
web/App_Code/api/ActivityStatisticsController.cs
Normal file
@@ -0,0 +1,73 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Http;
|
||||
|
||||
/// <summary>
|
||||
/// ActivityStatisticsController 的摘要描述
|
||||
/// </summary>
|
||||
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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user