| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import com.ruoyi.common.enums.FileNameType; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.constant.Constants; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.UUID; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Service |
| | | @RequiredArgsConstructor |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 将审批单上的附件记录复制为多条发货台账附件(同一文件路径,每条发货台账各一条记录)。 |
| | | */ |
| | | public void copyApproveProcessShipAttachmentsToShippingInfos(Long approveProcessId, List<Long> shippingInfoIds) { |
| | | if (approveProcessId == null || CollectionUtils.isEmpty(shippingInfoIds)) { |
| | | return; |
| | | } |
| | | List<CommonFile> files = commonFileMapper.selectList(new LambdaQueryWrapper<CommonFile>() |
| | | .eq(CommonFile::getCommonId, approveProcessId) |
| | | .eq(CommonFile::getType, FileNameType.ApproveProcess.getValue())); |
| | | if (CollectionUtils.isEmpty(files)) { |
| | | return; |
| | | } |
| | | List<Long> distinctTargets = shippingInfoIds.stream().filter(java.util.Objects::nonNull).distinct().collect(Collectors.toList()); |
| | | for (Long sid : distinctTargets) { |
| | | for (CommonFile f : files) { |
| | | CommonFile copy = new CommonFile(); |
| | | copy.setCommonId(sid); |
| | | copy.setName(f.getName()); |
| | | copy.setUrl(f.getUrl()); |
| | | copy.setLink(f.getLink()); |
| | | copy.setType(FileNameType.SHIP.getValue()); |
| | | copy.setCreateTime(LocalDateTime.now()); |
| | | commonFileMapper.insert(copy); |
| | | } |
| | | } |
| | | } |
| | | |
| | | private String buildAccessLink(Path formalFilePath) { |
| | | String normalizedPath = formalFilePath.toString().replace("\\", "/"); |
| | | String profile = RuoYiConfig.getProfile(); |