Commit 4c9bf6ab by 王悦

Merge remote-tracking branch 'origin/center-channel' into center-channel

parents 2854206b 8958cc56
...@@ -6,6 +6,8 @@ class QcAPI extends APIBase { ...@@ -6,6 +6,8 @@ class QcAPI extends APIBase {
super(); super();
this.qcCenterOrderSve = system.getObject("service.common.qcCenterOrderSve"); this.qcCenterOrderSve = system.getObject("service.common.qcCenterOrderSve");
this.baseOrderSve = system.getObject("service.common.baseCenterOrderSve"); this.baseOrderSve = system.getObject("service.common.baseCenterOrderSve");
this.ncSve = system.getObject("service.common.ncSve");
this.rtSve = system.getObject("service.common.rtSve");
} }
/** /**
* 接口跳转-POST请求 * 接口跳转-POST请求
...@@ -54,42 +56,70 @@ class QcAPI extends APIBase { ...@@ -54,42 +56,70 @@ class QcAPI extends APIBase {
opResult = await this.qcCenterOrderSve.closeOrderDelivery(pobj); opResult = await this.qcCenterOrderSve.closeOrderDelivery(pobj);
break; break;
// --------- 网文 --------- // --------- 网文 ---------
case "ncServiceSubmitOption"://服务商提交服务操作(文网文)2020-9-26 case "ncGetNeedList"://查询需求列表(网文)2020-11-11
opResult = await this.qcCenterOrderSve.ncServiceSubmitOption(pobj); opResult = await this.ncSve.ncGetNeedList(pobj);
break; break;
case "ncSubmitSolution"://提交方案(文网文)2020-9-26 case "ncSubmitMaterial"://交付材料提交(网文)2020-11-11
opResult = await this.qcCenterOrderSve.ncSubmitSolution(pobj); opResult = await this.ncSve.ncSubmitMaterial(pobj);
break; break;
case "ncCloseNeed"://关闭需求(文网文)2020-9-28 case "ncNotification"://状态通知(网文)2020-11-11
opResult = await this.qcCenterOrderSve.ncCloseNeed(pobj); opResult = await this.ncSve.ncNotification(pobj);
break; break;
case "ncRecordLog"://提交沟通记录(文网文)2020-9-28 case "ncSubmitSolution"://提交方案(网文)2020-11-11
opResult = await this.qcCenterOrderSve.ncRecordLog(pobj); opResult = await this.ncSve.ncSubmitSolution(pobj);
break; break;
case "ncRecordLogList"://查询沟通记录(文网文)2020-9-29 case "ncWriteCommunicationRecord"://提交沟通记录(网文)2020-11-11
opResult = await this.qcCenterOrderSve.ncRecordLogList(pobj); opResult = await this.ncSve.ncWriteCommunicationRecord(pobj);
break;
case "ncGetCommunicationRecord"://查询沟通记录(网文)2020-11-11
opResult = await this.ncSve.ncGetCommunicationRecord(pobj);
break;
case "ncCloseNeed"://关闭需求(网文)2020-11-11
opResult = await this.ncSve.ncCloseNeed(pobj);
break;
case "ncClosePlan"://关闭方案(网文)2020-11-11
opResult = await this.ncSve.ncClosePlan(pobj);
break;
case "ncCloseOrderDelivery"://关闭交付单(网文)2020-11-11
opResult = await this.ncSve.ncCloseOrderDelivery(pobj);
break; break;
// --------- 广电 --------- // --------- 广电 ---------
case "rtServiceSubmitOption"://服务商提交服务操作(文网文)2020-9-26 case "rtGetNeedList"://查询需求列表(广电)2020-11-11
opResult = await this.qcCenterOrderSve.rtServiceSubmitOption(pobj); opResult = await this.rtSve.rtGetNeedList(pobj);
break;
case "rtSubmitMaterial"://交付材料提交(广电)2020-11-11
opResult = await this.rtSve.rtSubmitMaterial(pobj);
break; break;
case "rtSubmitSolution"://提交方案(文网文)2020-9-26 case "rtNotification"://状态通知(广电)2020-11-11
opResult = await this.qcCenterOrderSve.rtSubmitSolution(pobj); opResult = await this.rtSve.rtNotification(pobj);
break; break;
case "rtCloseNeed"://关闭需求(文网文)2020-9-28 case "rtSubmitSolution"://提交方案(广电)2020-11-11
opResult = await this.qcCenterOrderSve.rtCloseNeed(pobj); opResult = await this.rtSve.rtSubmitSolution(pobj);
break; break;
case "rtRecordLog"://提交沟通记录(文网文)2020-9-28 case "rtWriteCommunicationRecord"://提交沟通记录(广电)2020-11-11
opResult = await this.qcCenterOrderSve.rtRecordLog(pobj); opResult = await this.rtSve.rtWriteCommunicationRecord(pobj);
break; break;
case "rtRecordLogList"://查询沟通记录(文网文)2020-9-29 case "rtGetCommunicationRecord"://查询沟通记录(广电)2020-11-11
opResult = await this.qcCenterOrderSve.rtRecordLogList(pobj); opResult = await this.rtSve.rtGetCommunicationRecord(pobj);
break;
case "rtCloseNeed"://关闭需求(广电)2020-11-11
opResult = await this.rtSve.rtCloseNeed(pobj);
break;
case "rtClosePlan"://关闭方案(广电)2020-11-11
opResult = await this.rtSve.rtClosePlan(pobj);
break;
case "rtCloseOrderDelivery"://关闭交付单(广电)2020-11-11
opResult = await this.rtSve.rtCloseOrderDelivery(pobj);
break; break;
// --------- 推送icp信息至渠道和作方 zhuangbing-20201116--------
case "pushIcpSolution2Channel"://推送ICP方案至渠道(百度)
opResult = await this.baseOrderSve.pushIcpSolution2Channel(pobj);
break;
default: default:
opResult = system.getResult(null, "action_type参数错误"); opResult = system.getResult(null, "action_type参数错误");
break; break;
......
var APIBase = require("../../api.base");
var system = require("../../../system");
var settings = require("../../../../config/settings");
class QueueNotify extends APIBase {
constructor() {
super();
this.baseOrderSve = system.getObject("service.common.baseCenterOrderSve");
}
/**
* 接口跳转-POST请求
* action_process 执行的流程
* action_type 执行的类型
* action_body 执行的参数
*/
async springBoard(pobj, qobj, req) {
if (!pobj.actionType) {
return system.getResult(null, "actionType参数不能为空");
}
var result = await this.opActionProcess(pobj, pobj.actionType, req);
return result;
}
async opActionProcess(pobj, action_type, req) {
var opResult = null;
switch (action_type) {
// --------- 推送icp信息至渠道和作方 zhuangbing-20201116--------
case "pushIcpSolution2Channel"://推送ICP方案至渠道(百度)
opResult = await this.baseOrderSve.pushIcpSolution2Channel(pobj);
break;
default:
opResult = system.getResult(null, "action_type参数错误");
break;
}
return opResult;
}
}
module.exports = QueueNotify;
\ No newline at end of file
const system = require("../../../system"); const system = require("../../../system");
const crypto = require('crypto');
var settings = require("../../../../config/settings"); var settings = require("../../../../config/settings");
const AppServiceBase = require("../../app.base"); const AppServiceBase = require("../../app.base");
//(文网文状态2020-9-26) //(文网文状态2020-9-26)
...@@ -103,86 +102,146 @@ class BaseCenterOrderService extends AppServiceBase { ...@@ -103,86 +102,146 @@ 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;
var self = this; if(ab.isTest && ab.isTest==1){
//推送方案 var reqPushParams = {
// 2020 0916 lin 修改 增加获取返回值 actionBody: {
//var pushIcpSolutionRes = await this.pushIcpSolution(pushObj, needsolution.solutionNo, pobj.appInfo, self); uapp_id:needinfo.uapp_id,
channelNeedNo:needinfo.channelNeedNo,
CompanyName:solution.CompanyName,
IcpType:solution.IcpType,
CompanyAddress:solution.CompanyAddress,
Area:solution.Area,
Note: solution.Note,
ActionType:solution.ActionType,
channelSolutionNo:needsolution.channelSolutionNo,
solutionNo:needsolution.solutionNo,
},
appInfo: pobj.appInfo
};
await this.utilsPushSve.business2Channel(reqPushParams, "pushIcpSolution2Channel");
}else{
var self = this;
//2020-10-26 laolan 区分百度与阿里
if(needinfo.uapp_id == uappId.ali){
//推送数据至阿里
// var bizType = needinfo.channelTypeCode;//业务类型里
var pushObj = {
IntentionBizId: needinfo.channelNeedNo,
CompanyName: solution.CompanyName,
IcpType: solution.IcpType,
CompanyAddress: solution.CompanyAddress,
Area: solution.Area,
Note: solution.Note,
ActionType:solution.ActionType,
Source:"官网"
};
if (needsolution.channelSolutionNo) {
pushObj["BizId"] = needsolution.channelSolutionNo;
}
var pushIcpSolutionRes = await this.pushIcpSolution(pushObj, needsolution.solutionNo, pobj.appInfo, self);
}
if(needinfo.uapp_id == uappId.baidu){
//推送数据至baidu
// var bizType = needinfo.channelTypeCode;//业务类型里
solution.Area = cityLetter[solution.Area]
console.log('solution.Area++',solution.Area)
var pushObj = {
requirementId: needinfo.channelNeedNo,
companyName: solution.CompanyName,
companyAddress: solution.CompanyAddress,
area: solution.Area,
type:solution.IcpType
};
if (needsolution.channelSolutionNo) {
pushObj["bizId"] = needsolution.channelSolutionNo;
}
console.log('pushObj++',pushObj)
var pushIcpSolutionRes = await this.pushBaiduIcpSolution(pushObj, needsolution.solutionNo, pobj.appInfo, self);
}
this.logCtl.info({
appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "",
appkey: pobj.appInfo ? pobj.appInfo.uapp_key || "" : "",
requestId: pobj.requestId || "",
op: "service/impl/common/qcCenterOrderSve.js/submitIcpProgramme",
content: JSON.stringify(pobj),
resultInfo: JSON.stringify(needinfo),
optitle: "createSolution推送蜂擎获取的接口信息->aliBusiness2Delivery",
});
}
var reqParams = {
actionBody: {
intentionBizId: needinfo.channelNeedNo,
status: "createSolution"
},
appInfo: pobj.appInfo
}
await this.utilsPushSve.aliBusiness2Delivery(reqParams, "updateChanceStatus");
//
// return system.getResultSuccess(pushIcpSolutionRes);
}
return res;
}
//推送ICP方案至渠道方
async pushIcpSolution2Channel(pobj){
var actionBody = pobj.actionBody;
var appInfo = pobj.appInfo;
var pushRes = {
status:-1,msg:"推送失败"
};
var self = this;
if(actionBody){
//2020-10-26 laolan 区分百度与阿里 //2020-10-26 laolan 区分百度与阿里
if(needinfo.uapp_id == uappId.ali){ if(actionBody.uapp_id == uappId.ali){
//推送数据至阿里 //推送数据至阿里
// var bizType = needinfo.channelTypeCode;//业务类型里
var pushObj = { var pushObj = {
IntentionBizId: needinfo.channelNeedNo, IntentionBizId: actionBody.channelNeedNo,
CompanyName: solution.CompanyName, CompanyName: actionBody.CompanyName,
IcpType: solution.IcpType, IcpType: actionBody.IcpType,
CompanyAddress: solution.CompanyAddress, CompanyAddress: actionBody.CompanyAddress,
Area: solution.Area, Area: actionBody.Area,
Note: solution.Note, Note: actionBody.Note,
ActionType:solution.ActionType, ActionType:actionBody.ActionType,
Source:"官网" Source:"官网"
}; };
if (needsolution.channelSolutionNo) { if (actionBody.channelSolutionNo) {
pushObj["BizId"] = needsolution.channelSolutionNo; pushObj["BizId"] = actionBody.channelSolutionNo;
} }
var pushIcpSolutionRes = await this.pushIcpSolution(pushObj, needsolution.solutionNo, pobj.appInfo, self); pushRes = await this.pushIcpSolution(pushObj, actionBody.solutionNo, actionBody.appInfo, self);
} }
if(actionBody.uapp_id == uappId.baidu){
if(needinfo.uapp_id == uappId.baidu){
//推送数据至baidu //推送数据至baidu
// var bizType = needinfo.channelTypeCode;//业务类型里 actionBody.Area = cityLetter[actionBody.Area];
solution.Area = cityLetter[solution.Area]
console.log('solution.Area++',solution.Area)
var pushObj = { var pushObj = {
requirementId: needinfo.channelNeedNo, requirementId: actionBody.channelNeedNo,
companyName: solution.CompanyName, companyName: actionBody.CompanyName,
companyAddress: solution.CompanyAddress, companyAddress: actionBody.CompanyAddress,
area: solution.Area, area: actionBody.Area,
type:solution.IcpType type:actionBody.IcpType
}; };
if (needsolution.channelSolutionNo) { if (actionBody.channelSolutionNo) {
pushObj["bizId"] = needsolution.channelSolutionNo; pushObj["bizId"] = actionBody.channelSolutionNo;
} }
console.log('pushObj++',pushObj) pushRes = await this.pushBaiduIcpSolution(pushObj, actionBody.solutionNo, actionBody.appInfo, self);
var pushIcpSolutionRes = await this.pushBaiduIcpSolution(pushObj, needsolution.solutionNo, pobj.appInfo, self);
} }
// // 2020 0806 lin 新增推送
// var reqParams = {
// actionType: "produceData",// Y 功能名称
// actionBody: {
// pushUrl: pushUrl,// Y 推送地址
// actionType: "updateChanceStatus",// Y 推送地址接收时的功能名称
// notifyUrl: "",// N 推送成功后通知的Url
// identifyCode: "ali.vat",// Y 操作的业务标识
// messageBody: pobj.actionBody, // Y 推送的业务消息,必须有一项对象属性值
// headData: ""//N 请求头信息,Json格式,如:{token:"XXXXXXX"}
// },
// requestId: pobj.requestId || "" // N 请求id
// }
// this.opQueuePushClientPost(pobj, this.opPushQueueUrl, reqParams);
this.logCtl.info({ this.logCtl.info({
appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "", appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "",
appkey: pobj.appInfo ? pobj.appInfo.uapp_key || "" : "", appkey: pobj.appInfo ? pobj.appInfo.uapp_key || "" : "",
requestId: pobj.requestId || "", requestId: pobj.requestId || "",
op: "service/impl/common/qcCenterOrderSve.js/submitIcpProgramme", op: "app/base/service/impl/common/baseCenterOrderSve.js/pushIcpSolution2Channel",
content: JSON.stringify(pobj), content: JSON.stringify(pobj),
resultInfo: JSON.stringify(needinfo), resultInfo: JSON.stringify(pushRes),
optitle: "createSolution推送蜂擎获取的接口信息->aliBusiness2Delivery", optitle: "pushIcpSolution2Channel推送ICP方案至渠道方->pushIcpSolution2Channel",
}); });
var reqParams = {
actionBody: {
intentionBizId: needinfo.channelNeedNo,
status: "createSolution"
},
appInfo: pobj.appInfo
}
this.utilsPushSve.aliBusiness2Delivery(reqParams, "updateChanceStatus");
//
return system.getResultSuccess(pushIcpSolutionRes);
} }
return res; if(pushRes.status==0 || pushRes.status==1 ){
return system.getResultRedisQueueSuccess();
}
return pushRes;
} }
//推送ICP方案ali //推送ICP方案ali
async pushIcpSolution(pushObj, solutionNo, appInfo, self) { async pushIcpSolution(pushObj, solutionNo, appInfo, self) {
//推送方案信息 //推送方案信息
...@@ -216,10 +275,11 @@ class BaseCenterOrderService extends AppServiceBase { ...@@ -216,10 +275,11 @@ class BaseCenterOrderService extends AppServiceBase {
var a = await self.reqCenterOrderApi(reqObj3);//保存用户确认方案url var a = await self.reqCenterOrderApi(reqObj3);//保存用户确认方案url
} }
} }
return confirmRes; // return confirmRes;
} }
} }
} }
return pushRes;
} }
//推送ICP方案baidu 2020-10-26 laolan //推送ICP方案baidu 2020-10-26 laolan
...@@ -252,10 +312,11 @@ class BaseCenterOrderService extends AppServiceBase { ...@@ -252,10 +312,11 @@ 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;
} }
} }
} }
return pushRes;
} }
//服务商icp方案关闭 2020-10-26 laolan //服务商icp方案关闭 2020-10-26 laolan
...@@ -398,407 +459,5 @@ class BaseCenterOrderService extends AppServiceBase { ...@@ -398,407 +459,5 @@ class BaseCenterOrderService extends AppServiceBase {
} }
return res; return res;
} }
// ----------- 文网文 -----------
//服务商提交服务操作(文网文)2020-9-26
async serviceSubmitOption(pobj) {
var res = await this.reqCenterOrderApi(pobj, "action/qcapi/springBoard");
if (res && res.status == 0 && res.data) {
//推送数据至阿里
var resStatus = res.data.ApplicationStatus;
var pushObj = {
BizId: pobj.actionBody.orderNo,
BizType: pobj.actionBody.channelType,
OperateType: wangwenStatusDisct[resStatus],
ExtInfo:pobj.actionBody.extInfo
};
console.log("fuwu++++pushObj",pushObj);
//推送状态变更
var r = await this.aliclient.reqbyget({ action: "OperateProduceForPartner", reqbody: pushObj, apiVersion: "2020-03-06" });
console.log('ttttssss',r)
return system.getResultSuccess();
}
return res;
}
//提交方案(文网文)2020-9-27
async submitWangwenSolution(pobj) {
console.log('文网文提交方案',pobj)
var res = await this.reqCenterOrderApi(pobj, "action/qcapi/springBoard");
if (res && res.status == 0 && res.data) {
console.log('www',res.data.needsolution.solutionContent);
var solution = res.data.needsolution.solutionContent;
var needsolution = res.data.needsolution;//方案信息
solution = JSON.parse(solution);
solution = solution.solution
solution = JSON.stringify(solution)
//推送交付系统
var reqParams = {
actionBody: {
intentionBizId: res.data.needinfo.channelNeedNo,
status: "createSolution"
},
opType: "updateChanceStatus",
appInfo: pobj.appInfo
}
var self = this;
self.utilsPushSve.aliBusiness2Delivery(reqParams, "updateChanceStatus");
//日志记录
self.logCtl.info({
appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "",
appkey: pobj.appInfo ? pobj.appInfo.uapp_key || "" : "",
requestId: pobj.requestId || "",
op: "service/impl/common/qcCenterOrderSve.js/submitWangwenSolution",
content: JSON.stringify(reqParams),
resultInfo: "",
optitle: "updateChanceStatus推送蜂擎获取的接口信息->aliBusiness2Delivery",
});
//推送数据至阿里
var pushObj = {
intentionBizId: res.data.needinfo.channelNeedNo,
bizType: res.data.needinfo.channelTypeCode,
// solution: res.data.needsolution.solutionContent
solution: solution
};
console.log("wangwen",pushObj);
this.pushSubmitSolution(pushObj, needsolution.solutionNo, pobj.appInfo, self);
return system.getResultSuccess();
}
return res;
}
//推送方案
async pushSubmitSolution(pushObj, solutionNo, appInfo, self) {
//推送状态变更
var pushRes = await this.aliclient.reqbyget({ action: "SubmitSolution", reqbody: pushObj, apiVersion: "2020-03-06" });
console.log('wangwen++++pushRespushRes',pushRes)
if (pushRes && pushRes.status == 0 && pushRes.data) {
var resData = pushRes.data;
var reqObj2 = {
actionType: "receiveProgrammeNo",
appInfo: appInfo,
actionBody: {
solutionNo: solutionNo,
solutionBizId: resData.SolutionBizId
}
};
var a = await self.reqCenterOrderApi(reqObj2);//保存渠道方案id
return a;
}
}
//关闭需求
async closeNeed(pobj) {
if (!pobj.actionBody.needNo) {
return system.getResult(null, "actionBody.needNo can not be empty,100395");
}
if (!pobj.actionBody.note) {
return system.getResult(null, "actionBody.note can not be empty,100395");
}
var self = this;
pobj.actionBody.intentionBizId = pobj.actionBody.needNo;
pobj.actionType = "abolishIcpProgrammeByNeed"
var reqUrl = this.centerOrderUrl + "action/qcapi/springBoard";
var result = await this.restPostUrl(pobj, reqUrl);
console.log('www+++result',result)
if (result.status == 0) {
if (result.data) {
pobj.actionBody.orderNo = result.data;
var orderrtn = await self.utilsOrderSve.delOrder(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
}
self.utilsPushSve.aliBusiness2Delivery(reqParams, "updateChanceStatus");
//日志记录
self.logCtl.info({
appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "",
appkey: pobj.appInfo ? pobj.appInfo.uapp_key || "" : "",
requestId: pobj.requestId || "",
op: "service/impl/common/qcCenterOrderSve.js/closeNeed",
content: JSON.stringify(reqParams),
resultInfo: "",
optitle: "updateChanceStatus推送蜂擎获取的接口信息->aliBusiness2Delivery",
});
// 推送ali
var a = await self.aliclient.reqbyget({ action: "CloseIntentionForPartner", reqbody: { IntentionBizId: pobj.actionBody.needNo, BizType: "esp.wangwen" ,Note : pobj.actionBody.note}, apiVersion: "2020-03-06" });
console.log('alalallala',a)
// 2020 1021 lin 新增查看日志
self.logCtl.info({
appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "",
appkey: pobj.appInfo ? pobj.appInfo.uapp_key || "" : "",
requestId: pobj.requestId || "",
op: "service/impl/common/qcCenterOrderSve.js/closeNeed",
content: JSON.stringify(a),
resultInfo: "",
optitle: "推送ali关闭需求->closeNeed",
});
self.utilsPushSve.aliBusiness2Fq(pobj, "pushCloseWangWenNeed");
return system.getResultSuccess();
} else {
return system.getResult(null, "close fail 100389 ");
}
}
//提交沟通记录
async recordLog(pobj) {
console.log('提交沟通记录pobj',pobj)
var res = await this.reqCenterOrderApi(pobj, "action/qcapi/springBoard");
if (!pobj.actionBody.needNo) {
return system.getResult(null, "actionBody.needNo can not be empty,100491");
}
if (!pobj.actionBody.note) {
return system.getResult(null, "actionBody.note can not be empty,100492");
}
var self = this;
var reqUrl = this.centerOrderUrl + "action/qcapi/springBoard";
var result = await this.restPostUrl(pobj, reqUrl);
console.log('www+提交沟通记录result',result)
//推送交付系统
var reqParams = {
actionBody: {
intentionBizId: pobj.actionBody.needNo,
status: "followingUp"
},
opType: "updateChanceStatus",
appInfo: pobj.appInfo
}
self.utilsPushSve.aliBusiness2Delivery(reqParams, "updateChanceStatus");
//推送数据至阿里
var pushObj = {
IntentionBizId: pobj.actionBody.needNo,
note: pobj.actionBody.note
};
//提交沟通记录
var r = await this.aliclient.reqbyget({ action: "SubmitIntentionNote", reqbody: pushObj, apiVersion: "2020-03-06" });
console.log('www+提交沟通记录r',r)
return system.getResultSuccess();
}
//查看沟通记录
async recordLogList(pobj) {
if (!pobj.actionBody.needNo) {
return system.getResult(null, "actionBody.needNo can not be empty,100493");
}
let res = await this.aliclient.reqbyget({
action: "ListIntentionNote", reqbody: {
BeginTime: pobj.actionBody.BeginTime ? pobj.actionBody.BeginTime : "",
EndTime: pobj.actionBody.EndTime ? pobj.actionBody.EndTime : "",
IntentionBizId: pobj.actionBody.needNo,
PageNum: pobj.actionBody.pageNum || 1,
PageSize: pobj.actionBody.pageSize || 10,
}, apiVersion: "2020-03-06"
});
console.log('loglist-----',res)
if(res && res.data && res.data.Data){
var len = res.data.Data.length;
for(var i=0; i<len;i++){
res.data.Data[i].CreateTime = res.data.Data[i].CreateTime / 1000
}
}
return system.getResultSuccess(res);
}
// ----------- 食品 -----------
//服务商提交服务操作
async foodServiceSubmitOption(pobj) {
var res = await this.reqCenterOrderApi(pobj, "action/qcapi/springBoard");
if (res && res.status == 0 && res.data) {
//推送数据至阿里
var resStatus = res.data.ApplicationStatus;
var pushObj = {
BizId: pobj.actionBody.orderNo,
BizType: pobj.actionBody.channelTpye,
OperateType: wangwenStatusDisct[resStatus],
ExtInfo:pobj.actionBody.extInfo
};
//推送状态变更
var r = await this.aliclient.reqbyget({ action: "OperateProduceForPartner", reqbody: pushObj, apiVersion: "2020-03-06" });
console.log('ttttssss',r)
return system.getResultSuccess();
}
return res;
}
//提交方案
async submitFoodSolution(pobj) {
console.log('food+++pobj',pobj)
var res = await this.reqCenterOrderApi(pobj, "action/qcapi/springBoard");
console.log('food+++res',res)
if (res && res.status == 0 && res.data) {
console.log('food',res.data.needsolution.solutionContent);
var solution = res.data.needsolution.solutionContent;
var needsolution = res.data.needsolution;//方案信息
solution = JSON.parse(solution);
solution = solution.solution
solution = JSON.stringify(solution)
//推送交付系统
var reqParams = {
actionBody: {
intentionBizId: pobj.actionBody.needNo,
status: "createSolution"
},
opType: "updateChanceStatus",
appInfo: pobj.appInfo
}
var self = this;
self.utilsPushSve.aliBusiness2Delivery(reqParams, "updateChanceStatus");
//日志记录
self.logCtl.info({
appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "",
appkey: pobj.appInfo ? pobj.appInfo.uapp_key || "" : "",
requestId: pobj.requestId || "",
op: "service/impl/common/qcCenterOrderSve.js/submitFoodSolution",
content: JSON.stringify(reqParams),
resultInfo: "",
optitle: "updateChanceStatus推送蜂擎获取的接口信息->aliBusiness2Delivery",
});
//推送数据至阿里
var pushObj = {
intentionBizId: res.data.needinfo.channelNeedNo,
bizType: res.data.needinfo.channelTypeCode,
// solution: res.data.needsolution.solutionContent
solution: solution
};
console.log("food",pushObj);
this.pushSubmitSolution(pushObj, needsolution.solutionNo, pobj.appInfo, self);
return system.getResultSuccess();
}
return res;
}
//关闭需求
async foodCloseNeed(pobj) {
if (!pobj.actionBody.needNo) {
return system.getResult(null, "actionBody.needNo can not be empty,100395");
}
if (!pobj.actionBody.note) {
return system.getResult(null, "actionBody.note can not be empty,100395");
}
var self = this;
pobj.actionBody.intentionBizId = pobj.actionBody.needNo;
pobj.actionType = "abolishIcpProgrammeByNeed"
var reqUrl = this.centerOrderUrl + "action/qcapi/springBoard";
var result = await this.restPostUrl(pobj, reqUrl);
console.log('food+++result',result)
if (result.status == 0) {
if (result.data) {
pobj.actionBody.orderNo = result.data;
var orderrtn = await self.utilsOrderSve.delOrder(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
}
var self = this;
self.utilsPushSve.aliBusiness2Delivery(reqParams, "updateChanceStatus");
//日志记录
self.logCtl.info({
appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "",
appkey: pobj.appInfo ? pobj.appInfo.uapp_key || "" : "",
requestId: pobj.requestId || "",
op: "service/impl/common/qcCenterOrderSve.js/foodCloseNeed",
content: JSON.stringify(reqParams),
resultInfo: "",
optitle: "updateChanceStatus推送蜂擎获取的接口信息->aliBusiness2Delivery",
});
// 推送ali
var a = await self.aliclient.reqbyget({ action: "CloseIntentionForPartner", reqbody: { IntentionBizId: pobj.actionBody.needNo, BizType: "esp.wangwen" ,Note : pobj.actionBody.note}, apiVersion: "2020-03-06" });
self.utilsPushSve.aliBusiness2Fq(pobj, "pushCloseFoodNeed");
return system.getResultSuccess();
} else {
return system.getResult(null, "close fail 100389 ");
}
}
//提交沟通记录
async foodRecordLog(pobj) {
console.log('提交沟通记录pobj',pobj)
var res = await this.reqCenterOrderApi(pobj, "action/qcapi/springBoard");
if (!pobj.actionBody.needNo) {
return system.getResult(null, "actionBody.needNo can not be empty,100491");
}
if (!pobj.actionBody.note) {
return system.getResult(null, "actionBody.note can not be empty,100492");
}
var self = this;
var reqUrl = this.centerOrderUrl + "action/qcapi/springBoard";
var result = await this.restPostUrl(pobj, reqUrl);
console.log('提交沟通记录result',result)
//推送交付系统
var reqParams = {
actionBody: {
intentionBizId: pobj.actionBody.needNo,
status: "followingUp"
},
opType: "updateChanceStatus",
appInfo: pobj.appInfo
}
self.utilsPushSve.aliBusiness2Delivery(reqParams, "updateChanceStatus");
//推送数据至阿里
var pushObj = {
IntentionBizId: pobj.actionBody.needNo,
note: pobj.actionBody.note
};
//提交沟通记录
var r = await this.aliclient.reqbyget({ action: "SubmitIntentionNote", reqbody: pushObj, apiVersion: "2020-03-06" });
console.log('提交沟通记录r',r)
return system.getResultSuccess();
}
//查看沟通记录
async foodRecordLogList(pobj) {
if (!pobj.actionBody.needNo) {
return system.getResult(null, "actionBody.needNo can not be empty,100493");
}
let res = await this.aliclient.reqbyget({
action: "ListIntentionNote", reqbody: {
BeginTime: pobj.actionBody.BeginTime ? pobj.actionBody.BeginTime : "",
EndTime: pobj.actionBody.EndTime ? pobj.actionBody.EndTime : "",
IntentionBizId: pobj.actionBody.needNo,
PageNum: pobj.actionBody.pageNum || 1,
PageSize: pobj.actionBody.pageSize || 10,
}, apiVersion: "2020-03-06"
});
if(res && res.data && res.data.Data){
var len = res.data.Data.length;
for(var i=0; i<len;i++){
res.data.Data[i].CreateTime = res.data.Data[i].CreateTime / 1000
}
}
return system.getResultSuccess(res);
}
} }
module.exports = BaseCenterOrderService; module.exports = BaseCenterOrderService;
\ No newline at end of file
const system = require("../../../system"); const system = require("../../../system");
const crypto = require('crypto');
var settings = require("../../../../config/settings"); var settings = require("../../../../config/settings");
const AppServiceBase = require("../../app.base"); const AppServiceBase = require("../../app.base");
//(文网文状态2020-9-26) const { getResultSuccess } = require("../../../system");
const wangwenStatusDisct = {
601: "PARTNER_SUBMIT_MATERIAL",
602: "CERT_ACCOUNT_REGISTERED",
603: "CERT_MATERIAL_SUBMITTED",
604: "CERT_GXB_ACCEPT",
605: "CERT_GXB_REFUSE",
606: "CERT_GXB_SUCCESS",
607: "CERT_GXB_FAIL"
};
//区分渠道的uappid //区分渠道的uappid
const uappId = { const uappId = {
'ali':"18", //(阿里icp、edi) 'ali':"18", //(阿里icp、edi)
...@@ -53,7 +44,7 @@ const cityLetter = { ...@@ -53,7 +44,7 @@ const cityLetter = {
"海南":"HAINAN" "海南":"HAINAN"
} }
//百度拼音转义 2020-11-6 //百度拼音转义 2020-11-11 laolan
const baiduIcpStatus = { const baiduIcpStatus = {
507: "REGISTRATION", 507: "REGISTRATION",
508: "SUBMITTED", 508: "SUBMITTED",
...@@ -70,7 +61,6 @@ class NcService extends AppServiceBase { ...@@ -70,7 +61,6 @@ class NcService extends AppServiceBase {
super(); super();
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.cacheManager = system.getObject("db.common.cacheManager"); this.cacheManager = system.getObject("db.common.cacheManager");
this.utilsOrderSve = system.getObject("service.utilsSve.utilsOrderSve"); this.utilsOrderSve = system.getObject("service.utilsSve.utilsOrderSve");
this.utilsPushSve = system.getObject("service.utilsSve.utilsPushSve"); this.utilsPushSve = system.getObject("service.utilsSve.utilsPushSve");
...@@ -88,198 +78,34 @@ class NcService extends AppServiceBase { ...@@ -88,198 +78,34 @@ class NcService extends AppServiceBase {
var data = JSON.parse(rtn.stdout); var data = JSON.parse(rtn.stdout);
return data; return data;
} }
//提交Icp注册方案 //查询需求列表 2020-11-11 laolan
async submitIcpProgramme(pobj) { async ncGetNeedList(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) {
var needinfo = res.data.needinfo;//需求信息 if(res.data.uapp_id == uappId.baidu){
var needsolution = res.data.needsolution;//方案信息
var ab = pobj.actionBody;
if (typeof (ab.solutionContent) == "string") {
ab.solutionContent = JSON.parse(ab.solutionContent);
}
if (typeof (needsolution.solutionContent) == "string") {
needsolution.solutionContent = JSON.parse(needsolution.solutionContent);
}
var solution = needsolution.solutionContent.solution;
var self = this;
//推送方案
// 2020 0916 lin 修改 增加获取返回值
//var pushIcpSolutionRes = await this.pushIcpSolution(pushObj, needsolution.solutionNo, pobj.appInfo, self);
//2020-10-26 laolan 区分百度与阿里
if(needinfo.uapp_id == uappId.ali){
//推送数据至阿里
// var bizType = needinfo.channelTypeCode;//业务类型里
var pushObj = {
IntentionBizId: needinfo.channelNeedNo,
CompanyName: solution.CompanyName,
IcpType: solution.IcpType,
CompanyAddress: solution.CompanyAddress,
Area: solution.Area,
Note: solution.Note,
ActionType:solution.ActionType,
Source:"官网"
};
if (needsolution.channelSolutionNo) {
pushObj["BizId"] = needsolution.channelSolutionNo;
}
var pushIcpSolutionRes = await this.pushIcpSolution(pushObj, needsolution.solutionNo, pobj.appInfo, self);
}
if(needinfo.uapp_id == uappId.baidu){
//推送数据至baidu
// var bizType = needinfo.channelTypeCode;//业务类型里
solution.Area = cityLetter[solution.Area]
console.log('solution.Area++',solution.Area)
var pushObj = { var pushObj = {
requirementId: needinfo.channelNeedNo, type:res.data.type,
companyName: solution.CompanyName, begin:res.data.begin || "",
companyAddress: solution.CompanyAddress, end:res.data.end || "",
area: solution.Area, intentionBizId:res.data.intentionBizId,
type:solution.ActionType status:res.data.status,
}; area:res.data.area,
if (needsolution.channelSolutionNo) { pagreSize:res.data.pagreSize || 10,
pushObj["bizId"] = needsolution.channelSolutionNo; pageNum:res.data.pageNum || 1
}
console.log('pushObj++',pushObj)
var pushIcpSolutionRes = await this.pushBaiduIcpSolution(pushObj, needsolution.solutionNo, pobj.appInfo, self);
}
// // 2020 0806 lin 新增推送
// var reqParams = {
// actionType: "produceData",// Y 功能名称
// actionBody: {
// pushUrl: pushUrl,// Y 推送地址
// actionType: "updateChanceStatus",// Y 推送地址接收时的功能名称
// notifyUrl: "",// N 推送成功后通知的Url
// identifyCode: "ali.vat",// Y 操作的业务标识
// messageBody: pobj.actionBody, // Y 推送的业务消息,必须有一项对象属性值
// headData: ""//N 请求头信息,Json格式,如:{token:"XXXXXXX"}
// },
// requestId: pobj.requestId || "" // N 请求id
// }
// this.opQueuePushClientPost(pobj, this.opPushQueueUrl, reqParams);
this.logCtl.info({
appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "",
appkey: pobj.appInfo ? pobj.appInfo.uapp_key || "" : "",
requestId: pobj.requestId || "",
op: "service/impl/common/qcCenterOrderSve.js/submitIcpProgramme",
content: JSON.stringify(pobj),
resultInfo: JSON.stringify(needinfo),
optitle: "createSolution推送蜂擎获取的接口信息->aliBusiness2Delivery",
});
var reqParams = {
actionBody: {
intentionBizId: needinfo.channelNeedNo,
status: "createSolution"
},
appInfo: pobj.appInfo
}
this.utilsPushSve.aliBusiness2Delivery(reqParams, "updateChanceStatus");
//
return system.getResultSuccess(pushIcpSolutionRes);
}
return res;
}
//推送ICP方案ali
async pushIcpSolution(pushObj, solutionNo, appInfo, self) {
//推送方案信息
var pushRes = await self.aliclient.reqbyget({ action: "SubmitIcpSolution", reqbody: pushObj, apiVersion: "2019-05-08" });
if (pushRes && pushRes.status == 0 && pushRes.data) {
var resData = pushRes.data;
if (resData.BizId) {
var reqObj2 = {
actionType: "receiveProgrammeNo",
appInfo: appInfo,
actionBody: {
solutionNo: solutionNo,
solutionBizId: resData.BizId
}
};
var a = await self.reqCenterOrderApi(reqObj2);//保存渠道方案id
if (a && a.status == 0) {
//推送方案确认信息
var confirmRes = await self.aliclient.reqbyget({ action: "ConfirmIntention", reqbody: { BizId: pushObj.IntentionBizId }, apiVersion: "2019-05-08" });
if (confirmRes && confirmRes.status == 0 && confirmRes.data) {
var confirmResData = confirmRes.data;
if (confirmResData.ConfirmUrl) {
var reqObj3 = {
actionType: "receiveIcpConfirmUrl",
appInfo: appInfo,
actionBody: {
solutionNo: solutionNo,
confirmUrl: confirmResData.ConfirmUrl
}
};
var a = await self.reqCenterOrderApi(reqObj3);//保存用户确认方案url
}
}
return confirmRes;
} }
//查询需求列表
var r = await this.baiduclient.baiduReqbyget({ path: "////", reqbody: pushObj });
console.log('nc rrrr+++++',r)
} }
return getResultSuccess();
} }
return res
} }
//推送ICP方案baidu 2020-10-26 laolan
async pushBaiduIcpSolution(pushObj, solutionNo, appInfo, self) {
console.log('pushObj++baidu+++',pushObj)
//推送方案信息
var pushRes = await self.baiduclient.baiduReqbyget({ path: "/api/bla/provider/plan", reqbody: pushObj });
console.log("pushRes++++",pushRes)
if (pushRes && pushRes.status == 0 && pushRes.data) {
var resData = pushRes.data;
if (resData.planId) {
var reqObj2 = {
actionType: "receiveProgrammeNo",
appInfo: appInfo,
actionBody: {
solutionNo: solutionNo,
solutionBizId: resData.planId
}
};
var a = await self.reqCenterOrderApi(reqObj2);//保存渠道方案id
console.log("保存渠道方案id aaaa++ ",a)
if (a && a.status == 0 && resData.path) {
var reqObj3 = {
actionType: "receiveIcpConfirmUrl",
appInfo: appInfo,
actionBody: {
solutionNo: solutionNo,
confirmUrl: resData.path
}
};
var url = await self.reqCenterOrderApi(reqObj3);//保存用户确认方案url
console.log('save confirmUrl ++ ',url)
return pushRes;
}
}
}
}
//服务商icp方案关闭 2020-10-26 laolan //交付材料提交 2020-11-11 laolan
async abolishIcpProgramme(pobj) { async ncSubmitMaterial(pobj) {
var res = await this.reqCenterOrderApi(pobj, "action/qcapi/springBoard");
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 pushObj = {
BizId: ab.BizId, Note: ab.Note
};
//关闭方案
this.aliclient.reqbyget({ action: "CloseIcpProduce", reqbody: pushObj, apiVersion: "2019-05-08" });
return system.getResultSuccess();
}
return res;
}
//交付材料提交
async serviceProviderSubmitMaterial(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) { if (res && res.status == 0 && res.data) {
var needsolution = res.data;//方案信息 var needsolution = res.data;//方案信息
...@@ -288,229 +114,121 @@ class NcService extends AppServiceBase { ...@@ -288,229 +114,121 @@ class NcService extends AppServiceBase {
ab.material = JSON.parse(ab.material); ab.material = JSON.parse(ab.material);
} }
var material = ab.material; var material = ab.material;
if(res.data.uapp_id == uappId.ali){
//推送数据至阿里
var BizId = needsolution.channelSolutionNo;//⽅案业务ID
var pushObj = {
"BizId": BizId,
"Domain": material.Domain,
"CorporateName": material.CorporateName,
"IncludeForeignInvestment": material.IncludeForeignInvestment,
"PartnerBusinessLicense": material.PartnerBusinessLicense,
"PartnerIdCardList": material.PartnerIdCardList,
"PartnerDomainCertificate": material.PartnerDomainCertificate,
"PartnerPreviewOtherList": material.PartnerPreviewOtherList || [],
"PartnerPlan": material.PartnerPlan || "",
"PartnerForeignInvestment": material.PartnerForeignInvestment || "",
"PartnerLaw": material.PartnerLaw || "",
"PartnerStampOtherList": material.PartnerStampOtherList || [],
"PartnerSignOtherList": material.PartnerSignOtherList || [],
"PartnerSignAndStampOtherList": material.PartnerSignAndStampOtherList || []
};
var self = this;
//推送方案材料
self.aliclient.reqbyget({ action: "SavePartnerSubmitMaterial", reqbody: pushObj, apiVersion: "2019-05-08" });
}
if(res.data.uapp_id == uappId.baidu){ if(res.data.uapp_id == uappId.baidu){
//推送数据至百度 //推送数据至百度
var BizId = needsolution.orderChannelNo; var bizId = needsolution.orderChannelNo;
console.log('BizId++',BizId) console.log('bizId++',bizId)
var pushObj = { var pushObj = {
"orderNo": bizId,
"businessLicense" : { "businessLicense" : {
"createdAt" : material.BusinessLicense.CreatedAt || "", "name" :material.businessLicense.name || "",
"enterpriseCode" :material.BusinessLicense.EnterpriseCode || "", "type" : material.businessLicense.type || "",
"legalRepresentative" :material.BusinessLicense.LegalRepresentative || "", "address" :material.businessLicense.address || "",
"address" :material.BusinessLicense.Address || "", "createdAt" : material.businessLicense.createdAt || "",
"registeredCapital" : material.BusinessLicense.RegisteredCapital || "", "businessTerm" :material.businessLicense.businessTerm || "",
"name" :material.BusinessLicense.Name || "", "scopeBusiness" :material.businessLicense.scopeBusiness || "",
"businessTerm" :material.BusinessLicense.BusinessTerm || "", "enterpriseCode" :material.businessLicense.enterpriseCode || "",
"type" : material.BusinessLicense.Type || "", "registeredCapital" : material.businessLicense.registeredCapital || "",
"scopeBusiness" :material.BusinessLicense.ScopeBusiness || "" "legalRepresentative" :material.businessLicense.legalRepresentative || "",
}, },
"partnerForeignInvestment": material.PartnerForeignInvestment || "", "partnerBusinessLicense": material.partnerBusinessLicense || "",
"orderNo": BizId, "legalPersonIdentityCard":material.legalPersonIdentityCard || "",
"domain": material.Domain, "businessDevelopmentDescription":material.businessDevelopmentDescription || "",
"corporateName": material.CorporateName, "companyPolicy":material.companyPolicy || "",
"includeForeignInvestment": material.IncludeForeignInvestment, "mainManagement":material.mainManagement || "",
"partnerBusinessLicense": material.PartnerBusinessLicense, "creditCertificateDocument":material.creditCertificateDocument || "",
"partnerIdCardList": material.PartnerIdCardList, "registeredAddressCertificateDocument":material.registeredAddressCertificateDocument || "",
"partnerDomainCertificate": material.PartnerDomainCertificate, "partnerOtherList":material.partnerOtherList || ""
"partnerPreviewOtherList": material.PartnerPreviewOtherList || [],
"partnerPlan": material.PartnerPlan || "",
"partnerLaw": material.PartnerLaw || "",
"partnerStampOtherList": material.PartnerStampOtherList || [],
"partnerSignOtherList": material.PartnerSignOtherList || [],
"partnerSignAndStampOtherList": material.PartnerSignAndStampOtherList || []
}; };
var self = this;
//推送方案材料 //推送方案材料
var r = await self.baiduclient.baiduReqbyget({ path: "/api/bla/provider/license/material", reqbody: pushObj }); var r = await this.baiduclient.baiduReqbyget({ path: "/api/bla/provider/license/material", reqbody: pushObj });
console.log('rrrr+++++',r) console.log('nc rrrr+++++',r)
} }
return system.getResultSuccess(); return system.getResultSuccess();
} }
return res; return res;
} }
//通知交付状态变更 //通知交付状态变更 2020-11-11 laolan
async serviceProviderNotification(pobj) { async ncNotification(pobj) {
var res = await this.reqCenterOrderApi(pobj, "action/qcapi/springBoard");
if (res && res.status == 0 && res.data) {
if(res.data.uapp_id == uappId.ali){
//推送数据至阿里
var pushObj = {
BizId: res.data.BizId,
OfficialFileURL: res.data.OfficialFileURL,
ApplicationStatus: res.data.ApplicationStatus
};
//推送状态变更
this.aliclient.reqbyget({ action: "AcceptPartnerNotification", reqbody: pushObj, apiVersion: "2019-05-08" });
}
if(res.data.uapp_id == uappId.baidu){
res.data.ApplicationStatus = baiduIcpStatus[res.data.ApplicationStatus];
console.log('res.data.channelOrderNo',res.data.channelOrderNo)
//推送数据至百度
var pushObj = {
orderNo: res.data.channelOrderNo,
status: res.data.ApplicationStatus
};
//推送状态变更
this.baiduclient.baiduReqbyget({ path: "/api/bla/provider/license/update", reqbody: pushObj });
}
return system.getResultSuccess();
}
return res;
}
//交付单关闭
async closeOrderDelivery(pobj) {
var res = await this.reqCenterOrderApi(pobj, "action/qcapi/springBoard");
if (res && res.status == 0 && res.data) {
var needsolution = res.data;//方案信息
var ab = pobj.actionBody;
//推送数据至阿里
var pushObj = {
BizId: needsolution.channelSolutionNo, Note: ab.note
};
//关闭方案
this.aliclient.reqbyget({ action: "CloseIcpProduce", reqbody: pushObj, apiVersion: "2019-05-08" });
return system.getResultSuccess();
}
return res;
}
// ----------- 文网文 -----------
//服务商提交服务操作(文网文)2020-9-26
async ncServiceSubmitOption(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) { if (res && res.status == 0 && res.data) {
if(res.data.uapp_id = uappId.ali){ if(res.data.uapp_id == uappId.baidu){
//推送数据至阿里 res.data.applicationStatus = baiduIcpStatus[res.data.applicationStatus];
var resStatus = res.data.ApplicationStatus; console.log('nc res.data.channelOrderNo',res.data.channelOrderNo)
var pushObj = { //推送数据至百度
BizId: pobj.actionBody.orderNo, var pushObj = {
BizType: pobj.actionBody.channelType, orderNo: res.data.channelOrderNo,
OperateType: wangwenStatusDisct[resStatus], status: res.data.applicationStatus,
ExtInfo:pobj.actionBody.extInfo };
}; //推送状态变更
console.log("ali fuwu++++pushObj",pushObj); var r = await this.baiduclient.baiduReqbyget({ path: "/api/bla/provider/license/update", reqbody: pushObj });
//推送状态变更 console("nc tongzhi+++",r)
var r = await this.aliclient.reqbyget({ action: "OperateProduceForPartner", reqbody: pushObj, apiVersion: "2020-03-06" });
console.log('ali +++ r+++',r)
}
if(res.data.uapp_id = uappId.baidu){
//推送数据至阿里
var resStatus = res.data.ApplicationStatus;
var pushObj = {
bizId: pobj.actionBody.orderNo,
bizType: pobj.actionBody.channelType,
operateType: wangwenStatusDisct[resStatus],
extInfo:pobj.actionBody.extInfo
};
console.log(" baidu fuwu++++pushObj",pushObj);
//推送状态变更
var r = await this.baiduclient.baiduReqbyget({ path: "////", reqbody: pushObj });
console.log('baidu +++ r+++',r)
} }
return system.getResultSuccess(); return system.getResultSuccess();
} }
return res; return res;
} }
//提交方案(文网文)2020-9-27
//提交方案 2020-11-11 laolan
async ncSubmitSolution(pobj) { async ncSubmitSolution(pobj) {
console.log('文网文提交方案',pobj) console.log('nc+++pobj',pobj)
var res = await this.reqCenterOrderApi(pobj, "action/qcapi/springBoard"); var res = await this.reqCenterOrderApi(pobj, "action/qcapi/springBoard");
console.log('nc+++res',res)
if (res && res.status == 0 && res.data) { if (res && res.status == 0 && res.data) {
console.log('www',res.data.needsolution.solutionContent); console.log('nc solutionContent+++',res.data.needsolution.solutionContent);
var solution = res.data.needsolution.solutionContent; var solution = res.data.needsolution.solutionContent;
var needsolution = res.data.needsolution;//方案信息 var needsolution = res.data.needsolution;//方案信息
solution = JSON.parse(solution); solution = JSON.parse(solution);
solution = solution.solution solution = solution.solution
solution = JSON.stringify(solution) solution = JSON.stringify(solution)
//推送交付系统 //推送交付系统
var reqParams = { var reqParams = {
actionBody: { actionBody: {
intentionBizId: res.data.needinfo.channelNeedNo, intentionBizId: pobj.actionBody.needNo,
status: "createSolution" status: "createSolution"
}, },
opType: "updateChanceStatus", opType: "updateChanceStatus",
appInfo: pobj.appInfo appInfo: pobj.appInfo
} }
var self = this; var self = this;
self.utilsPushSve.aliBusiness2Delivery(reqParams, "updateChanceStatus"); self.utilsPushSve.aliBusiness2Delivery(reqParams, "updateChanceStatus");
//日志记录 //日志记录
self.logCtl.info({ self.logCtl.info({
appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "", appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "",
appkey: pobj.appInfo ? pobj.appInfo.uapp_key || "" : "", appkey: pobj.appInfo ? pobj.appInfo.uapp_key || "" : "",
requestId: pobj.requestId || "", requestId: pobj.requestId || "",
op: "service/impl/common/qcCenterOrderSve.js/submitWangwenSolution", op: "service/impl/common/ncSve.js/ncSubmitSolution",
content: JSON.stringify(reqParams), content: JSON.stringify(reqParams),
resultInfo: "", resultInfo: "",
optitle: "updateChanceStatus推送蜂擎获取的接口信息->aliBusiness2Delivery", optitle: "updateChanceStatus推送蜂擎获取的接口信息->aliBusiness2Delivery",
}); });
if(res.data.uapp_id == uappId.ali){ if(res.data.needinfo.uapp_id == uappId.baidu){
//推送数据至阿里 //推送数据至baidu
var pushObj = { var pushObj = {
intentionBizId: res.data.needinfo.channelNeedNo, intentionBizId: res.data.needinfo.channelNeedNo,
bizType: res.data.needinfo.channelTypeCode, bizType: res.data.needinfo.bizType,
// solution: res.data.needsolution.solutionContent
solution: solution solution: solution
}; };
console.log("wangwen",pushObj); console.log("nc pushObj+++",pushObj);
var r = await this.pushBaiduNcSubmitSolution(pushObj, needsolution.solutionNo, pobj.appInfo, self);
this.pushAliNcSubmitSolution(pushObj, needsolution.solutionNo, pobj.appInfo, self); console.log('nc rr+++',r)
return system.getResultSuccess();
} }
if(res.data.uapp_id == uappId.baidu){
//推送数据至baidu
var pushObj = {
intentionBizId: res.data.needinfo.channelNeedNo,
bizType: res.data.needinfo.channelTypeCode,
// solution: res.data.needsolution.solutionContent
solution: solution
};
console.log("wangwen",pushObj);
this.pushBaiduNcSubmitSolution(pushObj, needsolution.solutionNo, pobj.appInfo, self);
}
return system.getResultSuccess();
} }
return res; return res;
} }
//推送方案baidu 2020-11-11 laolan
//推送方案ali async pushBaiduNcSubmitSolution(pushObj, solutionNo, appInfo, self) {
async pushAliNcSubmitSolution(pushObj, solutionNo, appInfo, self) {
//推送状态变更 //推送状态变更
var pushRes = await this.aliclient.reqbyget({ action: "SubmitSolution", reqbody: pushObj, apiVersion: "2020-03-06" }); var pushRes = await this.baiduclient.baiduReqbyget({ path: "///", reqbody: pushObj });
console.log('ali wangwen++++pushRespushRes',pushRes) console.log('baidu nc++++pushRes',pushRes)
if (pushRes && pushRes.status == 0 && pushRes.data) { if (pushRes && pushRes.status == 0 && pushRes.data) {
var resData = pushRes.data; var resData = pushRes.data;
var reqObj2 = { var reqObj2 = {
actionType: "receiveProgrammeNo", actionType: "ncReceiveProgrammeNo",
appInfo: appInfo, appInfo: appInfo,
actionBody: { actionBody: {
solutionNo: solutionNo, solutionNo: solutionNo,
...@@ -523,45 +241,77 @@ class NcService extends AppServiceBase { ...@@ -523,45 +241,77 @@ class NcService extends AppServiceBase {
} }
//推送方案baidu //提交沟通记录 2020-11-11 laolan
async pushBaiduNcSubmitSolution(pushObj, solutionNo, appInfo, self) { async ncWriteCommunicationRecord(pobj) {
//推送状态变更 console.log('nc 提交沟通记录pobj',pobj)
var pushRes = await this.baiduclient.baiduReqbyget({ path: "///", reqbody: pushObj }); var res = await this.reqCenterOrderApi(pobj, "action/qcapi/springBoard");
console.log('baidu wangwen++++pushRespushRes',pushRes) console.log('nc 提交沟通记录res',res)
if (pushRes && pushRes.status == 0 && pushRes.data) { if(res && res.data && res.status == 0){
var resData = pushRes.data; //推送交付系统
var reqObj2 = { var reqParams = {
actionType: "receiveProgrammeNo",
appInfo: appInfo,
actionBody: { actionBody: {
solutionNo: solutionNo, intentionBizId: pobj.actionBody.needNo,
solutionBizId: resData.SolutionBizId status: "followingUp"
} },
opType: "updateChanceStatus",
appInfo: pobj.appInfo
}
var push = await self.utilsPushSve.aliBusiness2Delivery(reqParams, "updateChanceStatus");
if( push && res.data.uapp_id == uappId.baidu){
//推送数据至baidu
var pushObj = {
intentionBizId: pobj.actionBody.needNo,
note: pobj.actionBody.note
};
//提交沟通记录
var r = await this.baiduclient.baiduReqbyget({ path: "////", reqbody: pushObj });
}
console.log('nc 提交沟通记录r++',r)
return system.getResultSuccess();
}
}
//查看沟通记录 2020-11-11 laolan
async ncGetCommunicationRecord(pobj) {
var res = await this.reqCenterOrderApi(pobj, "action/qcapi/springBoard");
console.log('nc 查看沟通记录res-----',res)
if(res && res.data && res.status == 0){
if(res.data.uapp_id == uappId.baidu){
//推送数据至baidu
var pushObj = {
beginTime: pobj.actionBody.beginTime ? pobj.actionBody.beginTime : "",
endTime: pobj.actionBody.endTime ? pobj.actionBody.endTime : "",
intentionBizId: pobj.actionBody.needNo,
pageNum: pobj.actionBody.pageNum || 1,
pageSize: pobj.actionBody.pageSize || 10,
}; };
var a = await self.reqCenterOrderApi(reqObj2);//保存渠道方案id //查看沟通记录
return a; var r = await this.baiduclient.baiduReqbyget({ path: "////", reqbody: pushObj });
if(r && r.data && r.data.data){
var len = r.data.data.length;
for(var i=0; i<len;i++){
r.data.data[i].createTime = r.data.data[i].createTime / 1000
}
}
console.log('nc 查看沟通记录++',r)
} }
return system.getResultSuccess(r);
} }
}
//关闭需求
async ncCloseNeed(pobj) {
// if (!pobj.actionBody.needNo) {
// return system.getResult(null, "actionBody.needNo can not be empty,100395"); //关闭需求 2020-11-11 laolan
// } async ncCloseNeed(pobj) {
// if (!pobj.actionBody.note) { pobj.actionBody.intentionBizId = pobj.actionBody.channelNeedNo;
// return system.getResult(null, "actionBody.note can not be empty,100395"); pobj.actionType = "ncClosePlan"
// }
var self = this;
pobj.actionBody.intentionBizId = pobj.actionBody.needNo;
pobj.actionType = "abolishIcpProgrammeByNeed"
var reqUrl = this.centerOrderUrl + "action/qcapi/springBoard"; var reqUrl = this.centerOrderUrl + "action/qcapi/springBoard";
var result = await this.restPostUrl(pobj, reqUrl); var result = await this.restPostUrl(pobj, reqUrl);
console.log('www+++result',result) console.log('nc 关闭需求result-----',result)
if (result.status == 0) { if (result.status == 0) {
if (result.data) { if (result.data) {
pobj.actionBody.orderNo = result.data.orderNo; pobj.actionBody.orderNo = result.data;
var orderrtn = await self.utilsOrderSve.delOrder(pobj, pobj.actionBody); var orderrtn = await this.utilsOrderSve.delOrder(pobj, pobj.actionBody);
if (orderrtn.status < 0) { if (orderrtn.status < 0) {
return system.getResultFail(-5022, "订单关闭失败"); return system.getResultFail(-5022, "订单关闭失败");
} }
...@@ -576,112 +326,78 @@ class NcService extends AppServiceBase { ...@@ -576,112 +326,78 @@ class NcService extends AppServiceBase {
opType: "updateChanceStatus", opType: "updateChanceStatus",
appInfo: pobj.appInfo appInfo: pobj.appInfo
} }
self.utilsPushSve.aliBusiness2Delivery(reqParams, "updateChanceStatus"); this.utilsPushSve.aliBusiness2Delivery(reqParams, "updateChanceStatus");
//日志记录 //日志记录
self.logCtl.info({ this.logCtl.info({
appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "", appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "",
appkey: pobj.appInfo ? pobj.appInfo.uapp_key || "" : "", appkey: pobj.appInfo ? pobj.appInfo.uapp_key || "" : "",
requestId: pobj.requestId || "", requestId: pobj.requestId || "",
op: "service/impl/common/qcCenterOrderSve.js/closeNeed", op: "service/impl/common/ncSve.js/ncCloseNeed",
content: JSON.stringify(reqParams), content: JSON.stringify(reqParams),
resultInfo: "", resultInfo: "",
optitle: "updateChanceStatus推送蜂擎获取的接口信息->aliBusiness2Delivery", optitle: "updateChanceStatus推送蜂擎获取的接口信息->aliBusiness2Delivery",
}); });
if(result.data.uapp_id == uappId.ali){ if(res.data.uapp_id == uappId.baidu){
// 推送ali
var a = await self.aliclient.reqbyget({ action: "CloseIntentionForPartner", reqbody: { IntentionBizId: pobj.actionBody.needNo, BizType: "esp.wangwen" ,Note : pobj.actionBody.note}, apiVersion: "2020-03-06" });
console.log('alalallala++',a)
}
if(result.data.uapp_id == uappId.baidu){
// 推送baidu // 推送baidu
var a = await self.baiduclient.baiduReqbyget({ path: "///", reqbody: { intentionBizId: pobj.actionBody.needNo, bizType: "网络文化许可证" ,note : pobj.actionBody.note} }); var pushObj = {
console.log('baidubaidu++',a) intentionBizId: pobj.actionBody.needNo,
bizType: pobj.actionBody.bizType,
note : pobj.actionBody.note
}
var r = await this.baiduclient.baiduReqbyget({ path: "////", pushObj });
console.log('nc closeNeed+++',r)
} }
// 2020 1021 lin 新增查看日志 this.utilsPushSve.aliBusiness2Fq(pobj, "pushCloseNcNeed");
self.logCtl.info({
appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "",
appkey: pobj.appInfo ? pobj.appInfo.uapp_key || "" : "",
requestId: pobj.requestId || "",
op: "service/impl/common/qcCenterOrderSve.js/closeNeed",
content: JSON.stringify(a),
resultInfo: "",
optitle: "推送ali关闭需求->closeNeed",
});
self.utilsPushSve.aliBusiness2Fq(pobj, "pushCloseWangWenNeed");
return system.getResultSuccess(); return system.getResultSuccess();
} else { } else {
return system.getResult(null, "close fail 100389 "); return system.getResult(null, "close fail 100389 ");
} }
} }
//提交沟通记录
async ncWriteCommunicationRecord(pobj) { //服务商方案关闭 2020-11-11 laolan
console.log('提交沟通记录pobj',pobj) async ncClosePlan(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){ if (res && res.status == 0 && res.data) {
var self = this; var needsolution = res.data;//方案信息
var reqUrl = this.centerOrderUrl + "action/qcapi/springBoard"; var ab = pobj.actionBody;
var result = await this.restPostUrl(pobj, reqUrl); if (typeof (ab.material) == "string") {
console.log('www+提交沟通记录result',result) ab.material = JSON.parse(ab.material);
//推送交付系统
var reqParams = {
actionBody: {
intentionBizId: pobj.actionBody.needNo,
status: "followingUp"
},
opType: "updateChanceStatus",
appInfo: pobj.appInfo
} }
var result = await self.utilsPushSve.aliBusiness2Delivery(reqParams, "updateChanceStatus"); if(res.data.uapp_id == uappId.baidu){
if(result && result.status ==0){ //推送数据至baidu
if(res.data.uapp_id == uappId.ali){ var pushObj = {
//推送数据至阿里 bizId: ab.bizId,
var pushObj = { note: ab.note
IntentionBizId: pobj.actionBody.needNo, };
Note: pobj.actionBody.note //关闭方案
}; var r = await this.baiduclient.baiduReqbyget({ path: "////", reqbody: pushObj });
//提交沟通记录 console.log('nc cloesePlan r+++',r)
var r = await this.aliclient.reqbyget({ action: "SubmitIntentionNote", reqbody: pushObj, apiVersion: "2020-03-06" });
console.log('ali www+提交沟通记录r',r)
}
if(res.data.uapp_id == uappId.baidu){
//推送数据至baidu
var pushObj = {
intentionBizId: pobj.actionBody.needNo,
note: pobj.actionBody.note
};
//提交沟通记录
var r = await this.aliclient.reqbyget({ path: "///", reqbody: pushObj });
console.log('baidu www+提交沟通记录r',r)
}
} }
return system.getResultSuccess(); return system.getResultSuccess();
} }
return res;
} }
//查看沟通记录 //交付单关闭 2020-11-11 laolan
async ncGetCommunicationRecord(pobj) { async ncCloseOrderDelivery(pobj) {
if (!pobj.actionBody.needNo) { var res = await this.reqCenterOrderApi(pobj, "action/qcapi/springBoard");
return system.getResult(null, "actionBody.needNo can not be empty,100493"); if (res && res.status == 0 && res.data) {
} var needsolution = res.data;//方案信息
let res = await this.aliclient.reqbyget({ var ab = pobj.actionBody;
action: "ListIntentionNote", reqbody: { if(res.data.uapp_id == uappId.baidu){
BeginTime: pobj.actionBody.BeginTime ? pobj.actionBody.BeginTime : "", //推送数据至baidu
EndTime: pobj.actionBody.EndTime ? pobj.actionBody.EndTime : "", var pushObj = {
IntentionBizId: pobj.actionBody.needNo, bizId: needsolution.channelSolutionNo,
PageNum: pobj.actionBody.pageNum || 1, note: ab.note
PageSize: pobj.actionBody.pageSize || 10, };
}, apiVersion: "2020-03-06" //关闭方案
}); var r = await this.baiduclient.baiduReqbyget({ path: "///", reqbody: pushObj });
console.log('loglist-----',res) console.log('nc交付单关闭+++',r)
if(res && res.data && res.data.Data){
var len = res.data.Data.length;
for(var i=0; i<len;i++){
res.data.Data[i].CreateTime = res.data.Data[i].CreateTime / 1000
} }
return system.getResultSuccess();
} }
return system.getResultSuccess(res); return res;
} }
} }
module.exports = NcService; module.exports = NcService;
\ No newline at end of file
const system = require("../../../system"); const system = require("../../../system");
const crypto = require('crypto');
var settings = require("../../../../config/settings"); var settings = require("../../../../config/settings");
const AppServiceBase = require("../../app.base"); const AppServiceBase = require("../../app.base");
//(文网文状态2020-9-26)
const wangwenStatusDisct = {
601: "PARTNER_SUBMIT_MATERIAL",
602: "CERT_ACCOUNT_REGISTERED",
603: "CERT_MATERIAL_SUBMITTED",
604: "CERT_GXB_ACCEPT",
605: "CERT_GXB_REFUSE",
606: "CERT_GXB_SUCCESS",
607: "CERT_GXB_FAIL"
};
//区分渠道的uappid //区分渠道的uappid
const uappId = { const uappId = {
'ali':"18", //(阿里icp、edi) 'ali':"18", //(阿里icp、edi)
...@@ -53,8 +43,7 @@ const cityLetter = { ...@@ -53,8 +43,7 @@ const cityLetter = {
"海南":"HAINAN" "海南":"HAINAN"
} }
//百度拼音转义 //百度拼音转义 2020-11-11 laolan
2020-11-6
const baiduIcpStatus = { const baiduIcpStatus = {
507: "REGISTRATION", 507: "REGISTRATION",
508: "SUBMITTED", 508: "SUBMITTED",
...@@ -71,7 +60,6 @@ class RtService extends AppServiceBase { ...@@ -71,7 +60,6 @@ class RtService extends AppServiceBase {
super(); super();
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.cacheManager = system.getObject("db.common.cacheManager"); this.cacheManager = system.getObject("db.common.cacheManager");
this.utilsOrderSve = system.getObject("service.utilsSve.utilsOrderSve"); this.utilsOrderSve = system.getObject("service.utilsSve.utilsOrderSve");
this.utilsPushSve = system.getObject("service.utilsSve.utilsPushSve"); this.utilsPushSve = system.getObject("service.utilsSve.utilsPushSve");
...@@ -90,197 +78,33 @@ class RtService extends AppServiceBase { ...@@ -90,197 +78,33 @@ class RtService extends AppServiceBase {
return data; return data;
} }
//提交Icp注册方案
async submitIcpProgramme(pobj) {
var res = await this.reqCenterOrderApi(pobj, "action/qcapi/springBoard");
if (res && res.status == 0 && res.data && res.data.needinfo && res.data.needsolution) {
var needinfo = res.data.needinfo;//需求信息
var needsolution = res.data.needsolution;//方案信息
var ab = pobj.actionBody;
if (typeof (ab.solutionContent) == "string") {
ab.solutionContent = JSON.parse(ab.solutionContent);
}
if (typeof (needsolution.solutionContent) == "string") {
needsolution.solutionContent = JSON.parse(needsolution.solutionContent);
}
var solution = needsolution.solutionContent.solution;
var self = this;
//推送方案
// 2020 0916 lin 修改 增加获取返回值
//var pushIcpSolutionRes = await this.pushIcpSolution(pushObj, needsolution.solutionNo, pobj.appInfo, self);
//2020-10-26 laolan 区分百度与阿里
if(needinfo.uapp_id == uappId.ali){
//推送数据至阿里
// var bizType = needinfo.channelTypeCode;//业务类型里
var pushObj = {
IntentionBizId: needinfo.channelNeedNo,
CompanyName: solution.CompanyName,
IcpType: solution.IcpType,
CompanyAddress: solution.CompanyAddress,
Area: solution.Area,
Note: solution.Note,
ActionType:solution.ActionType,
Source:"官网"
};
if (needsolution.channelSolutionNo) {
pushObj["BizId"] = needsolution.channelSolutionNo;
}
var pushIcpSolutionRes = await this.pushIcpSolution(pushObj, needsolution.solutionNo, pobj.appInfo, self);
}
if(needinfo.uapp_id == uappId.baidu){
//推送数据至baidu
// var bizType = needinfo.channelTypeCode;//业务类型里
solution.Area = cityLetter[solution.Area]
console.log('solution.Area++',solution.Area)
var pushObj = {
requirementId: needinfo.channelNeedNo,
companyName: solution.CompanyName,
companyAddress: solution.CompanyAddress,
area: solution.Area,
type:solution.ActionType
};
if (needsolution.channelSolutionNo) {
pushObj["bizId"] = needsolution.channelSolutionNo;
}
console.log('pushObj++',pushObj)
var pushIcpSolutionRes = await this.pushBaiduIcpSolution(pushObj, needsolution.solutionNo, pobj.appInfo, self);
}
// // 2020 0806 lin 新增推送
// var reqParams = {
// actionType: "produceData",// Y 功能名称
// actionBody: {
// pushUrl: pushUrl,// Y 推送地址
// actionType: "updateChanceStatus",// Y 推送地址接收时的功能名称
// notifyUrl: "",// N 推送成功后通知的Url
// identifyCode: "ali.vat",// Y 操作的业务标识
// messageBody: pobj.actionBody, // Y 推送的业务消息,必须有一项对象属性值
// headData: ""//N 请求头信息,Json格式,如:{token:"XXXXXXX"}
// },
// requestId: pobj.requestId || "" // N 请求id
// }
// this.opQueuePushClientPost(pobj, this.opPushQueueUrl, reqParams);
this.logCtl.info({
appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "",
appkey: pobj.appInfo ? pobj.appInfo.uapp_key || "" : "",
requestId: pobj.requestId || "",
op: "service/impl/common/qcCenterOrderSve.js/submitIcpProgramme",
content: JSON.stringify(pobj),
resultInfo: JSON.stringify(needinfo),
optitle: "createSolution推送蜂擎获取的接口信息->aliBusiness2Delivery",
});
var reqParams = {
actionBody: {
intentionBizId: needinfo.channelNeedNo,
status: "createSolution"
},
appInfo: pobj.appInfo
}
this.utilsPushSve.aliBusiness2Delivery(reqParams, "updateChanceStatus");
//
return system.getResultSuccess(pushIcpSolutionRes);
}
return res;
}
//推送ICP方案ali
async pushIcpSolution(pushObj, solutionNo, appInfo, self) {
//推送方案信息
var pushRes = await self.aliclient.reqbyget({ action: "SubmitIcpSolution", reqbody: pushObj, apiVersion: "2019-05-08" });
if (pushRes && pushRes.status == 0 && pushRes.data) {
var resData = pushRes.data;
if (resData.BizId) {
var reqObj2 = {
actionType: "receiveProgrammeNo",
appInfo: appInfo,
actionBody: {
solutionNo: solutionNo,
solutionBizId: resData.BizId
}
};
var a = await self.reqCenterOrderApi(reqObj2);//保存渠道方案id
if (a && a.status == 0) {
//推送方案确认信息
var confirmRes = await self.aliclient.reqbyget({ action: "ConfirmIntention", reqbody: { BizId: pushObj.IntentionBizId }, apiVersion: "2019-05-08" });
if (confirmRes && confirmRes.status == 0 && confirmRes.data) {
var confirmResData = confirmRes.data;
if (confirmResData.ConfirmUrl) {
var reqObj3 = {
actionType: "receiveIcpConfirmUrl",
appInfo: appInfo,
actionBody: {
solutionNo: solutionNo,
confirmUrl: confirmResData.ConfirmUrl
}
};
var a = await self.reqCenterOrderApi(reqObj3);//保存用户确认方案url
}
}
return confirmRes;
}
}
}
}
//推送ICP方案baidu 2020-10-26 laolan
async pushBaiduIcpSolution(pushObj, solutionNo, appInfo, self) {
console.log('pushObj++baidu+++',pushObj)
//推送方案信息
var pushRes = await self.baiduclient.baiduReqbyget({ path: "/api/bla/provider/plan", reqbody: pushObj });
console.log("pushRes++++",pushRes)
if (pushRes && pushRes.status == 0 && pushRes.data) {
var resData = pushRes.data;
if (resData.planId) {
var reqObj2 = {
actionType: "receiveProgrammeNo",
appInfo: appInfo,
actionBody: {
solutionNo: solutionNo,
solutionBizId: resData.planId
}
};
var a = await self.reqCenterOrderApi(reqObj2);//保存渠道方案id
console.log("保存渠道方案id aaaa++ ",a)
if (a && a.status == 0 && resData.path) {
var reqObj3 = {
actionType: "receiveIcpConfirmUrl",
appInfo: appInfo,
actionBody: {
solutionNo: solutionNo,
confirmUrl: resData.path
}
};
var url = await self.reqCenterOrderApi(reqObj3);//保存用户确认方案url
console.log('save confirmUrl ++ ',url)
return pushRes;
}
}
}
}
//服务商icp方案关闭 2020-10-26 laolan //查询需求列表 2020-11-11 laolan
async abolishIcpProgramme(pobj) { async rtGetNeedList(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) { if (res && res.status == 0 && res.data) {
var needsolution = res.data;//方案信息 if(res.data.uapp_id == uappId.baidu){
var ab = pobj.actionBody; var pushObj = {
if (typeof (ab.material) == "string") { type:res.data.type,
ab.material = JSON.parse(ab.material); begin:res.data.begin || "",
end:res.data.end || "",
intentionBizId:res.data.intentionBizId,
status:res.data.status,
area:res.data.area,
pagreSize:res.data.pagreSize || 10,
pageNum:res.data.pageNum || 1
}
//查询需求列表
var r = await this.baiduclient.baiduReqbyget({ path: "////", reqbody: pushObj });
console.log('rt rrrr+++++',r)
} }
//推送数据至阿里 return getResultSuccess();
var pushObj = {
BizId: ab.BizId, Note: ab.Note
};
//关闭方案
this.aliclient.reqbyget({ action: "CloseIcpProduce", reqbody: pushObj, apiVersion: "2019-05-08" });
return system.getResultSuccess();
} }
return res; return res
} }
//交付材料提交 //交付材料提交 2020-11-11 laolan
async serviceProviderSubmitMaterial(pobj) { async rtSubmitMaterial(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) { if (res && res.status == 0 && res.data) {
var needsolution = res.data;//方案信息 var needsolution = res.data;//方案信息
...@@ -289,302 +113,290 @@ class RtService extends AppServiceBase { ...@@ -289,302 +113,290 @@ class RtService extends AppServiceBase {
ab.material = JSON.parse(ab.material); ab.material = JSON.parse(ab.material);
} }
var material = ab.material; var material = ab.material;
if(res.data.uapp_id == uappId.ali){
//推送数据至阿里
var BizId = needsolution.channelSolutionNo;//⽅案业务ID
var pushObj = {
"BizId": BizId,
"Domain": material.Domain,
"CorporateName": material.CorporateName,
"IncludeForeignInvestment": material.IncludeForeignInvestment,
"PartnerBusinessLicense": material.PartnerBusinessLicense,
"PartnerIdCardList": material.PartnerIdCardList,
"PartnerDomainCertificate": material.PartnerDomainCertificate,
"PartnerPreviewOtherList": material.PartnerPreviewOtherList || [],
"PartnerPlan": material.PartnerPlan || "",
"PartnerForeignInvestment": material.PartnerForeignInvestment || "",
"PartnerLaw": material.PartnerLaw || "",
"PartnerStampOtherList": material.PartnerStampOtherList || [],
"PartnerSignOtherList": material.PartnerSignOtherList || [],
"PartnerSignAndStampOtherList": material.PartnerSignAndStampOtherList || []
};
var self = this;
//推送方案材料
self.aliclient.reqbyget({ action: "SavePartnerSubmitMaterial", reqbody: pushObj, apiVersion: "2019-05-08" });
}
if(res.data.uapp_id == uappId.baidu){ if(res.data.uapp_id == uappId.baidu){
//推送数据至百度 //推送数据至百度
var BizId = needsolution.orderChannelNo; var bizId = needsolution.orderChannelNo;
console.log('BizId++',BizId) console.log('rt bizId++',bizId)
var pushObj = { var pushObj = {
"orderNo": bizId,
"businessLicense" : { "businessLicense" : {
"createdAt" : material.BusinessLicense.CreatedAt || "", "name" :material.businessLicense.name || "",
"enterpriseCode" :material.BusinessLicense.EnterpriseCode || "", "type" : material.businessLicense.type || "",
"legalRepresentative" :material.BusinessLicense.LegalRepresentative || "", "address" :material.businessLicense.address || "",
"address" :material.BusinessLicense.Address || "", "createdAt" : material.businessLicense.createdAt || "",
"registeredCapital" : material.BusinessLicense.RegisteredCapital || "", "businessTerm" :material.businessLicense.businessTerm || "",
"name" :material.BusinessLicense.Name || "", "scopeBusiness" :material.businessLicense.scopeBusiness || "",
"businessTerm" :material.BusinessLicense.BusinessTerm || "", "enterpriseCode" :material.businessLicense.enterpriseCode || "",
"type" : material.BusinessLicense.Type || "", "registeredCapital" : material.businessLicense.registeredCapital || "",
"scopeBusiness" :material.BusinessLicense.ScopeBusiness || "" "legalRepresentative" :material.businessLicense.legalRepresentative || "",
}, },
"partnerForeignInvestment": material.PartnerForeignInvestment || "", "partnerBusinessLicense": material.partnerBusinessLicense || "",
"orderNo": BizId, "legalPersonIdentityCard":material.legalPersonIdentityCard || "",
"domain": material.Domain, "administrativeLicenseAuthorization":material.administrativeLicenseAuthorization || "",
"corporateName": material.CorporateName, "companyPolicy":material.companyPolicy || "",
"includeForeignInvestment": material.IncludeForeignInvestment, "mainManagement":material.mainManagement || "",
"partnerBusinessLicense": material.PartnerBusinessLicense, "radioAndTelevisionQualifications":material.radioAndTelevisionQualifications || "",
"partnerIdCardList": material.PartnerIdCardList, "registeredAddressCertificateDocument":material.registeredAddressCertificateDocument || "",
"partnerDomainCertificate": material.PartnerDomainCertificate, "partnerOtherList":material.partnerOtherList || ""
"partnerPreviewOtherList": material.PartnerPreviewOtherList || [],
"partnerPlan": material.PartnerPlan || "",
"partnerLaw": material.PartnerLaw || "",
"partnerStampOtherList": material.PartnerStampOtherList || [],
"partnerSignOtherList": material.PartnerSignOtherList || [],
"partnerSignAndStampOtherList": material.PartnerSignAndStampOtherList || []
}; };
var self = this;
//推送方案材料 //推送方案材料
var r = await self.baiduclient.baiduReqbyget({ path: "/api/bla/provider/license/material", reqbody: pushObj }); var r = await this.baiduclient.baiduReqbyget({ path: "/api/bla/provider/license/material", reqbody: pushObj });
console.log('rrrr+++++',r) console.log('rt rrrr+++++',r)
} }
return system.getResultSuccess(); return system.getResultSuccess();
} }
return res; return res;
} }
//通知交付状态变更 //通知交付状态变更 2020-11-11 laolan
async serviceProviderNotification(pobj) { async rtNotification(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) { if (res && res.status == 0 && res.data) {
if(res.data.uapp_id == uappId.ali){ if(res.data.uapp_id == uappId.baidu){
//推送数据至阿里 res.data.applicationStatus = baiduIcpStatus[res.data.applicationStatus];
var pushObj = { console.log('rt res.data.channelOrderNo+++',res.data.channelOrderNo)
BizId: res.data.BizId, //推送数据至百度
OfficialFileURL: res.data.OfficialFileURL, var pushObj = {
ApplicationStatus: res.data.ApplicationStatus orderNo: res.data.channelOrderNo,
}; status: res.data.applicationStatus,
//推送状态变更 };
this.aliclient.reqbyget({ action: "AcceptPartnerNotification", reqbody: pushObj, apiVersion: "2019-05-08" }); //推送状态变更
} var r = await this.baiduclient.baiduReqbyget({ path: "/api/bla/provider/license/update", reqbody: pushObj });
console("rt tongzhi+++",r)
if(res.data.uapp_id == uappId.baidu){ }
res.data.ApplicationStatus = baiduIcpStatus[res.data.ApplicationStatus];
console.log('res.data.channelOrderNo',res.data.channelOrderNo)
//推送数据至百度
var pushObj = {
orderNo: res.data.channelOrderNo,
status: res.data.ApplicationStatus
};
//推送状态变更
this.baiduclient.baiduReqbyget({ path: "/api/bla/provider/license/update", reqbody: pushObj });
}
return system.getResultSuccess(); return system.getResultSuccess();
} }
return res; return res;
} }
//交付单关闭
async closeOrderDelivery(pobj) {
//提交方案 2020-11-11 laolan
async rtSubmitSolution(pobj) {
console.log('rt+++pobj',pobj)
var res = await this.reqCenterOrderApi(pobj, "action/qcapi/springBoard"); var res = await this.reqCenterOrderApi(pobj, "action/qcapi/springBoard");
console.log('rt+++res',res)
if (res && res.status == 0 && res.data) { if (res && res.status == 0 && res.data) {
var needsolution = res.data;//方案信息 console.log('rt solutionContent+++',res.data.needsolution.solutionContent);
var ab = pobj.actionBody; var solution = res.data.needsolution.solutionContent;
//推送数据至阿里 var needsolution = res.data.needsolution;//方案信息
var pushObj = { solution = JSON.parse(solution);
BizId: needsolution.channelSolutionNo, Note: ab.note solution = solution.solution
}; solution = JSON.stringify(solution)
//关闭方案
this.aliclient.reqbyget({ action: "CloseIcpProduce", reqbody: pushObj, apiVersion: "2019-05-08" }); //推送交付系统
return system.getResultSuccess(); var reqParams = {
actionBody: {
intentionBizId: pobj.actionBody.needNo,
status: "createSolution"
},
opType: "updateChanceStatus",
appInfo: pobj.appInfo
}
var self = this;
self.utilsPushSve.aliBusiness2Delivery(reqParams, "updateChanceStatus");
//日志记录
self.logCtl.info({
appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "",
appkey: pobj.appInfo ? pobj.appInfo.uapp_key || "" : "",
requestId: pobj.requestId || "",
op: "service/impl/common/rtSve.js/rtSubmitSolution",
content: JSON.stringify(reqParams),
resultInfo: "",
optitle: "updateChanceStatus推送蜂擎获取的接口信息->aliBusiness2Delivery",
});
if(res.data.uapp_id == uappId.baidu){
//推送数据至baidu
var pushObj = {
intentionBizId: res.data.needinfo.channelNeedNo,
bizType: res.data.needinfo.channelTypeCode,
// solution: res.data.needsolution.solutionContent
solution: solution
};
console.log("rt pushObj+++",pushObj);
var r = await this.pushBaiduRtSubmitSolution(pushObj, needsolution.solutionNo, pobj.appInfo, self);
console.log('rt rr+++',r)
return system.getResultSuccess();
}
} }
return res; return res;
} }
//推送方案baidu 2020-11-11 laolan
async pushBaiduRtSubmitSolution(pushObj, solutionNo, appInfo, self) {
//推送状态变更
var pushRes = await this.baiduclient.baiduReqbyget({ path: "///", reqbody: pushObj });
console.log(' rt++++pushRes',pushRes)
if (pushRes && pushRes.status == 0 && pushRes.data) {
var resData = pushRes.data;
var reqObj2 = {
actionType: "rtReceiveProgrammeNo",
appInfo: appInfo,
actionBody: {
solutionNo: solutionNo,
solutionBizId: resData.SolutionBizId
}
};
var a = await self.reqCenterOrderApi(reqObj2);//保存渠道方案id
return a;
}
}
// ----------- 广电 ----------- //提交沟通记录 2020-11-11 laolan
async rtWriteCommunicationRecord(pobj) {
console.log('rt 提交沟通记录pobj',pobj)
var res = await this.reqCenterOrderApi(pobj, "action/qcapi/springBoard");
console.log('rt 提交沟通记录res',res)
if(res && res.data && res.status == 0){
//推送交付系统
var reqParams = {
actionBody: {
intentionBizId: pobj.actionBody.needNo,
status: "followingUp"
},
opType: "updateChanceStatus",
appInfo: pobj.appInfo
}
var push = await self.utilsPushSve.aliBusiness2Delivery(reqParams, "updateChanceStatus");
if( push && res.data.uapp_id == uappId.baidu){
//推送数据至baidu
var pushObj = {
intentionBizId: pobj.actionBody.needNo,
note: pobj.actionBody.note
};
//提交沟通记录
var r = await this.baiduclient.baiduReqbyget({ path: "////", reqbody: pushObj });
}
console.log('rt 提交沟通记录r++',r)
return system.getResultSuccess();
}
}
//服务商提交服务操作 //查看沟通记录 2020-11-11 laolan
async foodServiceSubmitOption(pobj) { async rtGetCommunicationRecord(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) { console.log('rt 查看沟通记录res-----',res)
//推送数据至阿里 if(res && res.data && res.status == 0){
var resStatus = res.data.ApplicationStatus; if(res.data.uapp_id == uappId.baidu){
var pushObj = { //推送数据至baidu
BizId: pobj.actionBody.orderNo, var pushObj = {
BizType: pobj.actionBody.channelTpye, beginTime: pobj.actionBody.beginTime ? pobj.actionBody.beginTime : "",
OperateType: wangwenStatusDisct[resStatus], endTime: pobj.actionBody.endTime ? pobj.actionBody.endTime : "",
ExtInfo:pobj.actionBody.extInfo intentionBizId: pobj.actionBody.needNo,
}; pageNum: pobj.actionBody.pageNum || 1,
//推送状态变更 pageSize: pobj.actionBody.pageSize || 10,
var r = await this.aliclient.reqbyget({ action: "OperateProduceForPartner", reqbody: pushObj, apiVersion: "2020-03-06" }); };
console.log('ttttssss',r) //查看沟通记录
return system.getResultSuccess(); var r = await this.baiduclient.baiduReqbyget({ path: "////", reqbody: pushObj });
if(r && r.data && r.data.data){
var len = r.data.data.length;
for(var i=0; i<len;i++){
r.data.data[i].createTime = r.data.data[i].createTime / 1000
}
}
console.log('rt 查看沟通记录++',r)
}
return system.getResultSuccess(r);
}
} }
return res;
}
//提交方案
async submitFoodSolution(pobj) { //关闭需求 2020-11-11 laolan
console.log('food+++pobj',pobj) async rtCloseNeed(pobj) {
var res = await this.reqCenterOrderApi(pobj, "action/qcapi/springBoard"); pobj.actionBody.intentionBizId = pobj.actionBody.channelNeedNo;
console.log('food+++res',res) pobj.actionType = "rtClosePlan"
if (res && res.status == 0 && res.data) { var reqUrl = this.centerOrderUrl + "action/qcapi/springBoard";
console.log('food',res.data.needsolution.solutionContent); var result = await this.restPostUrl(pobj, reqUrl);
var solution = res.data.needsolution.solutionContent; console.log('rt 关闭需求result-----',result)
var needsolution = res.data.needsolution;//方案信息 if (result.status == 0) {
solution = JSON.parse(solution); if (result.data) {
solution = solution.solution pobj.actionBody.orderNo = result.data;
solution = JSON.stringify(solution) var orderrtn = await self.utilsOrderSve.delOrder(pobj, pobj.actionBody);
if (orderrtn.status < 0) {
return system.getResultFail(-5022, "订单关闭失败");
}
}
//推送交付系统 //推送交付系统
var reqParams = { var reqParams = {
actionBody: { actionBody: {
intentionBizId: pobj.actionBody.needNo, intentionBizId: pobj.actionBody.needNo,
status: "createSolution" status: "closeNeed"
}, },
opType: "updateChanceStatus", opType: "updateChanceStatus",
appInfo: pobj.appInfo appInfo: pobj.appInfo
} }
var self = this; this.utilsPushSve.aliBusiness2Delivery(reqParams, "updateChanceStatus");
self.utilsPushSve.aliBusiness2Delivery(reqParams, "updateChanceStatus");
//日志记录 //日志记录
self.logCtl.info({ this.logCtl.info({
appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "", appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "",
appkey: pobj.appInfo ? pobj.appInfo.uapp_key || "" : "", appkey: pobj.appInfo ? pobj.appInfo.uapp_key || "" : "",
requestId: pobj.requestId || "", requestId: pobj.requestId || "",
op: "service/impl/common/qcCenterOrderSve.js/submitFoodSolution", op: "service/impl/common/rtSve.js/rtCloseNeed",
content: JSON.stringify(reqParams), content: JSON.stringify(reqParams),
resultInfo: "", resultInfo: "",
optitle: "updateChanceStatus推送蜂擎获取的接口信息->aliBusiness2Delivery", optitle: "updateChanceStatus推送蜂擎获取的接口信息->aliBusiness2Delivery",
}); });
//推送数据至阿里 if(res.data.uapp_id == uappId.baidu){
var pushObj = { // 推送baidu
intentionBizId: res.data.needinfo.channelNeedNo, var pushObj = {
bizType: res.data.needinfo.channelTypeCode, intentionBizId: pobj.actionBody.needNo,
// solution: res.data.needsolution.solutionContent bizType: pobj.actionBody.bizType,
solution: solution note : pobj.actionBody.note
}; }
console.log("food",pushObj); var a = await this.baiduclient.baiduReqbyget({ path: "////", pushObj });
this.pushSubmitSolution(pushObj, needsolution.solutionNo, pobj.appInfo, self); console.log('rt closeNeed+++',a)
return system.getResultSuccess(); }
this.utilsPushSve.aliBusiness2Fq(pobj, "pushCloseRtNeed");
return system.getResultSuccess();
} else {
return system.getResult(null, "close fail 100389 ");
}
} }
return res;
}
//关闭需求
async foodCloseNeed(pobj) {
if (!pobj.actionBody.needNo) { //服务商方案关闭 2020-11-11 laolan
return system.getResult(null, "actionBody.needNo can not be empty,100395"); async rtClosePlan(pobj) {
} var res = await this.reqCenterOrderApi(pobj, "action/qcapi/springBoard");
if (!pobj.actionBody.note) { if (res && res.status == 0 && res.data) {
return system.getResult(null, "actionBody.note can not be empty,100395"); var needsolution = res.data;//方案信息
} var ab = pobj.actionBody;
var self = this; if (typeof (ab.material) == "string") {
pobj.actionBody.intentionBizId = pobj.actionBody.needNo; ab.material = JSON.parse(ab.material);
pobj.actionType = "abolishIcpProgrammeByNeed"
var reqUrl = this.centerOrderUrl + "action/qcapi/springBoard";
var result = await this.restPostUrl(pobj, reqUrl);
console.log('food+++result',result)
if (result.status == 0) {
if (result.data) {
pobj.actionBody.orderNo = result.data;
var orderrtn = await self.utilsOrderSve.delOrder(pobj, pobj.actionBody);
if (orderrtn.status < 0) {
return system.getResultFail(-5022, "订单关闭失败");
} }
if(res.data.uapp_id == uappId.baidu){
//推送数据至baidu
var pushObj = {
bizId: ab.bizId,
note: ab.note
};
//关闭方案
var r = await this.baiduclient.baiduReqbyget({ path: "////", reqbody: pushObj });
console.log('rt closePlan +++',r)
}
return system.getResultSuccess();
} }
return res;
//推送交付系统
var reqParams = {
actionBody: {
intentionBizId: pobj.actionBody.needNo,
status: "closeNeed"
},
opType: "updateChanceStatus",
appInfo: pobj.appInfo
}
var self = this;
self.utilsPushSve.aliBusiness2Delivery(reqParams, "updateChanceStatus");
//日志记录
self.logCtl.info({
appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "",
appkey: pobj.appInfo ? pobj.appInfo.uapp_key || "" : "",
requestId: pobj.requestId || "",
op: "service/impl/common/qcCenterOrderSve.js/foodCloseNeed",
content: JSON.stringify(reqParams),
resultInfo: "",
optitle: "updateChanceStatus推送蜂擎获取的接口信息->aliBusiness2Delivery",
});
// 推送ali
var a = await self.aliclient.reqbyget({ action: "CloseIntentionForPartner", reqbody: { IntentionBizId: pobj.actionBody.needNo, BizType: "esp.wangwen" ,Note : pobj.actionBody.note}, apiVersion: "2020-03-06" });
self.utilsPushSve.aliBusiness2Fq(pobj, "pushCloseFoodNeed");
return system.getResultSuccess();
} else {
return system.getResult(null, "close fail 100389 ");
}
}
//提交沟通记录
async foodRecordLog(pobj) {
console.log('提交沟通记录pobj',pobj)
var res = await this.reqCenterOrderApi(pobj, "action/qcapi/springBoard");
if (!pobj.actionBody.needNo) {
return system.getResult(null, "actionBody.needNo can not be empty,100491");
}
if (!pobj.actionBody.note) {
return system.getResult(null, "actionBody.note can not be empty,100492");
}
var self = this;
var reqUrl = this.centerOrderUrl + "action/qcapi/springBoard";
var result = await this.restPostUrl(pobj, reqUrl);
console.log('提交沟通记录result',result)
//推送交付系统
var reqParams = {
actionBody: {
intentionBizId: pobj.actionBody.needNo,
status: "followingUp"
},
opType: "updateChanceStatus",
appInfo: pobj.appInfo
} }
self.utilsPushSve.aliBusiness2Delivery(reqParams, "updateChanceStatus");
//推送数据至阿里
var pushObj = {
IntentionBizId: pobj.actionBody.needNo,
note: pobj.actionBody.note
};
//提交沟通记录
var r = await this.aliclient.reqbyget({ action: "SubmitIntentionNote", reqbody: pushObj, apiVersion: "2020-03-06" });
console.log('提交沟通记录r',r) //交付单关闭 2020-11-11 laolan
return system.getResultSuccess(); async rtCloseOrderDelivery(pobj) {
} var res = await this.reqCenterOrderApi(pobj, "action/qcapi/springBoard");
if (res && res.status == 0 && res.data) {
//查看沟通记录 var needsolution = res.data;//方案信息
async foodRecordLogList(pobj) { var ab = pobj.actionBody;
if (!pobj.actionBody.needNo) { if(res.data.uapp_id == uappId.baidu){
return system.getResult(null, "actionBody.needNo can not be empty,100493"); //推送数据至baidu
} var pushObj = {
let res = await this.aliclient.reqbyget({ bizId: needsolution.channelSolutionNo,
action: "ListIntentionNote", reqbody: { note: ab.note
BeginTime: pobj.actionBody.BeginTime ? pobj.actionBody.BeginTime : "", };
EndTime: pobj.actionBody.EndTime ? pobj.actionBody.EndTime : "", //关闭方案
IntentionBizId: pobj.actionBody.needNo, var r = await this.baiduclient.baiduReqbyget({ path: "///", reqbody: pushObj });
PageNum: pobj.actionBody.pageNum || 1, console.log('rt 交付单关闭+++',r)
PageSize: pobj.actionBody.pageSize || 10, }
}, apiVersion: "2020-03-06" return system.getResultSuccess();
});
if(res && res.data && res.data.Data){
var len = res.data.Data.length;
for(var i=0; i<len;i++){
res.data.Data[i].CreateTime = res.data.Data[i].CreateTime / 1000
} }
return res;
} }
return system.getResultSuccess(res);
}
} }
module.exports = RtService; module.exports = RtService;
\ No newline at end of file
var system = require("../../../system");
const AppServiceBase = require("../../app.base");
var settings = require("../../../../config/settings");
//此类用来db中配置来进行调用-主要功能是推送渠道合作方
class UtilsChannelPartnerService extends AppServiceBase {
constructor() {
super();
this.opPushQueueUrl = settings.opPushQueueUrl();
this.signSve = system.getObject("service.common.signSve");
}
/**
* 推送业务信息到渠道合作方
* 业务操作的信息不变外加增加组装的一些参数(推送方案、订单交付信息)
* @param {*} pobj
*/
async pushBusiness2Channel(pobj) {//推送业务信息到渠道合作方
console.log(pobj,"pushBusiness2Channel-zhuangbing------------------------------");
var verifyResult = await this.verifyParam(pobj);
if (verifyResult.status != 0) {
return await this.disposePushResultFail(pobj, verifyResult, "deliver->pushBusiness2Channel->verifyResult", this.pushlogFailType.FQ);
}
var actionbody = pobj.actionBody;
var interface_params_info = verifyResult.data;
if(interface_params_info.headData){
interface_params_info.headData.appcode = pobj.appInfo.app_code;
interface_params_info.headData.sign = verifyResult.sign;
interface_params_info.headData.appkey = pobj.appInfo.uapp_key;
}
var reqParams = {
actionType: "produceData",// Y 功能名称
actionBody: {
pushUrl: interface_params_info.pushUrl,// Y 推送地址
actionType: interface_params_info.actionType,// Y 推送地址接收时的功能名称
notifyUrl: interface_params_info.notifyUrl || "",// N 推送成功后通知的Url
identifyCode: interface_params_info.identifyCode,// Y 操作的业务标识
messageBody: actionbody, // Y 推送的业务消息,必须有一项对象属性值
headData: interface_params_info.headData //N 请求头信息,Json格式,如:{token:"XXXXXXX"}
},
requestId: pobj.requestId || "" // N 请求id
}
var opQueuePushClientPostRes = await this.opQueuePushClientPost(pobj, this.opPushQueueUrl, reqParams);
console.log(opQueuePushClientPostRes,"pushBusiness2Channel-zhuangbing----2--------------------------");
}
//--------------------------------------------------内部辅助方法-------------------start-----------------
async opQueuePushClientPost(pobj, pushQueueUrl, reqParams) {
try {
var rtn = await this.restPostUrl(reqParams, pushQueueUrl);
if (rtn.status != 1) {
return system.getResult(null, "推送队列接收数据失败,失败原因:" + JSON.stringify(rtn));
}
return system.getResultSuccess(null, "推送成功");
} catch (e) {
//日志记录
this.logCtl.error({
appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "",
appkey: pobj.appInfo ? pobj.appInfo.uapp_key || "" : "",
requestId: pobj.requestId || "",
op: "utilsSve/utilsChannelPartnerSve/opQueuePushClientPost",
content: "error:" + e.stack,
// clientIp: pobj.clientIp,
optitle: pobj.opType + "推送操作异常deliver->opQueuePushClientPost",
});
return system.getResult(null, "推送操作异常deliver->opQueuePushClientPost->error:" + e.stack);
}
}
async verifyParam(pobj) {//参数信息验证
var verify = system.getResultSuccess();
if (!pobj.interface_params) {
verify = system.getResult(null, "interface_params can not be empty,100400");
}
var interface_params_info = JSON.parse(pobj.interface_params);
if (!interface_params_info || !interface_params_info.pushUrl || !interface_params_info.headData) {
verify = system.getResult(null, "interface_params(pushUrl、headData) can not be empty,100430");
}
if(!pobj || !pobj.appInfo || !pobj.appInfo.app_code){
verify = system.getResult(null, "appInfo can not be empty,100450");
}
var signRes = await this.signSve.createSign({actionBody:pobj.actionBody,actionType: interface_params_info.actionType},pobj.appInfo.uapp_secret);
if(signRes && signRes.status==0){
verify.sign=signRes.data;
}else{
verify = system.getResult(null, "creatSign fail!,100470");
}
verify.data = interface_params_info;
console.log(verify,"app/base/service/impl/utilsSve/utilsChannelPartnerSve.js____verifyParam___________________");
return verify;
}
//--------------------------------------------------内部辅助方法-------------------end-----------------
}
module.exports = UtilsChannelPartnerService;
...@@ -14,6 +14,7 @@ class UtilsDeliverSystemService extends AppServiceBase { ...@@ -14,6 +14,7 @@ class UtilsDeliverSystemService extends AppServiceBase {
* @param {*} pobj * @param {*} pobj
*/ */
async pushBusiness2DeliverSystem(pobj) {//推送业务信息到交付系统 async pushBusiness2DeliverSystem(pobj) {//推送业务信息到交付系统
console.log(pobj,"pushBusiness2DeliverSystem-zhuangbing------------------------------");
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);
...@@ -36,7 +37,8 @@ class UtilsDeliverSystemService extends AppServiceBase { ...@@ -36,7 +37,8 @@ class UtilsDeliverSystemService extends AppServiceBase {
}, },
requestId: pobj.requestId || "" // N 请求id requestId: pobj.requestId || "" // N 请求id
} }
await this.opQueuePushClientPost(pobj, this.opPushQueueUrl, reqParams); var opQueuePushClientPostRes = await this.opQueuePushClientPost(pobj, this.opPushQueueUrl, reqParams);
console.log(opQueuePushClientPostRes,"pushBusiness2DeliverSystem-zhuangbing----2--------------------------");
} }
//--------------------------------------------------内部辅助方法-------------------start----------------- //--------------------------------------------------内部辅助方法-------------------start-----------------
......
...@@ -1456,6 +1456,7 @@ class UtilsNeedService extends AppServiceBase { ...@@ -1456,6 +1456,7 @@ class UtilsNeedService extends AppServiceBase {
var url = settings.centerOrderUrl() + "action/qcapi/springBoard"; var url = settings.centerOrderUrl() + "action/qcapi/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;
pobj.actionBody.orderNo = rtn.data.orderNo; pobj.actionBody.orderNo = rtn.data.orderNo;
pobj.actionType="delOrder"; pobj.actionType="delOrder";
var orderrtn = await self.utilsOrderSve.delOrder(pobj, actionBody); var orderrtn = await self.utilsOrderSve.delOrder(pobj, actionBody);
...@@ -1471,8 +1472,16 @@ class UtilsNeedService extends AppServiceBase { ...@@ -1471,8 +1472,16 @@ class UtilsNeedService extends AppServiceBase {
appInfo: pobj.appInfo appInfo: pobj.appInfo
} }
this.utilsPushSve.baiduBusiness2Delivery(tmpObj, "pushDeliveryStatusNotify"); this.utilsPushSve.baiduBusiness2Delivery(tmpObj, "pushDeliveryStatusNotify");
tmpObj.actionBody.orderNo = rtn.data.channelSolutionNo; // tmpObj.actionBody.orderNo = channelOrderNo;
self.utilsPushSve.baiduBusiness2Fq(tmpObj, "pushOrderICPClose"); var tmpObj2 = {
actionBody: {
orderNo: channelOrderNo,
channelNeedNo: rtn.data.channelNeedNo,
needsolution: rtn.data.solutionContent
},
appInfo: pobj.appInfo
};
self.utilsPushSve.baiduBusiness2Fq(tmpObj2, "pushOrderICPClose");
}//通知更新状态 }//通知更新状态
return rtn; return rtn;
} }
......
...@@ -29,6 +29,30 @@ class UtilsPushService extends AppServiceBase { ...@@ -29,6 +29,30 @@ class UtilsPushService extends AppServiceBase {
return system.getResult(null, "push Fail,interface_info data is empty"); return system.getResult(null, "push Fail,interface_info data is empty");
} }
async business2Channel(pobj, opType) {//供业务调用,在代码中调用,不在db中做配置进行调用
console.log("business2Channel++++++++start++++++++++");
console.log(pobj,"business2Channel++++++++++++++++++");
pobj.actionType = "getAppInterface";
var reqUrl = settings.centerAppUrl() + "action/opProduct/springBoard";
var productItemInterfaceResult = await this.restPostUrl(pobj, reqUrl);
pobj.interface_info = productItemInterfaceResult.data;
//日志记录
this.logCtl.info({
appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "",
appkey: pobj.appInfo ? pobj.appInfo.uapp_key || "" : "",
requestId: pobj.requestId || "",
op: "service/impl/utilsSve/utilsPushSve.js/service/app.base.js/business2Channel",
content: JSON.stringify(pobj),
resultInfo: productItemInterfaceResult.data ? JSON.stringify(productItemInterfaceResult.data) : "接口数据为空",
optitle: opType + "推送获取的接口信息->business2Channel",
});
if (pobj.interface_info) {
await this.pushBusInfo(pobj, opType, 1);
return system.getResultSuccess();
}
return system.getResult(null, "push Fail,interface_info data is empty");
}
async aliBusiness2Fq(pobj, opType) {//供业务调用,在代码中调用,不在db中做配置进行调用 async aliBusiness2Fq(pobj, opType) {//供业务调用,在代码中调用,不在db中做配置进行调用
pobj.actionType = "getAppInterface"; pobj.actionType = "getAppInterface";
...@@ -53,12 +77,13 @@ class UtilsPushService extends AppServiceBase { ...@@ -53,12 +77,13 @@ class UtilsPushService extends AppServiceBase {
} }
async pushBusInfo(pobj, opType, isDelProductInfo) {//推送业务总入口,不在db中做配置进行调用 async pushBusInfo(pobj, opType, isDelProductInfo) {//推送业务总入口,不在db中做配置进行调用
console.log(JSON.stringify(pobj), ".......pushBusInfo........................."); console.log(JSON.stringify(pobj), ".......pushBusInfo........................."+opType);
var interface_list = pobj.interface_info ? pobj.interface_info : pobj.actionBody.product_info.interface_info; var interface_list = pobj.interface_info ? pobj.interface_info : pobj.actionBody.product_info.interface_info;
if (!interface_list) { if (!interface_list) {
return system.getResult(null, "暂无推送配置"); return system.getResult(null, "暂无推送配置");
} }
var interface_list_temp = interface_list.filter(f => f.op_type == opType) var interface_list_temp = interface_list.filter(f => f.op_type == opType);
console.log(interface_list_temp,"interface_list_temp+++++++++++++++");
if (!interface_list_temp || interface_list_temp.length == 0) { if (!interface_list_temp || interface_list_temp.length == 0) {
return system.getResult(null, "暂无【" + opType + "】的推送配置"); return system.getResult(null, "暂无【" + opType + "】的推送配置");
} }
...@@ -94,6 +119,8 @@ class UtilsPushService extends AppServiceBase { ...@@ -94,6 +119,8 @@ class UtilsPushService extends AppServiceBase {
} }
async reflexAction(interface_info, opType, pobj, isDelProductInfo) { async reflexAction(interface_info, opType, pobj, isDelProductInfo) {
console.log(interface_info,"reflexAction+++++++++++++++"+opType);
console.log(pobj,"reflexAction++++++2+++++++++"+opType);
var refResult = null; var refResult = null;
pobj.interface_info = interface_info; pobj.interface_info = interface_info;
pobj.opType = opType; pobj.opType = opType;
...@@ -165,6 +192,8 @@ class UtilsPushService extends AppServiceBase { ...@@ -165,6 +192,8 @@ class UtilsPushService extends AppServiceBase {
var reqUrl = settings.centerAppUrl() + "action/opProduct/springBoard"; var reqUrl = settings.centerAppUrl() + "action/opProduct/springBoard";
var productItemInterfaceResult = await this.restPostUrl(pobj, reqUrl); var productItemInterfaceResult = await this.restPostUrl(pobj, reqUrl);
pobj.interface_info = productItemInterfaceResult.data; pobj.interface_info = productItemInterfaceResult.data;
console.log(pobj,"baiduBusiness2Delivery-zhuangbing------------------------------"+opType);
console.log(productItemInterfaceResult);
//日志记录 //日志记录
this.logCtl.info({ this.logCtl.info({
appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "", appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "",
......
const co = require("co");
var request = require("request");
const crypto = require('crypto'); const crypto = require('crypto');
const sha256 = require('sha256'); const sha256 = require('sha256');
var urlencode = require('urlencode');
const system = require("../system"); const system = require("../system");
var settings = require("../../config/settings");
class baiduClient { class baiduClient {
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.baiduClientParams = settings.baiduClientParams();
} }
//2020 1027 laolan 调用百度网关 //2020 1027 laolan 调用百度网关
async baiduPost( path, actionBody) { async baiduPost( path, actionBody) {
console.log('actionBody++',actionBody) console.log('actionBody++',actionBody)
// let domain = "https://gwgp-mwnn9gk4o4e.i.bdcloudapi.com";//开发 let domain = this.baiduClientParams.domain;
let domain = "https://gwgp-nbzljnwusrw.i.bdcloudapi.com";//线上
let url = domain+path; let url = domain+path;
let version ="bce-auth-v1"; let version ="bce-auth-v1";
// let accessKey = "ed0f5c4c7c2d4e87aa335d9b07bf9bd4"; let accessKey = this.baiduClientParams.accessKey;
// let secretKey = "f600c4e91f6d43998d637401e6e34ef9"; let secretKey = this.baiduClientParams.secretKey;
let accessKey = "0e5abf33ef07457f8dbd779287747c0c";
let secretKey = "9d86f04a85db4cdfa95ba8ad28009188";
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:gwgp-nbzljnwusrw.i.bdcloudapi.com" let canonicalHeaders = "host:"+this.baiduClientParams.host;
//中间结果1:规范化请求和前缀字符串 //中间结果1:规范化请求和前缀字符串
let canonicalRequest = "POST" + "\n" + path + "\n" + "\n" + canonicalHeaders; let canonicalRequest = "POST" + "\n" + path + "\n" + "\n" + canonicalHeaders;
//authStringPrefix(前缀字符串,由除sk字段外的签名信息生成) //authStringPrefix(前缀字符串,由除sk字段外的签名信息生成)
...@@ -67,7 +63,7 @@ class baiduClient { ...@@ -67,7 +63,7 @@ class baiduClient {
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:"gwgp-nbzljnwusrw.i.bdcloudapi.com" host:this.baiduClientParams.host
}, // set the http request headers }, // set the http request headers
}); });
console.log('baidu++++res+++',res) console.log('baidu++++res+++',res)
...@@ -97,3 +93,5 @@ class baiduClient { ...@@ -97,3 +93,5 @@ class baiduClient {
} }
} }
module.exports = baiduClient; module.exports = baiduClient;
// var task = new baiduClient();
// console.log(task.baiduClientParams,"11111111111111111");
\ No newline at end of file
...@@ -14,17 +14,18 @@ module.exports = { ...@@ -14,17 +14,18 @@ module.exports = {
"orderTotalSum", "collect", "reg", "orderCheck", "getReOrderList", "getOfficalList", "addReviewList", "opSubmitNeed", "opNeedClose", "opNeedList", "orderTotalSum", "collect", "reg", "orderCheck", "getReOrderList", "getOfficalList", "addReviewList", "opSubmitNeed", "opNeedClose", "opNeedList",
"getItemByNeedNo", "opNeedDetailByChannelNo", "getNeedListUser", "manualEvaluation", "diagnosisInfo", "check", "enterpriseInfo", "diagnosisDetail", "getItemByNeedNo", "opNeedDetailByChannelNo", "getNeedListUser", "manualEvaluation", "diagnosisInfo", "check", "enterpriseInfo", "diagnosisDetail",
"submitIcpIntention", "queryIntentionList", "confirmIcpIntention", "tmAccept", "tmStatus", "needBatchUpload", "submitIcpIntention", "queryIntentionList", "confirmIcpIntention", "tmAccept", "tmStatus", "needBatchUpload",
"ncServiceSubmitOption", "ncSubmitSolution", "ncCloseNeed", "ncWriteCommunicationRecord", "ncGetCommunicationRecord", "rtServiceSubmitOption", "rtSubmitSolution", "ncSubmitMaterial","ncNotification","ncSubmitSolution","ncWriteCommunicationRecord","ncGetCommunicationRecord","ncCloseNeed","ncClosePlan","ncCloseOrderDelivery",
"rtCloseNeed", "rtWriteCommunicationRecord", "rtGetCommunicationRecord", "getParamsFor360", "addOrderWeb", "getPayRecords", "getLoginInfo", "putUserMobileByVcode", "rtSubmitMaterial","rtNotification","rtSubmitSolution","rtWriteCommunicationRecord","rtGetCommunicationRecord","rtCloseNeed","rtClosePlan","rtCloseOrderDelivery",
"getParamsFor360", "addOrderWeb", "getPayRecords", "getLoginInfo", "putUserMobileByVcode",
"putUserPwdByMobile", "icpNotifyNew" "putUserPwdByMobile", "icpNotifyNew"
], ],
apiMustUserpinList: [ apiMustUserpinList: [
"icpOrderClose", "icpOrderClose",
"submitNeed", "paySuccess", "icpNotify", "getLoginInfo", "icpNotifyNew", "submitIcpProgramme","serviceProviderSubmitMaterial","abolishIcpProgramme", "submitNeed", "paySuccess", "icpNotify", "getLoginInfo", "icpNotifyNew", "submitIcpProgramme","serviceProviderSubmitMaterial","abolishIcpProgramme",
"submitService","serviceProviderNotification", "submitService","serviceProviderNotification",
"ncServiceSubmitOption", "ncSubmitSolution", "ncCloseNeed", "ncWriteCommunicationRecord", "ncGetCommunicationRecord", "rtServiceSubmitOption", "rtSubmitSolution", "ncGetNeedList","ncSubmitMaterial","ncNotification","ncSubmitSolution","ncWriteCommunicationRecord","ncGetCommunicationRecord","ncCloseNeed","ncClosePlan","ncCloseOrderDelivery",
"rtCloseNeed", "rtWriteCommunicationRecord", "rtGetCommunicationRecord", "rtGetNeedList","rtSubmitMaterial","rtNotification","rtSubmitSolution","rtWriteCommunicationRecord","rtGetCommunicationRecord","rtCloseNeed","rtClosePlan","rtCloseOrderDelivery",
], ],
apiSecretPathList: ["/api/icp/consultation/submit","/api/icp/feedback/submit","/api/icp/order/notify","/api/opreceive/service/create","/api/icp/order/close","/api/opreceive/service/notify"] apiSecretPathList: ["/api/icp/consultation/submit","/api/icp/feedback/submit","/api/icp/order/notify","/api/opreceive/service/create","/api/icp/order/close","/api/opreceive/service/notify","/api/icp/queueNotify/springBoard",]
} }
} }
...@@ -30,6 +30,22 @@ var settings = { ...@@ -30,6 +30,22 @@ var settings = {
} }
return "http://43.247.184.94:7200/center_channel_req_log/_doc?pretty"; return "http://43.247.184.94:7200/center_channel_req_log/_doc?pretty";
}, },
baiduClientParams: function () {
if (this.env == 'dev') {
return {
domain:"https://gwgp-mwnn9gk4o4e.i.bdcloudapi.com",//开发
accessKey:"ed0f5c4c7c2d4e87aa335d9b07bf9bd4",
secretKey:"f600c4e91f6d43998d637401e6e34ef9",
host:"gwgp-mwnn9gk4o4e.i.bdcloudapi.com"
};
}
return {
domain:"https://gwgp-nbzljnwusrw.i.bdcloudapi.com",//线上
accessKey:"0e5abf33ef07457f8dbd779287747c0c",
secretKey:"9d86f04a85db4cdfa95ba8ad28009188",
host:"gwgp-nbzljnwusrw.i.bdcloudapi.com"
};
},
fbQueryUrl: function () { fbQueryUrl: function () {
if (this.env == 'dev' || this.env == 'test') { if (this.env == 'dev' || this.env == 'test') {
return 'http://43.247.184.92:15505' return 'http://43.247.184.92:15505'
......
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