Commit 5551f6bc by 钟博

Merge branch 'release/v20210625绩效划拨二次分配合并' of…

Merge branch 'release/v20210625绩效划拨二次分配合并' of http://gitlab.suvalue.com/zry/performance into release/v20210625绩效划拨二次分配合并
parents e2759395 209f4fe4
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
namespace Performance.Services.ExtractExcelService.SheetDataWrite namespace Performance.Services.ExtractExcelService.SheetDataWrite
{ {
public class CostTransferDataWrite:IAutoInjection public class CostTransferDataWrite : IAutoInjection
{ {
private readonly ILogger logger; private readonly ILogger logger;
private readonly PerforCosttransferRepository costtransferRepository; private readonly PerforCosttransferRepository costtransferRepository;
...@@ -35,15 +35,15 @@ public void WriteSheetData(ISheet sheet, PerSheetPoint point, ExcelStyle style, ...@@ -35,15 +35,15 @@ public void WriteSheetData(ISheet sheet, PerSheetPoint point, ExcelStyle style,
{ {
try try
{ {
var columns = SupplySheetHeader(sheet, point, style);
if (columns == null || !columns.Any()) return;
var costTransfers = costtransferRepository.GetEntities(t => t.AllotId == allotId); var costTransfers = costtransferRepository.GetEntities(t => t.AllotId == allotId);
if (costTransfers == null || !costTransfers.Any()) return; if (costTransfers == null || !costTransfers.Any()) return;
var costTransferItems = costtransferitemRepository.GetEntities(t => costTransfers.Select(c => c.Id).Contains(t.TransferId) && t.Status == 1 && t.AdminStatus == 1 && t.IsWrited == 0); var costTransferItems = costtransferitemRepository.GetEntities(t => costTransfers.Select(c => c.Id).Contains(t.TransferId) && t.Status == 1 && t.AdminStatus == 1 && t.IsWrited == 0);
if (costTransferItems == null || !costTransferItems.Any()) return; if (costTransferItems == null || !costTransferItems.Any()) return;
var columns = SupplySheetHeader(sheet, point);
if (columns == null || !columns.Any()) return;
var departments = costTransfers.Select(t => t.AdoptedDepartment ?? "").Union(costTransfers.Select(t => t.ApplicantDepartment ?? "")).Distinct().ToList(); var departments = costTransfers.Select(t => t.AdoptedDepartment ?? "").Union(costTransfers.Select(t => t.ApplicantDepartment ?? "")).Distinct().ToList();
var cellStyle = style.SetBgkColorAndFormat(style.GetCellStyle(), StyleType.数据); var cellStyle = style.SetBgkColorAndFormat(style.GetCellStyle(), StyleType.数据);
...@@ -62,7 +62,7 @@ public void WriteSheetData(ISheet sheet, PerSheetPoint point, ExcelStyle style, ...@@ -62,7 +62,7 @@ public void WriteSheetData(ISheet sheet, PerSheetPoint point, ExcelStyle style,
} }
} }
private Dictionary<string, int> SupplySheetHeader(ISheet sheet, PerSheetPoint point) private Dictionary<string, int> SupplySheetHeader(ISheet sheet, PerSheetPoint point, ExcelStyle style)
{ {
Dictionary<string, int> pairs = new Dictionary<string, int>(); Dictionary<string, int> pairs = new Dictionary<string, int>();
var header = sheet.GetRow(point.HeaderFirstRowNum.Value); var header = sheet.GetRow(point.HeaderFirstRowNum.Value);
...@@ -84,13 +84,15 @@ public void WriteSheetData(ISheet sheet, PerSheetPoint point, ExcelStyle style, ...@@ -84,13 +84,15 @@ public void WriteSheetData(ISheet sheet, PerSheetPoint point, ExcelStyle style,
if (fixedColumns != null && fixedColumns.Any()) if (fixedColumns != null && fixedColumns.Any())
{ {
var index = header.LastCellNum + 1; var cellStyle = style.SetBgkColorAndFormat(style.GetCellStyle(), StyleType.列头);
var index = header.LastCellNum;
foreach (var column in fixedColumns) foreach (var column in fixedColumns)
{ {
var cell = header.CreateCell(index); var cell = header.CreateCell(index);
cell.SetCellValue(column); cell.SetCellValue(column);
cell.CellStyle = cellStyle;
if (!pairs.ContainsKey(column)) if (!pairs.ContainsKey(column))
pairs.Add(column, index); pairs.Add(column, index);
index++; index++;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment