2025年度浙江省建筑施工安全生产标准化优良工地(宁波地区)水平认定项目汇总表(按总分从高到低排序)
This commit is contained in:
@@ -32,7 +32,10 @@ namespace Vote.Services.ApiController
|
||||
private readonly IRepository<Entities.VoteRecords_2021> rep_VoteRecords2021;
|
||||
private readonly IRepository<Entities.Projects_2022> rep_Projects2022;
|
||||
private readonly IRepository<Entities.VoteRecords_2022> rep_VoteRecords2022;
|
||||
public ProjectsService(IRepository<Entities.Projects> _rep_Projects, IRepository<Entities.Experts> _rep_Experts, IRepository<Entities.VoteRecords> _rep_VoteRecords, IRepository<Entities.Projects_2021> _rep_Projects2021, IRepository<Entities.VoteRecords_2021> _rep_VoteRecords2021, IRepository<Entities.Projects_2022> _rep_Projects2022, IRepository<Entities.VoteRecords_2022> _rep_VoteRecords2022)
|
||||
|
||||
public ProjectsService(IRepository<Entities.Projects> _rep_Projects, IRepository<Entities.Experts> _rep_Experts, IRepository<Entities.VoteRecords> _rep_VoteRecords,
|
||||
IRepository<Entities.Projects_2021> _rep_Projects2021, IRepository<Entities.VoteRecords_2021> _rep_VoteRecords2021,
|
||||
IRepository<Entities.Projects_2022> _rep_Projects2022, IRepository<Entities.VoteRecords_2022> _rep_VoteRecords2022)
|
||||
{
|
||||
rep_Projects = _rep_Projects;
|
||||
rep_Experts = _rep_Experts;
|
||||
@@ -51,7 +54,7 @@ namespace Vote.Services.ApiController
|
||||
[Microsoft.AspNetCore.Authorization.AllowAnonymous]
|
||||
public async Task<dynamic> List(ProjectsInput args)
|
||||
{
|
||||
var typeList = new List<string> { "房建工程", "市政工程", "轨道交通工程" };//, "电力工程", "交通工程", "水利工程" };
|
||||
var typeList = new List<string> { "房屋建筑工程", "市政基础设施工程", "轨道交通工程", "电力工程" }; //, "交通工程", "水利工程" };
|
||||
var data = await rep_Projects.DetachedEntities.Where(p => !p.IsDeleted)
|
||||
.Where(args.type != null, a => (int)a.type == args.type)
|
||||
.ProjectToType<ProjectsOutput>()
|
||||
@@ -110,24 +113,27 @@ namespace Vote.Services.ApiController
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
private async Task<List<ProjectsList2Output>> GetVoteData()
|
||||
{
|
||||
var query = from a in rep_Projects.DetachedEntities
|
||||
join b in rep_VoteRecords.DetachedEntities
|
||||
on a.Id equals b.project_id into grouping
|
||||
from p in grouping.DefaultIfEmpty()
|
||||
group new { a, p } by new { a.Id, a.name, a.serial_number, a.type } into pp
|
||||
select new ProjectsList2Output
|
||||
{
|
||||
serial_number = pp.Key.serial_number,
|
||||
id = pp.Key.Id,
|
||||
name = pp.Key.name,
|
||||
yes_count = pp.Where(a => a.p.is_agree).Count(),
|
||||
no_count = pp.Where(a => !a.p.is_agree).Count(),
|
||||
type = pp.Key.type
|
||||
};
|
||||
join b in rep_VoteRecords.DetachedEntities
|
||||
on a.Id equals b.project_id into grouping
|
||||
from p in grouping.DefaultIfEmpty()
|
||||
group new { a, p } by new { a.Id, a.name, a.serial_number, a.type }
|
||||
into pp
|
||||
select new ProjectsList2Output
|
||||
{
|
||||
serial_number = pp.Key.serial_number,
|
||||
id = pp.Key.Id,
|
||||
name = pp.Key.name,
|
||||
yes_count = pp.Where(a => a.p.is_agree).Count(),
|
||||
no_count = pp.Where(a => !a.p.is_agree).Count(),
|
||||
type = pp.Key.type
|
||||
};
|
||||
return await query.OrderBy(a => a.serial_number).ToListAsync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 列表
|
||||
/// </summary>
|
||||
@@ -135,7 +141,6 @@ namespace Vote.Services.ApiController
|
||||
[HttpPost]
|
||||
public async Task<dynamic> List2()
|
||||
{
|
||||
|
||||
//var data = rep_Projects.DetachedEntities.Where(p => !p.IsDeleted)
|
||||
// //.Where(args.type != null, a => (int)a.type == args.type)
|
||||
// .Join(rep_VoteRecords.DetachedEntities, a => a.Id, a => a.project_id, (a, b) =>
|
||||
@@ -167,9 +172,10 @@ namespace Vote.Services.ApiController
|
||||
// data4,
|
||||
// data5
|
||||
//};
|
||||
var typeList = new List<string> { "房建工程", "市政工程", "轨道交通工程" };//, "电力工程", "交通工程", "水利工程" };
|
||||
var typeList = new List<string> { "房建工程", "市政工程", "轨道交通工程", "电力工程" }; //, "电力工程", "交通工程", "水利工程" };
|
||||
return new { data, typeList };
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
@@ -178,10 +184,11 @@ namespace Vote.Services.ApiController
|
||||
{
|
||||
var data = await GetVoteData();
|
||||
//var filepath = Tools.ExcelHelper.WriteTemplate(data, 4, "C");
|
||||
string template_name = "2024年度宁波市结构优质认定项目投票结果.xlsx";
|
||||
var filepath = Tools.ExcelHelper.WriteTemplate(template_name, data, 5, "C");
|
||||
string template_name = "2025年度浙江省建筑施工安全生产标准化优良工地(宁波地区)水平认定项目投票结果.xlsx";
|
||||
var filepath = Tools.ExcelHelper.WriteTemplate(template_name, data, 4, "D");
|
||||
return new FileStreamResult(new FileStream(filepath, FileMode.Open), "application/octet-stream") { FileDownloadName = filepath };
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
@@ -204,8 +211,6 @@ namespace Vote.Services.ApiController
|
||||
// is_vote = tt == null
|
||||
// };
|
||||
//return await query.ToListAsync();
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -229,7 +234,8 @@ namespace Vote.Services.ApiController
|
||||
CreatedTime = DateTime.Now
|
||||
});
|
||||
}
|
||||
|
||||
await rep_Experts.InsertAsync(list);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user