|
@@ -28041,6 +28041,14 @@ ORDER BY
|
|
|
.Select(x => new { x.Id, x.Title, x.DataDetails, x.Details, x.Remark })
|
|
|
.ToListAsync();
|
|
|
|
|
|
+ if (!conferenceProceduresList.Any())
|
|
|
+ {
|
|
|
+ conferenceProceduresList = await _sqlSugar.Queryable<Grp_ConferenceProcedures>()
|
|
|
+ .Where(x => x.DiId == -1 && x.IsDel == 0)
|
|
|
+ .Select(x => new { x.Id, x.Title, x.DataDetails, x.Details, x.Remark })
|
|
|
+ .ToListAsync();
|
|
|
+ }
|
|
|
+
|
|
|
var conferenceProceduresGroupByTitle = conferenceProceduresList
|
|
|
.GroupBy(x => x.Title)
|
|
|
.Select(x => new
|
|
@@ -28140,6 +28148,80 @@ ORDER BY
|
|
|
return Ok(JsonView(true, "SUCCESS"));
|
|
|
}
|
|
|
|
|
|
+ [HttpPost]
|
|
|
+ public async Task<IActionResult> ConferenceProceduresFileDown(ConferenceProceduresFileDownDto dto)
|
|
|
+ {
|
|
|
+
|
|
|
+ var groupInfo = await _sqlSugar.Queryable<Grp_DelegationInfo>()
|
|
|
+ .Where(x => x.Id == dto.GroupId && x.IsDel == 0)
|
|
|
+ .FirstAsync();
|
|
|
+ if (groupInfo == null)
|
|
|
+ {
|
|
|
+ return Ok(JsonView(false, "团组信息不存在"));
|
|
|
+ }
|
|
|
+
|
|
|
+ var conferenceProceduresList = await _sqlSugar.Queryable<Grp_ConferenceProcedures>()
|
|
|
+ .Where(x => x.DiId == dto.GroupId && x.IsDel == 0)
|
|
|
+ .ToListAsync();
|
|
|
+
|
|
|
+ if (!conferenceProceduresList.Any())
|
|
|
+ {
|
|
|
+ return Ok(JsonView(false, "会务流程信息不存在"));
|
|
|
+ }
|
|
|
+
|
|
|
+ var filePath = $"{AppSettingsHelper.Get("ExcelBasePath")}Template/会务流程.xlsx";
|
|
|
+ if (!System.IO.File.Exists(filePath))
|
|
|
+ {
|
|
|
+ return Ok(JsonView(false, "模板文件不存在"));
|
|
|
+ }
|
|
|
+
|
|
|
+ var designer = new WorkbookDesigner();
|
|
|
+ designer.Workbook = new Workbook(filePath);
|
|
|
+ designer.SetDataSource("TB", conferenceProceduresList);
|
|
|
+ designer.Process();
|
|
|
+
|
|
|
+ var sheet = designer.Workbook.Worksheets[0];
|
|
|
+ var cells = sheet.Cells;
|
|
|
+
|
|
|
+ int col = 0; // 第一列
|
|
|
+ int startRow = 2; // 若第0行为表头,则从第1行开始;无表头请改为0
|
|
|
+ int endRow = cells.MaxDataRow;
|
|
|
+
|
|
|
+ if (endRow >= startRow)
|
|
|
+ {
|
|
|
+ int mergeStart = startRow;
|
|
|
+ string prev = cells[mergeStart, col].StringValue?.Trim() ?? string.Empty;
|
|
|
+
|
|
|
+ for (int r = startRow + 1; r <= endRow; r++)
|
|
|
+ {
|
|
|
+ string cur = cells[r, col].StringValue?.Trim() ?? string.Empty;
|
|
|
+ if (!string.Equals(cur, prev, StringComparison.Ordinal))
|
|
|
+ {
|
|
|
+ int count = r - mergeStart;
|
|
|
+ if (count > 1)
|
|
|
+ cells.Merge(mergeStart, col, count, 1);
|
|
|
+
|
|
|
+ mergeStart = r;
|
|
|
+ prev = cur;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ int tailCount = endRow - mergeStart + 1;
|
|
|
+ if (tailCount > 1)
|
|
|
+ cells.Merge(mergeStart, col, tailCount, 1);
|
|
|
+ }
|
|
|
+
|
|
|
+ byte[] bytes = null;
|
|
|
+
|
|
|
+ using (MemoryStream stream = new MemoryStream())
|
|
|
+ {
|
|
|
+ designer.Workbook.Save(stream, Aspose.Cells.SaveFormat.Xlsx);
|
|
|
+ bytes = stream.ToArray();
|
|
|
+ }
|
|
|
+
|
|
|
+ return File(bytes, "application/excel", $"{groupInfo.TeamName}_会务流程.xlsx");
|
|
|
+ }
|
|
|
+
|
|
|
#endregion
|
|
|
|
|
|
#region 团组签证流程
|