Commit 7a8caa8b authored by 周健威's avatar 周健威

修改代码

parent f038a8e5
...@@ -28,6 +28,11 @@ ...@@ -28,6 +28,11 @@
<poi.version>3.15</poi.version> <poi.version>3.15</poi.version>
</properties> </properties>
<dependencies> <dependencies>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.5</version>
</dependency>
<dependency> <dependency>
<groupId>com.fasterxml.jackson.module</groupId> <groupId>com.fasterxml.jackson.module</groupId>
<artifactId>jackson-module-jaxb-annotations</artifactId> <artifactId>jackson-module-jaxb-annotations</artifactId>
......
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
package com.upyuns.platform.rs.gtdata; package com.upyuns.platform.rs.gtdata;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.io.IoUtil;
import cn.hutool.core.util.StrUtil;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse; import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
...@@ -674,6 +676,30 @@ public class GtDataRestClient { ...@@ -674,6 +676,30 @@ public class GtDataRestClient {
} }
// /**
// *
// * Description:显示指定路径[文件/文件夹(包括子文件)]的属性
// *
// * @param path
// * @param username
// * @param recursive
// * @param sign
// * @param time
// * @return
// * 成功({key:HttpStatusCode,value:200},{key:files,value:List<GtdataFile
// * >})
// *
// */
// public Map<String, Object> showFileInfo(String path) {
// //路径 和 文件分离
// String[] = StrUtil.
// String fin
// String resourceUrl = MessageFormat.format(
// "{0}{1}?op=LIST&sign={2}&time={3}",
// gtDataUrl, path, defaultSign, defaultTime);
// Map<String, Object> responseMap = restGet(resourceUrl);
// }
/** /**
* *
* Description:(只能在Linux环境使用)根据路径读取文件内容(支持大文件) * Description:(只能在Linux环境使用)根据路径读取文件内容(支持大文件)
...@@ -1097,7 +1123,7 @@ public class GtDataRestClient { ...@@ -1097,7 +1123,7 @@ public class GtDataRestClient {
try { try {
byte [] byteArr=file.getBytes(); byte [] byteArr=file.getBytes();
inputStream = new ByteArrayInputStream(byteArr); inputStream = new ByteArrayInputStream(byteArr);
return createInputStream(inputStream, path, sign, time, overwrite); return createInputStream(byteArr, inputStream, path, sign, time, overwrite);
}catch (Exception e){ }catch (Exception e){
logger.error(e.getMessage(), e); logger.error(e.getMessage(), e);
}finally { }finally {
...@@ -1129,7 +1155,7 @@ public class GtDataRestClient { ...@@ -1129,7 +1155,7 @@ public class GtDataRestClient {
* @return * @return
* *
*/ */
public Map<String, Object> createInputStream(InputStream file, String path, public Map<String, Object> createInputStream(byte [] byteArr, InputStream file, String path,
String sign, String time, boolean overwrite) { String sign, String time, boolean overwrite) {
String md5 = ""; String md5 = "";
...@@ -1155,8 +1181,15 @@ public class GtDataRestClient { ...@@ -1155,8 +1181,15 @@ public class GtDataRestClient {
gtDataUrl, path, md5, sign, time, overwrite); gtDataUrl, path, md5, sign, time, overwrite);
try { try {
HttpEntity<byte[]> httpEntity = new HttpEntity( HttpEntity<byte[]> httpEntity = null;
IOUtils.toByteArray(file));
if(null != byteArr && byteArr.length > 0) {
httpEntity = new HttpEntity(byteArr);
}else {
httpEntity = new HttpEntity(
IoUtil.readBytes(file));
}
Map<String, Object> responseMap2 = rest(resourceUrl, Map<String, Object> responseMap2 = rest(resourceUrl,
HttpMethod.PUT, httpEntity); HttpMethod.PUT, httpEntity);
return responseMap2; return responseMap2;
......
...@@ -9,4 +9,8 @@ import java.math.BigDecimal; ...@@ -9,4 +9,8 @@ import java.math.BigDecimal;
@Data @Data
public class ImageDataVO extends RscpAreaImageTotal { public class ImageDataVO extends RscpAreaImageTotal {
BigDecimal price = BigDecimal.ZERO; BigDecimal price = BigDecimal.ZERO;
public void setPrice(BigDecimal price) {
this.price = price;
}
} }
...@@ -31,7 +31,7 @@ public class GtdataController extends CommonBaseController { ...@@ -31,7 +31,7 @@ public class GtdataController extends CommonBaseController {
@IgnoreUserToken @IgnoreUserToken
public void queryAreaInfoByAreaId() throws Exception { public void queryAreaInfoByAreaId() throws Exception {
String url = request.getRequestURI(); String url = request.getRequestURI();
String fileName = url.substring(url.lastIndexOf("/")+1); String fileName = url.substring(url.lastIndexOf("/")+1)+ System.currentTimeMillis();
String filePath = "https://box.bdimg.com/static/fisp_static/common/img/searchbox/logo_news_276_88_1f9876a.png"; String filePath = "https://box.bdimg.com/static/fisp_static/common/img/searchbox/logo_news_276_88_1f9876a.png";
// String filePath = "/obt/thumbnail/"+ url.substring(url.lastIndexOf("/app/unauth/image/")+18); // String filePath = "/obt/thumbnail/"+ url.substring(url.lastIndexOf("/app/unauth/image/")+18);
// String filePath = "/obt/thumbnail/data/VDM2/20200613/VDM2_20200525232637_0015_L1_MSS_CMOS5/VDM2_20200525232637_0015_L1_MSS_CMOS5_98_98.jpg"; // String filePath = "/obt/thumbnail/data/VDM2/20200613/VDM2_20200525232637_0015_L1_MSS_CMOS5/VDM2_20200525232637_0015_L1_MSS_CMOS5_98_98.jpg";
......
...@@ -132,7 +132,7 @@ public class RscpImageDataTotalController extends BaseController<RscpImageDataTo ...@@ -132,7 +132,7 @@ public class RscpImageDataTotalController extends BaseController<RscpImageDataTo
list.forEach(p -> { list.forEach(p -> {
if(t.getImageSatelliteType().equals(p.getImageSatelliteType()) if(t.getImageSatelliteType().equals(p.getImageSatelliteType())
&& t.getImageSensorType().equals(p.getImageSensorType())) { && t.getImageSensorType().equals(p.getImageSensorType())) {
vo.setPrice(p.getUnitPrice()); vo.setPrice(p.getPrice());
} }
}); });
list3.add(vo); list3.add(vo);
......
package com.upyuns.platform.rs.datacenter.rest.backstage; package com.upyuns.platform.rs.datacenter.rest.backstage;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.github.wxiaoqi.security.auth.client.annotation.IgnoreUserToken; import com.github.wxiaoqi.security.auth.client.annotation.IgnoreUserToken;
...@@ -40,12 +41,24 @@ public class BgGtdataController extends CommonBaseController { ...@@ -40,12 +41,24 @@ public class BgGtdataController extends CommonBaseController {
@RequestParam(value = "prefix",defaultValue = "admin")String prefix @RequestParam(value = "prefix",defaultValue = "admin")String prefix
)throws Exception { )throws Exception {
String contentType = file.getContentType(); //图片文件类型 String contentType = file.getContentType(); //图片文件类型
Map<String, Object> existMap = gtDataRestClient.isExist(uploadP); if(StrUtil.isBlank(contentType)) {
contentType = "jpg";
}else {
String[] types = file.getContentType().split("/");
if(types.length > 1) {
contentType = file.getContentType().split("/")[1];
}
}
String path = uploadP+ DateUtil.date().toDateStr()+ "/";
String fileName = path+ System.currentTimeMillis()+ "."+ contentType;
Map<String, Object> existMap = gtDataRestClient.isExist(path);
if(existMap.get("HttpStatusCode") == null || !"200".equals(existMap.get("HttpStatusCode"))){ if(existMap.get("HttpStatusCode") == null || !"200".equals(existMap.get("HttpStatusCode"))){
gtDataRestClient.mkdirs(uploadP); gtDataRestClient.mkdirs(path);
} }
gtDataRestClient.createMultipartFile(file, uploadP+file.getName()); gtDataRestClient.createMultipartFile(file, fileName);
return ObjectRestResponse.succ(); //获取文件信息
Map<String, Object> map = gtDataRestClient.open(fileName);
return ObjectRestResponse.succ(fileName);
} }
public void downloadVideoById(String fileName, String filePath, HttpServletResponse response) throws Exception { public void downloadVideoById(String fileName, String filePath, HttpServletResponse response) throws Exception {
......
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