Commit cfc27721 by 高宇强

gyq

parent 91f66031
......@@ -43,6 +43,12 @@ class EnterpriseQueryAPI extends APIBase {
case "licenseListByAuthor"://获取企业证照信息列表
opResult = await this.enterSve.licenseListByAuthor(action_body);
break;
case "ipCountByAuthor"://获取企业域名信息数量
opResult = await this.enterSve.ipCountByAuthor(action_body);
break;
case "ipListByAuthor"://获取企业域名信息列表
opResult = await this.enterSve.ipListByAuthor(action_body);
break;
default:
opResult = system.getResult(null, "action_type参数错误");
break;
......
......@@ -6,6 +6,7 @@ class EnterpriseService {
this.gxgyUrl = settings.reqEsAddrIc() + "enterprise_chain_gxgy/_search";
this.licenseUrl = settings.reqEsAddrIc() + "enterprise_chain_license/_search";
this.gameUrl = settings.reqEsAddrIc() + "enterprise_chain_game/_search";
this.ipUrl = settings.reqEsAddrIc() + "bigdata_ip_back/_search";
};
async getConvertSemiangleStr(str) {//半角转全角
......@@ -360,6 +361,83 @@ class EnterpriseService {
return System.getResult2(null, "获取数据出错");
};
};
async ipCountByAuthor(obj) {//获取企业域名信息数量
var author = obj.author == null || obj.author == "" || obj.author == "undefined" ? "" : obj.author;
if (author == "") {
return System.getResult2(null, "企业名称不能为空");
}
author = await this.getConvertSemiangleStr(author);
var params = {
"query": {
"term": {
"company_name.raw": author
}
},
"size": 0
};
var rc = System.getObject("util.execClient");
var rtn = null;
var requrl = this.ipUrl;
try {
rtn = await rc.execPost(params, requrl);
var j = JSON.parse(rtn.stdout);
return System.getResult2(j.hits.total, null);
}
catch (e) {
return System.getResult2(null, "获取数据出错");
};
};
async ipListByAuthor(obj) {//获取企业域名信息列表
var author = obj.author == null || obj.author == "" || obj.author == "undefined" ? "" : obj.author;
var pagesize = obj.page_size == null || obj.page_size == "" || obj.page_size == "undefined" ? 10 : obj.page_size;
var from = obj.current_page == null || obj.current_page == "" || obj.current_page == "undefined" ? 0 : Number((obj.current_page - 1) * pagesize);
if (author == "") {
return System.getResult2(null, "企业名称不能为空");
}
author = await this.getConvertSemiangleStr(author);
var params = {
"query": {
"term": {
"company_name.raw": author
}
},
"from": from,
"size": pagesize,
"_source": [
"company_name",
"card_num",
"web_adress",
"phone",
"phone1",
"phone2"
]
};
var rc = System.getObject("util.execClient");
var rtn = null;
var requrl = this.ipUrl;
try {
rtn = await rc.execPost(params, requrl);
var j = JSON.parse(rtn.stdout);
var res = {};
res.total = 0;
res.data = [];
if (j.hits.total > 0) {
res.total = j.hits.total;
for (var x in j.hits.hits) {
res.data.push(j.hits.hits[x]["_source"]);
}
}
return System.getResult2(res, null);
}
catch (e) {
return System.getResult2(null, "获取数据出错");
};
};
}
module.exports = EnterpriseService;
......
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