Commit 6a20e8a3 by 兰国旗

laolan

parent 0f46314d
...@@ -24,6 +24,7 @@ class RegAPI extends APIBase { ...@@ -24,6 +24,7 @@ class RegAPI extends APIBase {
var opResult = null; var opResult = null;
switch (action_type) { switch (action_type) {
//-----------接入百度reg------start----laolan--2020.12.17---------------------------- //-----------接入百度reg------start----laolan--2020.12.17----------------------------
//---------2.
case "submitRegNeed"://提交需求 case "submitRegNeed"://提交需求
opResult = await this.regCenterOrderSve.submitRegNeed(pobj, pobj.actionBody); opResult = await this.regCenterOrderSve.submitRegNeed(pobj, pobj.actionBody);
break; break;
...@@ -46,7 +47,7 @@ class RegAPI extends APIBase { ...@@ -46,7 +47,7 @@ class RegAPI extends APIBase {
case "getSolutionByChannelOrderNo"://根据渠道订单获取方案信息 case "getSolutionByChannelOrderNo"://根据渠道订单获取方案信息
opResult = await this.regCenterOrderSve.getSolutionByChannelOrderNo(pobj, pobj.actionBody); opResult = await this.regCenterOrderSve.getSolutionByChannelOrderNo(pobj, pobj.actionBody);
break; break;
//------------3.
case "submitRegSolution"://方案提交 case "submitRegSolution"://方案提交
opResult = await this.regCenterOrderSve.submitRegSolution(pobj); opResult = await this.regCenterOrderSve.submitRegSolution(pobj);
break; break;
...@@ -59,8 +60,11 @@ class RegAPI extends APIBase { ...@@ -59,8 +60,11 @@ class RegAPI extends APIBase {
case "updateOrdertatus"://提交交付信息/修改订单状态 case "updateOrdertatus"://提交交付信息/修改订单状态
opResult = await this.regCenterOrderSve.updateOrdertatus(pobj); opResult = await this.regCenterOrderSve.updateOrdertatus(pobj);
break; break;
case "closeBdRegNeed"://需求关闭 case "regNeedClose"://需求关闭
opResult = await this.regCenterOrderSve.closeBdRegNeed(pobj); opResult = await this.regCenterOrderSve.regNeedClose(pobj);
break;
case "getRegInfoByChannelNeedNo"://获取需求方案列表
opResult = await this.regCenterOrderSve.reqCenterOrderApi(pobj,"action/regapi/springBoard");
break; break;
// case "closeRegSolution"://服务商方案关闭 // case "closeRegSolution"://服务商方案关闭
// opResult = await this.regCenterOrderSve.closeRegSolution(pobj); // opResult = await this.regCenterOrderSve.closeRegSolution(pobj);
......
...@@ -13,12 +13,12 @@ class RegCenterOrderService extends AppServiceBase { ...@@ -13,12 +13,12 @@ class RegCenterOrderService extends AppServiceBase {
this.utilsPushSve = system.getObject("service.utilsSve.utilsPushSve"); this.utilsPushSve = system.getObject("service.utilsSve.utilsPushSve");
this.opPushQueueUrl = settings.opPushQueueUrl(); this.opPushQueueUrl = settings.opPushQueueUrl();
this.baiduclient = system.getObject("util.baiduClient"); this.baiduclient = system.getObject("util.baiduClient");
this.baiduRegclient = system.getObject("util.baiduRegclient"); this.baiduRegClient = system.getObject("util.baiduRegClient");
this.utilsOrderSve = system.getObject("service.utilsSve.utilsOrderSve"); this.utilsOrderSve = system.getObject("service.utilsSve.utilsOrderSve");
}; };
//调用center-order //调用center-order
async reqCenterOrderApi(pobj, reqUrl) { async reqCenterOrderApi(pobj, reqUrl) {
var url = this.centerOrderUrl + "action/regCenterOrder/springBoard"; var url = this.centerOrderUrl + "action/regapi/springBoard";
if (reqUrl) { if (reqUrl) {
var url = this.centerOrderUrl + reqUrl; var url = this.centerOrderUrl + reqUrl;
} }
...@@ -26,9 +26,9 @@ class RegCenterOrderService extends AppServiceBase { ...@@ -26,9 +26,9 @@ class RegCenterOrderService extends AppServiceBase {
var data = JSON.parse(rtn.stdout); var data = JSON.parse(rtn.stdout);
return data; return data;
} }
//调用center-order reg需求反馈 //调用center-order reg需求反馈 2.2
async reqCenterOrderRegApi(pobj, reqUrl) { async reqCenterOrderRegApi(pobj, reqUrl) {
var url = this.centerOrderUrl + "action/regCenterOrderSve/springBoard"; var url = this.centerOrderUrl + "action/regapi/springBoard";
if (reqUrl) { if (reqUrl) {
var url = this.centerOrderUrl + reqUrl; var url = this.centerOrderUrl + reqUrl;
} }
...@@ -261,9 +261,9 @@ async regPaySuccess(pobj) { ...@@ -261,9 +261,9 @@ async regPaySuccess(pobj) {
this.utilsPushSve.baiduBusiness2Fq(pobj, "pushNeedICPBusinessNew"); this.utilsPushSve.baiduBusiness2Fq(pobj, "pushNeedICPBusinessNew");
} }
return result; return result;
} }
//状态更新 //状态更新
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) {
...@@ -276,8 +276,8 @@ async regOrderStatus(pobj) { ...@@ -276,8 +276,8 @@ async regOrderStatus(pobj) {
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,100495");
} }
pobj.actionType = "receiveOrderStatusNotify"; pobj.actionType = "regOrderStatus";
var url = settings.centerOrderUrl() + "action/qcapi/springBoard"; var url = settings.centerOrderUrl() + "action/regapi/springBoard";
var rtn = await this.restPostUrl(pobj, url); var rtn = await this.restPostUrl(pobj, url);
if (actionBody.status == 2) { if (actionBody.status == 2) {
var deliveryObj = { var deliveryObj = {
...@@ -316,12 +316,14 @@ async regOrderStatus(pobj) { ...@@ -316,12 +316,14 @@ async regOrderStatus(pobj) {
} }
}//通知更新状态 }//通知更新状态
return rtn; return rtn;
} }
//关闭reg订单
async regOrderClose(pobj) {
//关闭reg订单
async regOrderClose(pobj) {
var actionBody = pobj.actionBody; var actionBody = pobj.actionBody;
var self = this; var self = this;
var url = settings.centerOrderUrl() + "action/qcapi/springBoard"; var url = settings.centerOrderUrl() + "action/regapi/springBoard";
var rtn = await this.restPostUrl(pobj, url); var rtn = await this.restPostUrl(pobj, url);
if (rtn.status == 0 && rtn.data) { if (rtn.status == 0 && rtn.data) {
var channelOrderNo = pobj.actionBody.orderNo; var channelOrderNo = pobj.actionBody.orderNo;
...@@ -352,10 +354,61 @@ async regOrderClose(pobj) { ...@@ -352,10 +354,61 @@ async regOrderClose(pobj) {
self.utilsPushSve.baiduBusiness2Fq(tmpObj2, "pushOrderICPClose"); self.utilsPushSve.baiduBusiness2Fq(tmpObj2, "pushOrderICPClose");
}//通知更新状态 }//通知更新状态
return rtn; return rtn;
} }
//提交交付信息/修改订单状态
async updateOrdertatus(pobj) {
var res = await this.reqCenterOrderApi(pobj, "action/regapi/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(res.data.uapp_id == regCfg.uappId.baidu){
//推送数据至百度
var BizId = needsolution.orderChannelNo;
console.log('BizId++',BizId)
var pushObj = {
orderNo:,
status :,
deliverContent :
};
var self = this;
//推送交付信息/修改订单状态
var baidu = await self.baiduclient.baiduReqbyget({ path: "/api/bla/provider/license/material", reqbody: pushObj });
console.log('推送交付信息/修改订单状态baidu+++',baidu)
}
console.log('rsrsr++++------------++++',res)
return res
}
}
//通知交付状态变更
// async serviceProviderNotification(pobj) {
// console.log('zhuangtai ++++',pobj)
// var res = await this.reqCenterOrderApi(pobj, "action/regCenterOrder/springBoard");
// if (res && res.status == 0 && res.data) {
// if(res.data.uapp_id == regCfg.uappId.baidu){
// res.data.ApplicationStatus = baiduRegStatus[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)
// return res;
// }
// }
// }
//--------------3.
//提交reg注册方案 //提交reg注册方案
async submitRegSolution(pobj) { async submitRegSolution(pobj) {
console.log('reg --- pobj -----',pobj) console.log('reg --- pobj -----',pobj)
...@@ -364,31 +417,13 @@ async regOrderClose(pobj) { ...@@ -364,31 +417,13 @@ async regOrderClose(pobj) {
console.log('reg --- res -----',res) console.log('reg --- res -----',res)
var needinfo = res.data.needinfo;//需求信息 var needinfo = res.data.needinfo;//需求信息
var needsolutions = res.data.needsolutions;//方案信息 var needsolutions = res.data.needsolutions;//方案信息
// var ab = pobj.actionBody;
// if (typeof (ab.solutionContent) == "string") {
// ab.solutionContent = JSON.parse(ab.solutionContent);
// }
// if (typeof (needsolutions.solutionContent) == "string") {
// needsolutions.solutionContent = JSON.parse(needsolutions.solutionContent);
// }
// var solution = needsolutions.solutionContent.solution;
var self = this; var self = this;
var bizTypes;
var solutionList = [];
if(needinfo.uapp_id == regCfg.uappId.baidu){ if(needinfo.uapp_id == regCfg.uappId.baidu){
//推送数据至baidu //推送数据至baidu
// solution.Area = regCfg.baiduAreaCode[solution.Area]
// console.log('solution.Area++',solution.Area)
// var pushObj = {
// intentionBizId: needinfo.channelNeedNo,
// solutionList:{
// gsbBizId:"",
// bizType:"",
// solutionContent:""
// },
// };
var i=0; var i=0;
var needsolutionsLength = needsolutions.length; var needsolutionsLength = needsolutions.length;
var bizTypes;
var solutionList = [];
for(i=0;i<needsolutionsLength;i++){ for(i=0;i<needsolutionsLength;i++){
bizTypes = needsolutions[i].solutionContent; bizTypes = needsolutions[i].solutionContent;
console.log('bizTypes-----',bizTypes) console.log('bizTypes-----',bizTypes)
...@@ -407,10 +442,7 @@ async regOrderClose(pobj) { ...@@ -407,10 +442,7 @@ async regOrderClose(pobj) {
solutionList:solutionList solutionList:solutionList
}; };
console.log('pushObj---pushObj---',pushObj) console.log('pushObj---pushObj---',pushObj)
// if (needsolutions.channelSolutionNo) { var pushBaiduRegSolution = await this.pushBaiduRegSolution(pushObj, pobj.appInfo, self);
// pushObj["bizId"] = needsolutions.channelSolutionNo;
// }
var pushBaiduRegSolution = await this.pushBaiduRegSolution(pushObj, needsolutions.solutionNo, pobj.appInfo, self);
console.log('pushBaiduRegSolution+++',pushBaiduRegSolution) console.log('pushBaiduRegSolution+++',pushBaiduRegSolution)
} }
this.logCtl.info({ this.logCtl.info({
...@@ -435,124 +467,158 @@ async regOrderClose(pobj) { ...@@ -435,124 +467,158 @@ async regOrderClose(pobj) {
return res; return res;
} }
//推送reg方案 //推送reg方案
async pushBaiduRegSolution(pushObj, solutionNo, appInfo, self) { async pushBaiduRegSolution(pushObj, appInfo, self) {
console.log('pushObj++baidu+++',pushObj) console.log('pushObj++baidu+++',pushObj)
//推送方案信息 //推送方案信息
var pushRes = await self.baiduRegclient.baiduReqbyget({ path: "/v1/provider/demand?submitSolutions=", reqbody: pushObj }); var pushRes = await self.baiduRegClient.baiduReqbyget({ path: "/v1/provider/demand?submitSolutions=", 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.infos) {
var reqObj2 = { var reqObj2 = {
actionType: "receiveProgrammeNo", actionType: "saveReginfo",
appInfo: appInfo, appInfo: appInfo,
actionBody: { actionBody: {
solutionNo: solutionNo, infos: resData.infos
solutionBizId: resData.planId
} }
}; };
var a = await self.reqCenterOrderApi(reqObj2);//保存渠道方案id var a = await self.reqCenterOrderApi(reqObj2);//保存渠道方案id,用户确认方案url
console.log("保存渠道方案id aaaa++ ",a) console.log("保存渠道方案id,用户确认方案url 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)
return url;
} }
} }
//reg回写沟通记录
async writeRegCommunicationLog(pobj) {
var self = this;
var reqUrl = this.centerOrderUrl + "action/regapi/springBoard";
var result = await this.restPostUrl(pobj, reqUrl);
var pushObj = {}
if (result && result.status == 0 && result.data) {
pushObj = {
requirementId: pobj.actionBody.intentionBizId,
note: pobj.actionBody.note
} }
if (result.data == regCfg.uappId.baidu) {
var ress = await self.baiduRegClient.baiduReqbyget({ path: "/v1/provider/demand?addCommRecord=", reqbody: pushObj });
console.log("baidu+res", ress)
} }
//提交交付信息/修改订单状态
async updateOrdertatus(pobj) {
var res = await this.reqCenterOrderApi(pobj, "action/regCenterOrder/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;
if(res.data.uapp_id == regCfg.uappId.baidu){ //推送交付系统
//推送数据至百度 var reqParams = {
var BizId = needsolution.orderChannelNo; actionBody: {
console.log('BizId++',BizId) intentionBizId: pobj.actionBody.intentionBizId,
var pushObj = { status: "followingUp"
"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 || "", opType: "updateChanceStatus",
"orderNo": BizId, appInfo: pobj.appInfo
"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+++',baidu)
} }
console.log('rsrsr++++------------++++',res) self.utilsPushSve.aliBusiness2Delivery(reqParams, "updateChanceStatus");
return res var fqobj = {
actionBody: {
"bizId": pobj.actionBody.intentionBizId,
"follow_date": (new Date()).toISOString(),
"follow_content": pobj.actionBody.note
},
opType: "aliFollowup",
appInfo: pobj.appInfo
} }
self.utilsPushSve.aliBusiness2Fq(fqobj, "aliFollowup");
return system.getResultSuccess();
} }
//reg查询沟通记录
async queryExpertRegCommunicationLogs(pobj) {
var reqUrl = this.centerOrderUrl + "action/regapi/springBoard";
var result = await this.restPostUrl(pobj, reqUrl);
console.log('jilu+++result++++', result)
if (result && result.status == 0 && result.data && result.data.uapp_id) {
var pushObj = {};
if (result.data.uapp_id == regCfg.uappId.baidu) {
console.log("bbbbb++", pobj)
pushObj = {
beginTime: pobj.actionBody.BeginTime ? pobj.actionBody.BeginTime : "",
endTime: pobj.actionBody.EndTime ? pobj.actionBody.EndTime : "",
intentionBizId: pobj.actionBody.intentionBizId
}
var res = await this.baiduRegClient.baiduReqbyget({
path: "/v1/provider/demand?listCommRecords=", reqbody: pushObj });
console.log('xxcc+++', res)
}
}
if(res && res.data && res.data.infos){
res.data['Data'] = res.data.infos
}
return system.getResultSuccess(res);
}
//通知交付状态变更
// async serviceProviderNotification(pobj) {
// console.log('zhuangtai ++++',pobj)
// var res = await this.reqCenterOrderApi(pobj, "action/regCenterOrder/springBoard");
// if (res && res.status == 0 && res.data) {
// if(res.data.uapp_id == regCfg.uappId.baidu){
// res.data.ApplicationStatus = baiduRegStatus[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)
// return res;
// }
// }
// }
//reg关闭需求
async regNeedClose(pobj) {
pobj.actionBody.intentionBizId = pobj.actionBody.channelNeedNo;
pobj.actionType = "regNeedClose"
var reqUrl = this.centerOrderUrl + "action/regapi/springBoard";
var result = await this.restPostUrl(pobj, reqUrl);
console.log('regNeedClose+++result', result)
var i;
var len = result.data.length
var orders = []
if (result.status == 0) {
for(i=0;i<len;i++){
if (result.data && result.data[i].orderNo) {
orders.push(result.data[i].orderNo)
pobj.actionBody.orderNo = orders;
var orderrtn = await this.utilsOrderSve.delOrders(pobj, pobj.actionBody);
if (orderrtn.status < 0) {
return system.getResultFail(-5022, "订单关闭失败");
}
}
}
//推送交付系统
var reqParams = {
actionBody: {
intentionBizId: pobj.actionBody.needNo,
status: "closeNeed"
},
opType: "updateChanceStatus",
appInfo: pobj.appInfo
}
this.utilsPushSve.aliBusiness2Delivery(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/regCenterOrderSve.js/regNeedClose",
content: JSON.stringify(reqParams),
resultInfo: "",
optitle: "updateChanceStatus推送蜂擎获取的接口信息->aliBusiness2Delivery",
});
var pushObj = {
IntentionBizId: pobj.actionBody.needNo,
Note: pobj.actionBody.note
}
// 推送baidu
var a = await this.baiduRegClient.baiduReqbyget({ path: "/v1/provider/demand?close=", pushObj});
console.log('regNeedClose+++', a)
//查看日志
this.logCtl.info({
appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "",
appkey: pobj.appInfo ? pobj.appInfo.uapp_key || "" : "",
requestId: pobj.requestId || "",
op: "service/impl/common/regCenterOrderSve.js/regNeedClose",
content: JSON.stringify(a),
resultInfo: "",
optitle: "推送baidu-reg关闭需求->closeNeed",
});
this.utilsPushSve.aliBusiness2Fq(pobj, "pushCloseICPNeed");
}
return result;
}
//-----------接入百度reg------end---------------------------------- //-----------接入百度reg------end----------------------------------
} }
......
...@@ -117,6 +117,16 @@ class UtilsOrderService extends AppServiceBase { ...@@ -117,6 +117,16 @@ class UtilsOrderService extends AppServiceBase {
var result = await this.restPostUrl(pobj, reqUrl); var result = await this.restPostUrl(pobj, reqUrl);
return result; return result;
} }
//reg关闭订单2020-12-20
async delOrders(pobj, actionBody) {
if (!actionBody.orderNo) {
return system.getResult(null, "actionBody.orderNo can not be empty,100025");
}
var reqUrl = this.centerOrderUrl + "action/order/springBoard";
var result = await this.restPostUrl(pobj, reqUrl);
return result;
}
async getOrderInfo(pobj, actionBody) { async getOrderInfo(pobj, actionBody) {
var reqUrl = this.centerOrderUrl + "action/order/springBoard"; var reqUrl = this.centerOrderUrl + "action/order/springBoard";
var result = await this.restPostUrl(pobj, reqUrl); var result = await this.restPostUrl(pobj, reqUrl);
......
...@@ -2,7 +2,7 @@ const crypto = require('crypto'); ...@@ -2,7 +2,7 @@ const crypto = require('crypto');
const sha256 = require('sha256'); const sha256 = require('sha256');
const system = require("../system"); const system = require("../system");
var settings = require("../../config/settings"); var settings = require("../../config/settings");
class baiduClient { 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");
...@@ -100,6 +100,6 @@ class baiduClient { ...@@ -100,6 +100,6 @@ class baiduClient {
} }
} }
} }
module.exports = baiduClient; module.exports = baiduRegClient;
// var task = new baiduClient(); // var task = new baiduRegClient();
// console.log(task.baiduRegClientParams,"11111111111111111"); // console.log(task.baiduRegClientParams,"11111111111111111");
\ No newline at end of file
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