Skip to content

Commit

Permalink
Chore: 큐시트 파일 업로드 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
yby654321 committed Oct 29, 2023
1 parent 297c2be commit e31f7be
Showing 1 changed file with 50 additions and 35 deletions.
85 changes: 50 additions & 35 deletions nw/src/main/java/lab/cherry/nw/service/Impl/QsheetServiceImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import lab.cherry.nw.error.enums.ErrorCode;
import lab.cherry.nw.error.exception.CustomException;
import lab.cherry.nw.error.exception.EntityNotFoundException;
import lab.cherry.nw.model.FileEntity;
import lab.cherry.nw.model.OrgEntity;
import lab.cherry.nw.model.QsheetEntity;
import lab.cherry.nw.model.QsheetEntity.ItemData;
Expand Down Expand Up @@ -110,22 +111,32 @@ public void createQsheet(QsheetEntity.QsheetCreateDto qsheetCreateDto, List<Mult

for (ItemData data : qsheetCreateDto.getData()) {
for (String filePath : fileUrls) {
if (filePath.contains(data.getFilePath())) {
ItemData tempData = ItemData.builder()
.orderIndex(data.getOrderIndex())
.process(data.getProcess())
.content(data.getContent())
.actor(data.getActor())
.note(data.getNote())
.filePath(filePath)
.build();
data = tempData;
break;
String[] parts = filePath.split("/");
String fileId = parts[parts.length - 1];
FileEntity fileEntity = fileService.findById(fileId);
if( fileEntity != null ) {
if (fileEntity.getName().contains(data.getFilePath())){
ItemData tempData = ItemData.builder()
.orderIndex(data.getOrderIndex())
.process(data.getProcess())
.content(data.getContent())
.actor(data.getActor())
.note(data.getNote())
.filePath(filePath)
.build();
data = tempData;
break;

}


}

}
newItemData.add(data);
}
}else{
}

} else {
newItemData = qsheetCreateDto.getData();
}

Expand Down Expand Up @@ -190,34 +201,38 @@ public void updateById(String id, QsheetEntity.QsheetUpdateDto qsheetUpdateDto,

for (ItemData data : qsheetUpdateDto.getData()) {
for (String filePath : fileUrls) {
if (filePath.contains(data.getFilePath())) {
ItemData tempData = ItemData.builder()
.orderIndex(data.getOrderIndex())
.process(data.getProcess())
.content(data.getContent())
.actor(data.getActor())
.note(data.getNote())
.filePath(filePath)
.build();
data = tempData;
break;
String[] parts = filePath.split("/");
String fileId = parts[parts.length - 1];
FileEntity fileEntity = fileService.findById(fileId);
if(fileEntity != null){
if (fileEntity.getName().contains(data.getFilePath())){
ItemData tempData = ItemData.builder()
.orderIndex(data.getOrderIndex())
.process(data.getProcess())
.content(data.getContent())
.actor(data.getActor())
.note(data.getNote())
.filePath(filePath)
.build();
data = tempData;
break;
}
}
newItemData.add(data);

}
}
newItemData.add(data);
}


}else if(qsheetUpdateDto.getData()!=null && files==null){
newItemData= new ArrayList<>();
for(ItemData data : qsheetUpdateDto.getData()){
ItemData tempData = ItemData.builder()
.orderIndex(data.getOrderIndex())
.process(data.getProcess())
.content(data.getContent())
.actor(data.getActor())
.note(data.getNote())
.filePath(data.getFilePath())
.build();
.orderIndex(data.getOrderIndex())
.process(data.getProcess())
.content(data.getContent())
.actor(data.getActor())
.note(data.getNote())
.filePath(data.getFilePath())
.build();
newItemData.add(tempData);
}
}
Expand Down

0 comments on commit e31f7be

Please sign in to comment.