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

gtdata路径处理

parent 7c5e9f81
...@@ -4,6 +4,7 @@ import cn.hutool.core.convert.Convert; ...@@ -4,6 +4,7 @@ import cn.hutool.core.convert.Convert;
import cn.hutool.core.io.FileUtil; import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpUtil; import cn.hutool.http.HttpUtil;
import cn.hutool.json.JSONUtil;
import com.github.wxiaoqi.security.auth.client.annotation.IgnoreUserToken; import com.github.wxiaoqi.security.auth.client.annotation.IgnoreUserToken;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse; import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.rest.BaseController; import com.github.wxiaoqi.security.common.rest.BaseController;
...@@ -20,6 +21,8 @@ import com.upyuns.platform.rs.website.entity.DataTempcache; ...@@ -20,6 +21,8 @@ import com.upyuns.platform.rs.website.entity.DataTempcache;
import com.upyuns.platform.rs.website.entity.FileData; import com.upyuns.platform.rs.website.entity.FileData;
import com.upyuns.platform.rs.website.entity.GainData; import com.upyuns.platform.rs.website.entity.GainData;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.extern.log4j.Log4j;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
...@@ -34,6 +37,7 @@ import static com.github.wxiaoqi.security.common.constant.CommonConstants.SYS_TR ...@@ -34,6 +37,7 @@ import static com.github.wxiaoqi.security.common.constant.CommonConstants.SYS_TR
@RestController @RestController
@RequestMapping("dataTempcache") @RequestMapping("dataTempcache")
@Slf4j
public class AdminDataTempcacheController extends BaseController<DataTempcacheBiz,DataTempcache> { public class AdminDataTempcacheController extends BaseController<DataTempcacheBiz,DataTempcache> {
@Autowired @Autowired
...@@ -106,38 +110,29 @@ public class AdminDataTempcacheController extends BaseController<DataTempcacheBi ...@@ -106,38 +110,29 @@ public class AdminDataTempcacheController extends BaseController<DataTempcacheBi
//根据id创建gtdata目录 //根据id创建gtdata目录
String gtdataPath = "/rscloudmart"+ tempcachePath + "/" + dataTempcacheDB.getId(); String gtdataPath = "/rscloudmart"+ tempcachePath + "/" + dataTempcacheDB.getId();
gtDataRestClient.mkdirs(gtdataPath); gtDataRestClient.mkdirs(gtdataPath);
// gainData.setGtdataPath(gtdataPath);
String finalGtdataPath = gtdataPath;
// updateSelectiveById(new GainData() {{
// setId(gainData.getId());
// setGtdataPath(finalGtdataPath);
// setHasGtdata(HASGTDATA_FIN);
// }});
//上传文件
String fileGtdataPath = gtdataPath + "/" + dataTempcacheDB.getFilename();
// Map<String, Object> result = gtDataRestClient.open(dataTempcacheDB.getGtdataPath()); String filepath = dataTempcacheDB.getFilepath();
// byte[] content = (byte[]) result.get("file"); // if(StrUtil.isBlank(filepath)) {
// 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()); if(!gtDataRestClient.isExist(fileGtdataPath).get("exist").toString().equals("true")){
// baseBiz.updateSelectiveById(new DataTempcache(){{ Map<String, Object> responseMap = gtDataRestClient.createLarge(filepath, fileGtdataPath);
// setId(dataTempcacheDB.getId()); if (responseMap == null || 200 != (Integer) responseMap.get("HttpStatusCode")) {
// setFilepath(serverPath + "/" + dataTempcache.getFilename()); log.error(JSONUtil.toJsonStr(responseMap), responseMap);
// setFileurl(xx_url+ SystemConfig.XXMP_URL + realPath + "/" + dataTempcache.getFilename()); }
// }}); }
// dataTempcacheDB.setFilepath(serverPath + "/" + dataTempcache.getFilename());
// dataTempcacheDB.setFileurl(xx_url+ SystemConfig.XXMP_URL + realPath + "/" + dataTempcache.getFilename()); baseBiz.updateSelectiveById(new DataTempcache() {{
setId(dataTempcache.getId());
setGtdataPath(fileGtdataPath);
setHasGtdata(HASGTDATA_FIN);
}});
dataTempcacheDB.setGtdataPath(fileGtdataPath);
} }
// else if (DataTempcache.UPTYPE_URL == dataTempcacheDB.getUptype()) {
//
// }
} }
resultPath = dataTempcacheDB.getGtdataPath(); resultPath = dataTempcacheDB.getGtdataPath();
...@@ -213,7 +208,7 @@ public class AdminDataTempcacheController extends BaseController<DataTempcacheBi ...@@ -213,7 +208,7 @@ public class AdminDataTempcacheController extends BaseController<DataTempcacheBi
dataTempcache.setFilesize(fileSizeString); dataTempcache.setFilesize(fileSizeString);
dataTempcache.setFilepath(serverPath + "/" + dataTempcache.getFilename()); dataTempcache.setFilepath(serverPath + "/" + dataTempcache.getFilename());
dataTempcache.setFileurl(xx_url+ SystemConfig.XXMP_URL + realPath + "/" + dataTempcache.getFilename()); dataTempcache.setFileurl(xx_url+ SystemConfig.XXMP_URL + realPath + "/" + dataTempcache.getFilename());
}else { }else if(DataTempcache.UPTYPE_UPLOAD == dataTempcache.getUptype()){
dataTempcache.setFileurl(dataTempcache.getUpurl()); dataTempcache.setFileurl(dataTempcache.getUpurl());
} }
} }
......
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