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

gtdata路径处理

parent 7c5e9f81
......@@ -4,6 +4,7 @@ import cn.hutool.core.convert.Convert;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpUtil;
import cn.hutool.json.JSONUtil;
import com.github.wxiaoqi.security.auth.client.annotation.IgnoreUserToken;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.rest.BaseController;
......@@ -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.GainData;
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.Value;
import org.springframework.web.bind.annotation.*;
......@@ -34,6 +37,7 @@ import static com.github.wxiaoqi.security.common.constant.CommonConstants.SYS_TR
@RestController
@RequestMapping("dataTempcache")
@Slf4j
public class AdminDataTempcacheController extends BaseController<DataTempcacheBiz,DataTempcache> {
@Autowired
......@@ -106,38 +110,29 @@ public class AdminDataTempcacheController extends BaseController<DataTempcacheBi
//根据id创建gtdata目录
String gtdataPath = "/rscloudmart"+ tempcachePath + "/" + dataTempcacheDB.getId();
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());
// 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);
String filepath = dataTempcacheDB.getFilepath();
// if(StrUtil.isBlank(filepath)) {
// //下载文件
// }
//
// 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());
if(!gtDataRestClient.isExist(fileGtdataPath).get("exist").toString().equals("true")){
Map<String, Object> responseMap = gtDataRestClient.createLarge(filepath, fileGtdataPath);
if (responseMap == null || 200 != (Integer) responseMap.get("HttpStatusCode")) {
log.error(JSONUtil.toJsonStr(responseMap), responseMap);
}
}
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();
......@@ -213,7 +208,7 @@ public class AdminDataTempcacheController extends BaseController<DataTempcacheBi
dataTempcache.setFilesize(fileSizeString);
dataTempcache.setFilepath(serverPath + "/" + dataTempcache.getFilename());
dataTempcache.setFileurl(xx_url+ SystemConfig.XXMP_URL + realPath + "/" + dataTempcache.getFilename());
}else {
}else if(DataTempcache.UPTYPE_UPLOAD == dataTempcache.getUptype()){
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