2025年度浙江省建筑施工安全生产标准化优良工地(宁波地区)水平认定项目汇总表(按总分从高到低排序)

This commit is contained in:
路 范
2025-12-22 20:27:32 +08:00
parent 00bf5a124b
commit 0a2c5f3fda
10 changed files with 737 additions and 38 deletions

View File

@@ -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);
}
}
}
}

View File

@@ -15,42 +15,49 @@ namespace Vote.Services.Dto
/// 项目类型
/// </summary>
public int? type { get; set; }
public int? is_no_inspection { get; set; }
}
public class ProjectsOutput
{
/// <summary>
///
/// </summary>
public string id { get; set; }
/// <summary>
/// 项目序号
/// </summary>
public int serial_number { get; set; }
/// <summary>
/// 工程名称
/// </summary>
public string name { get; set; }
/// <summary>
/// 项目类型
/// </summary>
public EnumProjectType type { get; set; }
/// <summary>
/// 项目类型
/// </summary>
public string type_title
{
get
{
return type.GetEnumDescription();
}
get { return type.GetEnumDescription(); }
}
/// <summary>
///
/// </summary>
public bool vote { get; set; } = false;
public string remark { get; set; }
public int is_no_inspection { get; set; }
}
public class CheckSubmitCodeInput
{
/// <summary>
@@ -59,6 +66,7 @@ namespace Vote.Services.Dto
[Required]
public string code { get; set; }
}
public class SubmitInput
{
/// <summary>
@@ -66,8 +74,8 @@ namespace Vote.Services.Dto
/// </summary>
[Required]
public string code { get; set; }
[Required]
public List<ProjectsOutput> projects { get; set; }
[Required] public List<ProjectsOutput> projects { get; set; }
}
public class ProjectsList2Output
@@ -76,10 +84,12 @@ namespace Vote.Services.Dto
///
/// </summary>
public string id { get; set; }
/// <summary>
/// 项目序号
/// </summary>
public int serial_number { get; set; }
/// <summary>
/// 工程名称
/// </summary>
@@ -95,29 +105,29 @@ namespace Vote.Services.Dto
{
get
{
return yes_count > 15;
return yes_count >= 11;
// return (yes_count / (yes_count + no_count)) >= (2.0 / 3.0);
}
}
/// <summary>
/// 项目类型
/// </summary>
public EnumProjectType type { get; set; }
/// <summary>
/// 项目类型
/// </summary>
public string type_title
{
get
{
return type.GetEnumDescription();
}
get { return type.GetEnumDescription(); }
}
public class AddExpertInput
{
[Required]
public int expertnum { get; set; }
[Required] public int expertnum { get; set; }
}
public int is_no_inspection { get; set; }
}
}
}

View File

@@ -29,6 +29,7 @@ namespace Vote.Services.Entities
/// </summary>
[Comment("工程名称")]
public string name { get; set; }
public string remark { get; set; }
/// <summary>
/// 项目类型
/// </summary>