|
|
@ -83,7 +83,7 @@ public class UploadInformationDomainServiceImpl implements UploadInformationDoma |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
public Result<String> batchUploadAndOverwrite(MultipartFile[] files, Long subLineId) throws Exception { |
|
|
public Result<String> batchUploadAndOverwrite(MultipartFile[] files, Long subLineId, Boolean skipExisting) throws Exception { |
|
|
if (Objects.isNull(subLineId)) { |
|
|
if (Objects.isNull(subLineId)) { |
|
|
throw new BusinessErrorException("所属子产品线id不能为空"); |
|
|
throw new BusinessErrorException("所属子产品线id不能为空"); |
|
|
} |
|
|
} |
|
|
@ -98,10 +98,17 @@ public class UploadInformationDomainServiceImpl implements UploadInformationDoma |
|
|
Map<Long, MultipartFile> fileMap = new HashMap<>(); |
|
|
Map<Long, MultipartFile> fileMap = new HashMap<>(); |
|
|
for (MultipartFile file : files) { |
|
|
for (MultipartFile file : files) { |
|
|
String fileName = file.getOriginalFilename(); |
|
|
String fileName = file.getOriginalFilename(); |
|
|
// 删掉原来的
|
|
|
|
|
|
informationBaseService.remove(new LambdaQueryWrapper<InformationEntity>() |
|
|
LambdaQueryWrapper<InformationEntity> wrapper = new LambdaQueryWrapper<InformationEntity>() |
|
|
.eq(InformationEntity::getSubLineId, subLineId) |
|
|
.eq(InformationEntity::getSubLineId, subLineId) |
|
|
.eq(InformationEntity::getName, fileName)); |
|
|
.eq(InformationEntity::getName, fileName); |
|
|
|
|
|
long count = informationBaseService.count(wrapper); |
|
|
|
|
|
//如果存在重复的,并且是跳过则不做处理
|
|
|
|
|
|
if (count > 0 && skipExisting) { |
|
|
|
|
|
continue; |
|
|
|
|
|
} |
|
|
|
|
|
// 删掉原来的
|
|
|
|
|
|
informationBaseService.remove(wrapper); |
|
|
String filePath = String.format("%s/%s/%s.%s", |
|
|
String filePath = String.format("%s/%s/%s.%s", |
|
|
subLineId, |
|
|
subLineId, |
|
|
DateUtil.format(new Date(), "yyyyMMdd"), |
|
|
DateUtil.format(new Date(), "yyyyMMdd"), |
|
|
|