Commit 00aec9d2 by 王勇飞

gyq

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