|
@@ -23,7 +23,7 @@ namespace OASystem.API.OAMethodLib
|
|
|
//团组信息
|
|
|
private readonly static DelegationInfoRepository _dirRep = AutofacIocManager.Instance.GetService<DelegationInfoRepository>();
|
|
|
private readonly static TeamRateRepository _teamRateRep = AutofacIocManager.Instance.GetService<TeamRateRepository>();
|
|
|
- private readonly static IJuHeApiService _juHeApiService = AutofacIocManager.Instance.GetService<IJuHeApiService>();
|
|
|
+ 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>();
|
|
@@ -102,7 +102,7 @@ namespace OASystem.API.OAMethodLib
|
|
|
return notificationStr;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+
|
|
|
|
|
|
#endregion
|
|
|
|
|
@@ -211,7 +211,7 @@ namespace OASystem.API.OAMethodLib
|
|
|
private static DateTime dateStart = new DateTime(1970, 1, 1, 8, 0, 0);
|
|
|
private static long longTime = 621355968000000000;
|
|
|
private static int samllTime = 10000000;
|
|
|
-
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// 时间戳 转 datetime
|
|
|
/// </summary>
|
|
@@ -234,7 +234,7 @@ namespace OASystem.API.OAMethodLib
|
|
|
/// <param name="userId">用户Id</param>
|
|
|
/// <param name="PageId">页面Id</param>
|
|
|
/// <returns></returns>
|
|
|
- public static async Task<PageFunAuthViewBase> PostUserPageFuncDatas(int userId,int PageId)
|
|
|
+ public static async Task<PageFunAuthViewBase> PostUserPageFuncDatas(int userId, int PageId)
|
|
|
{
|
|
|
PageFunAuthViewBase pageFunAuth = new PageFunAuthViewBase();
|
|
|
|
|
@@ -301,9 +301,9 @@ namespace OASystem.API.OAMethodLib
|
|
|
/// <param name="userId">用户Id</param>
|
|
|
/// <param name="CTable">业务模块Id</param>
|
|
|
/// <returns></returns>
|
|
|
- public static async Task<Result> PostGroupOperationAuth(int diId, int userId, int CTable )
|
|
|
+ public static async Task<Result> PostGroupOperationAuth(int diId, int userId, int CTable)
|
|
|
{
|
|
|
- Result _result = new Result { Code = -1,Msg = "No Operation Authorty!" };
|
|
|
+ Result _result = new Result { Code = -1, Msg = "No Operation Authorty!" };
|
|
|
if (CTable < 1)
|
|
|
{
|
|
|
_result.Msg = "请填写正确的用户Id!";
|
|
@@ -312,7 +312,7 @@ namespace OASystem.API.OAMethodLib
|
|
|
|
|
|
var data = await _dirRep._sqlSugar.Queryable<Grp_GroupsTaskAssignment>().Where(it => it.DIId == diId && it.UId == userId && it.CTId == CTable && it.IsDel == 0).FirstAsync();
|
|
|
|
|
|
- if (data == null)
|
|
|
+ if (data == null)
|
|
|
{
|
|
|
_result.Msg = "你没有本团下的该业务模块操作,请联系主管分配操作权限!";
|
|
|
}
|
|
@@ -345,93 +345,84 @@ namespace OASystem.API.OAMethodLib
|
|
|
|
|
|
Result result = new() { Code = -2 };
|
|
|
|
|
|
- if (userId < 0)
|
|
|
+ if (userId < 1)
|
|
|
{
|
|
|
result.Msg = string.Format(@"请传入正确的userId");
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
- if (diId < 0)
|
|
|
+ if (diId < 1)
|
|
|
{
|
|
|
result.Msg = string.Format(@"请传入正确的DiId");
|
|
|
return result;
|
|
|
}
|
|
|
//美元(USD):1.0000|欧元(EUR):1.0000|墨西哥比索(MXN):1.0000
|
|
|
- string CNYInit = string.Format(@"人名币(CNY):1.0000");
|
|
|
+ string rateInit = string.Format(@"人名币(CNY):1.0000");
|
|
|
|
|
|
- var gropInfo = await _dirRep._sqlSugar.Queryable<Grp_DelegationInfo>().Where( it => it.IsDel == 0 && it.Id == diId).FirstAsync();
|
|
|
- if (gropInfo != null)
|
|
|
- {
|
|
|
- if (!string.IsNullOrEmpty(gropInfo.VisitCountry))
|
|
|
- {
|
|
|
- var countryCueencyCodes = await _setDataRep.GetSetDataBySTId(_setDataRep, 66);
|
|
|
+ //var gropInfo = _dirRep._sqlSugar.Queryable<Grp_DelegationInfo>().Where(it => it.IsDel == 0 && it.Id == diId).First();
|
|
|
+ //if (gropInfo == null)
|
|
|
+ //{
|
|
|
+ // result.Msg = $@"未查询到团组信息!";
|
|
|
+ // return result;
|
|
|
+ //}
|
|
|
|
|
|
- string countrys = gropInfo.VisitCountry;
|
|
|
- string[] countryItems = new string[] { };
|
|
|
- if (countrys.Contains("|"))
|
|
|
- {
|
|
|
- countryItems = countrys.Split('|');
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- countryItems = new string[] { countrys };
|
|
|
- }
|
|
|
+ var juheRateData = await _juHeApi.GetExchangeRateAsync();
|
|
|
|
|
|
- var countryInfos = await _dirRep._sqlSugar.Queryable<Dis_Country>().Where(it => it.IsDel == 0).ToListAsync();
|
|
|
+ if (juheRateData.Error_code != 0)
|
|
|
+ {
|
|
|
+ result.Msg = juheRateData.Reason;
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ List<ExchangeRateModel> exchangeRateModels = (List<ExchangeRateModel>)juheRateData.Result;
|
|
|
+ if (exchangeRateModels.Count <= 0)
|
|
|
+ {
|
|
|
+ result.Msg = $@"未查询到聚合接口汇率信息!";
|
|
|
+ return result;
|
|
|
+ }
|
|
|
|
|
|
- List<string> currencyCodes = new List<string>();
|
|
|
- if (countryItems.Length > 0)
|
|
|
+ if (exchangeRateModels.Count > 0)
|
|
|
+ {
|
|
|
+ var codes = _dirRep._sqlSugar.Queryable<Sys_SetData>().Where(it => it.IsDel == 0 && it.STid == 66).ToList();
|
|
|
+ for (int i = 0; i < exchangeRateModels.Count; i++)
|
|
|
+ {
|
|
|
+ string currencyName = exchangeRateModels[i].Name;
|
|
|
+ string code = "";
|
|
|
+ var currencyData = codes.Where(it => it.Remark == currencyName).FirstOrDefault();
|
|
|
+ if (currencyData != null)
|
|
|
{
|
|
|
- foreach (var item in countryItems)
|
|
|
- {
|
|
|
- Dis_Country country = new Dis_Country();
|
|
|
- country = countryInfos.Where(it => it.CnShortName.Equals(item)).FirstOrDefault();
|
|
|
- if (country != null)
|
|
|
- {
|
|
|
- if (!item.Equals("中国"))
|
|
|
- {
|
|
|
- currencyCodes.Add(country.CurrencyCode);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ code = currencyData.Name;
|
|
|
|
|
|
- if (currencyCodes.Count > 0)
|
|
|
- {
|
|
|
- List<ExchangeRateModel> exchangeRateModels = await _juHeApiService.PostItemRateAsync(currencyCodes.ToArray());
|
|
|
- if (exchangeRateModels.Count > 0)
|
|
|
+ decimal currRate = 0.00M;
|
|
|
+ string MSellPri = exchangeRateModels[i].MSellPri;
|
|
|
+ if (!string.IsNullOrEmpty(MSellPri))
|
|
|
{
|
|
|
- var codes = await _dirRep._sqlSugar.Queryable<Sys_SetData>().Where(it => it.IsDel == 0 && it.IsDel == 0).ToListAsync();
|
|
|
- for (int i = 0; i < exchangeRateModels.Count; i++)
|
|
|
- {
|
|
|
- string currencyName = exchangeRateModels[i].Name;
|
|
|
- string code = "";
|
|
|
- var currencyData = codes.Where(it => it.IsDel == 0 && it.Remark == currencyName).FirstOrDefault();
|
|
|
- if (currencyData != null) {
|
|
|
- code = currencyData.Name;
|
|
|
- CNYInit += string.Format(@"|{0}({1}):{2}", exchangeRateModels[i].Name, code, exchangeRateModels[i].MSellPri);
|
|
|
- }
|
|
|
- }
|
|
|
+ currRate = Convert.ToDecimal(MSellPri) / 100M;
|
|
|
}
|
|
|
+
|
|
|
+ rateInit += $@"|{currencyName}({code}):{currRate.ToString("#0.0000")}";
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- List<Grp_TeamRate> grp_TeamRates = new List<Grp_TeamRate>()
|
|
|
+ var cTableIds = _dirRep._sqlSugar.Queryable<Sys_SetData>().Where(it => it.IsDel == 0 && it.STid == 16).ToList();
|
|
|
+
|
|
|
+ if (cTableIds.Count < 1)
|
|
|
{
|
|
|
- new Grp_TeamRate(){ DiId = diId,CTable = 76,Remark = CNYInit,CreateUserId = userId, IsDel = 0 }, //76 酒店预订
|
|
|
- new Grp_TeamRate(){ DiId = diId,CTable = 77,Remark = CNYInit,CreateUserId = userId, IsDel = 0 }, //77 行程
|
|
|
- new Grp_TeamRate(){ DiId = diId,CTable = 79,Remark = CNYInit,CreateUserId = userId, IsDel = 0 }, //79 车/导游地接
|
|
|
- new Grp_TeamRate(){ DiId = diId,CTable = 80,Remark = CNYInit,CreateUserId = userId, IsDel = 0 }, //80 签证
|
|
|
- new Grp_TeamRate(){ DiId = diId,CTable = 82,Remark = CNYInit,CreateUserId = userId, IsDel = 0 }, //82 团组客户保险
|
|
|
- new Grp_TeamRate(){ DiId = diId,CTable = 85,Remark = CNYInit,CreateUserId = userId, IsDel = 0 }, //85 机票预订
|
|
|
- new Grp_TeamRate(){ DiId = diId,CTable = 98,Remark = CNYInit,CreateUserId = userId, IsDel = 0 }, //98 其他款项
|
|
|
- new Grp_TeamRate(){ DiId = diId,CTable = 285,Remark = CNYInit,CreateUserId = userId, IsDel = 0 }, //285 收款退还
|
|
|
- new Grp_TeamRate(){ DiId = diId,CTable = 751,Remark = CNYInit,CreateUserId = userId, IsDel = 0 }, //751 酒店早餐
|
|
|
- };
|
|
|
+ result.Msg = $@"未查询到操作模块信息!";
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ List<Grp_TeamRate> grp_TeamRates = new List<Grp_TeamRate>();
|
|
|
+
|
|
|
+ foreach (var item in cTableIds)
|
|
|
+ {
|
|
|
+ grp_TeamRates.Add(
|
|
|
+ new Grp_TeamRate() { DiId = diId, CTable = item.Id, Remark = rateInit, CreateUserId = userId }
|
|
|
+ );
|
|
|
+ }
|
|
|
|
|
|
var res = _teamRateRep._sqlSugar.Insertable(grp_TeamRates).ExecuteCommand();
|
|
|
- if (res < 0)
|
|
|
+ if (res < 1)
|
|
|
{
|
|
|
|
|
|
result.Msg = string.Format(@"添加失败!");
|
|
@@ -440,9 +431,7 @@ namespace OASystem.API.OAMethodLib
|
|
|
|
|
|
result.Code = 0;
|
|
|
result.Msg = string.Format(@"操作成功!");
|
|
|
-
|
|
|
return result;
|
|
|
-
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
@@ -510,7 +499,7 @@ namespace OASystem.API.OAMethodLib
|
|
|
/// string
|
|
|
/// eg: CNY 1.0000
|
|
|
/// </returns>
|
|
|
- public static async Task<string> PostGroupRateByCTableAndCurrency(List<TeamRateModelView> teamRateModels,int cTable,List<string> currencyCodes)
|
|
|
+ public static async Task<string> PostGroupRateByCTableAndCurrency(List<TeamRateModelView> teamRateModels, int cTable, List<string> currencyCodes)
|
|
|
{
|
|
|
string str = "";
|
|
|
|
|
@@ -555,14 +544,14 @@ namespace OASystem.API.OAMethodLib
|
|
|
/// <param name="diId"></param>
|
|
|
/// <param name="cTable"></param>
|
|
|
/// <returns></returns>
|
|
|
- public static async Task<TeamRateModelGeneralView> PostGroupTeamRateByDiIdAndCTableId( int portType,int diId,int cTable)
|
|
|
+ public static async Task<TeamRateModelGeneralView> PostGroupTeamRateByDiIdAndCTableId(int portType, int diId, int cTable)
|
|
|
{
|
|
|
|
|
|
TeamRateModelGeneralView _view = new TeamRateModelGeneralView();
|
|
|
_view = await _teamRateRep.PostGroupTeamRateByDiIdAndCTableId(portType, diId, cTable);
|
|
|
return _view;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
|
|
|
#endregion
|
|
|
|
|
@@ -675,7 +664,7 @@ namespace OASystem.API.OAMethodLib
|
|
|
/// <param name="dataId"></param>
|
|
|
/// <param name="remark"></param>
|
|
|
/// <returns></returns>
|
|
|
- public static async Task<bool> NewClientOperationRecord(int portType, OperationEnum operationEnum,int userId,int dataId,string remark )
|
|
|
+ public static async Task<bool> NewClientOperationRecord(int portType, OperationEnum operationEnum, int userId, int dataId, string remark)
|
|
|
{
|
|
|
Crm_TableOperationRecord _TableOperationRecord = new Crm_TableOperationRecord()
|
|
|
{
|