Skip to content

Commit

Permalink
Merge pull request #40 from lab-cherry/develop
Browse files Browse the repository at this point in the history
Fix: QSheet File Updated
  • Loading branch information
taking authored Oct 17, 2023
2 parents 1676565 + 534280e commit 700f46a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package lab.cherry.nw.configuration.bean;

import lab.cherry.nw.service.security.CustomUserDetailsService;
import lombok.RequiredArgsConstructor;
import java.util.Arrays;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.mongodb.core.mapping.event.ValidatingMongoEventListener;
Expand All @@ -16,8 +15,8 @@
import org.springframework.web.cors.CorsConfigurationSource;
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
import org.yaml.snakeyaml.Yaml;

import java.util.Arrays;
import lab.cherry.nw.service.security.CustomUserDetailsService;
import lombok.RequiredArgsConstructor;

/**
* <pre>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,6 @@ public ResponseEntity<?> downloadQsheetBySeq(@RequestBody QsheetEntity.QsheetDow

HttpHeaders headers = new HttpHeaders();
headers.add(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=" + "download.zip");

return new ResponseEntity<>(qsheetService.download(qsheetDownloadDto.getUser()), new HttpHeaders(), HttpStatus.OK);

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ public void updateById(String id, QsheetEntity.QsheetUpdateDto qsheetUpdateDto,
// .org_confirm(qsheetUpdateDto.getFinalConfirm().isOrg_confirm()==!(qsheetEntity.getFinalConfirm().isOrg_confirm())?qsheetUpdateDto.getFinalConfirm().isOrg_confirm():qsheetEntity.getFinalConfirm().isOrg_confirm())
// .client_confirm(qsheetUpdateDto.getFinalConfirm().isClient_confirm()==!(qsheetEntity.getFinalConfirm().isClient_confirm())?qsheetUpdateDto.getFinalConfirm().isClient_confirm():qsheetEntity.getFinalConfirm().isClient_confirm())
// .build():qsheetEntity.getFinalConfirm() )
.memo(qsheetUpdateDto.getMemo())
.memo(qsheetUpdateDto.getMemo() != null ? qsheetUpdateDto.getMemo() : qsheetEntity.getMemo())
.updated_at(instant)
.build();
qsheetRepository.save(qsheetEntity);
Expand Down Expand Up @@ -340,17 +340,20 @@ public byte[] download(List<String> users) {
List<byte[]> userData = new ArrayList<>();

for(String user : users) {

if (userService.checkId(user)) {
UserEntity _user = userService.findById(user);
userList.add(_user);

String objectName = _user.getId() +"/";
userData.add(fileService.downloadZip("user", objectName));
// String objectName = _user.getId() + "/";
// userData.add(fileService.downloadZip("user", objectName));
}
}

if(userList.size() > 1) {

log.error("userList 가 1명 초과인 경우 # ", userList.size());

ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
try (ZipOutputStream zipOut = new ZipOutputStream(byteArrayOutputStream)) {
for (UserEntity user : userList) {
Expand Down Expand Up @@ -380,7 +383,7 @@ public byte[] download(List<String> users) {

String objectName = "사용자/" + user.getId();

return fileService.downloadZip(user.getOrg().getId(), objectName);
return fileService.downloadZip("user", objectName);
}
}
}

0 comments on commit 700f46a

Please sign in to comment.