|
@@ -51,47 +51,47 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
|
|
|
if (dto.PortType == 1)
|
|
|
{
|
|
|
- List<Sys_SetData> sys_SetDatas = new List<Sys_SetData>();
|
|
|
- sys_SetDatas = JsonConvert.DeserializeObject<List<Sys_SetData>>(JsonConvert.SerializeObject(teamRateDatas.Data));
|
|
|
- List<TeamRateDescView> teamRateDescViews = new List<TeamRateDescView>();
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
- teamRateDescViews = sys_SetDatas.Select(it => new TeamRateDescView() { CurrencyName = it.Remark, CurrencyCode = it.Name, Rate = 0.0000M }).ToList();
|
|
|
+
|
|
|
|
|
|
-
|
|
|
- * 放在首位币种
|
|
|
- * 人名币 CNY Rate = 1,美元 USD,欧元 EUR,港币 HKD,日元 JPY ,澳大利 AUD,英镑 GBP
|
|
|
- */
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
-
|
|
|
- var cnyData = teamRateDescViews.Find(it => it.CurrencyCode.Equals("CNY"));
|
|
|
- if (cnyData != null) { teamRateDescViews.Remove(cnyData); cnyData.Rate = 1.0000M; teamRateDescViews.Insert(0, cnyData); }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
-
|
|
|
- var usdData = teamRateDescViews.Find(it => it.CurrencyCode.Equals("USD"));
|
|
|
- if (usdData != null) { teamRateDescViews.Remove(usdData); teamRateDescViews.Insert(1, usdData); }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
-
|
|
|
- var eurData = teamRateDescViews.Find(it => it.CurrencyCode.Equals("EUR"));
|
|
|
- if (eurData != null) { teamRateDescViews.Remove(eurData); teamRateDescViews.Insert(2, eurData); }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
-
|
|
|
- var hkdData = teamRateDescViews.Find(it => it.CurrencyCode.Equals("HKD"));
|
|
|
- if (hkdData != null) { teamRateDescViews.Remove(hkdData); teamRateDescViews.Insert(3, hkdData); }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
-
|
|
|
- var jpyData = teamRateDescViews.Find(it => it.CurrencyCode.Equals("JPY"));
|
|
|
- if (jpyData != null) { teamRateDescViews.Remove(jpyData); teamRateDescViews.Insert(4, jpyData); }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
-
|
|
|
- var audData = teamRateDescViews.Find(it => it.CurrencyCode.Equals("AUD"));
|
|
|
- if (audData != null) { teamRateDescViews.Remove(audData); teamRateDescViews.Insert(5, audData); }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
-
|
|
|
- var gbpData = teamRateDescViews.Find(it => it.CurrencyCode.Equals("GBP"));
|
|
|
- if (gbpData != null) { teamRateDescViews.Remove(gbpData); teamRateDescViews.Insert(6, gbpData); }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
- _data = new { GroupData = groups.Data, TeamRateData = teamRateDescViews };
|
|
|
+ _data = new { GroupData = groups.Data, TeamRateData = PostGroupTeamRateHot() };
|
|
|
|
|
|
}
|
|
|
else if (dto.PortType == 2)
|
|
@@ -665,5 +665,120 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
|
|
|
return teamRateDescAddCurrencyIdViews;
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ public async Task<List<CurrencyHot>> PostGroupTeamRateHot()
|
|
|
+ {
|
|
|
+ List<CurrencyHot> _view = new List<CurrencyHot>();
|
|
|
+
|
|
|
+ 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 ");
|
|
|
+
|
|
|
+ var teamRateInfo = _sqlSugar.SqlQueryable<TeamRateInfoView>(teamRateInfoSql).ToList();
|
|
|
+
|
|
|
+ List<SetDataInfoView> currencyDatas = new List<SetDataInfoView>();
|
|
|
+ #region 获取所有币种
|
|
|
+
|
|
|
+ string sql = string.Format(@"Select * From Sys_SetData Where STid = {0} And IsDel = 0", 66);
|
|
|
+ var DBdata = _setDataRep.GetListBySqlWithNolock(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();
|
|
|
+
|
|
|
+ _view = currencyDatas.Select(it => new CurrencyHot() { CurrencyId = it.Id, CurrencyCode = it.Name, CurrencyName = it.Remark}).ToList();
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ List<TeamRateDescAddCurrencyIdView> teamRateDatas = new List<TeamRateDescAddCurrencyIdView>();
|
|
|
+ foreach (TeamRateInfoView item in teamRateInfo)
|
|
|
+ {
|
|
|
+ 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();
|
|
|
+ teamRateDatas.AddRange(teamRateDescViews);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ foreach (var item in _view)
|
|
|
+ {
|
|
|
+ if (item.CurrencyId == 836)
|
|
|
+ {
|
|
|
+ item.Rate = 1.0000M;
|
|
|
+ }
|
|
|
+
|
|
|
+ item.Number = teamRateDatas.Where(it => item.CurrencyId == it.CurrencyId).ToList().Count;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (_view.Count > 0)
|
|
|
+ {
|
|
|
+
|
|
|
+ _view = _view.OrderByDescending(it => it.Number).ToList();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ return _view;
|
|
|
+ }
|
|
|
}
|
|
|
}
|