forked from kidgrow-microservices-platform

zxh
2020-08-31 3846736bb8466edd1058b2f65220c1895d1f2b70
kidgrow-business/kidgrow-filecenter/kidgrow-filecenter-server/src/main/java/com/kidgrow/filecenter/controller/FileController.java
@@ -12,6 +12,8 @@
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.util.Map;
/**
@@ -83,6 +85,20 @@
        }
        return fileService.baseDownLoad(map);
    }
    /**
     * byte[]上传
     */
    @PostMapping(value="byteUplaod",produces = {MediaType.APPLICATION_JSON_UTF8_VALUE},consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
    public FileInfo byteUplaod(@RequestParam("fileName") String fileName,@RequestParam("byte[]") byte[] bytes){
        if(bytes.length == 0){
            return null;
        }
        if (com.kidgrow.common.utils.StringUtils.isBlank(fileName)) {
            return null;
        }
        InputStream inputStream = new ByteArrayInputStream(bytes);
        return fileService.byteUplaod(fileName,inputStream,bytes.length);
    }
    /**
     * 文件删除