| | |
| | | package com.qianwen.smartman.modules.dnc.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.Wrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.google.common.base.Joiner; |
| | | import java.lang.invoke.SerializedLambda; |
| | | import java.security.NoSuchAlgorithmException; |
| | | import java.util.ArrayList; |
| | | import java.util.Collections; |
| | |
| | | import java.util.Optional; |
| | | import java.util.function.Function; |
| | | import java.util.stream.Collectors; |
| | | import com.qianwen.smartman.common.cache.RegionCache; |
| | | import com.qianwen.smartman.common.cache.UserCache; |
| | | import com.qianwen.smartman.common.constant.CommonConstant; |
| | | import com.qianwen.smartman.common.constant.DncConstant; |
| | | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.google.common.base.Joiner; |
| | | import com.qianwen.core.mp.base.BaseServiceImpl; |
| | | import com.qianwen.core.oss.model.OssFile; |
| | | import com.qianwen.core.secure.utils.AuthUtil; |
| | | import com.qianwen.core.tool.utils.Func; |
| | | import com.qianwen.smartman.common.cache.UserCache; |
| | | import com.qianwen.smartman.common.constant.CommonConstant; |
| | | import com.qianwen.smartman.common.constant.DncConstant; |
| | | import com.qianwen.smartman.modules.dnc.convert.DncArtFileConvert; |
| | | import com.qianwen.smartman.modules.dnc.dto.ArtFileInformationDTO; |
| | | import com.qianwen.smartman.modules.dnc.dto.DncArtBagLogDTO; |
| | | import com.qianwen.smartman.modules.dnc.entity.DncArtBag; |
| | | import com.qianwen.smartman.modules.dnc.entity.DncArtFile; |
| | | import com.qianwen.smartman.modules.dnc.entity.DncFactoryFile; |
| | | import com.qianwen.smartman.modules.dnc.entity.DncProcessCatalogue; |
| | | import com.qianwen.smartman.modules.dnc.entity.TransferDirectoryFile; |
| | | import com.qianwen.smartman.modules.dnc.enums.DncEnums; |
| | | import com.qianwen.smartman.modules.dnc.mapper.DncArtFileMapper; |
| | | import com.qianwen.smartman.modules.dnc.service.IDncArtBagLogService; |
| | |
| | | import com.qianwen.smartman.modules.dnc.vo.sync.SyncDncProcessCatalogueVO; |
| | | import com.qianwen.smartman.modules.resource.builder.oss.OssBuilder; |
| | | import com.qianwen.smartman.modules.system.entity.User; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | @Service |
| | | /* loaded from: blade-api.jar:BOOT-INF/classes/org/springblade/modules/dnc/service/impl/DncArtFileServiceImpl.class */ |
| | |
| | | private IDncFactoryFileService dncFactoryFileService; |
| | | @Autowired |
| | | private IFileService fileService; |
| | | |
| | | private static /* synthetic */ Object $deserializeLambda$(SerializedLambda lambda) { |
| | | String implMethodName = lambda.getImplMethodName(); |
| | | boolean z = true; |
| | | switch (implMethodName.hashCode()) { |
| | | case -2007000029: |
| | | if (implMethodName.equals("getWhetherArchive")) { |
| | | z = true; |
| | | break; |
| | | } |
| | | break; |
| | | case -1646483922: |
| | | if (implMethodName.equals("getCatalogueId")) { |
| | | z = true; |
| | | break; |
| | | } |
| | | break; |
| | | case -1041904421: |
| | | if (implMethodName.equals("getParentId")) { |
| | | z = true; |
| | | break; |
| | | } |
| | | break; |
| | | case -75622813: |
| | | if (implMethodName.equals("getCode")) { |
| | | z = true; |
| | | break; |
| | | } |
| | | break; |
| | | case -75308287: |
| | | if (implMethodName.equals("getName")) { |
| | | z = true; |
| | | break; |
| | | } |
| | | break; |
| | | case 98245393: |
| | | if (implMethodName.equals("getId")) { |
| | | z = true; |
| | | break; |
| | | } |
| | | break; |
| | | case 537556537: |
| | | if (implMethodName.equals("getIsCurrent")) { |
| | | z = true; |
| | | break; |
| | | } |
| | | break; |
| | | case 812940310: |
| | | if (implMethodName.equals("getArtBagId")) { |
| | | z = false; |
| | | break; |
| | | } |
| | | break; |
| | | case 1342380108: |
| | | if (implMethodName.equals("getFileType")) { |
| | | z = true; |
| | | break; |
| | | } |
| | | break; |
| | | case 1343131517: |
| | | if (implMethodName.equals("getFilename")) { |
| | | z = true; |
| | | break; |
| | | } |
| | | break; |
| | | } |
| | | switch (z) { |
| | | case false: |
| | | if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("org/springblade/modules/dnc/entity/DncArtFile") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) { |
| | | return (v0) -> { |
| | | return v0.getArtBagId(); |
| | | }; |
| | | } |
| | | if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("org/springblade/modules/dnc/entity/DncArtFile") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) { |
| | | return (v0) -> { |
| | | return v0.getArtBagId(); |
| | | }; |
| | | } |
| | | if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("org/springblade/modules/dnc/entity/DncArtFile") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) { |
| | | return (v0) -> { |
| | | return v0.getArtBagId(); |
| | | }; |
| | | } |
| | | break; |
| | | case true: |
| | | if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("org/springblade/modules/dnc/entity/DncArtBag") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) { |
| | | return (v0) -> { |
| | | return v0.getCatalogueId(); |
| | | }; |
| | | } |
| | | break; |
| | | case true: |
| | | if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("org/springblade/modules/dnc/entity/DncArtFile") && lambda.getImplMethodSignature().equals("()Ljava/lang/Integer;")) { |
| | | return (v0) -> { |
| | | return v0.getIsCurrent(); |
| | | }; |
| | | } |
| | | if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("org/springblade/modules/dnc/entity/DncArtFile") && lambda.getImplMethodSignature().equals("()Ljava/lang/Integer;")) { |
| | | return (v0) -> { |
| | | return v0.getIsCurrent(); |
| | | }; |
| | | } |
| | | break; |
| | | case true: |
| | | if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("org/springblade/modules/dnc/entity/DncArtFile") && lambda.getImplMethodSignature().equals("()Ljava/lang/String;")) { |
| | | return (v0) -> { |
| | | return v0.getFilename(); |
| | | }; |
| | | } |
| | | break; |
| | | case true: |
| | | if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("org/springblade/modules/dnc/entity/DncArtBag") && lambda.getImplMethodSignature().equals("()Ljava/lang/String;")) { |
| | | return (v0) -> { |
| | | return v0.getName(); |
| | | }; |
| | | } |
| | | break; |
| | | case RegionCache.VILLAGE_LEVEL /* 5 */: |
| | | if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("org/springblade/core/mp/base/BaseEntity") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) { |
| | | return (v0) -> { |
| | | return v0.getId(); |
| | | }; |
| | | } |
| | | if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("org/springblade/core/mp/base/BaseEntity") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) { |
| | | return (v0) -> { |
| | | return v0.getId(); |
| | | }; |
| | | } |
| | | if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("org/springblade/core/mp/base/BaseEntity") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) { |
| | | return (v0) -> { |
| | | return v0.getId(); |
| | | }; |
| | | } |
| | | break; |
| | | case true: |
| | | if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("org/springblade/modules/dnc/entity/TransferDirectoryFile") && lambda.getImplMethodSignature().equals("()Ljava/lang/Integer;")) { |
| | | return (v0) -> { |
| | | return v0.getWhetherArchive(); |
| | | }; |
| | | } |
| | | if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("org/springblade/modules/dnc/entity/DncFactoryFile") && lambda.getImplMethodSignature().equals("()Ljava/lang/Integer;")) { |
| | | return (v0) -> { |
| | | return v0.getWhetherArchive(); |
| | | }; |
| | | } |
| | | break; |
| | | case true: |
| | | if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("org/springblade/modules/dnc/entity/DncArtBag") && lambda.getImplMethodSignature().equals("()Ljava/lang/String;")) { |
| | | return (v0) -> { |
| | | return v0.getCode(); |
| | | }; |
| | | } |
| | | break; |
| | | case true: |
| | | if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("org/springblade/modules/dnc/entity/DncProcessCatalogue") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) { |
| | | return (v0) -> { |
| | | return v0.getParentId(); |
| | | }; |
| | | } |
| | | break; |
| | | case true: |
| | | if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("org/springblade/modules/dnc/entity/DncArtFile") && lambda.getImplMethodSignature().equals("()Ljava/lang/Integer;")) { |
| | | return (v0) -> { |
| | | return v0.getFileType(); |
| | | }; |
| | | } |
| | | break; |
| | | } |
| | | throw new IllegalArgumentException("Invalid lambda deserialization"); |
| | | } |
| | | |
| | | @Override // org.springblade.modules.dnc.service.IDncArtFileService |
| | | public List<DncArtFileAddVO> addArtFile(List<DncArtFileAddVO> dncArtFilesList) { |
| | |
| | | List<DncArtFileAddVO> dncArtFilesList = new ArrayList<>(); |
| | | List<DncArtFileAddVO> dncArtFileAdds = bagFilesVO.getDncArtFileAddList(); |
| | | artBagIds.forEach(s -> { |
| | | List<DncArtFileAddVO> dncArtFileAddList = (List) dncArtFileAdds.stream().map(a -> { |
| | | List<DncArtFileAddVO> dncArtFileAddList = dncArtFileAdds.stream().map(a -> { |
| | | return DncArtFileAddVO.builder().artBagId(Long.valueOf(Func.toLong(s))).id(a.getId()).remark(a.getRemark()).tenantId(a.getTenantId()).fileId(a.getFileId()).sourceType(a.getSourceType()).fileType(a.getFileType()).originalFilename(a.getOriginalFilename()).filename(a.getFilename()).contentLength(a.getContentLength()).contentMd5(a.getContentMd5()).contentType(a.getContentType()).objectKey(a.getObjectKey()).fileOwnership(a.getFileOwnership()).link(a.getLink()).suffix(a.getSuffix()).storageSpace(a.getStorageSpace()).build(); |
| | | }).collect(Collectors.toList()); |
| | | dncArtFilesList.addAll(dncArtFileAddList); |
| | | }); |
| | | if (Func.isNotEmpty(dncArtFilesList)) { |
| | | List<DncArtFileAddVO> workstationList = (List) dncArtFilesList.stream().filter(s2 -> { |
| | | List<DncArtFileAddVO> workstationList = dncArtFilesList.stream().filter(s2 -> { |
| | | return DncEnums.FileOwnership.WORKSTATION.getCode().equals(s2.getFileOwnership()); |
| | | }).collect(Collectors.toList()); |
| | | if (Func.isNotEmpty(workstationList)) { |
| | | List<Long> workstationFileIds = (List) workstationList.stream().map((v0) -> { |
| | | List<Long> workstationFileIds = workstationList.stream().map((v0) -> { |
| | | return v0.getFileId(); |
| | | }).distinct().collect(Collectors.toList()); |
| | | |
| | | if (Func.isNotEmpty(workstationFileIds)) { |
| | | this.transferDirectoryFileService |
| | | .update(Wrappers.<TransferDirectoryFile>lambdaUpdate().set(TransferDirectoryFile::getWhetherArchive, DncEnums.WhetherArchive.not_Archive.getCode()) |
| | | .in(TransferDirectoryFile::getId, workstationFileIds)); |
| | | /* |
| | | this.transferDirectoryFileService.update((Wrapper) ((LambdaUpdateWrapper) Wrappers.lambdaUpdate().set((v0) -> { |
| | | return v0.getWhetherArchive(); |
| | | }, DncEnums.WhetherArchive.not_Archive.getCode())).in((v0) -> { |
| | | return v0.getId(); |
| | | }, workstationFileIds)); |
| | | }, workstationFileIds));*/ |
| | | } |
| | | } |
| | | List<DncArtFileAddVO> factoryList = (List) dncArtFilesList.stream().filter(s3 -> { |
| | | List<DncArtFileAddVO> factoryList = dncArtFilesList.stream().filter(s3 -> { |
| | | return DncEnums.FileOwnership.FACTORY.getCode().equals(s3.getFileOwnership()); |
| | | }).collect(Collectors.toList()); |
| | | if (Func.isNotEmpty(factoryList)) { |
| | | List<Long> factoryIds = (List) factoryList.stream().map((v0) -> { |
| | | List<Long> factoryIds = factoryList.stream().map((v0) -> { |
| | | return v0.getFileId(); |
| | | }).distinct().collect(Collectors.toList()); |
| | | if (Func.isNotEmpty(factoryIds)) { |
| | | this.dncFactoryFileService |
| | | .update(Wrappers.<DncFactoryFile>lambdaUpdate().set(DncFactoryFile::getWhetherArchive, DncEnums.WhetherArchive.not_Archive.getCode()) |
| | | .in(DncFactoryFile::getId, factoryIds)); |
| | | /* |
| | | this.dncFactoryFileService.update((Wrapper) ((LambdaUpdateWrapper) Wrappers.lambdaUpdate().set((v0) -> { |
| | | return v0.getWhetherArchive(); |
| | | }, DncEnums.WhetherArchive.not_Archive.getCode())).in((v0) -> { |
| | | return v0.getId(); |
| | | }, factoryIds)); |
| | | }, factoryIds));*/ |
| | | } |
| | | } |
| | | addArtFile(dncArtFilesList); |
| | |
| | | |
| | | @Override // org.springblade.modules.dnc.service.IDncArtFileService |
| | | public List<DncArtFileVO> artFileList(String artBagId) { |
| | | List<DncArtFile> list = list(Wrappers.<DncArtFile>lambdaQuery() |
| | | .eq(DncArtFile::getArtBagId, artBagId) |
| | | .eq(DncArtFile::getIsCurrent, DncEnums.CurrentVersion.YES.getCode())); |
| | | /* |
| | | List<DncArtFile> list = list((Wrapper) ((LambdaQueryWrapper) Wrappers.lambdaQuery().eq((v0) -> { |
| | | return v0.getArtBagId(); |
| | | }, artBagId)).eq((v0) -> { |
| | | return v0.getIsCurrent(); |
| | | }, DncEnums.CurrentVersion.YES.getCode())); |
| | | List<DncArtFileVO> dncArtFileVOList = (List) Optional.ofNullable(DncArtFileConvert.INSTANCE.convert(list)).orElse(new ArrayList()); |
| | | }, DncEnums.CurrentVersion.YES.getCode()));*/ |
| | | List<DncArtFileVO> dncArtFileVOList = Optional.<List<DncArtFileVO>>ofNullable(DncArtFileConvert.INSTANCE.convert(list)).orElse(new ArrayList<>()); |
| | | dncArtFileVOList.forEach(dncArtFileVO -> { |
| | | User createUser = UserCache.getUser(dncArtFileVO.getCreateUser()); |
| | | dncArtFileVO.setCreateUserName(Func.isNotEmpty(createUser) ? createUser.getAccount() : ""); |
| | |
| | | |
| | | @Override // org.springblade.modules.dnc.service.IDncArtFileService |
| | | public boolean batchRemoveFile(List<String> ids) { |
| | | List<DncArtFile> list = list(Wrappers.<DncArtFile>lambdaQuery().in(DncArtFile::getId, ids)); |
| | | /* |
| | | List<DncArtFile> list = list((Wrapper) Wrappers.lambdaQuery().in((v0) -> { |
| | | return v0.getId(); |
| | | }, ids)); |
| | | }, ids));*/ |
| | | if (Func.isNotEmpty(list)) { |
| | | list.forEach(s -> { |
| | | DncArtBagLogDTO dncArtBagLogDTO = new DncArtBagLogDTO(); |
| | |
| | | } |
| | | |
| | | private DncArtFile getDncArtFile(Long artBagId, String fileName, Integer fileType) { |
| | | return getOne(Wrappers.<DncArtFile>lambdaQuery().eq(DncArtFile::getArtBagId, artBagId) |
| | | .eq(DncArtFile::getIsCurrent, DncEnums.CurrentVersion.YES.getCode()) |
| | | .eq(DncArtFile::getFileType, fileType) |
| | | .eq(DncArtFile::getFilename, fileName)); |
| | | /* |
| | | return (DncArtFile) getOne((Wrapper) ((LambdaQueryWrapper) ((LambdaQueryWrapper) ((LambdaQueryWrapper) Wrappers.lambdaQuery().eq((v0) -> { |
| | | return v0.getArtBagId(); |
| | | }, artBagId)).eq((v0) -> { |
| | |
| | | return v0.getFileType(); |
| | | }, fileType)).eq((v0) -> { |
| | | return v0.getFilename(); |
| | | }, fileName)); |
| | | }, fileName));*/ |
| | | } |
| | | |
| | | @Override // org.springblade.modules.dnc.service.IDncArtFileService |
| | |
| | | @Transactional(rollbackFor = {Exception.class}) |
| | | public Boolean syncFile(SyncArtCatalogVO syncArtCatalogVO) { |
| | | List<String> suffixes = this.fileService.getSuffix(); |
| | | |
| | | DncProcessCatalogue root = this.dncProcessCatalogueService.getOne(Wrappers.<DncProcessCatalogue>lambdaQuery() |
| | | .eq(DncProcessCatalogue::getParentId, Long.valueOf(Func.toLong(DncConstant.DNC_DEFAULT_PARENT_ID)))); |
| | | /* |
| | | DncProcessCatalogue root = (DncProcessCatalogue) this.dncProcessCatalogueService.getOne((Wrapper) Wrappers.lambdaQuery().eq((v0) -> { |
| | | return v0.getParentId(); |
| | | }, Long.valueOf(Func.toLong(DncConstant.DNC_DEFAULT_PARENT_ID)))); |
| | | }, Long.valueOf(Func.toLong(DncConstant.DNC_DEFAULT_PARENT_ID))));*/ |
| | | if (root != null) { |
| | | String path = syncArtCatalogVO.getCatalog(); |
| | | boolean result = path.startsWith("/"); |
| | | String catalog = "/" + root.getName() + (result ? "" : "/") + syncArtCatalogVO.getCatalog(); |
| | | if (Func.isNotBlank(catalog)) { |
| | | LinkedHashMap<String, String> nameMap = getNameMap(catalog); |
| | | nameMap.forEach(k, v -> { |
| | | nameMap.forEach((k, v) -> { |
| | | Map<String, SyncDncProcessCatalogueVO> map = getCatalogueNameMap(); |
| | | String parentPath = getParentName(k); |
| | | SyncDncProcessCatalogueVO parentCatalogue = map.get(parentPath); |
| | |
| | | if (syncDncProcessCatalogueVO != null) { |
| | | Long catalogued = syncDncProcessCatalogueVO.getId(); |
| | | List<DncArtBag> artBags = this.dncArtBagService.list(); |
| | | Map<String, DncArtBag> artBagMap = (Map) artBags.stream().collect(Collectors.toMap(s -> { |
| | | Map<String, DncArtBag> artBagMap = artBags.stream().collect(Collectors.toMap(s -> { |
| | | return s.getCode() + "#" + s.getName() + "#" + s.getCatalogueId(); |
| | | }, Function.identity())); |
| | | List<SyncArtBagVO> artBagList = syncArtCatalogVO.getArtBag(); |
| | |
| | | bag.setCatalogueId(catalogued); |
| | | this.dncArtBagService.save(bag); |
| | | } |
| | | DncArtBag currentArtBag = this.dncArtBagService.getOne(Wrappers.<DncArtBag>lambdaQuery() |
| | | .eq(DncArtBag::getCatalogueId, catalogued) |
| | | .eq(DncArtBag::getCode, s2.getCode()) |
| | | .eq(DncArtBag::getName, s2.getName())); |
| | | /* |
| | | DncArtBag currentArtBag = (DncArtBag) this.dncArtBagService.getOne((Wrapper) ((LambdaQueryWrapper) ((LambdaQueryWrapper) Wrappers.lambdaQuery().eq((v0) -> { |
| | | return v0.getCatalogueId(); |
| | | }, catalogued)).eq((v0) -> { |
| | | return v0.getCode(); |
| | | }, s2.getCode())).eq((v0) -> { |
| | | return v0.getName(); |
| | | }, s2.getName())); |
| | | }, s2.getName()));*/ |
| | | if (currentArtBag != null) { |
| | | addSync(currentArtBag, s2.getFileList(), suffixes); |
| | | } |
| | |
| | | |
| | | private Map<String, SyncDncProcessCatalogueVO> getCatalogueNameMap() { |
| | | List<DncProcessCatalogue> list = this.dncProcessCatalogueService.list(); |
| | | List<SyncDncProcessCatalogueVO> catalogues = (List) list.stream().map(s -> { |
| | | List<SyncDncProcessCatalogueVO> catalogues = list.stream().map(s -> { |
| | | SyncDncProcessCatalogueVO syncDncProcessCatalogueVO = new SyncDncProcessCatalogueVO(); |
| | | syncDncProcessCatalogueVO.setId(s.getId()); |
| | | syncDncProcessCatalogueVO.setName(s.getName()); |
| | |
| | | syncDncProcessCatalogueVO.setAllPathName(pathName(s.getAllPath(), list)); |
| | | return syncDncProcessCatalogueVO; |
| | | }).collect(Collectors.toList()); |
| | | return (Map) catalogues.stream().filter(s2 -> { |
| | | return catalogues.stream().filter(s2 -> { |
| | | return Func.isNotBlank(s2.getAllPathName()); |
| | | }).collect(Collectors.toMap((v0) -> { |
| | | return v0.getAllPathName(); |
| | |
| | | private void addSync(DncArtBag currentArtBag, List<SyncArtBagFileVO> fileList, List<String> suffixes) { |
| | | if (Func.isNotEmpty(fileList)) { |
| | | Long artBagId = currentArtBag.getId(); |
| | | List<DncArtFile> list = list((Wrapper) Wrappers.lambdaQuery().eq((v0) -> { |
| | | return v0.getArtBagId(); |
| | | }, artBagId)); |
| | | List<DncArtFile> list = list(Wrappers.<DncArtFile>lambdaQuery().eq(DncArtFile::getArtBagId, artBagId)); |
| | | |
| | | if (Func.isEmpty(list)) { |
| | | saveBatch(addDncArtFiles(artBagId, fileList, suffixes)); |
| | | return; |
| | | } |
| | | List<SyncArtBagFileVO> files = new ArrayList<>(); |
| | | Map<String, DncArtFile> dncArtFileMap = (Map) list.stream().filter(c -> { |
| | | Map<String, DncArtFile> dncArtFileMap = list.stream().filter(c -> { |
| | | return DncEnums.CurrentVersion.YES.getCode().equals(c.getIsCurrent()); |
| | | }).collect(Collectors.toMap(s -> { |
| | | return s.getArtBagId() + "$" + s.getFilename(); |
| | |
| | | |
| | | private List<DncArtFile> addDncArtFiles(Long artBagId, List<SyncArtBagFileVO> fileList, List<String> suffixes) { |
| | | boolean notSuffix = suffixes.contains(CommonConstant.NOT_SUFFIX); |
| | | return (List) fileList.stream().map(s -> { |
| | | return fileList.stream().map(s -> { |
| | | DncArtFile dncArtFile = new DncArtFile(); |
| | | dncArtFile.setArtBagId(artBagId); |
| | | dncArtFile.setLink(s.getFileLink()); |
| | |
| | | } |
| | | |
| | | private String pathName(String pathIds, List<DncProcessCatalogue> list) { |
| | | Map<Long, DncProcessCatalogue> catalogueMap = (Map) list.stream().collect(Collectors.toMap((v0) -> { |
| | | Map<Long, DncProcessCatalogue> catalogueMap = list.stream().collect(Collectors.toMap((v0) -> { |
| | | return v0.getId(); |
| | | }, Function.identity())); |
| | | String[] split = pathIds.split("/"); |