|
@@ -1,5 +1,6 @@
|
|
|
|
|
|
using AutoMapper;
|
|
|
+using NPOI.SS.Formula.Functions;
|
|
|
using OASystem.Domain;
|
|
|
using OASystem.Domain.Dtos.Financial;
|
|
|
using OASystem.Domain.Dtos.Groups;
|
|
@@ -8,6 +9,7 @@ using OASystem.Domain.Entities.Groups;
|
|
|
using OASystem.Domain.ViewModels.Financial;
|
|
|
using OASystem.Domain.ViewModels.Groups;
|
|
|
using OASystem.Infrastructure.Repositories.System;
|
|
|
+using OASystem.Infrastructure.Tools;
|
|
|
using Org.BouncyCastle.Asn1.Cms;
|
|
|
using System;
|
|
|
using System.Collections.Generic;
|
|
@@ -37,8 +39,14 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
public async Task<Result> PostVisaByDiId(VisaPriceDto dto)
|
|
|
{
|
|
|
Result result = new Result() { Code = -2, Msg = "未知错误" };
|
|
|
+ if (dto.PortType==0 ||string.IsNullOrWhiteSpace(dto.PortType.ToString()))
|
|
|
+ {
|
|
|
+ return result = new Result() { Code = -1, Msg = "请传入PortType参数,请求端口分类 1 Web 2 Android 3 IOS" };
|
|
|
+ }
|
|
|
try
|
|
|
{
|
|
|
+ #region SQL条件拼接
|
|
|
+
|
|
|
string sqlWhere = string.Empty;
|
|
|
if (!string.IsNullOrWhiteSpace(dto.VisaClient))
|
|
|
{
|
|
@@ -61,59 +69,51 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
Regex r = new Regex("And");
|
|
|
sqlWhere = r.Replace(sqlWhere, "Where", 1);
|
|
|
}
|
|
|
- string sql = string.Format(@"select *,(select IsAuditGM from Grp_CreditCardPayment where CTable=80 and CId=v.Id) IsAuditGM,(select Name from Sys_SetData where isdel=0 and v.VisaCurrency=Id) VisaCurrencyStr from Grp_VisaInfo v {0} order by CreateTime desc", sqlWhere);
|
|
|
- List<VisaInfoView> infoViews = _sqlSugar.SqlQueryable<VisaInfoView>(sql).ToList();
|
|
|
- if (infoViews.Count != 0)
|
|
|
+
|
|
|
+ #endregion
|
|
|
+ int startIndex = (dto.PageIndex - 1) * dto.PageSize + 1;
|
|
|
+ int endIndex = startIndex + dto.PageSize - 1;
|
|
|
+ if (dto.PortType==1)
|
|
|
{
|
|
|
- if (dto.PageIndex != 0 && dto.PageSize != 0)
|
|
|
- {
|
|
|
+ string sql = string.Format(@"select *,(select IsAuditGM from Grp_CreditCardPayment where CTable=80 and CId=v.Id) IsAuditGM,
|
|
|
+ (select Name from Sys_SetData where isdel=0 and v.VisaCurrency=Id) VisaCurrencyStr from
|
|
|
+ Grp_VisaInfo v {0} order by CreateTime desc",sqlWhere);
|
|
|
+ List<VisaInfoView> infoViews = _sqlSugar.SqlQueryable<VisaInfoView>(sql).ToList();
|
|
|
+ return result = new Result() { Code = 0, Msg = "查询成功!", Data = infoViews };
|
|
|
+ }
|
|
|
+ else if(dto.PortType==2 || dto.PortType==3)
|
|
|
+ {
|
|
|
+ string sql = string.Format(@"Select * From (
|
|
|
+ Select row_number() over (order by v.Id Desc) as RowNumber,v.*,c.IsAuditGM,s.Name as VisaCurrencyStr
|
|
|
+ From Grp_VisaInfo v
|
|
|
+ Inner Join Grp_CreditCardPayment c On v.Id = c.CId and CTable=80
|
|
|
+ Left Join Sys_SetData s On v.VisaCurrency = s.Id {0}
|
|
|
+ ) temp Where RowNumber Between {1} and {2}", sqlWhere, startIndex, endIndex);
|
|
|
+
|
|
|
+ List<VisaInfoView> infoViews = _sqlSugar.SqlQueryable<VisaInfoView>(sql).ToList();
|
|
|
|
|
|
- int count = infoViews.Count;
|
|
|
+ string CountSql = string.Format(@"Select COUNT(1) as Count From (
|
|
|
+ Select v.*,c.IsAuditGM,s.Name as VisaCurrencyStr
|
|
|
+ From Grp_VisaInfo v
|
|
|
+ Inner Join Grp_CreditCardPayment c On v.Id = c.CId and CTable=80
|
|
|
+ Left Join Sys_SetData s On v.VisaCurrency = s.Id {0}
|
|
|
+ ) temp", sqlWhere);
|
|
|
+ DataCount dataCount = _sqlSugar.SqlQueryable<DataCount>(CountSql).First();
|
|
|
+ if (dataCount!=null)
|
|
|
+ {
|
|
|
+ int count = dataCount.Count;
|
|
|
float totalPage = (float)count / dto.PageSize;//总页数
|
|
|
if (totalPage == 0) totalPage = 1;
|
|
|
else totalPage = (int)Math.Ceiling((double)totalPage);
|
|
|
|
|
|
- List<VisaInfoView> visaInfosPage = new List<VisaInfoView>();
|
|
|
- for (int i = 0; i < dto.PageSize; i++)
|
|
|
- {
|
|
|
- var RowIndex = i + (dto.PageIndex - 1) * dto.PageSize;
|
|
|
- if (RowIndex < infoViews.Count)
|
|
|
- {
|
|
|
- visaInfosPage.Add(infoViews[RowIndex]);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
+
|
|
|
ListViewBase<VisaInfoView> rst = new ListViewBase<VisaInfoView>();
|
|
|
- rst.DataList = visaInfosPage;
|
|
|
+ rst.DataList = infoViews;
|
|
|
rst.DataCount = count;
|
|
|
rst.CurrPageIndex = dto.PageIndex;
|
|
|
rst.CurrPageSize = dto.PageSize;
|
|
|
return result = new Result() { Code = 0, Msg = "查询成功!", Data = rst };
|
|
|
}
|
|
|
- else
|
|
|
- {
|
|
|
- return result = new Result() { Code = 0, Msg = "查询成功!", Data = infoViews };
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- if (dto.PageIndex != 0 && dto.PageSize != 0)
|
|
|
- {
|
|
|
- ListViewBase<VisaInfoView> rst = new ListViewBase<VisaInfoView>();
|
|
|
- rst.DataList = infoViews;
|
|
|
- rst.DataCount = infoViews.Count;
|
|
|
- rst.CurrPageIndex = dto.PageIndex;
|
|
|
- rst.CurrPageSize = dto.PageSize;
|
|
|
- return result = new Result() { Code = 0, Msg = "暂无数据!", Data = rst };
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- return result = new Result() { Code = 0, Msg = "暂无数据!", Data = infoViews };
|
|
|
- }
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
catch (Exception)
|
|
@@ -121,6 +121,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
return result = new Result() { Code = -2, Msg = "未知错误" };
|
|
|
throw;
|
|
|
}
|
|
|
+ return result;
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// 根据签证费用Id查询单条数据及c表数据
|
|
@@ -160,146 +161,36 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
int id = 0;
|
|
|
Grp_VisaInfo grp_Visa1 = _mapper.Map<Grp_VisaInfo>(dto);
|
|
|
Grp_CreditCardPayment c = _mapper.Map<Grp_CreditCardPayment>(dto);
|
|
|
- c.PayMoney = grp_Visa1.VisaPrice;
|
|
|
+ c.PayMoney = dto.VisaPrice;
|
|
|
+ c.PaymentCurrency = dto.VisaCurrency;
|
|
|
+ c.Remark = dto.CRemark;
|
|
|
+ c.PayPercentage = 100;
|
|
|
+ c.CTable = 80;
|
|
|
+ c.CId = id;
|
|
|
+ c.IsAuditGM = 0;
|
|
|
+ if (c.PayDId == 72)
|
|
|
+ {
|
|
|
+ c.IsPay = 1;
|
|
|
+ }
|
|
|
+ c.RMBPrice = c.RMBPrice;
|
|
|
+ c.DayRate = 1;
|
|
|
Grp_TeamRate _TeamRate = _sqlSugar.Queryable<Grp_TeamRate>().First(a => a.DiId == dto.DiId && a.IsDel == 0 && a.CTable == 80);
|
|
|
+ List<CurrencyInfo> currencyInfos = new List<CurrencyInfo>();
|
|
|
if (_TeamRate != null)
|
|
|
{
|
|
|
- int OtherRateId = 0;
|
|
|
- Sys_SetData setData = _sqlSugar.Queryable<Sys_SetData>().First(a => a.IsDel == 0 && a.Id == _TeamRate.OtherRateId);
|
|
|
- if (setData != null)
|
|
|
- {
|
|
|
- OtherRateId = setData.Id;
|
|
|
- }
|
|
|
-
|
|
|
- #region 汇率换算
|
|
|
-
|
|
|
- if (grp_Visa1.VisaCurrency == 49)
|
|
|
- {
|
|
|
- c.RMBPrice = c.PayMoney * _TeamRate.RateU;
|
|
|
- c.DayRate = _TeamRate.RateU;
|
|
|
- }
|
|
|
- else if (OtherRateId == grp_Visa1.VisaCurrency)
|
|
|
- {
|
|
|
- c.RMBPrice = c.PayMoney * _TeamRate.OtherPrice;
|
|
|
- c.DayRate = _TeamRate.OtherPrice;
|
|
|
- }
|
|
|
- else if (grp_Visa1.VisaCurrency == 51)
|
|
|
- {
|
|
|
- c.RMBPrice = c.PayMoney * _TeamRate.RateE;
|
|
|
- c.DayRate = _TeamRate.RateE;
|
|
|
- }
|
|
|
- else if (grp_Visa1.VisaCurrency == 50)
|
|
|
- {
|
|
|
- c.RMBPrice = c.PayMoney * _TeamRate.RateJ;
|
|
|
- c.DayRate = _TeamRate.RateJ;
|
|
|
- }
|
|
|
- else if (grp_Visa1.VisaCurrency == 55)
|
|
|
- {
|
|
|
- c.RMBPrice = c.PayMoney * _TeamRate.RateH;
|
|
|
- c.DayRate = _TeamRate.RateH;
|
|
|
- }
|
|
|
- else if (grp_Visa1.VisaCurrency == 56)
|
|
|
- {
|
|
|
- c.RMBPrice = c.PayMoney * _TeamRate.RateN;
|
|
|
- c.DayRate = _TeamRate.RateN;
|
|
|
- }
|
|
|
- else if (grp_Visa1.VisaCurrency == 65)
|
|
|
- {
|
|
|
- c.RMBPrice = c.PayMoney * _TeamRate.RateS;
|
|
|
- c.DayRate = _TeamRate.RateS;
|
|
|
- }
|
|
|
- else if (grp_Visa1.VisaCurrency == 54)
|
|
|
- {
|
|
|
- c.RMBPrice = c.PayMoney * _TeamRate.RateA;
|
|
|
- c.DayRate = _TeamRate.RateA;
|
|
|
- }
|
|
|
- else if (grp_Visa1.VisaCurrency == 53)
|
|
|
- {
|
|
|
- c.RMBPrice = c.PayMoney * _TeamRate.RateC;
|
|
|
- c.DayRate = _TeamRate.RateC;
|
|
|
- }
|
|
|
- else if (grp_Visa1.VisaCurrency == 63)
|
|
|
- {
|
|
|
- c.RMBPrice = c.PayMoney * _TeamRate.RateT;
|
|
|
- c.DayRate = _TeamRate.RateT;
|
|
|
- }
|
|
|
- else if (grp_Visa1.VisaCurrency == 68)
|
|
|
- {
|
|
|
- c.RMBPrice = c.PayMoney * _TeamRate.RateBL;
|
|
|
- c.DayRate = _TeamRate.RateBL;
|
|
|
- }
|
|
|
- else if (grp_Visa1.VisaCurrency == 69)
|
|
|
- {
|
|
|
- c.RMBPrice = c.PayMoney * _TeamRate.RateHB;
|
|
|
- c.DayRate = _TeamRate.RateHB;
|
|
|
- }
|
|
|
- else if (grp_Visa1.VisaCurrency == 336)
|
|
|
- {
|
|
|
- c.RMBPrice = c.PayMoney * _TeamRate.RateFJD;
|
|
|
- c.DayRate = _TeamRate.RateFJD;
|
|
|
- }
|
|
|
- else if (grp_Visa1.VisaCurrency == 337)
|
|
|
- {
|
|
|
- c.RMBPrice = c.PayMoney * _TeamRate.RateTL;
|
|
|
- c.DayRate = _TeamRate.RateTL;
|
|
|
- }
|
|
|
- else if (grp_Visa1.VisaCurrency == 338)
|
|
|
+ Sys_SetData _SetData = _sqlSugar.Queryable<Sys_SetData>().First(a => a.IsDel == 0 && a.Id == c.PaymentCurrency);
|
|
|
+ if (_SetData!=null)
|
|
|
{
|
|
|
- c.RMBPrice = c.PayMoney * _TeamRate.RateRP;
|
|
|
- c.DayRate = _TeamRate.RateRP;
|
|
|
- }
|
|
|
- else if (grp_Visa1.VisaCurrency == 341)
|
|
|
- {
|
|
|
- c.RMBPrice = c.PayMoney * _TeamRate.RatePeso;
|
|
|
- c.DayRate = _TeamRate.RatePeso;
|
|
|
- }
|
|
|
- else if (grp_Visa1.VisaCurrency == 342)
|
|
|
- {
|
|
|
- c.RMBPrice = c.PayMoney * _TeamRate.RateMYR;
|
|
|
- c.DayRate = _TeamRate.RateMYR;
|
|
|
- }
|
|
|
- else if (grp_Visa1.VisaCurrency == 344)
|
|
|
- {
|
|
|
- c.RMBPrice = c.PayMoney * _TeamRate.RateCZK;
|
|
|
- c.DayRate = _TeamRate.RateCZK;
|
|
|
- }
|
|
|
- else if (grp_Visa1.VisaCurrency == 345)
|
|
|
- {
|
|
|
- c.RMBPrice = c.PayMoney * _TeamRate.RateMXN;
|
|
|
- c.DayRate = _TeamRate.RateMXN;
|
|
|
- }
|
|
|
- else if (grp_Visa1.VisaCurrency == 354)
|
|
|
- {
|
|
|
- c.RMBPrice = c.PayMoney * _TeamRate.RateMOP;
|
|
|
- c.DayRate = _TeamRate.RateMOP;
|
|
|
- }
|
|
|
- else if (grp_Visa1.VisaCurrency == 359)
|
|
|
- {
|
|
|
- c.RMBPrice = c.PayMoney * _TeamRate.RateARS;
|
|
|
- c.DayRate = _TeamRate.RateARS;
|
|
|
- }
|
|
|
- else if (grp_Visa1.VisaCurrency == 361)
|
|
|
- {
|
|
|
- c.RMBPrice = c.PayMoney * _TeamRate.RateHUF;
|
|
|
- c.DayRate = _TeamRate.RateHUF;
|
|
|
- }
|
|
|
- else if (grp_Visa1.VisaCurrency == 362)
|
|
|
- {
|
|
|
- c.RMBPrice = c.PayMoney * _TeamRate.RateRUB;
|
|
|
- c.DayRate = _TeamRate.RateRUB;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- c.DayRate = 1;
|
|
|
- c.RMBPrice = c.PayMoney;
|
|
|
+ currencyInfos = CommonFun.GetCurrencyChinaToList(_TeamRate.Remark);
|
|
|
+ CurrencyInfo CurrencyRate = currencyInfos.Where(a => a.CurrencyCode == _SetData.Name).First();
|
|
|
+ if (CurrencyRate!=null)
|
|
|
+ {
|
|
|
+ c.RMBPrice = c.PayMoney * Convert.ToDecimal(CurrencyRate.Rate);
|
|
|
+ c.DayRate = CurrencyRate.Rate;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- else
|
|
|
- {
|
|
|
- c.DayRate = 1;
|
|
|
- c.RMBPrice = c.PayMoney;
|
|
|
- }
|
|
|
- #endregion
|
|
|
+
|
|
|
if (dto.Status==1)//添加
|
|
|
{
|
|
|
Grp_VisaInfo grp_Visa =_sqlSugar.Queryable<Grp_VisaInfo>().First(a=>a.IsDel==0 && a.VisaCurrency==dto.VisaCurrency && a.VisaPrice==dto.VisaPrice && a.VisaClient==dto.VisaClient);
|
|
@@ -312,17 +203,6 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
id = await AddAsyncReturnId(grp_Visa1);
|
|
|
if (id!=0)
|
|
|
{
|
|
|
- c.PayMoney = dto.VisaPrice;
|
|
|
- c.PaymentCurrency = dto.VisaCurrency;
|
|
|
- c.Remark = dto.CRemark;
|
|
|
- c.PayPercentage = 100;
|
|
|
- c.CTable = 80;
|
|
|
- c.CId=id;
|
|
|
- c.IsAuditGM = 0;
|
|
|
- if (c.PayDId == 72)
|
|
|
- {
|
|
|
- c.IsPay = 1;
|
|
|
- }
|
|
|
int cId = await _sqlSugar.Insertable(c).ExecuteReturnIdentityAsync();
|
|
|
if (cId != 0)
|
|
|
{
|
|
@@ -359,11 +239,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
});
|
|
|
if (res)
|
|
|
{
|
|
|
- c.PayMoney = dto.VisaPrice;
|
|
|
- c.PaymentCurrency = dto.VisaCurrency;
|
|
|
- c.Remark = dto.CRemark;
|
|
|
- c.PayPercentage = 100;
|
|
|
- c.CTable = 80;
|
|
|
+
|
|
|
int CTable = await _sqlSugar.Updateable<Grp_CreditCardPayment>().Where(a => a.CId == grp_Visa1.Id && a.CTable==80).SetColumns(a => new Grp_CreditCardPayment
|
|
|
{
|
|
|
PayDId = dto.PayDId,
|