Commit e49bb01d by ruyun.zhang@suvalue.com

Merge branch 'hotfix/二次分配保存验证状态' into release/v22.2.14-Beta-lintao

parents 784a5044 fc5b7f20
...@@ -745,6 +745,9 @@ public ApiResponse RedistributionSave([FromBody] SecondComputeDto request) ...@@ -745,6 +745,9 @@ public ApiResponse RedistributionSave([FromBody] SecondComputeDto request)
var second = secondAllotService.GetSecondAllot(request.SecondId); var second = secondAllotService.GetSecondAllot(request.SecondId);
if (second == null) throw new PerformanceException("参数SecondId无效!"); if (second == null) throw new PerformanceException("参数SecondId无效!");
if (second.Status == (int)SecondAllot.Status.等待审核 || second.Status == (int)SecondAllot.Status.审核通过)
throw new PerformanceException("保存失败,当前二次分配已提交!");
var allot = _allotService.GetAllot(second.AllotId.Value); var allot = _allotService.GetAllot(second.AllotId.Value);
if (allot == null) if (allot == null)
throw new PerformanceException("绩效记录不存在!"); throw new PerformanceException("绩效记录不存在!");
......
...@@ -134,4 +134,14 @@ public enum Role ...@@ -134,4 +134,14 @@ public enum Role
数据收集 = 11, 数据收集 = 11,
绩效查询 = 12, 绩效查询 = 12,
} }
public class SecondAllot
{
public enum Status
{
未提交 = 1,
等待审核 = 2,
审核通过 = 3,
驳回 = 4,
}
}
} }
...@@ -209,7 +209,7 @@ public int InsertExecute(IEnumerable<TEntity> data) ...@@ -209,7 +209,7 @@ public int InsertExecute(IEnumerable<TEntity> data)
} }
catch catch
{ {
return 0; throw;
} }
} }
} }
......
using Performance.EntityModels; using Performance.EntityModels;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
...@@ -42,5 +43,11 @@ public List<view_second_compute_collect> GetComputeBySecond(int secondId) ...@@ -42,5 +43,11 @@ public List<view_second_compute_collect> GetComputeBySecond(int secondId)
return new List<view_second_compute_collect>(); return new List<view_second_compute_collect>();
} }
public int Submit(int secondId, int tempId, decimal realGiveFee, string remark = "")
{
string sql = "UPDATE ag_secondallot SET UseTempId = @tempId,NursingDeptStatus = @status, Status = @status, SubmitTime = @date, Remark = @remark WHERE Id = @secondId AND RealGiveFee = @fee";
return Execute(sql, new { secondId, tempId, status = 2, date = DateTime.Now, fee = realGiveFee, remark });
}
} }
} }
...@@ -30,5 +30,10 @@ public class ExcelHeader ...@@ -30,5 +30,10 @@ public class ExcelHeader
/// 工作量系数 /// 工作量系数
/// </summary> /// </summary>
public decimal? WorkloadFactor { get; set; } public decimal? WorkloadFactor { get; set; }
/// <summary>
/// 排序
/// </summary>
public int Sort { get; set; }
} }
} }
...@@ -41,6 +41,7 @@ public static void WriteSheetHeader(ISheet sheet, PerSheetPoint point, SheetType ...@@ -41,6 +41,7 @@ public static void WriteSheetHeader(ISheet sheet, PerSheetPoint point, SheetType
int headerFirstCellNum = point.DataFirstCellNum.Value; int headerFirstCellNum = point.DataFirstCellNum.Value;
if (columnHeader.LastCellNum > point.DataFirstCellNum.Value) if (columnHeader.LastCellNum > point.DataFirstCellNum.Value)
{ {
var rows = new IRow[] { nurseFactor, doctorFactor, technicianFactor, columnHeader };
for (int index = point.DataFirstCellNum.Value; index < columnHeader.LastCellNum; index++) for (int index = point.DataFirstCellNum.Value; index < columnHeader.LastCellNum; index++)
{ {
var category = columnHeader.GetCell(index).GetDecodeEscapes(); var category = columnHeader.GetCell(index).GetDecodeEscapes();
...@@ -53,13 +54,14 @@ public static void WriteSheetHeader(ISheet sheet, PerSheetPoint point, SheetType ...@@ -53,13 +54,14 @@ public static void WriteSheetHeader(ISheet sheet, PerSheetPoint point, SheetType
} }
else else
{ {
var rows = new IRow[] { nurseFactor, doctorFactor, technicianFactor, columnHeader };
foreach (var item in rows) foreach (var item in rows)
{ {
var cell = item.GetCell(index); var cell = item.GetCell(index);
if (cell != null) if (cell != null)
item.RemoveCell(cell); item.RemoveCell(cell);
} }
var column = columns.FirstOrDefault(w => w.ColumnName.NoBlank() == category);
if (column != null) column.Sort = index;
} }
} }
if (headerFirstCellNum > point.DataFirstCellNum.Value) if (headerFirstCellNum > point.DataFirstCellNum.Value)
...@@ -69,7 +71,7 @@ public static void WriteSheetHeader(ISheet sheet, PerSheetPoint point, SheetType ...@@ -69,7 +71,7 @@ public static void WriteSheetHeader(ISheet sheet, PerSheetPoint point, SheetType
if (columns == null || !columns.Any()) return; if (columns == null || !columns.Any()) return;
// 补充excel中不存在的列 // 补充excel中不存在的列
foreach (var item in columns) foreach (var item in columns.OrderBy(t => t.Sort).ThenBy(t => t.ColumnName))
{ {
var columnCell = columnHeader.GetOrCreate(headerFirstCellNum); var columnCell = columnHeader.GetOrCreate(headerFirstCellNum);
columnCell.SetCellValue(item.ColumnName); columnCell.SetCellValue(item.ColumnName);
...@@ -434,7 +436,7 @@ public static void WriteCollectData(ISheet sheet, PerSheetPoint point, SheetType ...@@ -434,7 +436,7 @@ public static void WriteCollectData(ISheet sheet, PerSheetPoint point, SheetType
var value = deptData.FirstOrDefault(t => t.TypeName.NoBlank() == column)?.CellValue; var value = deptData.FirstOrDefault(t => t.TypeName.NoBlank() == column)?.CellValue;
//数据为空,且单元格值不为空,不写入数据(保留原始值) //数据为空,且单元格值不为空,不写入数据(保留原始值)
var notWrite = string.IsNullOrEmpty(value) && !string.IsNullOrEmpty(cell.ToString()); var notWrite = string.IsNullOrEmpty(value) && !string.IsNullOrEmpty(cell.ToString());
if (cell.CellType != CellType.Formula && !notWrite) if (!notWrite)
{ {
cell.SetCellValue<decimal>(value); cell.SetCellValue<decimal>(value);
if (headers != null && headers.Contains(column)) if (headers != null && headers.Contains(column))
...@@ -531,7 +533,7 @@ public static void WriteCollectData(ISheet sheet, PerSheetPoint point, SheetType ...@@ -531,7 +533,7 @@ public static void WriteCollectData(ISheet sheet, PerSheetPoint point, SheetType
var cell = row.GetOrCreate(cellIndex); var cell = row.GetOrCreate(cellIndex);
var value = deptData.FirstOrDefault(t => t.TypeName.NoBlank() == column)?.CellValue; var value = deptData.FirstOrDefault(t => t.TypeName.NoBlank() == column)?.CellValue;
if (cell.CellType != CellType.Formula) if (!string.IsNullOrEmpty(value) && cell.CellType != CellType.Formula)
{ {
cell.SetCellValue<decimal>(value); cell.SetCellValue<decimal>(value);
cell.CellStyle = cellStyle; cell.CellStyle = cellStyle;
......
...@@ -56,6 +56,7 @@ public void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType sheetTyp ...@@ -56,6 +56,7 @@ public void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType sheetTyp
DoctorFactor = t.outer?.FirstOrDefault()?.YSZ, DoctorFactor = t.outer?.FirstOrDefault()?.YSZ,
NurseFactor = t.outer?.FirstOrDefault()?.HLZ, NurseFactor = t.outer?.FirstOrDefault()?.HLZ,
TechnicianFactor = t.outer?.FirstOrDefault()?.YJZ, TechnicianFactor = t.outer?.FirstOrDefault()?.YJZ,
Sort = 1000
}).ToList(); }).ToList();
} }
else else
...@@ -63,6 +64,7 @@ public void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType sheetTyp ...@@ -63,6 +64,7 @@ public void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType sheetTyp
headers = categories.Select(t => new ExcelHeader headers = categories.Select(t => new ExcelHeader
{ {
ColumnName = t, ColumnName = t,
Sort = 1000
}).ToList(); }).ToList();
} }
......
...@@ -201,12 +201,12 @@ private void SupplySpecialQuantity(ISheet sheet, ExcelStyle style, List<SpecialD ...@@ -201,12 +201,12 @@ private void SupplySpecialQuantity(ISheet sheet, ExcelStyle style, List<SpecialD
{ {
var cell = row.GetOrCreate(quantityIndex); var cell = row.GetOrCreate(quantityIndex);
if (cell.CellType != CellType.Formula) //if (cell.CellType != CellType.Formula)
{ //{
cell.SetCellType(CellType.Numeric); cell.SetCellType(CellType.Numeric);
cell.SetCellValue<double>(special.Quantity); cell.SetCellValue<double>(special.Quantity);
cell.CellStyle = cellStyle; cell.CellStyle = cellStyle;
} //}
specials.Remove(special); specials.Remove(special);
} }
dataFirstRowNum = rowIndex + 1; dataFirstRowNum = rowIndex + 1;
...@@ -310,7 +310,7 @@ private void WriteSpecialData(IRow row, ICellStyle style, SpecialDto special, Li ...@@ -310,7 +310,7 @@ private void WriteSpecialData(IRow row, ICellStyle style, SpecialDto special, Li
var index = columns.IndexOf(item.Key); var index = columns.IndexOf(item.Key);
var cell = row.GetOrCreate(index); var cell = row.GetOrCreate(index);
if (cell != null && cell.CellType != CellType.Formula) if (cell != null /*&& cell.CellType != CellType.Formula*/)
{ {
if (new string[] { SpecialUnitColumns.Department, SpecialUnitColumns.Target }.Contains(item.Key)) if (new string[] { SpecialUnitColumns.Department, SpecialUnitColumns.Target }.Contains(item.Key))
cell.SetCellValue(item.Value.Invoke(special)?.ToString()); cell.SetCellValue(item.Value.Invoke(special)?.ToString());
......
...@@ -1621,14 +1621,11 @@ bool VerifySubmissioAmount(decimal? leftAmount, decimal? rightAmount) ...@@ -1621,14 +1621,11 @@ bool VerifySubmissioAmount(decimal? leftAmount, decimal? rightAmount)
if (!VerifySubmissioAmount(total, second.RealGiveFee)) if (!VerifySubmissioAmount(total, second.RealGiveFee))
throw new PerformanceException($"总金额与考核后金额不一致!可分配金额:{second.RealGiveFee},提交金额:{total}"); throw new PerformanceException($"总金额与考核后金额不一致!可分配金额:{second.RealGiveFee},提交金额:{total}");
logger.LogCritical("程序虽然抛出异常但是还是执行了后续代码");
second.UseTempId = temp.UseTempId; var res = agsecondallotRepository.Submit(second.Id, temp.UseTempId ?? 0, total);
second.Status = 2; if (res == 0)
second.NursingDeptStatus = 2; throw new PerformanceException($"提交失败,当前绩效分配可能发生改变!");
second.SubmitType = temp.UseTempId == 6 ? 2 : 1; return true;
second.SubmitTime = DateTime.Now;
//second.Remark = "已提交审核,等待审核中";
return agsecondallotRepository.Update(second);
} }
else if (new int[] { 7, 8 }.Contains(temp.UseTempId.Value)) else if (new int[] { 7, 8 }.Contains(temp.UseTempId.Value))
{ {
...@@ -1641,14 +1638,10 @@ bool VerifySubmissioAmount(decimal? leftAmount, decimal? rightAmount) ...@@ -1641,14 +1638,10 @@ bool VerifySubmissioAmount(decimal? leftAmount, decimal? rightAmount)
if (!VerifySubmissioAmount(total, second.RealGiveFee)) if (!VerifySubmissioAmount(total, second.RealGiveFee))
throw new PerformanceException($"总金额与考核后金额不一致!可分配金额:{second.RealGiveFee},提交金额:{total}"); throw new PerformanceException($"总金额与考核后金额不一致!可分配金额:{second.RealGiveFee},提交金额:{total}");
logger.LogCritical("程序虽然抛出异常但是还是执行了后续代码"); var res = agsecondallotRepository.Submit(second.Id, temp.UseTempId ?? 0, total);
second.UseTempId = temp.UseTempId; if (res == 0)
second.Status = 2; throw new PerformanceException($"提交失败,当前绩效分配可能发生改变!");
second.NursingDeptStatus = 2; return true;
second.SubmitType = temp.UseTempId == 6 ? 2 : 1;
second.SubmitTime = DateTime.Now;
//second.Remark = "已提交审核,等待审核中";
return agsecondallotRepository.Update(second);
} }
else /*if (new int[] { 9, 10 }.Contains(temp.UseTempId.Value))*/ else /*if (new int[] { 9, 10 }.Contains(temp.UseTempId.Value))*/
{ {
...@@ -1657,26 +1650,30 @@ bool VerifySubmissioAmount(decimal? leftAmount, decimal? rightAmount) ...@@ -1657,26 +1650,30 @@ bool VerifySubmissioAmount(decimal? leftAmount, decimal? rightAmount)
throw new PerformanceException("提交时未检测到数据!"); throw new PerformanceException("提交时未检测到数据!");
else else
{ {
var nightShiftWorkPerforFee = data?.Sum(w => w.NightWorkPerformance ?? 0); var nightShiftWorkPerforFee = data.Sum(w => w.NightWorkPerformance ?? 0);
var total = data?.Sum(t => (t.DistPerformance ?? 0) + (t.NightWorkPerformance ?? 0)); var total = data.Sum(t => (t.DistPerformance ?? 0) + (t.NightWorkPerformance ?? 0));
if (!VerifySubmissioAmount(nightShiftWorkPerforFee, second.NightShiftWorkPerforFee)) if (!VerifySubmissioAmount(nightShiftWorkPerforFee, second.NightShiftWorkPerforFee))
throw new PerformanceException($"夜班绩效金额不一致!夜班绩效金额:{second.NightShiftWorkPerforFee ?? 0:0.####},提交金额:{nightShiftWorkPerforFee:0.####}"); throw new PerformanceException($"夜班绩效金额不一致!夜班绩效金额:{second.NightShiftWorkPerforFee ?? 0:0.####},提交金额:{nightShiftWorkPerforFee:0.####}");
else if (!VerifySubmissioAmount(total, second.RealGiveFee)) else if (!VerifySubmissioAmount(total, second.RealGiveFee))
throw new PerformanceException($"总金额与考核后金额不一致!可分配金额:{second.RealGiveFee:0.####},提交金额:{total:0.####}"); throw new PerformanceException($"总金额与考核后金额不一致!可分配金额:{second.RealGiveFee:0.####},提交金额:{total:0.####}");
else else
{ {
// 这段逻辑是为了监测 验证失败后继续修改状态而特意加入的 var res = agsecondallotRepository.Submit(second.Id, temp.UseTempId ?? 0, total);
second.UseTempId = temp.UseTempId; if (res == 0)
second.Status = 2; throw new PerformanceException($"提交失败,当前绩效分配可能发生改变!");
second.NursingDeptStatus = 2; return true;
second.SubmitType = temp.UseTempId == 6 ? 2 : 1;
second.SubmitTime = DateTime.Now;
//second.Remark = "已提交审核,等待审核中";
return agsecondallotRepository.Update(second);
} }
} }
} }
logger.LogCritical("程序虽然抛出异常但是还是执行了后续代码"); //logger.LogCritical("程序虽然抛出异常但是还是执行了后续代码");
//second.UseTempId = temp.UseTempId;
//second.Status = 2;
//second.NursingDeptStatus = 2;
////second.SubmitType = temp.UseTempId == 6 ? 2 : 1;
//second.SubmitTime = DateTime.Now;
//second.Remark = "已提交审核,等待审核中";
//return agsecondallotRepository.Update(second);
} }
/// <summary> /// <summary>
...@@ -2458,17 +2455,17 @@ private List<SecondPerforResponse> GetAllotPerformance(int allotId, List<res_com ...@@ -2458,17 +2455,17 @@ private List<SecondPerforResponse> GetAllotPerformance(int allotId, List<res_com
ShouldGiveFee = t.ShouldGiveFee, ShouldGiveFee = t.ShouldGiveFee,
}; };
// 行政中层 行政高层 补充 夜班费 // 行政中层 行政高层 补充 夜班费
if (types2.Contains(t.AccountType)) if (types2.Contains(t.AccountType))
comp.NightWorkPerfor = t.NightWorkPerfor; comp.NightWorkPerfor = t.NightWorkPerfor;
// 科主任/护士长 // 科主任/护士长
if (types1.Contains(t.AccountType)) if (types1.Contains(t.AccountType))
{ {
// 等同于考核后管理绩效 AssessLaterManagementFee // 等同于考核后管理绩效 AssessLaterManagementFee
comp.PerforManagementFee = Math.Round(t.ShouldGiveFee * t.ScoreAverageRate * t.Attendance + t.Punishment ?? 0); comp.PerforManagementFee = Math.Round(t.ShouldGiveFee * t.ScoreAverageRate * t.Attendance + t.Punishment ?? 0);
// 仅显示管理绩效 // 仅显示管理绩效
if (isShowManage == 2) if (isShowManage == 2)
comp.PerforSumFee = 0; comp.PerforSumFee = 0;
else else
comp.PerforSumFee = t.Avg; comp.PerforSumFee = t.Avg;
......
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