Commit dc16db53 by 庄冰

百度商标

parent e9fc92d6
......@@ -130,6 +130,16 @@ class Need extends APIBase {
case "getymicpProduce"://获取易名的icp产品信息
opResult = await this.centerorderSve.getymicpProduce(pobj);
break;
//百度商标接入
case "submitTmNeed"://提交需求
opResult = await this.utilsNeedSve.submitTmNeed(pobj, pobj.actionBody);
break;
case "tmFeedbackSubmit"://商标用户反馈
opResult = await this.utilsNeedSve.tmFeedbackSubmit(pobj);
break;
case "tmStatusNotify"://商标状态通知
opResult = await this.utilsNeedSve.tmStatusNotify(pobj);
break;
default:
opResult = system.getResult(null, "action_type参数错误");
break;
......
var APIBase = require("../../api.base");
var system = require("../../../system");
var settings = require("../../../../config/settings");
const uuidv4 = require('uuid/v4');
/**
* 商标需求
* 庄冰 2021.03.17
*/
class Consultation extends APIBase {
constructor() {
super();
this.gatewaypushlogSve = system.getObject("service.common.gatewaypushlogSve");
}
getUUID() {
var uuid = uuidv4();
var u = uuid.replace(/\-/g, "");
return u;
}
getResultSuccess(requestId) {
return {
"status": 0,
"msg": "success",
"data":null,
"requestId": requestId
};
}
getResultFail(errmsg) {
var self = this;
return {
"status":-1,
"msg": errmsg,
"requestId": self.getUUID(),
"data":null,
"bizmsg":"empty"
};
}
//需求提交
async submit(pobj,obj,req) {
var self = this;
if(!pobj.appInfo || !pobj.appInfo.uapp_key || !pobj.appInfo.uapp_secret){
return self.getResultFail("未知应用或应用未启用");
}
if (!pobj.intentionBizId) {
return self.getResultFail("intentionBizId不能为空");
}
if (!pobj.phone) {
return self.getResultFail("phone不能为空");
}
if (!pobj.consultType) {
return self.getResultFail("consultType不能为空");
}
pobj.type = pobj.consultType;
pobj.mobile = pobj.phone;
pobj.action_type = "submitTmNeed";
var param = {
requestId: req.requestId || self.getUUID(),
requestUrl: pobj.appInfo.app_code+"/tm/consultation/submit",
requestjson: JSON.stringify(pobj),//请求地址
pushUrl: "/action/intentionapi/springBoard",//调用地址
pushActionType: "submitTmNeed",//调用参数
pushtimes: 0,//推送次数
pushStatus: "wts",//推送状态
}
await self.gatewaypushlogSve.create(param);
return self.getResultSuccess(param.requestId);
}
}
module.exports = Consultation;
\ No newline at end of file
var APIBase = require("../../api.base");
var system = require("../../../system");
var settings = require("../../../../config/settings");
const uuidv4 = require('uuid/v4');
/**
* 商标通知接口
* 庄冰 2021.03.17
*/
class Feedback extends APIBase {
constructor() {
super();
this.gatewaypushlogSve = system.getObject("service.common.gatewaypushlogSve");
}
getUUID() {
var uuid = uuidv4();
var u = uuid.replace(/\-/g, "");
return u;
}
getResultSuccess(requestId) {
return {
"status": 0,
"msg": "success",
"data":null,
"requestId": requestId
};
}
getResultFail(errmsg) {
var self = this;
return {
"status":-1,
"msg": errmsg,
"requestId": self.getUUID(),
"data":null,
"bizmsg":"empty"
};
}
//需求反馈
async submit(pobj,obj,req) {
var self = this;
if(!pobj.appInfo || !pobj.appInfo.uapp_key || !pobj.appInfo.uapp_secret){
return self.getResultFail("未知应用或应用未启用");
}
if (!pobj.intentionBizId) {
return self.getResultFail("intentionBizId不能为空");
}
if (!pobj.description) {
return self.getResultFail("description不能为空");
}
pobj.action_type = "tmFeedbackSubmit";
var param = {
requestId: req.requestId || self.getUUID(),
requestUrl: pobj.appInfo.app_code+"/tm/feedback/submit",
requestjson: JSON.stringify(pobj),//请求地址
pushUrl: "/action/intentionapi/springBoard",//调用地址
pushActionType: "tmFeedbackSubmit",//调用参数
pushtimes: 0,//推送次数
pushStatus: "wts",//推送状态
}
await self.gatewaypushlogSve.create(param);
return self.getResultSuccess(param.requestId);
}
}
module.exports = Feedback;
\ No newline at end of file
var APIBase = require("../../api.base");
var system = require("../../../system");
var settings = require("../../../../config/settings");
const uuidv4 = require('uuid/v4');
/**
* tm通知接口
* 庄冰 2021.03.18
*/
class Order extends APIBase {
constructor() {
super();
this.gatewaypushlogSve = system.getObject("service.common.gatewaypushlogSve");
}
getUUID() {
var uuid = uuidv4();
var u = uuid.replace(/\-/g, "");
return u;
}
getResultSuccess(requestId) {
return {
"status": 0,
"msg": "success",
"data":null,
"requestId": requestId
};
}
getResultFail(errmsg) {
var self = this;
return {
"status":-1,
"msg": errmsg,
"requestId": self.getUUID(),
"data":null,
"bizmsg":"empty"
};
}
//状态变更
async notify(pobj,obj,req) {
var self = this;
if(!pobj.appInfo || !pobj.appInfo.uapp_key || !pobj.appInfo.uapp_secret){
return self.getResultFail("未知应用或应用未启用");
}
if (!pobj.bizId) {
return self.getResultFail("bizId不能为空");
}
if (!pobj.status) {
return self.getResultFail("status不能为空");
}
pobj.action_type = "tmStatusNotify";
var param = {
requestId: req.requestId || self.getUUID(),
requestUrl: pobj.appInfo.app_code+"/tm/status/notify",
requestjson: JSON.stringify(pobj),//请求地址
pushUrl: "/action/intentionapi/springBoard",//调用地址
pushActionType: "tmStatusNotify",//调用参数
pushtimes: 0,//推送次数
pushStatus: "wts",//推送状态
}
await self.gatewaypushlogSve.create(param);
return self.getResultSuccess(param.requestId);
}
}
module.exports = Order;
\ No newline at end of file
var APIBase = require("../../api.base");
var system = require("../../../system");
var settings = require("../../../../config/settings");
const uuidv4 = require('uuid/v4');
/**
* 商标方案信息(接收fqboss推送的商标方案信息,并推送至渠道)
* 庄冰 2021.03.18
*/
class Tmcase extends APIBase {
constructor() {
super();
this.utilsNeedSve = system.getObject("service.utilsSve.utilsNeedSve");
this.baseUrl = settings.centerOrderUrl()+"/notifyaction/internalCallsNotify/"
}
async updateTmStatus(pobj, qobj, req) {
var reqUrl = this.baseUrl + "updateTmStatus";
var result = await this.utilsNeedSve.restPostUrl(pobj);
return result;
}
//接收辅助、担保商标注册信息
async nbtzreceiveAssistTmData(pobj, qobj, req) {
var reqUrl = this.baseUrl + "nbtzreceiveAssistTmData";
var result = await this.utilsNeedSve.restPostUrl(pobj);
return result;
}
//接收辅助、担保商标注册修改信息
async nbtzreceiveEditAssistTmData(pobj, qobj, req) {
var reqUrl = this.baseUrl + "nbtzreceiveEditAssistTmData";
var result = await this.utilsNeedSve.restPostUrl(pobj);
return result;
}
}
module.exports = Tmcase;
\ No newline at end of file
......@@ -123,6 +123,85 @@ class UtilsNeedService extends AppServiceBase {
return result;
}
/**
* 提交商标需求,对接百度云商标
* @param {*} pobj
* @param {*} actionBody
*/
async submitTmNeed(pobj, actionBody) {
if(!actionBody.type && actionBody.consultType)
actionBody.type = actionBody.consultType
if (!actionBody.intentionBizId) {
return system.getResult(null, "actionBody.intentionBizId can not be empty,100380");
}
var sobj = pobj;
sobj.actionType = "getProductTypeInfo";
var url = settings.centerAppUrl() + "action/opProduct/springBoard";
var rtn = await this.execClient.execPost(sobj, url);
if (!rtn || !rtn.stdout) {
return system.getResultFail(-5015, "需求类型查询失败");
}
var data = JSON.parse(rtn.stdout);
if (data.status != 0) {
return system.getResultFail(-5015, "需求类型查询失败");
}
pobj.actionBody.type_code = data.data.type_code;
pobj.actionBody.type_name = data.data.type_name;
pobj.actionBody.channel_type_code = data.data.channel_type_code;
pobj.actionBody.channel_type_name = data.data.channel_type_name;
pobj.actionBody.type = pobj.actionBody.channel_type_code;
pobj.actionBody.phone = pobj.actionBody.phone || pobj.actionBody.mobile;
pobj.actionBody.appName = pobj.appInfo.app_name;
pobj.actionBody.idempotentId = pobj.actionBody.intentionBizId;
pobj.actionBody.idempotentSourceName = pobj.appInfo.app_name;
if (pobj.actionBody.channel_type_code == 5) {
pobj.actionBody.type = "ali.icp";
pobj.actionBody.idempotentSource = "icp_ali";
} else if (pobj.actionBody.channel_type_code == 7) {
pobj.actionBody.type = "ali.edi";
pobj.actionBody.idempotentSource = "edi_ali";
} else if (pobj.actionBody.channel_type_code == "tmjy") {
pobj.actionBody.type = "ali.tmd";
pobj.actionBody.idempotentSource = "tmd_ali";
}else if (pobj.actionBody.channel_type_code == 1) {
pobj.actionBody.type = "ali.tmd";
pobj.actionBody.idempotentSource = "tmd_ali";
}else if (pobj.actionBody.channel_type_code == 2) {
pobj.actionBody.type = "ali.tm";
pobj.actionBody.idempotentSource = "tm_ali";
}else if (pobj.actionBody.channel_type_code == 'esp.companyreg'){
pobj.actionBody.type = "ali.ic";
pobj.actionBody.idempotentSource = "ic_ali";
}else if (pobj.actionBody.channel_type_code == 'esp.companyreg_cloud'){
pobj.actionBody.type = "ali.ic";
pobj.actionBody.idempotentSource = "ic_ali";
}
if(pobj.appInfo.uapp_id=='44'){//百度云
if (pobj.actionBody.channel_type_code == 1) {
pobj.actionBody.type = "baidu.tmd";
pobj.actionBody.idempotentSource = "tmd_baidu";
}else if (pobj.actionBody.channel_type_code == 2) {
pobj.actionBody.type = "baidu.tm";
pobj.actionBody.idempotentSource = "tm_baidu";
}
}
if (pobj.actionBody.description && pobj.actionBody.description.indexOf("备#") < 0) {
pobj.actionBody.level = "A";
} else {
pobj.actionBody.level = "C"
}
if (pobj.actionBody.phone == "17319425791") {
pobj.actionBody.level = "F";
}
pobj.actionType = "submitNeed";
var reqUrl = this.centerOrderUrl + "action/need/springBoard";
var result = await this.restPostUrl(pobj, reqUrl);
if (result.status == 0) {
this.utilsPushSve.business2Fq(pobj, "pushNeedTMBusiness");
}
return result;
}
//调用center-order icp需求反馈
async reqCenterOrderQcApi(pobj, reqUrl) {
......@@ -157,6 +236,47 @@ class UtilsNeedService extends AppServiceBase {
return data;
}
//商标需求反馈
async tmFeedbackSubmit(pobj) {
var url = this.centerOrderUrl + "action/qcapi/springBoard";
var self = this;
pobj.actionType = "receiveIcpFeedback";
if (pobj.actionBody && pobj.actionBody.intentionStatus) {
pobj.intentionStatus = pobj.actionBody.intentionStatus;
}
var rtn = await this.execClient.execPost(pobj, url);
var data = JSON.parse(rtn.stdout);
if (data.data && (data.data.channelTypeCode == 1||data.data.channelTypeCode == 2)) {//商标
pobj.actionBody.status = "888"
this.execPostUrl({
"actionProcess": "AliTm",
"appCode": "100099",
"sign": await this.getFQbossSign(pobj.actionBody),
actionBody: pobj.actionBody
}, settings.fqbossTmUrl())
self.utilsPushSve.business2Fq(pobj, "pushTMFeedback");
}
return data;
}
//商标状态通知
async tmStatusNotify(pobj) {
var self = this;
// 引用属性,channel依赖bizId order依赖intentionBizId
pobj.intentionBizId = pobj.bizId
var sobj = {
"actionType": "getItemByChannelSolutionNo",
"actionBody": pobj
}
var result = this.getItemByChannelSolutionNo(sobj,sobj.actionBody);
if (result.status == 0) {
let pushres = await this.execPostUrl({ "actionProcess": "AliTm", "appCode": "100099", "sign": await this.getFQbossSign(pobj), actionBody: pobj },settings.fqbossTmUrl())
console.log("推送fqboos----->",pushres)
return this.getResult(result.requestId, pushres.message);
}
return this.getResult(result.requestId)
}
/**
* 提交需求-----del
* @param {*} pobj
......
......@@ -76,6 +76,28 @@ class UtilsPushService extends AppServiceBase {
return system.getResult(null, "push Fail,interface_info data is empty");
}
async business2Fq(pobj, opType) {//供业务调用,在代码中调用,不在db中做配置进行调用
pobj.actionType = "getAppInterface";
var reqUrl = settings.centerAppUrl() + "action/opProduct/springBoard";
var productItemInterfaceResult = await this.restPostUrl(pobj, reqUrl);
pobj.interface_info = productItemInterfaceResult.data;
//日志记录
this.logCtl.info({
appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "",
appkey: pobj.appInfo ? pobj.appInfo.uapp_key || "" : "",
requestId: pobj.requestId || "",
op: "service/impl/utilsSve/utilsPushSve.js/service/app.base.js/business2Fq",
content: JSON.stringify(pobj),
resultInfo: productItemInterfaceResult.data ? JSON.stringify(productItemInterfaceResult.data) : "接口数据为空",
optitle: pobj.opType + "推送蜂擎获取的接口信息->business2Fq",
});
if (pobj.interface_info) {
await this.pushBusInfo(pobj, opType, 1);
return system.getResultSuccess();
}
return system.getResult(null, "push Fail,interface_info data is empty");
}
async pushBusInfo(pobj, opType, isDelProductInfo) {//推送业务总入口,不在db中做配置进行调用
console.log(JSON.stringify(pobj), ".......pushBusInfo........................."+opType);
var interface_list = pobj.interface_info ? pobj.interface_info : pobj.actionBody.product_info.interface_info;
......
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