| | |
| | | using Azure; |
| | | using FlexJobApi.Core; |
| | | using Furion.DatabaseAccessor; |
| | | using Furion.DistributedIDGenerator; |
| | | using Furion.FriendlyException; |
| | | using Mapster; |
| | | using MediatR; |
| | |
| | | .FirstOrDefaultAsync(); |
| | | if (entity == null) |
| | | { |
| | | entity = new EnterpriseWallet(); |
| | | entity.EnterpriseId = request.EnterpriseId!.Value; |
| | | entity.Access = EnumEnterpriseWalletAccess.Alipay; |
| | | entity.PersonalProductCode = "FUND_SAFT_SIGN_WITHHOLDING_P"; |
| | | entity.SignScene = "INDUSTRY|SATF_ACC"; |
| | | entity.ThirdPartyType = "PARTNER"; |
| | | entity.ProductCode = "FUND_SAFT_SIGN_WITHHOLDING"; |
| | | entity.SignStatus = EnumEnterpriseWalletSignStatus.Wait; |
| | | await SetCode(entity); |
| | | await rep.InsertAsync(entity); |
| | | |
| | | return new GetEnterpriseWalletQueryResult |
| | | { |
| | | Id = entity.Id, |
| | | Code = entity.Code, |
| | | Access = request.Access, |
| | | SignStatus = EnumEnterpriseWalletSignStatus.Wait, |
| | | ExpandindirectOrderStatus = EnumEnterpriseWalletExpandindirectOrderStatus.Wait |
| | | ExpandindirectOrderStatus = EnumEnterpriseWalletExpandindirectOrderStatus.Wait, |
| | | }; |
| | | } |
| | | var update = false; |
| | |
| | | var model = entity.Adapt<GetEnterpriseWalletQueryResult>(); |
| | | |
| | | var expandindirectOrder = await repEnterpriseWalletExpandindirectOrder.AsQueryable() |
| | | .Include(it => it.Files) |
| | | .OrderByDescending(it => it.CreatedTime) |
| | | .Where(it => it.WalletId == model.Id) |
| | | .FirstOrDefaultAsync(); |
| | |
| | | } |
| | | await repEnterpriseWalletExpandindirectOrder.UpdateNowAsync(expandindirectOrder); |
| | | } |
| | | |
| | | model.Name = expandindirectOrder.Name; |
| | | model.Identity = expandindirectOrder.Identity; |
| | | model.Scene = expandindirectOrder.Scene; |
| | | model.SceneDirections = expandindirectOrder.SceneDirections; |
| | | model.TaskFinishTime = expandindirectOrder.TaskFinishTime; |
| | | model.SitesInfo = expandindirectOrder.Sites.JsonTo<GetEnterpriseWalletExpandindirectOrderQueryResultSites>(); |
| | | model.Files = expandindirectOrder.Files?.Adapt<List<GetEnterpriseWalletExpandindirectOrderQueryResultFile>>() ?? new List<GetEnterpriseWalletExpandindirectOrderQueryResultFile>(); |
| | | model.ExpandindirectOrderStatus = expandindirectOrder.OrderStatus; |
| | | } |
| | | else |
| | |
| | | return model; |
| | | } |
| | | |
| | | private async Task SetCode(EnterpriseWallet entity) |
| | | { |
| | | entity.Code = $"{DateTime.Now:yyyyMMddHHmmss}{new Random(IDGen.NextID().GetHashCode()).Next(1000, 9999)}"; |
| | | var exist = await rep.AsQueryable().AsNoTracking() |
| | | .AnyAsync(it => it.Code == entity.Code); |
| | | if (exist) |
| | | { |
| | | await SetCode(entity); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 查询企业钱包交易详情 |
| | | /// </summary> |