|
@@ -24,11 +24,13 @@ import org.apache.http.impl.client.CloseableHttpClient;
|
|
|
import org.apache.http.impl.client.HttpClients;
|
|
|
import org.apache.http.message.BasicNameValuePair;
|
|
|
import org.apache.http.util.EntityUtils;
|
|
|
+import org.apache.poi.util.IOUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import java.io.IOException;
|
|
|
+import java.io.InputStream;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
@@ -57,7 +59,7 @@ public class WarehouseBaseInfoController {
|
|
|
return warehouseBaseInfoService.addWarehouse(warehouseBaseInfo);
|
|
|
}
|
|
|
/**
|
|
|
- * 添加仓库
|
|
|
+ * 获取token
|
|
|
*/
|
|
|
@GetMapping("/api/getToken")
|
|
|
public String getToken() throws IOException {
|
|
@@ -74,6 +76,28 @@ public class WarehouseBaseInfoController {
|
|
|
}
|
|
|
return "";
|
|
|
}
|
|
|
+ /**
|
|
|
+ * 获取截图
|
|
|
+ */
|
|
|
+ @GetMapping("/api/getSnapshot")
|
|
|
+ public String getSnapshot(String param) {
|
|
|
+ try{
|
|
|
+ String url = "https://bi.zhaoliangsz.com:9230/ccm-api/v1/pods/snapshot/"+param;
|
|
|
+ HttpGet httpGet = new HttpGet(url);
|
|
|
+
|
|
|
+ CloseableHttpClient httpClient = HttpClients.createDefault();
|
|
|
+ HttpResponse response = httpClient.execute(httpGet);
|
|
|
+ HttpEntity entity = response.getEntity();
|
|
|
+ InputStream inStream = entity.getContent();
|
|
|
+ byte[] bytes = IOUtils.toByteArray(inStream);
|
|
|
+ return "data:image/png;base64,"+cn.hutool.core.codec.Base64.encode(bytes);
|
|
|
+ }
|
|
|
+ catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ return "data:image/png;base64,";
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
/**
|
|
|
* 添加临时仓库
|
|
|
*
|