提交 cd856b8f 作者: zhangqiliang

上传接口中返回上传的路径

父级 5c222115
...@@ -7,6 +7,8 @@ import com.ihidea.core.util.ImageUtilsEx; ...@@ -7,6 +7,8 @@ import com.ihidea.core.util.ImageUtilsEx;
import com.ihidea.core.util.JSONUtilsEx; import com.ihidea.core.util.JSONUtilsEx;
import com.ihidea.core.util.ServletUtilsEx; import com.ihidea.core.util.ServletUtilsEx;
import com.starcharge.base.redis.RedisClient; import com.starcharge.base.redis.RedisClient;
import com.starcharge.component.datastore.dao.CptDataInfoMapper;
import com.starcharge.component.datastore.dao.model.CptDataInfo;
import com.starcharge.component.datastore.fileio.FileIoEntity; import com.starcharge.component.datastore.fileio.FileIoEntity;
import com.starcharge.component.datastore.fileio.IFileInputStream; import com.starcharge.component.datastore.fileio.IFileInputStream;
import org.apache.catalina.connector.ClientAbortException; import org.apache.catalina.connector.ClientAbortException;
...@@ -14,6 +16,7 @@ import org.apache.commons.fileupload.disk.DiskFileItem; ...@@ -14,6 +16,7 @@ import org.apache.commons.fileupload.disk.DiskFileItem;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.ArrayUtils; import org.apache.commons.lang.ArrayUtils;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.apache.http.client.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
...@@ -24,6 +27,7 @@ import javax.servlet.http.HttpServletResponse; ...@@ -24,6 +27,7 @@ import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
...@@ -37,6 +41,8 @@ public class FileController extends CoreController { ...@@ -37,6 +41,8 @@ public class FileController extends CoreController {
@Autowired @Autowired
private FileSupportService service; private FileSupportService service;
@Autowired
private CptDataInfoMapper cptDataInfoMapper;
private static final String MULTIPART_BOUNDARY = "MULTIPART_BYTERANGES"; private static final String MULTIPART_BOUNDARY = "MULTIPART_BYTERANGES";
...@@ -178,6 +184,11 @@ public class FileController extends CoreController { ...@@ -178,6 +184,11 @@ public class FileController extends CoreController {
fileImgSize)); fileImgSize));
} }
CptDataInfo cptDataInfo=cptDataInfoMapper.selectByPrimaryKey(fileIdList.get(0));
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
String date=sdf.format(cptDataInfo.getCreateTime()).replace("-","/");
String url=date+"/"+fileIdList.get(0);
fileIdList.add(url);
// 返回文件id // 返回文件id
result.put("fileIdList", fileIdList); result.put("fileIdList", fileIdList);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论