Commit 6b4ac18e by 高宇强

gyq

parent cf71f2c1
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:"paCountByApplicantName",
actionBody:{applicant_name:"上海华虹宏力半导体制造有限公司"}
};
tesk.springBoard(parm).then(function(result){
console.log(result);
// console.log(result.data.rows[0]);
}).catch(function(e){
console.log(e);
});
\ No newline at end of file
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,421 @@ 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);
}
};
/*查询某一个公司名下有多少条专利(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 rtn = 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_date",
"gr_date",
"gr_no",
"pub_date",
"pub_no",
"agency_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);
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, "获取数据出错");
}
};
/*查询某一个公司名下有多少条专利(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_date",
"gr_date",
"gr_no",
"pub_date",
"pub_no",
"agency_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);
return System.getResult2(j.hits, null);
} catch (e) {
return rtn = 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_name",
"pub_status_now",
"filing_no",
"filing_date",
"gr_date",
"gr_no",
"pub_date",
"pub_no",
"agency_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);
return System.getResult2(j.hits, null);
} catch (e) {
return rtn = 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 rtn = {
status: 0,
msg: "操作成功",
data: j.hits.total
};
}
catch (e) {
return rtn = {
status: -1,
msg: "操作失败",
data: 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",
"publish_time",
"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);
return rtn = {
status: 0,
msg: "操作成功",
data: j.hits
};
}
catch (e) {
return rtn = {
status: -1,
msg: "操作失败",
data: 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);
return rtn = {
status: 0,
msg: "操作成功",
data: j.hits
};
}
catch (e) {
return rtn = {
status: -1,
msg: "操作失败",
data: 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 rtn = {
status: 0,
msg: "操作成功",
data: j.hits.total
};
}
catch (e) {
return rtn = {
status: -1,
msg: "操作失败",
data: 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" ? 20 : 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);
return rtn = {
status: 0,
msg: "操作成功",
data: j.hits
};
}
catch (e) {
return rtn = {
status: -1,
msg: "操作失败",
data: 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);
return rtn = {
status: 0,
msg: "操作成功",
data: j.hits
};
}
catch (e) {
return rtn = {
status: -1,
msg: "操作失败",
data: null
};
};
};
}
module.exports = CopyRightSearchApi;
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment