Commit 80165849 authored by 周健威's avatar 周健威

添加url处理接口

parent fd0ca88f
......@@ -46,6 +46,11 @@ public class ImageImgStorageBiz extends BaseBiz<ImageImgStorageMapper,ImageImgSt
if (imageImgStorage == null) {
return ObjectRestResponse.paramIsEmpty();
}
// //如果是url 则转存
// if(imageImgStorage.getUptype() == ImageImgStorage.UPTYPE_URL) {
// imageImgStorage.getCoverImg()
//
// }
if (imageImgStorage.getId() == null) {
insertSelectiveRe(imageImgStorage);
if (imageImgStorage.getImageInfoRelationList() != null && imageImgStorage.getImageInfoRelationList().size() > 0) {
......
......@@ -10,6 +10,7 @@ import com.github.wxiaoqi.security.common.rest.BaseController;
import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.github.wxiaoqi.security.common.util.process.SystemConfig;
import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.upyuns.platform.rs.gtdata.GdLoginVO;
import com.upyuns.platform.rs.gtdata.GtDataRestClient;
import com.upyuns.platform.rs.gtdata.GtFileInfo;
import com.upyuns.platform.rs.website.biz.DataTempcacheBiz;
......@@ -25,6 +26,7 @@ import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import tk.mybatis.mapper.entity.Example;
import java.io.OutputStream;
import java.util.List;
import java.util.Map;
......@@ -49,6 +51,45 @@ public class AdminDataTempcacheController extends BaseController<DataTempcacheBi
//BaseController.baseLogicPages
//BaseController.del
@RequestMapping(value = "/app/unauth/dealImageimgUrl", method = RequestMethod.GET)
@IgnoreUserToken
public ObjectRestResponse dealImageimgUrl(DataTempcache dataTempcache) throws Exception {
//查询dataTempcache 的上传方式
DataTempcache dataTempcacheDB = baseBiz.selectById(dataTempcache.getId());
String resultUrl = "";
if(DataTempcache.UPTYPE_GTDATA == dataTempcacheDB.getUptype()) {
//判断是否存在本地路径和url
if(StrUtil.isBlank(dataTempcacheDB.getUpurl())) {
Map<String, Object> result = gtDataRestClient.open(dataTempcacheDB.getGtdataPath());
byte[] content = (byte[]) result.get("file");
getResponse().setContentLength(content.length);
String realPath = tempcachePath+"/"+dataTempcache.getId();
String serverPath = baseUploadPath + realPath;
//创建目录
if(!FileUtil.exist(serverPath)) {
FileUtil.mkdir(serverPath);
}
FileUtil.writeBytes(content, serverPath + "/" + dataTempcache.getFilename());
baseBiz.updateSelectiveById(new DataTempcache(){{
setId(dataTempcacheDB.getId());
setFilepath(serverPath + "/" + dataTempcache.getFilename());
setFileurl(xx_url+ SystemConfig.XXMP_URL + realPath + "/" + dataTempcache.getFilename());
}});
dataTempcacheDB.setFilepath(serverPath + "/" + dataTempcache.getFilename());
dataTempcacheDB.setFileurl(xx_url+ SystemConfig.XXMP_URL + realPath + "/" + dataTempcache.getFilename());
}
// else if (DataTempcache.UPTYPE_URL == dataTempcacheDB.getUptype()) {
//
// }
resultUrl = dataTempcacheDB.getUpurl();
}
return ObjectRestResponse.succ(resultUrl);
}
@RequestMapping(value = "/getPageList",method = RequestMethod.GET)
public ObjectRestResponse<List<GainData>> getPageList(DataTempcacheDTO dto) {
PageDataVO pageDataVO = PageDataVO.pageInfo(dto.getPage(), dto.getLimit(), ()->baseBiz.pageList(dto));
......
......@@ -10,6 +10,7 @@ import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.rest.BaseController;
import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.upyuns.platform.rs.gtdata.GdLoginVO;
import com.upyuns.platform.rs.gtdata.GtDataRestClient;
import com.upyuns.platform.rs.gtdata.GtFileInfo;
import com.upyuns.platform.rs.website.biz.DataMenuBiz;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment