|
@@ -28,14 +28,14 @@ namespace OASystem.API.OAMethodLib
|
|
public static class GeneralMethod
|
|
public static class GeneralMethod
|
|
{
|
|
{
|
|
//团组信息
|
|
//团组信息
|
|
- private readonly static SqlSugarClient _sqlSugar = AutofacIocManager.Instance.GetService<SqlSugarClient>();
|
|
|
|
- private readonly static DelegationInfoRepository _dirRep = AutofacIocManager.Instance.GetService<DelegationInfoRepository>();
|
|
|
|
- private readonly static TeamRateRepository _teamRateRep = AutofacIocManager.Instance.GetService<TeamRateRepository>();
|
|
|
|
- private readonly static IJuHeApiService _juHeApi = AutofacIocManager.Instance.GetService<IJuHeApiService>();
|
|
|
|
- private readonly static SetDataRepository _setDataRep = AutofacIocManager.Instance.GetService<SetDataRepository>();
|
|
|
|
- private readonly static TableOperationRecordRepository _tableOperationRecordRep = AutofacIocManager.Instance.GetService<TableOperationRecordRepository>();
|
|
|
|
- private readonly static MessageRepository _messageRep = AutofacIocManager.Instance.GetService<MessageRepository>();
|
|
|
|
- private readonly static IHubContext<ChatHub, IChatClient> _hubContext = AutofacIocManager.Instance.GetService<IHubContext<ChatHub, IChatClient>>();
|
|
|
|
|
|
+ private static readonly SqlSugarClient _sqlSugar = AutofacIocManager.Instance.GetService<SqlSugarClient>();
|
|
|
|
+ private static readonly DelegationInfoRepository _dirRep = AutofacIocManager.Instance.GetService<DelegationInfoRepository>();
|
|
|
|
+ private static readonly TeamRateRepository _teamRateRep = AutofacIocManager.Instance.GetService<TeamRateRepository>();
|
|
|
|
+ private static readonly IJuHeApiService _juHeApi = AutofacIocManager.Instance.GetService<IJuHeApiService>();
|
|
|
|
+ private static readonly SetDataRepository _setDataRep = AutofacIocManager.Instance.GetService<SetDataRepository>();
|
|
|
|
+ private static readonly TableOperationRecordRepository _tableOperationRecordRep = AutofacIocManager.Instance.GetService<TableOperationRecordRepository>();
|
|
|
|
+ private static readonly MessageRepository _messageRep = AutofacIocManager.Instance.GetService<MessageRepository>();
|
|
|
|
+ private static readonly IHubContext<ChatHub, IChatClient> _hubContext = AutofacIocManager.Instance.GetService<IHubContext<ChatHub, IChatClient>>();
|
|
|
|
|
|
private readonly static string[] weekdays = new string[] { "星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六" };
|
|
private readonly static string[] weekdays = new string[] { "星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六" };
|
|
#region 员工注册默认添加基础页面
|
|
#region 员工注册默认添加基础页面
|
|
@@ -821,6 +821,55 @@ namespace OASystem.API.OAMethodLib
|
|
|
|
|
|
#region 三公费用相关
|
|
#region 三公费用相关
|
|
|
|
|
|
|
|
+
|
|
|
|
+ // <summary>
|
|
|
|
+ /// 保存操作前汇率
|
|
|
|
+ /// </summary>
|
|
|
|
+ /// <param name="currUserId"></param>
|
|
|
|
+ /// <returns></returns>
|
|
|
|
+ public static async Task<bool> RateRecordSave(int currUserId, int diId, string linkModule)
|
|
|
|
+ {
|
|
|
|
+ //var selectData = await _enterExitCostRep._sqlSugar.Queryable<Sys_ExchangeRateRecord>()
|
|
|
|
+ // .Where(x => Convert.ToDateTime(x.RateDateTime).ToString("yyyy-MM-dd").Equals(DateTime.Now.ToString("yyyy-MM-dd")))
|
|
|
|
+ // .FirstAsync();
|
|
|
|
+ //if (selectData != null) return false;
|
|
|
|
+
|
|
|
|
+ var _currencyRate = await _juHeApi.PostItemRateAsync(new string[] { });
|
|
|
|
+
|
|
|
|
+ string rateInfoStr = string.Empty;
|
|
|
|
+
|
|
|
|
+ var oaCurrencyData = await _sqlSugar.Queryable<Sys_SetData>()
|
|
|
|
+ .Where(x => x.IsDel == 0 && x.STid == 66)
|
|
|
|
+ .ToListAsync();
|
|
|
|
+
|
|
|
|
+ foreach (var rate in _currencyRate)
|
|
|
|
+ {
|
|
|
|
+ var oaCurrncy = oaCurrencyData.Find(x => x.Remark.Equals(rate.Name));
|
|
|
|
+ if (oaCurrncy == null) continue;
|
|
|
|
+
|
|
|
|
+ //美元(USD):7.5|
|
|
|
|
+ rateInfoStr += $"{rate.Name}({oaCurrncy.Name}):{rate.FSellPri}|";
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (string.IsNullOrEmpty(rateInfoStr)) return false;
|
|
|
|
+
|
|
|
|
+ var add = await _sqlSugar
|
|
|
|
+ .Insertable<Sys_ExchangeRateRecord>(new Sys_ExchangeRateRecord()
|
|
|
|
+ {
|
|
|
|
+ DiId = diId,
|
|
|
|
+ LinkModule = linkModule,
|
|
|
|
+ RateDateTime = DateTime.Now,
|
|
|
|
+ RateInfo = rateInfoStr,
|
|
|
|
+ CreateUserId = currUserId,
|
|
|
|
+ IsDel = 0
|
|
|
|
+ })
|
|
|
|
+ .ExecuteCommandAsync();
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ return add > 0 ? true : false;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
/// <summary>
|
|
/// <summary>
|
|
/// 三公费用导入首款账单数据
|
|
/// 三公费用导入首款账单数据
|
|
/// </summary>
|
|
/// </summary>
|