Commit bd2b7795 by 蒋勇

Merge branch 'center-channel' of gitlab.gongsibao.com:jiangyong/zhichan into center-channel

parents c97e2e81 3de5a10d
var APIBase = require("../../api.base");
var system = require("../../../system");
var settings = require("../../../../config/settings");
class QcAPI extends APIBase {
constructor() {
super();
......@@ -9,12 +10,13 @@ class QcAPI extends APIBase {
this.ncSve = system.getObject("service.common.ncSve");
this.rtSve = system.getObject("service.common.rtSve");
}
/**
* 接口跳转-POST请求
* action_process 执行的流程
* action_type 执行的类型
* action_body 执行的参数
*/
* 接口跳转-POST请求
* action_process 执行的流程
* action_type 执行的类型
* action_body 执行的参数
*/
async springBoard(pobj, qobj, req) {
if (!pobj.actionType) {
return system.getResult(null, "actionType参数不能为空");
......@@ -22,6 +24,7 @@ class QcAPI extends APIBase {
var result = await this.opActionProcess(pobj, pobj.actionType, req);
return result;
}
async opActionProcess(pobj, action_type, req) {
var opResult = null;
switch (action_type) {
......@@ -55,7 +58,7 @@ class QcAPI extends APIBase {
case "closeOrderDelivery"://交付商关闭交付单
opResult = await this.qcCenterOrderSve.closeOrderDelivery(pobj);
break;
// 2021-3-23 laolan 易名退款
case "eNameCloseOrder":
opResult = await this.baseOrderSve.eNameCloseOrder(pobj);
......@@ -71,7 +74,7 @@ class QcAPI extends APIBase {
case "ncSubmitSolution"://提交方案(网文)2020-11-11
opResult = await this.ncSve.ncSubmitSolution(pobj);
break;
// --------- 广电 ---------
......@@ -85,7 +88,7 @@ class QcAPI extends APIBase {
opResult = await this.rtSve.rtSubmitSolution(pobj);
break;
// --------- 推送icp信息至渠道和作方 zhuangbing-20201116--------
// --------- 推送icp信息至渠道和作方 zhuangbing-20201116--------
case "pushIcpSolution2Channel"://推送ICP方案至渠道(百度)
opResult = await this.baseOrderSve.pushIcpSolution2Channel(pobj);
break;
......@@ -97,4 +100,5 @@ class QcAPI extends APIBase {
}
}
module.exports = QcAPI;
\ No newline at end of file
......@@ -21,44 +21,21 @@ class Order extends APIBase {
if (!pobj.orderNo) {
return regCfg.getResultFail("orderNo不能为空");
}
// var i = 0;
// var orderLength = pobj.subOrderList.lenght;
// for (i = 0; i <= orderLength; i++) {
// if (!pobj.subOrderList[i].orderNo) {
// return regCfg.getResultFail("orderNo不能为空");
// }
// if (pobj.isDirectBuy == 0 && !pobj.subOrderList[i].bizId) {
// return regCfg.getResultFail("非直接下单bizId不能为空");
// }
// if (pobj.isDirectBuy == 1 && !pobj.subOrderList[i].phone) {
// return regCfg.getResultFail("直接下单phone不能为空");
// }
// if (pobj.isDirectBuy == 1 && !pobj.subOrderList[i].consultType) {
// return regCfg.getResultFail("直接下单consultType不能为空");
// }
// // if (pobj.subOrderList[i].area) {
// // pobj.subOrderList[i].area = regCfg.baiduArea[pobj.subOrderList[i].area]
// // }
// if (!pobj.subOrderList[i].area) {
// return regCfg.getResultFail("area参数错误");
// }
// }
if (!pobj.orderNo) {
return regCfg.getResultFail("orderNo不能为空");
}
if (pobj.isDirectBuy==0 && !pobj.bizId) {
if (pobj.isDirectBuy == 0 && !pobj.bizId) {
return regCfg.getResultFail("非直接下单bizId不能为空");
}
if (pobj.isDirectBuy==1 && !pobj.phone) {
if (pobj.isDirectBuy == 1 && !pobj.phone) {
return regCfg.getResultFail("直接下单phone不能为空");
}
if (pobj.isDirectBuy==1 && !pobj.consultType) {
if (pobj.isDirectBuy == 1 && !pobj.consultType) {
return regCfg.getResultFail("直接下单consultType不能为空");
}
if (pobj.area) {
pobj.area = regCfg.baiduArea[pobj.area]
}
}
pobj.status = 1;
pobj.action_type = "regOrderStatus";
......@@ -98,4 +75,5 @@ class Order extends APIBase {
}
}
module.exports = Order;
\ No newline at end of file
//百度配置
const uuidv4 = require('uuid/v4');
var regCfg = {
var regCfg = {
//工商注册城市对照表
baiduArea : {
"310100":"上海",
"441900":"东莞",
"440600":"佛山",
"110100":"北京",
"320100":"南京",
"360100":"南昌",
"320600":"南通",
"331000":"台州",
"340100":"合肥",
"330400":"嘉兴",
"210200":"大连",
"120100":"天津",
"140100":"太原",
"330200":"宁波",
"320400":"常州",
"440100":"广州",
"320300":"徐州",
"510100":"成都",
"321000":"扬州",
"320200":"无锡",
"530100":"昆明",
"330100":"杭州",
"420100":"武汉",
"210100":"沈阳",
"370100":"济南",
"440300":"深圳",
"330300":"温州",
"370600":"烟台",
"350100":"福州",
"330600":"绍兴",
"320500":"苏州",
"610100":"西安",
"520100":"贵阳",
"410100":"郑州",
"500100":"重庆",
"330700":"金华",
"220100":"长春",
"430100":"长沙",
"370200":"青岛",
"410200":"开封",
"230100":"哈尔滨",
"130100":"石家庄",
"350200":"厦门",
"360400":"九江",
"410300":"洛阳",
"411000":"许昌",
"411600":"周口",
"411300":"南阳",
"420500":"宜昌",
"420600":"襄阳",
"430600":"岳阳",
"430700":"常德",
"440700":"江门",
"440400":"珠海",
"440900":"茂名",
"441300":"惠州",
"442000":"中山",
"450100":"南宁",
"460100":"海口",
"460200":"三亚",
"510700":"绵阳",
"540100":"拉萨",
"130600":"保定",
"130200":"唐山",
"140200":"大同",
"1501":"呼和浩特",
"341200":"阜阳"
baiduArea: {
"310100": "上海",
"441900": "东莞",
"440600": "佛山",
"110100": "北京",
"320100": "南京",
"360100": "南昌",
"320600": "南通",
"331000": "台州",
"340100": "合肥",
"330400": "嘉兴",
"210200": "大连",
"120100": "天津",
"140100": "太原",
"330200": "宁波",
"320400": "常州",
"440100": "广州",
"320300": "徐州",
"510100": "成都",
"321000": "扬州",
"320200": "无锡",
"530100": "昆明",
"330100": "杭州",
"420100": "武汉",
"210100": "沈阳",
"370100": "济南",
"440300": "深圳",
"330300": "温州",
"370600": "烟台",
"350100": "福州",
"330600": "绍兴",
"320500": "苏州",
"610100": "西安",
"520100": "贵阳",
"410100": "郑州",
"500100": "重庆",
"330700": "金华",
"220100": "长春",
"430100": "长沙",
"370200": "青岛",
"410200": "开封",
"230100": "哈尔滨",
"130100": "石家庄",
"350200": "厦门",
"360400": "九江",
"410300": "洛阳",
"411000": "许昌",
"411600": "周口",
"411300": "南阳",
"420500": "宜昌",
"420600": "襄阳",
"430600": "岳阳",
"430700": "常德",
"440700": "江门",
"440400": "珠海",
"440900": "茂名",
"441300": "惠州",
"442000": "中山",
"450100": "南宁",
"460100": "海口",
"460200": "三亚",
"510700": "绵阳",
"540100": "拉萨",
"130600": "保定",
"130200": "唐山",
"140200": "大同",
"1501": "呼和浩特",
"341200": "阜阳",
"CPF009": "北京朝阳区",
"CPF010": "北京海淀区",
"CPF011": "北京丰台区",
"CPF012": "北京东城区",
"CPF013": "北京西城区",
"CPF014": "北京昌平区",
"CPF015": "北京通州区",
"CPF016": "北京怀柔区",
"CPF017": "北京石景山区",
"CPF018": "北京平谷区",
"CPF019": "北京顺义区",
"CPF020": "北京房山区",
"CPF021": "北京门头沟区",
"CPF022": "北京密云区",
"CPF023": "北京大兴区",
"CP0024": "北京顺义园区",
"CP0025": "北京房山园区"
},
baiduAreaCode : {
"上海": "310100",
"东莞": "441900",
"佛山": "440600",
"北京": "110100",
"南京": "320100",
"南昌": "360100",
"南通": "320600",
"台州": "331000",
"合肥": "340100",
"嘉兴": "330400",
"大连": "210200",
"天津": "120100",
"太原": "140100",
"宁波": "330200",
"常州": "320400",
"广州": "440100",
"徐州": "320300",
"成都": "510100",
"扬州": "321000",
"无锡": "320200",
"昆明": "530100",
"杭州": "330100",
"武汉": "420100",
"沈阳": "210100",
"济南": "370100",
"深圳": "440300",
"温州": "330300",
"烟台": "370600",
"福州": "350100",
"绍兴": "330600",
"苏州": "320500",
"西安": "610100",
"贵阳": "520100",
"郑州": "410100",
"重庆": "500100",
"金华": "330700",
"长春": "220100",
"长沙": "430100",
"青岛": "370200",
baiduAreaCode: {
"上海": "310100",
"东莞": "441900",
"佛山": "440600",
"北京": "110100",
"南京": "320100",
"南昌": "360100",
"南通": "320600",
"台州": "331000",
"合肥": "340100",
"嘉兴": "330400",
"大连": "210200",
"天津": "120100",
"太原": "140100",
"宁波": "330200",
"常州": "320400",
"广州": "440100",
"徐州": "320300",
"成都": "510100",
"扬州": "321000",
"无锡": "320200",
"昆明": "530100",
"杭州": "330100",
"武汉": "420100",
"沈阳": "210100",
"济南": "370100",
"深圳": "440300",
"温州": "330300",
"烟台": "370600",
"福州": "350100",
"绍兴": "330600",
"苏州": "320500",
"西安": "610100",
"贵阳": "520100",
"郑州": "410100",
"重庆": "500100",
"金华": "330700",
"长春": "220100",
"长沙": "430100",
"青岛": "370200",
"开封": "410200",
"哈尔滨":"230100",
"石家庄":"130100",
"厦门":"350200",
"九江":"360400",
"洛阳":"410300",
"许昌":"411000",
"周口":"411600",
"南阳":"411300",
"宜昌":"420500",
"襄阳":"420600",
"岳阳":"430600",
"常德":"430700",
"江门":"440700",
"珠海":"440400",
"茂名":"440900",
"惠州":"441300",
"中山":"442000",
"南宁":"450100",
"海口":"460100",
"三亚":"460200",
"绵阳":"510700",
"拉萨":"540100",
"保定":"130600",
"唐山":"130200",
"大同":"140200",
"呼和浩特":"150100",
"阜阳":"341200"
},
channelTypeCode : {
"GSREG" : "baidu.gsreg",
"KZFW" : "baidu.kzfw",
"GSCHANGS" : "baidu.gsbg",
"GSNB" : "baidu.gsnb",
"SKSQ" : "baidu.sksq",
"SWBD" : "baidu.swbd"
},
"哈尔滨": "230100",
"石家庄": "130100",
"厦门": "350200",
"九江": "360400",
"洛阳": "410300",
"许昌": "411000",
"周口": "411600",
"南阳": "411300",
"宜昌": "420500",
"襄阳": "420600",
"岳阳": "430600",
"常德": "430700",
"江门": "440700",
"珠海": "440400",
"茂名": "440900",
"惠州": "441300",
"中山": "442000",
"南宁": "450100",
"海口": "460100",
"三亚": "460200",
"绵阳": "510700",
"拉萨": "540100",
"保定": "130600",
"唐山": "130200",
"大同": "140200",
"呼和浩特": "150100",
"阜阳": "341200",
"北京朝阳区": "CPF009",
"北京海淀区": "CPF010",
"北京丰台区": "CPF011",
"北京东城区": "CPF012",
"北京西城区": "CPF013",
"北京昌平区": "CPF014",
"北京通州区": "CPF015",
"北京怀柔区": "CPF016",
"北京石景山区": "CPF017",
"北京平谷区": "CPF018",
"北京顺义区": "CPF019",
"北京房山区": "CPF020",
"北京门头沟区": "CPF021",
"北京密云区": "CPF022",
"北京大兴区": "CPF023",
"北京顺义园区": "CP0024",
"北京房山园区": "CP0025"
},
channelTypeCode: {
"GSREG": "baidu.gsreg",
"KZFW": "baidu.kzfw",
"GSCHANGS": "baidu.gsbg",
"GSNB": "baidu.gsnb",
"SKSQ": "baidu.sksq",
"SWBD": "baidu.swbd",
"QYJYTC3":"baidu_qyjytc3",
"QYJYTC4":"baidu_qyjytc4",
"QYJYTC5":"baidu_qyjytc5"
},
//区分渠道的uappid
uappId : {
'baidu':44,
uappId: {
'baidu': 44,
'zhogxiaowei': 38
},
//交付状态
deliverRegStatus:{
deliverRegStatus: {
'RECEIVED': 'RECEIVED',//已接单
'COLLECTING': 'COLLECTING',//材料收集环节
'AUDITING': 'AUDITING',//工商审核环节
......@@ -163,8 +200,8 @@ var regCfg = {
'SUCCESS': 'SUCCESS', //已完成
'ACTIVE': 'ACTIVE' //服务中
},
//交付状态
deliverStatus:{
//交付状态
deliverStatus: {
'RECEIVED': '已接单',//
'COLLECTING': '材料收集环节',//
'AUDITING': '工商审核环节',//
......@@ -180,19 +217,19 @@ var regCfg = {
},
getResultSuccess(requestId) {
return {
"status": 0,
"msg": "success",
"data":null,
"requestId": requestId
"status": 0,
"msg": "success",
"data": null,
"requestId": requestId
};
},
getResultFail(errmsg) {
return {
"status":-1,
"msg": errmsg,
"requestId": this.getUUID(),
"data":null,
"bizmsg":"empty"
"status": -1,
"msg": errmsg,
"requestId": this.getUUID(),
"data": null,
"bizmsg": "empty"
};
}
}
......
......@@ -3,892 +3,949 @@ var settings = require("../../../../config/settings");
const AppServiceBase = require("../../app.base");
//区分渠道的uappid
const uappId = {
'ali':"18", //(阿里icp、edi)
'baidu':"44", //(百度icp、edi)
'zc360':"50", //360icp、edi
"ename":"52" //易名
'ali': "18", //(阿里icp、edi)
'baidu': "44", //(百度icp、edi)
'zc360': "50", //360icp、edi
"ename": "52" //易名
}
//tui song baidu zhuanyong pinyin 2020-11-6
const cityLetter = {
"北京":"BEIJING",
"上海":"SHANGHAI",
"福建":"FUJIAN",
"广西":"GUANGXI",
"广东":"GUANGDONG",
"安徽":"ANHUI",
"河南":"HENAN",
"湖北":"HUBEI",
"浙江":"ZHEJIANG",
"江苏":"JIANGSU",
"山东":"SHANDONG",
"陕西":"SHANXI_SHAN",
"宁夏":"NINGXIA",
"甘肃":"GANSU",
"新疆":"XINJIANG",
"青海":"QINGHAI",
"天津":"TIANJIN",
"重庆":"CHONGQING",
"河北":"HEBEI",
"山西":"SHANXI_JIN",
"辽宁":"LIAONING",
"吉林":"JILIN",
"黑龙江":"HEILONGJIANG",
"江西":"JIANGXI",
"湖南":"HUNAN",
"四川":"SUCHUAN",
"贵州":"GUIZHOU",
"云南":"YUANNAN",
"内蒙古":"NEIMENGGU",
"西藏":"XIZANG",
"外资":"WAIZI",
"海南":"HAINAN",
"广州":"GUANGZHOU",
"深圳":"SHENZHEN",
"全国":"QUANGUO"
"北京": "BEIJING",
"上海": "SHANGHAI",
"福建": "FUJIAN",
"广西": "GUANGXI",
"广东": "GUANGDONG",
"安徽": "ANHUI",
"河南": "HENAN",
"湖北": "HUBEI",
"浙江": "ZHEJIANG",
"江苏": "JIANGSU",
"山东": "SHANDONG",
"陕西": "SHANXI_SHAN",
"宁夏": "NINGXIA",
"甘肃": "GANSU",
"新疆": "XINJIANG",
"青海": "QINGHAI",
"天津": "TIANJIN",
"重庆": "CHONGQING",
"河北": "HEBEI",
"山西": "SHANXI_JIN",
"辽宁": "LIAONING",
"吉林": "JILIN",
"黑龙江": "HEILONGJIANG",
"江西": "JIANGXI",
"湖南": "HUNAN",
"四川": "SUCHUAN",
"贵州": "GUIZHOU",
"云南": "YUANNAN",
"内蒙古": "NEIMENGGU",
"西藏": "XIZANG",
"外资": "WAIZI",
"海南": "HAINAN",
"广州": "GUANGZHOU",
"深圳": "SHENZHEN",
"全国": "QUANGUO"
}
//baidu pinyinzhuanyong 2020-11-6
const baiduIcpStatus = {
507: "REGISTRATION",
508: "SUBMITTED",
509: "ACCEPTED",
510: "NOT_ACCEPTED",
511: "APPROVED",
512: "NOT_APPROVED"
507: "REGISTRATION",
508: "SUBMITTED",
509: "ACCEPTED",
510: "NOT_ACCEPTED",
511: "APPROVED",
512: "NOT_APPROVED"
};
/**
* 资质信息提报相关接口(ICP\EDI)
*/
class BaseCenterOrderService extends AppServiceBase {
constructor() {
super();
this.centerOrderUrl = settings.centerOrderUrl();
this.execClient = system.getObject("util.execClient");
this.aliclient = system.getObject("util.aliyunClient");
this.cacheManager = system.getObject("db.common.cacheManager");
this.utilsOrderSve = system.getObject("service.utilsSve.utilsOrderSve");
this.utilsPushSve = system.getObject("service.utilsSve.utilsPushSve");
this.utilsTmAliyunSve = system.getObject("service.utilsSve.utilsTmAliyunSve");//测试用
this.opPushQueueUrl = settings.opPushQueueUrl();
this.baiduclient = system.getObject("util.baiduClient");
this.utils360Sve = system.getObject("service.utilsSve.utils360Sve")
};
//调用center-order
async reqCenterOrderApi(pobj, reqUrl) {
var url = this.centerOrderUrl + "action/qcapi/springBoard";
if (reqUrl) {
var url = this.centerOrderUrl + reqUrl;
}
var rtn = await this.execClient.execPost(pobj, url);
var data = JSON.parse(rtn.stdout);
return data;
}
constructor() {
super();
this.execClientNew = system.getObject("util.execClientNew");
this.centerOrderUrl = settings.centerOrderUrl();
this.execClient = system.getObject("util.execClient");
this.aliclient = system.getObject("util.aliyunClient");
this.cacheManager = system.getObject("db.common.cacheManager");
this.utilsOrderSve = system.getObject("service.utilsSve.utilsOrderSve");
this.utilsPushSve = system.getObject("service.utilsSve.utilsPushSve");
this.utilsTmAliyunSve = system.getObject("service.utilsSve.utilsTmAliyunSve");//测试用
this.opPushQueueUrl = settings.opPushQueueUrl();
this.baiduclient = system.getObject("util.baiduClient");
this.utils360Sve = system.getObject("service.utilsSve.utils360Sve")
};
//提交Icp注册方案
async submitIcpProgramme(pobj) {
console.log('提交Icp注册方案---',pobj)
var res = await this.reqCenterOrderApi(pobj, "action/qcapi/springBoard");
if (res && res.status == 0 && res.data && res.data.needinfo && res.data.needsolution) {
var needinfo = res.data.needinfo;//需求信息
var needsolution = res.data.needsolution;//方案信息
var ab = pobj.actionBody;
if (typeof (ab.solutionContent) == "string") {
ab.solutionContent = JSON.parse(ab.solutionContent);
}
if (typeof (needsolution.solutionContent) == "string") {
needsolution.solutionContent = JSON.parse(needsolution.solutionContent);
}
var solution = needsolution.solutionContent.solution;
if(ab.isTest && ab.isTest==1){
var reqPushParams = {
actionBody: {
uapp_id:needinfo.uapp_id,
channelNeedNo:needinfo.channelNeedNo,
CompanyName:solution.CompanyName,
IcpType:solution.IcpType,
CompanyAddress:solution.CompanyAddress,
Area:solution.Area,
Note: solution.Note,
ActionType:solution.ActionType,
channelSolutionNo:needsolution.channelSolutionNo,
solutionNo:needsolution.solutionNo,
},
appInfo: pobj.appInfo
};
await this.utilsPushSve.business2Channel(reqPushParams, "pushIcpSolution2Channel");
}else{
var self = this;
//2020-10-26 laolan 区分百度与阿里
if(needinfo.uapp_id == uappId.ali){
//推送数据至阿里
// var bizType = needinfo.channelTypeCode;//业务类型里
var pushObj = {
IntentionBizId: needinfo.channelNeedNo,
CompanyName: solution.CompanyName,
IcpType: solution.IcpType,
CompanyAddress: solution.CompanyAddress,
Area: solution.Area,
Note: solution.Note,
ActionType:solution.ActionType,
Source:"官网"
};
if (needsolution.channelSolutionNo) {
pushObj["BizId"] = needsolution.channelSolutionNo;
}
var pushIcpSolutionRes = await this.pushIcpSolution(pushObj, needsolution.solutionNo, pobj.appInfo, self);
}
if(needinfo.uapp_id == uappId.baidu){
//推送数据至baidu
// var bizType = needinfo.channelTypeCode;//业务类型里
solution.Area = cityLetter[solution.Area]
console.log('solution.Area++',solution.Area)
var pushObj = {
requirementId: needinfo.channelNeedNo,
companyName: solution.CompanyName,
companyAddress: solution.CompanyAddress,
area: solution.Area,
type:solution.IcpType
};
if (needsolution.channelSolutionNo) {
pushObj["bizId"] = needsolution.channelSolutionNo;
}
console.log('pushObj++',pushObj)
var pushIcpSolutionRes = await this.pushBaiduIcpSolution(pushObj, needsolution.solutionNo, pobj.appInfo, self);
//调用center-order
async reqCenterOrderApi(pobj, reqUrl) {
var url = this.centerOrderUrl + "action/qcapi/springBoard";
if (reqUrl) {
var url = this.centerOrderUrl + reqUrl;
}
if(needinfo.uapp_id == uappId.ename){
//推送数据至易名
// var bizType = needinfo.channelTypeCode;//业务类型里
// solution.Area = cityLetter[solution.Area]
console.log('solution.Area++',solution.Area)
console.log('solution++',solution)
var pushObj = {
IntentionBizId: needinfo.channelNeedNo,
CompanyName: solution.CompanyName,
CompanyAddress: solution.CompanyAddress,
Area: solution.Area,
IcpType:solution.IcpType
};
if (needsolution.channelSolutionNo) {
pushObj["BizId"] = needsolution.channelSolutionNo;
}
console.log('pushObj++',pushObj);
var pushIcpSolutionRes = await this.pushEnameIcpSolution(pushObj, needsolution.solutionNo, pobj.appInfo, self);
var rtn = await this.execClient.execPost(pobj, url);
var data = JSON.parse(rtn.stdout);
return data;
}
//提交Icp注册方案
async submitIcpProgramme(pobj) {
console.log('提交Icp注册方案---', pobj)
var res = await this.reqCenterOrderApi(pobj, "action/qcapi/springBoard");
if (res && res.status == 0 && res.data && res.data.needinfo && res.data.needsolution) {
var needinfo = res.data.needinfo;//需求信息
var needsolution = res.data.needsolution;//方案信息
var ab = pobj.actionBody;
if (typeof (ab.solutionContent) == "string") {
ab.solutionContent = JSON.parse(ab.solutionContent);
}
if (typeof (needsolution.solutionContent) == "string") {
needsolution.solutionContent = JSON.parse(needsolution.solutionContent);
}
var solution = needsolution.solutionContent.solution;
if (ab.isTest && ab.isTest == 1) {
var reqPushParams = {
actionBody: {
uapp_id: needinfo.uapp_id,
channelNeedNo: needinfo.channelNeedNo,
CompanyName: solution.CompanyName,
IcpType: solution.IcpType,
CompanyAddress: solution.CompanyAddress,
Area: solution.Area,
Note: solution.Note,
ActionType: solution.ActionType,
channelSolutionNo: needsolution.channelSolutionNo,
solutionNo: needsolution.solutionNo,
},
appInfo: pobj.appInfo
};
await this.utilsPushSve.business2Channel(reqPushParams, "pushIcpSolution2Channel");
} else {
var self = this;
//2020-10-26 laolan 区分百度与阿里
if (needinfo.uapp_id == uappId.ali) {
//推送数据至阿里
// var bizType = needinfo.channelTypeCode;//业务类型里
var pushObj = {
IntentionBizId: needinfo.channelNeedNo,
CompanyName: solution.CompanyName,
IcpType: solution.IcpType,
CompanyAddress: solution.CompanyAddress,
Area: solution.Area,
Note: solution.Note,
ActionType: solution.ActionType,
Source: "官网"
};
if (needsolution.channelSolutionNo) {
pushObj["BizId"] = needsolution.channelSolutionNo;
}
var pushIcpSolutionRes = await this.pushIcpSolution(pushObj, needsolution.solutionNo, pobj.appInfo, self);
}
if (needinfo.uapp_id == uappId.baidu) {
//推送数据至baidu
// var bizType = needinfo.channelTypeCode;//业务类型里
solution.Area = cityLetter[solution.Area]
console.log('solution.Area++', solution.Area)
var pushObj = {
requirementId: needinfo.channelNeedNo,
companyName: solution.CompanyName,
companyAddress: solution.CompanyAddress,
area: solution.Area,
type: solution.IcpType
};
if (needsolution.channelSolutionNo) {
pushObj["bizId"] = needsolution.channelSolutionNo;
}
console.log('pushObj++', pushObj)
var pushIcpSolutionRes = await this.pushBaiduIcpSolution(pushObj, needsolution.solutionNo, pobj.appInfo, self);
}
if (needinfo.uapp_id == uappId.ename) {
//推送数据至易名
// var bizType = needinfo.channelTypeCode;//业务类型里
// solution.Area = cityLetter[solution.Area]
console.log('solution.Area++', solution.Area)
console.log('solution++', solution)
var pushObj = {
IntentionBizId: needinfo.channelNeedNo,
CompanyName: solution.CompanyName,
CompanyAddress: solution.CompanyAddress,
Area: solution.Area,
IcpType: solution.IcpType
};
if (needsolution.channelSolutionNo) {
pushObj["BizId"] = needsolution.channelSolutionNo;
}
var pushIcpSolutionRes = await this.pushEnameIcpSolution(pushObj, needsolution.solutionNo, pobj.appInfo, self);
}
this.logCtl.info({
appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "",
appkey: pobj.appInfo ? pobj.appInfo.uapp_key || "" : "",
requestId: pobj.requestId || "",
op: "service/impl/common/qcCenterOrderSve.js/submitIcpProgramme",
content: JSON.stringify(pobj),
resultInfo: JSON.stringify(needinfo),
optitle: "createSolution推送蜂擎获取的接口信息->aliBusiness2Delivery",
});
}
var reqParams = {
actionBody: {
intentionBizId: needinfo.channelNeedNo,
status: "createSolution"
},
appInfo: pobj.appInfo
}
await this.utilsPushSve.business2Channel(reqParams, "updateChanceStatus");
}
this.logCtl.info({
appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "",
appkey: pobj.appInfo ? pobj.appInfo.uapp_key || "" : "",
requestId: pobj.requestId || "",
op: "service/impl/common/qcCenterOrderSve.js/submitIcpProgramme",
content: JSON.stringify(pobj),
resultInfo: JSON.stringify(needinfo),
optitle: "createSolution推送蜂擎获取的接口信息->aliBusiness2Delivery",
});
}
var reqParams = {
actionBody: {
intentionBizId: needinfo.channelNeedNo,
status: "createSolution"
},
appInfo: pobj.appInfo
}
await this.utilsPushSve.business2Channel(reqParams, "updateChanceStatus");
return res;
}
return res;
}
//推送ICP方案至渠道方
async pushIcpSolution2Channel(pobj){
var actionBody = pobj.actionBody;
var appInfo = pobj.appInfo;
var pushRes = {
status:-1,msg:"推送失败"
};
var self = this;
if(actionBody){
//2020-10-26 laolan 区分百度与阿里
if(actionBody.uapp_id == uappId.ali){
//推送数据至阿里
var pushObj = {
IntentionBizId: actionBody.channelNeedNo,
CompanyName: actionBody.CompanyName,
IcpType: actionBody.IcpType,
CompanyAddress: actionBody.CompanyAddress,
Area: actionBody.Area,
Note: actionBody.Note,
ActionType:actionBody.ActionType,
Source:"官网"
//推送ICP方案至渠道方
async pushIcpSolution2Channel(pobj) {
var actionBody = pobj.actionBody;
var appInfo = pobj.appInfo;
var pushRes = {
status: -1, msg: "推送失败"
};
if (actionBody.channelSolutionNo) {
pushObj["BizId"] = actionBody.channelSolutionNo;
var self = this;
if (actionBody) {
//2020-10-26 laolan 区分百度与阿里
if (actionBody.uapp_id == uappId.ali) {
//推送数据至阿里
var pushObj = {
IntentionBizId: actionBody.channelNeedNo,
CompanyName: actionBody.CompanyName,
IcpType: actionBody.IcpType,
CompanyAddress: actionBody.CompanyAddress,
Area: actionBody.Area,
Note: actionBody.Note,
ActionType: actionBody.ActionType,
Source: "官网"
};
if (actionBody.channelSolutionNo) {
pushObj["BizId"] = actionBody.channelSolutionNo;
}
pushRes = await this.pushIcpSolution(pushObj, actionBody.solutionNo, pobj.appInfo, self);
}
if (actionBody.uapp_id == uappId.baidu) {
//推送数据至baidu
actionBody.Area = cityLetter[actionBody.Area];
var pushObj = {
requirementId: actionBody.channelNeedNo,
companyName: actionBody.CompanyName,
companyAddress: actionBody.CompanyAddress,
area: actionBody.Area,
type: actionBody.IcpType
};
if (actionBody.channelSolutionNo) {
pushObj["bizId"] = actionBody.channelSolutionNo;
}
pushRes = await this.pushBaiduIcpSolution(pushObj, actionBody.solutionNo, pobj.appInfo, self);
}
this.logCtl.info({
appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "",
appkey: pobj.appInfo ? pobj.appInfo.uapp_key || "" : "",
requestId: pobj.requestId || "",
op: "app/base/service/impl/common/baseCenterOrderSve.js/pushIcpSolution2Channel",
content: JSON.stringify(pobj),
resultInfo: JSON.stringify(pushRes),
optitle: "pushIcpSolution2Channel推送ICP方案至渠道方->pushIcpSolution2Channel",
});
}
pushRes = await this.pushIcpSolution(pushObj, actionBody.solutionNo, pobj.appInfo, self);
}
if(actionBody.uapp_id == uappId.baidu){
//推送数据至baidu
actionBody.Area = cityLetter[actionBody.Area];
var pushObj = {
requirementId: actionBody.channelNeedNo,
companyName: actionBody.CompanyName,
companyAddress: actionBody.CompanyAddress,
area: actionBody.Area,
type:actionBody.IcpType
};
if (actionBody.channelSolutionNo) {
pushObj["bizId"] = actionBody.channelSolutionNo;
if (pushRes.status == 0 || pushRes.status == 1) {
return system.getResultRedisQueueSuccess();
}
pushRes = await this.pushBaiduIcpSolution(pushObj, actionBody.solutionNo, pobj.appInfo, self);
}
this.logCtl.info({
appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "",
appkey: pobj.appInfo ? pobj.appInfo.uapp_key || "" : "",
requestId: pobj.requestId || "",
op: "app/base/service/impl/common/baseCenterOrderSve.js/pushIcpSolution2Channel",
content: JSON.stringify(pobj),
resultInfo: JSON.stringify(pushRes),
optitle: "pushIcpSolution2Channel推送ICP方案至渠道方->pushIcpSolution2Channel",
});
return pushRes;
}
if(pushRes.status==0 || pushRes.status==1 ){
return system.getResultRedisQueueSuccess();
//推送ICP方案ali
async pushIcpSolution(pushObj, solutionNo, appInfo, self) {
//推送方案信息
var pushRes = await self.aliclient.reqbyget({
action: "SubmitIcpSolution",
reqbody: pushObj,
apiVersion: "2019-05-08"
});
if (pushRes && pushRes.status == 0 && pushRes.data) {
var resData = pushRes.data;
if (resData.BizId) {
var reqObj2 = {
actionType: "receiveProgrammeNo",
appInfo: appInfo,
actionBody: {
solutionNo: solutionNo,
solutionBizId: resData.BizId
}
};
var a = await self.reqCenterOrderApi(reqObj2);//保存渠道方案id
if (a && a.status == 0) {
//推送方案确认信息
var confirmRes = await self.aliclient.reqbyget({
action: "ConfirmIntention",
reqbody: {BizId: pushObj.IntentionBizId},
apiVersion: "2019-05-08"
});
if (confirmRes && confirmRes.status == 0 && confirmRes.data) {
var confirmResData = confirmRes.data;
if (confirmResData.ConfirmUrl) {
var reqObj3 = {
actionType: "receiveIcpConfirmUrl",
appInfo: appInfo,
actionBody: {
solutionNo: solutionNo,
confirmUrl: confirmResData.ConfirmUrl
}
};
var a = await self.reqCenterOrderApi(reqObj3);//保存用户确认方案url
}
}
// return confirmRes;
}
}
}
return pushRes;
}
return pushRes;
}
//推送ICP方案ali
async pushIcpSolution(pushObj, solutionNo, appInfo, self) {
//推送方案信息
var pushRes = await self.aliclient.reqbyget({ action: "SubmitIcpSolution", reqbody: pushObj, apiVersion: "2019-05-08" });
if (pushRes && pushRes.status == 0 && pushRes.data) {
var resData = pushRes.data;
if (resData.BizId) {
var reqObj2 = {
actionType: "receiveProgrammeNo",
appInfo: appInfo,
actionBody: {
solutionNo: solutionNo,
solutionBizId: resData.BizId
}
};
var a = await self.reqCenterOrderApi(reqObj2);//保存渠道方案id
if (a && a.status == 0) {
//推送方案确认信息
var confirmRes = await self.aliclient.reqbyget({ action: "ConfirmIntention", reqbody: { BizId: pushObj.IntentionBizId }, apiVersion: "2019-05-08" });
if (confirmRes && confirmRes.status == 0 && confirmRes.data) {
var confirmResData = confirmRes.data;
if (confirmResData.ConfirmUrl) {
var reqObj3 = {
actionType: "receiveIcpConfirmUrl",
//推送ICP方案易名 2021-02-25 庄冰
async pushEnameIcpSolution(pushObj, solutionNo, appInfo, self) {
console.log('pushObj++Ename+++', pushObj);
//推送方案信息
var rtn = await self.execClient.execEnamePost(pushObj, settings.enameClientUrl() + "SubmitIcpSolution");
console.log("url+++++", settings.enameClientUrl() + "SubmitIcpSolution")
console.log("rtn+++++", rtn)
if (!rtn || !rtn.stdout) {
return system.getResult(null, "execPost data is empty");
}
var pushRes = JSON.parse(rtn.stdout);
// var pushRes = await self.baiduclient.baiduReqbyget({ path: "/api/bla/provider/plan", reqbody: pushObj });
console.log("pushRes++++", pushRes)
if (pushRes && pushRes.ErrorCode == "200" && pushRes.Success == true && pushRes.BizId) {
var reqObj2 = {
actionType: "receiveProgrammeNo",
appInfo: appInfo,
actionBody: {
solutionNo: solutionNo,
confirmUrl: confirmResData.ConfirmUrl
solutionNo: solutionNo,
solutionBizId: pushRes.BizId
}
};
var a = await self.reqCenterOrderApi(reqObj3);//保存用户确认方案url
};
var a = await self.reqCenterOrderApi(reqObj2);//保存渠道方案id
console.log("保存渠道方案id aaaa++ ", a)
if (a && a.status == 0 && pushRes.ConfirmUrl) {
var reqObj3 = {
actionType: "receiveIcpConfirmUrl",
appInfo: appInfo,
actionBody: {
solutionNo: solutionNo,
confirmUrl: pushRes.ConfirmUrl
}
};
var url = await self.reqCenterOrderApi(reqObj3);//保存用户确认方案url
console.log('save confirmUrl ++ ', url)
}
}
// return confirmRes;
}
}
return pushRes;
}
return pushRes;
}
//推送ICP方案易名 2021-02-25 庄冰
async pushEnameIcpSolution(pushObj, solutionNo, appInfo, self) {
console.log('pushObj++Ename+++',pushObj);
//推送方案信息
var rtn = await self.execClient.execEnamePost(pushObj, settings.enameClientUrl()+"SubmitIcpSolution");
console.log("url+++++",settings.enameClientUrl()+"SubmitIcpSolution")
console.log("rtn+++++",rtn)
if (!rtn || !rtn.stdout) {
return system.getResult(null, "execPost data is empty");
}
var pushRes = JSON.parse(rtn.stdout);
// var pushRes = await self.baiduclient.baiduReqbyget({ path: "/api/bla/provider/plan", reqbody: pushObj });
console.log("pushRes++++",pushRes)
if (pushRes && pushRes.ErrorCode == "200" && pushRes.Success==true && pushRes.BizId) {
var reqObj2 = {
actionType: "receiveProgrammeNo",
appInfo: appInfo,
actionBody: {
solutionNo: solutionNo,
solutionBizId: pushRes.BizId
}
};
var a = await self.reqCenterOrderApi(reqObj2);//保存渠道方案id
console.log("保存渠道方案id aaaa++ ",a)
if (a && a.status == 0 && pushRes.ConfirmUrl) {
var reqObj3 = {
actionType: "receiveIcpConfirmUrl",
appInfo: appInfo,
actionBody: {
solutionNo: solutionNo,
confirmUrl: pushRes.ConfirmUrl
}
};
var url = await self.reqCenterOrderApi(reqObj3);//保存用户确认方案url
console.log('save confirmUrl ++ ',url)
}
}
return pushRes;
}
//推送ICP方案baidu 2020-10-26 laolan
async pushBaiduIcpSolution(pushObj, solutionNo, appInfo, self) {
console.log('pushObj++baidu+++',pushObj)
//推送方案信息
var pushRes = await self.baiduclient.baiduReqbyget({ path: "/api/bla/provider/plan", reqbody: pushObj });
console.log("pushRes++++",pushRes)
if (pushRes && pushRes.status == 0 && pushRes.data) {
var resData = pushRes.data;
if (resData.planId) {
var reqObj2 = {
actionType: "receiveProgrammeNo",
appInfo: appInfo,
actionBody: {
solutionNo: solutionNo,
solutionBizId: resData.planId
}
};
var a = await self.reqCenterOrderApi(reqObj2);//保存渠道方案id
console.log("保存渠道方案id aaaa++ ",a)
if (a && a.status == 0 && resData.path) {
var reqObj3 = {
actionType: "receiveIcpConfirmUrl",
appInfo: appInfo,
actionBody: {
solutionNo: solutionNo,
confirmUrl: resData.path
//推送ICP方案baidu 2020-10-26 laolan
async pushBaiduIcpSolution(pushObj, solutionNo, appInfo, self) {
console.log('pushObj++baidu+++', pushObj)
//推送方案信息
var pushRes = await self.baiduclient.baiduReqbyget({path: "/api/bla/provider/plan", reqbody: pushObj});
console.log("pushRes++++", pushRes)
if (pushRes && pushRes.status == 0 && pushRes.data) {
var resData = pushRes.data;
if (resData.planId) {
var reqObj2 = {
actionType: "receiveProgrammeNo",
appInfo: appInfo,
actionBody: {
solutionNo: solutionNo,
solutionBizId: resData.planId
}
};
var a = await self.reqCenterOrderApi(reqObj2);//保存渠道方案id
console.log("保存渠道方案id aaaa++ ", a)
if (a && a.status == 0 && resData.path) {
var reqObj3 = {
actionType: "receiveIcpConfirmUrl",
appInfo: appInfo,
actionBody: {
solutionNo: solutionNo,
confirmUrl: resData.path
}
};
var url = await self.reqCenterOrderApi(reqObj3);//保存用户确认方案url
console.log('save confirmUrl ++ ', url)
}
}
};
var url = await self.reqCenterOrderApi(reqObj3);//保存用户确认方案url
console.log('save confirmUrl ++ ',url)
}
}
return pushRes;
}
return pushRes;
}
//队列推送材料
async serviceProviderSubmit2Material(pobj) {
console.log("serviceProviderSubmit2Material+++++pobj+++",pobj)
var actionBody = pobj.actionBody;
var appInfo = pobj.appInfo;
var pushRes = {
status:-1,msg:"推送失败"
};
if(actionBody){
if(actionBody.uapp_id == uappId.ali){
//推送数据至阿里
var pushObj = {
"BizId": actionBody.BizId,
"Domain": actionBody.Domain,
"CorporateName": actionBody.CorporateName,
"IncludeForeignInvestment": actionBody.IncludeForeignInvestment,
"PartnerBusinessLicense": actionBody.PartnerBusinessLicense,
"PartnerIdCardList": actionBody.PartnerIdCardList,
"PartnerDomainCertificate": actionBody.PartnerDomainCertificate,
"PartnerPreviewOtherList": actionBody.PartnerPreviewOtherList || [],
"PartnerPlan": actionBody.PartnerPlan || "",
"PartnerForeignInvestment": actionBody.PartnerForeignInvestment || "",
"PartnerLaw": actionBody.PartnerLaw || "",
"PartnerStampOtherList": actionBody.PartnerStampOtherList || [],
"PartnerSignOtherList": actionBody.PartnerSignOtherList || [],
"PartnerSignAndStampOtherList": actionBody.PartnerSignAndStampOtherList || []
//队列推送材料
async serviceProviderSubmit2Material(pobj) {
console.log("serviceProviderSubmit2Material+++++pobj+++", pobj)
var actionBody = pobj.actionBody;
var appInfo = pobj.appInfo;
var pushRes = {
status: -1, msg: "推送失败"
};
var self = this;
//推送方案材料
var ali =await self.aliclient.reqbyget({ action: "SavePartnerSubmitMaterial", reqbody: pushObj, apiVersion: "2019-05-08" });
console.log('ali ----- +++',ali)
if(ali && ali.status == 200){
var aliFlag = 200
}else{
var aliFlag = -200
}
}
if (actionBody) {
if (actionBody.uapp_id == uappId.ali) {
//推送数据至阿里
var pushObj = {
"BizId": actionBody.BizId,
"Domain": actionBody.Domain,
"CorporateName": actionBody.CorporateName,
"IncludeForeignInvestment": actionBody.IncludeForeignInvestment,
"PartnerBusinessLicense": actionBody.PartnerBusinessLicense,
"PartnerIdCardList": actionBody.PartnerIdCardList,
"PartnerDomainCertificate": actionBody.PartnerDomainCertificate,
"PartnerPreviewOtherList": actionBody.PartnerPreviewOtherList || [],
"PartnerPlan": actionBody.PartnerPlan || "",
"PartnerForeignInvestment": actionBody.PartnerForeignInvestment || "",
"PartnerLaw": actionBody.PartnerLaw || "",
"PartnerStampOtherList": actionBody.PartnerStampOtherList || [],
"PartnerSignOtherList": actionBody.PartnerSignOtherList || [],
"PartnerSignAndStampOtherList": actionBody.PartnerSignAndStampOtherList || []
};
var self = this;
//推送方案材料
var ali = await self.aliclient.reqbyget({
action: "SavePartnerSubmitMaterial",
reqbody: pushObj,
apiVersion: "2019-05-08"
});
console.log('ali ----- +++', ali)
if (ali && ali.status == 200) {
var aliFlag = 200
} else {
var aliFlag = -200
}
}
if(actionBody.uapp_id == uappId.baidu){
//推送数据至百度
var pushObj = {
"businessLicense" : {
"address" :actionBody.businessLicense.address || "",
"businessTerm" :actionBody.businessLicense.businessTerm || "",
"createdAt" : actionBody.businessLicense.createdAt || "",
"enterpriseCode" :actionBody.businessLicense.enterpriseCode || "",
"legalRepresentative" :actionBody.businessLicense.legalRepresentative || "",
"name" :actionBody.businessLicense.name || "",
"registeredCapital" : actionBody.businessLicense.registeredCapital || "",
"scopeBusiness" :actionBody.businessLicense.scopeBusiness || "",
"type" : actionBody.businessLicense.type || ""
},
"domain": actionBody.domain,
"corporateName": actionBody.corporateName,
"includeForeignInvestment": actionBody.includeForeignInvestment,
"orderNo": actionBody.orderNo,
"partnerForeignInvestment": actionBody.partnerForeignInvestment || "",
"partnerBusinessLicense": actionBody.partnerBusinessLicense,
"partnerIdCardList": actionBody.partnerIdCardList,
"partnerDomainCertificate": actionBody.partnerDomainCertificate,
"partnerPreviewOtherList": actionBody.partnerPreviewOtherList || [],
"partnerPlan": actionBody.partnerPlan || "",
"partnerLaw": actionBody.partnerLaw || "",
"partnerStampOtherList": actionBody.partnerStampOtherList || [],
"partnerSignOtherList": actionBody.partnerSignOtherList || [],
"partnerSignAndStampOtherList": actionBody.partnerSignAndStampOtherList || []
};
var self = this;
//推送方案材料
var baidu = await self.baiduclient.baiduReqbyget({ path: "/api/bla/provider/license/material", reqbody: pushObj });
console.log('baidu -----+++++',baidu)
if(baidu && baidu.data && baidu.data.result){
var baiduFlag = 200
}else{
var baiduFlag = -200
if (actionBody.uapp_id == uappId.baidu) {
//推送数据至百度
var pushObj = {
"businessLicense": {
"address": actionBody.businessLicense.address || "",
"businessTerm": actionBody.businessLicense.businessTerm || "",
"createdAt": actionBody.businessLicense.createdAt || "",
"enterpriseCode": actionBody.businessLicense.enterpriseCode || "",
"legalRepresentative": actionBody.businessLicense.legalRepresentative || "",
"name": actionBody.businessLicense.name || "",
"registeredCapital": actionBody.businessLicense.registeredCapital || "",
"scopeBusiness": actionBody.businessLicense.scopeBusiness || "",
"type": actionBody.businessLicense.type || ""
},
"domain": actionBody.domain,
"corporateName": actionBody.corporateName,
"includeForeignInvestment": actionBody.includeForeignInvestment,
"orderNo": actionBody.orderNo,
"partnerForeignInvestment": actionBody.partnerForeignInvestment || "",
"partnerBusinessLicense": actionBody.partnerBusinessLicense,
"partnerIdCardList": actionBody.partnerIdCardList,
"partnerDomainCertificate": actionBody.partnerDomainCertificate,
"partnerPreviewOtherList": actionBody.partnerPreviewOtherList || [],
"partnerPlan": actionBody.partnerPlan || "",
"partnerLaw": actionBody.partnerLaw || "",
"partnerStampOtherList": actionBody.partnerStampOtherList || [],
"partnerSignOtherList": actionBody.partnerSignOtherList || [],
"partnerSignAndStampOtherList": actionBody.partnerSignAndStampOtherList || []
};
var self = this;
//推送方案材料
var baidu = await self.baiduclient.baiduReqbyget({
path: "/api/bla/provider/license/material",
reqbody: pushObj
});
console.log('baidu -----+++++', baidu)
if (baidu && baidu.data && baidu.data.result) {
var baiduFlag = 200
} else {
var baiduFlag = -200
}
console.log('hhhhh+++baiduFlag+++', baiduFlag)
}
this.logCtl.info({
appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "",
appkey: pobj.appInfo ? pobj.appInfo.uapp_key || "" : "",
requestId: pobj.requestId || "",
op: "app/base/service/impl/common/baseCenterOrderSve.js/serviceProviderSubmit2Material",
content: JSON.stringify(pobj),
resultInfo: JSON.stringify(pushRes),
optitle: "serviceProviderSubmit2Material推送ICP材料至渠道方->serviceProviderSubmit2Material",
});
}
console.log('hhhhh+++baiduFlag+++',baiduFlag)
}
this.logCtl.info({
appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "",
appkey: pobj.appInfo ? pobj.appInfo.uapp_key || "" : "",
requestId: pobj.requestId || "",
op: "app/base/service/impl/common/baseCenterOrderSve.js/serviceProviderSubmit2Material",
content: JSON.stringify(pobj),
resultInfo: JSON.stringify(pushRes),
optitle: "serviceProviderSubmit2Material推送ICP材料至渠道方->serviceProviderSubmit2Material",
});
}
if(aliFlag == 200 || baiduFlag == 200){
// pushRes.status = 1
return system.getResultRedisQueueSuccess();
if (aliFlag == 200 || baiduFlag == 200) {
// pushRes.status = 1
return system.getResultRedisQueueSuccess();
}
return pushRes;
}
return pushRes;
}
//交付材料提交
async serviceProviderSubmitMaterial(pobj) {
var res = await this.reqCenterOrderApi(pobj, "action/qcapi/springBoard");
console.log('zzzzlllll+++++',res)
console.log('zzzzlllll++pobj+++',pobj)
if (res && res.status == 0 && res.data) {
var needsolution = res.data;//方案信息
var ab = pobj.actionBody;
if (typeof (ab.material) == "string") {
ab.material = JSON.parse(ab.material);
}
var material = ab.material;
var reqPushParams = {};
if(ab.isTest && ab.isTest==1){
if(res.data.uapp_id == uappId.ali){
//推送数据至阿里
var BizId = needsolution.channelSolutionNo;//⽅案业务ID
reqPushParams = {
actionBody: {
"uapp_id":res.data.uapp_id,
"BizId": BizId,
"Domain": material.Domain,
"CorporateName": material.CorporateName,
"IncludeForeignInvestment": material.IncludeForeignInvestment,
"PartnerBusinessLicense": material.PartnerBusinessLicense,
"PartnerIdCardList": material.PartnerIdCardList,
"PartnerDomainCertificate": material.PartnerDomainCertificate,
"PartnerPreviewOtherList": material.PartnerPreviewOtherList || [],
"PartnerPlan": material.PartnerPlan || "",
"PartnerForeignInvestment": material.PartnerForeignInvestment || "",
"PartnerLaw": material.PartnerLaw || "",
"PartnerStampOtherList": material.PartnerStampOtherList || [],
"PartnerSignOtherList": material.PartnerSignOtherList || [],
"PartnerSignAndStampOtherList": material.PartnerSignAndStampOtherList || []
},
appInfo: pobj.appInfo
};
}
if(res.data.uapp_id == uappId.baidu){
//推送数据至百度
var BizId = needsolution.orderChannelNo;
console.log('BizId++',BizId)
reqPushParams = {
actionBody: {
"uapp_id":res.data.uapp_id,
"businessLicense" : {
"address" :material.BusinessLicense.Address || "",
"businessTerm" :material.BusinessLicense.BusinessTerm || "",
"createdAt" : material.BusinessLicense.CreatedAt || "",
"enterpriseCode" :material.BusinessLicense.EnterpriseCode || "",
"legalRepresentative" :material.BusinessLicense.LegalRepresentative || "",
"name" :material.BusinessLicense.Name || "",
"registeredCapital" : material.BusinessLicense.RegisteredCapital || "",
"scopeBusiness" :material.BusinessLicense.ScopeBusiness || "",
"type" : material.BusinessLicense.Type || ""
},
"corporateName": material.CorporateName,
"domain": material.Domain,
"includeForeignInvestment": material.IncludeForeignInvestment,
"orderNo": BizId,
"partnerForeignInvestment": material.PartnerForeignInvestment || "",
"partnerBusinessLicense": material.PartnerBusinessLicense,
"partnerIdCardList": material.PartnerIdCardList,
"partnerDomainCertificate": material.PartnerDomainCertificate,
"partnerPreviewOtherList": material.PartnerPreviewOtherList || [],
"partnerPlan": material.PartnerPlan || "",
"partnerLaw": material.PartnerLaw || "",
"partnerStampOtherList": material.PartnerStampOtherList || [],
"partnerSignOtherList": material.PartnerSignOtherList || [],
"partnerSignAndStampOtherList": material.PartnerSignAndStampOtherList || []
},
appInfo: pobj.appInfo
}
}
await this.utilsPushSve.business2Channel(reqPushParams, "serviceProviderSubmit2Material");
// console.log('result+++-cailiao--++++----',result)
// console.log('result+++-reqPushParams--++++----',reqPushParams)
}else{
if(res.data.uapp_id == uappId.ali){
//推送数据至阿里
var BizId = needsolution.channelSolutionNo;//⽅案业务ID
var pushObj = {
"CompanyName":material.CompanyName,
"BizId": BizId,
"Domain": material.Domain,
"CorporateName": material.CorporateName,
"IncludeForeignInvestment": material.IncludeForeignInvestment,
"PartnerBusinessLicense": material.PartnerBusinessLicense,
"PartnerIdCardList": material.PartnerIdCardList,
"PartnerDomainCertificate": material.PartnerDomainCertificate,
"PartnerPreviewOtherList": material.PartnerPreviewOtherList || [],
"PartnerPlan": material.PartnerPlan || "",
"PartnerForeignInvestment": material.PartnerForeignInvestment || "",
"PartnerLaw": material.PartnerLaw || "",
"PartnerStampOtherList": material.PartnerStampOtherList || [],
"PartnerSignOtherList": material.PartnerSignOtherList || [],
"PartnerSignAndStampOtherList": material.PartnerSignAndStampOtherList || []
};
var self = this;
//推送方案材料
var ali =await self.aliclient.reqbyget({ action: "SavePartnerSubmitMaterial", reqbody: pushObj, apiVersion: "2019-05-08" });
console.log('ali tui ziliao ++',ali)
if(ali && ali.status == 200){
var aliFlag = 200
}else{
var aliFlag = -200
}
}
//交付材料提交
async serviceProviderSubmitMaterial(pobj) {
let self = this;
let resFlag = -200;
try {
let res = await this.reqCenterOrderApi(pobj, "action/qcapi/springBoard");
this.execClientNew.execLogs("serviceProviderSubmitMaterial-reqCenterOrderApi:", pobj, "center-channel-serviceProviderSubmitMaterial", res, null);
if (res && res.status == 0 && res.data) {
let needsolution = res.data;//方案信息
let ab = pobj.actionBody;
if (typeof (ab.material) == "string") {
ab.material = JSON.parse(ab.material);
}
let material = ab.material;
let reqPushParams = {};
if (ab.isTest && ab.isTest == 1) {
if (res.data.uapp_id == uappId.ali) {
//推送数据至阿里
let BizId = needsolution.channelSolutionNo;//⽅案业务ID
reqPushParams = {
actionBody: {
"uapp_id": res.data.uapp_id,
"BizId": BizId,
"Domain": material.Domain,
"CorporateName": material.CorporateName,
"IncludeForeignInvestment": material.IncludeForeignInvestment,
"PartnerBusinessLicense": material.PartnerBusinessLicense,
"PartnerIdCardList": material.PartnerIdCardList,
"PartnerDomainCertificate": material.PartnerDomainCertificate,
"PartnerPreviewOtherList": material.PartnerPreviewOtherList || [],
"PartnerPlan": material.PartnerPlan || "",
"PartnerForeignInvestment": material.PartnerForeignInvestment || "",
"PartnerLaw": material.PartnerLaw || "",
"PartnerStampOtherList": material.PartnerStampOtherList || [],
"PartnerSignOtherList": material.PartnerSignOtherList || [],
"PartnerSignAndStampOtherList": material.PartnerSignAndStampOtherList || []
},
appInfo: pobj.appInfo
};
}
if (res.data.uapp_id == uappId.baidu) {
//推送数据至百度
let BizId = needsolution.orderChannelNo;
reqPushParams = {
actionBody: {
"uapp_id": res.data.uapp_id,
"businessLicense": {
"address": material.BusinessLicense.Address || "",
"businessTerm": material.BusinessLicense.BusinessTerm || "",
"createdAt": material.BusinessLicense.CreatedAt || "",
"enterpriseCode": material.BusinessLicense.EnterpriseCode || "",
"legalRepresentative": material.BusinessLicense.LegalRepresentative || "",
"name": material.BusinessLicense.Name || "",
"registeredCapital": material.BusinessLicense.RegisteredCapital || "",
"scopeBusiness": material.BusinessLicense.ScopeBusiness || "",
"type": material.BusinessLicense.Type || ""
},
"corporateName": material.CorporateName,
"domain": material.Domain,
"includeForeignInvestment": material.IncludeForeignInvestment,
"orderNo": BizId,
"partnerForeignInvestment": material.PartnerForeignInvestment || "",
"partnerBusinessLicense": material.PartnerBusinessLicense,
"partnerIdCardList": material.PartnerIdCardList,
"partnerDomainCertificate": material.PartnerDomainCertificate,
"partnerPreviewOtherList": material.PartnerPreviewOtherList || [],
"partnerPlan": material.PartnerPlan || "",
"partnerLaw": material.PartnerLaw || "",
"partnerStampOtherList": material.PartnerStampOtherList || [],
"partnerSignOtherList": material.PartnerSignOtherList || [],
"partnerSignAndStampOtherList": material.PartnerSignAndStampOtherList || []
},
appInfo: pobj.appInfo
}
}
await this.utilsPushSve.business2Channel(reqPushParams, "serviceProviderSubmit2Material");
} else {
if (res.data.uapp_id == uappId.ali) {
//推送数据至阿里
let BizId = needsolution.channelSolutionNo;//⽅案业务ID
let pushObj = {
"CompanyName": material.CompanyName,
"BizId": BizId,
"Domain": material.Domain,
"CorporateName": material.CorporateName,
"IncludeForeignInvestment": material.IncludeForeignInvestment,
"PartnerBusinessLicense": material.PartnerBusinessLicense,
"PartnerIdCardList": material.PartnerIdCardList,
"PartnerDomainCertificate": material.PartnerDomainCertificate,
"PartnerPreviewOtherList": material.PartnerPreviewOtherList || [],
"PartnerPlan": material.PartnerPlan || "",
"PartnerForeignInvestment": material.PartnerForeignInvestment || "",
"PartnerLaw": material.PartnerLaw || "",
"PartnerStampOtherList": material.PartnerStampOtherList || [],
"PartnerSignOtherList": material.PartnerSignOtherList || [],
"PartnerSignAndStampOtherList": material.PartnerSignAndStampOtherList || []
};
if(res.data.uapp_id == uappId.baidu){
//推送数据至百度
var BizId = needsolution.orderChannelNo;
console.log('BizId++',BizId)
var pushObj = {
"businessLicense" : {
"createdAt" : material.BusinessLicense.CreatedAt || "",
"enterpriseCode" :material.BusinessLicense.EnterpriseCode || "",
"legalRepresentative" :material.BusinessLicense.LegalRepresentative || "",
"address" :material.BusinessLicense.Address || "",
"registeredCapital" : material.BusinessLicense.RegisteredCapital || "",
"name" :material.BusinessLicense.Name || "",
"businessTerm" :material.BusinessLicense.BusinessTerm || "",
"type" : material.BusinessLicense.Type || "",
"scopeBusiness" :material.BusinessLicense.ScopeBusiness || ""
},
"partnerForeignInvestment": material.PartnerForeignInvestment || "",
"orderNo": BizId,
"domain": material.Domain,
"corporateName": material.CorporateName,
"includeForeignInvestment": material.IncludeForeignInvestment,
"partnerBusinessLicense": material.PartnerBusinessLicense,
"partnerIdCardList": material.PartnerIdCardList,
"partnerDomainCertificate": material.PartnerDomainCertificate,
"partnerPreviewOtherList": material.PartnerPreviewOtherList || [],
"partnerPlan": material.PartnerPlan || "",
"partnerLaw": material.PartnerLaw || "",
"partnerStampOtherList": material.PartnerStampOtherList || [],
"partnerSignOtherList": material.PartnerSignOtherList || [],
"partnerSignAndStampOtherList": material.PartnerSignAndStampOtherList || []
};
var self = this;
//推送方案材料
var baidu = await self.baiduclient.baiduReqbyget({ path: "/api/bla/provider/license/material", reqbody: pushObj });
console.log('baidu tui ziliao +++++',baidu)
console.log('baidu pushObj ziliao +++++',pushObj)
if(baidu && baidu.data && baidu.data.result){
var baiduFlag = 200
}else{
var baiduFlag = -200
}
}
//推送方案材料
let aliParams = {
action: "SavePartnerSubmitMaterial",
reqbody: pushObj,
apiVersion: "2019-05-08"
}
let ali = await self.aliclient.reqbyget(aliParams);
this.execClientNew.execLogs("serviceProviderSubmitMaterial-aliclient:", aliParams, "center-channel-serviceProviderSubmitMaterial", ali, null);
if (ali && ali.status == 200) {
resFlag = 200
}
}
if(res.data.uapp_id == uappId.ename){
var aliFlag = -200;
//推送数据至易名
var BizId = needsolution.channelSolutionNo;//⽅案业务ID
var pushObj = {
"CompanyName":material.CompanyName,
// "BizId": BizId,
"OrderNo": BizId,
"Domain": material.Domain,
"CorporateName": material.CorporateName,
"IncludeForeignInvestment": material.IncludeForeignInvestment,
"PartnerBusinessLicense": material.PartnerBusinessLicense,
"PartnerIdCardList": material.PartnerIdCardList,
"PartnerDomainCertificate": material.PartnerDomainCertificate,
"PartnerPreviewOtherList": material.PartnerPreviewOtherList || [],
"PartnerPlan": material.PartnerPlan || "",
"PartnerForeignInvestment": material.PartnerForeignInvestment || "",
"PartnerLaw": material.PartnerLaw || "",
"PartnerStampOtherList": material.PartnerStampOtherList || [],
"PartnerSignOtherList": material.PartnerSignOtherList || [],
"PartnerSignAndStampOtherList": material.PartnerSignAndStampOtherList || [],
"BusinessLicense" : {
"CreatedAt" : material.BusinessLicense.CreatedAt || "",
"EnterpriseCode" :material.BusinessLicense.EnterpriseCode || "",
"LegalRepresentative" :material.BusinessLicense.LegalRepresentative || "",
"Address" :material.BusinessLicense.Address || "",
"RegisteredCapital" : material.BusinessLicense.RegisteredCapital || "",
"Name" :material.BusinessLicense.Name || "",
"BusinessTerm" :material.BusinessLicense.BusinessTerm || "",
"Type" : material.BusinessLicense.Type || "",
"ScopeBusiness" :material.BusinessLicense.ScopeBusiness || ""
},
};
var self = this;
//推送方案材料
var rtn = await self.execClient.execEnamePost(pushObj, settings.enameClientUrl()+"SavePartnerSubmitMaterial");
console.log("url+++++",settings.enameClientUrl()+"SavePartnerSubmitMaterial")
console.log("rtn+++++",rtn)
if (!rtn || !rtn.stdout) {
aliFlag = -200;
}else{
var pushRes = JSON.parse(rtn.stdout);
if(pushRes && pushRes.Success && pushRes.Success==true){
aliFlag == 200;
}else{
aliFlag == -200;
if (res.data.uapp_id == uappId.baidu) {
//推送数据至百度
let BizId = needsolution.orderChannelNo;
let pushObj = {
"businessLicense": {
"createdAt": material.BusinessLicense.CreatedAt || "",
"enterpriseCode": material.BusinessLicense.EnterpriseCode || "",
"legalRepresentative": material.BusinessLicense.LegalRepresentative || "",
"address": material.BusinessLicense.Address || "",
"registeredCapital": material.BusinessLicense.RegisteredCapital || "",
"name": material.BusinessLicense.Name || "",
"businessTerm": material.BusinessLicense.BusinessTerm || "",
"type": material.BusinessLicense.Type || "",
"scopeBusiness": material.BusinessLicense.ScopeBusiness || ""
},
"partnerForeignInvestment": material.PartnerForeignInvestment || "",
"orderNo": BizId,
"domain": material.Domain,
"corporateName": material.CorporateName,
"includeForeignInvestment": material.IncludeForeignInvestment,
"partnerBusinessLicense": material.PartnerBusinessLicense,
"partnerIdCardList": material.PartnerIdCardList,
"partnerDomainCertificate": material.PartnerDomainCertificate,
"partnerPreviewOtherList": material.PartnerPreviewOtherList || [],
"partnerPlan": material.PartnerPlan || "",
"partnerLaw": material.PartnerLaw || "",
"partnerStampOtherList": material.PartnerStampOtherList || [],
"partnerSignOtherList": material.PartnerSignOtherList || [],
"partnerSignAndStampOtherList": material.PartnerSignAndStampOtherList || []
};
//推送方案材料
let baiduParams = {path: "/api/bla/provider/license/material", reqbody: pushObj}
let baidu = await self.baiduclient.baiduReqbyget(baiduParams);
this.execClientNew.execLogs("serviceProviderSubmitMaterial-baiduReqbyget:", baiduParams, "center-channel-serviceProviderSubmitMaterial", baidu, null);
if (baidu && baidu.data && baidu.data.result) {
resFlag = 200
}
}
if (res.data.uapp_id == uappId.ename) {
//推送数据至易名
let BizId = needsolution.channelSolutionNo;//⽅案业务ID
let pushObj = {
"CompanyName": material.CompanyName,
// "BizId": BizId,
"OrderNo": BizId,
"Domain": material.Domain,
"CorporateName": material.CorporateName,
"IncludeForeignInvestment": material.IncludeForeignInvestment,
"PartnerBusinessLicense": material.PartnerBusinessLicense,
"PartnerIdCardList": material.PartnerIdCardList,
"PartnerDomainCertificate": material.PartnerDomainCertificate,
"PartnerPreviewOtherList": material.PartnerPreviewOtherList || [],
"PartnerPlan": material.PartnerPlan || "",
"PartnerForeignInvestment": material.PartnerForeignInvestment || "",
"PartnerLaw": material.PartnerLaw || "",
"PartnerStampOtherList": material.PartnerStampOtherList || [],
"PartnerSignOtherList": material.PartnerSignOtherList || [],
"PartnerSignAndStampOtherList": material.PartnerSignAndStampOtherList || [],
"BusinessLicense": {
"CreatedAt": material.BusinessLicense.CreatedAt || "",
"EnterpriseCode": material.BusinessLicense.EnterpriseCode || "",
"LegalRepresentative": material.BusinessLicense.LegalRepresentative || "",
"Address": material.BusinessLicense.Address || "",
"RegisteredCapital": material.BusinessLicense.RegisteredCapital || "",
"Name": material.BusinessLicense.Name || "",
"BusinessTerm": material.BusinessLicense.BusinessTerm || "",
"Type": material.BusinessLicense.Type || "",
"ScopeBusiness": material.BusinessLicense.ScopeBusiness || ""
},
};
//推送方案材料
let eNameUrl = settings.enameClientUrl() + "SavePartnerSubmitMaterial";
let rtn = await self.execClient.execEnamePost(pushObj, eNameUrl);
this.execClientNew.execLogs("serviceProviderSubmitMaterial-execEnamePost:eNameUrl:" + eNameUrl, pushObj, "center-channel-serviceProviderSubmitMaterial", rtn, null);
if (rtn && rtn.stdout) {
let pushRes = JSON.parse(rtn.stdout);
if (pushRes && pushRes.Success && pushRes.Success == true) {
resFlag = 200;
}
}
}
if (resFlag == 200) {
return system.getResultSuccess();
}
}
}
}
}
if(aliFlag == 200 || baiduFlag == 200){
return system.getResultSuccess();
return res
} catch (e) {
const stackStr = e.stack ? e.stack : JSON.stringify(e);
this.execClientNew.execLogs("serviceProviderSubmitMaterial-reqError:", pobj, "center-channel-serviceProviderSubmitMaterial", null, stackStr);
}
}
console.log('rsrsr++++------------++++',res)
return res
}
return res
}
//队列通知交付状态变更
async serviceProvider2Notification(pobj){
console.log("serviceProvider2Notification+++++pobj+++",pobj)
var actionBody = pobj.actionBody;
var appInfo = pobj.appInfo;
var pushRes = {
status:-1,msg:"推送失败"
};
if(actionBody){
if(actionBody.uapp_id == uappId.ali){
//推送数据至阿里
var pushObj = {
BizId: actionBody.BizId,
OfficialFileURL: actionBody.OfficialFileURL,
ApplicationStatus: actionBody.ApplicationStatus
//队列通知交付状态变更
async serviceProvider2Notification(pobj) {
console.log("serviceProvider2Notification+++++pobj+++", pobj)
var actionBody = pobj.actionBody;
var appInfo = pobj.appInfo;
var pushRes = {
status: -1, msg: "推送失败"
};
//推送状态变更
var ali = await this.aliclient.reqbyget({ action: "AcceptPartnerNotification", reqbody: pushObj, apiVersion: "2019-05-08" });
console.log('状态变更 ali ----- +++',ali)
if(ali && ali.status == 200){
var aliFlag = 200
}else{
var aliFlag = -200
if (actionBody) {
if (actionBody.uapp_id == uappId.ali) {
//推送数据至阿里
var pushObj = {
BizId: actionBody.BizId,
OfficialFileURL: actionBody.OfficialFileURL,
ApplicationStatus: actionBody.ApplicationStatus
};
//推送状态变更
var ali = await this.aliclient.reqbyget({
action: "AcceptPartnerNotification",
reqbody: pushObj,
apiVersion: "2019-05-08"
});
console.log('状态变更 ali ----- +++', ali)
if (ali && ali.status == 200) {
var aliFlag = 200
} else {
var aliFlag = -200
}
}
if (actionBody.uapp_id == uappId.baidu) {
// actionBody.ApplicationStatus = baiduIcpStatus[actionBody.ApplicationStatus];
//推送数据至百度
var pushObj = {
orderNo: actionBody.orderNo,
status: actionBody.status
};
console.log('pushObj 推送状态变更 +++++', pushObj)
//推送状态变更
var baidu = await this.baiduclient.baiduReqbyget({
path: "/api/bla/provider/license/update",
reqbody: pushObj
});
console.log('baidu 推送状态变更 +++++', baidu)
if (baidu && baidu.data && baidu.data.result) {
var baiduFlag = 200
} else {
var baiduFlag = -200
}
}
this.logCtl.info({
appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "",
appkey: pobj.appInfo ? pobj.appInfo.uapp_key || "" : "",
requestId: pobj.requestId || "",
op: "app/base/service/impl/common/baseCenterOrderSve.js/serviceProvider2Notification",
content: JSON.stringify(pobj),
resultInfo: JSON.stringify(pushRes),
optitle: "serviceProvider2Notification推送ICP材料至渠道方->serviceProvider2Notification",
});
}
}
if(actionBody.uapp_id == uappId.baidu){
// actionBody.ApplicationStatus = baiduIcpStatus[actionBody.ApplicationStatus];
//推送数据至百度
var pushObj = {
orderNo: actionBody.orderNo,
status: actionBody.status
};
console.log('pushObj 推送状态变更 +++++',pushObj)
//推送状态变更
var baidu = await this.baiduclient.baiduReqbyget({ path: "/api/bla/provider/license/update", reqbody: pushObj });
console.log('baidu 推送状态变更 +++++',baidu)
if(baidu && baidu.data && baidu.data.result){
var baiduFlag = 200
}else{
var baiduFlag = -200
if (aliFlag == 200 || baiduFlag == 200) {
pushRes.status = 1
return system.getResultRedisQueueSuccess();
}
}
this.logCtl.info({
appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "",
appkey: pobj.appInfo ? pobj.appInfo.uapp_key || "" : "",
requestId: pobj.requestId || "",
op: "app/base/service/impl/common/baseCenterOrderSve.js/serviceProvider2Notification",
content: JSON.stringify(pobj),
resultInfo: JSON.stringify(pushRes),
optitle: "serviceProvider2Notification推送ICP材料至渠道方->serviceProvider2Notification",
});
return pushRes;
}
if(aliFlag == 200 || baiduFlag == 200){
pushRes.status = 1
return system.getResultRedisQueueSuccess();
}
return pushRes;
}
//通知交付状态变更
async serviceProviderNotification(pobj) {
console.log('zhuangtai ++++',pobj)
var res = await this.reqCenterOrderApi(pobj, "action/qcapi/springBoard");
if (res && res.status == 0 && res.data) {
if(pobj.actionBody.isTest && pobj.actionBody.isTest==1){
var reqPushParams = {};
if(res.data.uapp_id == uappId.ali){
//推送数据至阿里
reqPushParams = {
actionBody: {
uapp_id:res.data.uapp_id,
BizId: res.data.BizId,
OfficialFileURL: res.data.OfficialFileURL,
ApplicationStatus: res.data.ApplicationStatus
},
appInfo:pobj.appInfo
}
}
if(res.data.uapp_id == uappId.baidu){
res.data.ApplicationStatus = baiduIcpStatus[res.data.ApplicationStatus];
//推送数据至百度
reqPushParams = {
actionBody:{
uapp_id:res.data.uapp_id,
orderNo: res.data.channelOrderNo,
status: res.data.ApplicationStatus
},
appInfo:pobj.appInfo
}
}
await this.utilsPushSve.business2Channel(reqPushParams, "serviceProvider2Notification");
// console.log('reqPushParams+++-状态变更--++++----',reqPushParams)
// console.log('result+++-状态变更--++++----',result)
}else{
if(res.data.uapp_id == uappId.ali){
//推送数据至阿里
var pushObj = {
BizId: res.data.BizId,
OfficialFileURL: res.data.OfficialFileURL,
ApplicationStatus: res.data.ApplicationStatus,
//2021-3-18 addNew
CertificateNumber:res.data.CertificateNumber || "",//证书编号
CertificateStartTime:res.data.CertificateStartTime || "",//证书有效期 开始时间
CertificateEndTime:res.data.CertificateEndTime || ""//证书有效期 结束时间
};
//推送状态变更
var ali = await this.aliclient.reqbyget({ action: "AcceptPartnerNotification", reqbody: pushObj, apiVersion: "2019-05-08" });
if(ali && ali.status == 200){
var aliFlag = 200
}else{
var aliFlag = -200
}
}
//通知交付状态变更-所有渠道状态更改
async serviceProviderNotification(pobj) {
let self = this;
let resFlag = -200;
try {
let res = await this.reqCenterOrderApi(pobj, "action/qcapi/springBoard");
this.execClientNew.execLogs("serviceProviderNotification-reqCenterOrderApi:", pobj, "center-channel-serviceProviderNotification", res, null);
if (res && res.status == 0 && res.data) {
if (pobj.actionBody.isTest && pobj.actionBody.isTest == 1) {
var reqPushParams = {};
if (res.data.uapp_id == uappId.ali) {
//推送数据至阿里
reqPushParams = {
actionBody: {
uapp_id: res.data.uapp_id,
BizId: res.data.BizId,
OfficialFileURL: res.data.OfficialFileURL,
ApplicationStatus: res.data.ApplicationStatus
},
appInfo: pobj.appInfo
}
}
if (res.data.uapp_id == uappId.baidu) {
res.data.ApplicationStatus = baiduIcpStatus[res.data.ApplicationStatus];
//推送数据至百度
reqPushParams = {
actionBody: {
uapp_id: res.data.uapp_id,
orderNo: res.data.channelOrderNo,
status: res.data.ApplicationStatus
},
appInfo: pobj.appInfo
}
}
await this.utilsPushSve.business2Channel(reqPushParams, "serviceProvider2Notification");
} else {
if (res.data.uapp_id == uappId.ali) {
//推送数据至阿里
let pushObj = {
BizId: res.data.BizId,
OfficialFileURL: res.data.OfficialFileURL,
ApplicationStatus: res.data.ApplicationStatus,
//2021-3-18 addNew
CertificateNumber: res.data.CertificateNumber || "",//证书编号
CertificateStartTime: res.data.CertificateStartTime || "",//证书有效期 开始时间
CertificateEndTime: res.data.CertificateEndTime || ""//证书有效期 结束时间
};
//推送状态变更
let aliParams = {
action: "AcceptPartnerNotification",
reqbody: pushObj,
apiVersion: "2019-05-08"
}
let ali = await this.aliclient.reqbyget(aliParams);
this.execClientNew.execLogs("serviceProviderNotification-aliclient:", aliParams, "center-channel-serviceProviderNotification", ali, null);
if (ali && ali.status == 200) {
resFlag = 200
}
}
if(res.data.uapp_id == uappId.ename){
var enameFlag =-200;
//推送数据至易名
var pushObj = {
OrderNo: res.data.channelOrderNo,
OfficialFileURL: res.data.OfficialFileURL,
ApplicationStatus: res.data.ApplicationStatus
};
var rtn = await this.execClient.execEnamePost(pushObj, settings.enameClientUrl()+"AcceptPartnerNotification");
console.log("url+++++",settings.enameClientUrl()+"AcceptPartnerNotification")
console.log("rtn+++++",rtn)
if (!rtn || !rtn.stdout) {
enameFlag = -200;
}else{
var pushRes = JSON.parse(rtn.stdout);
if(pushRes && pushRes.Success && pushRes.Success==true){
enameFlag == 200;
}else{
enameFlag == -200;
}
}
}
if (res.data.uapp_id == uappId.ename) {
//推送数据至易名
let pushObj = {
OrderNo: res.data.channelOrderNo,
OfficialFileURL: res.data.OfficialFileURL,
ApplicationStatus: res.data.ApplicationStatus
};
let eNameUrl = settings.enameClientUrl() + "AcceptPartnerNotification";
let rtn = await self.execClient.execEnamePost(pushObj, eNameUrl);
this.execClientNew.execLogs("serviceProviderNotification-execEnamePost:eNameUrl:" + eNameUrl, pushObj, "center-channel-serviceProviderNotification", rtn, null);
if (rtn && rtn.stdout) {
let pushRes = JSON.parse(rtn.stdout);
if (pushRes && pushRes.Success && pushRes.Success == true) {
resFlag = 200;
}
}
}
if(res.data.uapp_id == uappId.baidu){
res.data.ApplicationStatus = baiduIcpStatus[res.data.ApplicationStatus];
console.log('res.data.channelOrderNo',res.data.channelOrderNo)
//推送数据至百度
var pushObj = {
orderNo: res.data.channelOrderNo,
status: res.data.ApplicationStatus
};
//推送状态变更
var baidu = await this.baiduclient.baiduReqbyget({ path: "/api/bla/provider/license/update", reqbody: pushObj });
console.log('res.data baidu +++++',baidu)
if(baidu && baidu.data && baidu.data.result){
var baiduFlag = 200
}else{
var baiduFlag = -200
}
}
if (res.data.uapp_id == uappId.baidu) {
res.data.ApplicationStatus = baiduIcpStatus[res.data.ApplicationStatus];
//推送数据至百度
let pushObj = {
orderNo: res.data.channelOrderNo,
status: res.data.ApplicationStatus
};
//推送状态变更
let baiduParams = {
path: "/api/bla/provider/license/update",
reqbody: pushObj
}
let baidu = await this.baiduclient.baiduReqbyget(baiduParams);
this.execClientNew.execLogs("serviceProviderNotification-updateStatus-baiduReqbyget:", baiduParams, "center-channel-serviceProviderNotification", baidu, null);
if (baidu && baidu.data && baidu.data.result) {
resFlag = 200
}
if(res.data.uapp_id == uappId.zc360){
pobj.pushObj = res.data;
let zc360 = await this.utils360Sve.pushOrderStatus(pobj);
if(zc360 && zc360.code == 200 && zc360.msg == 'ok' ){
var zc360Flag = 200
}else{
var zc360Flag = -200
}
}
//推送材料数据至百度用于更新订单状态完成
let material = res.data.material;
if (material) {
let pushMaterialObj = {
"businessLicense": {
"createdAt": material.BusinessLicense.CreatedAt || "",
"enterpriseCode": material.BusinessLicense.EnterpriseCode || "",
"legalRepresentative": material.BusinessLicense.LegalRepresentative || "",
"address": material.BusinessLicense.Address || "",
"registeredCapital": material.BusinessLicense.RegisteredCapital || "",
"name": material.BusinessLicense.Name || "",
"businessTerm": material.BusinessLicense.BusinessTerm || "",
"type": material.BusinessLicense.Type || "",
"scopeBusiness": material.BusinessLicense.ScopeBusiness || ""
},
"partnerForeignInvestment": material.PartnerForeignInvestment || "",
"orderNo": res.data.channelOrderNo,
"domain": material.Domain,
"corporateName": material.CorporateName,
"includeForeignInvestment": material.IncludeForeignInvestment,
"partnerBusinessLicense": material.PartnerBusinessLicense,
"partnerIdCardList": material.PartnerIdCardList,
"partnerDomainCertificate": material.PartnerDomainCertificate,
"partnerPreviewOtherList": material.PartnerPreviewOtherList || [],
"partnerPlan": material.PartnerPlan || "",
"partnerLaw": material.PartnerLaw || "",
"partnerStampOtherList": material.PartnerStampOtherList || [],
"partnerSignOtherList": material.PartnerSignOtherList || [],
"partnerSignAndStampOtherList": material.PartnerSignAndStampOtherList || []
};
//推送方案材料
let baiduMaterialParams = {
path: "/api/bla/provider/license/material",
reqbody: pushMaterialObj
}
let baiduMaterial = await self.baiduclient.baiduReqbyget(baiduMaterialParams);
this.execClientNew.execLogs("serviceProviderNotification-updateMaterial-baiduReqbyget:", pushMaterialObj, "center-channel-serviceProviderNotification", baiduMaterial, null);
}
}
if(aliFlag == 200 || baiduFlag == 200 || zc360Flag == 200 || enameFlag == 200){
return system.getResultSuccess();
}
}
if (res.data.uapp_id == uappId.zc360) {
pobj.pushObj = res.data;
let zc360 = await this.utils360Sve.pushOrderStatus(pobj);
if (zc360 && zc360.code == 200 && zc360.msg == 'ok') {
resFlag = 200
}
}
return res;
if (resFlag == 200) {
return system.getResultSuccess();
}
}
}
return res;
} catch (e) {
const stackStr = e.stack ? e.stack : JSON.stringify(e);
this.execClientNew.execLogs("serviceProviderNotification-reqError:", pobj, "center-channel-serviceProviderNotification", null, stackStr);
}
}
return res;
}
//易名退款,关闭订单 2021-3-23
async eNameCloseOrder(pobj){
console.log("eNameCloseOrder+++",pobj)
var pushObj = {}
var orderNo
var note
orderNo = pobj.actionBody.orderNo
note = pobj.actionBody.note
pobj.actionType = "delENameOrder"
var res = await this.utilsOrderSve.delENameOrder(pobj, pobj.actionBody);
if (res.status < 0) {
return system.getResultFail(-5022, "订单关闭失败");
}
console.log('delOrder---',res)
if (res && res.status == 0 && res.data && res.data.channelOrderNo) {
pushObj = {
OrderNo:res.data.channelOrderNo,
Note:note
}
console.log('eNameCloseOrder+++pushObj----',pushObj)
var rtn = await this.execClient.execEnamePost(pushObj, settings.enameClientUrl()+"CloseOrder");
console.log('eNameCloseOrder+++rtn----',rtn)
if(rtn && rtn.stdout){
var pushRes = JSON.parse(rtn.stdout);
if(pushRes && pushRes.Success && pushRes.Success==true){
console.log('ename----',pushRes)
return pushRes
//易名退款,关闭订单 2021-3-23
async eNameCloseOrder(pobj) {
console.log("eNameCloseOrder+++", pobj)
var pushObj = {}
var orderNo
var note
orderNo = pobj.actionBody.orderNo
note = pobj.actionBody.note
pobj.actionType = "delENameOrder"
var res = await this.utilsOrderSve.delENameOrder(pobj, pobj.actionBody);
if (res.status < 0) {
return system.getResultFail(-5022, "订单关闭失败");
}
}
console.log('delOrder---', res)
if (res && res.status == 0 && res.data && res.data.channelOrderNo) {
pushObj = {
OrderNo: res.data.channelOrderNo,
Note: note
}
console.log('eNameCloseOrder+++pushObj----', pushObj)
var rtn = await this.execClient.execEnamePost(pushObj, settings.enameClientUrl() + "CloseOrder");
console.log('eNameCloseOrder+++rtn----', rtn)
if (rtn && rtn.stdout) {
var pushRes = JSON.parse(rtn.stdout);
if (pushRes && pushRes.Success && pushRes.Success == true) {
console.log('ename----', pushRes)
return pushRes
}
}
}
return res
}
return res
}
}
module.exports = BaseCenterOrderService;
\ No newline at end of file
......@@ -7,6 +7,7 @@ const regCfg = require("../../../api/impl/ic/regCfg");
class RegCenterOrderService extends AppServiceBase {
constructor() {
super();
this.execClientNew = system.getObject("util.execClientNew");
this.centerOrderUrl = settings.centerOrderUrl();
this.execClient = system.getObject("util.execClient");
this.cacheManager = system.getObject("db.common.cacheManager");
......@@ -22,7 +23,7 @@ class RegCenterOrderService extends AppServiceBase {
704: 'ENGRAVING', //刻章环节
705: 'SUCCESS', //已完成
706: 'ACTIVE' //服务中
}
}
};
//调用center-order
......@@ -48,7 +49,6 @@ class RegCenterOrderService extends AppServiceBase {
}
async regPaySuccess(pobj) {
console.log('regPaySuccess++++pobj----', pobj)
var sobj = {
actionType: "getRegProducePrice",
actionBody: {
......@@ -60,7 +60,6 @@ class RegCenterOrderService extends AppServiceBase {
appInfo: pobj.appInfo,
actionProcess: pobj.actionProcess
}
console.log('regPaySuccess++++sobj----', sobj)
var url = settings.centerAppUrl() + "action/opProduct/springBoard";
var rtn = await this.execClient.execPost(sobj, url);
if (!rtn || !rtn.stdout) {
......@@ -70,9 +69,6 @@ class RegCenterOrderService extends AppServiceBase {
if (data.status != 0) {
return system.getResultFail(-5010, "产品查询失败");
}
console.log('data----data----', data)
// pobj.actionBody = data.data;
// pobj.actionBody.orderNo = pobj.actionBody.bizId;
pobj.actionBody.totalSum = data.data.price;
pobj.actionBody.orderPrice = data.data.price;
pobj.actionBody.payTotalSum = data.data.price;
......@@ -86,10 +82,8 @@ class RegCenterOrderService extends AppServiceBase {
channelOrderNo: pobj.actionBody.orderNo,
orderStatus: 2
}
console.log('pobj.actionBody------', pobj.actionBody)
var orderrtn = await this.utilsOrderSve.addOrder(pobj, pobj.actionBody);
console.log('orderrtn----', orderrtn)
this.execClientNew.execLogs(`regOrderStatusRegPaySuccess`, pobj, "center-channel-regCenterOrderSve-regPaySuccess", orderrtn, null);
if (orderrtn.status != 0 && orderrtn.status != -1) {
return system.getResultFail(-5012, "订单创建失败");
}
......@@ -105,7 +99,6 @@ class RegCenterOrderService extends AppServiceBase {
return system.getResultFail(-5011, "方案查询失败");
}
var solutiondata = JSON.parse(solutionrtn.stdout);
console.log('solutiondata----', solutiondata)
if (solutiondata.status != 0) {
return system.getResultFail(-5011, "方案查询失败");
}
......@@ -135,8 +128,9 @@ class RegCenterOrderService extends AppServiceBase {
},
appInfo: pobj.appInfo
}
console.log('fqobj----', fqobj)
var baiduPushRes = await this.utilsPushSve.business2Channel(fqobj, "pushOrderICPBusinessNew");
//往云服推送订单
let yunfuRes = await this.utilsPushSve.business2Channel(fqobj, "pushOrderICPBusinessNew");
var deliveryObj = {
actionBody: {
orderNo: orderrtn.data.orderNo,//pobj.actionBody.channelOrder.channelOrderNo,
......@@ -151,10 +145,11 @@ class RegCenterOrderService extends AppServiceBase {
},
appInfo: pobj.appInfo
};
//往资质宝推送订单
if (pobj.actionBody.isDirectBuy && pobj.actionBody.isDirectBuy == 1) {//直接下单需执行添加订单业务员操作
if (baiduPushRes && baiduPushRes.status == 0) {
if (baiduPushRes.data && baiduPushRes.data.data) {
var resData = baiduPushRes.data.data;
if (yunfuRes && yunfuRes.status == 0) {
if (yunfuRes.data && yunfuRes.data.data) {
var resData = yunfuRes.data.data;
var salesmanInfo = {
salesmanName: resData.orderList && resData.orderList.length > 0 ? resData.orderList[0].operatorName : "",
salesmanChannelId: resData.orderList && resData.orderList.length > 0 ? resData.orderList[0].operator : "",
......@@ -162,7 +157,7 @@ class RegCenterOrderService extends AppServiceBase {
var salesmanObj = {
appInfo: pobj.appInfo,
actionType: "addRegSalesmanInfo",//添加业务员信息
actionBody: { salesmanInfo: salesmanInfo, orderNo: orderrtn.data.orderNo }
actionBody: {salesmanInfo: salesmanInfo, orderNo: orderrtn.data.orderNo}
};
var url = settings.centerOrderUrl() + "action/regapi/springBoard";
var addRes = await this.execClient.execPost(salesmanObj, url);
......@@ -261,6 +256,7 @@ class RegCenterOrderService extends AppServiceBase {
pobj.actionType = "submitRegNeed";
var reqUrl = this.centerOrderUrl + "action/regapi/springBoard";
var result = await this.restPostUrl(pobj, reqUrl);
//往云服推送需求
if (result.status == 0) {
pobj.actionBody.description = pobj.actionBody.description + " 成交概率:" + pobj.actionBody.level
if (pobj.actionBody.probability) {
......@@ -297,24 +293,34 @@ class RegCenterOrderService extends AppServiceBase {
return data;
}
//状态更新
/***
* 状态更新
* @param pobj
* @returns {Promise<{msg: *, data: *, status: *}|{msg: *, data, bizmsg: *|string, status: number}|any>}
* status:
1:用户已支付
2:用户已上传(客户上传材料)
3:为资料未确认(暂时不用做处理)
4:用户已确认
11:方案已关闭
*/
async regOrderStatus(pobj) {
var actionBody = pobj.actionBody;
var self = this;
if (actionBody.isDirectBuy && actionBody.isDirectBuy == 1) {
actionBody.bizId = actionBody.orderNo
}
}//直购
if (!actionBody.bizId) {
return system.getResult(null, "actionBody.bizId can not be empty,100495");
}
actionBody.BizId = actionBody.bizId;
if (!actionBody.status) {
return system.getResult(null, "actionBody.status can not be empty,100495");
return system.getResult(null, "actionBody.status can not be empty,100496");
}
pobj.actionType = "regOrderStatus";
var url = settings.centerOrderUrl() + "action/regapi/springBoard";
var rtn = await this.restPostUrl(pobj, url);
console.log('公司宝--rtn---', rtn)
this.execClientNew.execLogs(`regOrderStatusUpdate`, pobj, "center-channel-regCenterOrderSve-reqCenterOrder-regOrderStatus", rtn, null);
if (actionBody.status == 2) {
var deliveryObj = {
actionBody: {
......@@ -330,7 +336,7 @@ class RegCenterOrderService extends AppServiceBase {
appInfo: pobj.appInfo
}
this.utilsPushSve.business2Channel(deliveryObj, "pushDeliveryOrder");
}
}//往资质宝推送
if (rtn.status == 0 && actionBody.status != 1 && actionBody.status != 2 && rtn.data) {
var tmpObj = {
actionBody: {
......@@ -350,7 +356,7 @@ class RegCenterOrderService extends AppServiceBase {
tmpObj.actionBody.orderNo = rtn.data.channelSolutionNo;
self.utilsPushSve.business2Channel(tmpObj, "pushOrderICPClose");
}
}//通知更新状态
}//往资质宝推送更新状态
return rtn;
}
......@@ -548,7 +554,10 @@ class RegCenterOrderService extends AppServiceBase {
note: pobj.actionBody.note
}
// 推送baidu
var tmpResult = await this.baiduRegClient.baiduReqbyget({ path: "/v1/provider/demand?close=", reqbody: pushObj });
var tmpResult = await this.baiduRegClient.baiduReqbyget({
path: "/v1/provider/demand?close=",
reqbody: pushObj
});
//查看日志
this.logCtl.info({
appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "",
......@@ -574,11 +583,11 @@ class RegCenterOrderService extends AppServiceBase {
//提交交付信息/修改订单状态
async regUpdateOrderStatus(pobj) {
var res = await this.reqCenterOrderApi(pobj, "action/regapi/springBoard");
console.log('推送交付信息/修改订单状态res+++++', res)
console.log('推送交付信息/修改订单状态++pobj+++', pobj)
var deliverContent = {}
var pushObj = {}
let self = this;
let res = await this.reqCenterOrderApi(pobj, "action/regapi/springBoard");
this.execClientNew.execLogs("regUpdateOrderStatus-reqCenterOrderApi:", pobj, "center-channel-regUpdateOrderStatus", res, null);
let deliverContent = {}
let pushObj = {}
if (res && res.status == 0 && res.data) {
if (pobj.actionBody.deliverContent) {
if (pobj.actionBody.deliverContent.companyInfo && pobj.actionBody.deliverContent.companyInfo.serviceArea) {
......@@ -624,7 +633,7 @@ class RegCenterOrderService extends AppServiceBase {
consultType: pobj.actionBody.consultType, //需求类型: GSREG:正常原始公司注册; QYJYTC1:企业经营套餐1; QYJYTC2:企业经营套餐2;
productType: pobj.actionBody.productType, //套餐包含业的务类型: 不传为原始公司注册
startTime: pobj.actionBody.startTime || null, //开始时间
endTime: pobj.actionBody.endTime || null //结束时间
endTime: pobj.actionBody.endTime || null //结束时间
};
} else {
pushObj = {
......@@ -636,18 +645,16 @@ class RegCenterOrderService extends AppServiceBase {
};
}
}
var self = this;
let baiduParams = {path: "/v1/provider/comreg", reqbody: pushObj}
//推送交付信息/修改订单状态
var baidu = await self.baiduRegClient.baiduReqbyget({ path: "/v1/provider/comreg", reqbody: pushObj });
console.log('推送交付信息/修改订单状态baidu+++', baidu)
console.log('推送交付信息/修改订单状态pushObj+++', pushObj)
let baidu = await self.baiduRegClient.baiduReqbyget(baiduParams);
this.execClientNew.execLogs("regUpdateOrderStatus-baiduReqbyget:", baiduParams, "center-channel-regUpdateOrderStatus", baidu, null);
//todo 推送云服订单所有交付单状态为完成时订单状态为完成的判断
// if(res.data.deliveryFlag && res.data.deliveryFlag2 && 200 == res.data.deliveryFlag == res.data.deliveryFlag2){
// await this.utilsPushSve.business2Channel("蜂擎参数", "更新订单完成状态的方法");
// }
return baidu.data
}
console.log('rsrsr++++------------++++', res)
}
return res
}
......@@ -672,7 +679,7 @@ class RegCenterOrderService extends AppServiceBase {
reqbody: pushObj
});
if (ress.data.status != 0) {
return system.getResultFail(ress.data.msg)
return system.getResultFail(-1, ress.data.msg)
}
console.log("regWriteCommunicationLog---------", ress)
}
......
......@@ -4,92 +4,74 @@ var settings = require("../../../../config/settings");
//此类用来db中配置来进行调用-主要功能是推送交付系统
class UtilsDeliverSystemService extends AppServiceBase {
constructor() {
super();
this.opPushQueueUrl = settings.opPushQueueUrl();
}
/**
* 推送业务信息到交付系统
* 业务操作的信息不变外加增加组装的一些参数(推送需求商机、关闭需求、订单商机、关闭订单)
* @param {*} pobj
*/
async pushBusiness2DeliverSystem(pobj) {//推送业务信息到交付系统
var verifyResult = await this.verifyParam(pobj);
if (verifyResult.status != 0) {
return await this.disposePushResultFail(pobj, verifyResult, "deliver->pushBusiness2DeliverSystem->verifyResult", this.pushlogFailType.FQ);
constructor() {
super();
this.opPushQueueUrl = settings.opPushQueueUrl();
}
var interface_params_info = verifyResult.data;
// var reqParams = {
// actionType: "produceData",// Y 功能名称
// actionBody: {
// pushUrl: interface_params_info.pushUrl,// Y 推送地址
// actionType: interface_params_info.actionType,// Y 推送地址接收时的功能名称
// notifyUrl: interface_params_info.notifyUrl || "",// N 推送成功后通知的Url
// identifyCode: interface_params_info.identifyCode,// Y 操作的业务标识
// messageBody: pobj.actionBody, // Y 推送的业务消息,必须有一项对象属性值
// headData: interface_params_info.headData //N 请求头信息,Json格式,如:{token:"XXXXXXX"}
// },
// requestId: pobj.requestId || "" // N 请求id
// }
let params=null
let headInfo={}
if(req.appInfo){
headInfo["appcode"]=req.appInfo.app_code
parms = {
actionType:interface_params_info.actionType,
actionBody: pobj.actionBody,
headData:headInfo
}
}else{
parms = {
actionType:interface_params_info.actionType,
actionBody: pobj.actionBody
}
/**
* 推送业务信息到交付系统
* 业务操作的信息不变外加增加组装的一些参数(推送需求商机、关闭需求、订单商机、关闭订单)
* @param {*} pobj
*/
async pushBusiness2DeliverSystem(pobj) {//推送业务信息到交付系统
this.execClientNew.execLogs(`推送资质宝结果->pushBusiness2DeliverSystem`, pobj, "center-channel-utilsDeliverSystemSve-pushBusiness2DeliverSystem", null, null);
var verifyResult = await this.verifyParam(pobj);
if (verifyResult.status != 0) {
return await this.disposePushResultFail(pobj, verifyResult, "deliver->pushBusiness2DeliverSystem->verifyResult", this.pushlogFailType.FQ);
}
var interface_params_info = verifyResult.data;
let params = null
let headInfo = {}
if (pobj.appInfo) {
headInfo["appcode"] = pobj.appInfo.app_code
params = {
actionType: interface_params_info.actionType,
actionBody: pobj.actionBody,
headData: headInfo
}
} else {
params = {
actionType: interface_params_info.actionType,
actionBody: pobj.actionBody
}
}
let url = interface_params_info.opUrl;
var opQueuePushClientPostRes = await this.opQueuePushClientPost(pobj, url, params);
return await this.disposePushResult(pobj, opQueuePushClientPostRes, "delivery->pushBusiness2DeliverSystem->result", this.pushlogFailType.FQ);
}
let url = interface_params_info.opUrl;
var opQueuePushClientPostRes = await this.opQueuePushClientPost(pobj, url, parms);
return await this.disposePushResult(pobj, opQueuePushClientPostRes, "delivery->pushBusiness2DeliverSystem->result", this.pushlogFailType.FQ);
}
//--------------------------------------------------内部辅助方法-------------------start-----------------
//--------------------------------------------------内部辅助方法-------------------start-----------------
async opQueuePushClientPost(pobj, pushQueueUrl, reqParams) {
try {
var rtn = await this.restPostUrl(reqParams, pushQueueUrl);
if (rtn.status != 1) {
this.execClientNew.execLogs(`推送资质宝失败->opQueuePushClientPost`, pobj, "center-channel-utilsDeliverSystemSve-opQueuePushClientPost", rtn, JSON.stringify(rtn));
return system.getResult(null, "推送资质宝失败,失败原因:" + JSON.stringify(rtn));
}
return system.getResultSuccess(null, "推送成功");
} catch (e) {
//日志记录
// this.logCtl.error({
// appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "",
// appkey: pobj.appInfo ? pobj.appInfo.uapp_key || "" : "",
// requestId: pobj.requestId || "",
// op: "utilsSve/utilsDeliverSystemSve/opQueuePushClientPost",
// content: "error:" + e.stack,
// // clientIp: pobj.clientIp,
// optitle: pobj.opType + "推送操作异常deliver->opQueuePushClientPost",
// });
this.execClientNew.execLogs(`推送资质宝失败->opQueuePushClientPost`, pobj, "center-channel-utilsDeliverSystemSve-opQueuePushClientPost", null, JSON.stringify(e.stack));
return system.getResult(null, "推送操作异常deliver->opQueuePushClientPost->error:" + e.stack);
}
}
async verifyParam(pobj) {//参数信息验证
var verify = system.getResultSuccess();
if (!pobj.interface_params) {
verify = system.getResult(null, "interface_params can not be empty,100400");
async opQueuePushClientPost(pobj, pushQueueUrl, reqParams) {
try {
var rtn = await this.restPostUrl(reqParams, pushQueueUrl);
this.execClientNew.execLogs(`推送资质宝结果->opQueuePushClientPost->url:` + pushQueueUrl, reqParams, "center-channel-utilsDeliverSystemSve-opQueuePushClientPost", rtn, null);
if (rtn.status != 1) {
return system.getResult(null, "推送资质宝失败,失败原因:" + JSON.stringify(rtn));
}
return system.getResultSuccess(null, "推送成功");
} catch (e) {
const stackStr = e.stack ? e.stack : JSON.stringify(e);
this.execClientNew.execLogs(`推送操作异常deliver->opQueuePushClientPost`, pobj, "center-channel-utilsDeliverSystemSve-opQueuePushClientPost", null, stackStr);
return system.getResult(null, "推送操作异常deliver->opQueuePushClientPost->error:" + stackStr);
}
}
var interface_params_info = JSON.parse(pobj.interface_params);
if (!interface_params_info || !interface_params_info.opUrl || !interface_params_info.headData) {
verify = system.getResult(null, "interface_params(opUrl、headData) can not be empty,100430");
async verifyParam(pobj) {//参数信息验证
var verify = system.getResultSuccess();
if (!pobj.interface_params) {
verify = system.getResult(null, "interface_params can not be empty,100400");
}
var interface_params_info = JSON.parse(pobj.interface_params);
if (!interface_params_info || !interface_params_info.opUrl || !interface_params_info.headData) {
verify = system.getResult(null, "interface_params(opUrl、headData) can not be empty,100430");
}
verify.data = interface_params_info;
return verify;
}
verify.data = interface_params_info;
return verify;
}
//--------------------------------------------------内部辅助方法-------------------end-----------------
//--------------------------------------------------内部辅助方法-------------------end-----------------
}
module.exports = UtilsDeliverSystemService;
......@@ -164,7 +164,6 @@ class UtilsOrderService extends AppServiceBase {
pobj.actionType = "addOrder";
var reqUrl = this.centerOrderUrl + "action/order/springBoard";
// console.log(pobj);
var result = await this.execPostByTimeOut(null, pobj, reqUrl);
if (result.status != 0) {
return result;
......
......@@ -3,108 +3,87 @@ const sha256 = require('sha256');
const system = require("../system");
var settings = require("../../config/settings");
const AppServiceBase = require("../service/app.base");
class baiduClient extends AppServiceBase{
constructor() {
super();
this.pushlogSve = system.getObject("service.common.pushlogSve");
this.execClient = system.getObject("util.execClient");
this.baiduClientParams = settings.baiduClientParams();
}
//2020 1027 laolan 调用百度网关
async baiduPost( path, actionBody) {
console.log('actionBody++',actionBody)
let domain = this.baiduClientParams.domain;
let url = domain+path;
let version ="bce-auth-v1";
let accessKey = this.baiduClientParams.accessKey;
let secretKey = this.baiduClientParams.secretKey;
let timestamp = new Date().toISOString()
let site = timestamp.lastIndexOf(".");
timestamp = timestamp.substring(0,site)+"Z"
let signedHeaders = "host";
let extime = 1800;
let canonicalHeaders = "host:"+this.baiduClientParams.host;
//中间结果1:规范化请求和前缀字符串
var canonicalRequest = null
var pathParams = path.split("?");
if(pathParams && pathParams.length > 1){
canonicalRequest = "POST" + "\n" + pathParams[0] + "\n" + pathParams[1] + "\n" + canonicalHeaders;
}else{
canonicalRequest = "POST" + "\n" + path + "\n" + "\n" + canonicalHeaders;
}
// let canonicalRequest = "POST" + "\n" + path + "\n" + "\n" + canonicalHeaders;
console.log('canonicalRequest+++++++',canonicalRequest)
//authStringPrefix(前缀字符串,由除sk字段外的签名信息生成)
let authStringPrefix = version+"/"+accessKey+"/"+timestamp+"/"+extime;
//中间结果2:派生签名密钥 signingKey
let signingKey = crypto.createHmac('sha256', secretKey)
.update(authStringPrefix)
.digest('hex');
//中间结果3:签名摘要 signature
let signature = crypto.createHmac('sha256', signingKey)
.update(canonicalRequest)
.digest('hex');
//最终结果:认证字符串 authorization
let authorization = authStringPrefix+"/"+signedHeaders+"/"+signature;
var baiduObj={
authorization:authorization,
data:actionBody
class baiduClient extends AppServiceBase {
constructor() {
super();
this.pushlogSve = system.getObject("service.common.pushlogSve");
this.execClient = system.getObject("util.execClient");
this.baiduClientParams = settings.baiduClientParams();
}
var rtn = await this.execClient.execBaiduPost(baiduObj, url);
if (!rtn || !rtn.stdout) {
this.execClientNew.execLogs(`baiduClient-opBaiduClientPost-result:url=${url}`, actionBody, "center-channel-opBaiduClientPost", null, rtn);
return system.getResult(null, rtn);
//2020 1027 laolan 调用百度网关
async baiduPost(path, actionBody) {
console.log('baiduPost-actionBody++', actionBody)
let domain = this.baiduClientParams.domain;
let url = domain + path;
let version = "bce-auth-v1";
let accessKey = this.baiduClientParams.accessKey;
let secretKey = this.baiduClientParams.secretKey;
let timestamp = new Date().toISOString()
let site = timestamp.lastIndexOf(".");
timestamp = timestamp.substring(0, site) + "Z"
let signedHeaders = "host";
let extime = 1800;
let canonicalHeaders = "host:" + this.baiduClientParams.host;
//中间结果1:规范化请求和前缀字符串
let canonicalRequest = null
let pathParams = path.split("?");
if (pathParams && pathParams.length > 1) {
canonicalRequest = "POST" + "\n" + pathParams[0] + "\n" + pathParams[1] + "\n" + canonicalHeaders;
} else {
canonicalRequest = "POST" + "\n" + path + "\n" + "\n" + canonicalHeaders;
}
// let canonicalRequest = "POST" + "\n" + path + "\n" + "\n" + canonicalHeaders;
console.log('canonicalRequest+++++++', canonicalRequest)
//authStringPrefix(前缀字符串,由除sk字段外的签名信息生成)
let authStringPrefix = version + "/" + accessKey + "/" + timestamp + "/" + extime;
//中间结果2:派生签名密钥 signingKey
let signingKey = crypto.createHmac('sha256', secretKey)
.update(authStringPrefix)
.digest('hex');
//中间结果3:签名摘要 signature
let signature = crypto.createHmac('sha256', signingKey)
.update(canonicalRequest)
.digest('hex');
//最终结果:认证字符串 authorization
let authorization = authStringPrefix + "/" + signedHeaders + "/" + signature;
let baiduObj = {
authorization: authorization,
data: actionBody
}
let rtn = await this.execClient.execBaiduPost(baiduObj, url);
this.execClientNew.execLogs(`baiduClient-baiduPost-result:url=${url}`, baiduObj, "center-channel-opBaiduClientPost", rtn, null);
if (!rtn || !rtn.stdout) {
this.execClientNew.execLogs(`baiduClient-opBaiduClientPost-result:url=${url}`, actionBody, "center-channel-opBaiduClientPost", null, rtn);
return system.getResult(null, rtn);
}
let result = JSON.parse(rtn.stdout);
return result;
}
var result = JSON.parse(rtn.stdout);
return result;
}
//百度接口 2020-10-27 laolan
async baiduReqbyget(obj, cbk) {
var path = obj.path;
var reqbody = obj.reqbody;
try {
var res = await this.baiduPost( path, reqbody, {
timeout: 10000, // default 3000 ms 修改3000为10000,原因ConfirmIcpIntention BizIds 超过5条会超时
formatAction: true, // default true, format the action to Action
formatParams: true, // default true, format the parameter name to first letter upper case
method: 'POST', // set the http method, default is GET
headers: {
host:this.baiduClientParams.host
}, // set the http request headers
});
if(res.status == 0){
await this.disposePushResult(obj, res, "baidu->pushBusiness2Baidu->result", "");
}else{
await this.disposePushResultFail(obj, res, "badiu->pushBusiness2Baidu->catchError", this.pushlogFailType.FAILLOG);
}
// this.pushlogSve.createDb({
// op: "new-baiduReqbyget",
// content: JSON.stringify(obj),//推送的参数信息
// resultInfo: JSON.stringify(res),
// returnType: '1',
// logLevel: '1',
// opTitle: "new-baiduReqbyget推送百度信息返回成功"
// });
return system.getResultSuccess(res);
} catch (e) {
await this.disposePushResultFail(obj, e, "badiu->pushBusiness2Baidu->catchError", this.pushlogFailType.FAILLOG);
// this.pushlogSve.createFailLogDb({
// appid: obj.appInfo ? obj.appInfo.uapp_id || "" : "",
// appkey: obj.appInfo ? obj.appInfo.uapp_key || "" : "",
// requestId: obj.requestId || "",
// content: JSON.stringify(obj),//推送的参数信息
// resultInfo: "error:" + JSON.stringify(e),
// clientIp: obj.clientIp || "",
// failType: 1,
// opTitle: "new-baiduReqbyget推送百度信息返回异常",
// pushNumber: obj.pushNumber || 1
// });
return system.getResultFail(-200, "出现异常,error:" + e.stack);
//百度接口 2020-10-27 laolan
async baiduReqbyget(obj, cbk) {
var path = obj.path;
var reqbody = obj.reqbody;
try {
var res = await this.baiduPost(path, reqbody, {
timeout: 10000, // default 3000 ms 修改3000为10000,原因ConfirmIcpIntention BizIds 超过5条会超时
formatAction: true, // default true, format the action to Action
formatParams: true, // default true, format the parameter name to first letter upper case
method: 'POST', // set the http method, default is GET
headers: {
host: this.baiduClientParams.host
}, // set the http request headers
});
return system.getResultSuccess(res);
} catch (e) {
await this.disposePushResultFail(obj, e, "badiu->baiduReqbyget->catchError", this.pushlogFailType.FAILLOG);
return system.getResultFail(-200, "出现异常,error:" + e.stack);
}
}
}
}
module.exports = baiduClient;
// var task = new baiduClient();
// console.log(task.baiduClientParams,"11111111111111111");
\ No newline at end of file
......@@ -6,12 +6,13 @@ class baiduRegClient {
constructor() {
this.pushlogSve = system.getObject("service.common.pushlogSve");
this.execClient = system.getObject("util.execClient");
this.execClientNew = system.getObject("util.execClientNew");
this.baiduRegClientParams = settings.baiduRegClientParams();
}
//2020 1027 laolan 调用百度网关
async baiduPost( path, actionBody) {
console.log('actionBody++',actionBody)
// console.log('actionBody++',actionBody)
let domain = this.baiduRegClientParams.domain;
let url = domain+path;
let version ="bce-auth-v1";
......@@ -32,7 +33,7 @@ class baiduRegClient {
canonicalRequest = "POST" + "\n" + path + "\n" + "\n" + canonicalHeaders;
}
// let canonicalRequest = "POST" + "\n" + path + "\n" + "\n" + canonicalHeaders;
console.log('canonicalRequest+++++++',canonicalRequest)
// console.log('canonicalRequest+++++++',canonicalRequest)
//authStringPrefix(前缀字符串,由除sk字段外的签名信息生成)
let authStringPrefix = version+"/"+accessKey+"/"+timestamp+"/"+extime;
//中间结果2:派生签名密钥 signingKey
......@@ -50,9 +51,10 @@ class baiduRegClient {
data:actionBody
}
var rtn = await this.execClient.execBaiduPost(baiduObj, url);
console.log("baiduObj+++++",baiduObj)
console.log("url+++++",url)
console.log("rtn+++++",rtn)
this.execClientNew.execLogs("api-center-channel-baiduPost:"+url, baiduObj, "center-channel-baiduPost", rtn, null);
// console.log("baiduObj+++++",baiduObj)
// console.log("url+++++",url)
// console.log("rtn+++++",rtn)
if (!rtn || !rtn.stdout) {
return system.getResult(null, "execPost data is empty");
}
......
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