bug修改

parent 8a4e754e
......@@ -107,7 +107,7 @@ public ApiResponse<List<UserResponse>> List([FromBody]ApiRequest request)
public ApiResponse<UserResponse> Insert([CustomizeValidator(RuleSet = "Insert"), FromBody]UserRequest request)
{
var userIdentity = _claim.At(request.Token);
var user = _userService.Insert(request, userIdentity.UserID, userIdentity.IsAgainAdmin);
var user = _userService.Insert(request, userIdentity.UserID);
user.Role = request.Role;
return new ApiResponse<UserResponse>(ResponseType.OK, user);
}
......
......@@ -178,19 +178,36 @@ public ApiResponse Pigeonhole([CustomizeValidator(RuleSet = "Delete"), FromBody]
}
/// <summary>
/// 检索数据是否合格
/// 归档时检索数据是否合格
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[Route("checkdata")]
[Route("checkrecord")]
[HttpPost]
public ApiResponse CheckData([CustomizeValidator(RuleSet = "Delete"), FromBody]AllotRequest request)
public ApiResponse CheckRecord([CustomizeValidator(RuleSet = "Delete"), FromBody]AllotRequest request)
{
var allot = _allotService.GetAllot(request.ID);
if (null == allot)
throw new PerformanceException("当前绩效记录不存在或没有上传数据文件");
var list = _allotService.CheckData(allot);
var list = _allotService.GetAgainAllotNotSucceed(allot);
return new ApiResponse(ResponseType.OK, list);
}
/// <summary>
/// 绩效校验结果
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[Route("allotcheckresult")]
[HttpPost]
public ApiResponse AllotCheckResult([CustomizeValidator(RuleSet = "Delete"), FromBody]AllotRequest request)
{
var allot = _allotService.GetAllot(request.ID);
if (null == allot)
throw new PerformanceException("当前绩效记录不存在");
var list = _allotService.AllotCheckResult(allot);
return new ApiResponse(ResponseType.OK);
}
}
}
using FluentValidation.AspNetCore;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Caching.Memory;
using Microsoft.Extensions.Options;
using Newtonsoft.Json.Linq;
using Performance.DtoModels;
using Performance.DtoModels.AppSettings;
using Performance.EntityModels;
using Performance.Infrastructure;
using Performance.Services;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Performance.Api.Controllers
{
[Route("api/[controller]")]
public class AssessController : Controller
{
private ClaimService claimService;
private AssessService assessService;
public AssessController(ClaimService claimService,
AssessService assessService)
{
this.claimService = claimService;
this.assessService = assessService;
}
//新增考核类别
[HttpPost]
[Route("addassess")]
public ApiResponse AddAssess([CustomizeValidator(RuleSet = "Add"), FromBody]AssessRequest request)
{
assessService.AddAssess(request.AllotID, request.AssessName);
throw new NotImplementedException();
}
//修改考核类别
[HttpPost]
[Route("editassess")]
public ApiResponse EditAssess([CustomizeValidator(RuleSet = "Update"), FromBody]AllotRequest request)
{
throw new NotImplementedException();
}
//删除考核类别
[HttpPost]
[Route("delassess")]
public ApiResponse DelAssess([CustomizeValidator(RuleSet = "Del"), FromBody]AssessRequest request)
{
throw new NotImplementedException();
}
//获取所有科室列表
[HttpPost]
[Route("departmentlist")]
public ApiResponse DepartmentList()
{
throw new NotImplementedException();
}
//设置科室考核分类
[HttpPost]
[Route("setassesstype")]
public ApiResponse SetAssessType()
{
throw new NotImplementedException();
}
//新增考核项
[HttpPost]
[Route("addcolumn")]
public ApiResponse AddColumn()
{
throw new NotImplementedException();
}
//删除考核项
[HttpPost]
[Route("delcolumn")]
public ApiResponse DelColumn()
{
throw new NotImplementedException();
}
}
}
using FluentValidation;
using System;
using System.Collections.Generic;
using System.Text;
namespace Performance.DtoModels
{
public class AssessRequest
{
public int AssessID { get; set; }
public int AllotID { get; set; }
public string AssessName { get; set; }
}
public class AssessRequestValidator : AbstractValidator<AssessRequest>
{
public AssessRequestValidator()
{
RuleSet("Del", () =>
{
RuleFor(t => t.AssessID).NotNull().GreaterThan(0);
});
RuleSet("Update", () =>
{
RuleFor(t => t.AssessID).NotNull().GreaterThan(0);
RuleFor(t => t.AllotID).NotNull().GreaterThan(0);
RuleFor(t => t.AssessName).NotNull().NotEmpty();
});
RuleSet("Add", () =>
{
RuleFor(t => t.AllotID).NotNull().NotEmpty();
RuleFor(t => t.AssessName).NotNull().NotEmpty();
});
}
}
}
......@@ -22,8 +22,13 @@ public class as_assess
public int ID { get; set; }
/// <summary>
/// 绩效ID
/// </summary>
public Nullable<int> AllotID { get; set; }
/// <summary>
/// 考核类别
/// </summary>
public string AssessType { get; set; }
public string AssessName { get; set; }
}
}
......@@ -29,6 +29,7 @@ public class AllotService : IAutoInjection
private PerforPerallotRepository _allotRepository;
private IEmailService emailService;
private PerforPeragainallotRepository _againallotRepository;
private PerforLogcheckRepository perforLogcheckRepository;
public AllotService(PerforPerallotRepository allotRepository,
BaiscNormService baiscNormService,
......@@ -40,7 +41,8 @@ public class AllotService : IAutoInjection
PerforLogdbugRepository logdbug,
IHostingEnvironment evn, ILogger<AllotService> logger,
IEmailService emailService,
PerforPeragainallotRepository againallotRepository)
PerforPeragainallotRepository againallotRepository,
PerforLogcheckRepository perforLogcheckRepository)
{
_allotRepository = allotRepository;
_againallotRepository = againallotRepository;
......@@ -54,6 +56,7 @@ public class AllotService : IAutoInjection
this.emailService = emailService;
this.configService = configService;
this.logdbug = logdbug;
this.perforLogcheckRepository = perforLogcheckRepository;
}
#region 基础功能
......@@ -265,10 +268,9 @@ public void Pigeonhole(per_allot allot)
/// 检索数据是否合格
/// </summary>
/// <param name="allot"></param>
public List<AgainAllotResponse> CheckData(per_allot allot)
public List<AgainAllotResponse> GetAgainAllotNotSucceed(per_allot allot)
{
List<int> states = new List<int>() { 0, 1, 2, 4 };
var again = _againallotRepository.GetEntities(t => t.AllotID == allot.ID && states.Contains(t.States.Value));
var again = _againallotRepository.GetEntities(t => t.AllotID == allot.ID && (!t.States.HasValue || t.States.Value != 3));
List<AgainAllotResponse> result = Mapper.Map<List<AgainAllotResponse>>(again);
if (result != null && result.Count > 0)
{
......@@ -276,5 +278,18 @@ public List<AgainAllotResponse> CheckData(per_allot allot)
}
return result;
}
/// <summary>
/// 绩效校验结果
/// </summary>
/// <param name="allot"></param>
/// <returns></returns>
public List<log_check> AllotCheckResult(per_allot allot)
{
var list = perforLogcheckRepository.GetEntities(t => t.AllotID == allot.ID);
if (list != null)
list = list.OrderBy(t => t.Type).ThenBy(t => t.ID).ToList();
return list;
}
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace Performance.Services
{
public class AssessService : IAutoInjection
{
//priv
public AssessService()
{
}
public void AddAssess(int allotID, string assessName)
{
throw new NotImplementedException();
}
}
}
......@@ -112,8 +112,9 @@ public List<UserResponse> GetUserList(int userID)
/// 新增用户
/// </summary>
/// <param name="request"></param>
public UserResponse Insert(UserRequest request, int userid, bool isAgainAdmin)
public UserResponse Insert(UserRequest request, int userid)
{
var isAgainAdmin = new int[] { application.DirectorRole, application.NurseRole }.Contains(request.Role);
if (null != _userRepository.GetEntity(t => t.Login == request.Login))
throw new PerformanceException("登录名重复");
if (null != _userRepository.GetEntity(t => t.Mobile == request.Mobile))
......@@ -136,7 +137,7 @@ public UserResponse Insert(UserRequest request, int userid, bool isAgainAdmin)
//添加用户角色关联关系
_userroleRepository.Add(new sys_user_role { UserID = user.ID, RoleID = request.Role });
//添加用户医院
SetHospital(request.ID, request.HosIDArray);
SetHospital(user.ID, request.HosIDArray);
return Mapper.Map<UserResponse>(user);
}
......@@ -216,7 +217,7 @@ public UserResponse Update(UserRequest request, bool isAgainAdmin)
//添加用户角色关联关系
_userroleRepository.Add(new sys_user_role { UserID = request.ID, RoleID = request.Role });
//添加用户医院
SetHospital(request.ID, request.HosIDArray);
SetHospital(user.ID, request.HosIDArray);
return Mapper.Map<UserResponse>(user);
}
......@@ -292,8 +293,10 @@ public List<TitleValue> Department(int hospitalID)
var allotList = _perforPerallotRepository.GetEntities(t => t.HospitalId == hospitalID);
if (allotList != null)
{
var department = _employeeRepository.GetEntities(t => t.Department != "" && allotList.Select(s => s.ID).ToList().Contains(t.AllotID.Value));
return department.Select(t => new TitleValue { Title = t.Department, Value = t.Department }).OrderBy(t => t.Title).Distinct().ToList();
var idList = allotList.Select(s => s.ID).ToList();
var department = _employeeRepository.GetEntities(t => t.Department != "" && idList.Contains(t.AllotID.Value));
if (department != null && department.Count > 0)
return department.Select(t => t.Department).Distinct().Select(t => new TitleValue { Title = t, Value = t }).OrderBy(t => t.Title).ToList();
}
return new List<TitleValue>();
}
......
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