private CWGLBorrowMoneyLogDto GetChangeModel(CWGLBorrowMoney model) { var ret = model.MapTo <CWGLBorrowMoneyLogDto>(); ret.TypeId_Name = Enum.GetName(typeof(BorrowMoney), model.TypeId); ret.Mode_Name = Enum.GetName(typeof(MoneyMode), model.Mode); return(ret); }
public async Task <InitWorkFlowOutput> Create(CreateCWGLBorrowMoneyInput input) { var service = AbpBootstrapper.Create <Abp.Modules.AbpModule>().IocManager.IocContainer.Resolve <IWorkFlowOrganizationUnitsAppService>(); var userOrgModel = await service.GetUserPostInfo(new NullableIdDto <long>() { Id = AbpSession.UserId.Value, }, new NullableIdDto <long>() { Id = null }); var id = Guid.NewGuid(); var newmodel = new CWGLBorrowMoney() { Id = id, UserId = AbpSession.UserId.Value, OrgId = userOrgModel.OrgId, TypeId = input.TypeId, Money = input.Money, Mode = input.Mode, IsPayBack = false, BankName = input.BankName, CardNumber = input.CardNumber, BankOpenName = input.BankOpenName, Note = input.Note, RepaymentTime = input.RepaymentTime, Nummber = input.Nummber }; newmodel.Status = 0; await _repository.InsertAsync(newmodel); if (input.FileList != null) { var fileList = new List <AbpFileListInput>(); foreach (var item in input.FileList) { fileList.Add(new AbpFileListInput() { Id = item.Id, Sort = item.Sort }); } await _abpFileRelationAppService.CreateAsync(new CreateFileRelationsInput() { BusinessId = id.ToString(), BusinessType = (int)AbpFileBusinessType.借款申请, Files = fileList }); } return(new InitWorkFlowOutput() { InStanceId = newmodel.Id.ToString() }); }
public async Task Update(UpdateCWGLBorrowMoneyInput input) { if (input.Id != Guid.Empty) { var dbmodel = await _repository.FirstOrDefaultAsync(x => x.Id == input.Id); if (dbmodel == null) { throw new UserFriendlyException((int)ErrorCode.DataAccessErr, "该数据不存在。"); } var logModel = new CWGLBorrowMoney(); if (input.IsUpdateForChange) { logModel = dbmodel.DeepClone <CWGLBorrowMoney>(); } dbmodel.TypeId = input.TypeId; dbmodel.Money = input.Money; dbmodel.Mode = input.Mode; dbmodel.BankName = input.BankName; dbmodel.CardNumber = input.CardNumber; dbmodel.BankOpenName = input.BankOpenName; dbmodel.Note = input.Note; dbmodel.RepaymentTime = input.RepaymentTime; dbmodel.Nummber = input.Nummber; dbmodel.RepayTime = input.RepayTime; dbmodel.RepayMode = input.RepayMode; dbmodel.RepayCardNumber = input.RepayCardNumber; dbmodel.RepayBankOpenName = input.RepayBankOpenName; dbmodel.RepayBankName = input.RepayBankName; input.FACData.BusinessId = input.Id.ToString(); await _repository.UpdateAsync(dbmodel); var fileList = new List <AbpFileListInput>(); if (input.FileList != null) { foreach (var item in input.FileList) { fileList.Add(new AbpFileListInput() { Id = item.Id, Sort = item.Sort }); } } await _abpFileRelationAppService.UpdateAsync(new CreateFileRelationsInput() { BusinessId = input.Id.ToString(), BusinessType = (int)AbpFileBusinessType.借款申请, Files = fileList }); var groupId = Guid.NewGuid(); input.FACData.GroupId = groupId; if (input.IsUpdateForChange) { var flowModel = _workFlowCacheManager.GetWorkFlowModelFromCache(input.FlowId); if (flowModel == null) { throw new UserFriendlyException((int)ErrorCode.DataAccessErr, "流程不存在"); } var logs = GetChangeModel(logModel).GetColumnAllLogs(GetChangeModel(dbmodel)); await _projectAuditManager.InsertAsync(logs, input.Id.ToString(), flowModel.TitleField.Table, groupId); } } else { throw new UserFriendlyException((int)ErrorCode.DataAccessErr, "该数据不存在。"); } }
/// <summary> /// 添加一个CWGLBorrowMoney /// </summary> /// <param name="input">实体</param> /// <returns></returns> public async Task <InitWorkFlowOutput> CreateTest() { var input = new CreateCWGLBorrowMoneyInput() { BankName = "1", BankOpenName = "2", CardNumber = "3", FlowId = Guid.Parse("384c41b8-9d13-429b-ab62-fcc22e8639ee"), FlowTitle = "查询效率测试", Mode = MoneyMode.现金, Money = 12312, Note = "测试", Nummber = 1, TypeId = BorrowMoney.普通借款, }; var service = AbpBootstrapper.Create <Abp.Modules.AbpModule>().IocManager.IocContainer.Resolve <IWorkFlowOrganizationUnitsAppService>(); var userOrgModel = await service.GetUserPostInfo(new NullableIdDto <long>() { Id = AbpSession.UserId.Value, }, new NullableIdDto <long>() { Id = null }); var id = Guid.NewGuid(); var newmodel = new CWGLBorrowMoney() { Id = id, UserId = AbpSession.UserId.Value, OrgId = userOrgModel.OrgId, TypeId = input.TypeId, Money = input.Money, Mode = input.Mode, IsPayBack = false, BankName = input.BankName, CardNumber = input.CardNumber, BankOpenName = input.BankOpenName, Note = input.Note, Nummber = input.Nummber }; newmodel.Status = 0; await _repository.InsertAsync(newmodel); if (input.FileList != null) { var fileList = new List <AbpFileListInput>(); foreach (var item in input.FileList) { fileList.Add(new AbpFileListInput() { Id = item.Id, Sort = item.Sort }); } await _abpFileRelationAppService.CreateAsync(new CreateFileRelationsInput() { BusinessId = id.ToString(), BusinessType = (int)AbpFileBusinessType.借款申请, Files = fileList }); } var service1 = AbpBootstrapper.Create <Abp.Modules.AbpModule>().IocManager.IocContainer.Resolve <IWorkFlowWorkTaskAppService>(); service1.InitWorkFlowInstance(new InitWorkFlowInput() { FlowId = input.FlowId, FlowTitle = input.FlowTitle, InStanceId = newmodel.Id.ToString() }); return(new InitWorkFlowOutput() { InStanceId = newmodel.Id.ToString() }); }