Commit 37feffd7 authored by frank.xa.zhang's avatar frank.xa.zhang

add attachment file upload function -- frank

parent 470d28f3
......@@ -519,7 +519,7 @@ public class OrganizationHKServiceImpl {
public OperationResultDto<Object> uploadAttachs(CommonsMultipartFile[] files, String orgId) {
logger.debug("OrganizationHKServiceImpl uploadAttachs start");
OperationResultDto<Object> result = new OperationResultDto<>();
List<OrganizationAttachment> organizationAttachments = new ArrayList<>();
List<OrganizationAttachmentDto> organizationAttachments = new ArrayList<>();
for (CommonsMultipartFile file : files) {
final String orginalName = file.getOriginalFilename();
logger.debug("orgianal file name[{}]", orginalName);
......@@ -561,7 +561,7 @@ public class OrganizationHKServiceImpl {
logger.debug("save file in database");
OrganizationAttachment organizationAttachment = saveOrgAttachments(filePath, filePathToSave, fileNameToSave, orgId, file, fileExtension);
organizationAttachments.add(organizationAttachment);
organizationAttachments.add(organizationAttachmentTMapper.toOrganizationAttachmentDto(organizationAttachment));
}
if (CollectionUtils.isEmpty(organizationAttachments)) {
......@@ -608,7 +608,7 @@ public class OrganizationHKServiceImpl {
public void downloadAttachment(HttpServletRequest request, HttpServletResponse response, Long attachmentId) {
OrganizationAttachment attachment = organizationAttachmentMapper.selectByPrimaryKey(attachmentId);
Assert.notNull(attachment, "attachemtn is null");
Assert.notNull(attachment, "attachment is null");
String fileName = attachment.getDocumentName();
String filePath = fileDirectory +"/"+ attachment.getDocumentPath();
FileExcelUtil.downloadFile(request, response, fileName, filePath);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment