|
@@ -27,6 +27,7 @@ using System.Net.Http;
|
|
|
using Google.Protobuf;
|
|
|
using NPOI.SS.Formula.Functions;
|
|
|
using System.Globalization;
|
|
|
+using NPOI.POIFS.Properties;
|
|
|
|
|
|
namespace OASystem.API.Controllers
|
|
|
{
|
|
@@ -1761,8 +1762,15 @@ Where c.CTable = 1015 And c.IsPay = 1 And f.IsDel = 0 And c.IsDel = 0 And f.DiId
|
|
|
#endregion
|
|
|
try
|
|
|
{
|
|
|
- tree_Fin_DailyFeePaymentResult dailyResult = PayRequest_DailyByDateRange(dto.beginDt, dto.endDt);
|
|
|
- tree_Group_DailyFeePaymentResult groupResult = PayRequest_PaymentByDateRange(dto.beginDt, dto.endDt);
|
|
|
+ PaymentRequestCheckedView checkedView = new PaymentRequestCheckedView();
|
|
|
+ var checkedStr = await RedisRepository.RedisFactory.CreateRedisRepository().StringGetAsync<string>("paymentRequestCheckedData");
|
|
|
+ if (checkedStr != null)
|
|
|
+ {
|
|
|
+ checkedView = JsonConvert.DeserializeObject<PaymentRequestCheckedView>(checkedStr.ToString());
|
|
|
+ }
|
|
|
+
|
|
|
+ tree_Fin_DailyFeePaymentResult dailyResult = PayRequest_DailyByDateRange(dto.Status, checkedView.DailyPaymentIds, dto.beginDt, dto.endDt);
|
|
|
+ tree_Group_DailyFeePaymentResult groupResult = PayRequest_GroupPaymentByDateRange( dto.Status,checkedView.GroupIds, dto.beginDt, dto.endDt);
|
|
|
|
|
|
return Ok(JsonView(true, "获取成功", new { daily = dailyResult, group = groupResult }));
|
|
|
}
|
|
@@ -1774,21 +1782,34 @@ Where c.CTable = 1015 And c.IsPay = 1 And f.IsDel = 0 And c.IsDel = 0 And f.DiId
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
- /// 付款申请(日付申请相关)
|
|
|
+ /// 付款申请(团组费用申请相关)
|
|
|
/// 查询 根据日期范围
|
|
|
/// </summary>
|
|
|
- /// <param name="dto"></param>
|
|
|
+ /// <param name="_groupIds"></param>
|
|
|
+ /// <param name="beginDt"></param>
|
|
|
+ /// <param name="endDt"></param>
|
|
|
/// <returns></returns>
|
|
|
- private tree_Group_DailyFeePaymentResult PayRequest_PaymentByDateRange(string beginDt, string endDt)
|
|
|
+ private tree_Group_DailyFeePaymentResult PayRequest_GroupPaymentByDateRange(int status,List<int> _groupIds, string beginDt, string endDt)
|
|
|
{
|
|
|
tree_Group_DailyFeePaymentResult _DailyFeePaymentResult = new tree_Group_DailyFeePaymentResult();
|
|
|
List<tree_Group_DailyFeePaymentPageListView> dataList = new List<tree_Group_DailyFeePaymentPageListView>();
|
|
|
#region sql条件处理
|
|
|
- string sqlWhere = string.Format(@"And (AuditGMDate Between '{0} 00:00:00' And '{1} 23:59:59') ", beginDt, endDt);
|
|
|
+ string sqlWhere = string.Format(@" And (AuditGMDate Between '{0} 00:00:00' And '{1} 23:59:59') ", beginDt, endDt);
|
|
|
+
|
|
|
+ if (status == 2)
|
|
|
+ {
|
|
|
+ if (_groupIds.Count < 1)
|
|
|
+ {
|
|
|
+ return _DailyFeePaymentResult;
|
|
|
+ }
|
|
|
+ sqlWhere += string.Format(@" And Id In ({0})", string.Join(",", _groupIds));
|
|
|
+ }
|
|
|
+
|
|
|
string sql_1 = string.Format(@"Select * From Grp_CreditCardPayment Where IsDel = 0 And IsPay = 0 And IsAuditGM = 1 {0}", sqlWhere);
|
|
|
#endregion
|
|
|
|
|
|
var _paymentDatas = _sqlSugar.SqlQueryable<Grp_CreditCardPayment>(sql_1).ToList();//付款信息
|
|
|
+
|
|
|
_DailyFeePaymentResult.gz = _paymentDatas.Where(it => it.OrbitalPrivateTransfer == 0).Sum(it => ((it.PayMoney * it.DayRate) / 100) * it.PayPercentage); //公转
|
|
|
_DailyFeePaymentResult.sz = _paymentDatas.Where(it => it.OrbitalPrivateTransfer == 1).Sum(it => ((it.PayMoney * it.DayRate) / 100) * it.PayPercentage); ; //私转
|
|
|
List<int> groupIds = _paymentDatas.Select(it => it.DIId).Distinct().ToList();
|
|
@@ -1867,21 +1888,22 @@ Where c.CTable = 1015 And c.IsPay = 1 And f.IsDel = 0 And c.IsDel = 0 And f.DiId
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
childList.Add(new Group_DailyFeePaymentContentInfolView()
|
|
|
{
|
|
|
+ IsChecked = _groupIds.Contains(payInfo.Id),
|
|
|
Id = payInfo.Id,
|
|
|
Payee = payInfo.Payee,
|
|
|
RowNumber = rouNumber,
|
|
|
Applicant = userDatas.Find(it => it.Id == payInfo.CreateUserId)?.CnName ?? "",
|
|
|
PayType = setDatas.Find(it => it.Id == payInfo.PayDId)?.Name ?? "",
|
|
|
+ TransferMark = payInfo.OrbitalPrivateTransfer == 0 ? "公转": payInfo.OrbitalPrivateTransfer == 1 ? "私转" :"-",
|
|
|
PriceName = priName,
|
|
|
ModuleName = setDatas.Find(it => it.Id == payInfo.CTable)?.Name ?? "",
|
|
|
PayCurrCode = setDatas.Find(it => it.Id == payInfo.PaymentCurrency)?.Name ?? "",
|
|
|
PaymentAmount = payInfo.PayMoney,
|
|
|
PayRate = payInfo.DayRate,
|
|
|
CNYSubTotalAmount = ((payInfo.DayRate * payInfo.PayMoney) / 100) * payInfo.PayPercentage //此次付款金额
|
|
|
- }) ;
|
|
|
+ });
|
|
|
rouNumber++;
|
|
|
}
|
|
|
|
|
@@ -1902,13 +1924,25 @@ Where c.CTable = 1015 And c.IsPay = 1 And f.IsDel = 0 And c.IsDel = 0 And f.DiId
|
|
|
/// 付款申请(日付申请相关)
|
|
|
/// 查询 根据日期范围
|
|
|
/// </summary>
|
|
|
- /// <param name="dto"></param>
|
|
|
+ /// <param name="_dailyIds"></param>
|
|
|
+ /// <param name="beginDt"></param>
|
|
|
+ /// <param name="endDt"></param>
|
|
|
/// <returns></returns>
|
|
|
- private tree_Fin_DailyFeePaymentResult PayRequest_DailyByDateRange(string beginDt, string endDt)
|
|
|
+ private tree_Fin_DailyFeePaymentResult PayRequest_DailyByDateRange(int status, List<int> _dailyIds, string beginDt, string endDt)
|
|
|
{
|
|
|
#region sql条件处理
|
|
|
string sqlWhere = string.Format(@" And dfp.CreateTime between '{0} 00:00:00' And '{1} 23:59:59' ", beginDt, endDt);
|
|
|
|
|
|
+ if (status == 2)
|
|
|
+ {
|
|
|
+ if (_dailyIds.Count < 1)
|
|
|
+ {
|
|
|
+ return new tree_Fin_DailyFeePaymentResult();
|
|
|
+ }
|
|
|
+
|
|
|
+ sqlWhere += string.Format(@" And dfp.Id In({0}) ", string.Join(",", _dailyIds));
|
|
|
+ }
|
|
|
+
|
|
|
string sql_1 = string.Format(@"Select * From (
|
|
|
Select row_number() over (order by dfp.Id Desc) as RowNumber,
|
|
|
dfp.Id,dfp.CompanyId,c.CompanyName,dfp.Instructions,dfp.SumPrice,
|
|
@@ -1927,6 +1961,8 @@ Where c.CTable = 1015 And c.IsPay = 1 And f.IsDel = 0 And c.IsDel = 0 And f.DiId
|
|
|
|
|
|
foreach (var item in DailyFeePaymentData)
|
|
|
{
|
|
|
+ item.IsChecked = _dailyIds.Contains(item.Id);
|
|
|
+
|
|
|
if (dic_setData.ContainsKey(item.PriceTypeId))
|
|
|
{
|
|
|
item.priceTypeStr = dic_setData[item.PriceTypeId];
|
|
@@ -1977,6 +2013,250 @@ Where c.CTable = 1015 And c.IsPay = 1 And f.IsDel = 0 And c.IsDel = 0 And f.DiId
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 付款申请
|
|
|
+ /// 团组相关费用 选中状态变更
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost]
|
|
|
+ [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
|
|
|
+ public async Task<IActionResult> PostPayRequestCheckedChange(PayRequestCheckedChangeDto dto)
|
|
|
+ {
|
|
|
+ #region 验证
|
|
|
+
|
|
|
+ if (dto.Type < 1 || dto.Type > 2)
|
|
|
+ {
|
|
|
+ return Ok(JsonView(false, "请传入有效的Type参数! 1 checked 2 清除上次勾选"));
|
|
|
+ }
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ try
|
|
|
+ {
|
|
|
+ PaymentRequestCheckedView requestCheckedView =new PaymentRequestCheckedView();
|
|
|
+ List<int> groupIds = new List<int>();
|
|
|
+ List<int> dailyPaymentIds = new List<int>();
|
|
|
+
|
|
|
+ #region 参数处理
|
|
|
+ if (!string.IsNullOrEmpty(dto.GroupIds))
|
|
|
+ {
|
|
|
+ if (dto.GroupIds.Contains(","))
|
|
|
+ {
|
|
|
+ groupIds = dto.GroupIds.Split(',').Select(int.Parse).ToList();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ groupIds.Add(int.Parse(dto.GroupIds));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!string.IsNullOrEmpty(dto.DailyPaymentIds))
|
|
|
+ {
|
|
|
+ if (dto.DailyPaymentIds.Contains(","))
|
|
|
+ {
|
|
|
+ dailyPaymentIds = dto.DailyPaymentIds.Split(',').Select(int.Parse).ToList();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ dailyPaymentIds.Add(int.Parse(dto.DailyPaymentIds));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ #endregion
|
|
|
+ requestCheckedView.GroupIds = groupIds;
|
|
|
+ requestCheckedView.DailyPaymentIds = dailyPaymentIds;
|
|
|
+ if (dto.Type == 1)
|
|
|
+ {
|
|
|
+ var status = await RedisRepository.RedisFactory.CreateRedisRepository().StringSetAsync<string>("paymentRequestCheckedData", JsonConvert.SerializeObject(requestCheckedView));
|
|
|
+ if (status)
|
|
|
+ {
|
|
|
+ return Ok(JsonView(true, "操作成功!"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if(dto.Type == 2)
|
|
|
+ {
|
|
|
+ var status = await RedisRepository.RedisFactory.CreateRedisRepository().KeyDeleteAsync("paymentRequestCheckedData" );
|
|
|
+ if (status)
|
|
|
+ {
|
|
|
+ return Ok(JsonView(true, "操作成功!"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return Ok(JsonView(false, "操作失败!"));
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ return Ok(JsonView(false, ex.Message));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 付款申请
|
|
|
+ /// 团组相关费用 汇率变更
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost]
|
|
|
+ [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
|
|
|
+ public async Task<IActionResult> PostPayRequestRateChange(PayRequestRateChangeDto dto)
|
|
|
+ {
|
|
|
+ #region 验证
|
|
|
+ DateTime beginDt, endDt;
|
|
|
+ string format = "yyyy-MM-dd";
|
|
|
+ if (!DateTime.TryParseExact(dto.beginDt, format, CultureInfo.InvariantCulture, DateTimeStyles.None, out beginDt))
|
|
|
+ {
|
|
|
+ return Ok(JsonView(false, "开始日期格式不正确!正确格式:yyyy-MM-dd"));
|
|
|
+ }
|
|
|
+ if (!DateTime.TryParseExact(dto.endDt, format, CultureInfo.InvariantCulture, DateTimeStyles.None, out endDt))
|
|
|
+ {
|
|
|
+ return Ok(JsonView(false, "结束日期格式不正确!正确格式:yyyy-MM-dd"));
|
|
|
+ }
|
|
|
+
|
|
|
+ if (dto.UserId < 1)
|
|
|
+ {
|
|
|
+ return Ok(JsonView(false, "请传入有效的UserId参数!"));
|
|
|
+ }
|
|
|
+
|
|
|
+ if (dto.Id < 1)
|
|
|
+ {
|
|
|
+ return Ok(JsonView(false, "请传入有效的Id参数!"));
|
|
|
+ }
|
|
|
+
|
|
|
+ if (dto.Rate <= 0)
|
|
|
+ {
|
|
|
+ return Ok(JsonView(false, "请传入有效的Rate参数!"));
|
|
|
+ }
|
|
|
+ #endregion
|
|
|
+ try
|
|
|
+ {
|
|
|
+ var status = _sqlSugar.Updateable<Grp_CreditCardPayment>()
|
|
|
+ .SetColumns(it => it.DayRate == dto.Rate)
|
|
|
+ .Where(it => it.Id == dto.Id)
|
|
|
+ .ExecuteCommand();
|
|
|
+ if (status > 0)
|
|
|
+ {
|
|
|
+ PaymentRequestCheckedView checkedView = new PaymentRequestCheckedView();
|
|
|
+ var checkedStr = await RedisRepository.RedisFactory.CreateRedisRepository().StringGetAsync<string>("paymentRequestCheckedData");
|
|
|
+ if (checkedStr != null)
|
|
|
+ {
|
|
|
+ checkedView = JsonConvert.DeserializeObject<PaymentRequestCheckedView>(checkedStr.ToString());
|
|
|
+ }
|
|
|
+
|
|
|
+ tree_Fin_DailyFeePaymentResult dailyResult = PayRequest_DailyByDateRange(1, checkedView.DailyPaymentIds, dto.beginDt, dto.endDt);
|
|
|
+ tree_Group_DailyFeePaymentResult groupResult = PayRequest_GroupPaymentByDateRange(1, checkedView.GroupIds, dto.beginDt, dto.endDt);
|
|
|
+
|
|
|
+ decimal _gz = dailyResult.gz + groupResult.gz;
|
|
|
+ decimal _sz = dailyResult.sz + groupResult.sz;
|
|
|
+
|
|
|
+ return Ok(JsonView(true, "获取成功", new { gz = dailyResult, sz = groupResult }));
|
|
|
+ }
|
|
|
+
|
|
|
+ return Ok(JsonView(false, "该项汇率修改失败!"));
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ return Ok(JsonView(false, ex.Message));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 付款申请
|
|
|
+ /// 团组,日付相关费用 付款状态变更
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost]
|
|
|
+ [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
|
|
|
+ public async Task<IActionResult> PostPayRequestPayChange(PayRequestPayChangeDto dto)
|
|
|
+ {
|
|
|
+ if (dto.UserId < 1)
|
|
|
+ {
|
|
|
+ return Ok(JsonView(false, "请传入有效的UserId参数!"));
|
|
|
+ }
|
|
|
+
|
|
|
+ //if (string.IsNullOrEmpty(dto.GroupIds))
|
|
|
+ //{
|
|
|
+ // return Ok(JsonView(false, "请传入有效的GroupIds参数!"));
|
|
|
+ //}
|
|
|
+
|
|
|
+ //if (string.IsNullOrEmpty(dto.DailyPaymentIds))
|
|
|
+ //{
|
|
|
+ // return Ok(JsonView(false, "请传入有效的DailyPaymentIds参数!"));
|
|
|
+ //}
|
|
|
+
|
|
|
+ try
|
|
|
+ {
|
|
|
+ List<int> groupIds = new List<int>();
|
|
|
+ List<int> dailyPaymentIds = new List<int>();
|
|
|
+
|
|
|
+ #region 参数处理
|
|
|
+ if (!string.IsNullOrEmpty(dto.GroupIds))
|
|
|
+ {
|
|
|
+ if (dto.GroupIds.Contains(","))
|
|
|
+ {
|
|
|
+ groupIds = dto.GroupIds.Split(',').Select(int.Parse).ToList();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ groupIds.Add(int.Parse(dto.GroupIds));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!string.IsNullOrEmpty(dto.DailyPaymentIds))
|
|
|
+ {
|
|
|
+ if (dto.DailyPaymentIds.Contains(","))
|
|
|
+ {
|
|
|
+ dailyPaymentIds = dto.DailyPaymentIds.Split(',').Select(int.Parse).ToList();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ dailyPaymentIds.Add(int.Parse(dto.DailyPaymentIds));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ bool changeStatus = false;
|
|
|
+ _sqlSugar.BeginTran();
|
|
|
+
|
|
|
+ if (groupIds.Count > 0)
|
|
|
+ {
|
|
|
+ var groupStatus = _sqlSugar.Updateable<Grp_CreditCardPayment>()
|
|
|
+ .SetColumns(it => it.IsPay == 1)
|
|
|
+ .Where(it => groupIds.Contains(it.Id))
|
|
|
+ .ExecuteCommand();
|
|
|
+ if (groupStatus > 0)
|
|
|
+ {
|
|
|
+ changeStatus = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (dailyPaymentIds.Count > 0)
|
|
|
+ {
|
|
|
+ var dailyPaymentStatus = _sqlSugar.Updateable<Fin_DailyFeePayment>()
|
|
|
+ .SetColumns(it => it.IsPay == 1)
|
|
|
+ .Where(it => dailyPaymentIds.Contains(it.Id))
|
|
|
+ .ExecuteCommand();
|
|
|
+ if (dailyPaymentStatus > 0)
|
|
|
+ {
|
|
|
+ changeStatus = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (changeStatus)
|
|
|
+ {
|
|
|
+ _sqlSugar.CommitTran();
|
|
|
+ return Ok(JsonView(true, "操作成功!"));
|
|
|
+ }
|
|
|
+ _sqlSugar.RollbackTran();
|
|
|
+ return Ok(JsonView(false, "付款状态修改失败!"));
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ _sqlSugar.RollbackTran();
|
|
|
+ return Ok(JsonView(false, ex.Message));
|
|
|
+ }
|
|
|
+ }
|
|
|
#endregion
|
|
|
|
|
|
#region 超支费用
|