| | |
| | | @Slf4j |
| | | public class SupplierController extends BaseController { |
| | | |
| | | private static final R ALLOWED_CONTENT_TYPES = R.valueOf("jpg"); |
| | | // private static final R ALLOWED_CONTENT_TYPES = R.valueOf("jpg"); |
| | | private final SupplierService supplierService; |
| | | |
| | | public SupplierController(SupplierService supplierService) { |
| | |
| | | |
| | | // 2. 检查文件类型 |
| | | String contentType = avatar.getContentType(); |
| | | if (!ALLOWED_CONTENT_TYPES.contains(contentType)) { |
| | | throw new ValidationException("不支持的文件类型"); |
| | | } |
| | | // if (!ALLOWED_CONTENT_TYPES.contains(contentType)) { |
| | | // throw new ValidationException("不支持的文件类型"); |
| | | // } |
| | | |
| | | // 3. 生成文件名 |
| | | String fileName = "avatar/" + UUID.randomUUID().toString() + |