|
@@ -367,29 +367,31 @@ public class SpecimenInfoServiceImpl implements SpecimenInfoService {
|
|
|
respVO.getFailureSpecimenNumbers().put(importSpecimen.getSpecimenNumber(), "图片名称格式不正确");
|
|
|
return;
|
|
|
}
|
|
|
-
|
|
|
- String[] names = importSpecimen.getImageName().split("、");
|
|
|
List<String> imagePathSet = new ArrayList<>();
|
|
|
- for (String importName : names) {
|
|
|
- File imageFile = findImageInTempDir(tempDir, importName);
|
|
|
- if (imageFile != null) {
|
|
|
- try {
|
|
|
- byte[] imageBytes = Files.readAllBytes(imageFile.toPath());
|
|
|
- String imagePath = fileApi.createFile(imageBytes);
|
|
|
- imagePathSet.add(imagePath);
|
|
|
- respVO.getCreateSpecimenImages().add(importName);
|
|
|
- // 处理上传后的路径,如存储到数据库或更新状态等
|
|
|
- } catch (IOException e) {
|
|
|
- respVO.getFailureSpecimenImages().put(importName, "图片上传失败");
|
|
|
+ if(importSpecimen.getImageName() != null){
|
|
|
+ String[] names = importSpecimen.getImageName().split("、");
|
|
|
+ for (String importName : names) {
|
|
|
+ File imageFile = findImageInTempDir(tempDir, importName);
|
|
|
+ if (imageFile != null) {
|
|
|
+ try {
|
|
|
+ byte[] imageBytes = Files.readAllBytes(imageFile.toPath());
|
|
|
+ String imagePath = fileApi.createFile(imageBytes);
|
|
|
+ imagePathSet.add(imagePath);
|
|
|
+ respVO.getCreateSpecimenImages().add(importName);
|
|
|
+ // 处理上传后的路径,如存储到数据库或更新状态等
|
|
|
+ } catch (IOException e) {
|
|
|
+ respVO.getFailureSpecimenImages().put(importName, "图片上传失败");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ respVO.getFailureSpecimenImages().put(importSpecimen.getSpecimenNumber(), "图片不存在压缩包中");
|
|
|
+ }
|
|
|
+ if (existSpecimen != null && imagePathSet.isEmpty()) {
|
|
|
+ imagePathSet = BeanUtils.toBean(existSpecimen, SpecimenInfoRespVO.class).getImagePath();
|
|
|
}
|
|
|
- } else {
|
|
|
- respVO.getFailureSpecimenImages().put(importSpecimen.getSpecimenNumber(), "图片不存在压缩包中");
|
|
|
- }
|
|
|
- if (existSpecimen != null && imagePathSet.isEmpty()) {
|
|
|
- imagePathSet = BeanUtils.toBean(existSpecimen, SpecimenInfoRespVO.class).getImagePath();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
// 处理文献资料字段,如果为空就赋值 <br>
|
|
|
if (importSpecimen.getDescription() == null || importSpecimen.getDescription().trim().isEmpty()) {
|
|
|
importSpecimen.setDescription("<p><br></p>");
|
|
@@ -417,8 +419,11 @@ public class SpecimenInfoServiceImpl implements SpecimenInfoService {
|
|
|
// 更新逻辑
|
|
|
SpecimenInfoDO updateSpecimen = BeanUtils.toBean(importSpecimen, SpecimenInfoDO.class);
|
|
|
|
|
|
-
|
|
|
- updateSpecimen.setImagePath(imagePathSet.toString());
|
|
|
+ if(imagePathSet != null){
|
|
|
+ updateSpecimen.setImagePath(imagePathSet.toString());
|
|
|
+ }else {
|
|
|
+ updateSpecimen.setImagePath(null);
|
|
|
+ }
|
|
|
if (updateType != -1) {
|
|
|
updateSpecimen.setSpecimenType(updateType);
|
|
|
}
|