/// <summary> /// /// </summary> /// <param name="inputPayEntity"></param> /// <param name="existingPayEntity"></param> /// <param name="lastPayInfoDetailsEntity"></param> /// <param name="db"></param> public PayToolsBase(Pay_InfoEntity entity) { this._inputPayEntity = entity; #region 为了保证下面的数据都是一致的所以这里把该查的数据都一起查出来 //项目信息 var projectInfo = new Base_ProjectInfoEntity(); if (entity.Project_Id != null) { _projectInfoEntity = projectService.GetEntityBase(entity.Project_Id); } if (_projectInfoEntity == null) { throw new Exception("项目信息不正确!"); } //数据库存储的付款单 this._existingPayEntity = payInfoService.GetEntity(entity.Pay_Info_Id); if (existingPayEntity != null) { this._lastPayInfoDetailsEntity = payDeailsService.GetEntityByCode(existingPayEntity.LastPayInfoDetailsCode); } this._ecommerceProjectMoneyCapacity = eprService.GetTrunkEntity(entity.Project_Id, entity.EcommerceID); if (_ecommerceProjectMoneyCapacity == null) { throw new Exception("未找到对应的电商合同!"); } _codeNumber = coderuleService.SetBillCodeByCode("System", "100"); #endregion try { string errMsg = string.Empty; if (existingPayEntity != null) { inputPayEntity.Modify(inputPayEntity.Pay_Info_Id); new RepositoryFactory().BaseRepository().Update(inputPayEntity); } else { inputPayEntity.CompanyID = projectInfoEntity.CompanyCode; inputPayEntity.CompanyName = projectInfoEntity.CompanyName; inputPayEntity.Create(); new RepositoryFactory().BaseRepository().Insert(inputPayEntity); } Transdb = new RepositoryFactory().BaseRepository().BeginTrans(); } catch (Exception ex) { Transdb.Rollback(); throw new Exception(ex.Message); } }
/// <summary> /// 共享平台推送付款单 /// </summary> /// <param name="keyValue">主键值</param> /// <param name="entity">实体对象</param> /// <returns></returns> public void Paymentuse(string keyValue, Pay_InfoEntity entity) { try { service.Paymentuse(keyValue, entity); } catch (Exception ex) { throw new Exception(ex.Message); } }
/// <summary> /// 保存表单(新增、修改) /// </summary> /// <param name="keyValue">主键值</param> /// <param name="entity">实体对象</param> /// <returns></returns> public void SaveForm(string keyValue, Pay_InfoEntity entity) { try { service.SaveForm(keyValue, entity); } catch (Exception ex) { throw new Exception(ex.Message); } }
public ActionResult SaveForm(string keyValue, Pay_InfoEntity entity) { try { pay_infobll.SaveForm(keyValue, entity); return(Success("操作成功。")); } catch (Exception ex) { throw new Exception(ex.Message); } }
public PayConsumptionHelp(Pay_InfoEntity inputPayEntity) : base(inputPayEntity) { }
public PayLockHelp(Pay_InfoEntity inputPayEntity) : base(inputPayEntity) { }
public void PostPaymentuse() { SqlConnection conn = new SqlConnection("Server=.;Initial Catalog=mytest;User ID=sa;Password=123456;Pooling=true;Max Pool Size=1024;Min Pool Size=0;"); StringBuilder sqlstr = new StringBuilder(); sqlstr.Append(@"select * from daorushuju"); conn.Open(); SqlCommand comm = new SqlCommand(sqlstr.ToString(), conn); SqlDataReader sdr = comm.ExecuteReader(); Pay_InfoEntity payinfo = new Pay_InfoEntity(); List <Pay_InfoEntity> payinfolists = new List <Pay_InfoEntity>(); while (sdr.Read()) { payinfo = new Pay_InfoEntity { Project_Name = sdr[2].ToString().Trim(), Electricity_Supplier_Name = sdr[3].ToString().Trim(), Pay_Money = Convert.ToDecimal(sdr[6]), Pay_Info_Id = sdr[10].ToString() }; payinfolists.Add(payinfo); if (!sdr.HasRows) { payinfo = new Pay_InfoEntity { Project_Name = "", }; payinfolists.Add(payinfo); } } sdr.Close(); conn.Close(); string datetime = DateTime.Now.ToString("yyyyMMdd"); string paycode = "History" + datetime + "A00"; string i = "1"; string hetong = "HT-" + datetime + "-00"; EcommerceBLL ecombll = new EcommerceBLL(); Base_ProjectInfoBLL bpbbll = new Base_ProjectInfoBLL(); EcommerceProjectRelationBLL ecomprorelabll = new EcommerceProjectRelationBLL(); bool isexprot = true; foreach (var item in payinfolists) { var projectdata = bpbbll.GetList("").ToList().Where(t => t.ProjecName == item.Project_Name).ToList(); var ecomdata = ecombll.GetList("").Where(t => t.EcommerceName == item.Electricity_Supplier_Name).ToList(); if (ecomdata.Count == 0) { isexprot = false; string msg = string.Format("不存在该电商公司:{0}", item.Electricity_Supplier_Name); Info(msg); continue; } bool isexist = ecomprorelabll.GetProjectAndEcom().Any(t => t.ProjecName == item.Project_Name && t.EcommerceName == item.Electricity_Supplier_Name); if (!isexist) { isexprot = false; string msg = string.Format("该电商公司( {0} )和项目( {1} )不存在", item.Electricity_Supplier_Name, item.Project_Name); Error(msg); continue; } InputPaymentuse abc = new InputPaymentuse(); if (i.Length == 1) { i = "0" + i; } abc.pay_info_id = item.Pay_Info_Id; abc.pay_info_code = paycode + i; abc.electricity_supplier_name = item.Electricity_Supplier_Name; abc.electricity_supplier_code = ecomdata[0].EcommerceCode; abc.electricity_supplier_id = ecomdata[0].EcommerceID; abc.electricity_supplier_ad_id = ecomdata[0].EcommerceGroupID; abc.electricity_supplier_ad = ecomdata[0].EcommerceGroupName; abc.project_code = projectdata[0].ProjectCode; abc.project_id = projectdata[0].ProjectID; abc.project_name = item.Project_Name; abc.pay_info_type = "EC"; abc.contract_code = hetong + i; abc.contract_name = item.Project_Name + "历史合同数据"; abc.pay_money = Convert.ToDecimal(item.Pay_Money); abc.pay_createtime = Convert.ToDateTime("2018/08/01"); abc.pay_completetime = Convert.ToDateTime("2018/08/31"); abc.pay_reason = "导入历史数据"; abc.approval_status = "SUBMITED"; abc.url = "https://fssc.yango.com.cn/jiebao-plus/#/app/smart_expense/form/EC/306991952048422912/detail"; abc.login_name = "金涛"; abc.login_code = "金涛"; i = (Convert.ToInt32(i) + 1).ToString(); string param = abc.ToJson(); string a = ""; string paydatadetail = abc.ToJson(); // data(paydatadetail); } if (!isexprot) { return; } foreach (var item in payinfolists) { var projectdata = bpbbll.GetList("").ToList().Where(t => t.ProjecName == item.Project_Name).ToList(); var ecomdata = ecombll.GetList("").Where(t => t.EcommerceName == item.Electricity_Supplier_Name).ToList(); if (ecomdata.Count == 0) { string msg = string.Format("不存在该电商公司:{0}", item.Electricity_Supplier_Name); Error(msg); } InputPaymentuse abc = new InputPaymentuse(); if (i.Length == 1) { i = "0" + i; } abc.pay_info_id = item.Pay_Info_Id; abc.pay_info_code = paycode + i; abc.electricity_supplier_name = item.Electricity_Supplier_Name; abc.electricity_supplier_code = ecomdata[0].EcommerceCode; abc.electricity_supplier_id = ecomdata[0].EcommerceID; abc.electricity_supplier_ad_id = ecomdata[0].EcommerceGroupID; abc.electricity_supplier_ad = ecomdata[0].EcommerceGroupName; abc.project_code = projectdata[0].ProjectCode; abc.project_id = projectdata[0].ProjectID; abc.project_name = item.Project_Name; abc.pay_info_type = "EC"; abc.contract_code = hetong + i; abc.contract_name = item.Project_Name + "历史合同数据"; abc.pay_money = Convert.ToDecimal(item.Pay_Money); abc.pay_createtime = Convert.ToDateTime("2018/08/01"); abc.pay_completetime = Convert.ToDateTime("2018/08/31"); abc.pay_reason = "导入历史数据"; abc.approval_status = "AUDITED"; abc.url = "https://fssc.yango.com.cn/jiebao-plus/#/app/smart_expense/form/EC/306991952048422912/detail"; abc.login_name = "金涛"; abc.login_code = "金涛"; i = (Convert.ToInt32(i) + 1).ToString(); string param = abc.ToJson(); string a = ""; string res = HttpMethods.PostResponse("http://172.19.10.206:8090/api/money/paymentuse", param, out a); } }
public async Task <Resp <bool> > PostPaymentuse(InputPaymentuse inputModel) { string errMsg = string.Empty; int reqState = 1; bool result = false; #region 入参校验 //验证实体对象属性信息 #endregion try { var errorResult = GetError(); if (!string.IsNullOrWhiteSpace(errorResult)) { errMsg = errorResult; reqState = 0; return(Resp.BusinessError(errMsg, result)); } if (inputModel.pay_money <= 0) { errMsg = "金额异常!"; reqState = 0; return(Resp.BusinessError(errMsg, result)); } await Task.Run(() => { var _approval = 0; switch (inputModel.approval_status) { case "AUDITED": // 已审批 消费金额 _approval = (int)ApproveStatus.approved; break; case "DRAFT": // DRAFT 草稿 释放 _approval = (int)ApproveStatus.draft; break; case "SUBMITED": //SUBMITED 待审批 占用(注意金额的变化,变化是需要修改) _approval = (int)ApproveStatus.in_approval; break; case "DISABLED": // DISABLED 已作废 释放 _approval = (int)ApproveStatus.deleted; break; default: break; } var model = new Pay_InfoEntity() { Approval_Status = _approval.ToString(), Contract_Code = inputModel.contract_code, Contract_Name = inputModel.contract_name, ContractMoney = inputModel.pay_money, CreateUserName = inputModel.login_name, EcommerceGroupID = inputModel.electricity_supplier_ad_id, EcommerceID = inputModel.electricity_supplier_id, Electricity_Supplier_Code = inputModel.electricity_supplier_code, Electricity_Supplier_Name = inputModel.electricity_supplier_name, EcommerceGroupName = inputModel.electricity_supplier_ad, Login_Code = inputModel.login_code, Login_Name = inputModel.login_name, Pay_Completetime = inputModel.pay_completetime, Pay_Createtime = inputModel.pay_createtime, Pay_Info_Code = inputModel.pay_info_code, Pay_Info_Id = inputModel.pay_info_id, Pay_Info_Type = inputModel.pay_info_type, Pay_Money = inputModel.pay_money, Pay_Reason = inputModel.pay_reason, Project_Code = inputModel.project_code, Project_Id = inputModel.project_id, Project_Name = inputModel.project_name, Url = inputModel.url, }; payInfoBll.Paymentuse(inputModel.pay_info_id, model); }); result = true; return(Resp.Success(result)); } catch (Exception ex) { errMsg = ex.Message; reqState = 0; return(Resp.BusinessError(errMsg, result)); } finally { string ResponseContent = reqState == 0 ? Resp.BusinessError <bool>(errMsg, result).ToJson() : Resp.Success(result).ToJson(); LogBLL.WriteLogInterface(inputModel.ToJson(), ResponseContent, "资金占用情况", reqState, "共享平台", "电商资金", errMsg); } }