|
@@ -1823,5 +1823,351 @@ namespace OASystem.API.Controllers
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
+
|
|
|
+ #region 超支费用
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 超支费用
|
|
|
+ /// 1增、2改、3删
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost]
|
|
|
+ [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
|
|
|
+ public async Task<IActionResult> PostGroupExtraCost_Operator(Fin_GroupExtraCostDto_OP dto)
|
|
|
+ {
|
|
|
+ #region 验证
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ Fin_GroupExtraCost _entity = new Fin_GroupExtraCost();
|
|
|
+ _entity.DiId = dto.diId;
|
|
|
+ _entity.PriceName = dto.priceName;
|
|
|
+ _entity.Price = dto.price;
|
|
|
+ _entity.PriceCurrency = dto.currency;
|
|
|
+ _entity.PriceType = dto.priceType;
|
|
|
+ _entity.Coefficient = dto.coefficient;
|
|
|
+ _entity.PriceDetailType = dto.priceDetailType;
|
|
|
+ _entity.FilePath = dto.filePath;
|
|
|
+ _entity.Remark = dto.remark;
|
|
|
+
|
|
|
+ _daiRep.BeginTran();
|
|
|
+ if (dto.editType == 1)
|
|
|
+ {
|
|
|
+ _entity.CreateUserId = dto.createUser;
|
|
|
+ _entity.CreateTime = DateTime.Now;
|
|
|
+ _entity.IsDel = 0;
|
|
|
+
|
|
|
+ int returnId = await _daiRep.AddAsyncReturnId<Fin_GroupExtraCost>(_entity);
|
|
|
+ if (returnId > 0)
|
|
|
+ {
|
|
|
+ dto.Id = returnId;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (dto.editType == 2)
|
|
|
+ {
|
|
|
+ bool res = await _daiRep.UpdateAsync<Fin_GroupExtraCost>(s => s.Id == dto.Id, s => new Fin_GroupExtraCost
|
|
|
+ {
|
|
|
+ PriceName = dto.priceName,
|
|
|
+ Price = dto.price,
|
|
|
+ PriceCurrency = dto.currency,
|
|
|
+ PriceType = dto.priceType,
|
|
|
+ PriceDetailType = dto.priceDetailType,
|
|
|
+ Coefficient = dto.coefficient,
|
|
|
+ FilePath = dto.filePath,
|
|
|
+ Remark = dto.remark
|
|
|
+ });
|
|
|
+ if (!res)
|
|
|
+ {
|
|
|
+ _daiRep.RollbackTran();
|
|
|
+ return Ok(JsonView(false, "2操作失败!"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (dto.editType == 3)
|
|
|
+ {
|
|
|
+ string delTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm");
|
|
|
+ bool res = await _daiRep.UpdateAsync<Fin_GroupExtraCost>(s => s.Id == dto.Id, s => new Fin_GroupExtraCost
|
|
|
+ {
|
|
|
+ IsDel = 1,
|
|
|
+ DeleteTime = delTime,
|
|
|
+ DeleteUserId = dto.createUser
|
|
|
+ });
|
|
|
+ if (!res)
|
|
|
+ {
|
|
|
+ _daiRep.RollbackTran();
|
|
|
+ return Ok(JsonView(false, "3操作失败!"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ _daiRep.RollbackTran();
|
|
|
+ return Ok(JsonView(false, "未知的editType"));
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!extraCost_editCreditCardPayment(dto))
|
|
|
+ {
|
|
|
+ return Ok(JsonView(false, "ccp操作失败"));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ _daiRep.CommitTran();
|
|
|
+ return Ok(JsonView(false, "操作成功"));
|
|
|
+ }
|
|
|
+
|
|
|
+ private bool extraCost_editCreditCardPayment(Fin_GroupExtraCostDto_OP costDto)
|
|
|
+ {
|
|
|
+ //设置团组汇率
|
|
|
+ decimal dcm_dayrate = 1M;
|
|
|
+ decimal dcm_rmbPrice = costDto.price;
|
|
|
+ int ispay = costDto.payType == 72 ? 1 : 0;
|
|
|
+
|
|
|
+ if (costDto.costSign != 3)
|
|
|
+ {
|
|
|
+ Grp_TeamRate tr = _daiRep.Query<Grp_TeamRate>(s => s.DiId == costDto.diId && s.CTable == 1015).First();
|
|
|
+
|
|
|
+ if (tr != null)
|
|
|
+ {
|
|
|
+ if (costDto.currency == 49)
|
|
|
+ {
|
|
|
+ dcm_dayrate = tr.RateU;
|
|
|
+ dcm_rmbPrice = dcm_rmbPrice * tr.RateU;
|
|
|
+ }
|
|
|
+ else if (costDto.currency == 51)
|
|
|
+ {
|
|
|
+ dcm_dayrate = tr.RateE;
|
|
|
+ dcm_rmbPrice = dcm_rmbPrice * tr.RateE;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ Grp_CreditCardPayment ccp = _daiRep.Query<Grp_CreditCardPayment>(s => s.CId == costDto.Id && s.CTable == 1015).First();
|
|
|
+ if (ccp == null)
|
|
|
+ {
|
|
|
+ ccp = new Grp_CreditCardPayment();
|
|
|
+
|
|
|
+ ccp.PayDId = costDto.payType;// dto
|
|
|
+ ccp.ConsumptionPatterns = "";
|
|
|
+ ccp.ConsumptionDate = "";
|
|
|
+ ccp.CTDId = costDto.payCardId;// dto
|
|
|
+ ccp.BankNo = "";
|
|
|
+
|
|
|
+ ccp.CardholderName = "";
|
|
|
+ ccp.PayMoney = costDto.price;// dto
|
|
|
+ ccp.PaymentCurrency = costDto.currency;// dto
|
|
|
+ ccp.CompanyBankNo = "";
|
|
|
+ ccp.OtherBankName = "";
|
|
|
+
|
|
|
+ ccp.OtherSideNo = "";
|
|
|
+ ccp.OtherSideName = "";
|
|
|
+ ccp.Remark = "";
|
|
|
+ ccp.CreateUserId = costDto.createUser;
|
|
|
+ ccp.CreateTime = DateTime.Now;
|
|
|
+
|
|
|
+ ccp.MFOperator = 0;
|
|
|
+ ccp.MFOperatorDate = "";
|
|
|
+ ccp.IsAuditDM = 0;
|
|
|
+ ccp.AuditDMOperate = 0;
|
|
|
+ ccp.AuditDMDate = "";
|
|
|
+
|
|
|
+ ccp.IsAuditMF = 0;
|
|
|
+ ccp.AuditMFOperate = 0;
|
|
|
+ ccp.AuditMFDate = "";
|
|
|
+ ccp.IsAuditGM = 0;
|
|
|
+ ccp.AuditGMOperate = 0;
|
|
|
+
|
|
|
+ ccp.AuditGMDate = "";
|
|
|
+ ccp.IsPay = ispay; // upd
|
|
|
+ ccp.DIId = costDto.diId;// dto
|
|
|
+ ccp.CId = costDto.Id;// dto
|
|
|
+ ccp.CTable = 1015; //超支费用指向id
|
|
|
+
|
|
|
+ ccp.IsDel = 0;
|
|
|
+ ccp.PayPercentage = 100M;
|
|
|
+ ccp.PayThenMoney = 0M;
|
|
|
+ ccp.PayPercentageOld = 100M;
|
|
|
+ ccp.PayThenMoneyOld = 0M;
|
|
|
+
|
|
|
+ ccp.UpdateDate = "";
|
|
|
+ ccp.Payee = costDto.payee;// dto
|
|
|
+ ccp.OrbitalPrivateTransfer = costDto.costSign;// dto
|
|
|
+ ccp.ExceedBudget = 0;
|
|
|
+ ccp.DayRate = dcm_dayrate; //upd
|
|
|
+
|
|
|
+ ccp.RMBPrice = dcm_rmbPrice; //upd
|
|
|
+
|
|
|
+ int ccpInsertId = _daiRep.AddReturnId<Grp_CreditCardPayment>(ccp);
|
|
|
+ if (ccpInsertId > 0)
|
|
|
+ {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if (costDto.editType == 2)
|
|
|
+ {
|
|
|
+ bool res = _daiRep.Update<Grp_CreditCardPayment>(s => s.Id == ccp.Id, s => new Grp_CreditCardPayment
|
|
|
+ {
|
|
|
+ PayDId = costDto.payType,
|
|
|
+ CTDId = costDto.payCardId,
|
|
|
+ PayMoney = costDto.price,
|
|
|
+ PaymentCurrency = costDto.currency,
|
|
|
+ IsPay = ispay,
|
|
|
+
|
|
|
+ Payee = costDto.payee,
|
|
|
+ OrbitalPrivateTransfer = costDto.costSign,
|
|
|
+ DayRate = dcm_dayrate,
|
|
|
+ RMBPrice = dcm_rmbPrice
|
|
|
+ });
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ else if (costDto.editType == 3)
|
|
|
+ {
|
|
|
+ string delTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm");
|
|
|
+ bool res2 = _daiRep.Update<Grp_CreditCardPayment>(s => s.Id == ccp.Id, s => new Grp_CreditCardPayment
|
|
|
+ {
|
|
|
+ IsDel = 1,
|
|
|
+ DeleteTime = delTime,
|
|
|
+ DeleteUserId = costDto.createUser
|
|
|
+ });
|
|
|
+ return res2;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 超支费用
|
|
|
+ /// 列表查询
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost]
|
|
|
+ [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
|
|
|
+ public async Task<IActionResult> PostGroupExtraCost_Search(Fin_GroupExtraCostDto_Search dto)
|
|
|
+ {
|
|
|
+ string sqlWhere = string.Format(@" And f.DiId = {0} ", dto.diId);
|
|
|
+ int startIndex = (dto.PageIndex - 1) * dto.PageSize + 1;
|
|
|
+ int endIndex = startIndex + dto.PageSize - 1;
|
|
|
+ string sql_data = string.Format(@"Select * From (
|
|
|
+ Select row_number() over (order by f.Id Desc) as RowNumber,f.Id,f.DiId,
|
|
|
+ f.PriceName,f.Price,f.FilePath,f.CreateUserId,f.CreateTime,c.IsAuditGM
|
|
|
+ From Fin_GroupExtraCost f
|
|
|
+ Inner Join Grp_CreditCardPayment c On f.Id = c.CId
|
|
|
+ Left Join Sys_Users u On f.CreateUserId = u.Id
|
|
|
+ Where f.IsDel=0 And c.CTable = 1015 {0}
|
|
|
+ ) temp Where RowNumber Between {1} and {2}", sqlWhere, startIndex, endIndex);
|
|
|
+ string sql_count = string.Format(@"Select Count(1) as DataCount From (
|
|
|
+ Select row_number() over (order by f.Id Desc) as RowNumber,f.Id,f.DiId,
|
|
|
+ f.PriceName,f.PriceType,f.Price,f.FilePath,f.CreateUserId,f.CreateTime,c.IsAuditGM
|
|
|
+ From Fin_GroupExtraCost f
|
|
|
+ Inner Join Grp_CreditCardPayment c On f.Id = c.CId
|
|
|
+ Left Join Sys_Users u On f.CreateUserId = u.Id
|
|
|
+ Where f.IsDel=0 And c.CTable = 1015 {0}
|
|
|
+ ) temp ", sqlWhere);
|
|
|
+ if (dto.PortType == 1 || dto.PortType == 2 || dto.PortType == 3) //web
|
|
|
+ {
|
|
|
+ //Fin_DailyFeePaymentPageCount
|
|
|
+ var count = await _sqlSugar.SqlQueryable<Fin_GroupExtraCostViewDataCount>(sql_count).FirstAsync();
|
|
|
+ List<Fin_GroupExtraCostView> dataList = await _sqlSugar.SqlQueryable<Fin_GroupExtraCostView>(sql_data).ToListAsync();
|
|
|
+
|
|
|
+ Dictionary<int, string> dic_setData = new Dictionary<int, string>();
|
|
|
+ Dictionary<int, string> dic_user = new Dictionary<int, string>();
|
|
|
+
|
|
|
+ foreach (var item in dataList)
|
|
|
+ {
|
|
|
+ //费用详细类型
|
|
|
+ if (dic_setData.ContainsKey(item.PriceType))
|
|
|
+ {
|
|
|
+ item.PriceTypeStr = dic_setData[item.PriceType];
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ Sys_SetData sd_priceTypeDetail = _daiRep.Query<Sys_SetData>(s => s.Id == item.PriceType).First();
|
|
|
+ if (sd_priceTypeDetail != null)
|
|
|
+ {
|
|
|
+ string tempName = sd_priceTypeDetail.Name.Replace("n", "");
|
|
|
+ item.PriceTypeStr = tempName;
|
|
|
+ dic_setData.Add(item.PriceType, tempName);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //系统用户
|
|
|
+ if (dic_user.ContainsKey(item.CreateUserId))
|
|
|
+ {
|
|
|
+ item.CreateUserIdStr = dic_setData[item.CreateUserId];
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ Sys_Users users = _daiRep.Query<Sys_Users>(s => s.Id == item.CreateUserId).First();
|
|
|
+ if (users != null)
|
|
|
+ {
|
|
|
+ item.CreateUserIdStr = users.CnName;
|
|
|
+ dic_setData.Add(item.CreateUserId, users.CnName);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ switch (item.IsAuditGM)
|
|
|
+ {
|
|
|
+ case 0: item.IsAuditGMStr = "未审核"; break;
|
|
|
+ case 1: item.IsAuditGMStr = "已通过"; break;
|
|
|
+ case 2: item.IsAuditGMStr = "未通过"; break;
|
|
|
+ default: item.IsAuditGMStr = "未知状态"; break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ var result = new ListViewBase<Fin_GroupExtraCostView>
|
|
|
+ {
|
|
|
+ CurrPageIndex = dto.PageIndex,
|
|
|
+ CurrPageSize = dto.PageSize,
|
|
|
+ DataCount = count.DataCount,
|
|
|
+ DataList = dataList
|
|
|
+ };
|
|
|
+
|
|
|
+ return Ok(JsonView(true, "查询成功", result));
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ return Ok(JsonView(false, "查询成功"));
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 超支费用
|
|
|
+ /// 数据集合配置
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost]
|
|
|
+ [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
|
|
|
+ public async Task<IActionResult> PostGroupExtraCost_ListDataInit(Fin_GroupExtraCostDto_DataListInit dto)
|
|
|
+ {
|
|
|
+ //支付方式
|
|
|
+ List<Sys_SetData> Payment = _sqlSugar.Queryable<Sys_SetData>().Where(a => a.STid == 14 && a.IsDel == 0).ToList();
|
|
|
+ List<SetDataInfoView> _Payment = _mapper.Map<List<SetDataInfoView>>(Payment);
|
|
|
+
|
|
|
+ //超支费用类型
|
|
|
+ List<Sys_SetData> PriceType = _sqlSugar.Queryable<Sys_SetData>().Where(a => a.STid == 79 && a.IsDel == 0).ToList();
|
|
|
+ List<SetDataInfoView> _PriceType = _mapper.Map<List<SetDataInfoView>>(PriceType);
|
|
|
+
|
|
|
+ //超支费用详细类型
|
|
|
+ List<Sys_SetData> PriceDetailType = _sqlSugar.Queryable<Sys_SetData>().Where(a => a.STid == 80 && a.IsDel == 0).ToList();
|
|
|
+ PriceDetailType.ForEach(a => { a.Name = a.Name.Replace("n", ""); });
|
|
|
+ List<SetDataInfoView> _PriceDetailType = _mapper.Map<List<SetDataInfoView>>(PriceDetailType);
|
|
|
+
|
|
|
+ var data = new
|
|
|
+ {
|
|
|
+ Payment = _Payment,
|
|
|
+ PriceType = _PriceType,
|
|
|
+ PriceDetailType = _PriceDetailType
|
|
|
+ };
|
|
|
+
|
|
|
+
|
|
|
+ return Ok(JsonView(true, "", data));
|
|
|
+ }
|
|
|
+
|
|
|
+ #endregion
|
|
|
}
|
|
|
}
|