Commit b1a3422b by 钟博

修改职称绩效金额的问题

parent a53edfdf
......@@ -32,52 +32,89 @@ public class SubsidyController : ControllerBase
return new ApiResponse(Status.Ok, allots);
}
// 职称查询
/// <summary>
/// 职称查询
/// </summary>
/// <param name="allotId"></param>
/// <param name="hospitalId"></param>
/// <returns></returns>
[HttpGet("{allotId}/jobtitle/{hospitalId}")]
public async Task<ApiResponse> GetJobTitle(int allotId, int hospitalId)
public ApiResponse GetJobTitle(int allotId, int hospitalId)
{
_service.GetHrpJobTitle(allotId, hospitalId,false);
var jobTitle = await _service.GetJobTitle(allotId, hospitalId);
_service.GetHrpJobTitle(allotId, hospitalId, false);
var jobTitle = _service.GetJobTitle(allotId, hospitalId);
return new ApiResponse(Status.Ok, jobTitle);
}
// 重新查询职称
/// <summary>
/// 重新查询职称
/// </summary>
/// <param name="allotId"></param>
/// <param name="hospitalId"></param>
/// <returns></returns>
[HttpPost("{allotId}/reset-jobtitle/{hospitalId}")]
public async Task<ApiResponse> ResetJobTitle(int allotId, int hospitalId)
public ApiResponse ResetJobTitle(int allotId, int hospitalId)
{
// 调取配置的SQL语句
// 执行SQL 获取结果
// 将结果存储到sub_subsidy中
// 查询sub_subsidy表职称去重
// 将去重数据插入sub_jobtitle
_service.GetHrpJobTitle(allotId, hospitalId,true);
var jobTitle = await _service.GetJobTitle(allotId, hospitalId);
_service.GetHrpJobTitle(allotId, hospitalId, true);
var jobTitle = _service.GetJobTitle(allotId, hospitalId);
return new ApiResponse(Status.Ok, jobTitle);
}
//1
// 职称标准保存
/// <summary>
/// 职称标准保存
/// </summary>
/// <param name="allotId"></param>
/// <param name="sub_Jobtitle"></param>
/// <returns></returns>
[HttpPost("{allotId}/jobtitle")]
public ApiResponse SaveJobTitle(int allotId,[FromBody]List<sub_jobtitle> sub_Jobtitle)
public ApiResponse SaveJobTitle(int allotId, [FromBody] List<sub_jobtitle> sub_Jobtitle)
{
bool result = _service.SaveJobTitle(allotId, sub_Jobtitle);
return new ApiResponse(Status.Ok, result);
}
// 个人职称补贴结果查询
/// <summary>
/// 个人职称补贴结果查询
/// </summary>
/// <param name="allotId"></param>
/// <returns></returns>
[HttpGet("{allotId}/jobtitle/subsidy")]
public ApiResponse GetJobTitleSubsidy(int allotId)
{
List<sub_subsidy> subsidies=_service.GetJobTitleSubsidy(allotId);
List<sub_subsidy> subsidies = _service.GetJobTitleSubsidy(allotId);
return new ApiResponse(Status.Ok,subsidies);
return new ApiResponse(Status.Ok, subsidies);
}
// 个人职称补贴结果保存
/// <summary>
/// 个人职称补贴结果保存
/// </summary>
/// <param name="allotId"></param>
/// <param name="subsidys"></param>
/// <returns></returns>
[HttpPost("{allotId}/jobtitle/subsidy")]
public ApiResponse SaveJobTitleSubsidy(int allotId, [FromBody] List<sub_subsidy> subsidys)
{
bool result = _service.SaveJobTitleSubsidy(allotId, subsidys);
return new ApiResponse(Status.Ok, result);
}
/// <summary>
/// 保存个人职称补贴结果
/// </summary>
/// <param name="allotId"></param>
/// <param name="subsidies"></param>
/// <returns></returns>
[HttpPost("{allotId}/savesubsidy")]
public ApiResponse SaveSubsidy(int allotId,[FromBody] List<sub_subsidy> subsidies)
{
var result = _service.SaveSubsidy(allotId, subsidies);
return new ApiResponse(Status.Ok, subsidies);
}
}
}
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Performance.Subsidy.Api.Filters
{
public class ExceptionsFilter : IAsyncExceptionFilter
{
private readonly ILogger<ExceptionsFilter> _logger;
public ExceptionsFilter(ILogger<ExceptionsFilter> logger)
{
this._logger = logger;
}
public Task OnExceptionAsync(ExceptionContext context)
{
if(context.Exception is Exception)
{
_logger.LogError($"接口异常:{context.Exception.ToString()}");
var response = new ApiResponse(Status.Error, "接口内部异常", context.Exception.Message);
context.Result = new ObjectResult(response);
_logger.LogError("接口内部异常" + JsonConvert.SerializeObject(response, Formatting.None));
}
return Task.CompletedTask;
}
}
}
......@@ -5,6 +5,13 @@
</PropertyGroup>
<ItemGroup>
<None Include="..\.editorconfig" Link=".editorconfig" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="NLog" Version="4.7.9" />
<PackageReference Include="NLog.Extensions.Logging" Version="1.4.0" />
<PackageReference Include="NLog.Web.AspNetCore" Version="4.8.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.6.3" />
<PackageReference Include="Autofac" Version="6.2.0" />
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="7.1.0" />
......
......@@ -3,6 +3,7 @@
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using NLog.Web;
using System;
using System.Collections.Generic;
using System.Linq;
......@@ -14,8 +15,20 @@ public class Program
{
public static void Main(string[] args)
{
var logger = NLogBuilder.ConfigureNLog("nlog.config").GetCurrentClassLogger();
try
{
CreateHostBuilder(args).Build().Run();
}
catch (Exception ex)
{
logger.Error(ex, "Stopped program because of exception");
}
finally
{
NLog.LogManager.Shutdown();
}
}
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
......@@ -23,6 +36,12 @@ public static void Main(string[] args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
});
})
.ConfigureLogging(logging =>
{
logging.ClearProviders();
logging.SetMinimumLevel(LogLevel.Trace);
})
.UseNLog();
}
}
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<DeleteExistingFiles>False</DeleteExistingFiles>
<ExcludeApp_Data>False</ExcludeApp_Data>
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<PublishProvider>FileSystem</PublishProvider>
<PublishUrl>D:\publish\Subsidy</PublishUrl>
<WebPublishMethod>FileSystem</WebPublishMethod>
</PropertyGroup>
</Project>
\ No newline at end of file
......@@ -5,6 +5,7 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.OpenApi.Models;
using Performance.Subsidy.Api.Filters;
using Performance.Subsidy.Services;
using Performance.Subsidy.Services.Models;
using Performance.Subsidy.Services.Repository;
......@@ -38,6 +39,8 @@ public void ConfigureServices(IServiceCollection services)
c.SwaggerDoc("v1", new OpenApiInfo { Title = "Performance.Subsidy.Api", Version = "v1" });
});
services.Configure<ConnectionStringTemplates>(Configuration.GetSection("ConnectionStringTemplates"));
services.AddMvc(option => { option.Filters.Add<ExceptionsFilter>(); });
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
......
<?xml version="1.0" encoding="utf-8"?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
autoReload="true"
internalLogLevel="info"
internalLogFile="c:\Temp\GrapefruitVuCore\internal-nlog.txt">
<!-- enable asp.net core and mongodb layout renderers -->
<extensions>
<add assembly="NLog.Web.AspNetCore"/>
<add assembly="NLog.Mongo"/>
</extensions>
<!--internal-nlog:NLog启动及加载config信息-->
<!--nlog-all:所有日志记录信息-->
<!--nlog-own:自定义日志记录信息-->
<!-- the targets to write to -->
<targets>
<!-- write logs to file -->
<target xsi:type="File" name="allfile" fileName="${basedir}/Logs/${shortdate}/${level}.log"
layout="日志记录时间:${longdate}${newline}日志级别:${uppercase:${level}}${newline}日志来源:${logger}${newline}日志信息:${message}${newline}错误信息:${exception:format=tostring}${newline}==============================================================${newline}" />
<!-- another file log, only own logs. Uses some ASP.NET core renderers -->
<target xsi:type="File" name="ownFile-web" fileName="${basedir}/Logs/${shortdate}/${level}.log"
layout="日志记录时间:${longdate}${newline}日志级别:${uppercase:${level}}${newline}日志来源:${logger}${newline}日志信息:${message}${newline}错误信息:${exception:format=tostring}${newline}url: ${aspnet-request-url}${newline}action: ${aspnet-mvc-action}${newline}==============================================================${newline}" />
</targets>
<!-- rules to map from logger name to target -->
<rules>
<!--All logs, including from Microsoft-->
<logger name="*" minlevel="Trace" writeTo="allfile" />
<!--Skip non-critical Microsoft logs and so log only own logs-->
<logger name="Microsoft.*" maxLevel="Info" final="true" />
<!-- BlackHole without writeTo -->
<logger name="*" minlevel="Trace" writeTo="ownFile-web" />
<!--Add logs to mongodb-->
<!--<logger name="*" minlevel="Trace" writeTo="mongo"/>-->
</rules>
</nlog>
\ No newline at end of file
......@@ -8,8 +8,10 @@
<PackageReference Include="Dapper" Version="2.0.90" />
<PackageReference Include="Microsoft.AspNet.WebApi.Core" Version="5.2.7" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.Options" Version="5.0.0" />
<PackageReference Include="MySql.Data" Version="8.0.24" />
<PackageReference Include="NLog" Version="4.7.9" />
<PackageReference Include="Oracle.ManagedDataAccess.Core" Version="3.21.1" />
<PackageReference Include="System.Data.SqlClient" Version="4.8.2" />
</ItemGroup>
......
......@@ -3,9 +3,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.31112.23
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Performance.Subsidy.Api", "Performance.Subsidy.Api\Performance.Subsidy.Api.csproj", "{B1560D0E-69D5-44DA-9C7E-AB548C709EE7}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Performance.Subsidy.Api", "Performance.Subsidy.Api\Performance.Subsidy.Api.csproj", "{B1560D0E-69D5-44DA-9C7E-AB548C709EE7}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Performance.Subsidy.Services", "Performance.Subsidy.Services\Performance.Subsidy.Services.csproj", "{75937D89-4F57-4D95-A03E-DD64D782C700}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Performance.Subsidy.Services", "Performance.Subsidy.Services\Performance.Subsidy.Services.csproj", "{75937D89-4F57-4D95-A03E-DD64D782C700}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
......
......@@ -369,5 +369,18 @@ public ApiResponse DeleteUser([CustomizeValidator(RuleSet = "Delete"), FromBody]
}
#endregion
/// <summary>
/// 批量新增用户
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[Route("BatchSaveUser")]
[HttpPost]
public ApiResponse BatchSaveUser()
{
return new ApiResponse(ResponseType.OK);
}
}
}
\ No newline at end of file
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