().WorkUSERID;
+ return userid;
+ }
+ }
+}
diff --git a/20220330_Vote/Ewide.Web.Core/Startup.cs b/20220330_Vote/Ewide.Web.Core/Startup.cs
index 872875c..7239c9d 100644
--- a/20220330_Vote/Ewide.Web.Core/Startup.cs
+++ b/20220330_Vote/Ewide.Web.Core/Startup.cs
@@ -107,7 +107,7 @@ namespace Ewide.Web.Core
{
endpoints.MapControllerRoute(
name: "default",
- pattern: "{controller=Home}/{action=Index}/{id?}");
+ pattern: "gb/yjb/{controller=Home}/{action=Index}/{id?}");
});
}
}
diff --git a/20220330_Vote/Ewide.Web.Entry/Controllers/ManageController.cs b/20220330_Vote/Ewide.Web.Entry/Controllers/ManageController.cs
new file mode 100644
index 0000000..14b4505
--- /dev/null
+++ b/20220330_Vote/Ewide.Web.Entry/Controllers/ManageController.cs
@@ -0,0 +1,26 @@
+using Microsoft.AspNetCore.Authorization;
+using Microsoft.AspNetCore.Mvc;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace Ewide.Web.Entry.Controllers
+{
+ [AllowAnonymous]
+ public class ManageController : Controller
+ {
+ public IActionResult Index()
+ {
+ return View();
+ }
+ public IActionResult Login()
+ {
+ return View();
+ }
+ public IActionResult Expert()
+ {
+ return View();
+ }
+ }
+}
diff --git a/20220330_Vote/Ewide.Web.Entry/Controllers/VoteController.cs b/20220330_Vote/Ewide.Web.Entry/Controllers/VoteController.cs
index 1d3bb32..b4367dd 100644
--- a/20220330_Vote/Ewide.Web.Entry/Controllers/VoteController.cs
+++ b/20220330_Vote/Ewide.Web.Entry/Controllers/VoteController.cs
@@ -1,4 +1,5 @@
-using Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.Authorization;
+using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -6,6 +7,7 @@ using System.Threading.Tasks;
namespace Ewide.Web.Entry.Controllers
{
+ [AllowAnonymous]
public class VoteController : Controller
{
public IActionResult Index()
diff --git a/20220330_Vote/Ewide.Web.Entry/Ewide.Web.Entry.csproj b/20220330_Vote/Ewide.Web.Entry/Ewide.Web.Entry.csproj
index 968bca3..2482c34 100644
--- a/20220330_Vote/Ewide.Web.Entry/Ewide.Web.Entry.csproj
+++ b/20220330_Vote/Ewide.Web.Entry/Ewide.Web.Entry.csproj
@@ -78,4 +78,28 @@
+
+
+ bin\Debug\net5.0\ICSharpCode.SharpZipLib.dll
+
+
+ bin\Debug\net5.0\NPOI.dll
+
+
+ bin\Debug\net5.0\NPOI.OOXML.dll
+
+
+ bin\Debug\net5.0\NPOI.OpenXml4Net.dll
+
+
+ bin\Debug\net5.0\NPOI.OpenXmlFormats.dll
+
+
+
+
+
+ PreserveNewest
+
+
+
diff --git a/20220330_Vote/Ewide.Web.Entry/Views/Manage/Expert.cshtml b/20220330_Vote/Ewide.Web.Entry/Views/Manage/Expert.cshtml
new file mode 100644
index 0000000..5faf79c
--- /dev/null
+++ b/20220330_Vote/Ewide.Web.Entry/Views/Manage/Expert.cshtml
@@ -0,0 +1,120 @@
+@*
+ For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
+*@
+@{
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
2021年度宁波市“甬江建设杯”选票结果
+
+
+
+
+ 已投
+ 未投
+
+
+
+
+
+ 刷新数据
+ 查看项目投票情况
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/20220330_Vote/Ewide.Web.Entry/Views/Manage/Index.cshtml b/20220330_Vote/Ewide.Web.Entry/Views/Manage/Index.cshtml
new file mode 100644
index 0000000..87f22f8
--- /dev/null
+++ b/20220330_Vote/Ewide.Web.Entry/Views/Manage/Index.cshtml
@@ -0,0 +1,260 @@
+@*
+ For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
+*@
+@{
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
2021年度宁波市“甬江建设杯”选票结果
+
+
+
+
+
+
+
+
+
+ 通过
+ 不通过
+
+
+
+
+
+
+
+
+
+
+
+
+ 通过
+ 不通过
+
+
+
+
+
+
+
+
+
+
+
+
+ 通过
+ 不通过
+
+
+
+
+
+
+
+
+
+
+
+
+ 通过
+ 不通过
+
+
+
+
+
+
+
+
+
+
+
+
+ 通过
+ 不通过
+
+
+
+
+
+
+
+
+
+
+
+
+ 通过
+ 不通过
+
+
+
+
+
+
+
+
+ 刷新数据
+ 导出Excel
+ 查看专家投票情况
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/20220330_Vote/Ewide.Web.Entry/Views/Manage/Login.cshtml b/20220330_Vote/Ewide.Web.Entry/Views/Manage/Login.cshtml
new file mode 100644
index 0000000..50b04de
--- /dev/null
+++ b/20220330_Vote/Ewide.Web.Entry/Views/Manage/Login.cshtml
@@ -0,0 +1,269 @@
+@*
+ For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
+*@
+@{
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
后台登录
+
+
+
+
+
+
+
+
+
+ 登录
+ @*重置*@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/20220330_Vote/Ewide.Web.Entry/Views/Shared/_Layout.cshtml b/20220330_Vote/Ewide.Web.Entry/Views/Shared/_Layout.cshtml
index 84dc8a3..86df639 100644
--- a/20220330_Vote/Ewide.Web.Entry/Views/Shared/_Layout.cshtml
+++ b/20220330_Vote/Ewide.Web.Entry/Views/Shared/_Layout.cshtml
@@ -3,7 +3,7 @@
- @ViewData["Title"] - Furion
+ 2021年度宁波市“甬江建设杯”选票
@RenderBody()
diff --git a/20220330_Vote/Ewide.Web.Entry/Views/Vote/Index.cshtml b/20220330_Vote/Ewide.Web.Entry/Views/Vote/Index.cshtml
index e1dd794..9958614 100644
--- a/20220330_Vote/Ewide.Web.Entry/Views/Vote/Index.cshtml
+++ b/20220330_Vote/Ewide.Web.Entry/Views/Vote/Index.cshtml
@@ -3,3 +3,292 @@
*@
@{
}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
2021年度宁波市“甬江建设杯”选票
+
+
+
+ {{project.serial_number}}:{{project.name}}
+
+
+
+ 同意
+ 不同意
+
+
+
+
+
+
+
+ {{project.serial_number}}:{{project.name}}
+
+
+
+ 同意
+ 不同意
+
+
+
+
+
+
+
+ {{project.serial_number}}:{{project.name}}
+
+
+
+ 同意
+ 不同意
+
+
+
+
+
+
+
+ {{project.serial_number}}:{{project.name}}
+
+
+
+ 同意
+ 不同意
+
+
+
+
+
+
+
+ {{project.serial_number}}:{{project.name}}
+
+
+
+ 同意
+ 不同意
+
+
+
+
+
+
+
+ {{project.serial_number}}:{{project.name}}
+
+
+
+ 同意
+ 不同意
+
+
+
+
+
+
+
+
+
+
+ 全部同意
+ 提交
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/20220330_Vote/Ewide.Web.Entry/wwwroot/ExcelTemplate/2021年度甬江杯投票.xlsx b/20220330_Vote/Ewide.Web.Entry/wwwroot/ExcelTemplate/2021年度甬江杯投票.xlsx
new file mode 100644
index 0000000..c66bf71
Binary files /dev/null and b/20220330_Vote/Ewide.Web.Entry/wwwroot/ExcelTemplate/2021年度甬江杯投票.xlsx differ
diff --git a/20220330_Vote/Vote.Services/ApiController/ProjectsService.cs b/20220330_Vote/Vote.Services/ApiController/ProjectsService.cs
index c037927..66f75dd 100644
--- a/20220330_Vote/Vote.Services/ApiController/ProjectsService.cs
+++ b/20220330_Vote/Vote.Services/ApiController/ProjectsService.cs
@@ -1,9 +1,13 @@
-using Furion.DatabaseAccessor;
+using Ewide.Core.Util;
+using Furion.DatabaseAccessor;
using Furion.DynamicApiController;
+using Furion.FriendlyException;
using Mapster;
using Microsoft.AspNetCore.Mvc;
+using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
+using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@@ -15,12 +19,17 @@ namespace Vote.Services.ApiController
/// 项目
///
[ApiDescriptionSettings("Vote", Order = 0)]
+ [Route("/gb/yjb/api/projects")]
public class ProjectsService : IDynamicApiController
{
private readonly IRepository rep_Projects;
- public ProjectsService(IRepository _rep_Projects)
+ private readonly IRepository rep_Experts;
+ private readonly IRepository rep_VoteRecords;
+ public ProjectsService(IRepository _rep_Projects, IRepository _rep_Experts, IRepository _rep_VoteRecords)
{
rep_Projects = _rep_Projects;
+ rep_Experts = _rep_Experts;
+ rep_VoteRecords = _rep_VoteRecords;
}
///
/// 列表
@@ -28,14 +37,153 @@ namespace Vote.Services.ApiController
///
[HttpPost]
[Microsoft.AspNetCore.Authorization.AllowAnonymous]
- public async Task List()
+ public async Task List(ProjectsInput args)
{
var data = await rep_Projects.DetachedEntities.Where(p => !p.IsDeleted)
- //.ProjectToType()
+ .Where(args.type != null, a => (int)a.type == args.type)
+ .ProjectToType()
.OrderBy(a => a.serial_number)
- .ToPagedListAsync();
-
+ .ToListAsync();
return data;
}
+
+ ///
+ /// 检验提交码
+ ///
+ ///
+ [HttpPost]
+ [Microsoft.AspNetCore.Authorization.AllowAnonymous]
+ public async Task CheckSubmitCode(CheckSubmitCodeInput args)
+ {
+ var data = await rep_Experts.DetachedEntities.Where(p => !p.IsDeleted)
+ .Where(a => a.login_code == args.code)
+ .FirstOrDefaultAsync();
+ return data != null;
+ }
+
+
+ ///
+ /// 提交
+ ///
+ ///
+ [HttpPost]
+ [UnitOfWork]
+ [Microsoft.AspNetCore.Authorization.AllowAnonymous]
+ public async Task SubmitSubmitVote(SubmitInput args)
+ {
+ var data = await rep_Experts.DetachedEntities.Where(p => !p.IsDeleted)
+ .Where(a => a.login_code == args.code)
+ .FirstOrDefaultAsync();
+ _ = (data == null) ? throw Oops.Oh("提交码错误") : 1;
+ //var list = args.projects.Adapt>();
+ //删除这个专家上次提交的结果
+ //或者提示不能再次提交
+ _ = (await rep_VoteRecords.DetachedEntities.Where(a => !a.IsDeleted && a.expert_login_code == args.code).CountAsync() > 0) ? throw Oops.Oh("已提交,无需再次提交") : 1;
+ var now = DateTime.Now;
+ args.projects.ForEach(async a =>
+ {
+ var model = new Entities.VoteRecords
+ {
+ expert_login_code = args.code,
+ project_id = a.id,
+ is_agree = a.vote,
+ vote_time = now
+ };
+ await model.InsertOrUpdate();
+ });
+ return true;
+ }
+ private async Task> 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
+ };
+ return await query.OrderBy(a => a.serial_number).ToListAsync();
+ }
+ ///
+ /// 列表
+ ///
+ ///
+ [HttpPost]
+ public async Task 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) =>
+ // new
+ // {
+ // //a.Id,
+ // //type = (int)a.type,
+ // //serial_number = a.serial_number,
+ // //name = a.name,
+ // //no_count = b.Where(bb => !bb.is_agree).Count(),
+ // //yes_count = b.Where(bb => bb.is_agree).Count(),
+ // }).ToList();
+ ////.ProjectToType()
+ ////.OrderBy(a => a.serial_number)
+ ////.ToListAsync();
+ var data = await GetVoteData();
+ var data0 = data.Where(a => a.type == Entities.EnumProjectType.FangJian).ToList();
+ var data1 = data.Where(a => a.type == Entities.EnumProjectType.ShiZheng).ToList();
+ var data2 = data.Where(a => a.type == Entities.EnumProjectType.GuiDaoGongCheng).ToList();
+ var data3 = data.Where(a => a.type == Entities.EnumProjectType.DianLiGongCheng).ToList();
+ var data4 = data.Where(a => a.type == Entities.EnumProjectType.JiaoTongGongCheng).ToList();
+ var data5 = data.Where(a => a.type == Entities.EnumProjectType.ShuiLiGongCheng).ToList();
+ return new
+ {
+ data0,
+ data1,
+ data2,
+ data3,
+ data4,
+ data5
+ };
+ }
+ ///
+ ///
+ ///
+ ///
+ public async Task Download()
+ {
+ var data = await GetVoteData();
+ var filepath = Tools.ExcelHelper.WriteTemplate(data, 4, "C");
+ return new FileStreamResult(new FileStream(filepath, FileMode.Open), "application/octet-stream") { FileDownloadName = filepath };
+ }
+ ///
+ ///
+ ///
+ ///
+ public async Task ExpertVote()
+ {
+ var list = await rep_Experts.DetachedEntities.GroupJoin(rep_VoteRecords.DetachedEntities, a => a.login_code, a => a.expert_login_code, (a, b) => new { a, b })
+ .SelectMany(a => a.b.DefaultIfEmpty(), (a, b) => new { a.a.Id, a.a.login_code, is_vote = b != null })
+ .Distinct().ToListAsync();
+ return list;
+ //var query = from a in rep_Experts.DetachedEntities
+ // join b in rep_VoteRecords.DetachedEntities on a.login_code equals b.expert_login_code into temp
+ // from tt in temp.DefaultIfEmpty()
+ // select new
+ // {
+ // a.Id,
+ // a.login_code,
+ // is_vote = tt == null
+ // };
+ //return await query.ToListAsync();
+
+
+ }
+
}
}
diff --git a/20220330_Vote/Vote.Services/Dto/ProjectsInput.cs b/20220330_Vote/Vote.Services/Dto/ProjectsInput.cs
index eaf48b9..f271277 100644
--- a/20220330_Vote/Vote.Services/Dto/ProjectsInput.cs
+++ b/20220330_Vote/Vote.Services/Dto/ProjectsInput.cs
@@ -1,6 +1,7 @@
using Ewide.Core.Util;
using System;
using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@@ -10,9 +11,17 @@ namespace Vote.Services.Dto
{
public class ProjectsInput
{
+ ///
+ /// 项目类型
+ ///
+ public int? type { get; set; }
}
public class ProjectsOutput
{
+ ///
+ ///
+ ///
+ public string id { get; set; }
///
/// 项目序号
///
@@ -35,5 +44,71 @@ namespace Vote.Services.Dto
return type.GetEnumDescription();
}
}
+ ///
+ ///
+ ///
+ public bool vote { get; set; } = false;
+ }
+ public class CheckSubmitCodeInput
+ {
+ ///
+ /// 项目类型
+ ///
+ [Required]
+ public string code { get; set; }
+ }
+ public class SubmitInput
+ {
+ ///
+ /// 项目类型
+ ///
+ [Required]
+ public string code { get; set; }
+ [Required]
+ public List projects { get; set; }
+ }
+
+ public class ProjectsList2Output
+ {
+ ///
+ ///
+ ///
+ public string id { get; set; }
+ ///
+ /// 项目序号
+ ///
+ public int serial_number { get; set; }
+ ///
+ /// 工程名称
+ ///
+ public string name { get; set; }
+
+ public int no_count { get; set; }
+ public int yes_count { get; set; }
+
+ ///
+ ///
+ ///
+ public bool is_agree
+ {
+ get
+ {
+ return yes_count >= 12;
+ }
+ }
+ ///
+ /// 项目类型
+ ///
+ public EnumProjectType type { get; set; }
+ ///
+ /// 项目类型
+ ///
+ public string type_title
+ {
+ get
+ {
+ return type.GetEnumDescription();
+ }
+ }
}
}
diff --git a/20220330_Vote/Vote.Services/Tools/ExcelHelper.cs b/20220330_Vote/Vote.Services/Tools/ExcelHelper.cs
new file mode 100644
index 0000000..340b3e3
--- /dev/null
+++ b/20220330_Vote/Vote.Services/Tools/ExcelHelper.cs
@@ -0,0 +1,212 @@
+using Furion;
+using Furion.FriendlyException;
+using NPOI.HSSF.UserModel;
+using NPOI.SS.UserModel;
+using NPOI.XSSF.UserModel;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Text.RegularExpressions;
+using System.Threading.Tasks;
+using Vote.Services.Dto;
+
+namespace Vote.Services.Tools
+{
+ ///
+ ///
+ ///
+ public static class ExcelHelper
+ {
+ static ExcelHelper()
+ {
+ System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance);
+ }
+ ///
+ /// 判断是否为兼容模式
+ ///
+ ///
+ ///
+ public static bool GetIsCompatible(string filePath)
+ {
+ return filePath.EndsWith(".xls", StringComparison.OrdinalIgnoreCase);
+ }
+ ///
+ /// 创建工作薄
+ ///
+ ///
+ ///
+ public static IWorkbook CreateWorkbook(bool isCompatible)
+ {
+ if (isCompatible)
+ {
+ return new HSSFWorkbook();
+ }
+ else
+ {
+ return new XSSFWorkbook();
+ }
+ }
+
+ ///
+ /// 创建工作薄(依据文件流)
+ ///
+ ///
+ ///
+ ///
+ public static IWorkbook CreateWorkbook(bool isCompatible, dynamic stream)
+ {
+ if (isCompatible)
+ {
+ return new HSSFWorkbook(stream);
+ }
+ else
+ {
+ return new XSSFWorkbook(stream);
+ }
+ }
+
+
+
+ ///
+ /// 列名字母转索引
+ ///
+ ///
+ ///
+ public static int ToExcelColumnIndex(this string columnName)
+ {
+ if (!Regex.IsMatch(columnName.ToUpper(), @"[A-Z]+")) { throw new Exception("invalid parameter"); }
+ int index = 0;
+ char[] chars = columnName.ToUpper().ToCharArray();
+ for (int i = 0; i < chars.Length; i++)
+ {
+ index += ((int)chars[i] - (int)'A' + 1) * (int)Math.Pow(26, chars.Length - i - 1);
+ }
+ return index - 1;
+ }
+ ///
+ /// 列索引转字母
+ ///
+ ///
+ ///
+ public static string ToExcelColumnName(this int index)
+ {
+ if (index < 0) { throw new Exception("invalid parameter"); }
+ List chars = new List();
+ do
+ {
+ if (chars.Count > 0) index--;
+ chars.Insert(0, ((char)(index % 26 + (int)'A')).ToString());
+ index = (int)((index - index % 26) / 26);
+ } while (index > 0);
+ return String.Join(string.Empty, chars.ToArray());
+ }
+
+
+ private static List GetDataByType(List list, Entities.EnumProjectType type)
+ {
+ return list.Where(a => a.type == type).ToList();
+ }
+
+ ///
+ ///
+ ///
+ ///
+ public static string WriteTemplate(List list, int start_row, string start_column)
+ {
+ try
+ {
+ string template_name = "2021年度甬江杯投票.xlsx";
+ string excelFilePath = $"{App.WebHostEnvironment.WebRootPath}\\ExcelTemplate\\{template_name}";
+ string outputPath = string.Empty;
+ if (!string.IsNullOrEmpty(excelFilePath))
+ {
+ using (FileStream excelFileStream = System.IO.File.OpenRead(excelFilePath))
+ {
+ bool isCompatible = ExcelHelper.GetIsCompatible(excelFilePath);
+ IWorkbook workbook = ExcelHelper.CreateWorkbook(isCompatible, excelFileStream);
+ ISheet sheet = null;
+ sheet = workbook.GetSheetAt(1);
+ Dictionary dic_sheet_config = new Dictionary();
+ var data = GetDataByType(list, Entities.EnumProjectType.FangJian);
+ //从第几行开始 , 比如 行号是4 , 就写3
+ var startRowIndex = start_row - 1;
+ for (int i = 0; i < data.Count; i++)
+ {
+ var c_rowindex = startRowIndex + i;
+ int cell_start_index = start_column.ToExcelColumnIndex();
+ sheet.GetRow(c_rowindex).GetCell(cell_start_index).SetCellValue(data[i].no_count);
+ sheet.GetRow(c_rowindex).GetCell(cell_start_index + 1).SetCellValue(data[i].yes_count);
+ sheet.GetRow(c_rowindex).GetCell(cell_start_index + 2).SetCellValue(data[i].is_agree ? "通过" : "不通过");
+ }
+ var length0 = data.Count;
+ data = GetDataByType(list, Entities.EnumProjectType.ShiZheng);
+ for (int i = 0; i < data.Count; i++)
+ {
+ var c_rowindex = length0 + 1 + startRowIndex + i;
+ int cell_start_index = start_column.ToExcelColumnIndex();
+ sheet.GetRow(c_rowindex).GetCell(cell_start_index).SetCellValue(data[i].no_count);
+ sheet.GetRow(c_rowindex).GetCell(cell_start_index + 1).SetCellValue(data[i].yes_count);
+ sheet.GetRow(c_rowindex).GetCell(cell_start_index + 2).SetCellValue(data[i].is_agree ? "通过" : "不通过");
+ }
+ var length1 = data.Count;
+ data = GetDataByType(list, Entities.EnumProjectType.GuiDaoGongCheng);
+ for (int i = 0; i < data.Count; i++)
+ {
+ var c_rowindex = length0 + 1 + length1 + 1 + startRowIndex + i;
+ int cell_start_index = start_column.ToExcelColumnIndex();
+ sheet.GetRow(c_rowindex).GetCell(cell_start_index).SetCellValue(data[i].no_count);
+ sheet.GetRow(c_rowindex).GetCell(cell_start_index + 1).SetCellValue(data[i].yes_count);
+ sheet.GetRow(c_rowindex).GetCell(cell_start_index + 2).SetCellValue(data[i].is_agree ? "通过" : "不通过");
+ }
+ var length2 = data.Count;
+ data = GetDataByType(list, Entities.EnumProjectType.DianLiGongCheng);
+ for (int i = 0; i < data.Count; i++)
+ {
+ var c_rowindex = length0 + 1 + length1 + 1 + length2 + 1 + startRowIndex + i;
+ int cell_start_index = start_column.ToExcelColumnIndex();
+ sheet.GetRow(c_rowindex).GetCell(cell_start_index).SetCellValue(data[i].no_count);
+ sheet.GetRow(c_rowindex).GetCell(cell_start_index + 1).SetCellValue(data[i].yes_count);
+ sheet.GetRow(c_rowindex).GetCell(cell_start_index + 2).SetCellValue(data[i].is_agree ? "通过" : "不通过");
+ }
+ var length3 = data.Count;
+ data = GetDataByType(list, Entities.EnumProjectType.JiaoTongGongCheng);
+ for (int i = 0; i < data.Count; i++)
+ {
+ var c_rowindex = length0 + 1 + length1 + 1 + length2 + 1 + length3 + 1 + startRowIndex + i;
+ int cell_start_index = start_column.ToExcelColumnIndex();
+ sheet.GetRow(c_rowindex).GetCell(cell_start_index).SetCellValue(data[i].no_count);
+ sheet.GetRow(c_rowindex).GetCell(cell_start_index + 1).SetCellValue(data[i].yes_count);
+ sheet.GetRow(c_rowindex).GetCell(cell_start_index + 2).SetCellValue(data[i].is_agree ? "通过" : "不通过");
+ }
+ var length4 = data.Count;
+ data = GetDataByType(list, Entities.EnumProjectType.ShuiLiGongCheng);
+ for (int i = 0; i < data.Count; i++)
+ {
+ var c_rowindex = length0 + 1 + length1 + 1 + length2 + 1 + length3 + 1 + length4 + 1 + startRowIndex + i;
+ int cell_start_index = start_column.ToExcelColumnIndex();
+ sheet.GetRow(c_rowindex).GetCell(cell_start_index).SetCellValue(data[i].no_count);
+ sheet.GetRow(c_rowindex).GetCell(cell_start_index + 1).SetCellValue(data[i].yes_count);
+ sheet.GetRow(c_rowindex).GetCell(cell_start_index + 2).SetCellValue(data[i].is_agree ? "通过" : "不通过");
+ }
+ var file = new FileInfo(excelFilePath);
+ var savePath = file.DirectoryName + "\\OutPut\\";
+ if (!Directory.Exists(savePath))
+ Directory.CreateDirectory(savePath);
+ outputPath = savePath + DateTime.Now.ToString("yyyyMMddHHmmss") + "-" + template_name;
+ using (var filess = new FileStream(outputPath, FileMode.Create, FileAccess.Write, FileShare.Read))
+ {
+ workbook.Write(filess);
+ }
+ }
+ }
+ return outputPath;
+ }
+ catch (System.IO.IOException ioex)
+ {
+ throw Oops.Oh("文件被占用,请检查文件模板");
+ }
+ }
+ }
+}
diff --git a/20220330_Vote/Vote.Services/Vote.Services.csproj b/20220330_Vote/Vote.Services/Vote.Services.csproj
index 863ec06..1d441aa 100644
--- a/20220330_Vote/Vote.Services/Vote.Services.csproj
+++ b/20220330_Vote/Vote.Services/Vote.Services.csproj
@@ -12,4 +12,22 @@
+
+
+ ..\Ewide.Web.Entry\bin\Debug\net5.0\ICSharpCode.SharpZipLib.dll
+
+
+ ..\Ewide.Web.Entry\bin\Debug\net5.0\NPOI.dll
+
+
+ ..\Ewide.Web.Entry\bin\Debug\net5.0\NPOI.OOXML.dll
+
+
+ ..\Ewide.Web.Entry\bin\Debug\net5.0\NPOI.OpenXml4Net.dll
+
+
+ ..\Ewide.Web.Entry\bin\Debug\net5.0\NPOI.OpenXmlFormats.dll
+
+
+
diff --git a/20220330_Vote/Vote.Services/Vote.Services.xml b/20220330_Vote/Vote.Services/Vote.Services.xml
index 401b9b8..bf93e6b 100644
--- a/20220330_Vote/Vote.Services/Vote.Services.xml
+++ b/20220330_Vote/Vote.Services/Vote.Services.xml
@@ -9,12 +9,52 @@
项目
-
+
列表
+
+
+ 检验提交码
+
+
+
+
+
+ 提交
+
+
+
+
+
+ 列表
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 项目类型
+
+
+
+
+
+
+
项目序号
@@ -35,6 +75,51 @@
项目类型
+
+
+
+
+
+
+
+ 项目类型
+
+
+
+
+ 项目类型
+
+
+
+
+
+
+
+
+
+ 项目序号
+
+
+
+
+ 工程名称
+
+
+
+
+
+
+
+
+
+ 项目类型
+
+
+
+
+ 项目类型
+
+
专家表
@@ -130,5 +215,52 @@
投票时间
+
+
+
+
+
+
+
+ 判断是否为兼容模式
+
+
+
+
+
+
+ 创建工作薄
+
+
+
+
+
+
+ 创建工作薄(依据文件流)
+
+
+
+
+
+
+
+ 列名字母转索引
+
+
+
+
+
+
+ 列索引转字母
+
+
+
+
+
+
+
+
+
+