From 347579b892fb6bdff29514839c671c5ea54aa9c1 Mon Sep 17 00:00:00 2001 From: lzh Date: Sat, 6 May 2023 21:53:05 +0800 Subject: [PATCH] httprequest --- .../src/main/java/test/ZhjRequestTester.java | 67 +++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/test/ZhjRequestTester.java diff --git a/yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/test/ZhjRequestTester.java b/yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/test/ZhjRequestTester.java new file mode 100644 index 00000000..d90935ed --- /dev/null +++ b/yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/test/ZhjRequestTester.java @@ -0,0 +1,67 @@ +/********************************************************* + ********************************************************* + ******************** ******************* + ************* ************ + ******* _oo0oo_ ******* + *** o8888888o *** + * 88" . "88 * + * (| -_- |) * + * 0\ = /0 * + * ___/`---'\___ * + * .' \\| |// '. * + * / \\||| : |||// \ * + * / _||||| -:- |||||- \ * + * | | \\\ - /// | | * + * | \_| ''\---/'' |_/ | * + * \ .-\__ '-' ___/-. / * + * ___'. .' /--.--\ `. .'___ * + * ."" '< `.___\_<|>_/___.' >' "". * + * | | : `- \`.;`\ _ /`;.`/ - ` : | | * + * \ \ `_. \_ __\ /__ _/ .-` / / * + * =====`-.____`.___ \_____/___.-`___.-'===== * + * `=---=' * + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * + *********__佛祖保佑__永无BUG__验收通过__钞票多多__********* + *********************************************************/ +package test; + + +import cn.hutool.http.HttpRequest; +import cn.hutool.json.JSONUtil; + +import java.util.HashMap; +import java.util.Map; + +/** + * Project: yxt_supervise
+ * File: ZhjRequestTester.java
+ * Class: test.ZhjRequestTester
+ * Description: <描述类的功能>.
+ * Copyright: Copyright (c) 2011
+ * Company: https://gitee.com/liuzp315
+ * Makedate: 2023/5/6 21:46
+ * + * @author liupopo + * @version 1.0 + * @since 1.0 + */ +public class ZhjRequestTester { + private static String url = "https://bi.aliyuncs.com/api/v2/biPlatform/query/byQueryParam"; + public static void main(String[] args) { + Map paramMap = new HashMap<>(); + paramMap.put("olapQueryParam","{\"componentId\":\"8d8a8363-89d8-4bec-9a58-c7c13ae63f15\",\"componentName\":\"菜品销量\",\"configs\":[{\"type\":\"field\",\"config\":{\"fields\":[{\"guid\":\"f8e0f500-ffc6-4821-9190-5cd3b3c906e9\",\"fid\":\"19a1d100cc\",\"areaType\":\"row\"},{\"guid\":\"07b482d2-b2e3-4a64-9d8d-3e30c03dfec6\",\"fid\":\"0e325d5eed\",\"areaType\":\"column\",\"granularity\":null,\"aggregate\":\"sum\"},{\"guid\":\"a4cfd195-dfd3-4947-a024-076ca806793f\",\"fid\":\"b9d5c6b646\",\"areaType\":\"column\",\"aggregate\":\"avg\"}]},\"cubeId\":\"a16139f4-8f21-4172-afb9-5de69719590e\"},{\"type\":\"paging\",\"cubeId\":\"a16139f4-8f21-4172-afb9-5de69719590e\",\"config\":{\"limit\":20,\"offset\":0,\"pagedByAllDim\":true}},{\"type\":\"beforeAggregateCondition\",\"cubeId\":\"a16139f4-8f21-4172-afb9-5de69719590e\",\"config\":{\"logicalOperator\":\"AND\",\"conditions\":[{\"field\":{\"fid\":\"1ca1ab13fe\"},\"functionalOperator\":\"in\",\"args\":[{\"valueType\":\"string\",\"value\":\"熟溢香\"}]},{\"field\":{\"fid\":\"1ca1ab13fe\"},\"functionalOperator\":\"in\",\"args\":[{\"valueType\":\"string\",\"value\":\"熟溢香\"}]},{\"field\":{\"fid\":\"e3aec87664\"},\"functionalOperator\":\"in\",\"args\":[{\"valueType\":\"string\",\"value\":\"熟溢香振头店\"}]},{\"logicalOperator\":\"AND\",\"conditions\":[{\"field\":{\"fid\":\"8e55928f76\",\"dateTrunc\":\"day\"},\"functionalOperator\":\"greaterThanOrEqual\",\"args\":[{\"valueType\":\"string\",\"value\":\"20230410\"}]},{\"field\":{\"fid\":\"8e55928f76\",\"dateTrunc\":\"day\"},\"functionalOperator\":\"lessThanOrEqual\",\"args\":[{\"valueType\":\"string\",\"value\":\"20230410\"}]}]}]}},{\"type\":\"sort\",\"cubeId\":\"a16139f4-8f21-4172-afb9-5de69719590e\",\"config\":{\"sortFields\":[{\"sortType\":\"desc\",\"guid\":\"07b482d2-b2e3-4a64-9d8d-3e30c03dfec6\",\"dimValues\":[],\"groupSort\":false},{\"sortType\":\"desc\",\"guid\":\"a4cfd195-dfd3-4947-a024-076ca806793f\",\"dimValues\":[],\"groupSort\":false}]}},{\"type\":\"queryConfig\",\"cubeId\":\"a16139f4-8f21-4172-afb9-5de69719590e\",\"config\":{\"needCount\":false,\"queryCount\":false,\"queryDetail\":false}},{\"type\":\"advancedParam\",\"cubeId\":\"a16139f4-8f21-4172-afb9-5de69719590e\",\"config\":{\"autoInsightParam\":{\"enable\":false},\"wordCloudParam\":{},\"summarizeParams\":[],\"trendLineParams\":[],\"forecastParams\":[],\"anomalyDetectionParams\":[],\"clusteringParams\":[],\"groupParam\":null}},{\"type\":\"annotationParam\",\"cubeId\":\"a16139f4-8f21-4172-afb9-5de69719590e\",\"config\":{\"measureThresholdParams\":[],\"inflectionPointParams\":[]}}],\"dataType\":\"general\",\"reportId\":\"85c4af04-1910-4005-8e47-742af1acb713\"}"); + paramMap.put("componentId","8d8a8363-89d8-4bec-9a58-c7c13ae63f15"); + paramMap.put("reportId","85c4af04-1910-4005-8e47-742af1acb713"); + paramMap.put("componentType","54"); + + String jsonStr = JSONUtil.toJsonStr(paramMap); + String result2 = HttpRequest.post(url) + .header("x-csrf-token", "be369ac4-aa13-4065-8d7c-88117b8cf444")//头信息,多个头信息多次调用此方法即可 + .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") + // .body(jsonStr) + .form(paramMap)//表单内容 + .execute().body(); + System.out.println(result2); + } +} +