| | |
| | | import com.oying.service.LocalStorageService; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | | import java.util.ArrayList; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | /** |
| | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public LocalStorage create(String name, MultipartFile multipartFile) { |
| | | FileUtil.checkSize(properties.getMaxSize(), multipartFile.getSize()); |
| | | FileUtil.checkSize(0, multipartFile.getSize()); |
| | | String suffix = FileUtil.getExtensionName(multipartFile.getOriginalFilename()); |
| | | String type = FileUtil.getFileType(suffix); |
| | | File file = FileUtil.upload(multipartFile, properties.getPath().getPath() + type + File.separator); |