| | |
| | | import cc.mrbird.febs.common.entity.FebsResponse; |
| | | import cc.mrbird.febs.common.entity.QueryRequest; |
| | | import cc.mrbird.febs.common.enumerates.DataDictionaryEnum; |
| | | import cc.mrbird.febs.common.exception.FebsException; |
| | | import cc.mrbird.febs.common.utils.FileUtil; |
| | | import cc.mrbird.febs.common.utils.OssUtils; |
| | | import cc.mrbird.febs.mall.dto.*; |
| | |
| | | |
| | | private final IAdminMallGoodsService adminMallGoodsService; |
| | | private final DataDictionaryCustomMapper dataDictionaryCustomMapper; |
| | | |
| | | // 文件保存目录URL |
| | | @Value("${static.resource.ai.common}") |
| | | private String commonPath; |
| | | // 文件保存目录URL |
| | | @Value("${static.resource.ai.company}") |
| | | private String companyPath; |
| | | @ControllerEndpoint(operation = "文件上传服务器", exceptionMessage = "上传失败") |
| | | @PostMapping(value = "/fileUploadEsc") |
| | | public Map<String,Object> fileUploadEsc(@RequestBody @Validated MultipartFile file) throws IOException { |
| | | if (file == null) { |
| | | throw new FebsException("上传文件不能为空"); |
| | | } |
| | | |
| | | String path = commonPath; |
| | | String companyId = getCurrentUserCompanyId(); |
| | | if (StrUtil.isNotEmpty(companyId)){ |
| | | path = companyPath + companyId+"/"; |
| | | } |
| | | return FileUtil.fileUploadEsc(file,null,path); |
| | | } |
| | | |
| | | // /** |
| | | // * 图片上传 |
| | |
| | | String base64Str = java.util.Base64.getEncoder().encodeToString(fileBytes); |
| | | String imageSuffix = "." + file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".") + 1); |
| | | String imageNames = System.currentTimeMillis() + IdUtil.simpleUUID() + imageSuffix; |
| | | String imageName = "hc/" + imageNames; |
| | | String imageName = "clothes/" + imageNames; |
| | | OssUtils.uploadFileWithBase64(base64Str, imageName); |
| | | String bucket_name = "https://excoin.oss-cn-hangzhou.aliyuncs.com"; |
| | | String url = bucket_name + "/" + imageName; |