签字表静态存储刷新

parent 960d717c
using FluentValidation.AspNetCore;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Caching.Memory;
using Microsoft.Extensions.Options;
using Newtonsoft.Json.Linq;
using Microsoft.AspNetCore.StaticFiles;
using Performance.DtoModels;
using Performance.DtoModels.AppSettings;
using Performance.DtoModels.Request;
using Performance.EntityModels;
using Performance.Infrastructure;
using Performance.Services;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using Performance.DtoModels.Request;
using System.IO;
using Microsoft.AspNetCore.StaticFiles;
using System.Linq;
namespace Performance.Api.Controllers
{
......@@ -23,17 +15,21 @@ namespace Performance.Api.Controllers
public class ComputeController : Controller
{
private ComputeService _computeService;
private readonly DapperService _service;
private AllotService _allotService;
private ClaimService _claim;
private EmployeeService _employeeService;
private readonly DownloadService downloadService;
public ComputeController(AllotService allotService,
public ComputeController(
DapperService service,
AllotService allotService,
ComputeService computeService,
EmployeeService employeeService,
DownloadService downloadService,
ClaimService claim)
{
_service = service;
_allotService = allotService;
_computeService = computeService;
_employeeService = employeeService;
......@@ -603,7 +599,8 @@ public ApiResponse AllComputeView([FromBody] ComputerRequest request)
var allot = _allotService.GetAllot(request.AllotId);
if (null == allot)
throw new PerformanceException("当前绩效记录不存在");
if (request.Refresh == 1)
_service.FreezeAllot(request.AllotId);
var list = _computeService.GetAllComputeView(allot.HospitalId, request.AllotId, "view_allot_sign_emp");
return new ApiResponse(ResponseType.OK, "ok", list);
}
......
......@@ -2011,6 +2011,11 @@
绩效基数核算参考对象
</summary>
</member>
<member name="P:Performance.DtoModels.ComputerRequest.Refresh">
<summary>
强制刷新 1
</summary>
</member>
<member name="T:Performance.DtoModels.DeptDetailRequest">
<summary>
查看科室绩效详情
......
......@@ -27,7 +27,10 @@ public class ComputerRequest
/// 绩效基数核算参考对象
/// </summary>
public int Type { get; set; }
/// <summary>
/// 强制刷新 1
/// </summary>
public int Refresh { get; set; }
}
public class ComputerRequestValidator : AbstractValidator<ComputerRequest>
{
......
......@@ -374,31 +374,6 @@ public void AccoungtingVerify(int allotId)
}
}
}
/// <summary>
/// 查询人员字典
/// </summary>
/// <param name="allotId"></param>
/// <param name="secondId">二次分配ID 0 代表一次分配</param>
/// <param name="status"> status = true 二次分配审核通过 false 二次分配驳回 </param>
/// <returns></returns>
public void FreezeAllot(int allotId, int secondId = 0, bool status = true)
{
using (var connection = context.Database.GetDbConnection())
{
if (connection.State != ConnectionState.Open) connection.Open();
try
{
string sql = $@"call proc_freeze_allot({allotId},{secondId},{(status ? 3 : 4)})";
connection.Execute(sql, commandTimeout: 60 * 60);
}
catch (Exception)
{
throw;
}
}
}
public IEnumerable<view_allot_sign_emp> GetFreezeAllot(int allotId)
{
......
......@@ -17,6 +17,7 @@ namespace Performance.Services.AllotCompute
public class ResultComputeService : IAutoInjection
{
private readonly IMapper _mapper;
private readonly DapperService _service;
private readonly PerforPerallotRepository _perforPerallotRepository;
private readonly BaiscNormService baiscNormService;
private readonly ComputeDirector computeDirector;
......@@ -35,6 +36,7 @@ public class ResultComputeService : IAutoInjection
public ResultComputeService(
IMapper mapper,
DapperService service,
PerforPerallotRepository perforPerallotRepository,
PerforHospitalRepository hospitalRepository,
PerforImemployeeRepository perforImEmployeeRepository,
......@@ -50,6 +52,7 @@ public class ResultComputeService : IAutoInjection
ILogger<ResultComputeService> logger)
{
_mapper = mapper;
_service = service;
_perforPerallotRepository = perforPerallotRepository;
this.baiscNormService = baiscNormService;
this.computeDirector = computeDirector;
......@@ -696,7 +699,7 @@ public bool IssuedChangeSecond(per_allot allot, List<ag_secondallot> secondList)
second.NursingDeptStatus = 4;
second.NursingDeptRemark = "科室绩效结果发生变更,需要重新提交";
}
_perforPerallotRepository.FreezeAllot(allot.ID, second.Id, false);
_service.FreezeAllotSync(allot.ID);
}
}
perforAgsecondallotRepository.UpdateRange(updSeconds.ToArray());
......
using AutoMapper;
using Dapper;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using MySql.Data.MySqlClient;
using Performance.DtoModels;
using Performance.DtoModels.AppSettings;
using Performance.EntityModels;
......@@ -16,7 +14,6 @@
using System.Data;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
namespace Performance.Services
{
......@@ -31,6 +28,7 @@ public class AllotService : IAutoInjection
private IWebHostEnvironment _evn;
private ILogger<AllotService> _logger;
private readonly IMapper _mapper;
private readonly DapperService _service;
private readonly PerforUserRepository _userRepository;
private PerforPerallotRepository _allotRepository;
private IEmailService emailService;
......@@ -57,6 +55,7 @@ public class AllotService : IAutoInjection
public AllotService(
IMapper mapper,
DapperService service,
PerforUserRepository userRepository,
PerforPerallotRepository allotRepository,
BaiscNormService baiscNormService,
......@@ -88,6 +87,7 @@ public class AllotService : IAutoInjection
QueryDataService queryDataService)
{
_mapper = mapper;
_service = service;
_userRepository = userRepository;
_allotRepository = allotRepository;
_againallotRepository = againallotRepository;
......@@ -447,8 +447,8 @@ public void Generate(per_allot allot)
//resultComputeService.SaveReserved(allot, allot.HospitalId);
// 科室创建但不下发
resultComputeService.GenerateSecondAllot(allot);
_allotRepository.FreezeAllot(allot.ID);
resultComputeService.GenerateSecondAllot(allot);
_service.FreezeAllotSync(allot.ID);
UpdateAllotStates(allot.ID, (int)AllotStates.绩效结果解析成功, EnumHelper.GetDescription(AllotStates.绩效结果解析成功), generate);
perforCofdirectorRepository.SupplementaryData(allot.ID);
......
using Dapper;
using Microsoft.Extensions.Options;
using MySql.Data.MySqlClient;
using Performance.DtoModels.AppSettings;
using System;
using System.Data;
using System.Threading.Tasks;
namespace Performance.Services
{
public class DapperService : IAutoInjection
{
private readonly IOptions<AppConnection> _options;
public DapperService(IOptions<AppConnection> options)
{
_options = options;
}
/// <summary>
/// 数据静态存储
/// </summary>
/// <param name="allotId"></param>
/// <returns></returns>
public void FreezeAllotSync(int allotId)
{
Task.Factory.StartNew(() => FreezeAllot(allotId));
}
/// <summary>
/// 数据静态存储
/// </summary>
/// <param name="allotId"></param>
/// <returns></returns>
public void FreezeAllot(int allotId)
{
using (var connection = new MySqlConnection(_options.Value.PerformanceConnectionString))
{
if (connection.State != ConnectionState.Open) connection.Open();
try
{
string sql = $@"call proc_freeze_allot({allotId})";
connection.Execute(sql, commandTimeout: 60 * 60);
}
catch (Exception)
{
throw;
}
}
}
}
}
using AutoMapper;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using NPOI.HSSF.UserModel;
using NPOI.SS.UserModel;
using NPOI.SS.Util;
using NPOI.XSSF.UserModel;
using Performance.DtoModels;
using Performance.DtoModels.Request;
using Performance.EntityModels;
using Performance.Infrastructure;
using Performance.Infrastructure.Models;
using Performance.Repository;
using Performance.Services.AllotCompute;
using System;
using System.Collections.Generic;
using System.IO;
......@@ -25,18 +20,19 @@ namespace Performance.Services
public class EmployeeService : IAutoInjection
{
private readonly IMapper _mapper;
private PerforImemployeeRepository perforImemployeeRepository;
private PerforPersheetRepository perforPersheetRepository;
private PerforImdataRepository perforImdataRepository;
private PerforPerallotRepository perforPerallotRepository;
private PerforImemployeeclinicRepository perforImemployeeclinicRepository;
private PerforUserhospitalRepository perforUserhospitalRepository;
private PerforPerallotRepository perallotRepository;
private PerforPerapramountRepository perapramountRepository;
private PerforImemployeelogisticsRepository perforImemployeelogisticsRepository;
private PerforUserroleRepository userroleRepository;
private PerforPeremployeeRepository peremployeeRepository;
private PerforUserRepository userRepository;
private readonly DapperService _service;
private readonly PerforImemployeeRepository perforImemployeeRepository;
private readonly PerforPersheetRepository perforPersheetRepository;
private readonly PerforImdataRepository perforImdataRepository;
private readonly PerforPerallotRepository perforPerallotRepository;
private readonly PerforImemployeeclinicRepository perforImemployeeclinicRepository;
private readonly PerforUserhospitalRepository perforUserhospitalRepository;
private readonly PerforPerallotRepository perallotRepository;
private readonly PerforPerapramountRepository perapramountRepository;
private readonly PerforImemployeelogisticsRepository perforImemployeelogisticsRepository;
private readonly PerforUserroleRepository userroleRepository;
private readonly PerforPeremployeeRepository peremployeeRepository;
private readonly PerforUserRepository userRepository;
private readonly PerforRoleRepository _roleRepository;
private readonly PerforPerapramounthideRepository _hideRepository;
private readonly PerforExresultgatherRepository exresultgatherRepository;
......@@ -51,6 +47,7 @@ public class EmployeeService : IAutoInjection
public EmployeeService(
IMapper mapper,
DapperService service,
PerforImemployeeRepository perforImemployeeRepository,
PerforPersheetRepository perforPersheetRepository,
PerforImdataRepository perforImdataRepository,
......@@ -76,6 +73,7 @@ public class EmployeeService : IAutoInjection
ILogger<EmployeeService> logger)
{
_mapper = mapper;
_service = service;
this.perforImemployeeRepository = perforImemployeeRepository;
this.perforPersheetRepository = perforPersheetRepository;
this.perforImdataRepository = perforImdataRepository;
......@@ -584,6 +582,7 @@ public ApiResponse ConfirmAudit(int userid, AprAmountAuditRequest request)
}
}
}
_service.FreezeAllotSync(request.AllotId);
return new ApiResponse(ResponseType.OK, "");
}
......@@ -1037,6 +1036,7 @@ public ApiResponse ConfirmAuditHide(int userid, AprAmountAuditRequest request)
}
}
}
_service.FreezeAllotSync(request.AllotId);
return new ApiResponse(ResponseType.OK, "");
}
/// <summary>
......
using AutoMapper;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Performance.DtoModels;
......@@ -12,6 +13,7 @@
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
namespace Performance.Services
{
......@@ -19,6 +21,8 @@ public partial class SecondAllotService : IAutoInjection
{
private readonly IMapper _mapper;
private readonly ILogger logger;
private readonly IServiceScopeFactory _serviceScopeFactory;
private readonly DapperService _service;
private readonly Application application;
private readonly PerforAgsecondallotRepository agsecondallotRepository;
private readonly PerforAgtempRepository agtempRepository;
......@@ -56,6 +60,8 @@ public partial class SecondAllotService : IAutoInjection
IMapper mapper,
ILogger<SecondAllotService> logger,
IOptions<Application> application,
IServiceScopeFactory serviceScopeFactory,
DapperService service,
PerforAgsecondallotRepository agsecondallotRepository,
PerforAgtempRepository agtempRepository,
PerforAgtempitemRepository agtempitemRepository,
......@@ -88,6 +94,8 @@ ComputeService computeService
{
_mapper = mapper;
this.logger = logger;
_serviceScopeFactory = serviceScopeFactory;
_service = service;
this.application = application.Value;
this.agsecondallotRepository = agsecondallotRepository;
this.agtempRepository = agtempRepository;
......@@ -1702,8 +1710,6 @@ public bool RollbackSubmit(int secondId)
public bool ConfirmAudit(int userId, SecondAuditRequest request)
{
var second = agsecondallotRepository.GetEntity(t => t.Id == request.SecondId);
//if (second.Status != 2)
// throw new PerformanceException("该绩效未提交至审核,请确认");
if (request.IsPass == 1)
{
......@@ -1714,20 +1720,15 @@ public bool ConfirmAudit(int userId, SecondAuditRequest request)
second.UseTempId = null;
second.Status = 4;
}
//second.Status = request.IsPass == 1 ? 3 : 4;
second.AuditUser = userId;
second.AuditTime = DateTime.Now;
second.Remark = request.Remark;
//if (string.IsNullOrEmpty(second.Remark))
//{
// second.Remark = request.IsPass == 1 ? "审核通过" : "驳回";
//}
var result = agsecondallotRepository.Update(second);
// 无论驳回还是通过,都需要清空该科室历史数据
agsecondallotRepository.DeleteComputeHistory(request.SecondId);
//if (request.IsPass == 1)
// SyncSecondComputeData(second);
if (request.IsPass == 1)
_service.FreezeAllotSync(second.AllotId.Value);
return result;
}
......@@ -2369,57 +2370,7 @@ public dynamic Print(int secondId)
return new { header, body = result/*.OrderBy(t => t.JobNumber).ThenBy(t => t.PersonName).ToList()*/ };
}
#endregion 打印
//public List<SecondPerforResponse> DeptComputeDetail(int userId, int allotId, out int isShowManage)
//{
// var user = userRepository.GetEntity(t => t.ID == userId);
// if (user == null)
// throw new NotImplementedException("人员ID无效");
// var allot = perallotRepository.GetEntity(t => t.ID == allotId);
// isShowManage = computeService.IsShowManage(allotId);
// var userrole = userroleRepository.GetEntity(t => t.UserID == userId);
// var role = roleRepository.GetEntity(t => t.ID == userrole.RoleID);
// Dictionary<int, string> dict = new Dictionary<int, string>
// {
// { application.DirectorRole, AccountUnitType.科主任.ToString() },
// { application.NurseRole, AccountUnitType.护士长.ToString() },
// { application.OfficeRole, AccountUnitType.行政中层.ToString() },
// { application.SpecialRole, AccountUnitType.科主任.ToString() },
// };
// if (!dict.Keys.Contains(role.Type.Value)) return new List<SecondPerforResponse>();
// var computes = rescomputeRepository.GetEntities(t => t.AllotID == allotId && t.AccountingUnit == user.Department && t.AccountType == dict[role.Type.Value]);
// if (computes == null || !computes.Any()) return new List<SecondPerforResponse>();
// var data = GetAllotPerformance(allotId, computes, isShowManage);
// // 补充医院其他绩效
// var result = AddAprAmount(allotId, data);
// // 预留比例
// if (result != null)
// {
// var empDic = peremployeeRepository.GetEntities(w => w.AllotId == allotId);
// foreach (var item in result)
// {
// item.PerforSumFee = Math.Round(item.PerforSumFee ?? 0, 0, MidpointRounding.AwayFromZero);
// item.PerforManagementFee = Math.Round(item.PerforManagementFee ?? 0, 0, MidpointRounding.AwayFromZero);
// var real = Math.Round((item.PerforSumFee ?? 0) + (item.PerforManagementFee ?? 0), 0) * item.Adjust + (item.AdjustLaterOtherFee ?? 0);
// item.OthePerfor = Math.Round(item.OthePerfor ?? 0, 0, MidpointRounding.AwayFromZero);
// item.NightWorkPerfor = Math.Round(item.NightWorkPerfor ?? 0, 0, MidpointRounding.AwayFromZero);
// item.ShouldGiveFee = Math.Round((real ?? 0) + (item.OthePerfor ?? 0) + (item.NightWorkPerfor ?? 0), 0, MidpointRounding.AwayFromZero);
// item.ReservedRatio = empDic?.FirstOrDefault(w => w.PersonnelNumber == item.JobNumber)?.ReservedRatio ?? 0;
// item.ReservedRatioFee = Math.Round((real ?? 0) * (item.ReservedRatio ?? 0), 0, MidpointRounding.AwayFromZero);
// item.RealGiveFee = Math.Round(item.ShouldGiveFee - (item.ReservedRatioFee ?? 0) ?? 0, 0, MidpointRounding.AwayFromZero);
// }
// }
// return result;
//}
#endregion 打印
public List<DeptDataDetails> DeptComputeDetailList(int userId, int allotId, out int isShowManage)
{
......
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