Commit 00aec9d2 by 王勇飞

gyq

parent b6020841
...@@ -1430,17 +1430,17 @@ class PatentycCtl extends CtlBase { ...@@ -1430,17 +1430,17 @@ class PatentycCtl extends CtlBase {
} }
module.exports = PatentycCtl; module.exports = PatentycCtl;
var task = new PatentycCtl(); // var task = new PatentycCtl();
var obj = { // var obj = {
"company1": "华为技术有限公司", // "company1": "华为技术有限公司",
"company2": "中兴通讯股份有限公司", // "company2": "中兴通讯股份有限公司",
"keyword1":"用户设备,通信领域,通信技术,设备发送,指示信息,通信系统,通信方法,设备接收,对应关系,基站发送,终端发送,用户体验,配置信息,请求消息,数据传输方法,用户终端,网络侧,移动终端,通信设备,传输方法", // "keyword1":"用户设备,通信领域,通信技术,设备发送,指示信息,通信系统,通信方法,设备接收,对应关系,基站发送,终端发送,用户体验,配置信息,请求消息,数据传输方法,用户终端,网络侧,移动终端,通信设备,传输方法",
"keyword2":"用户体验,移动终端,用户设备,相关技术,网络侧,终端发送,用户终端,配置信息,指示信息,请求消息,对应关系,传输方法,基站发送,通信系统,数据传输方法,通信领域,通信技术,设备发送,响应消息,发送方法" // "keyword2":"用户体验,移动终端,用户设备,相关技术,网络侧,终端发送,用户终端,配置信息,指示信息,请求消息,对应关系,传输方法,基站发送,通信系统,数据传输方法,通信领域,通信技术,设备发送,响应消息,发送方法"
}; // };
task.competitionAnalysisContex({},obj,{}).then(d=>{ // task.competitionAnalysisContex({},obj,{}).then(d=>{
console.log(JSON.stringify(d)); // console.log(JSON.stringify(d));
//console.log(d[0].analyse); // //console.log(d[0].analyse);
}) // })
// (async ()=>{ // (async ()=>{
// var task = new PatentycCtl(); // var task = new PatentycCtl();
......
...@@ -8794,12 +8794,45 @@ class PatentycService extends ServiceBase { ...@@ -8794,12 +8794,45 @@ class PatentycService extends ServiceBase {
async competitionAnalysisContex(obj) {//竞争分析详细信息 async competitionAnalysisContex(obj) {//竞争分析详细信息
try { try {
//得到两个公司的专利总量
var total1 = 0;
var total2 = 0;
var totalList = [
{
"term": {
"applicant_name.raw": obj.company1
}
}
];
var tms1 = await this.GsbByChinaAggApi.PubstatusAggs(totalList);//获取查询结果
if (tms1) {
if (tms1.status == 0) {
total1 = tms1.data.total;
}
}
totalList = [];
totalList = [
{
"term": {
"applicant_name.raw": obj.company2
}
}
];
tms1 = await this.GsbByChinaAggApi.PubstatusAggs(totalList);//获取查询结果
if (tms1) {
if (tms1.status == 0) {
total2 = tms1.data.total;
}
}
//比较公司下的关键词,得到相同的关键词 //比较公司下的关键词,得到相同的关键词
var arr1 = obj.keyword1.split(","); var arr1 = obj.keyword1.split(",");
var arr2 = obj.keyword2.split(","); var arr2 = obj.keyword2.split(",");
var arr3 = this.getArrEqual(arr1, arr2); var arr3 = this.getArrEqual(arr1, arr2);
if (arr3.length > 0) { if (arr3.length > 0) {
var rtnlist = []; var rtnlist = {
"arrt1":[],
"arrt2":[]
};
var max = 5; var max = 5;
if (arr3.length < 5) { if (arr3.length < 5) {
max = arr3.length; max = arr3.length;
...@@ -8807,24 +8840,23 @@ class PatentycService extends ServiceBase { ...@@ -8807,24 +8840,23 @@ class PatentycService extends ServiceBase {
for (var i in arr1) { for (var i in arr1) {
if (arr3.indexOf(arr1[i]) > -1) { if (arr3.indexOf(arr1[i]) > -1) {
var temp = { var temp1 = {
"keyword": arr1[i],//关键词 "keyword": arr1[i],//关键词
"company1": {//左边公司的信息 "patentnum": 0,//关键词专利总量
"cpmpanyname": obj.company1,//公司名称 "totalnum": total1,//公司专利总量
"patentnum": 0,//专利总量
"patentquality": 0,//专利质量得分 "patentquality": 0,//专利质量得分
"patentrate": "0%",//专利成长率 "patentrate": "0%",//专利成长率
"totalscore": 0,//总评分 "totalscore": 0,//总评分
"iconscore": 0//icon上的值 "iconscore": 0//icon上的值
}, };
"company2": {//右边公司的信息 var temp2 = {//右边公司的信息
"cpmpanyname": obj.company2,//公司名称 "keyword": arr1[i],//关键词
"patentnum": 0,//专利总量 "patentnum": 0,//关键词专利总量
"totalnum": total2,//公司专利总量
"patentquality": 0,//专利质量得分 "patentquality": 0,//专利质量得分
"patentrate": "0%",//专利成长率 "patentrate": "0%",//专利成长率
"totalscore": 0,//总评分 "totalscore": 0,//总评分
"iconscore": 0//icon上的值 "iconscore": 0//icon上的值
}
}; };
var searchList = [ var searchList = [
{ {
...@@ -8853,18 +8885,18 @@ class PatentycService extends ServiceBase { ...@@ -8853,18 +8885,18 @@ class PatentycService extends ServiceBase {
} }
if (total && cbuckets) { if (total && cbuckets) {
temp.company1.patentnum = total; temp1.patentnum = total;
var youxiao = 0; var youxiao = 0;
cbuckets.forEach(element => { cbuckets.forEach(element => {
if (element.key == "有效") { if (element.key == "有效") {
youxiao = element.doc_count; youxiao = element.doc_count;
} }
}); });
temp.company1.patentquality = parseInt((youxiao / total) * 100); temp1.patentquality = parseInt((youxiao / total) * 100);
var rpatentrate = this.RandomNumBoth(60, 95); var rpatentrate = this.RandomNumBoth(60, 95);
temp.company1.patentrate = rpatentrate.toString() + "%"; temp1.patentrate = rpatentrate.toString() + "%";
temp.company1.totalscore = parseInt(total / 100) + temp.company1.patentquality + rpatentrate; temp1.totalscore = parseInt((total / total1 + temp1.patentquality + rpatentrate)/3);
temp.company1.iconscore = parseInt(temp.company1.totalscore / 10); temp1.iconscore = (temp1.totalscore / 10).toFixed(1);
} }
searchList = []; searchList = [];
...@@ -8894,20 +8926,21 @@ class PatentycService extends ServiceBase { ...@@ -8894,20 +8926,21 @@ class PatentycService extends ServiceBase {
} }
if (total && cbuckets) { if (total && cbuckets) {
temp.company2.patentnum = total; temp2.patentnum = total;
var youxiao = 0; var youxiao = 0;
cbuckets.forEach(element => { cbuckets.forEach(element => {
if (element.key == "有效") { if (element.key == "有效") {
youxiao = element.doc_count; youxiao = element.doc_count;
} }
}); });
temp.company2.patentquality = parseInt((youxiao / total) * 100); temp2.patentquality = parseInt((youxiao / total) * 100);
var rpatentrate = this.RandomNumBoth(60, 95); var rpatentrate = this.RandomNumBoth(60, 95);
temp.company2.patentrate = rpatentrate.toString() + "%"; temp2.patentrate = rpatentrate.toString() + "%";
temp.company2.totalscore = parseInt(total / 100) + temp.company2.patentquality + rpatentrate; temp2.totalscore = parseInt((total / total2 + temp2.patentquality + rpatentrate)/3);
temp.company2.iconscore = parseInt(temp.company2.totalscore / 10); temp2.iconscore = (temp2.totalscore / 10).toFixed(1);
} }
rtnlist.push(temp); rtnlist.arrt1.push(temp1)
rtnlist.arrt2.push(temp2);
max--; max--;
} }
if (max <= 0) { if (max <= 0) {
...@@ -8917,7 +8950,7 @@ class PatentycService extends ServiceBase { ...@@ -8917,7 +8950,7 @@ class PatentycService extends ServiceBase {
return rtnlist; return rtnlist;
} }
else { else {
return []; return {};
} }
// return [ // return [
// { // {
...@@ -9020,7 +9053,7 @@ class PatentycService extends ServiceBase { ...@@ -9020,7 +9053,7 @@ class PatentycService extends ServiceBase {
} }
catch (error) { catch (error) {
return []; return {};
} }
} }
......
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