Commit e4f4af82 by zry

二次绩效审核及其他来源详情

parent afbd0054
......@@ -115,6 +115,18 @@ public ApiResponse SecondDetail([CustomizeValidator(RuleSet = "Refresh"), FromBo
var result = secondAllotService.GetSecondDetail(request);
return new ApiResponse(ResponseType.OK, result);
}
/// <summary>
/// 二次绩效录入页面配置信息
/// </summary>
/// <returns></returns>
[Route("api/second/otherdetail/{secondid}")]
[HttpPost]
public ApiResponse SecondOtherDetail(int secondid)
{
var result = secondAllotService.GetSecondDetail(secondid);
return new ApiResponse(ResponseType.OK, result);
}
#endregion
#region 模板使用
......@@ -209,20 +221,20 @@ public ApiResponse WorkloadDelete([CustomizeValidator(RuleSet = "Delete"), FromB
/// <summary>
/// 提交审核
/// </summary>
/// <param name="secondid">二次绩效Id</param>
/// <param name="request">二次绩效Id</param>
/// <returns></returns>
[HttpPost]
[Route("/api/second/audit/submit/{secondid}")]
public ApiResponse SubmitAudit(int secondid)
[Route("/api/second/audit/submit")]
public ApiResponse SubmitAudit(SubmitAuditRequest request)
{
var second = secondAllotService.GetSecondallot(secondid);
var second = secondAllotService.GetSecondallot(request.SecondId);
if (second == null)
return new ApiResponse(ResponseType.ParameterError, "二次绩效Id无效");
if (second.Status == 3)
return new ApiResponse(ResponseType.Fail, "该绩效已\"审核通过\",无需再次提交");
var userid = claimService.GetUserId();
var result = secondAllotService.AuditSubmit(second);
var result = secondAllotService.AuditSubmit(second, request.Type);
return result ? new ApiResponse(ResponseType.OK, "提交成功") : new ApiResponse(ResponseType.Fail, "提交失败");
}
......
......@@ -797,6 +797,12 @@
</summary>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.SecondAllotController.SecondOtherDetail(System.Int32)">
<summary>
二次绩效录入页面配置信息
</summary>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.SecondAllotController.Temp(Performance.DtoModels.AllotDeptRequest)">
<summary>
选择二次绩效模板
......@@ -839,11 +845,11 @@
</summary>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.SecondAllotController.SubmitAudit(System.Int32)">
<member name="M:Performance.Api.Controllers.SecondAllotController.SubmitAudit(Performance.DtoModels.SubmitAuditRequest)">
<summary>
提交审核
</summary>
<param name="secondid">二次绩效Id</param>
<param name="request">二次绩效Id</param>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.SecondAllotController.AuditList(Performance.DtoModels.AllotDeptRequest)">
......
......@@ -1634,6 +1634,11 @@
短信验证类型 1 手机号登录 2 其他
</summary>
</member>
<member name="P:Performance.DtoModels.SubmitAuditRequest.Type">
<summary>
提交类型 1 模板提交 2 其他提交
</summary>
</member>
<member name="P:Performance.DtoModels.UserRequest.RealName">
<summary>
真实名称
......
......@@ -708,6 +708,11 @@
状态 1 未提交 2 等待审核 3 审核通过 4 驳回
</summary>
</member>
<member name="P:Performance.EntityModels.ag_secondallot.SubmitType">
<summary>
提交类型 1使用模板 2 其他类型数据
</summary>
</member>
<member name="P:Performance.EntityModels.ag_secondallot.SubmitTime">
<summary>
提交时间
......
using FluentValidation;
using System;
using System.Collections.Generic;
using System.Text;
namespace Performance.DtoModels
{
public class SubmitAuditRequest
{
public int SecondId { get; set; }
/// <summary>
/// 提交类型 1 模板提交 2 其他提交
/// </summary>
public int Type { get; set; }
}
public class SubmitAuditRequestValidator : AbstractValidator<SubmitAuditRequest>
{
public SubmitAuditRequestValidator()
{
RuleFor(x => x.Type).InclusiveBetween(1, 2);
RuleFor(x => x.SecondId).GreaterThan(0);
}
}
}
......@@ -55,6 +55,11 @@ public class ag_secondallot
/// 状态 1 未提交 2 等待审核 3 审核通过 4 驳回
/// </summary>
public Nullable<int> Status { get; set; }
/// <summary>
/// 提交类型 1使用模板 2 其他类型数据
/// </summary>
public Nullable<int> SubmitType { get; set; }
/// <summary>
/// 提交时间
......
......@@ -224,6 +224,15 @@ public SecondResponse GetSecondDetail(UseTempRequest request)
}
/// <summary>
/// 二次绩效详情
/// </summary>
/// <returns></returns>
public List<ag_othersource> GetSecondDetail(int secondid)
{
var others = perforAgothersourceRepository.GetEntities(t => t.SecondId == secondid);
return others;
}
/// <summary>
/// 二次绩效项录入保存
/// </summary>
/// <param name="request"></param>
......@@ -576,9 +585,10 @@ public List<ag_secondallot> AuditList(int userId, int allotId)
/// <param name="userId">用户ID</param>
/// <param name="secondId">二次绩效ID</param>
/// <returns></returns>
public bool AuditSubmit(ag_secondallot second)
public bool AuditSubmit(ag_secondallot second, int submittype)
{
second.Status = 2;
second.SubmitType = submittype;
second.SubmitTime = DateTime.Now;
second.Remark = "已提交审核,等待审核中";
return perforAgsecondallotRepository.Update(second);
......@@ -612,42 +622,49 @@ public bool ConfirmAudit(int userId, SecondAuditRequest request)
if (result && request.IsPass == 1)
{
var computes = new List<ag_compute>();
var items = perforAgfixatitemRepository.GetEntities(t => t.SecondId == request.SecondId);
if (items != null && items.Any())
if (second.SubmitType == 1)
{
var rowNumbers = items.Select(t => t.RowNumber).Where(t => t > 0)?.Distinct();
if (rowNumbers != null && rowNumbers.Any())
var items = perforAgfixatitemRepository.GetEntities(t => t.SecondId == request.SecondId);
if (items != null && items.Any())
{
foreach (var item in rowNumbers)
var rowNumbers = items.Select(t => t.RowNumber).Where(t => t > 0)?.Distinct();
if (rowNumbers != null && rowNumbers.Any())
{
computes.Add(new ag_compute
foreach (var item in rowNumbers)
{
AllotId = second.AllotId,
SecondId = second.Id,
Department = second.Department,
WorkPost = items.FirstOrDefault(t => t.RowNumber == item && t.ItemName == "岗位")?.ItemValue,
PersonName = items.FirstOrDefault(t => t.RowNumber == item && t.ItemName == "姓名")?.ItemValue,
RealGiveFee = ConvertHelper.TryDecimal(items.FirstOrDefault(t => t.RowNumber == item && t.ItemName == "实发绩效工资金额")?.ItemValue, 0),
});
computes.Add(new ag_compute
{
AllotId = second.AllotId,
SecondId = second.Id,
Department = second.Department,
WorkPost = items.FirstOrDefault(t => t.RowNumber == item && t.ItemName == "岗位")?.ItemValue,
PersonName = items.FirstOrDefault(t => t.RowNumber == item && t.ItemName == "姓名")?.ItemValue,
RealGiveFee = ConvertHelper.TryDecimal(items.FirstOrDefault(t => t.RowNumber == item && t.ItemName == "实发绩效工资金额")?.ItemValue, 0),
});
}
}
}
}
var others = perforAgothersourceRepository.GetEntities(t => t.SecondId == request.SecondId);
if (others != null && others.Any())
else if (second.SubmitType == 2)
{
foreach (var item in others)
var others = perforAgothersourceRepository.GetEntities(t => t.SecondId == request.SecondId);
if (others != null && others.Any())
{
computes.Add(new ag_compute
foreach (var item in others)
{
AllotId = second.AllotId,
SecondId = second.Id,
Department = item.Department,
WorkPost = item.WorkPost,
PersonName = item.Name,
RealGiveFee = item.Amount,
});
computes.Add(new ag_compute
{
AllotId = second.AllotId,
SecondId = second.Id,
Department = item.Department,
WorkPost = item.WorkPost,
PersonName = item.Name,
RealGiveFee = item.Amount,
});
}
}
}
perforAgcomputeRepository.AddRange(computes.ToArray());
}
......
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