|
@@ -42,7 +42,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
|
|
|
Result result = new() { Code = -2 };
|
|
Result result = new() { Code = -2 };
|
|
|
|
|
|
- GroupNameDto groupNameDto = new GroupNameDto() { PortType = dto.PortType};
|
|
|
|
|
|
+ GroupNameDto groupNameDto = new GroupNameDto() { PortType = dto.PortType };
|
|
var groups = await _deleInfoRep.GetGroupNameList(groupNameDto);
|
|
var groups = await _deleInfoRep.GetGroupNameList(groupNameDto);
|
|
|
|
|
|
var teamRateDatas = await _setDataRep.GetSetDataBySTId(_setDataRep, 66); // STid=66 全球币种
|
|
var teamRateDatas = await _setDataRep.GetSetDataBySTId(_setDataRep, 66); // STid=66 全球币种
|
|
@@ -54,9 +54,10 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
List<Sys_SetData> sys_SetDatas = new List<Sys_SetData>();
|
|
List<Sys_SetData> sys_SetDatas = new List<Sys_SetData>();
|
|
sys_SetDatas = JsonConvert.DeserializeObject<List<Sys_SetData>>(JsonConvert.SerializeObject(teamRateDatas.Data));
|
|
sys_SetDatas = JsonConvert.DeserializeObject<List<Sys_SetData>>(JsonConvert.SerializeObject(teamRateDatas.Data));
|
|
List<TeamRateDescView> teamRateDescViews = new List<TeamRateDescView>();
|
|
List<TeamRateDescView> teamRateDescViews = new List<TeamRateDescView>();
|
|
- foreach (Sys_SetData item in sys_SetDatas)
|
|
|
|
|
|
+ foreach (Sys_SetData item in sys_SetDatas)
|
|
{
|
|
{
|
|
- teamRateDescViews.Add(new TeamRateDescView() {
|
|
|
|
|
|
+ teamRateDescViews.Add(new TeamRateDescView()
|
|
|
|
+ {
|
|
CurrencyName = item.Remark,
|
|
CurrencyName = item.Remark,
|
|
CurrencyCode = item.Name,
|
|
CurrencyCode = item.Name,
|
|
Rate = 0.0000M
|
|
Rate = 0.0000M
|
|
@@ -95,7 +96,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
|
|
|
Result result = new() { Code = -2 };
|
|
Result result = new() { Code = -2 };
|
|
|
|
|
|
-
|
|
|
|
|
|
+
|
|
|
|
|
|
string teamRateInfoSql = string.Format(@"Select * From Grp_TeamRate tr Where tr.IsDel = 0");
|
|
string teamRateInfoSql = string.Format(@"Select * From Grp_TeamRate tr Where tr.IsDel = 0");
|
|
|
|
|
|
@@ -103,7 +104,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
|
|
|
dynamic _data = null;
|
|
dynamic _data = null;
|
|
|
|
|
|
-
|
|
|
|
|
|
+
|
|
#region 团组汇率 - 详细汇率信息
|
|
#region 团组汇率 - 详细汇率信息
|
|
|
|
|
|
List<SetDataInfoView> otherCurrencyData1 = new List<SetDataInfoView>();
|
|
List<SetDataInfoView> otherCurrencyData1 = new List<SetDataInfoView>();
|
|
@@ -176,12 +177,12 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
{
|
|
{
|
|
rateStr = rateStr.Substring(0, rateStr.Length - 1);
|
|
rateStr = rateStr.Substring(0, rateStr.Length - 1);
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
item1.Remark = rateStr;
|
|
item1.Remark = rateStr;
|
|
|
|
|
|
-
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -193,9 +194,9 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
{
|
|
{
|
|
|
|
|
|
var _result = _sqlSugar.Updateable(teamRateInfo)
|
|
var _result = _sqlSugar.Updateable(teamRateInfo)
|
|
- .UpdateColumns(it => new {it.Remark} ) //更新列
|
|
|
|
- .WhereColumns(it => new { it.DiId,it.CTable }) //更新条件
|
|
|
|
- .ExecuteCommand();
|
|
|
|
|
|
+ .UpdateColumns(it => new { it.Remark }) //更新列
|
|
|
|
+ .WhereColumns(it => new { it.DiId, it.CTable }) //更新条件
|
|
|
|
+ .ExecuteCommand();
|
|
|
|
|
|
result.Code = 0;
|
|
result.Code = 0;
|
|
result.Msg = "数据修改成功!";
|
|
result.Msg = "数据修改成功!";
|
|
@@ -221,12 +222,12 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
|
|
|
Result result = new() { Code = -2 };
|
|
Result result = new() { Code = -2 };
|
|
|
|
|
|
- GroupInfoDto groupInfoDto = new GroupInfoDto() { Id = dto.Diid,PortType = dto.PortType, PageIndex = dto.PageIndex, PageSize = dto.PageSize };
|
|
|
|
|
|
+ GroupInfoDto groupInfoDto = new GroupInfoDto() { Id = dto.Diid, PortType = dto.PortType, PageIndex = dto.PageIndex, PageSize = dto.PageSize };
|
|
var groupInfo = await _deleInfoRep.GetGroupInfo(groupInfoDto);
|
|
var groupInfo = await _deleInfoRep.GetGroupInfo(groupInfoDto);
|
|
|
|
|
|
string teamRateInfoSql = string.Format(@"Select sd.Name,tr.* From Grp_TeamRate tr
|
|
string teamRateInfoSql = string.Format(@"Select sd.Name,tr.* From Grp_TeamRate tr
|
|
Left Join Sys_SetData sd On sd.IsDel=0 And sd.STid=16 And tr.CTable = sd.Id
|
|
Left Join Sys_SetData sd On sd.IsDel=0 And sd.STid=16 And tr.CTable = sd.Id
|
|
- Where tr.DiId = {0} And tr.IsDel = 0",dto.Diid);
|
|
|
|
|
|
+ Where tr.DiId = {0} And tr.IsDel = 0", dto.Diid);
|
|
|
|
|
|
var teamRateInfo = await _sqlSugar.SqlQueryable<TeamRateInfoView>(teamRateInfoSql).ToListAsync();
|
|
var teamRateInfo = await _sqlSugar.SqlQueryable<TeamRateInfoView>(teamRateInfoSql).ToListAsync();
|
|
|
|
|
|
@@ -318,12 +319,13 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
if (item.Remark.Contains("|"))
|
|
if (item.Remark.Contains("|"))
|
|
{
|
|
{
|
|
string[] currencyArr = item.Remark.Split("|");
|
|
string[] currencyArr = item.Remark.Split("|");
|
|
- foreach (string currency in currencyArr)
|
|
|
|
|
|
+ foreach (string currency in currencyArr)
|
|
{
|
|
{
|
|
string[] currency1 = currency.Split(":");
|
|
string[] currency1 = currency.Split(":");
|
|
string[] currency2 = currency1[0].Split("(");
|
|
string[] currency2 = currency1[0].Split("(");
|
|
|
|
|
|
- TeamRateDescView rateDescView = new TeamRateDescView() {
|
|
|
|
|
|
+ TeamRateDescView rateDescView = new TeamRateDescView()
|
|
|
|
+ {
|
|
CurrencyCode = currency2[1].Replace(")", "").TrimEnd(),
|
|
CurrencyCode = currency2[1].Replace(")", "").TrimEnd(),
|
|
CurrencyName = currency2[0],
|
|
CurrencyName = currency2[0],
|
|
Rate = decimal.Parse(currency1[1]),
|
|
Rate = decimal.Parse(currency1[1]),
|
|
@@ -418,14 +420,14 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
{
|
|
{
|
|
addCount++;
|
|
addCount++;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
else //修改
|
|
else //修改
|
|
{
|
|
{
|
|
teamRateInfo.Id = teamRateDetails.Id;
|
|
teamRateInfo.Id = teamRateDetails.Id;
|
|
res = await _sqlSugar.Updateable(teamRateInfo)
|
|
res = await _sqlSugar.Updateable(teamRateInfo)
|
|
.UpdateColumns(it => it.Remark)
|
|
.UpdateColumns(it => it.Remark)
|
|
- .WhereColumns(it => new { it.Id,it.DiId,it.CTable })
|
|
|
|
|
|
+ .WhereColumns(it => new { it.Id, it.DiId, it.CTable })
|
|
.ExecuteCommandAsync();
|
|
.ExecuteCommandAsync();
|
|
if (res > 0)
|
|
if (res > 0)
|
|
{
|
|
{
|
|
@@ -454,7 +456,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
|
|
|
result.Msg = ex.Message;
|
|
result.Msg = ex.Message;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
|
|
|
|
}
|
|
}
|
|
else if (dto.PortType == 2)
|
|
else if (dto.PortType == 2)
|
|
@@ -467,15 +469,12 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
}
|
|
}
|
|
|
|
|
|
result.Code = 0;
|
|
result.Code = 0;
|
|
- result.Msg = string.Format(@"操作成功!添加:{0}条;更新:{1};", addCount,updateCount);
|
|
|
|
|
|
+ result.Msg = string.Format(@"操作成功!添加:{0}条;更新:{1};", addCount, updateCount);
|
|
|
|
|
|
return result;
|
|
return result;
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
/// 团组汇率 Rep
|
|
/// 团组汇率 Rep
|
|
/// 根据团组Id 查询汇率
|
|
/// 根据团组Id 查询汇率
|
|
@@ -536,5 +535,175 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
return teamRateModels;
|
|
return teamRateModels;
|
|
|
|
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// 团组汇率 币种 Item (来源:团组汇率)
|
|
|
|
+ /// 根据 团组Id And 业务类型(CTable)Id
|
|
|
|
+ /// api处理CTable = 285,默认返回CNY
|
|
|
|
+ /// </summary>
|
|
|
|
+ /// <param name="portType"></param>
|
|
|
|
+ /// <param name="diId"></param>
|
|
|
|
+ /// <param name="cTable"></param>
|
|
|
|
+ /// <returns></returns>
|
|
|
|
+ public async Task<TeamRateModelGeneralView> PostGroupTeamRateByDiIdAndCTableId(int portType, int diId, int cTable)
|
|
|
|
+ {
|
|
|
|
+
|
|
|
|
+ TeamRateModelGeneralView _view = new TeamRateModelGeneralView();
|
|
|
|
+
|
|
|
|
+ if (diId < 1)
|
|
|
|
+ {
|
|
|
|
+ return _view;
|
|
|
|
+ }
|
|
|
|
+ if (cTable < 1)
|
|
|
|
+ {
|
|
|
|
+ return _view;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (portType == 1 || portType == 2 || portType == 3)
|
|
|
|
+ {
|
|
|
|
+ string teamRateInfoSql = string.Format(@"Select sd.Name,tr.* From Grp_TeamRate tr
|
|
|
|
+ Left Join Sys_SetData sd On sd.IsDel=0 And sd.STid=16 And tr.CTable = sd.Id
|
|
|
|
+ Where tr.IsDel = 0 And tr.DiId = {0} And tr.CTable = {1}", diId, cTable);
|
|
|
|
+
|
|
|
|
+ var teamRateInfo = await _sqlSugar.SqlQueryable<TeamRateInfoView>(teamRateInfoSql).ToListAsync();
|
|
|
|
+
|
|
|
|
+ #region 团组汇率
|
|
|
|
+
|
|
|
|
+ #region 单独处理Ctable 币种汇率 默认 为CNY
|
|
|
|
+ if (cTable == 285)
|
|
|
|
+ {
|
|
|
|
+ _view = new TeamRateModelGeneralView()
|
|
|
|
+ {
|
|
|
|
+ Id = 0,
|
|
|
|
+ CTableId = 285,
|
|
|
|
+ CTableName = "其他款项与收款退还",
|
|
|
|
+ TeamRates = new List<TeamRateDescAddCurrencyIdView>() {
|
|
|
|
+ new TeamRateDescAddCurrencyIdView()
|
|
|
|
+ {
|
|
|
|
+ CurrencyId = 836,
|
|
|
|
+ CurrencyCode = "CNY",
|
|
|
|
+ CurrencyName = "人民币",
|
|
|
|
+ Rate = 1.0000M,
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ };
|
|
|
|
+ return _view;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ #endregion
|
|
|
|
+
|
|
|
|
+ List<SetDataInfoView> currencyDatas = new List<SetDataInfoView>();
|
|
|
|
+ #region 获取所有币种
|
|
|
|
+
|
|
|
|
+ string sql = string.Format(@"select * from Sys_SetData where STid = {0} and isdel = 0", 66);
|
|
|
|
+ var DBdata = await _setDataRep.GetListBySqlWithNolockAsync(sql);
|
|
|
|
+
|
|
|
|
+ if (DBdata == null || DBdata.Count == 0)
|
|
|
|
+ {
|
|
|
|
+ return _view;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ currencyDatas = DBdata.Select(x => new SetDataInfoView
|
|
|
|
+ {
|
|
|
|
+ Name = x.Name,
|
|
|
|
+ Id = x.Id,
|
|
|
|
+ Remark = x.Remark,
|
|
|
|
+ }).ToList();
|
|
|
|
+
|
|
|
|
+ #endregion
|
|
|
|
+
|
|
|
|
+ foreach (TeamRateInfoView item in teamRateInfo)
|
|
|
|
+ {
|
|
|
|
+ TeamRateModelGeneralView teamRateModelInfo = new TeamRateModelGeneralView();
|
|
|
|
+
|
|
|
|
+ teamRateModelInfo.Id = item.Id;
|
|
|
|
+ teamRateModelInfo.CTableId = item.CTable;
|
|
|
|
+ teamRateModelInfo.CTableName = item.Name;
|
|
|
|
+ List<TeamRateDescAddCurrencyIdView> teamRateDescViews = new List<TeamRateDescAddCurrencyIdView>();
|
|
|
|
+
|
|
|
|
+ #region 拆分remark里的汇率
|
|
|
|
+
|
|
|
|
+ if (item.Remark.Contains("|"))
|
|
|
|
+ {
|
|
|
|
+ string[] currencyArr = item.Remark.Split("|");
|
|
|
|
+ foreach (string currency in currencyArr)
|
|
|
|
+ {
|
|
|
|
+ string[] currency1 = currency.Split(":");
|
|
|
|
+ string[] currency2 = currency1[0].Split("(");
|
|
|
|
+
|
|
|
|
+ string currencyCode = currency2[1].Replace(")", "").TrimEnd();
|
|
|
|
+ SetDataInfoView dataInfoView = new SetDataInfoView();
|
|
|
|
+ dataInfoView = currencyDatas.Where(it => it.Name == currencyCode).FirstOrDefault();
|
|
|
|
+ int currencyId = currencyDatas.Where(it => it.Name == currencyCode).FirstOrDefault().Id;
|
|
|
|
+ TeamRateDescAddCurrencyIdView rateDescView = new TeamRateDescAddCurrencyIdView()
|
|
|
|
+ {
|
|
|
|
+ CurrencyId = dataInfoView.Id,
|
|
|
|
+ CurrencyCode = currencyCode,
|
|
|
|
+ CurrencyName = currency2[0],
|
|
|
|
+ Rate = decimal.Parse(currency1[1]),
|
|
|
|
+ };
|
|
|
|
+ teamRateDescViews.Add(rateDescView);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ if (!string.IsNullOrEmpty(item.Remark))
|
|
|
|
+ {
|
|
|
|
+ string[] currency1 = item.Remark.Split(":");
|
|
|
|
+ string[] currency2 = currency1[0].Split("(");
|
|
|
|
+
|
|
|
|
+ string currencyCode = currency2[1].Replace(")", "").TrimEnd();
|
|
|
|
+ SetDataInfoView dataInfoView = new SetDataInfoView();
|
|
|
|
+ dataInfoView = currencyDatas.Where(it => it.Name == currencyCode).FirstOrDefault();
|
|
|
|
+ int currencyId = currencyDatas.Where(it => it.Name == currencyCode).FirstOrDefault().Id;
|
|
|
|
+ TeamRateDescAddCurrencyIdView rateDescView = new TeamRateDescAddCurrencyIdView()
|
|
|
|
+ {
|
|
|
|
+ CurrencyId = dataInfoView.Id,
|
|
|
|
+ CurrencyCode = currencyCode,
|
|
|
|
+ CurrencyName = currency2[0],
|
|
|
|
+ Rate = decimal.Parse(currency1[1]),
|
|
|
|
+ };
|
|
|
|
+ teamRateDescViews.Add(rateDescView);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ #endregion
|
|
|
|
+
|
|
|
|
+ if (teamRateDescViews.Count > 0)
|
|
|
|
+ {
|
|
|
|
+ teamRateDescViews = teamRateDescViews.OrderBy(it => it.CurrencyId).ToList();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ teamRateModelInfo.TeamRates = teamRateDescViews;
|
|
|
|
+ _view = teamRateModelInfo;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (_view.TeamRates == null)
|
|
|
|
+ {
|
|
|
|
+ _view.TeamRates = new List<TeamRateDescAddCurrencyIdView>();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ #endregion
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ return _view;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// 获取团组相关模块的currencyList
|
|
|
|
+ /// </summary>
|
|
|
|
+ /// <param name="portType"></param>
|
|
|
|
+ /// <param name="diId"></param>
|
|
|
|
+ /// <param name="cTable"></param>
|
|
|
|
+ /// <returns></returns>
|
|
|
|
+ public async Task<List<TeamRateDescAddCurrencyIdView>?> PostGroupTeamRateItemByDiIdAndCTableId(int portType, int diId, int cTable)
|
|
|
|
+ {
|
|
|
|
+ List<TeamRateDescAddCurrencyIdView>? teamRateDescAddCurrencyIdViews = new List<TeamRateDescAddCurrencyIdView>();
|
|
|
|
+ TeamRateModelGeneralView teamRateModelGeneralView = await PostGroupTeamRateByDiIdAndCTableId(portType, diId, cTable);
|
|
|
|
+ teamRateDescAddCurrencyIdViews = teamRateModelGeneralView.TeamRates;
|
|
|
|
+
|
|
|
|
+ return teamRateDescAddCurrencyIdViews;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|