Commit 4724f522 by 王栋源

Merge branch 'igirl-zcapi' of gitlab.gongsibao.com:jiangyong/zhichan into igirl-zcapi

parents 1f7f61fd a4d4ad31
var APIBase = require("../../api.base");
var system = require("../../../system");
class EnterpriseQueryAPI extends APIBase {
constructor() {
super();
this.enterSve = system.getObject("service.enterprise.enterpriseSve");
}
/**
* 接口跳转-POST请求
* action_type 执行的类型
* action_body 执行的参数
*/
async springBoard(pobj, qobj, req) {
if (!pobj.actionType) {
return system.getResult(null, "actionType参数不能为空");
}
var result = await this.opActionProcess(pobj.actionType, pobj.actionBody);
return result;
}
async opActionProcess(action_type, action_body) {
var opResult = null;
switch (action_type) {
case "test"://测试
opResult = system.getResultSuccess(null, "测试成功");
break;
case "gxCountByAuthor"://获取企业高薪信息数量
opResult = await this.enterSve.gxCountByAuthor(action_body);
break;
case "gxListByAuthor"://获取企业高薪信息列表
opResult = await this.enterSve.gxListByAuthor(action_body);
break;
case "gameCountByAuthor"://获取企业游戏出版及运营数量
opResult = await this.enterSve.gameCountByAuthor(action_body);
break;
case "gameListByAuthor"://获取企业游戏出版及运营信息列表
opResult = await this.enterSve.gameListByAuthor(action_body);
break;
case "licenseCountByAuthor"://获取企业证照信息数量
opResult = await this.enterSve.licenseCountByAuthor(action_body);
break;
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;
case "getQccBranches"://获取企业的分支机构(从企查查获取)
opResult = await this.enterSve.getQccBranches(action_body);
break;
case "getcountAll"://获取企业所有证照数量
opResult = await this.enterSve.getcountAll(action_body);
break;
default:
opResult = system.getResult(null, "action_type参数错误");
break;
}
return opResult;
}
}
module.exports = EnterpriseQueryAPI;
// var tesk = new EnterpriseQueryAPI();
// var parm = {
// actionType:"getLicenses",
// actionBody:{name:"上海盛霄云计算技术有限公司"}
// };
// tesk.springBoard(parm).then(function(result){
// console.log(result);
// //console.log(result.data.data[0]);
// }).catch(function(e){
// console.log(e);
// });
\ No newline at end of file
var APIBase = require("../../api.base");
var system = require("../../../system");
class LicenseQueryAPI extends APIBase {
constructor() {
super();
this.liecseSve = system.getObject("service.licenses.licenseSve");
}
/**
* 接口跳转-POST请求
* action_type 执行的类型
* action_body 执行的参数
*/
async springBoard(pobj, qobj, req) {
if (!pobj.actionType) {
return system.getResult(null, "actionType参数不能为空");
}
var result = await this.opActionProcess(pobj.actionType, pobj.actionBody);
return result;
}
async opActionProcess(action_type, action_body) {
var opResult = null;
switch (action_type) {
case "test"://测试
opResult = system.getResultSuccess(null, "测试成功");
break;
case "getLicenses"://根据公司得到推荐要办的证书
opResult = await this.liecseSve.getLicenses(action_body);
break;
// case "getLicenfgfg"://根据公司得到推荐要办的证书
// opResult = await this.liecseSve.getLicenfgfg(action_body);
// break;
default:
opResult = system.getResult(null, "action_type参数错误");
break;
}
return opResult;
}
}
module.exports = LicenseQueryAPI;
// var tesk = new LicenseQueryAPI();
// var parm = {
// actionType:"getLicenses",
// actionBody:{name:"上海盛霄云计算技术有限公司"}
// };
// tesk.springBoard(parm).then(function(result){
// console.log(result);
// //console.log(result.data.data[0]);
// }).catch(function(e){
// console.log(e);
// });
\ No newline at end of file
var APIBase = require("../../api.base");
var system = require("../../../system");
class PatentQueryAPI extends APIBase {
constructor() {
super();
this.cpatentsearchApi = system.getObject("api.patent.chinapatentsearch");
this.cpatentaggApi = system.getObject("api.patent.cpatentaggregations");
this.caffairsearchApi = system.getObject("api.patent.chinaaffairsearch");
this.wpatentsearchApi = system.getObject("api.patent.wordpatentsearch");
this.wpatentaggApi = system.getObject("api.patent.wpatentaggregations");
this.copyrightApi = system.getObject("api.patent.copyrightsearch");
}
/**
* 接口跳转-POST请求
* action_type 执行的类型
* action_body 执行的参数
*/
async springBoard(pobj, qobj, req) {
if (!pobj.actionType) {
return system.getResult(null, "actionType参数不能为空");
}
var result = await this.opActionProcess(pobj.actionType, pobj.actionBody);
return result;
}
async opActionProcess(action_type, action_body) {
var opResult = null;
switch (action_type) {
case "test"://测试
opResult = system.getResultSuccess(null, "测试成功");
break;
case "CommomSearchbyApplicant"://根据申请人查询聚合
opResult = await this.cpatentsearchApi.CommomSearchbyApplicant(action_body);
break;
case "paCountByApplicantName"://根据申请人获取专利量
opResult = await this.cpatentsearchApi.paCountByApplicantName(action_body);
break;
case "paShortListByApplicantName"://根据申请人获取专利详情列表
opResult = await this.cpatentsearchApi.paShortListByApplicantName(action_body);
break;
case "paDetailsBypubNo"://根据公开或授权号获取专利详情列表
opResult = await this.cpatentsearchApi.paDetailsBypubNo(action_body);
break;
case "paDetailsByfilingNo"://根据申请号获取专利详情列表
opResult = await this.cpatentsearchApi.paDetailsByfilingNo(action_body);
break;
case "softwareCountByAuthor"://根据公司名称得到软著量
opResult = await this.copyrightApi.softwareCountByAuthor(action_body);
break;
case "softwareListByAuthor"://根据公司名称得到软著详情
opResult = await this.copyrightApi.softwareListByAuthor(action_body);
break;
case "softwareDetailsByregNum"://根据登记号获取软著详情
opResult = await this.copyrightApi.softwareDetailsByregNum(action_body);
break;
case "worksCountByAuthor"://根据公司名称得到著作权量
opResult = await this.copyrightApi.worksCountByAuthor(action_body);
break;
case "worksListByAuthor"://根据公司名称得到著作权详情
opResult = await this.copyrightApi.worksListByAuthor(action_body);
break;
case "worksDetailsByregNum"://根据登记号获取著作权详情
opResult = await this.copyrightApi.worksDetailsByregNum(action_body);
break;
default:
opResult = system.getResult(null, "action_type参数错误");
break;
}
return opResult;
}
}
module.exports = PatentQueryAPI;
// var tesk = new PatentQueryAPI();
// var parm = {
// actionType:"paShortListByApplicantName",
// actionBody:{applicant_name:"中国专利信息中心"}
// };
// tesk.springBoard(parm).then(function(result){
// console.log(result);
// console.log(result.data.data[0]);
// }).catch(function(e){
// console.log(e);
// });
\ No newline at end of file
......@@ -10,29 +10,17 @@ class TmQueryAPI extends APIBase {
}
/**
* 接口跳转-POST请求
* action_process 执行的流程
* action_type 执行的类型
* action_body 执行的参数
*/
async springBoard(pobj, qobj, req) {
if (!pobj.actionProcess) {
return system.getResult(null, "actionProcess参数不能为空");
}
if (!pobj.actionType) {
return system.getResult(null, "actionType参数不能为空");
}
var result = null;
switch (pobj.actionProcess) {
case "jd"://京东
result = await this.jdOpActionProcess(pobj.actionProcess, pobj.actionType, pobj.actionBody);
break;
default:
result = system.getResult(null, "actionProcess参数错误");
break;
}
var result = await this.opActionProcess(pobj.actionType, pobj.actionBody);
return result;
}
async jdOpActionProcess(action_process, action_type, action_body) {
async opActionProcess(action_type, action_body) {
var opResult = null;
switch (action_type) {
case "test"://测试
......
......@@ -8,29 +8,17 @@ class TmToolsAPI extends APIBase {
}
/**
* 接口跳转-POST请求
* action_process 执行的流程
* action_type 执行的类型
* action_body 执行的参数
*/
async springBoard(pobj, qobj, req) {
if (!pobj.actionProcess) {
return system.getResult(null, "actionProcess参数不能为空");
}
if (!pobj.actionType) {
return system.getResult(null, "actionType参数不能为空");
}
var result = null;
switch (pobj.actionProcess) {
case "jd"://京东
result = await this.jdOpActionProcess(pobj.actionProcess, pobj.actionType, pobj.actionBody);
break;
default:
result = system.getResult(null, "actionProcess参数错误");
break;
}
var result = await this.opActionProcess(pobj.actionType, pobj.actionBody);
return result;
}
async jdOpActionProcess(action_process, action_type, action_body) {
async opActionProcess(action_type, action_body) {
var opResult = null;
switch (action_type) {
// sy
......
var APIBase = require("../../api.base");
var system = require("../../../system");
class zcosssignAPI extends APIBase {
class zcosssignAPI extends APIBase {//--TODO:将要修改掉
constructor() {
super();
this.uploadSve = system.getObject("service.common.uploadSve");
......
var System=require("../../../system");
var settings=require("../../../../config/settings");
var System = require("../../../system");
var settings = require("../../../../config/settings");
const querystring = require('querystring');
const ApiBase =require("../../api.base");
const ApiBase = require("../../api.base");
class ChinaPatentSearchApi extends ApiBase{
constructor(){
class ChinaPatentSearchApi extends ApiBase {
constructor() {
super();
this.patentUrl = settings.reqEsAddrIc()+"bigdata_patent_op/_search";
this.patentUrl = settings.reqEsAddrIc() + "bigdata_patent_op/_search";
};
buildDate(date){
buildDate(date) {
var date = new Date(date);
var time = Date.parse(date);
time=time / 1000;
time = time / 1000;
return time;
};
async ObtainChinaPatentInfo(obj){
async ObtainChinaPatentInfo(obj) {
console.log("----------------api-ObtainChinaPatentInfo----------------");
console.log(obj);
var params= {
var params = {
"query": {
"bool": {
"must": []
}
},
};
var applynum=obj.applynum==null?"":obj.applynum;//专利申请号
if (applynum != null && applynum != ""){
var applynum = obj.applynum == null ? "" : obj.applynum;//专利申请号
if (applynum != null && applynum != "") {
var param = {
"term": {
"filing_no": applynum
"filing_no": applynum
}
}
params.query.bool.must.push(param)
}
var publishnum=obj.publishnum==null?"":obj.publishnum;//专利公开号
if (publishnum != null && publishnum != ""){
var arr= publishnum.split("");
if(arr[arr.length-1]=="A"){
var publishnum = obj.publishnum == null ? "" : obj.publishnum;//专利公开号
if (publishnum != null && publishnum != "") {
var arr = publishnum.split("");
if (arr[arr.length - 1] == "A") {
var param = {
"term": {
"pub_no": publishnum
"pub_no": publishnum
}
};
}else{
} else {
var param = {
"term": {
"gr_no": publishnum
"gr_no": publishnum
}
};
}
params.query.bool.must.push(param)
}
var rc=System.getObject("util.execClient");
var rtn=null;
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);
try {
rtn = await rc.execPost(params, requrl);
var j = JSON.parse(rtn.stdout);
return rtn = {
status:0,
msg:"操作成功",
data:j.hits.hits
status: 0,
msg: "操作成功",
data: j.hits.hits
};
}catch(e){
return rtn={
status:-1,
msg:"操作失败",
data:null
} catch (e) {
return rtn = {
status: -1,
msg: "操作失败",
data: null
};
}
};
async CommomSearchbyTitle(obj){//根据标题查询聚合
async CommomSearchbyTitle(obj) {//根据标题查询聚合
console.log("--------CommomSearchbyTitle----------");
console.log(obj);
var pagesize = obj.pagesize==null?10:obj.pagesize;
if(obj.page==null){
var pagesize = obj.pagesize == null ? 10 : obj.pagesize;
if (obj.page == null) {
var from = 0;
}else{
var from = Number((obj.page-1)*obj.pagesize);
} else {
var from = Number((obj.page - 1) * obj.pagesize);
}
var title = obj.title==null?"":obj.title;
if(title==""){
return {status:-1,msg:"传入标题信息为空",data:null,buckets:null};
var title = obj.title == null ? "" : obj.title;
if (title == "") {
return { status: -1, msg: "传入标题信息为空", data: null, buckets: null };
}
var params= {
var params = {
"query": {
"bool": {
"must": []
......@@ -111,30 +111,30 @@ class ChinaPatentSearchApi extends ApiBase{
],
"aggregations": {
"group_by_pub_type": {
"terms": {
"field": "pub_type",
"size": 1000
}
"terms": {
"field": "pub_type",
"size": 1000
}
},
"group_by_pub_status": {
"terms": {
"field": "pub_status",
"size": 1000
}
"terms": {
"field": "pub_status",
"size": 1000
}
},
"group_by_filing_year": {
"terms": {
"field": "filing_year",
"size": 1000,
"order":{"_term":"desc"}
}
"terms": {
"field": "filing_year",
"size": 1000,
"order": { "_term": "desc" }
}
},
"group_by_pub_year": {
"terms": {
"field": "pub_year",
"size": 1000,
"order":{"_term":"desc"}
}
"terms": {
"field": "pub_year",
"size": 1000,
"order": { "_term": "desc" }
}
}
}
};
......@@ -146,92 +146,92 @@ class ChinaPatentSearchApi extends ApiBase{
}
params.query.bool.must.push(param);
var pubtype=obj.pubtype==null?"":obj.pubtype;//专利类型
if (pubtype != null && pubtype != ""){
var pubtype = obj.pubtype == null ? "" : obj.pubtype;//专利类型
if (pubtype != null && pubtype != "") {
param = {
"term": {
"pub_type": pubtype
"pub_type": pubtype
}
}
params.query.bool.must.push(param)
}
var pubstatus = obj.pubstatus==null?"":obj.pubstatus;//法律状态
if (pubstatus != null && pubstatus != ""){
var pubstatus = obj.pubstatus == null ? "" : obj.pubstatus;//法律状态
if (pubstatus != null && pubstatus != "") {
param = {
"term": {
"pub_status": pubstatus
"pub_status": pubstatus
}
}
params.query.bool.must.push(param)
}
var filingyear = obj.filingyear==null?"":obj.filingyear;//申请年份
if (filingyear != null && filingyear !=""){
var filingyear = obj.filingyear == null ? "" : obj.filingyear;//申请年份
if (filingyear != null && filingyear != "") {
param = {
"term": {
"filing_year": filingyear
"filing_year": filingyear
}
}
params.query.bool.must.push(param)
}
var pubyear = obj.pubyear==null?"":obj.pubyear;//公开年份
if (pubyear != null && pubyear != ""){
var pubyear = obj.pubyear == null ? "" : obj.pubyear;//公开年份
if (pubyear != null && pubyear != "") {
param = {
"term": {
"pub_year": pubyear
"pub_year": pubyear
}
}
params.query.bool.must.push(param)
}
var rc=System.getObject("util.execClient");
var rtn=null;
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);
try {
rtn = await rc.execPost(params, requrl);
var j = JSON.parse(rtn.stdout);
return rtn = {
status:0,
msg:"操作成功",
data:j.hits,
buckets:j.aggregations
status: 0,
msg: "操作成功",
data: j.hits,
buckets: j.aggregations
};
}catch(e){
return rtn={
status:-1,
msg:"操作失败",
data:null,
buckets:null
} catch (e) {
return rtn = {
status: -1,
msg: "操作失败",
data: null,
buckets: null
};
}
};
async CommomSearchbyFilingno(obj){//根据申请号查询聚合
var pagesize = obj.pagesize==null?10:obj.pagesize;
if(obj.page==null){
async CommomSearchbyFilingno(obj) {//根据申请号查询聚合
var pagesize = obj.pagesize == null ? 10 : obj.pagesize;
if (obj.page == null) {
var from = 0;
}else{
var from = Number((obj.page-1)*obj.pagesize);
} else {
var from = Number((obj.page - 1) * obj.pagesize);
}
var filingno = obj.filingno==null?"":obj.filingno;
if(filingno==""){
return {status:-1,msg:"传入的申请号信息为空",data:null,buckets:null};
var filingno = obj.filingno == null ? "" : obj.filingno;
if (filingno == "") {
return { status: -1, msg: "传入的申请号信息为空", data: null, buckets: null };
}
else{
filingno = filingno.replace("CN","").replace("cn","").replace(".","");
if (filingno.length == 13){
filingno = filingno.substr(0,12);
else {
filingno = filingno.replace("CN", "").replace("cn", "").replace(".", "");
if (filingno.length == 13) {
filingno = filingno.substr(0, 12);
}
else if (filingno.length == 9){
filingno = filingno.substr(0,8);
else if (filingno.length == 9) {
filingno = filingno.substr(0, 8);
}
}
var params= {
var params = {
"query": {
"bool": {
"must": []
......@@ -254,119 +254,119 @@ class ChinaPatentSearchApi extends ApiBase{
],
"aggregations": {
"group_by_pub_type": {
"terms": {
"field": "pub_type",
"size": 1000
}
"terms": {
"field": "pub_type",
"size": 1000
}
},
"group_by_pub_status": {
"terms": {
"field": "pub_status",
"size": 1000
}
"terms": {
"field": "pub_status",
"size": 1000
}
},
"group_by_filing_year": {
"terms": {
"field": "filing_year",
"size": 1000,
"order":{"_term":"desc"}
}
"terms": {
"field": "filing_year",
"size": 1000,
"order": { "_term": "desc" }
}
},
"group_by_pub_year": {
"terms": {
"field": "pub_year",
"size": 1000,
"order":{"_term":"desc"}
}
"terms": {
"field": "pub_year",
"size": 1000,
"order": { "_term": "desc" }
}
}
}
};
var param = {
"wildcard": {
"filing_no": "*"+filingno+"*"
"filing_no": "*" + filingno + "*"
}
}
params.query.bool.must.push(param);
var pubtype=obj.pubtype==null?"":obj.pubtype;//专利类型
if (pubtype != null && pubtype != ""){
var pubtype = obj.pubtype == null ? "" : obj.pubtype;//专利类型
if (pubtype != null && pubtype != "") {
param = {
"term": {
"pub_type": pubtype
"pub_type": pubtype
}
}
params.query.bool.must.push(param)
}
var pubstatus = obj.pubstatus==null?"":obj.pubstatus;//法律状态
if (pubstatus != null && pubstatus != ""){
var pubstatus = obj.pubstatus == null ? "" : obj.pubstatus;//法律状态
if (pubstatus != null && pubstatus != "") {
param = {
"term": {
"pub_status": pubstatus
"pub_status": pubstatus
}
}
params.query.bool.must.push(param)
}
var filingyear = obj.filingyear==null?"":obj.filingyear;//申请年份
if (filingyear != null && filingyear !=""){
var filingyear = obj.filingyear == null ? "" : obj.filingyear;//申请年份
if (filingyear != null && filingyear != "") {
param = {
"term": {
"filing_year": filingyear
"filing_year": filingyear
}
}
params.query.bool.must.push(param)
}
var pubyear = obj.pubyear==null?"":obj.pubyear;//公开年份
if (pubyear != null && pubyear != ""){
var pubyear = obj.pubyear == null ? "" : obj.pubyear;//公开年份
if (pubyear != null && pubyear != "") {
param = {
"term": {
"pub_year": pubyear
"pub_year": pubyear
}
}
params.query.bool.must.push(param)
}
var rc=System.getObject("util.execClient");
var rtn=null;
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);
try {
rtn = await rc.execPost(params, requrl);
var j = JSON.parse(rtn.stdout);
return rtn = {
status:0,
msg:"操作成功",
data:j.hits,
buckets:j.aggregations
status: 0,
msg: "操作成功",
data: j.hits,
buckets: j.aggregations
};
}catch(e){
return rtn={
status:-1,
msg:"操作失败",
data:null,
buckets:null
} catch (e) {
return rtn = {
status: -1,
msg: "操作失败",
data: null,
buckets: null
};
}
};
async CommomSearchbyPubno(obj){//根据公开号查询聚合
var pagesize = obj.pagesize==null?10:obj.pagesize;
if(obj.page==null){
async CommomSearchbyPubno(obj) {//根据公开号查询聚合
var pagesize = obj.pagesize == null ? 10 : obj.pagesize;
if (obj.page == null) {
var from = 0;
}else{
var from = Number((obj.page-1)*obj.pagesize);
} else {
var from = Number((obj.page - 1) * obj.pagesize);
}
var pubno = obj.pubno==null?"":obj.pubno;
if(pubno==""){
return {status:-1,msg:"传入的公开号信息为空",data:null,buckets:null};
var pubno = obj.pubno == null ? "" : obj.pubno;
if (pubno == "") {
return { status: -1, msg: "传入的公开号信息为空", data: null, buckets: null };
}
var params= {
var params = {
"query": {
"bool": {
"must": []
......@@ -389,134 +389,134 @@ class ChinaPatentSearchApi extends ApiBase{
],
"aggregations": {
"group_by_pub_type": {
"terms": {
"field": "pub_type",
"size": 1000
}
"terms": {
"field": "pub_type",
"size": 1000
}
},
"group_by_pub_status": {
"terms": {
"field": "pub_status",
"size": 1000
}
"terms": {
"field": "pub_status",
"size": 1000
}
},
"group_by_filing_year": {
"terms": {
"field": "filing_year",
"size": 1000,
"order":{"_term":"desc"}
}
"terms": {
"field": "filing_year",
"size": 1000,
"order": { "_term": "desc" }
}
},
"group_by_pub_year": {
"terms": {
"field": "pub_year",
"size": 1000,
"order":{"_term":"desc"}
}
"terms": {
"field": "pub_year",
"size": 1000,
"order": { "_term": "desc" }
}
}
}
};
var param = {
"bool": {
"should": [
]
"should": [
]
}
}
var parr = {
"wildcard": {
"pub_no": "*"+pubno+"*"
"pub_no": "*" + pubno + "*"
}
}
param.bool.should.push(parr)
parr = {
"wildcard": {
"gr_no": "*"+pubno+"*"
"gr_no": "*" + pubno + "*"
}
}
param.bool.should.push(parr)
params.query.bool.must.push(param);
var pubtype=obj.pubtype==null?"":obj.pubtype;//专利类型
if (pubtype != null && pubtype != ""){
var pubtype = obj.pubtype == null ? "" : obj.pubtype;//专利类型
if (pubtype != null && pubtype != "") {
param = {
"term": {
"pub_type": pubtype
"pub_type": pubtype
}
}
params.query.bool.must.push(param)
}
var pubstatus = obj.pubstatus==null?"":obj.pubstatus;//法律状态
if (pubstatus != null && pubstatus != ""){
var pubstatus = obj.pubstatus == null ? "" : obj.pubstatus;//法律状态
if (pubstatus != null && pubstatus != "") {
param = {
"term": {
"pub_status": pubstatus
"pub_status": pubstatus
}
}
params.query.bool.must.push(param)
}
var filingyear = obj.filingyear==null?"":obj.filingyear;//申请年份
if (filingyear != null && filingyear !=""){
var filingyear = obj.filingyear == null ? "" : obj.filingyear;//申请年份
if (filingyear != null && filingyear != "") {
param = {
"term": {
"filing_year": filingyear
"filing_year": filingyear
}
}
params.query.bool.must.push(param)
}
var pubyear = obj.pubyear==null?"":obj.pubyear;//公开年份
if (pubyear != null && pubyear != ""){
var pubyear = obj.pubyear == null ? "" : obj.pubyear;//公开年份
if (pubyear != null && pubyear != "") {
param = {
"term": {
"pub_year": pubyear
"pub_year": pubyear
}
}
params.query.bool.must.push(param)
}
var rc=System.getObject("util.execClient");
var rtn=null;
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);
try {
rtn = await rc.execPost(params, requrl);
var j = JSON.parse(rtn.stdout);
return rtn = {
status:0,
msg:"操作成功",
data:j.hits,
buckets:j.aggregations
status: 0,
msg: "操作成功",
data: j.hits,
buckets: j.aggregations
};
}catch(e){
return rtn={
status:-1,
msg:"操作失败",
data:null,
buckets:null
} catch (e) {
return rtn = {
status: -1,
msg: "操作失败",
data: null,
buckets: null
};
}
};
async CommomSearchbyApplicant(obj){//根据申请人查询聚合
var pagesize = obj.pagesize==null?10:obj.pagesize;
if(obj.page==null){
async CommomSearchbyApplicant(obj) {//根据申请人查询聚合
var pagesize = obj.pagesize == null ? 10 : obj.pagesize;
if (obj.page == null) {
var from = 0;
}else{
var from = Number((obj.page-1)*obj.pagesize);
} else {
var from = Number((obj.page - 1) * obj.pagesize);
}
var applicant = obj.applicant==null?"":obj.applicant;
if(applicant==""){
return {status:-1,msg:"传入的申请人信息为空",data:null,buckets:null};
var applicant = obj.applicant == null ? "" : obj.applicant;
if (applicant == "") {
return { status: -1, msg: "传入的申请人信息为空", data: null, buckets: null };
}
var params= {
var params = {
"query": {
"bool": {
"must": []
......@@ -539,30 +539,30 @@ class ChinaPatentSearchApi extends ApiBase{
],
"aggregations": {
"group_by_pub_type": {
"terms": {
"field": "pub_type",
"size": 1000
}
"terms": {
"field": "pub_type",
"size": 1000
}
},
"group_by_pub_status": {
"terms": {
"field": "pub_status",
"size": 1000
}
"terms": {
"field": "pub_status",
"size": 1000
}
},
"group_by_filing_year": {
"terms": {
"field": "filing_year",
"size": 1000,
"order":{"_term":"desc"}
}
"terms": {
"field": "filing_year",
"size": 1000,
"order": { "_term": "desc" }
}
},
"group_by_pub_year": {
"terms": {
"field": "pub_year",
"size": 1000,
"order":{"_term":"desc"}
}
"terms": {
"field": "pub_year",
"size": 1000,
"order": { "_term": "desc" }
}
}
}
};
......@@ -570,88 +570,88 @@ class ChinaPatentSearchApi extends ApiBase{
var param = {
"query_string": {
"default_field": "applicant_name",
"query": "\""+ applicant +"\""
"query": "\"" + applicant + "\""
}
}
params.query.bool.must.push(param);
var pubtype=obj.pubtype==null?"":obj.pubtype;//专利类型
if (pubtype != null && pubtype != ""){
var pubtype = obj.pubtype == null ? "" : obj.pubtype;//专利类型
if (pubtype != null && pubtype != "") {
param = {
"term": {
"pub_type": pubtype
"pub_type": pubtype
}
}
params.query.bool.must.push(param)
}
var pubstatus = obj.pubstatus==null?"":obj.pubstatus;//法律状态
if (pubstatus != null && pubstatus != ""){
var pubstatus = obj.pubstatus == null ? "" : obj.pubstatus;//法律状态
if (pubstatus != null && pubstatus != "") {
param = {
"term": {
"pub_status": pubstatus
"pub_status": pubstatus
}
}
params.query.bool.must.push(param)
}
var filingyear = obj.filingyear==null?"":obj.filingyear;//申请年份
if (filingyear != null && filingyear !=""){
var filingyear = obj.filingyear == null ? "" : obj.filingyear;//申请年份
if (filingyear != null && filingyear != "") {
param = {
"term": {
"filing_year": filingyear
"filing_year": filingyear
}
}
params.query.bool.must.push(param)
}
var pubyear = obj.pubyear==null?"":obj.pubyear;//公开年份
if (pubyear != null && pubyear != ""){
var pubyear = obj.pubyear == null ? "" : obj.pubyear;//公开年份
if (pubyear != null && pubyear != "") {
param = {
"term": {
"pub_year": pubyear
"pub_year": pubyear
}
}
params.query.bool.must.push(param)
}
var rc=System.getObject("util.execClient");
var rtn=null;
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);
try {
rtn = await rc.execPost(params, requrl);
var j = JSON.parse(rtn.stdout);
return rtn = {
status:0,
msg:"操作成功",
data:j.hits,
buckets:j.aggregations
status: 0,
msg: "操作成功",
data: j.hits,
buckets: j.aggregations
};
}catch(e){
return rtn={
status:-1,
msg:"操作失败",
data:null,
buckets:null
} catch (e) {
return rtn = {
status: -1,
msg: "操作失败",
data: null,
buckets: null
};
}
};
async CommomSearchbyInventor(obj){//根据发明人查询聚合
var pagesize = obj.pagesize==null?10:obj.pagesize;
if(obj.page==null){
async CommomSearchbyInventor(obj) {//根据发明人查询聚合
var pagesize = obj.pagesize == null ? 10 : obj.pagesize;
if (obj.page == null) {
var from = 0;
}else{
var from = Number((obj.page-1)*obj.pagesize);
} else {
var from = Number((obj.page - 1) * obj.pagesize);
}
var inventor = obj.inventor==null?"":obj.inventor;
if(inventor==""){
return {status:-1,msg:"传入的发明人信息为空",data:null,buckets:null};
var inventor = obj.inventor == null ? "" : obj.inventor;
if (inventor == "") {
return { status: -1, msg: "传入的发明人信息为空", data: null, buckets: null };
}
var params= {
var params = {
"query": {
"bool": {
"must": []
......@@ -674,30 +674,30 @@ class ChinaPatentSearchApi extends ApiBase{
],
"aggregations": {
"group_by_pub_type": {
"terms": {
"field": "pub_type",
"size": 1000
}
"terms": {
"field": "pub_type",
"size": 1000
}
},
"group_by_pub_status": {
"terms": {
"field": "pub_status",
"size": 1000
}
"terms": {
"field": "pub_status",
"size": 1000
}
},
"group_by_filing_year": {
"terms": {
"field": "filing_year",
"size": 1000,
"order":{"_term":"desc"}
}
"terms": {
"field": "filing_year",
"size": 1000,
"order": { "_term": "desc" }
}
},
"group_by_pub_year": {
"terms": {
"field": "pub_year",
"size": 1000,
"order":{"_term":"desc"}
}
"terms": {
"field": "pub_year",
"size": 1000,
"order": { "_term": "desc" }
}
}
}
};
......@@ -705,75 +705,75 @@ class ChinaPatentSearchApi extends ApiBase{
var param = {
"query_string": {
"default_field": "inventor_name",
"query": "\""+ inventor +"\""
"query": "\"" + inventor + "\""
}
}
params.query.bool.must.push(param);
var pubtype=obj.pubtype==null?"":obj.pubtype;//专利类型
if (pubtype != null && pubtype != ""){
var pubtype = obj.pubtype == null ? "" : obj.pubtype;//专利类型
if (pubtype != null && pubtype != "") {
param = {
"term": {
"pub_type": pubtype
"pub_type": pubtype
}
}
params.query.bool.must.push(param)
}
var pubstatus = obj.pubstatus==null?"":obj.pubstatus;//法律状态
if (pubstatus != null && pubstatus != ""){
var pubstatus = obj.pubstatus == null ? "" : obj.pubstatus;//法律状态
if (pubstatus != null && pubstatus != "") {
param = {
"term": {
"pub_status": pubstatus
"pub_status": pubstatus
}
}
params.query.bool.must.push(param)
}
var filingyear = obj.filingyear==null?"":obj.filingyear;//申请年份
if (filingyear != null && filingyear !=""){
var filingyear = obj.filingyear == null ? "" : obj.filingyear;//申请年份
if (filingyear != null && filingyear != "") {
param = {
"term": {
"filing_year": filingyear
"filing_year": filingyear
}
}
params.query.bool.must.push(param)
}
var pubyear = obj.pubyear==null?"":obj.pubyear;//公开年份
if (pubyear != null && pubyear != ""){
var pubyear = obj.pubyear == null ? "" : obj.pubyear;//公开年份
if (pubyear != null && pubyear != "") {
param = {
"term": {
"pub_year": pubyear
"pub_year": pubyear
}
}
params.query.bool.must.push(param)
}
var rc=System.getObject("util.execClient");
var rtn=null;
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);
try {
rtn = await rc.execPost(params, requrl);
var j = JSON.parse(rtn.stdout);
return rtn = {
status:0,
msg:"操作成功",
data:j.hits,
buckets:j.aggregations
status: 0,
msg: "操作成功",
data: j.hits,
buckets: j.aggregations
};
}catch(e){
return rtn={
status:-1,
msg:"操作失败",
data:null,
buckets:null
} catch (e) {
return rtn = {
status: -1,
msg: "操作失败",
data: null,
buckets: null
};
}
};
async ChinaPatentSrearch(obj){//根据条件查询
async ChinaPatentSrearch(obj) {//根据条件查询
var params = {
"query": {
"bool": {
......@@ -785,32 +785,32 @@ class ChinaPatentSearchApi extends ApiBase{
params.query.bool.must.push(obj[x]);
}
var rc=System.getObject("util.execClient");
var rtn=null;
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);
try {
rtn = await rc.execPost(params, requrl);
var j = JSON.parse(rtn.stdout);
return rtn = {
status:0,
msg:"操作成功",
data:j.hits
status: 0,
msg: "操作成功",
data: j.hits
};
}catch(e){
return rtn={
status:-1,
msg:"操作失败",
data:null
} catch (e) {
return rtn = {
status: -1,
msg: "操作失败",
data: null
};
}
};
async seniorSearch(obj){//高级检索,根据用户输入的不同多条件进行检索
var pagesize = obj.pagesize==null?10:obj.pagesize;
if(obj.page==null){
async seniorSearch(obj) {//高级检索,根据用户输入的不同多条件进行检索
var pagesize = obj.pagesize == null ? 10 : obj.pagesize;
if (obj.page == null) {
var from = 0;
}else{
var from = Number((obj.page-1)*obj.pagesize);
} else {
var from = Number((obj.page - 1) * obj.pagesize);
}
var params = {
......@@ -838,37 +838,37 @@ class ChinaPatentSearchApi extends ApiBase{
var param = null;
//对关键词
var title=obj.title==null?"":obj.title;
if (title != null && title != ""){
param ={
var title = obj.title == null ? "" : obj.title;
if (title != null && title != "") {
param = {
"match": {
"filing_name": title
"filing_name": title
}
}
params.query.bool.must.push(param)
}
var abstr = obj.abstr==null?"":obj.abstr;
if (abstr != null && abstr != ""){
param ={
var abstr = obj.abstr == null ? "" : obj.abstr;
if (abstr != null && abstr != "") {
param = {
"match": {
"abstr_text": abstr
"abstr_text": abstr
}
}
params.query.bool.must.push(param)
}
var filingno=obj.filingno==null?"":obj.filingno;
if(filingno!=null && filingno!=""){
filingno = filingno.replace("CN","").replace("cn","").replace(".","");
if (filingno.length == 13){
filingno = filingno.substr(0,12);
var filingno = obj.filingno == null ? "" : obj.filingno;
if (filingno != null && filingno != "") {
filingno = filingno.replace("CN", "").replace("cn", "").replace(".", "");
if (filingno.length == 13) {
filingno = filingno.substr(0, 12);
}
else if (filingno.length == 9){
filingno = filingno.substr(0,8);
else if (filingno.length == 9) {
filingno = filingno.substr(0, 8);
}
param= {
param = {
"term": {
"filing_no": filingno
}
......@@ -876,12 +876,12 @@ class ChinaPatentSearchApi extends ApiBase{
params.query.bool.must.push(param)
}
var pubno=obj.pubno==null?"":obj.pubno;
if (pubno!=null && pubno!=""){
var pubno = obj.pubno == null ? "" : obj.pubno;
if (pubno != null && pubno != "") {
param = {
"bool": {
"should": [
]
"should": [
]
}
}
......@@ -901,15 +901,15 @@ class ChinaPatentSearchApi extends ApiBase{
params.query.bool.must.push(param);
}
var priorno=obj.priorno==null?"":obj.priorno;
if (priorno != null && priorno != ""){
param= {
var priorno = obj.priorno == null ? "" : obj.priorno;
if (priorno != null && priorno != "") {
param = {
"nested": {
"path": "prior_info",
"query": {
"bool": {
"must": [
{ "term": { "prior_info.pri_no": priorno}}
{ "term": { "prior_info.pri_no": priorno } }
]
}
}
......@@ -918,27 +918,27 @@ class ChinaPatentSearchApi extends ApiBase{
params.query.bool.must.push(param)
}
var appl=obj.applname==null?"":obj.applname;
if (appl!=null && appl!=""){
param= {
var appl = obj.applname == null ? "" : obj.applname;
if (appl != null && appl != "") {
param = {
"term": {
"applicant_name.raw": appl
}
}
params.query.bool.must.push(param)
}
var inv=obj.invname==null?"":obj.invname;
if (inv!=null && inv!=""){
param= {
var inv = obj.invname == null ? "" : obj.invname;
if (inv != null && inv != "") {
param = {
"term": {
"inventor_name.raw": inv
}
}
params.query.bool.must.push(param)
}
var ipc=obj.ipcno==null?"":obj.ipcno;
if (ipc!=null && ipc!=""){
var param= {
var ipc = obj.ipcno == null ? "" : obj.ipcno;
if (ipc != null && ipc != "") {
var param = {
"term": {
"other_ipc": ipc
}
......@@ -946,102 +946,474 @@ class ChinaPatentSearchApi extends ApiBase{
params.query.bool.must.push(param)
}
if(obj.filingdate1!=null && obj.filingdate1!=""){
var filingdate1=obj.filingdate1;
if (obj.filingdate1 != null && obj.filingdate1 != "") {
var filingdate1 = obj.filingdate1;
}
else {
var filingdate1 ="";
var filingdate1 = "";
}
if(obj.filingdate2!=null && obj.filingdate2!=""){
var filingdate2=obj.filingdate2;
if (obj.filingdate2 != null && obj.filingdate2 != "") {
var filingdate2 = obj.filingdate2;
}
else {
var filingdate2 = "";
}
if (filingdate1!="" || filingdate2!=""){
param={
if (filingdate1 != "" || filingdate2 != "") {
param = {
"range": {
"filing_time": {
}
}
};
if (filingdate1!=""){
param.range.filing_time["gte"]=filingdate1;
if (filingdate1 != "") {
param.range.filing_time["gte"] = filingdate1;
}
if (filingdate2!=""){
param.range.filing_time["lte"]=filingdate2;
if (filingdate2 != "") {
param.range.filing_time["lte"] = filingdate2;
}
params.query.bool.must.push(param);
}
if(obj.pubdate1!=null && obj.pubdate1!=""){
var pubdate1=obj.pubdate1;
if (obj.pubdate1 != null && obj.pubdate1 != "") {
var pubdate1 = obj.pubdate1;
}
else {
var pubdate1 ="";
var pubdate1 = "";
}
if(obj.pubdate2!=null && obj.pubdate2!=""){
var pubdate2=obj.pubdate2;
if (obj.pubdate2 != null && obj.pubdate2 != "") {
var pubdate2 = obj.pubdate2;
}
else {
var pubdate2 = "";
}
if (pubdate1!="" || pubdate2!=""){
param={
if (pubdate1 != "" || pubdate2 != "") {
param = {
"range": {
"pub_time": {
}
}
};
if (pubdate1!=""){
param.range.pub_time["gte"]=pubdate1;
if (pubdate1 != "") {
param.range.pub_time["gte"] = pubdate1;
}
if (pubdate2!=""){
param.range.pub_time["lte"]=pubdate2;
if (pubdate2 != "") {
param.range.pub_time["lte"] = pubdate2;
}
params.query.bool.must.push(param);
}
if(obj.grdate1!=null && obj.grdate1!=""){
var grdate1=obj.grdate1;
if (obj.grdate1 != null && obj.grdate1 != "") {
var grdate1 = obj.grdate1;
}
else {
var grdate1 ="";
var grdate1 = "";
}
if(obj.grdate2!=null && obj.grdate2!=""){
var grdate2=obj.grdate2;
if (obj.grdate2 != null && obj.grdate2 != "") {
var grdate2 = obj.grdate2;
}
else {
var grdate2 = "";
}
if (grdate1!="" || grdate2!=""){
param={
if (grdate1 != "" || grdate2 != "") {
param = {
"range": {
"gr_time": {
}
}
};
if (grdate1!=""){
param.range.gr_time["gte"]=grdate1;
if (grdate1 != "") {
param.range.gr_time["gte"] = grdate1;
}
if (grdate2!=""){
param.range.gr_time["lte"]=grdate2;
if (grdate2 != "") {
param.range.gr_time["lte"] = grdate2;
}
params.query.bool.must.push(param);
}
var rc=System.getObject("util.execClient");
var rtn=null;
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 System.getResult2(j.hits,null);
}catch(e){
return rtn=System.getResult2(null,null);
try {
rtn = await rc.execPost(params, requrl);
var j = JSON.parse(rtn.stdout);
return System.getResult2(j.hits, null);
} catch (e) {
return rtn = System.getResult2(null, null);
}
};
/*查询某一个公司名下有多少条专利(applicant_name:公司-精确)
auther:sy
{
"status": 0,
"msg": "操作成功",
"total": 54,
"data": [
{
"fm_count": 1,
"wg_count": 1,
"syxx_count": 1
}
],
"bizmsg": "empty"
}
返回值说明:status为0则为成功,否则为查询有误
*/
async paCountByApplicantName(obj) {
var applicantName = obj.applicant_name == null || obj.applicant_name == "" || obj.applicant_name == "undefined" ? "" : obj.applicant_name;
if (applicantName == "") {
return System.getResult2(null, "申请人不能为空");
}
applicantName = await this.getConvertSemiangleStr(applicantName);
var params = {
"size": 0,
"query": {
"bool": {
"must": [
{
"term": {
"applicant_name.raw": applicantName
}
}
]
}
}
};
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 System.getResult2(j.hits.total, null);
} catch (e) {
return System.getResult2(null, "获取数据出错");
}
};
/*查询某一个公司名下有专利列表(applicant_name:公司-精确)
auther:sy
返回值:
{
"status": 0,
"msg": "操作成功",
"total": 2,
"data": [
{
"filing_name":"",
"pub_status_now":"",
"filing_no":"",
"filing_date":"",
"gr_date":"",
"gr_no":"",
"pub_date":"",
"pub_no":"",
"pa_type":""
}
],
"bizmsg": "empty"
}
返回值说明:status为0则为成功,否则为查询有误
"filing_name",发明名称
"pub_status_now",法律状态
"filing_no",申请号
"filing_date",申请日期
"gr_date",授权日期
"gr_no",授权公布号
"pub_date",公开(公告)日期
"pub_no",公开(公告)号
"pa_type"专利类型
"total" 总条数
*/
async paShortListByApplicantName(obj) {
var applicantName = obj.applicant_name == null || obj.applicant_name == "" || obj.applicant_name == "undefined" ? "" : obj.applicant_name;
//var paType = obj.pa_type == null || obj.pa_type == "" || obj.pa_type == "undefined" ? "" : obj.pa_type;
if (applicantName == "") {
return System.getResult2(null, "申请人不能为空");
}
var pagesize = obj.page_size == null || obj.page_size == "" || obj.page_size == "undefined" ? 20 : obj.page_size;
var from = obj.current_page == null || obj.current_page == "" || obj.current_page == "undefined" ? 0 : Number((obj.current_page - 1) * pagesize);
applicantName = await this.getConvertSemiangleStr(applicantName);
var params = {
"query": {
"bool": {
"must": [
{
"term": {
"applicant_name.raw": applicantName
}
}
]
}
},
"from": from,
"size": pagesize,
"_source": [
"filing_name",
"pub_status_now",
"filing_no",
"filing_time",
"gr_time",
"gr_no",
"pub_time",
"pub_no",
"agency_name",
"applicant_name",
"inventor_name",
"main_ipc",
"abstr_text",
"pub_type"
],
"sort": [
{
"filing_date": "desc"
}
]
};
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);
// console.log(rtn.stdout, "rtn.stdout........................############################");
var res = {};
res.total = 0;
res.data = [];
if (j.hits.total > 0) {
res.total = j.hits.total;
for (let index = 0; index < j.hits.hits.length; index++) {
const element = j.hits.hits[index];
if (element) {
res.data.push(element["_source"]);
}
}
}
return System.getResult2(res, null);
} catch (e) {
return System.getResult2(null, "获取数据出错");
}
};
/*查询某一个公司名下有多少条专利(pub_no:公开(公告)号-精确、gr_no:授权公布号-精确)
auther:sy
返回值:
{
"status": 0,
"msg": "操作成功",
"total": 2,
"data": [
{
"filing_name":"",
"pub_status_now":"",
"filing_no":"",
"filing_date":"",
"gr_date":"",
"gr_no":"",
"pub_date":"",
"pub_no":""
"agency_name",
"inventor_name",
"main_ipc",
"abstr_text",
"pa_type":""
}
],
"bizmsg": "empty"
}
返回值说明:status为0则为成功,否则为查询有误
"filing_name",发明名称
"pub_status_now",法律状态
"filing_no",申请号
"filing_date",申请日期
"gr_date",授权日期
"gr_no",授权公布号
"pub_date",公开(公告)日期
"pub_no",公开(公告)号
"agency_name",代理机构
"inventor_name",发明人
"main_ipc",主分类号
"abstr_text",详情信息
"pa_type",专利类型
"total" 总条数
*/
async paDetailsBypubNo(obj) {
var pubNo = obj.pub_no == null || obj.pub_no == "" || obj.pub_no == "undefined" || obj.pub_no == "null" ? "" : obj.pub_no;
var grNo = obj.gr_no == null || obj.gr_no == "" || obj.gr_no == "undefined" || obj.gr_no == "null" ? "" : obj.gr_no;
if (pubNo == "" && grNo == "") {
return System.getResult2(null, "参数不能为空");
}
var params = {
"query": {
"bool": {
"must": []
}
},
"_source": [
"filing_name",
"pub_status_now",
"filing_no",
"filing_time",
"gr_time",
"gr_no",
"pub_time",
"pub_no",
"agency_name",
"applicant_name",
"inventor_name",
"main_ipc",
"abstr_text",
"pub_type"
],
"sort": [
{
"filing_date": "desc"
}
]
};
if (pubNo != "") {
var param = {
"term": {
"pub_no": pubNo
}
}
params.query.bool.must.push(param)
}
if (grNo != "") {
var param = {
"term": {
"gr_no": grNo
}
}
params.query.bool.must.push(param)
}
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);
var res = {};
res.total = 0;
res.data = [];
if (j.hits.total > 0) {
res.total = j.hits.total;
for (let index = 0; index < j.hits.hits.length; index++) {
const element = j.hits.hits[index];
if (element) {
res.data.push(element["_source"]);
}
}
}
return System.getResult2(res, null);
} catch (e) {
return System.getResult2(null, "获取数据出错");
}
};
async paDetailsByfilingNo(obj) {
var filingNo = obj.filingNo == null || obj.filingNo == "" || obj.filingNo == "undefined" || obj.filingNo == "null" ? "" : obj.filingNo;
if (filingNo == "") {
return System.getResult2(null, "参数不能为空");
}
else {
filingNo = filingNo.replace("CN", "").replace("cn", "").replace(".", "");
if (filingNo.length == 13) {
filingNo = filingNo.substr(0, 12);
}
else if (filingNo.length == 9) {
filingNo = filingNo.substr(0, 8);
}
}
var params = {
"query": {
"bool": {
"must": [
{
"term": {
"filing_no": filingNo
}
}
]
}
},
"_source": [
"filing_no",
"pub_type",
"filing_time",
"pub_no",
"gr_time",
"gr_no",
"pub_time",
"agency_code",
"agency_name",
"agent_name1",
"agent_name2",
"applicant_name",
"inventor_name",
"country_code",
"appl_zip",
"appl_address",
"main_ipc",
"abstr_text",
"filing_name",
"pub_status",
"pub_status_now",
"ipc_version",
"other_ipc",
"prior_info",
"pct_info",
"img_path",
"claim_text"
],
"sort": [
{
"filing_time": "desc"
}
]
};
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);
var res = {};
res.total = 0;
res.data = [];
if (j.hits.total > 0) {
res.total = j.hits.total;
for (let index = 0; index < j.hits.hits.length; index++) {
const element = j.hits.hits[index];
if (element) {
res.data.push(element["_source"]);
}
}
}
return System.getResult2(res, null);
} catch (e) {
return System.getResult2(null, "获取数据出错");
}
};
async getConvertSemiangleStr(str) {//半角转全角
var result = "";
var len = str.length;
for (var i = 0; i < len; i++) {
var cCode = str.charCodeAt(i);
//全角与半角相差(除空格外):65248(十进制)
cCode = (cCode >= 0xFF01 && cCode <= 0xFF5E) ? (cCode - 65248) : cCode;
//处理空格
cCode = (cCode == 0x03000) ? 0x0020 : cCode;
result += String.fromCharCode(cCode);
}
return result;
};
}
module.exports = ChinaPatentSearchApi;
var System = require("../../../system");
var settings = require("../../../../config/settings");
const querystring = require('querystring');
const ApiBase = require("../../api.base");
class CopyRightSearchApi extends ApiBase {
constructor() {
super();
this.softcopyrightUrl = settings.reqEsAddrIc() + "bigdata_software_copyright_op/_search";
this.workcopyrightUrl = settings.reqEsAddrIc() + "bigdata_works_copyright_op/_search";
};
async getConvertSemiangleStr(str) {//半角转全角
var result = "";
var len = str.length;
for (var i = 0; i < len; i++) {
var cCode = str.charCodeAt(i);
//全角与半角相差(除空格外):65248(十进制)
cCode = (cCode >= 0xFF01 && cCode <= 0xFF5E) ? (cCode - 65248) : cCode;
//处理空格
cCode = (cCode == 0x03000) ? 0x0020 : cCode;
result += String.fromCharCode(cCode);
}
return result;
};
/*查询某一个软件著作权人名下有多少条软件著作权(author:软件著作权人-精确)
auther:sy
返回值:
{
"status": 0,
"msg": "操作成功",
"total": 2,----总条数
"data": [],
"bizmsg": "empty"
}
*/
async softwareCountByAuthor(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": {
"nested": {
"path": "author_nationality",
"query": {
"bool": {
"must": [
{ "match": { "author_nationality.author_name.raw": author } }
]
}
}
}
},
"size": 0
};
var rc = System.getObject("util.execClient");
var rtn = null;
var requrl = this.softcopyrightUrl;
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, "获取数据出错");
};
};
/*查询某一个软件著作权人名下软件著作权列表(author:软件著作权人-精确、page_size:每页大小、current_page:当前第几页,从1开始)
auther:sy
返回值:
{
"status": 0,
"msg": "操作成功",
"total": 2,
"data": [
{
"full_name": "触宝软件",
"simple_name": "图形",
"reg_num": "T",
"reg_time": 1387170000
}
],
"bizmsg": "empty"
}
返回值说明:status为0则为成功,否则为查询有误
"ncl_one_codes" 名称
"status" 软件简介
"tm_regist_num" 登记号
"apply_day" 登记批准日期----格式为时间戳,转换后的格式为2018-08-21
"total" 总条数
*/
async softwareListByAuthor(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, "软件著作权人不能为空");
}
var params = {
"query": {
"nested": {
"path": "author_nationality",
"query": {
"bool": {
"must": [
{ "match": { "author_nationality.author_name.raw": author } }
]
}
}
}
},
"from": from,
"size": pagesize,
"_source": [
"full_name",
"simple_name",
"reg_num",
"cat_num",
"reg_time",
"reg_date",
"publish_time",
"publish_date",
"software_version"
],
"sort": [
{
"reg_time": "desc"
}
]
};
var rc = System.getObject("util.execClient");
var rtn = null;
var requrl = this.softcopyrightUrl;
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 (let index = 0; index < j.hits.hits.length; index++) {
const element = j.hits.hits[index];
if (element) {
res.data.push(element["_source"]);
}
}
}
return System.getResult2(res, null);
}
catch (e) {
return System.getResult2(null, "获取数据出错");
};
};
/*查询某一个软件著作权人名下软件著作权列表(reg_num:登记号-精确)
auther:sy
返回值:
{
"status": 0,
"msg": "操作成功",
"total": 2,
"data":{
"reg_num": "2013SR027478",
"cat_num": "30200-0000",
"full_name": "触宝拨号软件",
"simple_name": "TouchPal Dialer",
"software_version": "V3.3",
"author_nationality": [
{
"author_name": "上海触乐信息科技有限公司",
"author_country": "中国"
}
],
"publish_time": 1300593600,
"reg_time": 1364184000
},
"bizmsg": "empty"
}
返回值说明:status为0则为成功,否则为查询有误
"reg_num": "登记号",
"cat_num": "30200-0000??",
"full_name": "名称",
"simple_name": "软件简介",
"software_version": "版本号",
"author_nationality": [
{
"author_name": "软件著作权人",
"author_country": "软件著作权人国籍"
}
],
"publish_time": 首次发布日期,
"reg_time": 登记批准日期
*/
async softwareDetailsByregNum(obj) {
var regNum = obj.reg_num == null || obj.reg_num == "" || obj.reg_num == "undefined" ? "" : obj.reg_num;
if (regNum == "") {
return System.getResult2(null,"软件著作权号不能为空");
}
var params = {
"query": {
"term": {
"reg_num": regNum
}
},
"from": 0,
"size": 1
};
var rc = System.getObject("util.execClient");
var rtn = null;
var requrl = this.softcopyrightUrl;
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 (let index = 0; index < j.hits.hits.length; index++) {
const element = j.hits.hits[index];
if (element) {
res.data.push(element["_source"]);
}
}
}
return System.getResult2(res, null);
}
catch (e) {
return System.getResult2(null, "获取数据出错");
};
};
//--------------------------------------------以下为作品著作权---------------------------------------------------------------
/*查询某一个作品著作权人下有多少条作品著作权(author:作品著作权人-精确)
auther:sy
返回值:
{
"status": 0,
"msg": "操作成功",
"total": 2,----总条数
"data": [],
"bizmsg": "empty"
}
*/
async worksCountByAuthor(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": {
"works_author.raw": author
}
},
"size": 0
};
var rc = System.getObject("util.execClient");
var rtn = null;
var requrl = this.workcopyrightUrl;
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, "获取数据出错");
};
};
/*查询某一个作品著作权人名下作品著作权列表(author:作品著作权人-精确、page_size:每页大小、current_page:当前第几页,从1开始)
auther:sy
返回值:
{
"status": 0,
"msg": "操作成功",
"total": 2,
"data": [
{
"works_name": "触宝LoGO",
"works_type": "图形",
"reg_num": "T",
"publish_time": 1387170000,
"finish_time": 1387170000,
"first_publish_time": 1387170000
}
],
"bizmsg": "empty"
}
返回值说明:status为0则为成功,否则为查询有误
"works_name" 名称
"works_type" 类型
"reg_num" 登记号
"publish_time" 登记日期----格式为时间戳,转换后的格式为2018-08-21
"finish_time" 完成日期----格式为时间戳,转换后的格式为2018-08-21
"first_publish_time" 首次发表日期----格式为时间戳,转换后的格式为2018-08-21
"total" 总条数
*/
async worksListByAuthor(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": {
"works_author.raw": author
}
},
"from": from,
"size": pagesize,
"_source": [
"works_name",
"works_type",
"reg_num",
"publish_time",
"finish_time",
"first_publish_time"
],
"sort": [
{
"first_publish_time": "desc"
}
]
};
var rc = System.getObject("util.execClient");
var rtn = null;
var requrl = this.workcopyrightUrl;
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 (let index = 0; index < j.hits.hits.length; index++) {
const element = j.hits.hits[index];
if (element) {
res.data.push(element["_source"]);
}
}
}
return System.getResult2(res, null);
}
catch (e) {
return System.getResult2(null, "获取数据出错");
};
};
/*查询某一个软件著作权人名下软件著作权列表(reg_num:登记号-精确)
auther:sy
返回值:
{
"status": 0,
"msg": "操作成功",
"total": 2,
"data":{
"reg_num": "2013SR027478",
"cat_num": "30200-0000",
"full_name": "触宝拨号软件",
"simple_name": "TouchPal Dialer",
"software_version": "V3.3",
"author_nationality": [
{
"author_name": "上海触乐信息科技有限公司",
"author_country": "中国"
}
],
"publish_time": 1300593600,
"reg_time": 1364184000
},
"bizmsg": "empty"
}
返回值说明:status为0则为成功,否则为查询有误
"reg_num": "登记号",
"cat_num": "30200-0000??",
"full_name": "名称",
"simple_name": "软件简介",
"software_version": "版本号",
"author_nationality": [
{
"author_name": "软件著作权人",
"author_country": "软件著作权人国籍"
}
],
"publish_time": 首次发布日期,
"reg_time": 登记批准日期
*/
async worksDetailsByregNum(obj) {
var regNum = obj.reg_num == null || obj.reg_num == "" || obj.reg_num == "undefined" ? "" : obj.reg_num;
if (regNum == "") {
return System.getResult2(null,"作品著作权登记号不能为空");
}
var params = {
"query": {
"term": {
"reg_num": regNum
}
},
"from": 0,
"size": 1
};
var rc = System.getObject("util.execClient");
var rtn = null;
var requrl = this.workcopyrightUrl;
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 (let index = 0; index < j.hits.hits.length; index++) {
const element = j.hits.hits[index];
if (element) {
res.data.push(element["_source"]);
}
}
}
return System.getResult2(res, null);
}
catch (e) {
return System.getResult2(null, "获取数据出错");
};
};
}
module.exports = CopyRightSearchApi;
\ No newline at end of file
......@@ -2,8 +2,8 @@ var System = require("../../../system")
const crypto = require('crypto');
var xlsx = require('node-xlsx');
var fs = require("fs");
var accesskey = 'DHmRtFlw2Zr3KaRwUFeiu7FWATnmla';
var accessKeyId = 'LTAIyAUK8AD04P5S';
var accesskey = '3KV9nIwW8qkTGlrPmAe3HnR3fzM6r5';
var accessKeyId = 'LTAI4GC5tSKvqsH2hMqj6pvd';
var settings = require("../../../../config/settings");
const logCtl = System.getObject("web.common.oplogCtl");
const ApiBase = require("../../api.base");
......@@ -349,6 +349,92 @@ class ToolApi extends ApiBase {
}
}
//数据中心工商模糊查询接口
async getCompanyListByVague(pobj,o, req) {
var appkey = this.appKeyStr;
var pageSize = pobj.pageSize ? pobj.pageSize : 20;
var currentPage = pobj.currentPage ? pobj.currentPage : 1;
var data = {
appKey: appkey,
pageSize: pageSize,
currentPage: currentPage,
companyName: pobj.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: pobj.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 = pobj.pageSize ? o.pageSize : 20;
var currentPage = pobj.currentPage ? pobj.currentPage : 1;
var data = {
appKey: appkey,
pageSize: pageSize,
currentPage: currentPage,
companyName: pobj.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 = pobj.pageSize ? pobj.pageSize : 20;
var currentPage = pobj.currentPage ? pobj.currentPage : 1;
var data = {
appKey: appkey,
pageSize: pageSize,
currentPage: currentPage,
companyName: pobj.companyName,
};
var company = await this.gsbIcSearchApi.companyicpsearch(data);
if (company.status == 0 && company.data.totalSize > 0) {
return company;
} else {
return {};
}
}
//商标尼斯小项查询过滤
async getTmNclFilterSearch(pobj,o, req) {
var appkey = this.appKeyStr;
var data = {
appKey: appkey,
nclOneCodes: pobj.nclOneCodes,
nclSmallCodes: pobj.nclSmallCodes,
};
var ncllist = await this.gsbSearchApi.tmnclfiltersearch(data);
if (ncllist.status == 0) {
return ncllist;
} else {
return {};
}
}
async getCropperPic(qobj, obj, req) {
var that = this;
var base64 = obj.base64;
......
var System=require("../../../system")
const crypto = require('crypto');
var fs=require("fs");
var accesskey='DHmRtFlw2Zr3KaRwUFeiu7FWATnmla';
var accessKeyId='LTAIyAUK8AD04P5S';
var accesskey='3KV9nIwW8qkTGlrPmAe3HnR3fzM6r5';
var accessKeyId='LTAI4GC5tSKvqsH2hMqj6pvd';
var url="https://gsb-zc.oss-cn-beijing.aliyuncs.com";
class UploadApi{
constructor(){
......
......@@ -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);
......@@ -24,7 +25,7 @@ class GsbIcSearchApi extends ApiBase {
};
async membersearch(obj) {
var companyName = obj.companyName == null ? "" : obj.companyName;
companyName = await this.getConvertSemiangleStr(companyName);
var pageSize = obj.pageSize == null ? 15 : obj.pageSize;
......@@ -105,7 +106,7 @@ class GsbIcSearchApi extends ApiBase {
};
async shareholdersearch(obj) {
var companyName = obj.companyName == null ? "" : obj.companyName;
companyName = await this.getConvertSemiangleStr(companyName);
var pageSize = obj.pageSize == null ? 15 : obj.pageSize;
......@@ -173,7 +174,7 @@ class GsbIcSearchApi extends ApiBase {
};
async investsearch(obj) {
var companyName = obj.companyName == null ? "" : obj.companyName;
companyName = await this.getConvertSemiangleStr(companyName);
var pageSize = obj.pageSize == null ? 15 : obj.pageSize;
......@@ -242,7 +243,7 @@ class GsbIcSearchApi extends ApiBase {
};
async changesearch(obj) {
var companyName = obj.companyName == null ? "" : obj.companyName;
companyName = await this.getConvertSemiangleStr(companyName);
var pageSize = obj.pageSize == null ? 15 : obj.pageSize;
......@@ -310,7 +311,7 @@ class GsbIcSearchApi extends ApiBase {
};
async companynamesearch(obj) {
var companyName = obj.companyName == null ? "" : obj.companyName;
companyName = await this.getConvertSemiangleStr(companyName);
var pageSize = obj.pageSize == null ? 15 : obj.pageSize;
......@@ -396,7 +397,7 @@ class GsbIcSearchApi extends ApiBase {
};
async companynameonesearch(obj) {
var companyName = obj.companyName == null ? "" : obj.companyName;
companyName = await this.getConvertSemiangleStr(companyName);
var pageSize = 1;
......@@ -423,27 +424,49 @@ class GsbIcSearchApi extends ApiBase {
"from": from,
"size": pageSize,
"_source": [
"company_id",
"company_province",
"gsb_city",
"company_domain",
"legal_person",
"reg_status",
"reg_unit",
"reg_capital",
"estibish_time",
"credit_code",
"reg_number",
"org_number",
"company_type",
"reg_institute",
"company_org_type",
"reg_location",
"business_scope",
"approved_time",
"estiblish_time",
"from_time",
"to_time",
"reg_unit"
"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"
]
};
// 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 :行业大类三类
var rc = System.getObject("util.execClient");
var rtn = null;
try {
......@@ -469,25 +492,31 @@ class GsbIcSearchApi extends ApiBase {
var time3 = new Date(c._source.to_time * 1000);
c._source.to_time = time3.toLocaleDateString();
}
if (c._source.estibish_time != null) {
var time3 = new Date(c._source.estibish_time * 1000);
c._source.estibish_time = time3.toLocaleDateString();
if (c._source.estiblish_time != null) {
var time3 = new Date(c._source.estiblish_time * 1000);
c._source.estiblish_time = time3.toLocaleDateString();
}
var source = {
companyProvince: c._source.company_province,
city: c._source.gsb_city,
name: c._source.company_domain,
legalRepresentative: c._source.legal_person,
managementState: c._source.reg_status,
registeredCapital: c._source.reg_capital + c._source.reg_unit,
foundedTime: c._source.estibish_time,
creditCode: c._source.credit_code,
registrID: c._source.reg_number,
organizationCode: c._source.org_number,
companyType: c._source.company_type,
registerOffice: c._source.reg_institute,
companyOrgType: c._source.company_org_type,
businessAddress: c._source.reg_location,
foundedTime: c._source.estiblish_time || "",
businessTerm: c._source.from_time + "至" + c._source.to_time,
scope: c._source.business_scope,
registerOffice: c._source.reg_institute,
dateIssue: c._source.approved_time,
businessTerm: c._source.from_time + "至" + c._source.to_time,
managementState: c._source.reg_status,
registeredCapital: c._source.reg_capital + c._source.reg_unit || "万人民币",
organizationCode: c._source.org_number,
creditCode: c._source.credit_code,
companyCate1: c._source.gsb_company_cate_1,
companyCate2: c._source.gsb_company_cate_2,
companyCate3: c._source.gsb_company_cate_3,
companyType: c._source.company_type
};
sources.push(source);
});
......@@ -502,7 +531,7 @@ class GsbIcSearchApi extends ApiBase {
var self = this;
var isVerify = obj.isVerify || 1;
if (isVerify == 1) {
}
var companyName = obj.companyName == null ? "" : obj.companyName;
companyName = await this.getConvertSemiangleStr(companyName);
......@@ -625,9 +654,467 @@ 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", //"经营范围",
"change_before", //变更前内容
"change_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,
change_before: c._source.change_before,
change_after: c._source.change_after,
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;
var companyNames = obj.companyNames;
var pageSize = obj.companyNames.length;
if (obj.currentPage == null) {
......@@ -715,7 +1202,7 @@ class GsbIcSearchApi extends ApiBase {
};
async companycodesearch(obj) {
var creditCode = obj.creditCode == null ? "" : obj.creditCode;
var pageSize = obj.pageSize == null ? 15 : obj.pageSize;
if (obj.currentPage == null) {
......@@ -814,7 +1301,7 @@ class GsbIcSearchApi extends ApiBase {
};
async companyNumsearch(obj) {
var regNumber = obj.regNumber == null ? "" : obj.regNumber;
var pageSize = obj.pageSize == null ? 15 : obj.pageSize;
if (obj.currentPage == null) {
......@@ -917,7 +1404,7 @@ class GsbIcSearchApi extends ApiBase {
var self = this;
var isVerify = obj.isVerify || 1;
if (isVerify == 1) {
}
var companyName = obj.companyName == null ? "" : obj.companyName;
companyName = await this.getConvertSemiangleStr(companyName);
......@@ -965,7 +1452,7 @@ class GsbIcSearchApi extends ApiBase {
};
async branchsearch(obj) {
var companyName = obj.companyName == null ? "" : obj.companyName;
companyName = await this.getConvertSemiangleStr(companyName);
var pageSize = obj.pageSize == null ? 15 : obj.pageSize;
......
......@@ -28,7 +28,7 @@ class GsbTmSearchApi extends ApiBase {
};
async xzSearch(obj) {//续展查询-ok
var self = this;
var type = obj.searchType;
if (type == "" || type == null) {
return System.getResult2(null, null);
......@@ -168,7 +168,7 @@ class GsbTmSearchApi extends ApiBase {
}
};
async xzallSearch(obj) {//公司商机
var companyName = obj.companyName == null ? "" : obj.companyName;
var addr = obj.address == null ? "" : obj.address;
var pagesize = obj.pageSize == null ? 15 : obj.pageSize;
......@@ -253,7 +253,7 @@ class GsbTmSearchApi extends ApiBase {
};
async xzSearchDetail(obj) {//续展详情查询
var type = obj.searchType;
if (type == "" || type == null) {
return System.getResult2(null, null);
......@@ -334,7 +334,7 @@ class GsbTmSearchApi extends ApiBase {
};
async yySearchDetail(obj) {//异议详情查询-???
if (obj.companyName == null && obj.companyName == "") {
return System.getResult2(null, null);
}
......@@ -410,7 +410,7 @@ class GsbTmSearchApi extends ApiBase {
}
};
async byslSearch(obj) {//不予受理查询-???
var companyName = obj.companyName == null ? "" : obj.companyName;
var pagesize = obj.pageSize == null ? 15 : obj.pageSize;
if (obj.currentPage == null) {
......@@ -467,7 +467,7 @@ class GsbTmSearchApi extends ApiBase {
}
};
async byslDetail(obj) {//不予受理详情查询-???
if (obj.companyName == null && obj.companyName == "") {
return System.getResult2(null, null);
}
......@@ -524,7 +524,7 @@ class GsbTmSearchApi extends ApiBase {
};
async tmSearch(obj) {//商标查询-ok
var param = {
tm_name: obj.tmName,
reg_num: obj.regNum,
......@@ -536,7 +536,7 @@ class GsbTmSearchApi extends ApiBase {
};
async tmAccurateSearch(obj) {//根据商标名称进行精准查询
var tmName = obj.tmName == null ? "" : obj.tmName;
var sqlbtabkey = obj.sqlbtabkey == null ? "" : obj.sqlbtabkey;
var pagesize = obj.pagesize == null ? 15 : obj.pagesize;
......@@ -609,7 +609,7 @@ class GsbTmSearchApi extends ApiBase {
}
};
async tmAccurateJuheSearch(obj) {//根据商标名称精准查询,对查询结果进行类别聚合
var tmName = obj.tmName == null ? "" : obj.tmName;
if (tmName == "") {
......@@ -647,7 +647,7 @@ class GsbTmSearchApi extends ApiBase {
};
async tmNameSearch(obj) {//根据商标名称模糊查询
var tmName = obj.tmName == null ? "" : obj.tmName;
var sqlbtabkey = obj.sqlbtabkey == null ? "" : obj.sqlbtabkey;
var pagesize = obj.pagesize == null ? 15 : obj.pagesize;
......@@ -721,7 +721,7 @@ class GsbTmSearchApi extends ApiBase {
};
async tmNamejuheSearch(obj) {//根据商标名称模糊查询,对查询结果进行类别聚合
var tmName = obj.tmName == null ? "" : obj.tmName;
if (tmName == "") {
......@@ -759,7 +759,7 @@ class GsbTmSearchApi extends ApiBase {
};
async tmzchSearch(obj) {//根据商标商标号精准查询
var regNum = obj.regNum == null ? "" : obj.regNum;
var sqlbtabkey = obj.sqlbtabkey == null ? "" : obj.sqlbtabkey;
var pagesize = obj.pagesize == null ? 15 : obj.pagesize;
......@@ -833,7 +833,7 @@ class GsbTmSearchApi extends ApiBase {
};
async tmzchjuheSearch(obj) {//根据商标商标号精准查询,对查询结果进行类别聚合
var regNum = obj.regNum == null ? "" : obj.regNum;
if (regNum == "") {
......@@ -871,7 +871,7 @@ class GsbTmSearchApi extends ApiBase {
};
async tmzcrSearch(obj) {//根据商标注册人模糊查询
var applier = obj.applier == null ? "" : obj.applier;
var sqlbtabkey = obj.sqlbtabkey == null ? "" : obj.sqlbtabkey;
var pagesize = obj.pagesize == null ? 15 : obj.pagesize;
......@@ -945,7 +945,7 @@ class GsbTmSearchApi extends ApiBase {
};
async tmzcrjuheSearch(obj) {//根据商标注册人模糊查询,对查询结果进行类别聚合
var applier = obj.applier == null ? "" : obj.applier;
if (applier == "") {
......@@ -984,7 +984,7 @@ class GsbTmSearchApi extends ApiBase {
async tmSearchByRegNum(obj) {//商标查询(多注册号)-ok
var reqUrl = this.tmSearchUrl;
if (obj.regNums == null || obj.regNums.length < 1) {
return System.getResult2(null, null);
}
......@@ -1058,7 +1058,7 @@ class GsbTmSearchApi extends ApiBase {
};
async getTmFlow(obj) {//商标流程
var param = {
reg_num: obj.regNum
}
......@@ -1066,7 +1066,7 @@ class GsbTmSearchApi extends ApiBase {
}
async getTmNclSmallCodes(obj) {//商标小类
var param = {
reg_num: obj.regNum,
nclone_code: obj.nclOneCode
......@@ -1075,7 +1075,7 @@ class GsbTmSearchApi extends ApiBase {
}
async getNcl(obj) {//尼斯数据
var nclcode = obj.nclcode == null ? "" : obj.nclcode;
var level = obj.level == null ? "" : obj.level;
var nclcodelist = obj.nclcodelist || null;
......@@ -1150,7 +1150,7 @@ class GsbTmSearchApi extends ApiBase {
};
async getNclByLikeName_new(obj) {//尼斯数据
var ncls = obj.ncls || null;
var name = obj.name;
var reqUrl = this.nclUrl;
......@@ -1359,7 +1359,7 @@ class GsbTmSearchApi extends ApiBase {
}
}
async getNclByLikeName(obj) {//尼斯数据
var ncls = obj.ncls || null;
var name = obj.name;
var reqUrl = this.nclUrl;
......@@ -1550,7 +1550,7 @@ class GsbTmSearchApi extends ApiBase {
return tmpParams;
}
async imagesearch(obj) {//图像检索结果进行查询
var tmRegistNum = obj.tmRegistNum == null ? "" : obj.tmRegistNum;
var sqlbtabkey = obj.sqlbtabkey == null ? "" : obj.sqlbtabkey;
if (tmRegistNum == "" && tmRegistNum == null) {
......@@ -1614,7 +1614,7 @@ class GsbTmSearchApi extends ApiBase {
}
}
async imagesearchbycode(obj) {//图像检索结果进行分类查询
var tmRegistNumsAll = obj.tmRegistNumsAll == null ? "" : obj.tmRegistNumsAll;
var sqlbtabkey = obj.sqlbtabkey == null ? "" : obj.sqlbtabkey;
var pagesize = obj.pagesize == null ? 15 : obj.pagesize;
......@@ -1767,7 +1767,7 @@ class GsbTmSearchApi extends ApiBase {
}
}
async getAgencyName(obj) {//代理机构名称查询
var companyName = obj.companyName == null ? "" : obj.companyName;
companyName = await this.getConvertSemiangleStr(companyName);
var pageSize = obj.pageSize == null ? 15 : obj.pageSize;
......@@ -1806,6 +1806,76 @@ class GsbTmSearchApi extends ApiBase {
return rtn = System.getResult2(null, null);
}
}
//商标尼斯小项查询过滤
async tmnclfiltersearch(obj) {
var nclOneCodes = obj.nclOneCodes == null ? "" : obj.nclOneCodes;
var nclSmallCodes = obj.nclSmallCodes == [] ? "" : obj.nclSmallCodes;
var reqUrl = this.nclUrl;
var params = {
"query": {
"bool": {
"must": [
{
"term": {
"belong_to_onecode": nclOneCodes
}
},
{
"term": {
"level": 3
}
}
]
}
},
"size": 300,
"_source": [
"code",
"level",
"description",
"name",
"pid",
"belong_to_onecode"
]
};
if (nclSmallCodes.length > 0) {
var namelist = []
for (var k = 0; k < nclSmallCodes.length; k++) {
var c = nclSmallCodes[k];
namelist.push(c.name);
}
var dsl = {
"terms": {
"name.raw": namelist
}
}
params.query.bool.must.push(dsl);
}
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 = {
"nclOneCodes": nclOneCodes,
"nclSmallCodes": sources
};
j.hits.hits.forEach(function (c) {
var source = {
code: c._source.code,
name: c._source.name,
pcode: c._source.pcode
};
sources.push(source);
});
var a = { status: 0, msg: "操作成功", data: data };
return a;
} catch (e) {
return { status: -1, msg: "操作失败", data: null };
}
}
async getConvertSemiangleStr(str) {
var result = "";
......
......@@ -627,7 +627,7 @@ class tmqueryApi extends ApiBase{
return System.getResult2(result,null);
}
async findTrademarkzchAccurate(query,obj){//通过商标号来进行精准查询
async findTrademarkzchAccurate(obj){//通过商标号来进行精准查询
var result={rows:[],code_counts:[],status_counts:[],year_counts:[],count:0};
var sources=[];
var codes=[];
......@@ -642,8 +642,8 @@ class tmqueryApi extends ApiBase{
var ncltwocodesearch = obj.xcl;
var ncltwo =[];
for(var i=0;i<ncltwocodesearch.length;i++){
var code=ncltwocodesearch[i].code;
ncltwo.push(code);
var code=ncltwocodesearch[i].code;
ncltwo.push(code);
}
var data={
regNum:regNum,
......@@ -1270,10 +1270,10 @@ class tmqueryApi extends ApiBase{
}
async tradeMarkDetail(query,obj){//商标详情
console.log(obj);
// console.log(obj);
var result={detaildata:[],nclexist:[],nclnotexist:[]};
var sbzch=obj.sbzch;
var gjfl=obj.gjfl;
var sbzch=query.sbzch;
var gjfl=query.gjfl;
var sources=[];
var data={
sbzch:sbzch,
......@@ -1283,15 +1283,15 @@ class tmqueryApi extends ApiBase{
regNum:sbzch
};
var detailtms= await this.GsbByTmSearchApi.tradeMarkDetailapi(data);
console.log("00000000000000000000000000000000000000000000000000000000");
console.log(detailtms);
// console.log("00000000000000000000000000000000000000000000000000000000");
// console.log(detailtms);
var data2={
reg_num:sbzch,
nclone_code:gjfl
}
var qunzutms=await this.utilstmSve.getGroupNclInfo(data2);
console.log("11111111111111111111111111111111111111111111111111111");
console.log(qunzutms.data);
// console.log("11111111111111111111111111111111111111111111111111111");
// console.log(qunzutms.data);
if(qunzutms.status==0){
var qunzuexist=[];
var qunzuexistnorepeat=[]
......@@ -1326,8 +1326,8 @@ class tmqueryApi extends ApiBase{
lcxx.push(lcjson);
});
}
console.log("lcxx====================================");
console.log(lcxx);
// console.log("lcxx====================================");
// console.log(lcxx);
if(detailtms.status == 0 && detailtms.data.length>0){
var tm=detailtms.data[0];
var source={
......@@ -1390,7 +1390,7 @@ class tmqueryApi extends ApiBase{
// sources.push(source);
// }
result.detaildata=sources;
console.log(result);
// console.log(result);
return System.getResult2(result,null);
}
......@@ -1755,7 +1755,7 @@ class tmqueryApi extends ApiBase{
data: null
};
try {
var tCompanyName = qobj.company_name || "";
var tCompanyName = queryobj.company_name || "";
if (!tCompanyName || tCompanyName == "undefined") {
// result.code = -102;
// result.message = "company_name参数有误";
......
......@@ -2,9 +2,10 @@ var system = require("../../../system")
const CtlBase = require("../../ctl.base");
const crypto = require('crypto');
var fs = require("fs");
var accesskey = 'DHmRtFlw2Zr3KaRwUFeiu7FWATnmla';
var accessKeyId = 'LTAIyAUK8AD04P5S';
var accesskey = '3KV9nIwW8qkTGlrPmAe3HnR3fzM6r5';
var accessKeyId = 'LTAI4GC5tSKvqsH2hMqj6pvd';
var url = "https://gsb-zc.oss-cn-beijing.aliyuncs.com";
//-----------------------------------------暂时没有用到此类的方法
class UploadCtl extends CtlBase {
constructor() {
super("common", CtlBase.getServiceName(UploadCtl));
......
const system = require("../system");
const moment = require('moment')
const settings = require("../../config/settings");
const md5 = require("MD5");
class AppServiceBase {
constructor() {
this.execClient = system.getObject("util.execClient");
this.restClient = system.getObject("util.restClient");
this.cacheManager = system.getObject("db.common.cacheManager");
}
/**
* 验证签名
* @param {*} params 要验证的参数
* @param {*} app_key 应用的校验key
*/
async verifySign(params, app_key) {
if (!params) {
return system.getResult(null, "请求参数为空");
}
if (!params.sign) {
return system.getResult(null, "请求参数sign为空");
}
var signArr = [];
var keys = Object.keys(params).sort();
if (keys.length == 0) {
return system.getResult(null, "请求参数信息为空");
}
for (let k = 0; k < keys.length; k++) {
const tKey = keys[k];
if (tKey != "sign" && params[tKey] && !(params[tKey] instanceof Array)) {
signArr.push(tKey + "=" + params[tKey]);
}
}
if (signArr.length == 0) {
return system.getResult(null, "请求参数组装签名参数信息为空");
}
var resultSignStr = signArr.join("&") + "&key=" + app_key;
var resultTmpSign = md5(resultSignStr).toUpperCase();
if (params.sign != resultTmpSign) {
return system.getResult(null, "返回值签名验证失败");
}
return system.getResultSuccess();
}
async restPostUrl(pobj, url) {
var rtn = await this.restClient.execPost(pobj, url);
if (!rtn || !rtn.stdout) {
return system.getResult(null, "restPost is empty");
}
var result = JSON.parse(rtn.stdout);
return result;
}
async execPostUrl(pobj, url) {
var rtn = await this.execClient.execPost(pobj, url);
if (!rtn || !rtn.stdout) {
return system.getResult(null, "execPost is empty");
}
var result = JSON.parse(rtn.stdout);
return result;
}
}
module.exports = AppServiceBase;
const system=require("../../../system");
const ServiceBase=require("../../sve.base");
const crypto = require('crypto');
var accesskey = 'DHmRtFlw2Zr3KaRwUFeiu7FWATnmla';
var accessKeyId = 'LTAIyAUK8AD04P5S';
var accesskey = '3KV9nIwW8qkTGlrPmAe3HnR3fzM6r5';
var accessKeyId = 'LTAI4GC5tSKvqsH2hMqj6pvd';
var url = "https://gsb-zc.oss-cn-beijing.aliyuncs.com";
class UploadService extends ServiceBase{
constructor(){
......@@ -11,7 +11,7 @@ class UploadService extends ServiceBase{
}
async getOssConfig() {
var end = new Date().getTime() + 36000000;
var end = new Date().getTime() + 36000000;//10小时-毫秒
var expiration = new Date(end).toISOString()
var policyText = {
"expiration": expiration,
......
const System = require("../../../system");
var settings = require("../../../../config/settings");
var md5 = require("MD5");
const querystring = require('querystring');
class EnterpriseService {
constructor() {
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";
this.qccUrl = "http://api.qichacha.com/ECIV4/GetDetailsByName";
this.patentApi = System.getObject("api.patent.chinapatentsearch");
this.copyApi = System.getObject("api.patent.copyrightsearch");
this.redisClient = System.getObject("util.redisClient");
};
async getcountAll(obj){//获取企业所有证照数量
try{
var author = obj.author == null || obj.author == "" || obj.author == "undefined" ? "" : obj.author;
if (author == "") {
return System.getResult2(null, "企业名称不能为空");
}
author = await this.getConvertSemiangleStr(author);
var resdict = {
"知产证照":0,
"互联网经营":0,
"食品":0,
"网络文化":0,
"特种资质":0
}
var parms = {
"applicant_name": author
}
var licenses = [];
var patentCount = 0;
var res = await this.patentApi.paCountByApplicantName(parms);
if (res.status == 0){
patentCount = res.data;
}
var softCount = 0;
res = await this.copyApi.softwareCountByAuthor(obj);
if (res.status == 0){
softCount = res.data;
}
var worksCount = 0;
res = await this.copyApi.worksCountByAuthor(obj);
if (res.status == 0){
worksCount = res.data;
}
resdict["知产证照"] = patentCount + softCount + worksCount;
res = await this.gxCountByAuthor(obj);
var gxCount = 0;
if (res.status == 0){
gxCount = res.data;
}
resdict["特种资质"] = gxCount;
parms = {
"author":author,
"type":"网络游戏出版备案"
}
res = await this.gameCountByAuthor(parms);
var game1Count = 0;
var game2Count = 0;
if (res.status == 0){
game1Count = res.data;
}
parms = {
"author":author,
"type":"网络游戏运营备案"
}
res = await this.gameCountByAuthor(parms);
if (res.status == 0){
game2Count = res.data;
}
res = await this.licenseCountByAuthor(obj);
var webCount = 0;
var gbcount = 0;
var ICPCount = 0;
var IDCCount = 0;
var EDICount = 0;
if (res.status == 0){
for (var index =0;index < res.data.data.length;index++){
var temp = res.data.data[index];
if (temp){
if (temp["key"] == "网络文化经营许可证"){
webCount = temp["doc_count"];
}
else if (temp["key"] == "广播电视节目制作经营许可证"){
gbcount = temp["doc_count"];
}
else if (temp["key"] == "ICP许可证"){
ICPCount = temp["doc_count"];
}
else if (temp["key"] == "IDC许可证"){
IDCCount = temp["doc_count"];
}
else if (temp["key"] == "EDI许可证"){
EDICount = temp["doc_count"];
}
}
}
}
resdict["互联网经营"] = ICPCount + IDCCount + EDICount;
resdict["网络文化"] = webCount + gbcount + game1Count + game2Count;
return System.getResult2(resdict, null);
}
catch (e)
{
console.log(e);
return System.getResult2(null, "获取数据出错");
}
}
async getQccBranches(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 childName = await this.redisClient.get("qichacha_QccBranches:" + author);
if (childName){
return System.getResult2(JSON.parse(childName), "获取数据成功");
}
else{
var Timespan = parseInt(Date.now()/1000);//秒级时间戳
var Token = md5("74805b02bf2f46feaa3bdb24feecfbc1" + Timespan.toString() + "5D92FB79060AFCBFD3D4BC7AE7A3D225");
Token = Token.toUpperCase();
var params = {
key:"74805b02bf2f46feaa3bdb24feecfbc1",
keyword:author
}
var rc = System.getObject("util.restClient");
var data= querystring.stringify(params);
var rtn=null;
try{
rtn=await rc.execGetZZ(params,this.qccUrl,Token,Timespan);
var result = JSON.parse(rtn.stdout);
if (result.Status == "200"){
//await this.redisClient.set("qichacha_QccBranches:" + author, result.Result.Branches.join("-"));
await this.redisClient.setWithEx("qichacha_QccBranches:" + author, JSON.stringify(result.Result.Branches), 31536000);
return System.getResult2(result.Result.Branches, "获取数据成功");
}
else if (result.Status == "201"){
return System.getResult2(null, "查询无结果");
}
else{
return System.getResult2(null, "获取数据出错");
}
}catch(e){
return System.getResult2(null, "获取数据出错");
}
}
};
async getConvertSemiangleStr(str) {//半角转全角
var result = "";
var len = str.length;
for (var i = 0; i < len; i++) {
var cCode = str.charCodeAt(i);
//全角与半角相差(除空格外):65248(十进制)
cCode = (cCode >= 0xFF01 && cCode <= 0xFF5E) ? (cCode - 65248) : cCode;
//处理空格
cCode = (cCode == 0x03000) ? 0x0020 : cCode;
result += String.fromCharCode(cCode);
}
return result;
};
async gxCountByAuthor(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": {
"companyName.raw": author
}
},
"size": 0
};
var rc = System.getObject("util.execClient");
var rtn = null;
var requrl = this.gxgyUrl;
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 gxListByAuthor(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": {
"companyName.raw": author
}
},
"from": from,
"size": pagesize,
"_source": [
"techType",
"area",
"certificateNo",
"address",
"year",
"businessScope"
],
"sort": [
{
"year": "desc"
}
]
};
var rc = System.getObject("util.execClient");
var rtn = null;
var requrl = this.gxgyUrl;
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 (let index = 0; index < j.hits.hits.length; index++) {
const element = j.hits.hits[index];
if (element) {
res.data.push(element["_source"]);
}
}
}
return System.getResult2(res, null);
}
catch (e) {
return System.getResult2(null, "获取数据出错");
};
};
async gameCountByAuthor(obj) {//获取游戏出版及运营数量
var author = obj.author == null || obj.author == "" || obj.author == "undefined" ? "" : obj.author;
var type = obj.type == null || obj.type == "" || obj.type == "undefined" ? "" : obj.type;
if (author == "" || type == "") {
return System.getResult2(null, "企业名称和证照类型不能为空");
}
author = await this.getConvertSemiangleStr(author);
var params = null;
if (type == "网络游戏出版备案") {
params = {
"query": {
"term": {
"publishing_unit.raw": author
}
},
"size": 0
}
}
else if (type == "网络游戏运营备案") {
params = {
"query": {
"term": {
"operation_unit.raw": author
}
},
"size": 0
}
}
else {
return System.getResult2(null, "证照类型不正确");
}
var rc = System.getObject("util.execClient");
var rtn = null;
var requrl = this.gameUrl;
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 gameListByAuthor(obj) {//获取游戏出版信息列表
var author = obj.author == null || obj.author == "" || obj.author == "undefined" ? "" : obj.author;
var type = obj.type == null || obj.type == "" || obj.type == "undefined" ? "" : obj.type;
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 == "" || type == "") {
return System.getResult2(null, "企业名称和证照类型不能为空");
}
author = await this.getConvertSemiangleStr(author);
var params = null;
if (type == "网络游戏出版备案") {
params = {
"query": {
"term": {
"publishing_unit.raw": author
}
},
"from": from,
"size": pagesize,
"_source": [
"game_name",
"declaration_category",
"publishing_unit",
"operation_unit",
"symbol",
"publishing_number",
"publish_time",
"publishing_record",
"operation_record",
"industry_type"
],
"sort": [
{
"publish_time": "desc"
}
]
}
}
else if (type == "网络游戏运营备案") {
params = {
"query": {
"term": {
"operation_unit.raw": author
}
},
"from": from,
"size": pagesize,
"_source": [
"game_name",
"declaration_category",
"publishing_unit",
"operation_unit",
"symbol",
"publishing_number",
"publish_time",
"publishing_record",
"operation_record",
"industry_type"
],
"sort": [
{
"publish_time": "desc"
}
]
}
}
else {
return System.getResult2(null, "证照类型不正确");
}
var rc = System.getObject("util.execClient");
var rtn = null;
var requrl = this.gameUrl;
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 (let index = 0; index < j.hits.hits.length; index++) {
const element = j.hits.hits[index];
if (element) {
res.data.push(element["_source"]);
}
}
}
return System.getResult2(res, null);
}
catch (e) {
return System.getResult2(null, "获取数据出错");
};
};
async licenseCountByAuthor(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": {
"companyName.raw": author
}
},
"from": 0,
"size": 0,
"aggregations": {
"group_by_licence": {
"terms": {
"field": "licence",
"size": 1000
}
}
}
};
var rc = System.getObject("util.execClient");
var rtn = null;
var requrl = this.licenseUrl;
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 (let index = 0; index < j.aggregations.group_by_licence.buckets.length; index++) {
const element = j.aggregations.group_by_licence.buckets[index];
if (element) {
res.data.push(element);
}
}
}
return System.getResult2(res, null);
}
catch (e) {
return System.getResult2(null, "获取数据出错");
};
};
async licenseListByAuthor(obj) {//获取企业证照信息列表
var author = obj.author == null || obj.author == "" || obj.author == "undefined" ? "" : obj.author;
var licence = obj.licence == null || obj.licence == "" || obj.licence == "undefined" ? "" : obj.licence;
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 == "" || licence == "") {
return System.getResult2(null, "企业名称和证照类型不能为空");
}
author = await this.getConvertSemiangleStr(author);
var params = {
"query": {
"bool": {
"must": [
{
"term": {
"companyName.raw": author
}
},
{
"term": {
"licence": licence
}
},
]
}
},
"from": from,
"size": pagesize,
"_source": [
"companyName",
"licence",
"licence_no",
"service_category",
"start_date",
"end_date",
"industry_type"
],
"sort": [
{
"end_date": "desc"
}
]
};
var rc = System.getObject("util.execClient");
var rtn = null;
var requrl = this.licenseUrl;
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 (let index = 0; index < j.hits.hits.length; index++) {
const element = j.hits.hits[index];
if (element) {
res.data.push(element["_source"]);
}
}
}
return System.getResult2(res, null);
}
catch (e) {
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);
if (author == "阿里云计算有限公司"){
return System.getResult2(12, null);
}
else if (author == "行吟信息科技(上海)有限公司"){
return System.getResult2(8, null);
}
else if (author == "小米科技有限责任公司"){
return System.getResult2(15, null);
}
else if (author == "上海熊猫互娱文化有限公司"){
return System.getResult2(3, null);
}
else if (author == "网易(杭州)网络有限公司"){
return System.getResult2(5, null);
}
else if (author == "万达电影股份有限公司"){
return System.getResult2(2, null);
}
else{
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);
if (author == "阿里云计算有限公司"){
var res = {};
res.total = 12;
res.data = [];
if (from == 0){
var temp = {"company_name":"阿里云计算有限公司","phone1":"阿里云","web_adress":"www.net.cn","card_num":"浙B2-20080101-21","phone2":"2019-7-19"};
res.data.push(temp);
temp = {"company_name":"阿里云计算有限公司","phone1":"阿里云","web_adress":"www.aliyun.com","card_num":"浙B2-20080101-4","phone2":"2019-7-19"};
res.data.push(temp);
temp = {"company_name":"阿里云计算有限公司","phone1":"phpwind官方网","web_adress":"www.phpwind.com","card_num":"浙B2-20080101-10","phone2":"2019-7-19"};
res.data.push(temp);
temp = {"company_name":"阿里云计算有限公司","phone1":"phpwind官方社区","web_adress":"www.phpwind.net","card_num":"浙B2-20080101-9","phone2":"2019-7-19"};
res.data.push(temp);
temp = {"company_name":"阿里云计算有限公司","phone1":"uueasy站长平台","web_adress":"www.uueasy.com","card_num":"浙B2-20080101-11","phone2":"2019-7-19"};
res.data.push(temp);
}
else if (from == 5){
var temp = {"company_name":"阿里云计算有限公司","phone1":"阿里旺旺","web_adress":"www.alicdn.com","card_num":"浙B2-20080101-3","phone2":"2019-7-19"};
res.data.push(temp);
temp = {"company_name":"阿里云计算有限公司","phone1":"阿里云PC","web_adress":"www.aliypc.com","card_num":"浙B2-20080101-20","phone2":"2019-7-19"};
res.data.push(temp);
temp = {"company_name":"阿里云计算有限公司","phone1":"阿里软件","web_adress":"www.alisoft.com","card_num":"浙B2-20080101-1","phone2":"2019-7-19"};
res.data.push(temp);
temp = {"company_name":"阿里云计算有限公司","phone1":"阿里云Mindsphere","web_adress":"www.mindsphere-in.cn","card_num":"浙B2-20080101-24","phone2":"2019-7-19"};
res.data.push(temp);
temp = {"company_name":"阿里云计算有限公司","phone1":"农业种植项目产品","web_adress":"www.etagri.com","card_num":"浙B2-20080101-23","phone2":"2019-7-19"};
res.data.push(temp);
}
else{
var temp = {"company_name":"阿里云计算有限公司","phone1":"趣淘网","web_adress":"www.qutao.com","card_num":"浙B2-20080101-14","phone2":"2019-7-19"};
res.data.push(temp);
temp = {"company_name":"阿里云计算有限公司","phone1":"阿里云LinkMarket物联网市场","web_adress":"www.aliyuniot.com","card_num":"浙B2-20080101-22","phone2":"2019-7-19"};
res.data.push(temp);
}
return System.getResult2(res, null);
}
else if (author == "行吟信息科技(上海)有限公司"){
var res = {};
res.total = 8;
res.data = [];
if (from == 0){
var temp = {"company_name":"行吟信息科技(上海)有限公司","phone1":"小红书","web_adress":"www.xiaohongshu.net","card_num":"沪ICP备13030189号-8","phone2":"2018-11-22"};
res.data.push(temp);
temp = {"company_name":"行吟信息科技(上海)有限公司","phone1":"小红书物流","web_adress":"www.hongyunlogistics.com","card_num":"沪ICP备13030189号-7","phone2":"2018-11-22"};
res.data.push(temp);
temp = {"company_name":"行吟信息科技(上海)有限公司","phone1":"小红书短域名服务","web_adress":"www.rl.ink","card_num":"沪ICP备13030189号-6","phone2":"2018-11-22"};
res.data.push(temp);
temp = {"company_name":"行吟信息科技(上海)有限公司","phone1":"小红书yuukoo","web_adress":"www.yuukoo.info","card_num":"沪ICP备13030189号-5","phone2":"2018-11-22"};
res.data.push(temp);
temp = {"company_name":"行吟信息科技(上海)有限公司","phone1":"小红书select","web_adress":"www.redselect.com.cn","card_num":"沪ICP备13030189号-4","phone2":"2018-11-22"};
res.data.push(temp);
}
else{
var temp = {"company_name":"行吟信息科技(上海)有限公司","phone1":"小红书elight","web_adress":"www.redelight.cn","card_num":"沪ICP备13030189号-3","phone2":"2018-11-22"};
res.data.push(temp);
temp = {"company_name":"行吟信息科技(上海)有限公司","phone1":"小红书CDN","web_adress":"www.xhscdn.com","card_num":"沪ICP备13030189号-2","phone2":"2018-11-22"};
res.data.push(temp);
temp = {"company_name":"行吟信息科技(上海)有限公司","phone1":"小红书","web_adress":"www.xiaohongshu.com","card_num":"沪ICP备13030189号-1","phone2":"2018-11-22"};
res.data.push(temp);
}
return System.getResult2(res, null);
}
else if (author == "小米科技有限责任公司"){
var res = {};
res.total = 15;
res.data = [];
if (from == 0){
var temp ={"company_name":"小米科技有限责任公司","phone1":"MIUI米柚","web_adress":"www.miui.cn","card_num":"京ICP备10046444号-4","phone2":"2019-12-20"};
res.data.push(temp);
temp ={"company_name":"小米科技有限责任公司","phone1":"小米科技","web_adress":"58.220.58.153","card_num":"京ICP备10046444号-15","phone2":"2019-12-20"};
res.data.push(temp);
temp ={"company_name":"小米科技有限责任公司","phone1":"小米路由器","web_adress":"www.miwifi.com","card_num":"京ICP备10046444号-14","phone2":"2019-12-20"};
res.data.push(temp);
temp ={"company_name":"小米科技有限责任公司","phone1":"脸图","web_adress":"www.facephoto.com","card_num":"京ICP备10046444号-11","phone2":"2019-12-20"};
res.data.push(temp);
temp ={"company_name":"小米科技有限责任公司","phone1":"小米盒子","web_adress":"www.duokanbox.com","card_num":"京ICP备10046444号-6","phone2":"2019-12-20"};
res.data.push(temp);
}
else if (from ==5){
var temp ={"company_name":"小米科技有限责任公司","phone1":"小米科技有限责任公司","web_adress":"www.miui.com","card_num":"京ICP备10046444号-2","phone2":"2019-12-20"};
res.data.push(temp);
temp ={"company_name":"小米科技有限责任公司","phone1":"小米科技","web_adress":"58.220.59.2","card_num":"京ICP备10046444号-16","phone2":"2019-12-20"};
res.data.push(temp);
temp ={"company_name":"小米科技有限责任公司","phone1":"小米科技","web_adress":"58.220.58.152","card_num":"京ICP备10046444号-17","phone2":"2019-12-20"};
res.data.push(temp);
temp ={"company_name":"小米科技有限责任公司","phone1":"小米科技","web_adress":"www.mi.cn","card_num":"京ICP备10046444号-9","phone2":"2019-12-20"};
res.data.push(temp);
temp ={"company_name":"小米科技有限责任公司","phone1":"小米科技有限责任公司","web_adress":"www.mi.com","card_num":"京ICP备10046444号-7","phone2":"2019-12-20"};
res.data.push(temp);
}
else{
var temp ={"company_name":"小米科技有限责任公司","phone1":"小米科技有限责任公司","web_adress":"www.mifile.cn","card_num":"京ICP备10046444号-12","phone2":"2019-12-20"};
res.data.push(temp);
temp ={"company_name":"小米科技有限责任公司","phone1":"小米推送","web_adress":"www.mipush.com","card_num":"京ICP备10046444号-10","phone2":"2019-12-20"};
res.data.push(temp);
temp ={"company_name":"小米科技有限责任公司","phone1":"小米TV","web_adress":"www.mitvos.net","card_num":"京ICP备10046444号-5","phone2":"2019-12-20"};
res.data.push(temp);
temp ={"company_name":"小米科技有限责任公司","phone1":"小米网","web_adress":"www.xiaomi.cn","card_num":"京ICP备10046444号-1","phone2":"2019-12-20"};
res.data.push(temp);
temp ={"company_name":"小米科技有限责任公司","phone1":"米聊","web_adress":"www.miliao.com","card_num":"京ICP备10046444号-13","phone2":"2019-12-20"};
res.data.push(temp);
}
return System.getResult2(res, null);
}
else if (author == "上海熊猫互娱文化有限公司"){
var res = {};
res.total = 3;
res.data = [];
var temp = {"company_name":"上海熊猫互娱文化有限公司","phone1":"熊猫直播","web_adress":"www.panda.tv","card_num":"沪ICP备15043293号-1","phone2":"2018-12-26"};
res.data.push(temp);
temp = {"company_name":"上海熊猫互娱文化有限公司","phone1":"上海熊猫互娱-内部应用","web_adress":"www.pdsso.com","card_num":"沪ICP备15043293号-2","phone2":"2018-12-26"};
res.data.push(temp);
temp = {"company_name":"上海熊猫互娱文化有限公司","phone1":"上海熊猫互娱-内部服务类网站","web_adress":"www.xiongmaoxingyan.com","card_num":"沪ICP备15043293号-3","phone2":"2018-12-26"};
res.data.push(temp);
return System.getResult2(res, null);
}
else if (author == "网易(杭州)网络有限公司"){
var res = {};
res.total = 5;
res.data = [];
var temp = {"company_name":"网易(杭州)网络有限公司","phone1":"网易云分发","web_adress":"www.ntes53.com","card_num":"浙ICP备17041593号-1","phone2":"2019-10-30"};
res.data.push(temp);
temp = {"company_name":"网易(杭州)网络有限公司","phone1":"网易卡搭","web_adress":"www.163kada.com","card_num":"浙ICP备17041593号-4","phone2":"2019-10-30"};
res.data.push(temp);
temp = {"company_name":"网易(杭州)网络有限公司","phone1":"网易云加速","web_adress":"www.163jiasu.com","card_num":"浙ICP备17041593号-2","phone2":"2019-10-30"};
res.data.push(temp);
temp = {"company_name":"网易(杭州)网络有限公司","phone1":"网易卡搭编程","web_adress":"www.kada.com","card_num":"浙ICP备17041593号-5","phone2":"2019-10-30"};
res.data.push(temp);
temp = {"company_name":"网易(杭州)网络有限公司","phone1":"网易卡搭","web_adress":"www.kada163.com","card_num":"浙ICP备17041593号-3","phone2":"2019-10-30"};
res.data.push(temp);
return System.getResult2(res, null);
}
else if (author == "万达电影股份有限公司"){
var res = {};
res.total = 2;
res.data = [];
var temp = {"company_name":"万达电影股份有限公司","phone1":"万达电影网","web_adress":"www.wandafilm.com","card_num":"京ICP备14052128号-2","phone2":"2019-12-16"};
res.data.push(temp);
temp = {"company_name":"万达电影股份有限公司","phone1":"万达电影院线","web_adress":"www.wandacinemas.com","card_num":"京ICP备14052128号-1","phone2":"2019-12-16"};
res.data.push(temp);
return System.getResult2(res, null);
}
else{
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 (let index = 0; index < j.hits.hits.length; index++) {
const element = j.hits.hits[index];
if (element) {
res.data.push(element["_source"]);
}
}
}
return System.getResult2(res, null);
}
catch (e) {
return System.getResult2(null, "获取数据出错");
};
}
};
}
module.exports = EnterpriseService;
// var tesk = new EnterpriseService();
// var parm = {
// //author: "淘宝(中国)软件有限公司"
// author:"华为技术有限公司"
// };
// tesk.getQccBranches(parm).then(function (result) {
// console.log(result);
// // console.log(result.data.data[0]);
// }).catch(function (e) {
// console.log(e);
// });
const System = require("../../../system");
// const ServiceBase = require("../../sve.base");
const querystring = require('querystring');
class LicenseService {
constructor() {
this.licenseUrl = "http://43.247.184.92:8111/gsb/api/Licenses";
};
async getLicenses(obj) {//根据公司得到推荐要办的证书
var name = obj.name == null ? "" : obj.name;
if (name == "") {
return System.getResult2(null, "参数不能为空");
}
var params = {"name": name};
var rc = System.getObject("util.execClient");
//var data = querystring.stringify(params);
var rtn = null;
try {
rtn = await rc.execPost(params, this.licenseUrl);
var result = JSON.parse(rtn.stdout);
return System.getResult2(result, null);
} catch (e) {
return System.getResult2(null, "获取数据出错");
}
};
}
module.exports = LicenseService;
......@@ -4,8 +4,8 @@ class OSSClient{
constructor(){
this.client=new OSS({
endpoint: 'https://oss-cn-beijing.aliyuncs.com',
accessKeyId: 'LTAIyAUK8AD04P5S',
accessKeySecret: 'DHmRtFlw2Zr3KaRwUFeiu7FWATnmla'
accessKeyId: 'LTAI4GC5tSKvqsH2hMqj6pvd',
accessKeySecret: '3KV9nIwW8qkTGlrPmAe3HnR3fzM6r5'
});
this.client.useBucket('gsb-zc');
}
......
......@@ -6,6 +6,7 @@ var settings = require("../../config/settings");
class RestClient {
constructor() {
this.cmdGetPattern = "curl {-G} -k -d '{data}' {url}";
this.cmdZZGet = "curl -G -k -H 'Token:{ak}' -H 'Timespan:{ts}' -d '{data}' {url}";
this.cmdPostPattern = "curl -k -H 'Content-type: application/json' -d '{data}' '{url}'";
this.cmdPostPatternWithAK = "curl -k -H 'Content-type: application/json' -H 'AccessKey:{ak}' -d '{data}' {url}";
......@@ -16,6 +17,18 @@ class RestClient {
this.cmdPostPattern5 = "curl -k --data '{data}' {url}";
}
async execGetZZ(subData, url, acck, Timespan) {
let cmd = this.FetchGetZZCmd(subData, url, acck, Timespan);
var result = await this.exec(cmd);
return result;
}
FetchGetZZCmd(subData, url, acck, Timespan) {
var data = querystring.stringify(subData);
var cmd = this.cmdZZGet.replace(/\{data\}/g,
data).replace(/\{url\}/g, url).replace(/\{ak\}/g, acck).replace(/\{ts\}/g, Timespan);
return cmd;
}
FetchGetCmd(subData, url) {
var cmd = this.cmdGetPattern.replace(/\{\-G\}/g, "-G").replace(
/\{data\}/g, subData).replace(/\{url\}/g, url);
......
......@@ -10,8 +10,8 @@ var settings={
user: "write",
password: "write",
config: {
host: '192.168.18.237',
port: 3306,
host: '43.247.184.35',
port: 8899,
dialect: 'mysql',
operatorsAliases: false,
pool: {
......
......@@ -48,8 +48,8 @@ module.exports = function (app) {
params.push(gname);
params.push(methodName);
params.push(req.query);
params.push(req.body);
params.push(req.query);
params.push(req);
var p = null;
var invokeObj = system.getObject("api." + classPath);
......
......@@ -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