Commit 7c6241eb by 宋毅

tj

parent 9f014841
...@@ -23,7 +23,10 @@ class IcQueryAPI extends APIBase { ...@@ -23,7 +23,10 @@ class IcQueryAPI extends APIBase {
switch (actionType) { switch (actionType) {
case "getListByLikeCompanyName": case "getListByLikeCompanyName":
opResult = await this.utilsIcSve.getListByLikeCompanyName(pobj.actionBody); opResult = await this.utilsIcSve.getListByLikeCompanyName(pobj.actionBody);
break; break;
case "getItemByCompanyName":
opResult = await this.utilsIcSve.getItemByCompanyName(pobj.actionBody);
break;
default: default:
opResult = system.getResult(null, "actionType参数错误"); opResult = system.getResult(null, "actionType参数错误");
break; break;
......
...@@ -9,13 +9,12 @@ class UtilsIcService extends AppServiceBase { ...@@ -9,13 +9,12 @@ class UtilsIcService extends AppServiceBase {
this.esUtils = system.getObject("util.esUtils"); this.esUtils = system.getObject("util.esUtils");
} }
/** /**
* 接口跳转-POST请求 * 公司模糊查询
* action_type 执行的类型 * actionBody {companyName:公司名称,currentPage:第几页,pageSize:每页大小}
* action_body 执行的参数
*/ */
async getListByLikeCompanyName(actionBody) { async getListByLikeCompanyName(actionBody) {
if (!actionBody.companyName) { if (!actionBody.companyName) {
return system.getResult(null, "查询的公司名称不能为空"); return system.getResult(null, "companyName can not be empty");
} }
actionBody.companyName = await this.getConvertSemiangleStr(actionBody.companyName); actionBody.companyName = await this.getConvertSemiangleStr(actionBody.companyName);
var pageSize = !actionBody.pageSize ? 15 : Number(actionBody.pageSize); var pageSize = !actionBody.pageSize ? 15 : Number(actionBody.pageSize);
...@@ -44,6 +43,109 @@ class UtilsIcService extends AppServiceBase { ...@@ -44,6 +43,109 @@ class UtilsIcService extends AppServiceBase {
"from": from, "from": from,
"size": pageSize, "size": pageSize,
"_source": [ "_source": [
"company_name"//公司名称
// "company_org_type",//公司类型
// "credit_code",//统一社会信用代码
// "legal_person",//法人姓名
// "from_time",//营业期限开始日期
// "to_time",//营业期限结束日期
// "estiblish_time",//成立时间
// "reg_status",//公司状态
// "reg_number",//注册号
// "org_number",//组织机构代码
// "reg_location",//公司地址
// "reg_capital",//注册资本
// "business_scope",//公司经营范围
// "reg_institute",//登记机关
// "company_province",//公司省份
// "company_city",//公司二级市
// "company_cate_1",//行业分类一级分类
// "company_cate_2",//行业分类二级分类
// "company_cate_3"//行业分类三级分类
]
// ,
// "sort": [
// {
// "reg_capital": "desc"
// }
// ]
}
var resultData = null;
try {
resultData = await this.esUtils.execPostEs(settings.queuedName, params, esIndexName);
var sources = [];
var data = {
"totalCount": resultData.data.hits.total,
"pageSize": pageSize,
"currentPage": from === 0 ? from : (from - 1),
"list": sources
};
if (!resultData.data.hits) {
return system.getResult(null, "data is empty");
}
if (!resultData.data.hits.hits || resultData.data.hits.hits.length === 0) {
return system.getResult(null, "data is empty!");
}
resultData.data.hits.hits.forEach(function (c) {
var source = {
"companyName": c._source.company_name//公司名称
// "companyOrgType": c._source.company_org_type || "",//公司类型
// "creditCode": c._source.credit_code || "",//统一社会信用代码
// "legalPerson": c._source.legal_person,//法人姓名
// "fromTime": c._source.from_time ? moment(c._source.from_time * 1000).format("YYYY-MM-DD") : "",//营业期限开始日期
// "toTime": c._source.to_time ? moment(c._source.to_time * 1000).format("YYYY-MM-DD") : "",//营业期限结束日期
// "estiblishTime": c._source.estiblish_time ? moment(c._source.estiblish_time * 1000).format("YYYY-MM-DD") : "",//成立时间
// "regStatus": c._source.reg_status || "",//公司状态
// "regNumber": c._source.reg_number || "",//注册号
// "orgNumber": c._source.org_number || "",//组织机构代码
// "regLocation": c._source.reg_location || "",//公司地址
// "regCapital": c._source.reg_capital || "",//注册资本
// "businessScope": c._source.business_scope || "",//公司经营范围
// "regInstitute": c._source.reg_institute || "",//登记机关
// "companyProvince": c._source.company_province || "",//公司省份
// "companyCity": c._source.company_city || "",//公司二级市
// "companyCate1": c._source.company_cate_1 || "",//行业分类一级分类
// "companyCate2": c._source.company_cate_2 || "",//行业分类二级分类
// "companyCate3": c._source.company_cate_3 || ""//行业分类三级分类
};
sources.push(source);
});
return system.getResultSuccess(data);
} catch (e) {
console.log(e.stack, ".. getListByLikeCompanyName query is error");
//TODO:日志
return system.getResultError("query is error");
}
}
/**
* 公司精确查询
* actionBody {companyName:公司名称}
*/
async getItemByCompanyName(actionBody) {
if (!actionBody.companyName) {
return system.getResult(null, "companyName can not be empty");
}
actionBody.companyName = await this.getConvertSemiangleStr(actionBody.companyName);
var esIndexName = "tx_ic_bigdata_business_index/_search";
var params = {
"query": {
"bool": {
"must": [
{
"term": {
"company_name.raw": actionBody.companyName
}
}
]
}
},
"from": 0,
"size": 1,
"_source": [
"company_name",//公司名称 "company_name",//公司名称
"company_org_type",//公司类型 "company_org_type",//公司类型
"credit_code",//统一社会信用代码 "credit_code",//统一社会信用代码
...@@ -76,54 +178,41 @@ class UtilsIcService extends AppServiceBase { ...@@ -76,54 +178,41 @@ class UtilsIcService extends AppServiceBase {
var resultData = null; var resultData = null;
try { try {
resultData = await this.esUtils.execPostEs(settings.queuedName, params, esIndexName); resultData = await this.esUtils.execPostEs(settings.queuedName, params, esIndexName);
var sources = [];
var data = {
"totalCount": resultData.data.hits.total,
"pageSize": pageSize,
"currentPage": actionBody.currentPage - 1,
"list": sources
};
if (!resultData.data.hits) { if (!resultData.data.hits) {
return system.getResultSuccess(); return system.getResult(null, "data is empty");
} }
if (!resultData.data.hits.hits) { if (!resultData.data.hits.hits || resultData.data.hits.hits.length === 0) {
return system.getResultSuccess(); return system.getResult(null, "data is empty!");
} }
resultData.data.hits.hits.forEach(function (c) { var item = {
if (c._source.estibish_time != null) { "companyName": resultData.data.hits.hits[0]._source.company_name,//公司名称
var time = new Date(c._source.estibish_time * 1000); "companyOrgType": resultData.data.hits.hits[0]._source.company_org_type || "",//公司类型
c._source.estibish_time = time.toLocaleDateString(); "creditCode": resultData.data.hits.hits[0]._source.credit_code || "",//统一社会信用代码
} "legalPerson": resultData.data.hits.hits[0]._source.legal_person,//法人姓名
var source = { "fromTime": resultData.data.hits.hits[0]._source.from_time ? moment(resultData.data.hits.hits[0]._source.from_time * 1000).format("YYYY-MM-DD") : "",//营业期限开始日期
"companyName": c._source.company_name,//公司名称 "toTime": resultData.data.hits.hits[0]._source.to_time ? moment(resultData.data.hits.hits[0]._source.to_time * 1000).format("YYYY-MM-DD") : "",//营业期限结束日期
"companyOrgType": c._source.company_org_type || "",//公司类型 "estiblishTime": resultData.data.hits.hits[0]._source.estiblish_time ? moment(resultData.data.hits.hits[0]._source.estiblish_time * 1000).format("YYYY-MM-DD") : "",//成立时间
"creditCode": c._source.credit_code || "",//统一社会信用代码 "regStatus": resultData.data.hits.hits[0]._source.reg_status || "",//公司状态
"legalPerson": c._source.legal_person,//法人姓名 "regNumber": resultData.data.hits.hits[0]._source.reg_number || "",//注册号
"fromTime": c._source.from_time ? moment(c._source.from_time * 1000).format("YYYY-MM-DD") : "",//营业期限开始日期 "orgNumber": resultData.data.hits.hits[0]._source.org_number || "",//组织机构代码
"toTime": c._source.to_time ? moment(c._source.to_time * 1000).format("YYYY-MM-DD") : "",//营业期限结束日期 "regLocation": resultData.data.hits.hits[0]._source.reg_location || "",//公司地址
"estiblishTime": c._source.estiblish_time ? moment(c._source.estiblish_time * 1000).format("YYYY-MM-DD") : "",//成立时间 "regCapital": resultData.data.hits.hits[0]._source.reg_capital || "",//注册资本
"regStatus": c._source.reg_status || "",//公司状态 "businessScope": resultData.data.hits.hits[0]._source.business_scope || "",//公司经营范围
"regNumber": c._source.reg_number || "",//注册号 "regInstitute": resultData.data.hits.hits[0]._source.reg_institute || "",//登记机关
"orgNumber": c._source.org_number || "",//组织机构代码 "companyProvince": resultData.data.hits.hits[0]._source.company_province || "",//公司省份
"regLocation": c._source.reg_location || "",//公司地址 "companyCity": resultData.data.hits.hits[0]._source.company_city || "",//公司二级市
"regCapital": c._source.reg_capital || "",//注册资本 "companyCate1": resultData.data.hits.hits[0]._source.company_cate_1 || "",//行业分类一级分类
"businessScope": c._source.business_scope || "",//公司经营范围 "companyCate2": resultData.data.hits.hits[0]._source.company_cate_2 || "",//行业分类二级分类
"regInstitute": c._source.reg_institute || "",//登记机关 "companyCate3": resultData.data.hits.hits[0]._source.company_cate_3 || ""//行业分类三级分类
"companyProvince": c._source.company_province || "",//公司省份 };
"companyCity": c._source.company_city || "",//公司二级市 return system.getResultSuccess(item);
"companyCate1": c._source.company_cate_1 || "",//行业分类一级分类
"companyCate2": c._source.company_cate_2 || "",//行业分类二级分类
"companyCate3": c._source.company_cate_3 || ""//行业分类三级分类
};
sources.push(source);
});
// j.hits.hits = data;
return system.getResultSuccess(data);
} catch (e) { } catch (e) {
return { status: -1, msg: "操作失败", data: null }; //TODO:日志
console.log(e.stack, ".. getItemByCompanyName query is error");
return system.getResultError("query is error");
} }
} }
async getConvertSemiangleStr(str) { async getConvertSemiangleStr(str) {
var result = ""; var result = "";
str = str.replace(/\s+/g, ""); str = str.replace(/\s+/g, "");
......
...@@ -135,8 +135,7 @@ class System { ...@@ -135,8 +135,7 @@ class System {
return { return {
status: !data ? -1 : 1, status: !data ? -1 : 1,
message: opmsg, message: opmsg,
data: data, data: data
bizmessage: req && req.session && req.session.bizmsg ? req.session.bizmsg : "empty"
}; };
} }
/** /**
...@@ -217,7 +216,7 @@ class System { ...@@ -217,7 +216,7 @@ class System {
try { try {
ClassObj = require(objabspath); ClassObj = require(objabspath);
} catch (e) { } catch (e) {
console.log(e.stack,"...getObject.....errror"); console.log(e.stack, "...getObject.....errror");
let fname = objsettings[packageName + "base"]; let fname = objsettings[packageName + "base"];
ClassObj = require(fname); ClassObj = require(fname);
} }
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
二.公共队列接口 二.公共队列接口
1.生产业务数据供消费者消费 1.生产业务数据供消费者消费
地址:http://60.205.209.94:4018/api/queueAction/producer/springBoard 地址:http://192.168.1.128:4018/api/queueAction/producer/springBoard
请求方式:post 请求方式:post
参数: 参数:
{ {
...@@ -76,7 +76,7 @@ ...@@ -76,7 +76,7 @@
} }
2.生产日志数据供消费者消费 2.生产日志数据供消费者消费
地址:http://60.205.209.94:4019/api/queueAction/producer/springBoard 地址:http://192.168.1.128:4019/api/queueAction/producer/springBoard
请求方式:post 请求方式:post
参数: 参数:
{ {
...@@ -101,7 +101,7 @@ ...@@ -101,7 +101,7 @@
三.业务查询接口 三.业务查询接口
1.tx cos 信息获取 1.tx cos 信息获取
地址:http://60.205.209.94:4018/api/uploadAction/txCos/getCosInfo 地址:http://192.168.1.128:4018/api/uploadAction/txCos/getCosInfo
请求方式:get 请求方式:get
参数:无 参数:无
返回参数: 返回参数:
...@@ -124,7 +124,7 @@ ...@@ -124,7 +124,7 @@
"requestId": "SCZ202006172105Wz6yF" "requestId": "SCZ202006172105Wz6yF"
} }
2.企业模糊查询信息 2.企业模糊查询信息
地址:http://60.205.209.94:4018/api/icAction/icQuery/springBoard 地址:http://192.168.1.128:4018/api/icAction/icQuery/springBoard
请求方式:get 请求方式:get
参数: 参数:
{ {
...@@ -140,32 +140,61 @@ ...@@ -140,32 +140,61 @@
"data": { "data": {
"totalCount": 3, "totalCount": 3,
"pageSize": 15, "pageSize": 15,
"currentPage": null, "currentPage": 0,
"list": [ "list": [
{ {
"companyName": "上海汉玉实业有限公司", "companyName": "上海汉玉实业有限公司"
"companyOrgType": "有限责任公司", },
"creditCode": null, {
"legalPerson": "曹雪静", "companyName": "广州贤玉实业有限公司"
"fromTime": "2008-03-20", },
"toTime": "2018-03-19", {
"estiblishTime": "2008-03-20", "companyName": "上海琦玉实业有限公司"
"regStatus": "注销",
"regNumber": "310228001075786",
"orgNumber": " ",
"regLocation": "上海市金山区卫昌路229号2幢220室",
"regCapital": "3.000",
"businessScope": "化妆品,日用百货,服装鞋帽,健身器材销售,投资咨询、商务咨询(除经纪)(涉及行政许可的凭许可证经营)。",
"regInstitute": "金山区市场监管局",
"companyProvince": "上海",
"companyCity": "金山区",
"companyCate1": "批发和零售业",
"companyCate2": "批发业",
"companyCate3": "纺织、服装及家庭用品批发"
} }
] ]
}, },
"requestId": "SCZ202006172233xV7el" "requestId": "SCZ2020061816078D804"
}
参数说明:
"companyName": "上海汉玉实业有限公司",//公司名称
3.企业精确查询信息
地址:http://192.168.1.128:4018/api/icAction/icQuery/springBoard
请求方式:get
参数:
{
"actionType":"getItemByCompanyName",
"actionBody":{
"companyName":"上海汉玉实业有限公司"
}
}
返回参数:
{
"status": 1,
"message": "success",
"data": {
"companyName": "上海汉玉实业有限公司",
"companyOrgType": "有限责任公司",
"creditCode": "",
"legalPerson": "曹雪静",
"fromTime": "2008-03-20",
"toTime": "2018-03-19",
"estiblishTime": "2008-03-20",
"regStatus": "注销",
"regNumber": "310228001075786",
"orgNumber": " ",
"regLocation": "上海市金山区卫昌路229号2幢220室",
"regCapital": "3.000",
"businessScope": "化妆品,日用百货,服装鞋帽,健身器材销售,投资咨询、商务咨询(除经纪)(涉及行政许可的凭许可证经营)。",
"regInstitute": "金山区市场监管局",
"companyProvince": "上海",
"companyCity": "金山区",
"companyCate1": "批发和零售业",
"companyCate2": "批发业",
"companyCate3": "纺织、服装及家庭用品批发"
},
"requestId": "SCZ202006181604MJBns"
} }
参数说明: 参数说明:
...@@ -188,4 +217,4 @@ ...@@ -188,4 +217,4 @@
"companyCity": "金山区",//公司二级市 "companyCity": "金山区",//公司二级市
"companyCate1": "批发和零售业",//行业分类一级分类 "companyCate1": "批发和零售业",//行业分类一级分类
"companyCate2": "批发业",//行业分类二级分类 "companyCate2": "批发业",//行业分类二级分类
"companyCate3": "纺织、服装及家庭用品批发"//行业分类三级分类 "companyCate3": "纺织、服装及家庭用品批发"//行业分类三级分类
\ No newline at end of file \ No newline at end of file
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