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
// 职称标准保存
[HttpPost("{allotId}/jobtitle")]
public ApiResponse SaveJobTitle(int allotId,[FromBody]List<sub_jobtitle> sub_Jobtitle)
/// <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)
{
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);
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,7 +15,19 @@ public class Program
{
public static void Main(string[] args)
{
CreateHostBuilder(args).Build().Run();
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) =>
......@@ -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>
......
using Dapper;
using Microsoft.Extensions.Logging;
using Performance.Subsidy.Services.Repository;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Threading.Tasks;
using System.Linq;
using System;
using System.Web.Http;
namespace Performance.Subsidy.Services
{
......@@ -16,146 +14,190 @@ public class SubsidyService
private readonly ConnectionFactory _factory;
private readonly ConnectionStringBuilder builder;
private readonly int _commandTimeout;
private readonly IDbConnection _dbConnection;
private readonly ILogger<SubsidyService> logger;
public SubsidyService(
ConnectionFactory factory,
ConnectionStringBuilder builder)
ConnectionStringBuilder builder,
ILogger<SubsidyService> logger)
{
_factory = factory;
this.builder = builder;
_commandTimeout = 60 * 5;
_dbConnection = _factory.CreateDefault();
this.logger = logger;
}
//绩效列表
public async Task<IEnumerable<view_allot>> GetAllot()
{
return await _factory.CreateDefault().QueryAsync<view_allot>("SELECT * FROM view_allot;");
return await _dbConnection.QueryAsync<view_allot>("SELECT * FROM view_allot;");
}
public void GetAllot(int allotId)
//allot查询
public view_allot GetAllot(int allotId)
{
var allot = _factory.CreateDefault().Query<view_allot>($@"select * frrom view_allot where AllotID=@allotId;", new { allotId });
if (allot == null || !allot.Any()) throw new Exception("allotId无效");
return _dbConnection.QueryFirst<view_allot>($@"select * from view_allot where AllotID=@allotId;", new { allotId });
}
public async Task<IEnumerable<sub_jobtitle>> GetJobTitle(int allotId, int hospitalId)
//职称查询
public IEnumerable<sub_jobtitle> GetJobTitle(int allotId, int hospitalId)
{
var jobTitleSql = $@"select * from sub_jobtitle where AllotID=@allotId;";
var jobTitles = _factory.CreateDefault().Query<sub_jobtitle>(jobTitleSql, new { allotId });
if (jobTitles != null || jobTitles.Any()) return jobTitles;
try
{
var jobTitleSql = $@"select * from sub_jobtitle where AllotID=@allotId and JobTitle is not null;";
var jobTitles = _dbConnection.Query<sub_jobtitle>(jobTitleSql, new { allotId });
if (jobTitles?.Count() > 0) return jobTitles;
jobTitles = _factory.CreateDefault().Query<sub_jobtitle>($@"SELECT DISTINCT JobTitle FROM db_performance_subsidy.sub_subsidy where AllotID=@allotId;", new { allotId }).Select(t => new sub_jobtitle { JobTitle = t.JobTitle, BasicPerforFee = t.BasicPerforFee ?? 0 });
jobTitles = _dbConnection.Query<sub_jobtitle>($@"SELECT DISTINCT JobTitle FROM db_performance_subsidy.sub_subsidy where AllotID=@allotId;", new { allotId }).Select(t => new sub_jobtitle { JobTitle = t.JobTitle, BasicPerforFee = t.BasicPerforFee ?? 0 });
var allotOder = _factory.CreateDefault().Query<view_allot>($@"SELECT * from view_allot a WHERE a.HospitalId=@HospitalId ORDER BY a.`Year`,a.`Month`;", new { hospitalId }).ToList();
if (!allotOder.Any()) return jobTitles;
var allotOder = _dbConnection.Query<view_allot>($@"SELECT * from view_allot a WHERE a.HospitalId=@HospitalId ORDER BY a.`Year`,a.`Month`;", new { hospitalId }).ToList();
if (!allotOder.Any()) return jobTitles;
var allot = allotOder.FirstOrDefault(t => t.AllotId == allotId);
if (allot == null) throw new Exception("有问题");
var allot = allotOder.FirstOrDefault(t => t.AllotId == allotId);
if (allot == null) throw new Exception("有问题");
var index = allotOder.IndexOf(allot);
if (index == 0) return jobTitles;
var index = allotOder.IndexOf(allot);
if (index == 0) return jobTitles;
var prevAllot = allotOder[index - 1];
var jobTitle = _factory.CreateDefault().Query<sub_jobtitle>(jobTitleSql, new { prevAllot.AllotId });
var prevAllot = allotOder[index - 1];
var jobTitle = _dbConnection.Query<sub_jobtitle>(jobTitleSql, new { prevAllot.AllotId });
return jobTitle.Select(t => new sub_jobtitle { JobTitle = t.JobTitle, BasicPerforFee = t.BasicPerforFee ?? 0 }) ?? jobTitles;
}
catch (Exception e)
{
logger.LogError(e.Message);
throw e;
}
return jobTitle.Select(t => new sub_jobtitle { JobTitle = t.JobTitle, BasicPerforFee = t.BasicPerforFee ?? 0 }) ?? jobTitles;
}
//重新查询职称
public void GetHrpJobTitle(int allotId, int hospitalId, bool isRefresh)
{
GetAllot(allotId);
var subsidy = _factory.CreateDefault().Query<sub_subsidy>("select * from sub_subsidy where AllotID=@allotId;", new { allotId });
if (subsidy.Any() && isRefresh == false) return;
var config = _factory.CreateDefault().QueryFirst<ex_config>("select * from ex_config where hospitalId=@hospitalId", new { hospitalId });
var connectionString = builder.GetConnectionString(config.DataBaseType, config.DbSource, config.DbName, config.DbUser, config.DbPassword);
var connection = _factory.Create(config.DataBaseType, connectionString);
var hrp = _factory.CreateDefault().QueryFirst<ex_script>("select * from ex_script;");
var res = connection.Query<sub_subsidy>(hrp.ExecScript,allotId, commandTimeout: _commandTimeout);
//删除:在点击重新加载时删除记录重新插入
_factory.CreateDefault().Execute("delete from sub_subsidy where AllotID=@allotId;delete from sub_jobtitle where AllotID=@allotId;", new { allotId });
var jobtitle = res.Select(t => new { t.AllotID, t.JobTitle,t.BasicPerforFee }).Distinct();
var sql = $@"insert into sub_jobtitle(AllotID,JobTitle,BasicPerforFee) values (@allotId,@JobTitle,@BasicPerforFee);";
_factory.CreateDefault().Execute(sql, jobtitle);
sql = $@"insert into sub_subsidy (AllotID,Department,PersonnelNumber,PersonnelName,JobTitle,Attendance) values (@allotId,@Department,@PersonnelNumber,@PersonnelName,@JobTitle,@Attendance);";
var exmper = res.ToList().Select(t => new
try
{
var allot = GetAllot(allotId);
if (allot == null) throw new Exception("AllotId无效");
var subsidies = _dbConnection.Query<sub_subsidy>("select * from sub_subsidy where AllotID=@allotId;", new { allotId });
if (subsidies.Any() && isRefresh == false) return;
var config = _dbConnection.QueryFirst<ex_config>("select * from ex_config where hospitalId=@hospitalId", new { hospitalId });
var connectionString = builder.GetConnectionString(config.DataBaseType, config.DbSource, config.DbName, config.DbUser, config.DbPassword);
var connection = _factory.Create(config.DataBaseType, connectionString);
var hrp = _dbConnection.QueryFirst<ex_script>("select * from ex_script;");
var res = connection.Query<sub_subsidy>(hrp?.ExecScript, new { allotId }, commandTimeout: _commandTimeout);
var subsidy = subsidies.Select(t => new { t.JobTitle, t.BasicPerforFee }).Distinct();
//删除:在点击重新加载时删除记录重新插入
_dbConnection.Execute("delete from sub_subsidy where AllotID=@allotId;delete from sub_jobtitle where AllotID=@allotId;", new { allotId });
var jobtitle = res.Select(t => new { allotId, t.JobTitle,
BasicPerforFee=subsidy.Where(w => w.JobTitle == t.JobTitle)?.Select(t => t.BasicPerforFee).FirstOrDefault() }).Distinct();
var sql = $@"insert into sub_jobtitle(AllotID,JobTitle,BasicPerforFee) values (@allotId,@JobTitle,@BasicPerforFee);";
_dbConnection.Execute(sql, jobtitle);
sql = $@"insert into sub_subsidy (AllotID,Department,PersonnelNumber,PersonnelName,JobTitle,Attendance) values (@allotId,@Department,@PersonnelNumber,@PersonnelName,@JobTitle,@Attendance);";
var exmper = res.ToList().Select(t => new
{
AllotID = allotId,
t.Department,
t.PersonnelNumber,
t.PersonnelName,
t.JobTitle,
t.Attendance
});
var i = _dbConnection.Execute(sql, exmper);
}
catch (Exception e)
{
AllotID = allotId,
t.Department,
t.PersonnelNumber,
t.PersonnelName,
t.JobTitle,
t.Attendance
});
var i = _factory.CreateDefault().Execute(sql, exmper);
logger.LogError(e.Message);
throw e;
}
}
#region zb
/*
public bool SaveJobTitle(int allotId, List<sub_jobtitle> jobtitles)
//职称标准保存
public bool SaveJobTitle(int allotId, List<sub_jobtitle> jobtitle)
{
GetAllot(allotId);
var sql = $@"update sub_jobtitle set BasicPerforFee =@BasicPerforFee where AllotID=@allotId and JobTitle=@JobTitle;";
var result = jobtitles.Select(t => new { AllotID = allotId, t.JobTitle, t.BasicPerforFee });
_factory.CreateDefault().Execute(sql, result);
_factory.CreateDefault().Execute($@"call proc_performance_subsidy(@AllotId);", new { allotId });
return true;
try
{
var allot = GetAllot(allotId);
if (allot == null) throw new Exception("AllotId无效");
var result = jobtitle.Select(t => new { AllotID = allotId, t.BasicPerforFee, t.JobTitle });
var modify = _dbConnection.Execute($" update `sub_jobtitle` set BasicPerforFee =@BasicPerforFee WHERE AllotID=@allotId and JobTitle=@JobTitle; ", result);
_dbConnection.Execute("call proc_performance_subsidy(@allotId) ;", new { allotId });
return modify > 0;
}
catch (Exception e)
{
logger.LogError(e.Message);
throw e;
}
}
public IEnumerable<sub_subsidy> GetJobTitle(int allotId)
//个人职称补贴结果查询
public List<sub_subsidy> GetJobTitleSubsidy(int allotId)
{
GetAllot(allotId);
var subsidy = _factory.CreateDefault().Query<sub_subsidy>($@"select * from sub_subsidy where AllotId=@allotId", new { allotId });
return subsidy;
try
{
var allot = GetAllot(allotId);
if (allot == null) throw new Exception("AllotId无效");
IEnumerable<sub_subsidy> _Subsidies = _dbConnection.Query<sub_subsidy>(@"
select * from sub_subsidy where JobTitle is not null and AllotID=@allotId ;", new { allotId });
return _Subsidies?.ToList();
}
catch (Exception e)
{
logger.LogError(e.Message);
throw e;
}
}
public bool SaveSubsidy(int allotId, List<sub_subsidy> subsidys)
//个人职称补贴结果保存
public bool SaveJobTitleSubsidy(int allotId, List<sub_subsidy> subsidys)
{
GetAllot(allotId);
var result = subsidys.Select(t => new { AllotId = allotId, t.RealAmount, t.PersonnelNumber });
_factory.CreateDefault().Execute(@$"update sub_subsidy set RealAmount=@RealAmount where AllotID=@AllotID and PersonnelNumber=@PersonnelNumber;",result);
_factory.CreateDefault().Execute($@"call proc_performance_sync(@allotId);", new { allotId });
return true;
}
*/
#endregion
try
{
var allot = GetAllot(allotId);
if (allot == null) throw new Exception("AllotId无效");
public bool SaveJobTitle(int allotId, List<sub_jobtitle> jobtitle)
{
GetAllot(allotId);
var CreateDefault = _factory.CreateDefault();
var result = jobtitle.Select(t => new { AllotID = allotId, t.BasicPerforFee, t.JobTitle });
var modify= CreateDefault.Execute($" update `sub_jobtitle` set BasicPerforFee =@BasicPerforFee WHERE AllotID=@allotId and JobTitle=@JobTitle; ", result);
CreateDefault.Execute("call proc_performance_subsidy(@allotId) ;", new { allotId });
return modify>0;
}
var result = subsidys.Select(t => new { t.RealAmount, AllotID = allotId, t.PersonnelNumber });
_dbConnection.Execute(@$"update sub_subsidy set GiveAmount = Attendance * BasicPerforFee, RealAmount = @RealAmount where AllotID=@allotId and PersonnelNumber=@PersonnelNumber;", result);
public List<sub_subsidy> GetJobTitleSubsidy(int allotId)
{
GetAllot(allotId);
IEnumerable<sub_subsidy> _Subsidies = _factory.CreateDefault().Query<sub_subsidy>(@"
select * from sub_subsidy where RealAmount is not null and AllotID=@allotId ;", new { allotId });
return _Subsidies?.ToList();
_dbConnection.Execute($@"call proc_performance_sync(@allotId);", new { allotId });
return true;
}
catch (Exception e)
{
logger.LogError(e.Message);
throw e;
}
}
public bool SaveJobTitleSubsidy(int allotId, List<sub_subsidy> subsidys)
public bool SaveSubsidy(int allotId, List<sub_subsidy> subsidys)
{
GetAllot(allotId);
var result = subsidys.Select(t => new { t.RealAmount, AllotID = allotId, t.PersonnelNumber });
_factory.CreateDefault().Execute(@$"update sub_subsidy set GiveAmount = Attendance * BasicPerforFee, RealAmount = @RealAmount where AllotID=@allotId and PersonnelNumber=@PersonnelNumber;",result);
_factory.CreateDefault().Execute($@"call proc_performance_sync(@allotId);", new { allotId });
return true;
try
{
var allot = GetAllot(allotId);
if (allot == null) throw new Exception("AllotId无效");
var result = subsidys.Select(t => new { t.RealAmount, AllotID = allotId, t.PersonnelNumber });
_dbConnection.Execute(@$"update sub_subsidy set GiveAmount = Attendance * BasicPerforFee, RealAmount = @RealAmount where AllotID=@allotId and PersonnelNumber=@PersonnelNumber;", result);
return true;
}
catch (Exception e)
{
logger.LogError(e.Message);
throw e;
}
}
}
}
......@@ -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