Commit 8df5446b by 宋毅

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

parents d9002873 3a987af0
......@@ -3,7 +3,8 @@ FROM registry.cn-beijing.aliyuncs.com/hantang2/node105:v2
MAINTAINER jy "jiangyong@gongsibao.com"
ADD center-channel /apps/center-channel/
WORKDIR /apps/center-channel/
RUN cnpm install -S
RUN yum install gcc-c++.x86_64 -y
RUN npm install --unsafe-perm=true --allow-root
CMD ["node","/apps/center-channel/main.js"]
......
var APIBase = require("../../api.base");
var system = require("../../../system");
class AliyunApi extends APIBase {
constructor() {
super();
this.aliclient = system.getObject("util.aliyunClient");
}
/**
* 接口跳转-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.actionProcess, pobj.actionType, pobj.actionBody, req);
return result;
}
async opActionProcess(pobj, action_process, action_type, action_body, req) {
pobj.requestId = req.requestId;
var opResult = null;
switch (action_type) {
case "queryAvailabelNumbers":// 获取可用外呼号码列表
opResult = await this.aliclient.queryAvailabelNumbers(pobj.actionBody.bizType);
break;
case "startBackToBackCall":// 发起双呼接口
opResult = await this.aliclient.startBackToBackCall(pobj.actionBody);
break;
default:
opResult = system.getResult(null, "action_type参数错误");
break;
}
return opResult;
}
}
module.exports = AliyunApi;
\ No newline at end of file
......@@ -53,6 +53,12 @@ class ProductAPI extends WEBBase {
case "getAllProducts":
opResult = await this.utilsProductSve.getAllProducts(pobj);
break;
case "getProducts"://目前用作创建方案时获取当前app的商品(product)
opResult = await this.utilsProductSve.getProducts(pobj);
break;
case "getProductsPrice"://目前用作创建方案时获取当前app的商品的属性(product_price-price_desc)
opResult = await this.utilsProductSve.getProductsPrice(pobj);
break;
case "getAllProductType":// 获取产品大类
opResult = await this.utilsProductSve.getAllProductType(pobj);
break;
......
......@@ -36,6 +36,10 @@ class AccessAuthAPI extends APIBase {
await this.redisClient.set("start_time_18",endtime+1)
return res
}
//后台任务调度这个方法,获取暂存的需求信息
//igirl_api数据库gateway_pushlog
//gateway_pushlog表中且未推送且推送次数(pushtimes)少于4的数据
//
async taskAliIcapi() {
var rtn = await this.gatewaypushlogSve.taskAliIcapi();
return rtn;
......
......@@ -44,7 +44,32 @@ var regCfg = {
"370200":"青岛",
"410200":"开封",
"230100":"哈尔滨",
"130100":"石家庄"
"130100":"石家庄",
"350200":"厦门",
"360400":"九江",
"410300":"洛阳",
"411000":"许昌",
"411600":"周口",
"411300":"南阳",
"420500":"宜昌",
"420600":"襄阳",
"430600":"岳阳",
"430700":"常德",
"440700":"江门",
"440400":"珠海",
"440900":"茂名",
"441300":"惠州",
"442000":"中山",
"450100":"南宁",
"460100":"海口",
"460200":"三亚",
"510700":"绵阳",
"540100":"拉萨",
"130600":"保定",
"130200":"唐山",
"140200":"大同",
"1501":"呼和浩特",
"341200":"阜阳"
},
baiduAreaCode : {
......@@ -89,7 +114,32 @@ var regCfg = {
"青岛": "370200",
"开封": "410200",
"哈尔滨":"230100",
"石家庄":"130100"
"石家庄":"130100",
"厦门":"350200",
"九江":"360400",
"洛阳":"410300",
"许昌":"411000",
"周口":"411600",
"南阳":"411300",
"宜昌":"420500",
"襄阳":"420600",
"岳阳":"430600",
"常德":"430700",
"江门":"440700",
"珠海":"440400",
"茂名":"440900",
"惠州":"441300",
"中山":"442000",
"南宁":"450100",
"海口":"460100",
"三亚":"460200",
"绵阳":"510700",
"拉萨":"540100",
"保定":"130600",
"唐山":"130200",
"大同":"140200",
"呼和浩特":"150100",
"阜阳":"341200"
},
channelTypeCode : {
"GSREG" : "baidu.gsreg",
......@@ -101,7 +151,8 @@ var regCfg = {
},
//区分渠道的uappid
uappId : {
'baidu':44
'baidu':44,
'zhogxiaowei': 38
},
//交付状态
deliverRegStatus:{
......
......@@ -183,7 +183,7 @@ class Order extends APIBase {
requestUrl: "/icp/order/notify",
requestjson: JSON.stringify(pobj),//请求地址
pushUrl: "/action/intentionapi/springBoard",//调用地址
pushActionType: "icpNotifyNew",//调用参数
pushActionType: "icpOrderStatus",//调用参数
pushtimes: 0,//推送次数
pushStatus: "wts",//推送状态
}
......
......@@ -39,6 +39,9 @@ class Ic extends APIBase {
case "orderClose"://阿里退款
opResult = await this.utilsOrderSve.orderClose(pobj);
break;
case "pushOrderToDelivery"://直接推送资质宝
opResult= await this.centerorderSve.icOrderToDelievery(pobj);
break;
default:
opResult = system.getResult(null, "action_type参数错误");
break;
......
......@@ -74,9 +74,12 @@ class Need extends APIBase {
case "tmNotifySub"://tm建案成功
opResult = await self.centerorderSve.tmsave(pobj, pobj.actionBody);
break;
case "writeCommunicationLog"://icp接收方案反馈信息
case "writeCommunicationLog"://写入跟进记录。通用
opResult = await this.utilsNeedSve2.writeCommunicationLog(pobj);
break;
case "queryCommunicationLog"://获取跟进记录。通用
opResult = await this.utilsNeedSve2.queryCommunicationLog(pobj);
break;
case "queryExpertApplyCommunicationLogs"://icp接收方案反馈信息
opResult = await this.utilsNeedSve2.queryExpertApplyCommunicationLogs(pobj);
break;
......
......@@ -731,6 +731,68 @@ class CenterorderService extends AppServiceBase {
return system.getResultSuccess();
}
async icOrderToDelievery(pobj) {
let orderNo = pobj.actionBody.orderNo;
pobj.actionBody.orderNo = orderNo;
pobj.actionType = "getSolutionByChannelOrderNo";
var url = settings.centerOrderUrl() + "action/need/springBoard";
var solutionrtn = await this.execClient.execPost(pobj, url);
if (!solutionrtn || !solutionrtn.stdout) {
return system.getResultFail(-5011, "方案查询失败");
}
var solutiondata = JSON.parse(solutionrtn.stdout);
if (solutiondata.status != 0) {
return system.getResultFail(-5011, "方案查询失败");
}
if (!solutiondata.data) {
return system.getResultFail(-5012, "方案查询数据为空");
}
var deliveryObj = {
actionBody: {
orderNo: solutiondata.data.orderNo,//pobj.actionBody.channelOrder.channelOrderNo,
needsolution: solutiondata.data.solutionContent,
channelNeedNo: solutiondata.data.channelNeedNo,
channelSolutionNo: solutiondata.data.channelSolutionNo,
skuCode: pobj.actionBody.payCode,
servicer: {
code: 'gsb',
name: '公司宝'
}
},
appInfo: pobj.appInfo
};
let finalRet = null;
if(pobj.actionBody.isDirectBuy && pobj.actionBody.isDirectBuy==1){//直接下单需执行添加订单业务员操作
if(baiduPushRes && baiduPushRes.status==0){
if(baiduPushRes.data && baiduPushRes.data.data){
var resData = baiduPushRes.data.data;
var salesmanInfo = {
salesmanName:resData.orderList && resData.orderList.length>0?resData.orderList[0].operatorName:"",
salesmanChannelId:resData.orderList && resData.orderList.length>0?resData.orderList[0].operator:"",
};
var salesmanObj={
appInfo:pobj.appInfo,
actionType:"addIcpSalesmanInfo",//添加业务员信息
actionBody:{salesmanInfo:salesmanInfo,orderNo:orderrtn.data.orderNo}
};
var url = settings.centerOrderUrl() + "action/qcapi/springBoard";
var addRes = await this.execClient.execPost(salesmanObj, url);
if (addRes && addRes.stdout) {
var salesmanRes = JSON.parse(addRes.stdout);
if (salesmanRes.status == 0) {
deliveryObj.actionBody.needsolution = salesmanRes.data;
await this.utilsPushSve.business2Channel(deliveryObj, "pushDeliveryOrder");
}
}
}
}
}else{
finalRet = await this.utilsPushSve.business2Channel(deliveryObj, "pushDeliveryOrder");
}
return finalRet;
}
//获取易名的icp产品信息
async getymicpProduce(pobj) {
......@@ -740,145 +802,6 @@ class CenterorderService extends AppServiceBase {
return await this.restPostUrl(pobj, url);
}
async tmPaySuccess(pobj) {
// var sobj = {
// actionType: "getProduceByChannelItemCode",
// actionBody: { typeCode: pobj.actionBody.channelTypeCode},
// appInfo: pobj.appInfo,
// actionProcess: pobj.actionProcess
// }
// var url = settings.centerAppUrl() + "action/opProduct/springBoard";
// var rtn = await this.execClient.execPost(sobj, url);
// if (!rtn || !rtn.stdout) {
// return system.getResultFail(-5010, "产品查询失败");
// }
// var data = JSON.parse(rtn.stdout);
// if (data.status != 0) {
// return system.getResultFail(-5010, "产品查询失败");
// }
// pobj.actionBody.orderNo = pobj.actionBody.bizId;
// pobj.actionBody.totalSum = data.data.price;
// pobj.actionBody.orderPrice = data.data.price;
// pobj.actionBody.payTotalSum = data.data.price;
// pobj.actionBody.payCode = data.data.payCode;
// pobj.actionBody.channelItemCode = data.data.channelItemCode;
// pobj.actionBody.channelNeedNo = data.data.channelNeedNo;
// pobj.actionBody.needNo = data.data.needNo;
// pobj.actionBody.quantity = 1;
// pobj.actionBody.channelOrder = {
// channelServiceNo: pobj.actionBody.orderNo,
// channelOrderNo: pobj.actionBody.orderNo,
// orderStatus: 2
// }
// var orderrtn = await this.utilsOrderSve.addOrder(pobj, pobj.actionBody);
// if (orderrtn.status != 0 && orderrtn.status != -1) {
// return system.getResultFail(-5012, "订单创建失败");
// }
// if (orderrtn.data) {
// pobj.actionBody.orderNo = orderrtn.data.orderNo;
// }
// pobj.actionBody.channelSolutionNo = pobj.actionBody.bizId;
// pobj.actionType = "receiveSolutionPayInfoNew";
// var url = settings.centerOrderUrl() + "action/icapi/springBoard";
// var solutionrtn = await this.execClient.execPost(pobj, url);
// if (!solutionrtn || !solutionrtn.stdout) {
// return system.getResultFail(-5011, "方案查询失败");
// }
// var solutiondata = JSON.parse(solutionrtn.stdout);
// if (solutiondata.status != 0) {
// return system.getResultFail(-5011, "方案查询失败");
// }
// if (!solutiondata.data) {
// return system.getResultFail(-5012, "方案查询数据为空");
// }
// if (solutiondata.data && solutiondata.data.channelNeedNo) {
// pobj.actionBody.needId = solutiondata.data.channelNeedNo;
// }
// if (pobj.actionBody.channelItemCode == '5') {
// pobj.actionBody.regType = "baidu.icp";
// } else if (pobj.actionBody.channelItemCode == '7') {
// pobj.actionBody.regType = "baidu.edi";
// }
// else if (pobj.actionBody.channelItemCode == 'NC') {
// pobj.actionBody.regType = "baidu.wangwen";
// }
// else if (pobj.actionBody.channelItemCode == 'RT') {
// pobj.actionBody.regType = "baidu.radiotv";
// }
// if(pobj && pobj.appInfo && pobj.appInfo.uapp_id && pobj.appInfo.uapp_id=='52'){
// if (pobj.actionBody.channelItemCode == '5') {
// pobj.actionBody.regType = "yiming.icp";
// } else if (pobj.actionBody.channelItemCode == '7') {
// pobj.actionBody.regType = "yiming.edi";
// }
// else if (pobj.actionBody.channelItemCode == 'icpnb') {
// pobj.actionBody.regType = "yiming.icpnb";
// }else if (pobj.actionBody.channelItemCode == 'edinb') {
// pobj.actionBody.regType = "yiming.edinb";
// }
// }
// var fqobj = {
// actionBody: {
// area: pobj.actionBody.province,
// idempotentSource: pobj.actionBody.regType,
// orderNo: pobj.actionBody.channelOrder.channelOrderNo,
// orderPrice: Number(pobj.actionBody.orderPrice / 100),
// phone: pobj.actionBody.publishMobile,
// needId: solutiondata.data.channelNeedNo,
// companyName:solutiondata.data.solutionContent.solution.CompanyName || '',
// //2021-1-21 laolan add new
// appName:pobj.appInfo.app_name || '',
// sku:data.data.service_code || ''
// },
// appInfo: pobj.appInfo
// }
// var baiduPushRes = await this.utilsPushSve.baiduBusiness2Fq(fqobj, "pushOrderICPBusinessNew");
// var deliveryObj = {
// actionBody: {
// orderNo: orderrtn.data.orderNo,//pobj.actionBody.channelOrder.channelOrderNo,
// needsolution: solutiondata.data.solutionContent,
// channelNeedNo: solutiondata.data.channelNeedNo,
// channelSolutionNo: solutiondata.data.channelSolutionNo,
// skuCode: data.data.payCode,
// servicer: {
// code: 'gsb',
// name: '公司宝'
// }
// },
// appInfo: pobj.appInfo
// };
// if(pobj.actionBody.isDirectBuy && pobj.actionBody.isDirectBuy==1){//直接下单需执行添加订单业务员操作
// if(baiduPushRes && baiduPushRes.status==0){
// if(baiduPushRes.data && baiduPushRes.data.data){
// var resData = baiduPushRes.data.data;
// var salesmanInfo = {
// salesmanName:resData.orderList && resData.orderList.length>0?resData.orderList[0].operatorName:"",
// salesmanChannelId:resData.orderList && resData.orderList.length>0?resData.orderList[0].operator:"",
// };
// var salesmanObj={
// appInfo:pobj.appInfo,
// actionType:"addIcpSalesmanInfo",//添加业务员信息
// actionBody:{salesmanInfo:salesmanInfo,orderNo:orderrtn.data.orderNo}
// };
// var url = settings.centerOrderUrl() + "action/qcapi/springBoard";
// var addRes = await this.execClient.execPost(salesmanObj, url);
// if (addRes && addRes.stdout) {
// var salesmanRes = JSON.parse(addRes.stdout);
// if (salesmanRes.status == 0) {
// deliveryObj.actionBody.needsolution = salesmanRes.data;
// await this.utilsPushSve.baiduBusiness2Delivery(deliveryObj, "pushDeliveryOrder");
// }
// }
// }
// }
// }else{
// this.utilsPushSve.baiduBusiness2Delivery(deliveryObj, "pushDeliveryOrder");
// }
return system.getResultSuccess();
}
}
module.exports = CenterorderService;
// var task = new CenterorderService();
......
......@@ -462,6 +462,13 @@ class RegCenterOrderService extends AppServiceBase {
return system.getResultFail(-101, pushBaiduRegSolution.msg)
}
}
if (needinfo.uapp_id == regCfg.uappId.zhogxiaowei) {
// 2021 1103 lin 等待推送方案地址。确定返回值是什么
var result = await this.restPostUrl(res.data.needsolutions[0], 'http://zhongxiaowei.com/createSolutions');
if (pushBaiduRegSolution.status != 0) {
return system.getResultFail(-101, pushBaiduRegSolution.msg)
}
}
this.logCtl.info({
appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "",
appkey: pobj.appInfo ? pobj.appInfo.uapp_key || "" : "",
......
......@@ -77,37 +77,13 @@ class utils360Sve extends AppServiceBase {
}
let result = await this.restPostUrl(pushObj, url);
if (result.code == 200) {
this.pushlogSve.createDb({
op: "360-pushOrderStatus",
content: JSON.stringify(pushObj),//推送的参数信息
resultInfo: JSON.stringify(result),
returnType: '1',
logLevel: 1,
opTitle: "推送360信息返回成功"
});
this.disposePushResult(pobj, result, "utils360Sve---pushOrderStatus--推送成功", 4);
} else {
this.logCtl.error({
appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "",
appkey: pobj.appInfo ? pobj.appInfo.uapp_key || "" : "",
requestId: pobj.requestId || "",
op: "utilsSve/utils360Sve/pushOrderStatus",
content: "error:" + result.msg,
// clientIp: pobj.clientIp,
optitle: pobj.opType + "推送操作异常status->pushOrderStatus",
});
this.disposePushResultFail(pobj, result, "utils360Sve---pushOrderStatus--推送失败", 4);
}
console.log(result, '-------------push360-----------------')
return result;
} catch (e) {
this.logCtl.error({
appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "",
appkey: pobj.appInfo ? pobj.appInfo.uapp_key || "" : "",
requestId: pobj.requestId || "",
op: "utilsSve/utils360Sve/pushOrderStatus",
content: "error:" + e.stack,
// clientIp: pobj.clientIp,
optitle: pobj.opType + "推送操作异常status->pushOrderStatus",
});
this.disposePushResultFail(pobj, e.stack, "utils360Sve---pushOrderStatus", 4);
}
}
......@@ -132,63 +108,40 @@ class utils360Sve extends AppServiceBase {
}
let params = actionBody.itemCode.join(',');
let url = settings.requestUrl360() + `api/v1/eshop/GetGoodsLowestPrice?sku_ids=${params}`;
let rtn = await this.restClient.execGet("",url);
let rtn = await this.restClient.execGet("", url);
if (!rtn || !rtn.stdout) {
return system.getResult(null, "restGet data is empty");
}
let result = JSON.parse(rtn.stdout);
if(result.code != 200){
return system.getResultFail(-1,result.msg)
if (result.code != 200) {
return system.getResultFail(-1, result.msg)
}
return system.getResultSuccess(result.data);
}
async pushTmOrderStatus(pobj){
let token = await this.utilsAuthSve.get360Token();
let url = settings.pushUrl360() + 'api/v1/eshop/GsbOrderUpdate?token=' + token.access_token;
let order_id = pobj.orderNo;
let sub_status = pobj.sub_status;
let status = pobj.status;
let pushObj = {
order_id,
status,
sub_status: sub_status
}
let result = await this.restPostUrl(pushObj, url);
if (result.code == 200) {
this.pushlogSve.createDb({
op: "360-pushTMOrderStatus",
content: JSON.stringify(pushObj),//推送的参数信息
resultInfo: JSON.stringify(result),
returnType: '1',
logLevel: 1,
opTitle: "推送360信息返回成功"
});
} else {
this.logCtl.error({
appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "",
appkey: pobj.appInfo ? pobj.appInfo.uapp_key || "" : "",
requestId: pobj.requestId || "",
op: "utilsSve/utils360Sve/pushTMOrderStatus",
content: "error:" + result.msg,
// clientIp: pobj.clientIp,
optitle: pobj.opType + "推送操作异常status->pushTMOrderStatus",
});
async pushTmOrderStatus(pobj) {
try {
let token = await this.utilsAuthSve.get360Token();
let url = settings.pushUrl360() + 'api/v1/eshop/GsbOrderUpdate?token=' + token.access_token;
let order_id = pobj.orderNo;
let sub_status = pobj.sub_status;
let status = pobj.status;
let pushObj = {
order_id,
status,
sub_status: sub_status
}
let result = await this.restPostUrl(pushObj, url);
if (result.code == 200) {
this.disposePushResult(pobj, result, "utils360Sve---pushTmOrderStatus--推送成功", 4)
} else {
this.disposePushResultFail(pobj, result, "utils360Sve---pushTmOrderStatus--推送失败", 4);
}
return result;
} catch (e) {
this.disposePushResultFail(pobj, e.stack, "utils360Sve---pushTmOrderStatus--推送失败", 4);
}
console.log(result, '-------------push360-----------------')
return result;
} catch (e) {
this.logCtl.error({
appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "",
appkey: pobj.appInfo ? pobj.appInfo.uapp_key || "" : "",
requestId: pobj.requestId || "",
op: "utilsSve/utils360Sve/pushTMOrderStatus",
content: "error:" + e.stack,
// clientIp: pobj.clientIp,
optitle: pobj.opType + "推送操作异常status->pushOrderStatus",
});
}
}
}
module.exports = utils360Sve;
......@@ -11,34 +11,45 @@ class UtilsDeliverSystemService extends AppServiceBase {
/**
* 推送业务信息到交付系统
* 业务操作的信息不变外加增加组装的一些参数(推送需求商机、关闭需求、订单商机、关闭订单)
* @param {*} pobj
* @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);
}
var interface_params_info = verifyResult.data;
if(interface_params_info.headData){
if(pobj && pobj.appInfo && pobj.appInfo.app_code){
interface_params_info.headData.appcode = pobj.appInfo.app_code;
// var reqParams = {
// actionType: "produceData",// Y 功能名称
// actionBody: {
// pushUrl: interface_params_info.pushUrl,// Y 推送地址
// actionType: interface_params_info.actionType,// Y 推送地址接收时的功能名称
// notifyUrl: interface_params_info.notifyUrl || "",// N 推送成功后通知的Url
// identifyCode: interface_params_info.identifyCode,// Y 操作的业务标识
// messageBody: pobj.actionBody, // Y 推送的业务消息,必须有一项对象属性值
// headData: interface_params_info.headData //N 请求头信息,Json格式,如:{token:"XXXXXXX"}
// },
// requestId: pobj.requestId || "" // N 请求id
// }
let params=null
let headInfo={}
if(req.appInfo){
headInfo["appcode"]=req.appInfo.app_code
parms = {
actionType:interface_params_info.actionType,
actionBody: pobj.actionBody,
headData:headInfo
}
}else{
parms = {
actionType:interface_params_info.actionType,
actionBody: pobj.actionBody
}
}
var reqParams = {
actionType: "produceData",// Y 功能名称
actionBody: {
pushUrl: interface_params_info.pushUrl,// Y 推送地址
actionType: interface_params_info.actionType,// Y 推送地址接收时的功能名称
notifyUrl: interface_params_info.notifyUrl || "",// N 推送成功后通知的Url
identifyCode: interface_params_info.identifyCode,// Y 操作的业务标识
messageBody: pobj.actionBody, // Y 推送的业务消息,必须有一项对象属性值
headData: interface_params_info.headData //N 请求头信息,Json格式,如:{token:"XXXXXXX"}
},
requestId: pobj.requestId || "" // N 请求id
}
var opQueuePushClientPostRes = await this.opQueuePushClientPost(pobj, this.opPushQueueUrl, reqParams);
console.log(opQueuePushClientPostRes,"pushBusiness2DeliverSystem-zhuangbing----2--------------------------");
let url = interface_params_info.opUrl;
var opQueuePushClientPostRes = await this.opQueuePushClientPost(pobj, url, parms);
return await this.disposePushResult(pobj, opQueuePushClientPostRes, "delivery->pushBusiness2DeliverSystem->result", this.pushlogFailType.FQ);
}
//--------------------------------------------------内部辅助方法-------------------start-----------------
......@@ -47,20 +58,22 @@ class UtilsDeliverSystemService extends AppServiceBase {
try {
var rtn = await this.restPostUrl(reqParams, pushQueueUrl);
if (rtn.status != 1) {
return system.getResult(null, "推送队列接收数据失败,失败原因:" + JSON.stringify(rtn));
this.execClientNew.execLogs(`推送资质宝失败->opQueuePushClientPost`, pobj, "center-channel-utilsDeliverSystemSve-opQueuePushClientPost", rtn, JSON.stringify(rtn));
return system.getResult(null, "推送资质宝失败,失败原因:" + JSON.stringify(rtn));
}
return system.getResultSuccess(null, "推送成功");
} catch (e) {
//日志记录
this.logCtl.error({
appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "",
appkey: pobj.appInfo ? pobj.appInfo.uapp_key || "" : "",
requestId: pobj.requestId || "",
op: "utilsSve/utilsDeliverSystemSve/opQueuePushClientPost",
content: "error:" + e.stack,
// clientIp: pobj.clientIp,
optitle: pobj.opType + "推送操作异常deliver->opQueuePushClientPost",
});
// this.logCtl.error({
// appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "",
// appkey: pobj.appInfo ? pobj.appInfo.uapp_key || "" : "",
// requestId: pobj.requestId || "",
// op: "utilsSve/utilsDeliverSystemSve/opQueuePushClientPost",
// content: "error:" + e.stack,
// // clientIp: pobj.clientIp,
// optitle: pobj.opType + "推送操作异常deliver->opQueuePushClientPost",
// });
this.execClientNew.execLogs(`推送资质宝失败->opQueuePushClientPost`, pobj, "center-channel-utilsDeliverSystemSve-opQueuePushClientPost", null, JSON.stringify(e.stack));
return system.getResult(null, "推送操作异常deliver->opQueuePushClientPost->error:" + e.stack);
}
}
......@@ -70,8 +83,8 @@ class UtilsDeliverSystemService extends AppServiceBase {
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 (!interface_params_info || !interface_params_info.opUrl || !interface_params_info.headData) {
verify = system.getResult(null, "interface_params(opUrl、headData) can not be empty,100430");
}
verify.data = interface_params_info;
return verify;
......
......@@ -65,14 +65,35 @@ class UtilsNeedService extends AppServiceBase {
pobj.actionBody.type = "ali.edi";
pobj.actionBody.idempotentSource = "edi_ali";
} else if (pobj.actionBody.channel_type_code == "tmjy") {
// 阿里商标交易
if(pobj.actionBody.phone.length>11){
// 如果是密文手机号,则设置为空
pobj.actionBody.phone = ""
pobj.actionBody.mobile = ""
}
pobj.actionBody.type = "ali.tmd";
pobj.actionBody.idempotentSource = "tmd_ali";
pobj.actionBody.contactsDingtalk = pobj.actionBody.idempotentId;
}else if (pobj.actionBody.channel_type_code == 1) {
// 阿里商标交易
if(pobj.actionBody.phone.length>11){
// 如果是密文手机号,则设置为空
pobj.actionBody.phone = ""
pobj.actionBody.mobile = ""
}
pobj.actionBody.type = "ali.tmd";
pobj.actionBody.idempotentSource = "tmd_ali";
pobj.actionBody.contactsDingtalk = pobj.actionBody.idempotentId;
}else if (pobj.actionBody.channel_type_code == 2) {
// 阿里商标注册
if(pobj.actionBody.phone.length>11){
// 如果是密文手机号,则设置为空
pobj.actionBody.phone = ""
pobj.actionBody.mobile = ""
}
pobj.actionBody.type = "ali.tm";
pobj.actionBody.idempotentSource = "tm_ali";
pobj.actionBody.contactsDingtalk = pobj.actionBody.idempotentId;
}else if (pobj.actionBody.channel_type_code == 'esp.companyreg'){
pobj.actionBody.type = "ali.ic";
pobj.actionBody.idempotentSource = "ic_ali";
......@@ -768,6 +789,7 @@ class UtilsNeedService extends AppServiceBase {
// }
pobj.actionBody.data = [];
await this.queryByAli(pobj, 1);
pobj.actionBody.data=pobj.actionBody.data.filter(item=>item.Type===1)
pobj.actionType = "getUnCreated";
let reqUrl = this.centerOrderUrl + "action/need/springBoard";
let result = await this.restPostUrl(pobj, reqUrl);
......@@ -776,7 +798,7 @@ class UtilsNeedService extends AppServiceBase {
type: "tmjy"
};
for (let item of result.data) {
if (item.Type == 1 && item.RegisterNumber) {
if (item.Type == 1) {
pobj.actionBody.intentionBizId = item.BizId;
pobj.actionBody.mobile = item.Mobile ? item.Mobile : "";
//pobj.actionBody.Area = item.Area || "北京"
......@@ -802,10 +824,10 @@ class UtilsNeedService extends AppServiceBase {
End: pobj.actionBody.End ? pobj.actionBody.End : "",
PageNum: page,
PageSize: 10,
}, apiVersion: "2019-05-08"
}, type: "TM"
});
if (res.status == 0) {
pobj.actionBody.data.push(...res.data.Data);
pobj.actionBody.data.push(...res.data.Data.Trademark);
if (page < res.data.TotalPageNum) {
await this.queryByAli(pobj, page + 1)
}
......
......@@ -217,6 +217,16 @@ class UtilsNeedService2 extends AppServiceBase {
return getResultSuccess(res);
}
}
async queryCommunicationLog(pobj) {
var reqUrl = this.centerOrderUrl + "action/need/springBoard";
var result = await this.restPostUrl(pobj, reqUrl);
if(result && result.data && result.data.followContent){
return getResultSuccess(result.data.followContent);
}else{
return system.getResult(null, "未查到跟进记录 100500");
}
}
}
module.exports = UtilsNeedService2;
\ No newline at end of file
......@@ -18,7 +18,7 @@ class UtilsOpNeedService extends AppServiceBase {
}
/**
* 提交需求 h5/pc 通用提交需求接口 如果需求内容是具体sku价格项 则不适用 目前只有鑫创在用。
* 提交需求 h5/pc 通用提交需求接口 如果需求内容是具体sku价格项 则不适用 目前只有鑫创and中小微在用。
* @param {*} pobj
* @param {*} actionBody
*/
......@@ -30,16 +30,12 @@ class UtilsOpNeedService extends AppServiceBase {
var url = settings.centerAppUrl() + "action/opProduct/springBoard";
var opResult = await this.restPostUrl(sobj, url);
if (opResult.status != 0) {
return system.getResultFail(-5015, "需求类型查询失败");
return system.getResultFail(-5015, "产品类型查询失败");
}
sobj.actionType = "getProductDetail";
sobj.actionBody.channelItemCode = opResult.data.channel_type_code;
var url = settings.centerAppUrl() + "action/opProduct/springBoard";
var opDetailResult = await this.restPostUrl(sobj, url);
if (opResult.status != 0) {
return system.getResultFail(-5015, "需求类型查询失败");
if (!opResult.data) {
return system.getResultFail(-5016, "请检查产品类型编码");
}
pobj.actionBody.service_product_id = opDetailResult.data.price_list[0].service_code;// 获取skuid skuid应在product price表 代表具体价格项
pobj.actionBody.service_product_id = opResult.data.service_product_id;// 获取skuid skuid应在product price表 代表具体价格项
pobj.actionBody.productId = opResult.data.service_product_id;// productId 注意这里与上面不是相等的值。 productId代表一类产品应在type里
pobj.actionBody.appName = pobj.appInfo.app_name;
pobj.actionBody.type_code = opResult.data.type_code;
......@@ -51,8 +47,8 @@ class UtilsOpNeedService extends AppServiceBase {
// 提交需求
pobj.actionType = "opSubmitNeed";
var reqUrl = this.centerOrderUrl + "action/opNeed/springBoard";
this.execClientNew.execLogs(`推送蜂擎前创建需求信息->opSubmitNeed->channel(opSubmitNeed)`, pobj, "center-channel-UtilsOpNeedService-opSubmitNeed", result, null);
var result = await this.restPostUrl(pobj, reqUrl);
this.execClientNew.execLogs(`推送蜂擎前创建需求信息->opSubmitNeed->channel(opSubmitNeed)`, pobj, "center-channel-UtilsOpNeedService-opSubmitNeed", result, null);
if (result.status == 0) {
pobj.actionBody.idempotentId = result.data.channelNeedNo;
pobj.actionBody.idempotentSource = opResult.data.channel_type_code;
......
......@@ -155,6 +155,26 @@ class UtilsProductService extends AppServiceBase {
}
/**
* 目前用作创建方案时获取当前app的商品(product)
* @returns {Promise<{msg: string, data, bizmsg: *|string, status: number}|any>}
*/
async getProducts(pobj) {
let url = settings.centerAppUrl() + 'action/opProduct/springBoard';
let result = await this.restPostUrl(pobj, url);
return result;
}
/**
* 目前用作创建方案时获取当前app的商品的属性(product_price-price_desc)
* @returns {Promise<{msg: string, data, bizmsg: *|string, status: number}|any>}
*/
async getProductsPrice(pobj) {
let url = settings.centerAppUrl() + 'action/opProduct/springBoard';
let result = await this.restPostUrl(pobj, url);
return result;
}
/**
* 获取全部产品大类
* @returns {Promise<{msg: string, data, bizmsg: *|string, status: number}|any>}
*/
......
......@@ -3,7 +3,7 @@ var RPCClient = require('@alicloud/pop-core').RPCClient;
const system = require("../system");
class aliyunClient {
constructor() {
this.execClientNew = system.getObject("util.execClientNew");
this.pushlogSve = system.getObject("service.common.pushlogSve");
}
getAliClient() {
......@@ -16,7 +16,7 @@ class aliyunClient {
}
getAliTMClient() {
return new RPCClient({
accessKeyId: 'LTAI4FmyipY1wuLHjLhMWiPa',
accessKeyId: 'LTAI4FmyipY1wuLHjLhMWiPa', //对应的aliuid 是 1525276744866147
accessKeySecret: 'hp4FF18IDCSym1prqzxrAjnnhNH3ju',
endpoint: 'https://trademark.aliyuncs.com',
apiVersion: '2018-07-24'
......@@ -95,6 +95,107 @@ class aliyunClient {
}
}
//-----------阿里云双呼能力接口接入------start--------chensicong----2022.01.17----------------------
// 专家辅助申请(商标注册) 双呼客户端
getAliDoubleCallClientForTMREG() {
return new RPCClient({
accessKeyId: "LTAI1pJs7KQizBe2",//对应的aliuid 是 30039057
accessKeySecret: "MMNibebAPqR9AnX5YWHnSL2tHMSIoL",
endpoint: "https://companyreg.aliyuncs.com",
apiVersion: "2020-03-06"
});
}
// 商标交易(商标优选) 双呼客户端
getAliDoubleCallClientForTMTRADE() {
return new RPCClient({
accessKeyId: 'LTAI4FmyipY1wuLHjLhMWiPa', // 对应的aliuid 是 1525276744866147
accessKeySecret: 'hp4FF18IDCSym1prqzxrAjnnhNH3ju',
endpoint: "https://companyreg.aliyuncs.com",
apiVersion: "2020-03-06"
});
}
// 获取可用外呼号码列表
async queryAvailabelNumbers(bizType){
let res = null;
try{
console.log(`开始调用阿里云-获取可用外呼号码列表接口。参数bizType=${bizType}`)
if(!bizType){
return system.getResultFail(-200, "bizType不能为空");
}
let reqAliclient = null
if(bizType == 'TM_TRADE'){
reqAliclient = this.getAliDoubleCallClientForTMTRADE();
}else if(bizType == 'EXPERT_APPLY'){
reqAliclient = this.getAliDoubleCallClientForTMREG();
}else {
return system.getResultFail(-200, `不支持的bizType=${bizType}`);
}
let obj = { bizType:bizType }
res = await reqAliclient.request("QueryAvailableNumbers", obj, {
timeout: 3000, // default 3000 ms
formatAction: true, // default true, format the action to Action
formatParams: true, // default true, format the parameter name to first letter upper case
method: 'POST', // set the http method, default is GET
headers: {}, // set the http request headers
});
console.log(`结束调用阿里云-获取可用外呼号码列表接口。参数bizType=${bizType},结果=${JSON.stringify(res)}`)
this.execClientNew.execLogs(`获取可用外呼号码列表成功`, {bizType:bizType}, "center-channel-aliyunClient-queryAvailabelNumbers", res, null);
return system.getResultSuccess(res.Data||res.data);
}catch (e){
console.log(`调用异常:阿里云-获取可用外呼号码列表接口。参数bizType=${bizType},结果=${JSON.stringify(res)},异常信息=${e.stack}`)
this.execClientNew.execLogs(`获取可用外呼号码列表失败接口`, {bizType:bizType}, "center-channel-aliyunClient-queryAvailabelNumbers", res, JSON.stringify(e.stack));
return system.getResultFail(-200, "api调用出现异常,error:" + e.stack);
}
}
/**
* 发起双呼
* @param reqbody
* @returns {Promise<{msg: *, data: *, status: *}|{msg: *, data, status: number}>}
*/
async startBackToBackCall(reqbody){
let res = null;
try{
console.log(`开始调用阿里云-发起双呼接口。参数reqbody`,reqbody)
if(!reqbody.bizType){
return system.getResultFail(-200, "bizType不能为空");
}
let reqAliclient = null
if(reqbody.bizType == 'TM_TRADE'){
reqAliclient = this.getAliDoubleCallClientForTMTRADE();
}else if(reqbody.bizType == 'EXPERT_APPLY'){
reqAliclient = this.getAliDoubleCallClientForTMREG();
}else {
return system.getResultFail(-200, `不支持的bizType=${reqbody.bizType}`);
}
res = await reqAliclient.request("StartBackToBackCall",reqbody, {
timeout: 10000, // default 3000 ms 2020 0916 lin修改3000为10000,原因ConfirmIcpIntention BizIds 超过5条会超时
formatAction: true, // default true, format the action to Action
formatParams: true, // default true, format the parameter name to first letter upper case
method: 'POST', // set the http method, default is GET
headers: {}, // set the http request headers
});
console.log(`结束调用阿里云-发起双呼接口。参数reqbody=`,reqbody,'结果=',JSON.stringify(res))
this.execClientNew.execLogs(`调用阿里云发起双呼接口成功`, reqbody, "center-channel-aliyunClient-startBackToBackCall", res, null);
return system.getResultSuccess(res.Data||res.data);
}catch (e){
console.log(`调用异常:阿里云-发起双呼接口。参数reqbody=`,reqbody,'结果=',JSON.stringify(res),`异常信息=${e.stack}`)
this.execClientNew.execLogs(`调用阿里云发起双呼接口失败`, reqbody, "center-channel-aliyunClient-startBackToBackCall", res, JSON.stringify(e.stack));
return system.getResultFail(-200, "api调用出现异常,error:" + JSON.stringify(e.data));
}
}
//-----------阿里云双呼能力接口接入------start--------chensicong----2022.01.17----------------------
// 2020 0924 lin 新增
async reqbyLTget(obj, cbk) {
var action = obj.action;
......
......@@ -2,8 +2,10 @@ const crypto = require('crypto');
const sha256 = require('sha256');
const system = require("../system");
var settings = require("../../config/settings");
class baiduClient {
const AppServiceBase = require("../service/app.base");
class baiduClient extends AppServiceBase{
constructor() {
super();
this.pushlogSve = system.getObject("service.common.pushlogSve");
this.execClient = system.getObject("util.execClient");
this.baiduClientParams = settings.baiduClientParams();
......@@ -50,11 +52,9 @@ class baiduClient {
data:actionBody
}
var rtn = await this.execClient.execBaiduPost(baiduObj, url);
console.log("baiduObj+++++",baiduObj)
console.log("url+++++",url)
console.log("rtn+++++",rtn)
if (!rtn || !rtn.stdout) {
return system.getResult(null, "execPost data is empty");
this.execClientNew.execLogs(`baiduClient-opBaiduClientPost-result:url=${url}`, actionBody, "center-channel-opBaiduClientPost", null, rtn);
return system.getResult(null, rtn);
}
var result = JSON.parse(rtn.stdout);
return result;
......@@ -74,28 +74,33 @@ class baiduClient {
host:this.baiduClientParams.host
}, // set the http request headers
});
console.log('baidu++++res+++',res)
this.pushlogSve.createDb({
op: "new-baiduReqbyget",
content: JSON.stringify(obj),//推送的参数信息
resultInfo: JSON.stringify(res),
returnType: '1',
logLevel: '1',
opTitle: "new-baiduReqbyget推送百度信息返回成功"
});
if(res.status == 0){
await this.disposePushResult(obj, res, "baidu->pushBusiness2Baidu->result", "");
}else{
await this.disposePushResultFail(obj, res, "badiu->pushBusiness2Baidu->catchError", this.pushlogFailType.FAILLOG);
}
// this.pushlogSve.createDb({
// op: "new-baiduReqbyget",
// content: JSON.stringify(obj),//推送的参数信息
// resultInfo: JSON.stringify(res),
// returnType: '1',
// logLevel: '1',
// opTitle: "new-baiduReqbyget推送百度信息返回成功"
// });
return system.getResultSuccess(res);
} catch (e) {
this.pushlogSve.createFailLogDb({
appid: obj.appInfo ? obj.appInfo.uapp_id || "" : "",
appkey: obj.appInfo ? obj.appInfo.uapp_key || "" : "",
requestId: obj.requestId || "",
content: JSON.stringify(obj),//推送的参数信息
resultInfo: "error:" + JSON.stringify(e),
clientIp: obj.clientIp || "",
failType: 1,
opTitle: "new-baiduReqbyget推送百度信息返回异常",
pushNumber: obj.pushNumber || 1
});
await this.disposePushResultFail(obj, e, "badiu->pushBusiness2Baidu->catchError", this.pushlogFailType.FAILLOG);
// this.pushlogSve.createFailLogDb({
// appid: obj.appInfo ? obj.appInfo.uapp_id || "" : "",
// appkey: obj.appInfo ? obj.appInfo.uapp_key || "" : "",
// requestId: obj.requestId || "",
// content: JSON.stringify(obj),//推送的参数信息
// resultInfo: "error:" + JSON.stringify(e),
// clientIp: obj.clientIp || "",
// failType: 1,
// opTitle: "new-baiduReqbyget推送百度信息返回异常",
// pushNumber: obj.pushNumber || 1
// });
return system.getResultFail(-200, "出现异常,error:" + e.stack);
}
}
......
......@@ -65,6 +65,7 @@ module.exports = {
apiAliSendKeyPathList: [
"/api/opreceive/pushAliInfo/tmNote",
"/api/opreceive/pushAliInfo/icNote",
"/api/action/aliyunapi/springBoard"
]
},
AREACOMM: {
......
This source diff could not be displayed because it is too large. You can view the blob instead.
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