public async Task Update(UpdateCWGLoanInput 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 CWGLoan(); if (input.IsUpdateForChange) { logModel = dbmodel.DeepClone <CWGLoan>(); } dbmodel.Money = input.Money; dbmodel.Remark = input.Remark; 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, "该数据不存在。"); } }
public async Task <InitWorkFlowOutput> Create(CreateCWGLoanInput input) { var id = Guid.NewGuid(); var newmodel = new CWGLoan() { Id = id, Money = input.Money, Remark = input.Remark }; newmodel.Status = 0; await _repository.InsertAsync(newmodel); return(new InitWorkFlowOutput() { InStanceId = newmodel.Id.ToString() }); }
private CWGLoanLogDto GetChangeModel(CWGLoan model) { var ret = model.MapTo <CWGLoanLogDto>(); return(ret); }