Commit 9fb59832 by 张云飞

zyf

parent cf01e8f5
......@@ -349,6 +349,77 @@ class ToolApi extends ApiBase {
}
}
//数据中心工商模糊查询接口
async getCompanyListByVague(pobj,o, req) {
var appkey = this.appKeyStr;
var pageSize = o.pageSize ? o.pageSize : 20;
var currentPage = o.currentPage ? o.currentPage : 1;
var data = {
appKey: appkey,
pageSize: pageSize,
currentPage: currentPage,
companyName: o.companyName,
};
var company = await this.gsbIcSearchApi.companyvaguesearch(data);
if (company.status == 0 && company.data.totalSize > 0) {
return company;
} else {
return {};
}
}
//公司详情信息
async getDetailByCompanyName(pobj,o, req) {
var appkey = this.appKeyStr;
var data = {
appKey: appkey,
companyName: o.companyName,
};
var company = await this.gsbIcSearchApi.companydetailsearch(data);
if (company.status == 0 && company.data.totalSize > 0) {
return company.data.list[0];
} else {
return {};
}
}
//企业变更记录查询
async getCompanyChangeByName(pobj,o, req) {
var appkey = this.appKeyStr;
var pageSize = o.pageSize ? o.pageSize : 20;
var currentPage = o.currentPage ? o.currentPage : 1;
var data = {
appKey: appkey,
pageSize: pageSize,
currentPage: currentPage,
companyName: o.companyName,
};
var company = await this.gsbIcSearchApi.companychangesearch(data);
if (company.status == 0 && company.data.totalSize > 0) {
return company;
} else {
return {};
}
}
//企业ICP证照数据
async getCompanyIcpByName(pobj,o, req) {
var appkey = this.appKeyStr;
var pageSize = o.pageSize ? o.pageSize : 20;
var currentPage = o.currentPage ? o.currentPage : 1;
var data = {
appKey: appkey,
pageSize: pageSize,
currentPage: currentPage,
companyName: o.companyName,
};
var company = await this.gsbIcSearchApi.companyicpsearch(data);
if (company.status == 0 && company.data.totalSize > 0) {
return company;
} else {
return {};
}
}
async getCropperPic(qobj, obj, req) {
var that = this;
var base64 = obj.base64;
......
......@@ -9,6 +9,7 @@ class GsbIcSearchApi extends ApiBase {
this.icshareholderSearchUrl = settings.apiconfig.icshareholderSearchUrl(settings.env);
this.icinvestSearchUrl = settings.apiconfig.icinvestSearchUrl(settings.env);
this.icchangeSearchUrl = settings.apiconfig.icchangeSearchUrl(settings.env);
this.iccompanyicpSearchUrl = settings.apiconfig.iccompanyicpSearchUrl(settings.env);
this.iccompanynameSearchUrl = settings.apiconfig.iccompanynameSearchUrl(settings.env);
this.agencynameSearchUrl = settings.apiconfig.agencynameSearchUrl(settings.env);
this.iccompanycodeSearchUrl = settings.apiconfig.iccompanycodeSearchUrl(settings.env);
......@@ -653,6 +654,465 @@ class GsbIcSearchApi extends ApiBase {
}
};
//数据中心工商模糊查询接口
async companyvaguesearch(obj) {
var companyName = obj.companyName == null ? "" : obj.companyName;
companyName = await this.getConvertSemiangleStr(companyName);
var pageSize = 20;
if (obj.currentPage == null) {
var from = 0;
} else {
var from = Number((obj.currentPage - 1) * obj.pageSize);
}
var reqUrl = this.iccompanynameSearchUrl;
var params = {
"query": {
"bool": {
"should": [
{
"term": {
"credit_code": companyName
}
},
{
"term": {
"reg_number": companyName
}
}
]
}
},
"from": from,
"size": pageSize,
"_source": [
"id",
"company_province",
"company_name",
"gsb_city",
"company_domain",
"legal_person",
"reg_number",
"company_org_type",
"reg_location",
"estiblish_time",
"from_time",
"to_time",
"business_scope",
"reg_institute",
"approved_time",
"reg_status",
"reg_capital",
"reg_unit",
"org_number",
"old_name",
"credit_code",
"gsb_company_cate_1",
"gsb_company_cate_2",
"gsb_company_cate_3",
"company_type"
]
};
// company_province     :省份
// gsb_city     :市或区
// company_domain     :公司名称
// legal_person   :法人
// reg_number    :工商注册号
// company_org_type     :公司类型
// reg_location     :注册地址
// estiblish_time      :成立时间
// from_time 至 to_time :营业期限_开始 至 营业期限_结束
// business_scope      :经营范围
// reg_institute      :登记机关
// approved_time      :核准时间
// reg_status         :经营状态
// reg_capital/reg_unit :注册资本/注册资本_单位
// org_number :组织机构代码
// old_name :曾用名
// credit_code :统一社会信用代码
// gsb_company_cate_1 :行业大类一类
// gsb_company_cate_2 :行业大类二类
// gsb_company_cate_3 :行业大类三类
if (/^[\u3220-\uFA29]+$/.test(companyName)) {
var company_name_param = {
"match": {
"company_name": companyName
}
}
var old_name_param = {
"wildcard": {
"old_name": "*" + companyName + "*"
}
}
params.query.bool.should.push(company_name_param);
params.query.bool.should.push(old_name_param);
}
var rc = System.getObject("util.execClient");
var rtn = null;
try {
rtn = await rc.execPost(params, reqUrl);
var j = JSON.parse(rtn.stdout);
var sources = [];
var data = {
"totalSize": j.hits.total,
"pageSize": 20,
"currentPage": obj.currentPage, "list": sources
};
j.hits.hits.forEach(function (c) {
if (c._source.estiblish_time != null) {
var time3 = new Date(c._source.estiblish_time * 1000);
c._source.estiblish_time = time3.toLocaleDateString();
}
var source = {
id: c._source.id,
name: c._source.company_name,
legal_person_name: c._source.legal_person,
reg_number: c._source.reg_number,
establish_time: c._source.estiblish_time || "",
gsb_old_company_name: c._source.old_name,
reg_status: c._source.reg_status,
reg_capital: c._source.reg_capital + c._source.reg_unit || "万人民币",
usc_code: c._source.credit_code
};
sources.push(source);
});
var a = { status: 0, msg: "操作成功", data: data };
return a;
} catch (e) {
return { status: -1, msg: "操作失败", data: null };
}
};
//公司详情信息
async companydetailsearch(obj) {
var companyName = obj.companyName == null ? "" : obj.companyName;
companyName = await this.getConvertSemiangleStr(companyName);
var reqUrl = this.iccompanynameSearchUrl;
var params = {
"query": {
"bool": {
"must": [
{
"term": {
"company_name.raw": companyName
}
}
]
}
},
"size": 3,
"_source": [
"company_province",
"gsb_city",
"company_domain",
"legal_person",
"reg_number",
"company_org_type",
"reg_location",
"estiblish_time",
"from_time",
"to_time",
"business_scope",
"reg_institute",
"approved_time",
"reg_status",
"reg_capital",
"reg_unit",
"org_number",
"credit_code",
"gsb_company_cate_1",
"gsb_company_cate_2",
"gsb_company_cate_3",
"company_type",
"id",
"company_name",
"old_name",
"base"
]
};
// company_province     :省份
// gsb_city     :市或区
// company_domain     :公司名称
// legal_person   :法人
// reg_number    :工商注册号
// company_org_type     :公司类型
// reg_location     :注册地址
// estiblish_time      :成立时间
// from_time 至 to_time :营业期限_开始 至 营业期限_结束
// business_scope      :经营范围
// reg_institute      :登记机关
// approved_time      :核准时间
// reg_status         :经营状态
// reg_capital/reg_unit :注册资本/注册资本_单位
// org_number :组织机构代码
// credit_code :统一社会信用代码
// gsb_company_cate_1 :行业大类一类
// gsb_company_cate_2 :行业大类二类
// gsb_company_cate_3 :行业大类三类
// company_name :公司名称
// old_name :曾用名
// base :省份
var rc = System.getObject("util.execClient");
var rtn = null;
var self = this;
try {
rtn = await rc.execPost(params, reqUrl);
var j = JSON.parse(rtn.stdout);
var sources = [];
var data = {
"totalSize": j.hits.total,
"list": sources
};
for (var k = 0; k < j.hits.hits.length; k++) {
var c = j.hits.hits[k];
if (c._source.approved_time != null) {
var time3 = new Date(c._source.approved_time * 1000);
c._source.approved_time = time3.toLocaleDateString();
}
if (c._source.from_time != null) {
var time3 = new Date(c._source.from_time * 1000);
c._source.from_time = time3.toLocaleDateString();
}
if (c._source.to_time != null) {
var time3 = new Date(c._source.to_time * 1000);
c._source.to_time = time3.toLocaleDateString();
}
if (c._source.estiblish_time != null) {
var time3 = new Date(c._source.estiblish_time * 1000);
c._source.estiblish_time = time3.toLocaleDateString();
}
if (c._source.company_domain) {
var pobj = {
appKey: obj.appKey,
companyName: c._source.company_domain
}
var phones = await self.phonesearch.phoneNameSearch(pobj);
if (phones.status == 0 && phones.data.list.length > 0) {
c._source.tel_info = phones.data.list[0]._doc.phone_number;
c._source.postal_address = phones.data.list[0]._doc.postal_address;
c._source.email_info = phones.data.list[0]._doc.email;
}
}
var source = {
company_province: c._source.company_province,
gsb_city: c._source.gsb_city,
company_name: c._source.company_name,
legal_person: c._source.legal_person,
reg_number: c._source.reg_number,
company_org_type: c._source.company_org_type,
businessAddress: c._source.reg_location,
reg_location: c._source.estiblish_time || "",
from_time: c._source.from_time,
to_time: c._source.to_time,
businessTerm: c._source.from_time + "至" + c._source.to_time,
business_scope: c._source.business_scope,
reg_institute: c._source.reg_institute,
approved_time: c._source.approved_time,
reg_status: c._source.reg_status,
reg_capital: c._source.reg_capital,
reg_unit: c._source.reg_unit || "万人民币",
registeredCapital: c._source.reg_capital + (c._source.reg_unit || "万人民币"),
org_number: c._source.org_number,
credit_code: c._source.credit_code,
gsb_company_cate_1: c._source.gsb_company_cate_1,
gsb_company_cate_2: c._source.gsb_company_cate_2,
gsb_company_cate_3: c._source.gsb_company_cate_3,
company_type: c._source.company_type,
old_name: c._source.old_name,
phone_number: c._source.tel_info || "",
postal_address: c._source.postal_address || "",
email: c._source.email_info || ""
};
sources.push(source);
};
var a = { status: 0, msg: "操作成功", data: data };
return a;
} catch (e) {
return { status: -1, msg: "操作失败", data: null };
}
};
//企业变更记录查询
async companychangesearch(obj) {
var companyName = obj.companyName == null ? "" : obj.companyName;
companyName = await this.getConvertSemiangleStr(companyName);
var pageSize = obj.pageSize == null ? 15 : obj.pageSize;
if (obj.currentPage == null) {
var from = 0;
} else {
var from = Number((obj.currentPage - 1) * obj.pageSize);
}
var reqUrl = this.icchangeSearchUrl;
var params = {
"query": {
"bool": {
"must": [
{
"term": {
"company_name.raw": companyName
}
}
]
}
},
"from": from,
"size": pageSize,
"_source": [
"company_id",
"company_name", //企业名称
"usc_code", //统一社会信用代码,
"reg_number", //注册号,
"change_item", //"经营范围",
"content_before", //变更前内容
"content_after", //变更后内容
"change_time", // 变更日期,
"create_time" //创建时间
]
};
var rc = System.getObject("util.execClient");
var rtn = null;
try {
rtn = await rc.execPost(params, reqUrl);
var j = JSON.parse(rtn.stdout);
var sources = [];
var data = {
"totalSize": j.hits.total,
"pageSize": pageSize,
"currentPage": obj.currentPage, "list": sources
};
j.hits.hits.forEach(function (c) {
if (c._source.change_time != null) {
var time3 = new Date(c._source.change_time * 1000);
c._source.change_time = time3.toLocaleDateString();
}
var source = {
company_id: c._source.company_id,
company_name: c._source.company_name,
usc_code: c._source.usc_code,
reg_number: c._source.reg_number,
change_item: c._source.change_item,
change_time: c._source.change_time,
content_before: c._source.content_before,
content_after: c._source.content_after,
content_before: c._source.content_before,
create_time: c._source.create_time
};
sources.push(source);
});
var a = { status: 0, msg: "操作成功", data: data };
return a;
} catch (e) {
return { status: -1, msg: "操作失败", data: null };
}
};
//企业ICP证照数据
async companyicpsearch(obj) {
var companyName = obj.companyName == null ? "" : obj.companyName;
companyName = await this.getConvertSemiangleStr(companyName);
var pageSize = obj.pageSize == null ? 15 : obj.pageSize;
if (obj.currentPage == null) {
var from = 0;
} else {
var from = Number((obj.currentPage - 1) * obj.pageSize);
}
var reqUrl = this.iccompanyicpSearchUrl;
var params = {
"query": {
"bool": {
"must": [
{
"term": {
"company_name.raw": companyName
}
}
]
}
},
"from": from,
"size": pageSize,
"_source": [
"company_id",
"icp_id",
"company_name",
"company_type",
"liscense",
"web_name",
"web_site",
"examine_date",
"dwmc",
"ztid",
"dwxz",
"zt_baxh",
"wzid",
"wzmc",
"wzfzr",
"site_url",
"ym",
"wz_baxh",
"shsj",
"shengid",
"shiid",
"xianid",
"xxdz",
"ymid",
"updatetime",
"createtime"
]
};
var rc = System.getObject("util.execClient");
var rtn = null;
try {
rtn = await rc.execPost(params, reqUrl);
var j = JSON.parse(rtn.stdout);
var sources = [];
var data = {
"totalSize": j.hits.total,
"pageSize": pageSize,
"currentPage": obj.currentPage, "list": sources
};
j.hits.hits.forEach(function (c) {
var source = {
company_id: c._source.company_id,
icp_id: c._source.icp_id,
company_name: c._source.company_name,
company_type: c._source.company_type,
liscense: c._source.liscense,
web_name: c._source.web_name,
web_site: c._source.web_site,
examine_date: c._source.examine_date,
dwmc: c._source.dwmc,
ztid: c._source.ztid,
dwxz: c._source.dwxz,
zt_baxh: c._source.zt_baxh,
wzid: c._source.wzid,
wzmc: c._source.wzmc,
wzfzr: c._source.wzfzr,
site_url: c._source.site_url,
ym: c._source.ym,
wz_baxh: c._source.wz_baxh,
shsj: c._source.shsj,
shengid: c._source.shengid,
shiid: c._source.shiid,
xianid: c._source.xianid,
xxdz: c._source.xxdz,
ymid: c._source.ymid,
updatetime: c._source.updatetime,
createtime: c._source.createtime
};
sources.push(source);
});
var a = { status: 0, msg: "操作成功", data: data };
return a;
} catch (e) {
return { status: -1, msg: "操作失败", data: null };
}
};
async companymgetsearch(obj) {
var self = this;
......
......@@ -167,8 +167,11 @@ var settings = {
icinvestSearchUrl: function () {
return settings.reqEsAddrIc() + "bigdata_ic_gsb_invest_op/_search";
},
iccompanyicpSearchUrl: function () {
return settings.reqEsAddrIc() + "bigdata_company_icp_record_all_final/_search";
},
icchangeSearchUrl: function () {
return settings.reqEsAddrIc() + "bigdata_ic_gsb_change_op/_search";
return settings.reqEsAddrIc() + "bigdata_ic_gsb_change_1/_search";
},
iccompanynameSearchUrl: function () {
return settings.reqEsAddrIc() + "bigdata_ic_gsb_company_op/_search";
......
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