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