Commit e6365357 by 王勇飞

gyq

parent 5ea39fe6
......@@ -1225,6 +1225,66 @@ class CPatentAggregationsApi extends ApiBase {
};
async ApplKeywordAggs(obj) {//申请人关键词双重聚合
var params = {
"query": {
"bool": {
"must": []
}
},
"from": 0,
"size": 1,
"aggregations": {
"group_by_appl": {
"terms": {
"field": "applicant_name.raw",
"size": 10,
"order": {
"_count": "desc"
}
},
"aggregations": {
"group_by_keyword": {
"terms": {
"field": "key_word",
"size": 20,
"order": {
"_count": "desc"
}
}
}
}
}
}
};
for (var x in obj) {
params.query.bool.must.push(obj[x]);
}
var rc = System.getObject("util.execClient");
var rtn = null;
var requrl = this.patentUrl;
try {
rtn = await rc.execPost(params, requrl);
var j = JSON.parse(rtn.stdout);
return rtn = {
status: 0,
msg: "操作成功",
data: j.hits,
buckets: j.aggregations
};
} catch (e) {
return rtn = {
status: -1,
msg: "操作失败",
data: null,
buckets: null
};
}
};
async AppIpclgAggs(obj) {//Ipc大组聚合
var params = {
"query": {
......
......@@ -6,6 +6,8 @@ class ExecClient {
constructor() {
this.cmdPostPattern = "curl --user admines:adminGSBes. -k -H 'Content-type: application/json' -d '{data}' {url}";
this.cmdGetPattern = "curl -G -X GET '{url}'";
this.cmdPostPattern2 = "curl -k -H 'Content-type: application/json' -d '{data}' {url}";
this.cmdPostPattern3 = "curl -k -H 'Content-type: application/json' -H 'token: {token}' -d '{data}' {url}";
}
async exec(cmd) {
......@@ -30,12 +32,39 @@ class ExecClient {
return cmd;
}
FetchPostCmd2(subData, url) {
var data = JSON.stringify(subData);
var cmd = this.cmdPostPattern2.replace(/\{data\}/g,
data).replace(/\{url\}/g, url);
console.log(cmd);
return cmd;
}
FetchPostCmd3(token,subData, url) {
var data = JSON.stringify(subData);
var cmd = this.cmdPostPattern3.replace(/\{token\}/g,token).replace(/\{data\}/g,data).replace(/\{url\}/g, url);
console.log(cmd);
return cmd;
}
async execPost(subData, url) {
let cmd = this.FetchPostCmd(subData, url);
var result = await this.exec(cmd);
return result;
}
async execPost3(subData, url) {
let cmd = this.FetchPostCmd2(subData, url);
var result = await this.exec(cmd);
return result;
}
async execPost4(token,subData, url) {
let cmd = this.FetchPostCmd3(token,subData, url);
var result = await this.exec(cmd);
return result;
}
async execPost2(subData, url) {
let cmd = this.FetchPostCmd(subData, url);
var result = await this.exec2(cmd);
......
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