| | |
| | | FourStreamsMaterialFileBusinessTypeEnumKey, |
| | | TransferFileEnumInRewardGrand, |
| | | TransferFileEnumInRewardGrandKey, |
| | | FourStreamsExtraMaterialFileSearchType, |
| | | SearchType, |
| | | } from '@/constants'; |
| | | |
| | | export class FourStreamsMaterialUtils { |
| | |
| | | export type CustomerApplyFileTypeListItem = { |
| | | id?: string; |
| | | fileSearchTypeId?: string; |
| | | searchType?: number; |
| | | fileTypeName?: string; |
| | | lastUpdateTime?: string; |
| | | listFiles?: (API.CustomerUploadMonthApplyFileTypeDto & UploadUserFile)[]; |
| | |
| | | ); |
| | | } |
| | | |
| | | static convertApiFileToExtraListFiles(listFiles: API.CustomerUploadMonthApplyFileTypeDto[]) { |
| | | if (listFiles.length > 0) { |
| | | return this.convertApiFileToParkCollectFileList(listFiles); |
| | | } else { |
| | | return [ |
| | | { |
| | | fileSearchTypeId: FourStreamsExtraMaterialFileSearchType[SearchType.BountyExtraFileType], |
| | | fileTypeName: '补充材料', |
| | | listFiles: [], |
| | | } as CustomerApplyFileTypeListItem, |
| | | ]; |
| | | } |
| | | } |
| | | |
| | | static initParkCollectFileListApplyFiles( |
| | | applyUploadFiles: API.GetEnterpriseParkApplyUploadFileOutput[], |
| | | applyFiles: API.GetCustomerUploadApplyFilesOutput[], |
| | | lastUploadEnterPactFile: API.CustomerUploadMonthApplyFileTypeDto[] |
| | | lastUploadEnterPactFile: API.CustomerUploadMonthApplyFileTypeDto[], |
| | | applyUploadExtraFiles: API.GetEnterpriseParkApplyUploadFileOutput[] |
| | | ) { |
| | | return applyUploadFiles.map((x) => { |
| | | const applyFile = applyFiles.find((a) => a.fileSearchTypeId === x.fileSearchTypeId); |
| | | let listFiles: API.CustomerUploadMonthApplyFileTypeDto[]; |
| | | if (x.fileSearchTypeName === '园区入驻协议') { |
| | | listFiles = !x.listFiles.length ? lastUploadEnterPactFile : x.listFiles; |
| | | } else { |
| | | listFiles = |
| | | !x.listFiles.length && applyFile?.listFiles?.length > 0 |
| | | ? applyFile.listFiles |
| | | : x.listFiles; |
| | | } |
| | | const extraFiles = |
| | | applyUploadExtraFiles.length > 0 |
| | | ? applyUploadExtraFiles.map((x) => { |
| | | return { |
| | | fileSearchTypeId: x.fileSearchTypeId, |
| | | fileTypeName: x.fileSearchTypeName, |
| | | listFiles: x.listFiles.map((a) => ({ ...a, ...convertApi2FormUrl(a.fileUrl) })), |
| | | } as CustomerApplyFileTypeListItem; |
| | | }) |
| | | : [ |
| | | { |
| | | fileSearchTypeId: |
| | | FourStreamsExtraMaterialFileSearchType[SearchType.BountyApplyExtraFileType], |
| | | fileTypeName: '补充材料', |
| | | listFiles: [], |
| | | } as CustomerApplyFileTypeListItem, |
| | | ]; |
| | | |
| | | return { |
| | | fileSearchTypeId: x.fileSearchTypeId, |
| | | fileTypeName: x.fileSearchTypeName, |
| | | listFiles: listFiles.map((a) => ({ ...a, ...convertApi2FormUrl(a.fileUrl) })), |
| | | } as CustomerApplyFileTypeListItem; |
| | | }); |
| | | return applyUploadFiles |
| | | .map((x) => { |
| | | const applyFile = applyFiles.find((a) => a.fileSearchTypeId === x.fileSearchTypeId); |
| | | let listFiles: API.CustomerUploadMonthApplyFileTypeDto[]; |
| | | if (x.fileSearchTypeName === '园区入驻协议') { |
| | | listFiles = !x.listFiles.length ? lastUploadEnterPactFile : x.listFiles; |
| | | } else { |
| | | listFiles = |
| | | !x.listFiles.length && applyFile?.listFiles?.length > 0 |
| | | ? applyFile.listFiles |
| | | : x.listFiles; |
| | | } |
| | | |
| | | return { |
| | | fileSearchTypeId: x.fileSearchTypeId, |
| | | fileTypeName: x.fileSearchTypeName, |
| | | listFiles: listFiles.map((a) => ({ ...a, ...convertApi2FormUrl(a.fileUrl) })), |
| | | } as CustomerApplyFileTypeListItem; |
| | | }) |
| | | .concat(extraFiles); |
| | | } |
| | | |
| | | static isApplyUploadExtraFileSearchTypeId(fileSearchTypeId: string) { |
| | | return ( |
| | | (fileSearchTypeId ?? '').toLowerCase() === |
| | | FourStreamsExtraMaterialFileSearchType[SearchType.BountyApplyExtraFileType].toLowerCase() |
| | | ); |
| | | } |
| | | |
| | | static convertFileTableListToApi(fileTableList: CustomerApplyFileTypeListItem[]) { |