| @@ -8,6 +8,7 @@ import com.fasterxml.jackson.databind.module.SimpleModule; | |||
| import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; | |||
| import com.iformall.interceptor.HttpServletRequestWrapperFilter; | |||
| import com.iformall.interceptor.RequestInterceptor; | |||
| import com.iformall.service.MallResourceService; | |||
| import com.iformall.ueditor.ActionEnter; | |||
| import com.iformall.ueditor.ConfigManager; | |||
| import com.iformall.ueditor.UEditorConfig; | |||
| @@ -44,10 +45,13 @@ public class WebConfig implements WebMvcConfigurer { | |||
| @Autowired | |||
| private RequestInterceptor requestInterceptor; | |||
| @Autowired | |||
| private MallResourceService mallResourceService; | |||
| @Bean | |||
| @ConditionalOnMissingBean(ActionEnter.class) | |||
| public ActionEnter actionEnter() { | |||
| ActionEnter actionEnter = new ActionEnter(ConfigManager.getInstance(uEditorConfig, awsProperty)); | |||
| ActionEnter actionEnter = new ActionEnter(ConfigManager.getInstance(uEditorConfig, awsProperty, mallResourceService)); | |||
| return actionEnter; | |||
| } | |||
| @@ -8,12 +8,12 @@ import com.amazonaws.auth.AWSCredentialsProvider; | |||
| import com.amazonaws.auth.BasicAWSCredentials; | |||
| import com.amazonaws.services.s3.AmazonS3; | |||
| import com.amazonaws.services.s3.AmazonS3ClientBuilder; | |||
| import com.amazonaws.services.s3.model.CannedAccessControlList; | |||
| import com.amazonaws.services.s3.model.ObjectMetadata; | |||
| import com.amazonaws.services.s3.model.PutObjectRequest; | |||
| import com.amazonaws.services.s3.model.*; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.config.AwsProperty; | |||
| import com.iformall.controller.base.BaseController; | |||
| import com.iformall.domain.po.MallResource; | |||
| import com.iformall.service.MallResourceService; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.slf4j.Logger; | |||
| @@ -41,9 +41,12 @@ public class UploadController extends BaseController { | |||
| @Autowired | |||
| private AwsProperty awsProperty; | |||
| @Autowired | |||
| private MallResourceService mallResourceService; | |||
| private AmazonS3 s3 = null; | |||
| private ResultData awsUpload(MultipartFile multiReq, ObjectMetadata metadata, String fileName) { | |||
| private ResultData awsUpload(MultipartFile multiReq, ObjectMetadata metadata, String fileName, String tenantId) { | |||
| ResultData data = new ResultData(); | |||
| try { | |||
| if(s3 == null) { | |||
| @@ -69,6 +72,13 @@ public class UploadController extends BaseController { | |||
| URL url = s3.getUrl(awsProperty.getBucketName(), fileName); | |||
| logger.info(url.toString()); | |||
| MallResource mr = new MallResource(); | |||
| mr.setTenantId(tenantId); | |||
| mr.setBucket(awsProperty.getBucketName()); | |||
| mr.setS3Key(fileName); | |||
| mr.setUrl(url.toString()); | |||
| mallResourceService.saveOrUpdate(mr); | |||
| data.code = ResultData.SUCCESS; | |||
| Map<String, String> map = new HashMap<>(); | |||
| map.put("url", url.toString()); | |||
| @@ -128,7 +138,7 @@ public class UploadController extends BaseController { | |||
| fileName = getTenantId() + "/" + fileName; | |||
| } | |||
| ResultData data = awsUpload(multiReq, metadata, fileName); | |||
| ResultData data = awsUpload(multiReq, metadata, fileName, getTenantId()); | |||
| return data; | |||
| } | |||
| @@ -167,7 +177,7 @@ public class UploadController extends BaseController { | |||
| fileName = getTenantId() + "/" + fileName; | |||
| } | |||
| ResultData data1 = awsUpload(multipartFile, metadata, fileName); | |||
| ResultData data1 = awsUpload(multipartFile, metadata, fileName, getTenantId()); | |||
| if(data1.code == ResultData.SUCCESS) { | |||
| Map _data = (Map)data1.data; | |||
| map.put("url", (String) _data.get("url")); | |||
| @@ -205,7 +215,7 @@ public class UploadController extends BaseController { | |||
| String fileName = multiReq.getOriginalFilename(); | |||
| fileName = "cimg/" + fileName; | |||
| ResultData data = awsUpload(multiReq, metadata, fileName); | |||
| ResultData data = awsUpload(multiReq, metadata, fileName, "cimg"); | |||
| return data; | |||
| } | |||
| @@ -69,7 +69,7 @@ public class ActionEnter { | |||
| case ActionMap.UPLOAD_VIDEO: | |||
| case ActionMap.UPLOAD_FILE: | |||
| conf = this.configManager.getConfig(actionCode); | |||
| state = new Uploader(request, conf).doExec(); | |||
| state = new Uploader(request, conf, configManager.getMallResourceService()).doExec(); | |||
| break; | |||
| case ActionMap.CATCH_IMAGE: | |||
| @@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONArray; | |||
| import com.alibaba.fastjson.JSONException; | |||
| import com.alibaba.fastjson.JSONObject; | |||
| import com.iformall.config.AwsProperty; | |||
| import com.iformall.service.MallResourceService; | |||
| import com.iformall.ueditor.define.ActionMap; | |||
| import java.io.*; | |||
| @@ -28,13 +29,15 @@ public final class ConfigManager { | |||
| //配置信息 | |||
| private UEditorConfig uEditorConfig; | |||
| private AwsProperty awsProperty; | |||
| private MallResourceService mallResourceService; | |||
| /* | |||
| * 通过一个给定的路径构建一个配置管理器, 该管理器要求地址路径所在目录下必须存在config.properties文件 | |||
| */ | |||
| private ConfigManager(UEditorConfig uEditorConfig, AwsProperty awsProperty) throws IOException { | |||
| private ConfigManager(UEditorConfig uEditorConfig, AwsProperty awsProperty, MallResourceService mallResourceService) throws IOException { | |||
| this.uEditorConfig = uEditorConfig; | |||
| this.awsProperty = awsProperty; | |||
| this.mallResourceService = mallResourceService; | |||
| String configPath = uEditorConfig.getConfig(); | |||
| configPath = configPath == null || configPath.isEmpty() ? configFileName : configPath; | |||
| this.initEnv(configPath); | |||
| @@ -46,10 +49,10 @@ public final class ConfigManager { | |||
| * @param uEditorConfig 配置文件 | |||
| * @return 配置管理器实例或者null | |||
| */ | |||
| public static ConfigManager getInstance(UEditorConfig uEditorConfig, AwsProperty awsProperty) { | |||
| public static ConfigManager getInstance(UEditorConfig uEditorConfig, AwsProperty awsProperty, MallResourceService mallResourceService) { | |||
| try { | |||
| return new ConfigManager(uEditorConfig, awsProperty); | |||
| return new ConfigManager(uEditorConfig, awsProperty, mallResourceService); | |||
| } catch (Exception e) { | |||
| System.err.println("UEditor ConfigManager load error~"); | |||
| return null; | |||
| @@ -57,6 +60,14 @@ public final class ConfigManager { | |||
| } | |||
| public MallResourceService getMallResourceService() { | |||
| return mallResourceService; | |||
| } | |||
| public void setMallResourceService(MallResourceService mallResourceService) { | |||
| this.mallResourceService = mallResourceService; | |||
| } | |||
| // 验证配置文件加载是否正确 | |||
| public boolean valid() { | |||
| return this.jsonConfig != null; | |||
| @@ -12,6 +12,8 @@ import com.amazonaws.services.s3.AmazonS3ClientBuilder; | |||
| import com.amazonaws.services.s3.model.CannedAccessControlList; | |||
| import com.amazonaws.services.s3.model.ObjectMetadata; | |||
| import com.amazonaws.services.s3.model.PutObjectRequest; | |||
| import com.iformall.domain.po.MallResource; | |||
| import com.iformall.service.MallResourceService; | |||
| import com.iformall.shiro.UserSession; | |||
| import com.iformall.ueditor.define.BaseState; | |||
| import com.iformall.ueditor.define.State; | |||
| @@ -33,11 +35,13 @@ public class Uploader { | |||
| private HttpServletRequest request = null; | |||
| private Map<String, Object> conf = null; | |||
| private MallResourceService mallResourceService = null; | |||
| private AmazonS3 s3 = null; | |||
| public Uploader(HttpServletRequest request, Map<String, Object> conf) { | |||
| public Uploader(HttpServletRequest request, Map<String, Object> conf, MallResourceService mallResourceService) { | |||
| this.request = request; | |||
| this.conf = conf; | |||
| this.mallResourceService = mallResourceService; | |||
| this.s3 = AmazonS3ClientBuilder.standard() | |||
| .withRegion(conf.get("clientRegion").toString()) | |||
| .withCredentials(new AWSCredentialsProvider() { | |||
| @@ -89,7 +93,15 @@ public class Uploader { | |||
| .withCannedAcl(CannedAccessControlList.PublicRead)); | |||
| URL url = s3.getUrl(conf.get("bucketName").toString(), fileName); | |||
| //logger.info(url.toString()); | |||
| state.putInfo("url", url.toString()); | |||
| MallResource mr = new MallResource(); | |||
| mr.setTenantId(tenantId); | |||
| mr.setBucket(conf.get("bucketName").toString()); | |||
| mr.setS3Key(fileName); | |||
| mr.setUrl(url.toString()); | |||
| mallResourceService.saveOrUpdate(mr); | |||
| } catch (AmazonServiceException ase) { | |||
| /* | |||
| logger.warn("Caught an AmazonServiceException, which " + | |||
| @@ -0,0 +1,9 @@ | |||
| DROP TABLE IF EXISTS `mall_resource` ; | |||
| CREATE TABLE `mall_resource` ( | |||
| `id` bigint(64) NOT NULL, | |||
| `tenant_id` varchar(50) DEFAULT NULL COMMENT '租户ID', | |||
| `bucket` varchar(20) DEFAULT '' COMMENT 'bucket名称', | |||
| `s3_key` varchar(100) DEFAULT NULL COMMENT 's3 key', | |||
| `url` varchar(1024) DEFAULT NULL COMMENT 's3 url', | |||
| PRIMARY KEY (`id`) | |||
| ) ENGINE=`InnoDB` ROW_FORMAT=DYNAMIC COMMENT='资源表' CHECKSUM=0 DELAY_KEY_WRITE=0; | |||
| @@ -13,6 +13,8 @@ import com.amazonaws.services.s3.model.ObjectMetadata; | |||
| import com.amazonaws.services.s3.model.PutObjectRequest; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.config.AwsProperty; | |||
| import com.iformall.domain.po.MallResource; | |||
| import com.iformall.service.MallResourceService; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.slf4j.Logger; | |||
| @@ -38,9 +40,12 @@ public class UploadController extends BaseController { | |||
| @Autowired | |||
| private AwsProperty awsProperty; | |||
| @Autowired | |||
| private MallResourceService mallResourceService; | |||
| private AmazonS3 s3 = null; | |||
| private ResultData awsUpload(MultipartFile multiReq, ObjectMetadata metadata, String fileName) { | |||
| private ResultData awsUpload(MultipartFile multiReq, ObjectMetadata metadata, String fileName, String tenantId) { | |||
| ResultData data = new ResultData(); | |||
| try { | |||
| if (s3 == null) { | |||
| @@ -66,6 +71,13 @@ public class UploadController extends BaseController { | |||
| URL url = s3.getUrl(awsProperty.getBucketName(), fileName); | |||
| logger.info(url.toString()); | |||
| MallResource mr = new MallResource(); | |||
| mr.setTenantId(tenantId); | |||
| mr.setBucket(awsProperty.getBucketName()); | |||
| mr.setS3Key(fileName); | |||
| mr.setUrl(url.toString()); | |||
| mallResourceService.saveOrUpdate(mr); | |||
| data.code = ResultData.SUCCESS; | |||
| Map<String, String> map = new HashMap<>(); | |||
| map.put("url", url.toString()); | |||
| @@ -125,7 +137,7 @@ public class UploadController extends BaseController { | |||
| fileName = getTenantId() + "/" + fileName; | |||
| } | |||
| ResultData data = awsUpload(multiReq, metadata, fileName); | |||
| ResultData data = awsUpload(multiReq, metadata, fileName, getTenantId()); | |||
| return data; | |||
| } | |||
| @@ -164,7 +176,7 @@ public class UploadController extends BaseController { | |||
| fileName = getTenantId() + "/" + fileName; | |||
| } | |||
| ResultData data1 = awsUpload(multipartFile, metadata, fileName); | |||
| ResultData data1 = awsUpload(multipartFile, metadata, fileName, getTenantId()); | |||
| if (data1.code == ResultData.SUCCESS) { | |||
| Map _data = (Map) data1.data; | |||
| map.put("url", (String) _data.get("url")); | |||
| @@ -183,27 +195,4 @@ public class UploadController extends BaseController { | |||
| } | |||
| return new ResultData(); | |||
| } | |||
| /** | |||
| * C端上传图片文件 | |||
| * | |||
| * @param multiReq | |||
| * @return | |||
| * @throws Exception | |||
| */ | |||
| @PostMapping(value = "/cimgUpload", consumes = "multipart/*", headers = "content-type=multipart/form-data") | |||
| @ApiOperation("C端上传图片文件") | |||
| public ResultData cimgUpload(@RequestParam("file") MultipartFile multiReq) { | |||
| logger.info("[" + getIpAddr() + "] UploadController::cimgUpload"); | |||
| ObjectMetadata metadata = new ObjectMetadata(); | |||
| metadata.setContentType(multiReq.getContentType()); | |||
| metadata.setContentLength(multiReq.getSize()); | |||
| String fileName = multiReq.getOriginalFilename(); | |||
| fileName = "cimg/" + fileName; | |||
| ResultData data = awsUpload(multiReq, metadata, fileName); | |||
| return data; | |||
| } | |||
| } | |||
| @@ -0,0 +1,94 @@ | |||
| package com.iformall.domain.po; | |||
| import lombok.Data; | |||
| import javax.persistence.*; | |||
| import java.util.*; | |||
| import java.math.*; | |||
| import javax.persistence.Transient; | |||
| import java.util.List; | |||
| import javax.persistence.Id; | |||
| import java.io.Serializable; | |||
| @Table(name = "mall_resource") | |||
| @Data | |||
| public class MallResource implements Serializable { | |||
| private static final long serialVersionUID = 1L; | |||
| @Id | |||
| protected Long id; | |||
| @Transient | |||
| protected List<Long> ids; | |||
| @Transient | |||
| protected String sortColumns; | |||
| @io.swagger.annotations.ApiModelProperty(value="租户ID",name="tenantId") | |||
| private String tenantId; | |||
| @io.swagger.annotations.ApiModelProperty(value="bucket名称",name="bucket") | |||
| private String bucket; | |||
| @io.swagger.annotations.ApiModelProperty(value="s3 key",name="s3Key") | |||
| private String s3Key; | |||
| @io.swagger.annotations.ApiModelProperty(value="s3 url",name="url") | |||
| private String url; | |||
| public static enum Field | |||
| { | |||
| Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | |||
| ,TenantId_ASC("`tenant_id` ASC"),TenantId_DESC("`tenant_id` DESC") | |||
| ,Bucket_ASC("`bucket` ASC"),Bucket_DESC("`bucket` DESC") | |||
| ,Key_ASC("`s3_key` ASC"),Key_DESC("`s3_key` DESC") | |||
| ,Url_ASC("`url` ASC"),Url_DESC("`url` DESC") | |||
| ; | |||
| private String value; | |||
| Field(String value){ | |||
| this.value = value; | |||
| } | |||
| public String getValue() { | |||
| return value; | |||
| } | |||
| public void setCol(String value) { | |||
| this.value = value; | |||
| } | |||
| @Override | |||
| public String toString() { | |||
| return this.getValue(); | |||
| } | |||
| } | |||
| public void setSortColumns(MallResource.Field... fields) | |||
| { | |||
| if (fields == null || fields.length == 0) { | |||
| return; | |||
| } | |||
| for (int k = 0; k < fields.length; k++) { | |||
| if (fields[k] == null) { | |||
| return; | |||
| } | |||
| } | |||
| StringBuilder sb = new StringBuilder(fields[0].toString()); | |||
| for (int k = 1; k < fields.length; k++) { | |||
| sb.append(","); | |||
| sb.append(fields[k].toString()); | |||
| } | |||
| this.sortColumns = sb.toString(); | |||
| } | |||
| public void setSortColumns(String sortColumns) | |||
| { | |||
| if (sortColumns == null || "".equals(sortColumns.trim())) { | |||
| return; | |||
| } | |||
| if (sortColumns.contains(",")) { | |||
| String[] cols = sortColumns.split(","); | |||
| java.util.List<Field> fList = new java.util.ArrayList(); | |||
| for (int k = 0; k < cols.length; k++) { | |||
| fList.add(Field.valueOf(cols[k])); | |||
| } | |||
| this.setSortColumns(fList.toArray(new Field[fList.size()])); | |||
| } else { | |||
| this.setSortColumns(Field.valueOf(sortColumns)); | |||
| } | |||
| } | |||
| } | |||
| @@ -0,0 +1,17 @@ | |||
| package com.iformall.mapper; | |||
| import java.util.*; | |||
| import com.iformall.common.CommonMapper; | |||
| import org.apache.ibatis.annotations.Param; | |||
| import com.iformall.domain.po.MallResource; | |||
| public interface MallResourceMapper extends CommonMapper<MallResource, Long> { | |||
| List<MallResource> findList(MallResource mallResource); | |||
| } | |||
| @@ -0,0 +1,48 @@ | |||
| package com.iformall.service; | |||
| import java.util.*; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.domain.po.MallResource; | |||
| public interface MallResourceService { | |||
| /** | |||
| * 根据实体查询分页列表 | |||
| * | |||
| * @param record | |||
| * @param pageIndex | |||
| * @param pageSize | |||
| * @return | |||
| */ | |||
| PageInfo<MallResource> listAsPage(MallResource record, Integer pageIndex, Integer pageSize); | |||
| /** | |||
| * 根据Id获得实体 | |||
| * | |||
| * @param id | |||
| * @return | |||
| */ | |||
| MallResource getById(Long id); | |||
| /** | |||
| * 保存或更新实体 | |||
| * | |||
| * @param record | |||
| */ | |||
| void saveOrUpdate(MallResource record); | |||
| /** | |||
| * 根据Id删除实体 | |||
| * | |||
| * @param id | |||
| */ | |||
| void deleteById(Long id); | |||
| } | |||
| @@ -0,0 +1,53 @@ | |||
| package com.iformall.service.impl; | |||
| import com.github.pagehelper.PageHelper; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.domain.po.MallResource; | |||
| import com.iformall.mapper.MallResourceMapper; | |||
| import com.iformall.service.MallResourceService; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| import com.iformall.common.IdWorker; | |||
| @Service | |||
| public class MallResourceServiceImpl implements MallResourceService { | |||
| @Autowired | |||
| MallResourceMapper mallResourceMapper; | |||
| @Override | |||
| public PageInfo<MallResource> listAsPage(MallResource record, Integer pageIndex, Integer pageSize) { | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> mallResourceMapper.findList(record)); | |||
| } | |||
| @Override | |||
| public MallResource getById(Long id) { | |||
| return mallResourceMapper.selectByPrimaryKey(id); | |||
| } | |||
| @Override | |||
| public void saveOrUpdate(MallResource record) { | |||
| if (record.getId() == null) { | |||
| //record.setId(UUID.randomUUID().toString().replaceAll("-", "")); | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| record.setId(idWorker.nextId()); | |||
| mallResourceMapper.insertSelective(record); | |||
| } else { | |||
| mallResourceMapper.updateByPrimaryKeySelective(record); | |||
| } | |||
| } | |||
| @Override | |||
| public void deleteById(Long id) { | |||
| mallResourceMapper.deleteByPrimaryKey(id); | |||
| } | |||
| } | |||
| @@ -0,0 +1,52 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
| <mapper namespace="com.iformall.mapper.MallResourceMapper"> | |||
| <resultMap id="BaseResultMap" type="com.iformall.domain.po.MallResource"> | |||
| <id column="id" jdbcType="BIGINT" property="id" /> | |||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId" /> | |||
| <result column="bucket" jdbcType="VARCHAR" property="bucket" /> | |||
| <result column="s3_key" jdbcType="VARCHAR" property="s3Key" /> | |||
| <result column="url" jdbcType="VARCHAR" property="url" /> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `id`,`tenant_id`,`bucket`,`key`,`url` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| where 1 = 1 | |||
| <if test=" null != id "> | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != bucket "> | |||
| and `bucket` = #{bucket} | |||
| </if> | |||
| <if test=" null != key "> | |||
| and `s3_key` = #{s3Key} | |||
| </if> | |||
| <if test=" null != url "> | |||
| and `url` = #{url} | |||
| </if> | |||
| <if test=" null != ids "> | |||
| and id in | |||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||
| #{idItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != sortColumns"> order by ${sortColumns} </if> | |||
| </sql> | |||
| <select id="findList" parameterType="com.iformall.domain.po.MallResource" resultMap="BaseResultMap"> | |||
| select <include refid="allColumns" /> from mall_resource | |||
| <include refid="dynamicWhereConditions" /> | |||
| </select> | |||
| </mapper> | |||
| @@ -14,6 +14,8 @@ import com.amazonaws.services.s3.model.PutObjectRequest; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.config.AwsProperty; | |||
| import com.iformall.controller.base.BaseController; | |||
| import com.iformall.domain.po.MallResource; | |||
| import com.iformall.service.MallResourceService; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.slf4j.Logger; | |||
| @@ -41,9 +43,12 @@ public class UploadController extends BaseController { | |||
| @Autowired | |||
| private AwsProperty awsProperty; | |||
| @Autowired | |||
| private MallResourceService mallResourceService; | |||
| private AmazonS3 s3 = null; | |||
| private ResultData awsUpload(MultipartFile multiReq, ObjectMetadata metadata, String fileName) { | |||
| private ResultData awsUpload(MultipartFile multiReq, ObjectMetadata metadata, String fileName, String tenantId) { | |||
| ResultData data = new ResultData(); | |||
| try { | |||
| if(s3 == null) { | |||
| @@ -69,6 +74,13 @@ public class UploadController extends BaseController { | |||
| URL url = s3.getUrl(awsProperty.getBucketName(), fileName); | |||
| logger.info(url.toString()); | |||
| MallResource mr = new MallResource(); | |||
| mr.setTenantId(tenantId); | |||
| mr.setBucket(awsProperty.getBucketName()); | |||
| mr.setKey(fileName); | |||
| mr.setUrl(url.toString()); | |||
| mallResourceService.saveOrUpdate(mr); | |||
| data.code = ResultData.SUCCESS; | |||
| Map<String, String> map = new HashMap<>(); | |||
| map.put("url", url.toString()); | |||
| @@ -128,7 +140,7 @@ public class UploadController extends BaseController { | |||
| fileName = getTenantId() + "/" + fileName; | |||
| } | |||
| ResultData data = awsUpload(multiReq, metadata, fileName); | |||
| ResultData data = awsUpload(multiReq, metadata, fileName, getTenantId()); | |||
| return data; | |||
| } | |||
| @@ -167,7 +179,7 @@ public class UploadController extends BaseController { | |||
| fileName = getTenantId() + "/" + fileName; | |||
| } | |||
| ResultData data1 = awsUpload(multipartFile, metadata, fileName); | |||
| ResultData data1 = awsUpload(multipartFile, metadata, fileName, getTenantId()); | |||
| if(data1.code == ResultData.SUCCESS) { | |||
| Map _data = (Map)data1.data; | |||
| map.put("url", (String) _data.get("url")); | |||
| @@ -205,7 +217,7 @@ public class UploadController extends BaseController { | |||
| String fileName = multiReq.getOriginalFilename(); | |||
| fileName = "cimg/" + fileName; | |||
| ResultData data = awsUpload(multiReq, metadata, fileName); | |||
| ResultData data = awsUpload(multiReq, metadata, fileName, "cimg"); | |||
| return data; | |||
| } | |||