
13 changed files with 652 additions and 27 deletions
Binary file not shown.
@ -0,0 +1,54 @@ |
|||||
|
package com.yxt.supervise.dbcenter; |
||||
|
|
||||
|
import cn.hutool.http.HttpRequest; |
||||
|
import cn.hutool.http.HttpResponse; |
||||
|
import cn.hutool.http.HttpUtil; |
||||
|
import cn.hutool.json.JSONUtil; |
||||
|
import com.yxt.supervise.dbcenter.zhj.crawl.ZhjSpiderConfig; |
||||
|
import com.yxt.supervise.dbcenter.zhj.crawl.spider.ZhjResp; |
||||
|
import org.junit.jupiter.api.Test; |
||||
|
|
||||
|
import java.net.HttpCookie; |
||||
|
import java.util.HashMap; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
public class HttpUtilTester { |
||||
|
private static String olapQueryParam_salesAmount = "{\"componentId\":\"52dece2d-ba6d-452e-8497-f94baff096c4\",\"componentName\":\"指标看板-熟溢香支付方式_knief\",\"configs\":[{\"type\":\"field\",\"config\":{\"fields\":[{\"guid\":\"31ce439f-747c-45d0-8f35-51fe9daea91e\",\"fid\":\"5805bc15e1\",\"areaType\":\"row\"},{\"guid\":\"6e8c6afd-038a-4644-85c1-ffb813dc8614\",\"fid\":\"fa1b7a0d21\",\"areaType\":\"column\",\"aggregate\":\"sum\"}]},\"cubeId\":\"90bb4e6c-c315-465b-9c3b-74a22a0d84e6\"},{\"type\":\"paging\",\"cubeId\":\"90bb4e6c-c315-465b-9c3b-74a22a0d84e6\",\"config\":{\"limit\":1000,\"offset\":0,\"pagedByAllDim\":true}},{\"type\":\"beforeAggregateCondition\",\"cubeId\":\"90bb4e6c-c315-465b-9c3b-74a22a0d84e6\",\"config\":{\"logicalOperator\":\"AND\",\"conditions\":[{\"field\":{\"fid\":\"3fd928d207\"},\"functionalOperator\":\"in\",\"args\":[{\"valueType\":\"string\",\"value\":\"POS点餐\"},{\"valueType\":\"string\",\"value\":\"会员充值\"},{\"valueType\":\"string\",\"value\":\"扫码点餐\"},{\"valueType\":\"string\",\"value\":\"美团外卖点餐\"},{\"valueType\":\"string\",\"value\":\"饿了么外卖点餐\"}]},{\"logicalOperator\":\"AND\",\"conditions\":[{\"field\":{\"fid\":\"15784307a1\",\"dateTrunc\":\"day\"},\"functionalOperator\":\"greaterThanOrEqual\",\"args\":[{\"valueType\":\"string\",\"value\":\"VAR_DATE_STR\"}]},{\"field\":{\"fid\":\"15784307a1\",\"dateTrunc\":\"day\"},\"functionalOperator\":\"lessThanOrEqual\",\"args\":[{\"valueType\":\"string\",\"value\":\"VAR_DATE_STR\"}]}]}]}},{\"type\":\"queryConfig\",\"cubeId\":\"90bb4e6c-c315-465b-9c3b-74a22a0d84e6\",\"config\":{\"needCount\":false,\"queryCount\":false,\"queryDetail\":false}},{\"type\":\"advancedParam\",\"cubeId\":\"90bb4e6c-c315-465b-9c3b-74a22a0d84e6\",\"config\":{\"autoInsightParam\":{\"enable\":false},\"wordCloudParam\":{},\"summarizeParams\":[],\"trendLineParams\":[],\"forecastParams\":[],\"anomalyDetectionParams\":[],\"clusteringParams\":[],\"groupParam\":null}},{\"type\":\"annotationParam\",\"cubeId\":\"90bb4e6c-c315-465b-9c3b-74a22a0d84e6\",\"config\":{\"measureThresholdParams\":[],\"inflectionPointParams\":[]}}],\"dataType\":\"general\",\"reportId\":\"85c4af04-1910-4005-8e47-742af1acb713\"}"; |
||||
|
private static String reportId = "85c4af04-1910-4005-8e47-742af1acb713"; |
||||
|
|
||||
|
private static String urla = "https://bi.aliyuncs.com/api/v2/biPlatform/query/byQueryParam"; |
||||
|
@Test |
||||
|
void sptest() { |
||||
|
|
||||
|
String url = "https://bi.aliyuncs.com/token3rd/dashboard/view/pc.htm?pageId=85c4af04-1910-4005-8e47-742af1acb713&accessToken=d8c021cd40ad94b2d500d12229b57c3e&dd_orientation=auto"; |
||||
|
|
||||
|
HttpRequest request = HttpRequest.get(url); |
||||
|
HttpResponse execute = request.execute(); |
||||
|
Map<String,String> mm = new HashMap<>(); |
||||
|
List<HttpCookie> cookies = execute.getCookies(); |
||||
|
for (HttpCookie c : cookies ) { |
||||
|
String name = c.getName(); |
||||
|
String value = c.getValue(); |
||||
|
mm.put(name,value); |
||||
|
} |
||||
|
System.out.println(); |
||||
|
|
||||
|
|
||||
|
String olapQueryParam = olapQueryParam_salesAmount.replace("VAR_DATE_STR", "2023-055-13"); |
||||
|
String componentId = "52dece2d-ba6d-452e-8497-f94baff096c4"; |
||||
|
Map<String, Object> paramMap = new HashMap<>(); |
||||
|
paramMap.put("olapQueryParam", olapQueryParam); |
||||
|
paramMap.put("componentId", componentId); |
||||
|
paramMap.put("reportId", reportId); |
||||
|
paramMap.put("componentType", "66"); |
||||
|
|
||||
|
String result = HttpRequest.post(urla) |
||||
|
.header("cookie", "cna=QZ74GyioHjsCAWpxs/DlZflP; qbi_locale=zh-CN; x_login_pk="+mm.get("x_login_pk")+"; qbi_version=1; csrf_token=hello123456") |
||||
|
.header("x-csrf-token", "hello123456") |
||||
|
.header("x-gw-referer", "https://bi.aliyuncs.com/token3rd/dashboard/view/pc.htm?pageId=85c4af04-1910-4005-8e47-742af1acb713&accessToken=d8c021cd40ad94b2d500d12229b57c3e&dd_orientation=auto&qbi_version_param=1") |
||||
|
.form(paramMap).execute().body(); |
||||
|
|
||||
|
System.out.println( result); |
||||
|
} |
||||
|
} |
@ -0,0 +1,37 @@ |
|||||
|
package com.yxt.supervise.customer.api.gdinventorylog; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||
|
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
|
import com.yxt.common.core.domain.EntityWithId; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.util.Date; |
||||
|
|
||||
|
/** |
||||
|
* @author wangpengfei |
||||
|
* @date 2023/4/24 13:45 |
||||
|
*/ |
||||
|
@Data |
||||
|
@TableName("gd_inventory_log") |
||||
|
public class GdInventoryLog extends EntityWithId { |
||||
|
|
||||
|
public GdInventoryLog() { |
||||
|
} |
||||
|
|
||||
|
public GdInventoryLog(String fileFullPath) { |
||||
|
this.fileFullPath = fileFullPath; |
||||
|
} |
||||
|
|
||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
||||
|
private Date createTime = new Date(); // 记录创建时间/
|
||||
|
private String remarks; // 备注说明/
|
||||
|
private String fileFullPath; // 文件完整路径/
|
||||
|
private String outFilePath; // 汇总文件路径
|
||||
|
// private String outfile; //输出文件名
|
||||
|
private String fileUrl; //文件下载地址
|
||||
|
private int allNum; // 总记录数/
|
||||
|
private int validNum; // 有效记录数/
|
||||
|
private long durations; // 程序运行时长/
|
||||
|
private int errRowNum; // 出错的条数/
|
||||
|
private String orderDate; // 单据日期
|
||||
|
} |
@ -0,0 +1,24 @@ |
|||||
|
package com.yxt.supervise.customer.api.gdinventorylog; |
||||
|
|
||||
|
import com.yxt.common.core.query.Query; |
||||
|
|
||||
|
public class GdInventoryLogQuery implements Query { |
||||
|
private String dataDateStart; // 数据日期
|
||||
|
private String dataDateEnd; // 数据日期
|
||||
|
|
||||
|
public String getDataDateStart() { |
||||
|
return dataDateStart; |
||||
|
} |
||||
|
|
||||
|
public void setDataDateStart(String dataDateStart) { |
||||
|
this.dataDateStart = dataDateStart; |
||||
|
} |
||||
|
|
||||
|
public String getDataDateEnd() { |
||||
|
return dataDateEnd; |
||||
|
} |
||||
|
|
||||
|
public void setDataDateEnd(String dataDateEnd) { |
||||
|
this.dataDateEnd = dataDateEnd; |
||||
|
} |
||||
|
} |
@ -0,0 +1,8 @@ |
|||||
|
package com.yxt.supervise.customer.api.gdinventorylog; |
||||
|
|
||||
|
/** |
||||
|
* @author wangpengfei |
||||
|
* @date 2023/4/24 13:46 |
||||
|
*/ |
||||
|
public class GdInventoryLogVo { |
||||
|
} |
@ -1,8 +0,0 @@ |
|||||
package com.yxt.supervise.customer.api.gdlinventorylog; |
|
||||
|
|
||||
/** |
|
||||
* @author wangpengfei |
|
||||
* @date 2023/4/24 13:45 |
|
||||
*/ |
|
||||
public class GdIinventoryLog { |
|
||||
} |
|
@ -1,8 +0,0 @@ |
|||||
package com.yxt.supervise.customer.api.gdlinventorylog; |
|
||||
|
|
||||
/** |
|
||||
* @author wangpengfei |
|
||||
* @date 2023/4/24 13:46 |
|
||||
*/ |
|
||||
public class GdIinventoryLogVo { |
|
||||
} |
|
Loading…
Reference in new issue