|
@@ -26,12 +26,12 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
{
|
|
|
private readonly IMapper _mapper;
|
|
|
|
|
|
- public VisaPriceRepository(SqlSugarClient sqlSugar,IMapper mapper)
|
|
|
+ public VisaPriceRepository(SqlSugarClient sqlSugar, IMapper mapper)
|
|
|
: base(sqlSugar)
|
|
|
{
|
|
|
- _mapper=mapper;
|
|
|
+ _mapper = mapper;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
|
|
|
/// <summary>
|
|
|
/// 根据diid查询签证费用列表
|
|
@@ -41,9 +41,9 @@ 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()))
|
|
|
+ if (dto.PortType == 0 || string.IsNullOrWhiteSpace(dto.PortType.ToString()))
|
|
|
{
|
|
|
- return result = new Result() { Code = -1, Msg = "请传入PortType参数,请求端口分类 1 Web 2 Android 3 IOS" };
|
|
|
+ return result = new Result() { Code = -1, Msg = "请传入PortType参数,请求端口分类 1 Web 2 Android 3 IOS" };
|
|
|
}
|
|
|
try
|
|
|
{
|
|
@@ -54,7 +54,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
{
|
|
|
sqlWhere += string.Format(@" And v.VisaClient like '%{0}%'", dto.VisaClient);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
sqlWhere += string.Format(@"And v.DIId={0} and v.isdel={1}", dto.DiID, 0);
|
|
|
string UserId = "";
|
|
|
List<Grp_GroupsTaskAssignment> gtaUIdList = _sqlSugar.Queryable<Grp_GroupsTaskAssignment>().Where(a => a.DIId == dto.DiID && a.IsDel == 0 && a.CTId == 80).ToList();
|
|
@@ -85,16 +85,16 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
#endregion
|
|
|
int startIndex = (dto.PageIndex - 1) * dto.PageSize + 1;
|
|
|
int endIndex = startIndex + dto.PageSize - 1;
|
|
|
- if (dto.PortType==1)
|
|
|
+ if (dto.PortType == 1)
|
|
|
{
|
|
|
//string sql = string.Format(@"select *,(select IsAuditGM from Grp_CreditCardPayment where CTable=80 and CId=v.Id and IsDel=0) IsAuditGM,
|
|
|
// (select Name from Sys_SetData where isdel=0 and v.VisaCurrency=Id) VisaCurrencyStr from
|
|
|
// Grp_VisaInfo v {0} order by CreateTime desc",sqlWhere);
|
|
|
|
|
|
- string sql = string.Format(@" Select v.*, c.IsAuditGM,c.IsPay,sd1.[Name] as VisaCurrencyStr
|
|
|
-From Grp_VisaInfo as v With(Nolock) Left Join Grp_CreditCardPayment as c With(Nolock) On v.Id = c.CId
|
|
|
-Left Join Sys_SetData as sd1 With(Nolock) On v.VisaCurrency = sd1.Id
|
|
|
-{0} And c.CTable = 80 And c.IsDel = 0 And sd1.IsDel = 0 ", sqlWhere);
|
|
|
+ string sql = string.Format(@" Select v.*, c.IsAuditGM,c.IsPay
|
|
|
+From Grp_VisaInfo as v With(Nolock) left Join Grp_CreditCardPayment as c With(Nolock) On v.Id = c.CId
|
|
|
+{0}
|
|
|
+ And c.CTable = 80 And c.IsDel = 0 ", sqlWhere);
|
|
|
|
|
|
List<VisaInfoView> infoViews = _sqlSugar.SqlQueryable<VisaInfoView>(sql).ToList();
|
|
|
var parseIntValue = 0;
|
|
@@ -108,8 +108,32 @@ Left Join Sys_SetData as sd1 With(Nolock) On v.VisaCurrency = sd1.Id
|
|
|
sql = string.Format("SELECT * FROM Crm_DeleClient cdc where id in ({0}) and IsDel = 0", strCrmIds);
|
|
|
clietArr = _sqlSugar.SqlQueryable<Crm_DeleClient>(sql).ToList();
|
|
|
}
|
|
|
+
|
|
|
+ Dictionary<int, string> dic_Currency = new Dictionary<int, string>();
|
|
|
+
|
|
|
foreach (VisaInfoView view in infoViews)
|
|
|
{
|
|
|
+ if (dic_Currency.ContainsKey(view.VisaCurrency))
|
|
|
+ {
|
|
|
+ view.VisaCurrencyStr = dic_Currency[view.VisaCurrency];
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ List<Sys_SetData> temp_sdList = Query<Sys_SetData>(s => s.Id == view.VisaCurrency).ToList();
|
|
|
+ if (temp_sdList.Count > 0)
|
|
|
+ {
|
|
|
+ view.VisaCurrencyStr = temp_sdList[0].Name;
|
|
|
+ dic_Currency.Add(view.VisaCurrency, temp_sdList[0].Name);
|
|
|
+
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ view.VisaCurrencyStr = "未知";
|
|
|
+ dic_Currency.Add(view.VisaCurrency, "未知");
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
if (view.IsAuditGM == 0) view.IsAuditGMStr = "未审核";
|
|
|
else if (view.IsAuditGM == 1) view.IsAuditGMStr = "已通过";
|
|
|
else if (view.IsAuditGM == 2) view.IsAuditGMStr = "未通过";
|
|
@@ -161,7 +185,7 @@ Left Join Sys_SetData as sd1 With(Nolock) On v.VisaCurrency = sd1.Id
|
|
|
}
|
|
|
return result = new Result() { Code = 0, Msg = "查询成功!", Data = infoViews };
|
|
|
}
|
|
|
- else if(dto.PortType==2 || dto.PortType==3)
|
|
|
+ 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
|
|
@@ -240,7 +264,7 @@ Left Join Sys_SetData as sd1 With(Nolock) On v.VisaCurrency = sd1.Id
|
|
|
Left Join Sys_SetData s On v.VisaCurrency = s.Id {0}
|
|
|
) temp", sqlWhere);
|
|
|
DataCount dataCount = _sqlSugar.SqlQueryable<DataCount>(CountSql).First();
|
|
|
- if (dataCount!=null)
|
|
|
+ if (dataCount != null)
|
|
|
{
|
|
|
int count = dataCount.Count;
|
|
|
float totalPage = (float)count / dto.PageSize;//总页数
|
|
@@ -274,8 +298,8 @@ Left Join Sys_SetData as sd1 With(Nolock) On v.VisaCurrency = sd1.Id
|
|
|
Result result = new Result() { Code = -2, Msg = "未知错误" };
|
|
|
try
|
|
|
{
|
|
|
- Grp_VisaInfo _VisaInfo = _sqlSugar.Queryable<Grp_VisaInfo>().First(a => a.Id == dto.Id && a.IsDel==0);
|
|
|
- Grp_CreditCardPayment _CreditCardPayment = _sqlSugar.Queryable<Grp_CreditCardPayment>().First(a=>a.CId==dto.Id && a.IsDel==0 && a.CTable==80);
|
|
|
+ Grp_VisaInfo _VisaInfo = _sqlSugar.Queryable<Grp_VisaInfo>().First(a => a.Id == dto.Id && a.IsDel == 0);
|
|
|
+ Grp_CreditCardPayment _CreditCardPayment = _sqlSugar.Queryable<Grp_CreditCardPayment>().First(a => a.CId == dto.Id && a.IsDel == 0 && a.CTable == 80);
|
|
|
var data = new
|
|
|
{
|
|
|
VisaInfo = _VisaInfo,
|
|
@@ -320,41 +344,41 @@ Left Join Sys_SetData as sd1 With(Nolock) On v.VisaCurrency = sd1.Id
|
|
|
if (_TeamRate != null)
|
|
|
{
|
|
|
Sys_SetData _SetData = _sqlSugar.Queryable<Sys_SetData>().First(a => a.IsDel == 0 && a.Id == c.PaymentCurrency);
|
|
|
- if (_SetData!=null)
|
|
|
+ if (_SetData != null)
|
|
|
{
|
|
|
currencyInfos = CommonFun.GetCurrencyChinaToList(_TeamRate.Remark);
|
|
|
CurrencyInfo CurrencyRate = currencyInfos.FirstOrDefault(a => a.CurrencyCode == _SetData.Name);
|
|
|
- if (CurrencyRate!=null)
|
|
|
+ if (CurrencyRate != null)
|
|
|
{
|
|
|
c.RMBPrice = c.PayMoney * Convert.ToDecimal(CurrencyRate.Rate);
|
|
|
c.DayRate = CurrencyRate.Rate;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- if (dto.Status==1)//添加
|
|
|
+
|
|
|
+ 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);
|
|
|
- if (grp_Visa!=null)
|
|
|
+ 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);
|
|
|
+ if (grp_Visa != null)
|
|
|
{
|
|
|
return result = new Result() { Code = -1, Msg = "该笔费用已存在,请勿重复添加!" };
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
id = await AddAsyncReturnId(grp_Visa1);
|
|
|
- if (id!=0)
|
|
|
+ if (id != 0)
|
|
|
{
|
|
|
c.CId = id;
|
|
|
int cId = await _sqlSugar.Insertable(c).ExecuteReturnIdentityAsync();
|
|
|
if (cId != 0)
|
|
|
{
|
|
|
- result = new Result() { Code = 0, Msg = "添加成功!" };
|
|
|
+ result = new Result() { Code = 0, Msg = "添加成功!" };
|
|
|
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
RollbackTran();
|
|
|
- result = new Result() { Code = -1, Msg = "添加失败!" };
|
|
|
+ result = new Result() { Code = -1, Msg = "添加失败!" };
|
|
|
}
|
|
|
}
|
|
|
else
|
|
@@ -363,11 +387,11 @@ Left Join Sys_SetData as sd1 With(Nolock) On v.VisaCurrency = sd1.Id
|
|
|
result = new Result() { Code = -1, Msg = "添加失败,请稍后重试!" };
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
- else if (dto.Status==2)//修改
|
|
|
+ else if (dto.Status == 2)//修改
|
|
|
{
|
|
|
-
|
|
|
+
|
|
|
bool res = await UpdateAsync(a => a.Id == dto.Id, a => new Grp_VisaInfo
|
|
|
{
|
|
|
VisaClient = grp_Visa1.VisaClient,
|
|
@@ -382,7 +406,7 @@ Left Join Sys_SetData as sd1 With(Nolock) On v.VisaCurrency = sd1.Id
|
|
|
});
|
|
|
if (res)
|
|
|
{
|
|
|
- int CTable = await _sqlSugar.Updateable<Grp_CreditCardPayment>().Where(a => a.CId == grp_Visa1.Id && a.CTable==80).SetColumns(a => new Grp_CreditCardPayment
|
|
|
+ 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,
|
|
|
PayMoney = c.PayMoney,
|
|
@@ -416,7 +440,7 @@ Left Join Sys_SetData as sd1 With(Nolock) On v.VisaCurrency = sd1.Id
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
- result = new Result() { Code = -2, Msg = ex.Message };
|
|
|
+ result = new Result() { Code = -2, Msg = ex.Message };
|
|
|
}
|
|
|
return result;
|
|
|
}
|