Commit 4c9bf6ab by 王悦

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

parents 2854206b 8958cc56
......@@ -6,6 +6,8 @@ class QcAPI extends APIBase {
super();
this.qcCenterOrderSve = system.getObject("service.common.qcCenterOrderSve");
this.baseOrderSve = system.getObject("service.common.baseCenterOrderSve");
this.ncSve = system.getObject("service.common.ncSve");
this.rtSve = system.getObject("service.common.rtSve");
}
/**
* 接口跳转-POST请求
......@@ -54,42 +56,70 @@ class QcAPI extends APIBase {
opResult = await this.qcCenterOrderSve.closeOrderDelivery(pobj);
break;
// --------- 网文 ---------
// --------- 网文 ---------
case "ncServiceSubmitOption"://服务商提交服务操作(文网文)2020-9-26
opResult = await this.qcCenterOrderSve.ncServiceSubmitOption(pobj);
case "ncGetNeedList"://查询需求列表(网文)2020-11-11
opResult = await this.ncSve.ncGetNeedList(pobj);
break;
case "ncSubmitSolution"://提交方案(文网文)2020-9-26
opResult = await this.qcCenterOrderSve.ncSubmitSolution(pobj);
case "ncSubmitMaterial"://交付材料提交(网文)2020-11-11
opResult = await this.ncSve.ncSubmitMaterial(pobj);
break;
case "ncCloseNeed"://关闭需求(文网文)2020-9-28
opResult = await this.qcCenterOrderSve.ncCloseNeed(pobj);
case "ncNotification"://状态通知(网文)2020-11-11
opResult = await this.ncSve.ncNotification(pobj);
break;
case "ncRecordLog"://提交沟通记录(文网文)2020-9-28
opResult = await this.qcCenterOrderSve.ncRecordLog(pobj);
case "ncSubmitSolution"://提交方案(网文)2020-11-11
opResult = await this.ncSve.ncSubmitSolution(pobj);
break;
case "ncRecordLogList"://查询沟通记录(文网文)2020-9-29
opResult = await this.qcCenterOrderSve.ncRecordLogList(pobj);
case "ncWriteCommunicationRecord"://提交沟通记录(网文)2020-11-11
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;
// --------- 广电 ---------
case "rtServiceSubmitOption"://服务商提交服务操作(文网文)2020-9-26
opResult = await this.qcCenterOrderSve.rtServiceSubmitOption(pobj);
case "rtGetNeedList"://查询需求列表(广电)2020-11-11
opResult = await this.rtSve.rtGetNeedList(pobj);
break;
case "rtSubmitMaterial"://交付材料提交(广电)2020-11-11
opResult = await this.rtSve.rtSubmitMaterial(pobj);
break;
case "rtSubmitSolution"://提交方案(文网文)2020-9-26
opResult = await this.qcCenterOrderSve.rtSubmitSolution(pobj);
case "rtNotification"://状态通知(广电)2020-11-11
opResult = await this.rtSve.rtNotification(pobj);
break;
case "rtCloseNeed"://关闭需求(文网文)2020-9-28
opResult = await this.qcCenterOrderSve.rtCloseNeed(pobj);
case "rtSubmitSolution"://提交方案(广电)2020-11-11
opResult = await this.rtSve.rtSubmitSolution(pobj);
break;
case "rtRecordLog"://提交沟通记录(文网文)2020-9-28
opResult = await this.qcCenterOrderSve.rtRecordLog(pobj);
case "rtWriteCommunicationRecord"://提交沟通记录(广电)2020-11-11
opResult = await this.rtSve.rtWriteCommunicationRecord(pobj);
break;
case "rtRecordLogList"://查询沟通记录(文网文)2020-9-29
opResult = await this.qcCenterOrderSve.rtRecordLogList(pobj);
case "rtGetCommunicationRecord"://查询沟通记录(广电)2020-11-11
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;
// --------- 推送icp信息至渠道和作方 zhuangbing-20201116--------
case "pushIcpSolution2Channel"://推送ICP方案至渠道(百度)
opResult = await this.baseOrderSve.pushIcpSolution2Channel(pobj);
break;
default:
opResult = system.getResult(null, "action_type参数错误");
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
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 {
* @param {*} pobj
*/
async pushBusiness2DeliverSystem(pobj) {//推送业务信息到交付系统
console.log(pobj,"pushBusiness2DeliverSystem-zhuangbing------------------------------");
var verifyResult = await this.verifyParam(pobj);
if (verifyResult.status != 0) {
return await this.disposePushResultFail(pobj, verifyResult, "deliver->pushBusiness2DeliverSystem->verifyResult", this.pushlogFailType.FQ);
......@@ -36,7 +37,8 @@ class UtilsDeliverSystemService extends AppServiceBase {
},
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-----------------
......
......@@ -1456,6 +1456,7 @@ class UtilsNeedService extends AppServiceBase {
var url = settings.centerOrderUrl() + "action/qcapi/springBoard";
var rtn = await this.restPostUrl(pobj, url);
if (rtn.status == 0 && rtn.data) {
var channelOrderNo = pobj.actionBody.orderNo;
pobj.actionBody.orderNo = rtn.data.orderNo;
pobj.actionType="delOrder";
var orderrtn = await self.utilsOrderSve.delOrder(pobj, actionBody);
......@@ -1471,8 +1472,16 @@ class UtilsNeedService extends AppServiceBase {
appInfo: pobj.appInfo
}
this.utilsPushSve.baiduBusiness2Delivery(tmpObj, "pushDeliveryStatusNotify");
tmpObj.actionBody.orderNo = rtn.data.channelSolutionNo;
self.utilsPushSve.baiduBusiness2Fq(tmpObj, "pushOrderICPClose");
// tmpObj.actionBody.orderNo = channelOrderNo;
var tmpObj2 = {
actionBody: {
orderNo: channelOrderNo,
channelNeedNo: rtn.data.channelNeedNo,
needsolution: rtn.data.solutionContent
},
appInfo: pobj.appInfo
};
self.utilsPushSve.baiduBusiness2Fq(tmpObj2, "pushOrderICPClose");
}//通知更新状态
return rtn;
}
......
......@@ -29,6 +29,30 @@ class UtilsPushService extends AppServiceBase {
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中做配置进行调用
pobj.actionType = "getAppInterface";
......@@ -53,12 +77,13 @@ class UtilsPushService extends AppServiceBase {
}
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;
if (!interface_list) {
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) {
return system.getResult(null, "暂无【" + opType + "】的推送配置");
}
......@@ -94,6 +119,8 @@ class UtilsPushService extends AppServiceBase {
}
async reflexAction(interface_info, opType, pobj, isDelProductInfo) {
console.log(interface_info,"reflexAction+++++++++++++++"+opType);
console.log(pobj,"reflexAction++++++2+++++++++"+opType);
var refResult = null;
pobj.interface_info = interface_info;
pobj.opType = opType;
......@@ -165,6 +192,8 @@ class UtilsPushService extends AppServiceBase {
var reqUrl = settings.centerAppUrl() + "action/opProduct/springBoard";
var productItemInterfaceResult = await this.restPostUrl(pobj, reqUrl);
pobj.interface_info = productItemInterfaceResult.data;
console.log(pobj,"baiduBusiness2Delivery-zhuangbing------------------------------"+opType);
console.log(productItemInterfaceResult);
//日志记录
this.logCtl.info({
appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "",
......
const co = require("co");
var request = require("request");
const crypto = require('crypto');
const sha256 = require('sha256');
var urlencode = require('urlencode');
const system = require("../system");
var settings = require("../../config/settings");
class baiduClient {
constructor() {
this.pushlogSve = system.getObject("service.common.pushlogSve");
this.execClient = system.getObject("util.execClient");
this.baiduClientParams = settings.baiduClientParams();
}
//2020 1027 laolan 调用百度网关
async baiduPost( path, actionBody) {
console.log('actionBody++',actionBody)
// let domain = "https://gwgp-mwnn9gk4o4e.i.bdcloudapi.com";//开发
let domain = "https://gwgp-nbzljnwusrw.i.bdcloudapi.com";//线上
let domain = this.baiduClientParams.domain;
let url = domain+path;
let version ="bce-auth-v1";
// let accessKey = "ed0f5c4c7c2d4e87aa335d9b07bf9bd4";
// let secretKey = "f600c4e91f6d43998d637401e6e34ef9";
let accessKey = "0e5abf33ef07457f8dbd779287747c0c";
let secretKey = "9d86f04a85db4cdfa95ba8ad28009188";
let accessKey = this.baiduClientParams.accessKey;
let secretKey = this.baiduClientParams.secretKey;
let timestamp = new Date().toISOString()
let site = timestamp.lastIndexOf(".");
timestamp = timestamp.substring(0,site)+"Z"
let signedHeaders = "host";
let extime = 1800;
let canonicalHeaders = "host:gwgp-nbzljnwusrw.i.bdcloudapi.com"
let canonicalHeaders = "host:"+this.baiduClientParams.host;
//中间结果1:规范化请求和前缀字符串
let canonicalRequest = "POST" + "\n" + path + "\n" + "\n" + canonicalHeaders;
//authStringPrefix(前缀字符串,由除sk字段外的签名信息生成)
......@@ -67,7 +63,7 @@ class baiduClient {
formatParams: true, // default true, format the parameter name to first letter upper case
method: 'POST', // set the http method, default is GET
headers: {
host:"gwgp-nbzljnwusrw.i.bdcloudapi.com"
host:this.baiduClientParams.host
}, // set the http request headers
});
console.log('baidu++++res+++',res)
......@@ -97,3 +93,5 @@ class 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 = {
"orderTotalSum", "collect", "reg", "orderCheck", "getReOrderList", "getOfficalList", "addReviewList", "opSubmitNeed", "opNeedClose", "opNeedList",
"getItemByNeedNo", "opNeedDetailByChannelNo", "getNeedListUser", "manualEvaluation", "diagnosisInfo", "check", "enterpriseInfo", "diagnosisDetail",
"submitIcpIntention", "queryIntentionList", "confirmIcpIntention", "tmAccept", "tmStatus", "needBatchUpload",
"ncServiceSubmitOption", "ncSubmitSolution", "ncCloseNeed", "ncWriteCommunicationRecord", "ncGetCommunicationRecord", "rtServiceSubmitOption", "rtSubmitSolution",
"rtCloseNeed", "rtWriteCommunicationRecord", "rtGetCommunicationRecord", "getParamsFor360", "addOrderWeb", "getPayRecords", "getLoginInfo", "putUserMobileByVcode",
"ncSubmitMaterial","ncNotification","ncSubmitSolution","ncWriteCommunicationRecord","ncGetCommunicationRecord","ncCloseNeed","ncClosePlan","ncCloseOrderDelivery",
"rtSubmitMaterial","rtNotification","rtSubmitSolution","rtWriteCommunicationRecord","rtGetCommunicationRecord","rtCloseNeed","rtClosePlan","rtCloseOrderDelivery",
"getParamsFor360", "addOrderWeb", "getPayRecords", "getLoginInfo", "putUserMobileByVcode",
"putUserPwdByMobile", "icpNotifyNew"
],
apiMustUserpinList: [
"icpOrderClose",
"submitNeed", "paySuccess", "icpNotify", "getLoginInfo", "icpNotifyNew", "submitIcpProgramme","serviceProviderSubmitMaterial","abolishIcpProgramme",
"submitService","serviceProviderNotification",
"ncServiceSubmitOption", "ncSubmitSolution", "ncCloseNeed", "ncWriteCommunicationRecord", "ncGetCommunicationRecord", "rtServiceSubmitOption", "rtSubmitSolution",
"rtCloseNeed", "rtWriteCommunicationRecord", "rtGetCommunicationRecord",
"ncGetNeedList","ncSubmitMaterial","ncNotification","ncSubmitSolution","ncWriteCommunicationRecord","ncGetCommunicationRecord","ncCloseNeed","ncClosePlan","ncCloseOrderDelivery",
"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 = {
}
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 () {
if (this.env == 'dev' || this.env == 'test') {
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