Commit 93b7caa7 by 宋毅

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

parents 89a2547d bff0bc50
...@@ -56,38 +56,38 @@ class QcAPI extends APIBase { ...@@ -56,38 +56,38 @@ class QcAPI extends APIBase {
// --------- 文网文 --------- // --------- 文网文 ---------
case "serviceSubmitOption"://服务商提交服务操作(文网文)2020-9-26 case "ncServiceSubmitOption"://服务商提交服务操作(文网文)2020-9-26
opResult = await this.qcCenterOrderSve.serviceSubmitOption(pobj); opResult = await this.qcCenterOrderSve.ncServiceSubmitOption(pobj);
break; break;
case "submitWangwenSolution"://提交方案(文网文)2020-9-26 case "ncSubmitSolution"://提交方案(文网文)2020-9-26
opResult = await this.qcCenterOrderSve.submitWangwenSolution(pobj); opResult = await this.qcCenterOrderSve.ncSubmitSolution(pobj);
break; break;
case "closeNeed"://关闭需求(文网文)2020-9-28 case "ncCloseNeed"://关闭需求(文网文)2020-9-28
opResult = await this.qcCenterOrderSve.closeNeed(pobj); opResult = await this.qcCenterOrderSve.ncCloseNeed(pobj);
break; break;
case "recordLog"://提交沟通记录(文网文)2020-9-28 case "ncRecordLog"://提交沟通记录(文网文)2020-9-28
opResult = await this.qcCenterOrderSve.recordLog(pobj); opResult = await this.qcCenterOrderSve.ncRecordLog(pobj);
break; break;
case "recordLogList"://查询沟通记录(文网文)2020-9-29 case "ncRecordLogList"://查询沟通记录(文网文)2020-9-29
opResult = await this.qcCenterOrderSve.recordLogList(pobj); opResult = await this.qcCenterOrderSve.ncRecordLogList(pobj);
break; break;
// --------- 食品 --------- // --------- 广电 ---------
case "foodServiceSubmitOption"://服务商提交服务操作(文网文)2020-9-26 case "rtServiceSubmitOption"://服务商提交服务操作(文网文)2020-9-26
opResult = await this.qcCenterOrderSve.foodServiceSubmitOption(pobj); opResult = await this.qcCenterOrderSve.rtServiceSubmitOption(pobj);
break; break;
case "submitFoodSolution"://提交方案(文网文)2020-9-26 case "rtSubmitSolution"://提交方案(文网文)2020-9-26
opResult = await this.qcCenterOrderSve.submitFoodSolution(pobj); opResult = await this.qcCenterOrderSve.rtSubmitSolution(pobj);
break; break;
case "foodCloseNeed"://关闭需求(文网文)2020-9-28 case "rtCloseNeed"://关闭需求(文网文)2020-9-28
opResult = await this.qcCenterOrderSve.foodCloseNeed(pobj); opResult = await this.qcCenterOrderSve.rtCloseNeed(pobj);
break; break;
case "foodRecordLog"://提交沟通记录(文网文)2020-9-28 case "rtRecordLog"://提交沟通记录(文网文)2020-9-28
opResult = await this.qcCenterOrderSve.foodRecordLog(pobj); opResult = await this.qcCenterOrderSve.rtRecordLog(pobj);
break; break;
case "foodRecordLogList"://查询沟通记录(文网文)2020-9-29 case "rtRecordLogList"://查询沟通记录(文网文)2020-9-29
opResult = await this.qcCenterOrderSve.foodRecordLogList(pobj); opResult = await this.qcCenterOrderSve.rtRecordLogList(pobj);
break; break;
default: default:
......
var APIBase = require("../../api.base");
var system = require("../../../system");
var settings = require("../../../../config/settings");
class QcAPI2 extends APIBase {
constructor() {
super();
this.centerorderSve = system.getObject("service.common.qcCenterOrderSve");
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) {
case "getNeedSolutionDetailByUser"://获取方案详情
opResult = await this.centerorderSve.reqCenterOrderApi(pobj, "action/baseapi/springBoard");
break;
case "submitIcpProgramme"://icp方案提交
opResult = await this.baseOrderSve.submitIcpProgramme(pobj);
break;
case "receiveProgrammeNo"://接收渠道方案号(测试)
opResult = await this.centerorderSve.reqCenterOrderApi(pobj);
break;
// case "submitIcpMaterial"://icp材料提交
// opResult = await this.baseOrderSve.submitIcpMaterial(pobj);
// break;
// case "acceptIcpPartnerNotification"://icp通知状态变更
// opResult = await this.baseOrderSve.acceptIcpPartnerNotification(pobj);
// break;
case "abolishIcpProgramme"://服务商icp方案关闭
opResult = await this.centerorderSve.abolishIcpProgramme(pobj);
break;
case "getProgrammeInfoByChannelNeedNo"://获取需求方案列表
opResult = await this.centerorderSve.reqCenterOrderApi(pobj, "action/baseapi/springBoard");
break;
case "serviceProviderSubmitMaterial"://交付商提交材料信息
opResult = await this.baseOrderSve.serviceProviderSubmitMaterial(pobj);
break;
case "serviceProviderNotification"://交付商通知状态变更
opResult = await this.baseOrderSve.serviceProviderNotification(pobj);
break;
case "closeOrderDelivery"://交付商关闭交付单
opResult = await this.centerorderSve.closeOrderDelivery(pobj);
break;
// --------- 文网文 ---------
case "serviceSubmitOption"://服务商提交服务操作(文网文)2020-9-26
opResult = await this.baseOrderSve.serviceSubmitOption(pobj);
break;
case "submitWangwenSolution"://提交方案(文网文)2020-9-26
opResult = await this.baseOrderSve.submitWangwenSolution(pobj);
break;
case "closeNeed"://关闭需求(文网文)2020-9-28
opResult = await this.baseOrderSve.closeNeed(pobj);
break;
case "recordLog"://提交沟通记录(文网文)2020-9-28
opResult = await this.baseOrderSve.recordLog(pobj);
break;
case "recordLogList"://查询沟通记录(文网文)2020-9-29
opResult = await this.baseOrderSve.recordLogList(pobj);
break;
// --------- 食品 ---------
case "foodServiceSubmitOption"://服务商提交服务操作(文网文)2020-9-26
opResult = await this.baseOrderSve.foodServiceSubmitOption(pobj);
break;
case "submitFoodSolution"://提交方案(文网文)2020-9-26
opResult = await this.baseOrderSve.submitFoodSolution(pobj);
break;
case "foodCloseNeed"://关闭需求(文网文)2020-9-28
opResult = await this.baseOrderSve.foodCloseNeed(pobj);
break;
case "foodRecordLog"://提交沟通记录(文网文)2020-9-28
opResult = await this.baseOrderSve.foodRecordLog(pobj);
break;
case "foodRecordLogList"://查询沟通记录(文网文)2020-9-29
opResult = await this.baseOrderSve.foodRecordLogList(pobj);
break;
default:
opResult = system.getResult(null, "action_type参数错误");
break;
}
return opResult;
}
}
module.exports = QcAPI2;
\ No newline at end of file
...@@ -110,6 +110,11 @@ class Need extends APIBase { ...@@ -110,6 +110,11 @@ class Need extends APIBase {
case "icpOrderClose"://关闭ICP订单 case "icpOrderClose"://关闭ICP订单
opResult = await this.utilsNeedSve.icpOrderClose(pobj, pobj.actionBody); opResult = await this.utilsNeedSve.icpOrderClose(pobj, pobj.actionBody);
break; break;
case "getSolutionByChannelOrderNo"://根据渠道订单获取方案信息
opResult = await this.utilsNeedSve.getSolutionByChannelOrderNo(pobj, pobj.actionBody);
// opResult = await this.utilsNeedSve.getItemByChannelSolutionNo(pobj, pobj.actionBody);
// break;
break;
//-----------接入百度ICP------end---------------------------------- //-----------接入百度ICP------end----------------------------------
default: default:
opResult = system.getResult(null, "action_type参数错误"); opResult = system.getResult(null, "action_type参数错误");
......
var APIBase = require("../../api.base");
var system = require("../../../system");
var settings = require("../../../../config/settings");
class Need2 extends APIBase {
constructor() {
super();
this.utilsNeedSve = system.getObject("service.utilsSve.utilsNeedSve");
this.centerorderSve = system.getObject("service.common.centerorderSve");
this.utilsNeedSve2 = system.getObject("service.utilsSve.utilsNeedSve2");
}
/**
* 接口跳转-POST请求
* action_process 执行的流程
* action_type 执行的类型
* action_body 执行的参数
*/
async springBoard(pobj, qobj, req) {
if (!pobj.actionProcess) {
return system.getResult(null, "actionProcess参数不能为空");
}
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 self = this;
var opResult = null;
switch (action_type) {
case "submitNeedH5"://提交需求----del
opResult = await this.utilsNeedSve.submitNeedH5(pobj, pobj.actionBody);
break;
//--------------------------------------跟ali合作---------------------------
case "submitNeed"://提交需求
opResult = await this.utilsNeedSve.submitNeed(pobj, pobj.actionBody);
break;
case "needClose"://关闭需求
opResult = await this.utilsNeedSve.needClose(pobj, pobj.actionBody);
break;
case "needCloseIcp"://关闭需求
opResult = await this.utilsNeedSve2.needCloseIcp(pobj, pobj.actionBody);
break;
case "needDetailByChannelNo":
opResult = await this.utilsNeedSve.needDetailByChannelNo(pobj, pobj.actionBody);
break;
case "getItemByChannelNeedNo":
opResult = await this.utilsNeedSve.getItemByChannelNeedNo(pobj, pobj.actionBody);
break;
case "getItemByNeedNo":
opResult = await this.utilsNeedSve.getItemByNeedNo(pobj, pobj.actionBody);
break;
case "receiveFeedback"://接收方案反馈信息
opResult = await this.centerorderSve.reqCenterOrderApi(pobj);
break;
case "getItemByChannelSolutionNo":
opResult = await this.utilsNeedSve.getItemByChannelSolutionNo(pobj, pobj.actionBody);
break;
case "icpFeedbackSubmit"://icp接收方案反馈信息
pobj.actionType = "receiveIcpFeedback";
opResult = await this.utilsNeedSve.reqCenterOrderQcApi(pobj);
break;
case "icpNotify"://icp方案更新
opResult = await this.utilsNeedSve.icpNotify(pobj, pobj.actionBody);
if (opResult.status == 0 && pobj.actionBody.status == 1) {
opResult = await self.centerorderSve.icppaysuccess(pobj, pobj.actionBody);
}
break;
case "writeCommunicationLog"://icp接收方案反馈信息2020-11-2 laolan 写入沟通记录
opResult = await this.utilsNeedSve2.writeCommunicationLog(pobj);
break;
case "queryExpertApplyCommunicationLogs"://icp接收方案反馈信息 2020-11-2 laolan 查询沟通记录
opResult = await this.utilsNeedSve2.queryExpertApplyCommunicationLogs(pobj);
break;
case "getaliicpProduce"://方案询价
opResult = await this.centerorderSve.getaliicpProduce(pobj);
break;
case "submitIcpIntention":// 2020 0827 lin 新增 4.1 提交需求
opResult = await this.utilsNeedSve.submitIcpIntention(pobj, pobj.actionBody);
break;
case "queryIntentionList":// 2020 0827 lin 新增 4.2 需求列表查询
opResult = await this.utilsNeedSve2.queryIntentionList(pobj, pobj.actionBody);
break;
case "confirmIcpIntention":// 2020 0827 lin 新增 4.3 用户需求确认
opResult = await this.utilsNeedSve.confirmIcpIntention(pobj, pobj.actionBody);
break;
case "needBatchUpload":// 2020 0914 lin 新增 刷单一条龙服务
opResult = await this.utilsNeedSve.needBatchUpload(pobj, pobj.actionBody);
break;
case "testsymq":
opResult = await this.utilsNeedSve.testsymq(pobj);
break;
//-----------接入百度ICP------start----zhuangbing--2020.10.22----------------------------
case "submitIcpNeed"://提交需求
opResult = await this.utilsNeedSve.submitNeed2(pobj, pobj.actionBody);
break;
case "icpFeedbackSubmitNew"://icp接收方案反馈信息
pobj.actionType = "receiveIcpFeedback";
opResult = await this.utilsNeedSve.reqCenterOrderQcApi(pobj);
break;
case "icpNotifyNew"://icp方案更新
opResult = await this.utilsNeedSve.icpNotifyNew(pobj, pobj.actionBody);
if (opResult.status == 0 && pobj.actionBody.status == 1) {
opResult = await self.centerorderSve.icppaysuccessNew(pobj, pobj.actionBody);
}
break;
//-----------接入百度ICP------end----------------------------------
default:
opResult = system.getResult(null, "action_type参数错误");
break;
}
return opResult;
}
}
module.exports = Need2;
\ No newline at end of file
...@@ -91,7 +91,7 @@ class BaseCenterOrderService extends AppServiceBase { ...@@ -91,7 +91,7 @@ class BaseCenterOrderService extends AppServiceBase {
//提交Icp注册方案 //提交Icp注册方案
async submitIcpProgramme(pobj) { async submitIcpProgramme(pobj) {
var res = await this.reqCenterOrderApi(pobj, "action/baseapi/springBoard"); var res = await this.reqCenterOrderApi(pobj, "action/qcapi/springBoard");
if (res && res.status == 0 && res.data && res.data.needinfo && res.data.needsolution) { if (res && res.status == 0 && res.data && res.data.needinfo && res.data.needsolution) {
var needinfo = res.data.needinfo;//需求信息 var needinfo = res.data.needinfo;//需求信息
var needsolution = res.data.needsolution;//方案信息 var needsolution = res.data.needsolution;//方案信息
...@@ -138,7 +138,7 @@ class BaseCenterOrderService extends AppServiceBase { ...@@ -138,7 +138,7 @@ class BaseCenterOrderService extends AppServiceBase {
companyName: solution.CompanyName, companyName: solution.CompanyName,
companyAddress: solution.CompanyAddress, companyAddress: solution.CompanyAddress,
area: solution.Area, area: solution.Area,
type:solution.ActionType type:solution.IcpType
}; };
if (needsolution.channelSolutionNo) { if (needsolution.channelSolutionNo) {
pushObj["bizId"] = needsolution.channelSolutionNo; pushObj["bizId"] = needsolution.channelSolutionNo;
...@@ -280,7 +280,7 @@ class BaseCenterOrderService extends AppServiceBase { ...@@ -280,7 +280,7 @@ class BaseCenterOrderService extends AppServiceBase {
//交付材料提交 //交付材料提交
async serviceProviderSubmitMaterial(pobj) { async serviceProviderSubmitMaterial(pobj) {
var res = await this.reqCenterOrderApi(pobj, "action/baseapi/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;//方案信息
var ab = pobj.actionBody; var ab = pobj.actionBody;
...@@ -354,7 +354,7 @@ class BaseCenterOrderService extends AppServiceBase { ...@@ -354,7 +354,7 @@ class BaseCenterOrderService extends AppServiceBase {
} }
//通知交付状态变更 //通知交付状态变更
async serviceProviderNotification(pobj) { async serviceProviderNotification(pobj) {
var res = await this.reqCenterOrderApi(pobj, "action/baseapi/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.ali){
//推送数据至阿里 //推送数据至阿里
......
...@@ -7,6 +7,7 @@ class GatewaypushlogService extends ServiceBase { ...@@ -7,6 +7,7 @@ class GatewaypushlogService extends ServiceBase {
constructor() { constructor() {
super("common", ServiceBase.getDaoName(GatewaypushlogService)); super("common", ServiceBase.getDaoName(GatewaypushlogService));
this.execClient = system.getObject("util.execClient"); this.execClient = system.getObject("util.execClient");
this.dingClient = system.getObject("util.dingClient");
} }
async taskAliIcapi() { async taskAliIcapi() {
...@@ -31,6 +32,7 @@ class GatewaypushlogService extends ServiceBase { ...@@ -31,6 +32,7 @@ class GatewaypushlogService extends ServiceBase {
if (data.success) { if (data.success) {
icloginfo.pushStatus = "yts"; icloginfo.pushStatus = "yts";
} else { } else {
this.dingClient.gatewayPushError(data)
icloginfo.pushtimes += 1; icloginfo.pushtimes += 1;
} }
await this.update(icloginfo); await this.update(icloginfo);
...@@ -39,6 +41,7 @@ class GatewaypushlogService extends ServiceBase { ...@@ -39,6 +41,7 @@ class GatewaypushlogService extends ServiceBase {
return system.getResultSuccess(); return system.getResultSuccess();
} catch (error) { } catch (error) {
this.dingClient.gatewayPushError({message:"Exception"})
return system.getResultFail(-1,error); return system.getResultFail(-1,error);
} }
} }
......
const system = require("../../../system");
const crypto = require('crypto');
var settings = require("../../../../config/settings");
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
const uappId = {
'ali':"18", //(阿里icp、edi)
'baidu':"44" //(百度icp、edi)
}
//推送百度城市拼音转义 2020-11-6
const cityLetter = {
"北京":"BEIJING",
"上海":"SHANGHAI",
"福建":"FUJIAN",
"广西":"GUANGXI",
"广东":"GUANGDONG",
"安徽":"ANHUI",
"河南":"HENAN",
"湖北":"HUBEI",
"浙江":"ZHEJIANG",
"江苏":"JIANGSU",
"山东":"SHANDONG",
"陕西":"SHANXI_SHAN",
"宁夏":"NINGXIA",
"甘肃":"GANSU",
"新疆":"XINJIANG",
"青海":"QINGHAI",
"天津":"TIANJIN",
"重庆":"CHONGQING",
"河北":"HEBEI",
"山西":"SHANXI_JIN",
"辽宁":"LIAONING",
"吉林":"JILIN",
"黑龙江":"HEILONGJIANG",
"江西":"JIANGXI",
"湖南":"HUNAN",
"四川":"SUCHUAN",
"贵州":"GUIZHOU",
"云南":"YUANNAN",
"内蒙古":"NEIMENGGU",
"西藏":"XIZANG",
"外资":"WAIZI",
"海南":"HAINAN"
}
//百度拼音转义 2020-11-6
const baiduIcpStatus = {
507: "REGISTRATION",
508: "SUBMITTED",
509: "ACCEPTED",
510: "NOT_ACCEPTED",
511: "APPROVED",
512: "NOT_APPROVED"
};
/**
* 网文相关接口(NC)
*/
class NcService extends AppServiceBase {
constructor() {
super();
this.centerOrderUrl = settings.centerOrderUrl();
this.execClient = system.getObject("util.execClient");
this.aliclient = system.getObject("util.aliyunClient");
this.cacheManager = system.getObject("db.common.cacheManager");
this.utilsOrderSve = system.getObject("service.utilsSve.utilsOrderSve");
this.utilsPushSve = system.getObject("service.utilsSve.utilsPushSve");
this.utilsTmAliyunSve = system.getObject("service.utilsSve.utilsTmAliyunSve");//测试用
this.opPushQueueUrl = settings.opPushQueueUrl();
this.baiduclient = system.getObject("util.baiduClient");
};
//调用center-order
async reqCenterOrderApi(pobj, reqUrl) {
var url = this.centerOrderUrl + "action/qcapi/springBoard";
if (reqUrl) {
var url = this.centerOrderUrl + reqUrl;
}
var rtn = await this.execClient.execPost(pobj, url);
var data = JSON.parse(rtn.stdout);
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
async abolishIcpProgramme(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");
if (res && res.status == 0 && res.data) {
var needsolution = res.data;//方案信息
var ab = pobj.actionBody;
if (typeof (ab.material) == "string") {
ab.material = JSON.parse(ab.material);
}
var material = ab.material;
if(res.data.uapp_id == 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){
//推送数据至百度
var BizId = needsolution.orderChannelNo;
console.log('BizId++',BizId)
var pushObj = {
"businessLicense" : {
"createdAt" : material.BusinessLicense.CreatedAt || "",
"enterpriseCode" :material.BusinessLicense.EnterpriseCode || "",
"legalRepresentative" :material.BusinessLicense.LegalRepresentative || "",
"address" :material.BusinessLicense.Address || "",
"registeredCapital" : material.BusinessLicense.RegisteredCapital || "",
"name" :material.BusinessLicense.Name || "",
"businessTerm" :material.BusinessLicense.BusinessTerm || "",
"type" : material.BusinessLicense.Type || "",
"scopeBusiness" :material.BusinessLicense.ScopeBusiness || ""
},
"partnerForeignInvestment": material.PartnerForeignInvestment || "",
"orderNo": 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 || "",
"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 });
console.log('rrrr+++++',r)
}
return system.getResultSuccess();
}
return res;
}
//通知交付状态变更
async serviceProviderNotification(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");
if (res && res.status == 0 && res.data) {
if(res.data.uapp_id = uappId.ali){
//推送数据至阿里
var resStatus = res.data.ApplicationStatus;
var pushObj = {
BizId: pobj.actionBody.orderNo,
BizType: pobj.actionBody.channelType,
OperateType: wangwenStatusDisct[resStatus],
ExtInfo:pobj.actionBody.extInfo
};
console.log("ali fuwu++++pushObj",pushObj);
//推送状态变更
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 res;
}
//提交方案(文网文)2020-9-27
async ncSubmitSolution(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",
});
if(res.data.uapp_id == uappId.ali){
//推送数据至阿里
var pushObj = {
intentionBizId: res.data.needinfo.channelNeedNo,
bizType: res.data.needinfo.channelTypeCode,
// solution: res.data.needsolution.solutionContent
solution: solution
};
console.log("wangwen",pushObj);
this.pushAliNcSubmitSolution(pushObj, needsolution.solutionNo, pobj.appInfo, self);
}
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;
}
//推送方案ali
async pushAliNcSubmitSolution(pushObj, solutionNo, appInfo, self) {
//推送状态变更
var pushRes = await this.aliclient.reqbyget({ action: "SubmitSolution", reqbody: pushObj, apiVersion: "2020-03-06" });
console.log('ali 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;
}
}
//推送方案baidu
async pushBaiduNcSubmitSolution(pushObj, solutionNo, appInfo, self) {
//推送状态变更
var pushRes = await this.baiduclient.baiduReqbyget({ path: "///", reqbody: pushObj });
console.log('baidu 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 ncCloseNeed(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.orderNo;
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",
});
if(result.data.uapp_id == uappId.ali){
// 推送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
var a = await self.baiduclient.baiduReqbyget({ path: "///", reqbody: { intentionBizId: pobj.actionBody.needNo, bizType: "网络文化许可证" ,note : pobj.actionBody.note} });
console.log('baidubaidu++',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 ncWriteCommunicationRecord(pobj) {
console.log('提交沟通记录pobj',pobj)
var res = await this.reqCenterOrderApi(pobj, "action/qcapi/springBoard");
if (res && res.status == 0 && res.data){
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
}
var result = await self.utilsPushSve.aliBusiness2Delivery(reqParams, "updateChanceStatus");
if(result && result.status ==0){
if(res.data.uapp_id == uappId.ali){
//推送数据至阿里
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('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();
}
}
//查看沟通记录
async ncGetCommunicationRecord(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);
}
}
module.exports = NcService;
\ No newline at end of file
const system = require("../../../system");
const crypto = require('crypto');
var settings = require("../../../../config/settings");
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
const uappId = {
'ali':"18", //(阿里icp、edi)
'baidu':"44" //(百度icp、edi)
}
//推送百度城市拼音转义 2020-11-6
const cityLetter = {
"北京":"BEIJING",
"上海":"SHANGHAI",
"福建":"FUJIAN",
"广西":"GUANGXI",
"广东":"GUANGDONG",
"安徽":"ANHUI",
"河南":"HENAN",
"湖北":"HUBEI",
"浙江":"ZHEJIANG",
"江苏":"JIANGSU",
"山东":"SHANDONG",
"陕西":"SHANXI_SHAN",
"宁夏":"NINGXIA",
"甘肃":"GANSU",
"新疆":"XINJIANG",
"青海":"QINGHAI",
"天津":"TIANJIN",
"重庆":"CHONGQING",
"河北":"HEBEI",
"山西":"SHANXI_JIN",
"辽宁":"LIAONING",
"吉林":"JILIN",
"黑龙江":"HEILONGJIANG",
"江西":"JIANGXI",
"湖南":"HUNAN",
"四川":"SUCHUAN",
"贵州":"GUIZHOU",
"云南":"YUANNAN",
"内蒙古":"NEIMENGGU",
"西藏":"XIZANG",
"外资":"WAIZI",
"海南":"HAINAN"
}
//百度拼音转义
2020-11-6
const baiduIcpStatus = {
507: "REGISTRATION",
508: "SUBMITTED",
509: "ACCEPTED",
510: "NOT_ACCEPTED",
511: "APPROVED",
512: "NOT_APPROVED"
};
/**
* 广电相关接口(RT)
*/
class RtService extends AppServiceBase {
constructor() {
super();
this.centerOrderUrl = settings.centerOrderUrl();
this.execClient = system.getObject("util.execClient");
this.aliclient = system.getObject("util.aliyunClient");
this.cacheManager = system.getObject("db.common.cacheManager");
this.utilsOrderSve = system.getObject("service.utilsSve.utilsOrderSve");
this.utilsPushSve = system.getObject("service.utilsSve.utilsPushSve");
this.utilsTmAliyunSve = system.getObject("service.utilsSve.utilsTmAliyunSve");//测试用
this.opPushQueueUrl = settings.opPushQueueUrl();
this.baiduclient = system.getObject("util.baiduClient");
};
//调用center-order
async reqCenterOrderApi(pobj, reqUrl) {
var url = this.centerOrderUrl + "action/qcapi/springBoard";
if (reqUrl) {
var url = this.centerOrderUrl + reqUrl;
}
var rtn = await this.execClient.execPost(pobj, url);
var data = JSON.parse(rtn.stdout);
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
async abolishIcpProgramme(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");
if (res && res.status == 0 && res.data) {
var needsolution = res.data;//方案信息
var ab = pobj.actionBody;
if (typeof (ab.material) == "string") {
ab.material = JSON.parse(ab.material);
}
var material = ab.material;
if(res.data.uapp_id == 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){
//推送数据至百度
var BizId = needsolution.orderChannelNo;
console.log('BizId++',BizId)
var pushObj = {
"businessLicense" : {
"createdAt" : material.BusinessLicense.CreatedAt || "",
"enterpriseCode" :material.BusinessLicense.EnterpriseCode || "",
"legalRepresentative" :material.BusinessLicense.LegalRepresentative || "",
"address" :material.BusinessLicense.Address || "",
"registeredCapital" : material.BusinessLicense.RegisteredCapital || "",
"name" :material.BusinessLicense.Name || "",
"businessTerm" :material.BusinessLicense.BusinessTerm || "",
"type" : material.BusinessLicense.Type || "",
"scopeBusiness" :material.BusinessLicense.ScopeBusiness || ""
},
"partnerForeignInvestment": material.PartnerForeignInvestment || "",
"orderNo": 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 || "",
"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 });
console.log('rrrr+++++',r)
}
return system.getResultSuccess();
}
return res;
}
//通知交付状态变更
async serviceProviderNotification(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;
}
// ----------- 广电 -----------
//服务商提交服务操作
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 = RtService;
\ No newline at end of file
...@@ -116,12 +116,9 @@ module.exports = SignService; ...@@ -116,12 +116,9 @@ module.exports = SignService;
// var task = new SignService(); // var task = new SignService();
// var obj = { // var obj = {
// "intentionBizId": "TRE-nmnHtEoTjeEtest", // "intentionBizId": "TRE-vLTWoPv99nfceshishuju2",
// "phone": "13126673246", // "description": "测试用户关闭2",
// "userName": "", // "intentionStatus": 5
// "description": "111111",
// "area": "BEIJING",
// "consultType": "EDI"
// }; // };
// task.createSign(obj,"7cbb892450174167b5c7e01we4716t51").then(d=>{ // task.createSign(obj,"7cbb892450174167b5c7e01we4716t51").then(d=>{
// console.log(d,"!!!!!!!!!!!!!!!!!!!!!!!!!!"); // console.log(d,"!!!!!!!!!!!!!!!!!!!!!!!!!!");
......
...@@ -60,15 +60,16 @@ class UtilsNeedService extends AppServiceBase { ...@@ -60,15 +60,16 @@ class UtilsNeedService extends AppServiceBase {
if (pobj.actionBody.description && pobj.actionBody.description.indexOf("备#") < 0) { if (pobj.actionBody.description && pobj.actionBody.description.indexOf("备#") < 0) {
pobj.actionBody.level = "A"; pobj.actionBody.level = "A";
} else { } else {
var levelurl = "http://106.13.228.212:8000/recProbability"; // var levelurl = "http://106.13.228.212:8000/recProbability";
var levelresult = await this.restPostUrl({ intentionBizId: pobj.actionBody.intentionBizId, type: pobj.actionBody.type, note: pobj.actionBody.description }, levelurl); // var levelresult = await this.restPostUrl({ intentionBizId: pobj.actionBody.intentionBizId, type: pobj.actionBody.type, note: pobj.actionBody.description }, levelurl);
if (levelresult.status == 0) { // if (levelresult.status == 0) {
pobj.actionBody.level = levelresult.data.level; // pobj.actionBody.level = levelresult.data.level;
pobj.actionBody.probability = levelresult.data.per; // pobj.actionBody.probability = levelresult.data.per;
} else { // } else {
// pobj.actionBody.level = "C"
// }
pobj.actionBody.level = "C" pobj.actionBody.level = "C"
} }
}
if (pobj.actionBody.phone == "17319425791") { if (pobj.actionBody.phone == "17319425791") {
pobj.actionBody.level = "F"; pobj.actionBody.level = "F";
...@@ -106,7 +107,7 @@ class UtilsNeedService extends AppServiceBase { ...@@ -106,7 +107,7 @@ class UtilsNeedService extends AppServiceBase {
} }
var self = this; var self = this;
pobj.actionType = "receiveIcpFeedback"; pobj.actionType = "receiveIcpFeedback";
if(pobj.actionBody && pobj.actionBody.intentionStatus){ if (pobj.actionBody && pobj.actionBody.intentionStatus) {
pobj.intentionStatus = pobj.actionBody.intentionStatus; pobj.intentionStatus = pobj.actionBody.intentionStatus;
} }
var rtn = await this.execClient.execPost(pobj, url); var rtn = await this.execClient.execPost(pobj, url);
...@@ -201,6 +202,19 @@ class UtilsNeedService extends AppServiceBase { ...@@ -201,6 +202,19 @@ class UtilsNeedService extends AppServiceBase {
return itemResult; return itemResult;
} }
/** /**
* 获取方案详情
* @param {*} pobj
* @param {*} actionBody bizId 渠道方案号
*/
async getSolutionByChannelOrderNo(pobj, actionBody) {
if (!actionBody.orderNo) {
return system.getResult(null, "actionBody.orderNo can not be empty,100390");
}
var reqUrl = this.centerOrderUrl + "action/need/springBoard";
var itemResult = await this.restPostUrl(pobj, reqUrl);
return itemResult;
}
/**
* 关闭需求 * 关闭需求
* @param {*} pobj * @param {*} pobj
* @param {*} actionBody * @param {*} actionBody
...@@ -1340,15 +1354,16 @@ class UtilsNeedService extends AppServiceBase { ...@@ -1340,15 +1354,16 @@ class UtilsNeedService extends AppServiceBase {
if (pobj.actionBody.description && pobj.actionBody.description.indexOf("备#") < 0) { if (pobj.actionBody.description && pobj.actionBody.description.indexOf("备#") < 0) {
pobj.actionBody.level = "A"; pobj.actionBody.level = "A";
} else { } else {
var levelurl = "http://106.13.228.212:8000/recProbability"; // var levelurl = "http://106.13.228.212:8000/recProbability";
var levelresult = await this.restPostUrl({ intentionBizId: pobj.actionBody.intentionBizId, type: pobj.actionBody.type, note: pobj.actionBody.description }, levelurl); // var levelresult = await this.restPostUrl({ intentionBizId: pobj.actionBody.intentionBizId, type: pobj.actionBody.type, note: pobj.actionBody.description }, levelurl);
if (levelresult.status == 0) { // if (levelresult.status == 0) {
pobj.actionBody.level = levelresult.data.level; // pobj.actionBody.level = levelresult.data.level;
pobj.actionBody.probability = levelresult.data.per; // pobj.actionBody.probability = levelresult.data.per;
} else { // } else {
// pobj.actionBody.level = "C"
// }
pobj.actionBody.level = "C" pobj.actionBody.level = "C"
} }
}
if (pobj.actionBody.phone == "17319425791") { if (pobj.actionBody.phone == "17319425791") {
pobj.actionBody.level = "F"; pobj.actionBody.level = "F";
...@@ -1442,7 +1457,8 @@ class UtilsNeedService extends AppServiceBase { ...@@ -1442,7 +1457,8 @@ class UtilsNeedService extends AppServiceBase {
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) {
pobj.actionBody.orderNo = rtn.data.orderNo; pobj.actionBody.orderNo = rtn.data.orderNo;
var orderrtn = await self.utilsOrderSve.delOrder(pobj, pobj.actionBody); pobj.actionType="delOrder";
var orderrtn = await self.utilsOrderSve.delOrder(pobj, actionBody);
if (orderrtn.status < 0) { if (orderrtn.status < 0) {
return system.getResultFail(-5022, "订单关闭失败"); return system.getResultFail(-5022, "订单关闭失败");
} }
......
...@@ -6,8 +6,8 @@ const { json } = require("sequelize"); ...@@ -6,8 +6,8 @@ const { json } = require("sequelize");
const { getResult, getResultSuccess } = require("../../../system"); const { getResult, getResultSuccess } = require("../../../system");
//区分渠道的uappid //区分渠道的uappid
const uappId = { const uappId = {
'ali':"18", //(阿里icp、edi) 'ali': "18", //(阿里icp、edi)
'baidu':"44" //(百度icp、edi) 'baidu': "44" //(百度icp、edi)
} }
//需求操作类----ali对接的需求 //需求操作类----ali对接的需求
class UtilsNeedService2 extends AppServiceBase { class UtilsNeedService2 extends AppServiceBase {
...@@ -35,7 +35,7 @@ class UtilsNeedService2 extends AppServiceBase { ...@@ -35,7 +35,7 @@ class UtilsNeedService2 extends AppServiceBase {
* @param {*} actionBody * @param {*} actionBody
*/ */
async submitNeed(pobj, actionBody) { async submitNeed(pobj, actionBody) {
if(actionBody.type == "esp.wangwen" || actionBody.type == "esp.food") { if (actionBody.type == "esp.wangwen" || actionBody.type == "esp.food") {
actionBody.area = this.wangwenAreaChange(actionBody.area) actionBody.area = this.wangwenAreaChange(actionBody.area)
} }
if (!actionBody.intentionBizId) { if (!actionBody.intentionBizId) {
...@@ -69,17 +69,18 @@ class UtilsNeedService2 extends AppServiceBase { ...@@ -69,17 +69,18 @@ class UtilsNeedService2 extends AppServiceBase {
if (pobj.actionBody.description && pobj.actionBody.description.indexOf("备#") < 0) { if (pobj.actionBody.description && pobj.actionBody.description.indexOf("备#") < 0) {
pobj.actionBody.level = "A"; pobj.actionBody.level = "A";
} else { } else {
var levelurl = "http://106.13.228.212:8000/recProbability"; // var levelurl = "http://106.13.228.212:8000/recProbability";
var levelresult = await this.restPostUrl({ intentionBizId: pobj.actionBody.intentionBizId, type: pobj.actionBody.type, note: pobj.actionBody.description }, levelurl); // var levelresult = await this.restPostUrl({ intentionBizId: pobj.actionBody.intentionBizId, type: pobj.actionBody.type, note: pobj.actionBody.description }, levelurl);
if (levelresult.status == 0) { // if (levelresult.status == 0) {
pobj.actionBody.level = levelresult.data.level; // pobj.actionBody.level = levelresult.data.level;
pobj.actionBody.probability = levelresult.data.per; // pobj.actionBody.probability = levelresult.data.per;
} else { // } else {
// pobj.actionBody.level = "C"
// }
pobj.actionBody.level = "C" pobj.actionBody.level = "C"
} }
}
if(pobj.actionBody.phone=="17319425791"){ if (pobj.actionBody.phone == "17319425791") {
pobj.actionBody.level = "F"; pobj.actionBody.level = "F";
} }
...@@ -259,8 +260,8 @@ class UtilsNeedService2 extends AppServiceBase { ...@@ -259,8 +260,8 @@ class UtilsNeedService2 extends AppServiceBase {
* @param {*} actionBody * @param {*} actionBody
*/ */
async needCloseIcp(pobj, actionBody) { async needCloseIcp(pobj, actionBody) {
console.log('guanbi icp xuqiu pobj+++',pobj) console.log('guanbi icp xuqiu pobj+++', pobj)
if(actionBody.uapp_id == uappId.ali){ if (actionBody.uapp_id == uappId.ali) {
if (!actionBody.channelNeedNo) { if (!actionBody.channelNeedNo) {
return system.getResult(null, "actionBody.channelNeedNo can not be empty,100395"); return system.getResult(null, "actionBody.channelNeedNo can not be empty,100395");
} }
...@@ -271,7 +272,7 @@ class UtilsNeedService2 extends AppServiceBase { ...@@ -271,7 +272,7 @@ class UtilsNeedService2 extends AppServiceBase {
var self = this; var self = this;
pobj.actionBody.intentionBizId = pobj.actionBody.channelNeedNo; pobj.actionBody.intentionBizId = pobj.actionBody.channelNeedNo;
pobj.actionType = "abolishIcpProgrammeByNeed" pobj.actionType = "abolishIcpProgrammeByNeed"
var reqUrl = this.centerOrderUrl + "action/baseapi/springBoard"; var reqUrl = this.centerOrderUrl + "action/qcapi/springBoard";
var result = await this.restPostUrl(pobj, reqUrl); var result = await this.restPostUrl(pobj, reqUrl);
this.logCtl.info({ this.logCtl.info({
appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "", appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "",
...@@ -282,9 +283,9 @@ class UtilsNeedService2 extends AppServiceBase { ...@@ -282,9 +283,9 @@ class UtilsNeedService2 extends AppServiceBase {
resultInfo: JSON.stringify(result), resultInfo: JSON.stringify(result),
optitle: "abolishIcpProgrammeByNeed推送蜂擎获取的接口信息->aliBusiness2Delivery", optitle: "abolishIcpProgrammeByNeed推送蜂擎获取的接口信息->aliBusiness2Delivery",
}); });
console.log('result close',result) console.log('result close', result)
if (result.status == 0) { if (result.status == 0) {
if (result.data && result.data.orderNo ) { if (result.data && result.data.orderNo) {
pobj.actionBody.orderNo = result.data.orderNo; pobj.actionBody.orderNo = result.data.orderNo;
var orderrtn = await self.utilsOrderSve.delOrder(pobj, pobj.actionBody); var orderrtn = await self.utilsOrderSve.delOrder(pobj, pobj.actionBody);
if (orderrtn.status < 0) { if (orderrtn.status < 0) {
...@@ -313,14 +314,14 @@ class UtilsNeedService2 extends AppServiceBase { ...@@ -313,14 +314,14 @@ class UtilsNeedService2 extends AppServiceBase {
optitle: "updateChanceStatus推送蜂擎获取的接口信息->aliBusiness2Delivery", optitle: "updateChanceStatus推送蜂擎获取的接口信息->aliBusiness2Delivery",
}); });
// 推送ali // 推送ali
if(result.data.uapp_id == uappId.ali){ if (result.data.uapp_id == uappId.ali) {
var a = await self.aliclient.reqbyget({ action: "CloseIntention", reqbody: { BizId: actionBody.channelNeedNo, Note: actionBody.note }, apiVersion: "2019-05-08" }); var a = await self.aliclient.reqbyget({ action: "CloseIntention", reqbody: { BizId: actionBody.channelNeedNo, Note: actionBody.note }, apiVersion: "2019-05-08" });
} }
// 推送baidu // 推送baidu
if(result.data.uapp_id == uappId.baidu){ if (result.data.uapp_id == uappId.baidu) {
var a = await self.baiduclient.baiduReqbyget({ path : "/api/bla/provider/requirement/update", reqbody : { requirementId : actionBody.channelNeedNo, status: "CLOSED" ,note: actionBody.note }}); var a = await self.baiduclient.baiduReqbyget({ path: "/api/bla/provider/requirement/update", reqbody: { requirementId: actionBody.channelNeedNo, status: "CLOSED", note: actionBody.note } });
} }
console.log("closed need a+++",a); console.log("closed need a+++", a);
self.utilsPushSve.aliBusiness2Fq(pobj, "pushCloseICPNeed"); self.utilsPushSve.aliBusiness2Fq(pobj, "pushCloseICPNeed");
return system.getResultSuccess(); return system.getResultSuccess();
} else { } else {
...@@ -380,7 +381,7 @@ class UtilsNeedService2 extends AppServiceBase { ...@@ -380,7 +381,7 @@ class UtilsNeedService2 extends AppServiceBase {
} }
actionBody.newuserOtherList = newuserOtherList; actionBody.newuserOtherList = newuserOtherList;
} }
if (actionBody.isDirectBuy === "true"&&(actionBody.status == 1||actionBody.status == 0)) {//已支付直购不调用 if (actionBody.isDirectBuy === "true" && (actionBody.status == 1 || actionBody.status == 0)) {//已支付直购不调用
return system.getResultSuccess(); return system.getResultSuccess();
} }
pobj.actionType = "receiveIcpStatusNotify"; pobj.actionType = "receiveIcpStatusNotify";
...@@ -391,7 +392,7 @@ class UtilsNeedService2 extends AppServiceBase { ...@@ -391,7 +392,7 @@ class UtilsNeedService2 extends AppServiceBase {
actionBody: { actionBody: {
orderNo: rtn.data.orderNo,//pobj.actionBody.channelOrder.channelOrderNo, orderNo: rtn.data.orderNo,//pobj.actionBody.channelOrder.channelOrderNo,
needsolution: rtn.data.solutionContent, needsolution: rtn.data.solutionContent,
channelNeedNo: rtn.data.channelNeedNo||"", channelNeedNo: rtn.data.channelNeedNo || "",
channelSolutionNo: rtn.data.channelSolutionNo, channelSolutionNo: rtn.data.channelSolutionNo,
servicer: { servicer: {
code: 'gsb', code: 'gsb',
...@@ -509,14 +510,14 @@ class UtilsNeedService2 extends AppServiceBase { ...@@ -509,14 +510,14 @@ class UtilsNeedService2 extends AppServiceBase {
var reqUrl = this.centerOrderUrl + "action/need/springBoard"; var reqUrl = this.centerOrderUrl + "action/need/springBoard";
var result = await this.restPostUrl(pobj, reqUrl); var result = await this.restPostUrl(pobj, reqUrl);
//2020-10-28 laolan start //2020-10-28 laolan start
if(result && result.status == 0 && result.data){ if (result && result.status == 0 && result.data) {
if(result.data == uappId.aliConfirmResult){ if (result.data == uappId.aliConfirmResult) {
var res = await self.aliclient.reqbyget({ action: "writeCommunicationLog", reqbody: { BizId: pobj.actionBody.intentionBizId, Note: pobj.actionBody.note }, apiVersion: "2019-05-08" }); var res = await self.aliclient.reqbyget({ action: "writeCommunicationLog", reqbody: { BizId: pobj.actionBody.intentionBizId, Note: pobj.actionBody.note }, apiVersion: "2019-05-08" });
console.log("ali+res",res) console.log("ali+res", res)
} }
if(result.data == uappId.baidu){ if (result.data == uappId.baidu) {
var ress = await self.baiduclient.baiduReqbyget({ path: "/api/bla/provider/communication", reqbody: { requirementId: pobj.actionBody.intentionBizId, content: pobj.actionBody.note } }); var ress = await self.baiduclient.baiduReqbyget({ path: "/api/bla/provider/communication", reqbody: { requirementId: pobj.actionBody.intentionBizId, content: pobj.actionBody.note } });
console.log("baidu+res",ress) console.log("baidu+res", ress)
} }
} }
...@@ -553,9 +554,9 @@ class UtilsNeedService2 extends AppServiceBase { ...@@ -553,9 +554,9 @@ class UtilsNeedService2 extends AppServiceBase {
//2020-10-28 laolan start //2020-10-28 laolan start
var reqUrl = this.centerOrderUrl + "action/need/springBoard"; var reqUrl = this.centerOrderUrl + "action/need/springBoard";
var result = await this.restPostUrl(pobj, reqUrl); var result = await this.restPostUrl(pobj, reqUrl);
console.log('jilu+++result++++',result) console.log('jilu+++result++++', result)
if(result && result.status == 0 && result.data && result.data.uapp_id){ if (result && result.status == 0 && result.data && result.data.uapp_id) {
if(result.data.uapp_id == uappId.ali){ if (result.data.uapp_id == uappId.ali) {
var res = await this.aliclient.reqbyget({ var res = await this.aliclient.reqbyget({
action: "QueryExpertApplyCommunicationLogs", reqbody: { action: "QueryExpertApplyCommunicationLogs", reqbody: {
BeginTime: pobj.actionBody.BeginTime ? pobj.actionBody.BeginTime : "", BeginTime: pobj.actionBody.BeginTime ? pobj.actionBody.BeginTime : "",
...@@ -568,8 +569,8 @@ class UtilsNeedService2 extends AppServiceBase { ...@@ -568,8 +569,8 @@ class UtilsNeedService2 extends AppServiceBase {
}); });
} }
if(result.data.uapp_id == uappId.baidu){ if (result.data.uapp_id == uappId.baidu) {
console.log("bbbbb++",pobj) console.log("bbbbb++", pobj)
var res = await this.baiduclient.baiduReqbyget({ var res = await this.baiduclient.baiduReqbyget({
path: "/api/bla/provider/communication/list", reqbody: { path: "/api/bla/provider/communication/list", reqbody: {
beginTime: pobj.actionBody.BeginTime ? pobj.actionBody.BeginTime : "", beginTime: pobj.actionBody.BeginTime ? pobj.actionBody.BeginTime : "",
...@@ -577,7 +578,7 @@ class UtilsNeedService2 extends AppServiceBase { ...@@ -577,7 +578,7 @@ class UtilsNeedService2 extends AppServiceBase {
requirementId: pobj.actionBody.intentionBizId requirementId: pobj.actionBody.intentionBizId
} }
}); });
console.log('xxcc+++',res) console.log('xxcc+++', res)
} }
} }
...@@ -630,10 +631,10 @@ class UtilsNeedService2 extends AppServiceBase { ...@@ -630,10 +631,10 @@ class UtilsNeedService2 extends AppServiceBase {
* @param {*} actionBody * @param {*} actionBody
*/ */
async queryIntentionList(pobj, actionBody) { async queryIntentionList(pobj, actionBody) {
if(pobj.appInfo.uapp_id = uappId.ali){ if (pobj.appInfo.uapp_id = uappId.ali) {
var result = await self.aliclient.reqbyget({ action: "QueryIntentionList", reqbody: actionBody, apiVersion: "2019-05-08" }); var result = await self.aliclient.reqbyget({ action: "QueryIntentionList", reqbody: actionBody, apiVersion: "2019-05-08" });
} }
if(pobj.appInfo.uapp_id = uappId.baidu){ if (pobj.appInfo.uapp_id = uappId.baidu) {
var result = await self.baiduclient.baiduReqbyget({ path: "api/bla/provider/requirement/list", reqbody: actionBody }); var result = await self.baiduclient.baiduReqbyget({ path: "api/bla/provider/requirement/list", reqbody: actionBody });
} }
if (result.code == 200) { if (result.code == 200) {
...@@ -668,7 +669,7 @@ class UtilsNeedService2 extends AppServiceBase { ...@@ -668,7 +669,7 @@ class UtilsNeedService2 extends AppServiceBase {
// if (!pobj.actionBody.userFeedBack) { // if (!pobj.actionBody.userFeedBack) {
// return system.getResult(null, "actionBody.userFeedBack can not be empty,100494"); // return system.getResult(null, "actionBody.userFeedBack can not be empty,100494");
// } // }
console.log('xxxqqqq+++chaxun+++',pobj) console.log('xxxqqqq+++chaxun+++', pobj)
pobj.actionBody.data = []; pobj.actionBody.data = [];
await this.queryByAli(pobj, 1); await this.queryByAli(pobj, 1);
pobj.actionType = "getUnCreated"; pobj.actionType = "getUnCreated";
...@@ -715,14 +716,14 @@ class UtilsNeedService2 extends AppServiceBase { ...@@ -715,14 +716,14 @@ class UtilsNeedService2 extends AppServiceBase {
} }
// 2020 0914 lin 新增 刷单一条龙服务 // 2020 0914 lin 新增 刷单一条龙服务
async needBatchUpload(pobj,actionBody) { async needBatchUpload(pobj, actionBody) {
var BizIds=""; var BizIds = "";
var demands = []; var demands = [];
// 声明两个数组 用来走后四步用 // 声明两个数组 用来走后四步用
var npobj = []; var npobj = [];
var spobj = []; var spobj = [];
// 遍历生成阿里需求 并把bizId 填充进数组 // 遍历生成阿里需求 并把bizId 填充进数组
for(var i = 0;i < actionBody.demands.length;i++) { for (var i = 0; i < actionBody.demands.length; i++) {
// 第一步 // 第一步
// 地区转换 // 地区转换
var area = this.areaChange(actionBody.demands[i].area) var area = this.areaChange(actionBody.demands[i].area)
...@@ -731,58 +732,58 @@ class UtilsNeedService2 extends AppServiceBase { ...@@ -731,58 +732,58 @@ class UtilsNeedService2 extends AppServiceBase {
// 声明调用4.1需要的参数 // 声明调用4.1需要的参数
var obj = { var obj = {
Mobile: actionBody.demands[i].contactMobile,// 手机号 Mobile: actionBody.demands[i].contactMobile,// 手机号
UserName:actionBody.demands[i].contactName,// 用户名 UserName: actionBody.demands[i].contactName,// 用户名
Description:actionBody.demands[i].description, Description: actionBody.demands[i].description,
Area:area, Area: area,
BizType:bizType, BizType: bizType,
Channel:"gsb", Channel: "gsb",
Token:"gsb", Token: "gsb",
} }
// 4.1 提交阿里需求 // 4.1 提交阿里需求
// 2020 0924 lin 修改 reqbyget 为 reqbyLTget // 2020 0924 lin 修改 reqbyget 为 reqbyLTget
var aliResult = await this.aliclient.reqbyLTget({ action: "SubmitIcpIntention", reqbody: obj, apiVersion: "2019-05-08" }); var aliResult = await this.aliclient.reqbyLTget({ action: "SubmitIcpIntention", reqbody: obj, apiVersion: "2019-05-08" });
console.log("needBatchUpload-aliResult",aliResult) console.log("needBatchUpload-aliResult", aliResult)
// 整合前端需要的数据1 // 整合前端需要的数据1
BizIds += aliResult.data.BizId + ","; BizIds += aliResult.data.BizId + ",";
npobj.push({ npobj.push({
"intentionBizId": aliResult.data.BizId, "intentionBizId": aliResult.data.BizId,
"type": this.bizTypeChange(actionBody.demands[i].type), "type": this.bizTypeChange(actionBody.demands[i].type),
"description":actionBody.demands[i].description, "description": actionBody.demands[i].description,
"mobile":actionBody.demands[i].contactMobile "mobile": actionBody.demands[i].contactMobile
}) })
spobj.push({ spobj.push({
"needNo": aliResult.data.BizId,//渠道需求号 "needNo": aliResult.data.BizId,//渠道需求号
"solutionContent":{ "solutionContent": {
// submitIcpProgramme需要的类型转换 ICP许可证 = icpsq/EDI许可证 = edisq // submitIcpProgramme需要的类型转换 ICP许可证 = icpsq/EDI许可证 = edisq
"bizType":actionBody.demands[i].type,//产品类型 icpsq edisq "bizType": actionBody.demands[i].type,//产品类型 icpsq edisq
"solution":{ "solution": {
// "IcpType":1,//方案类型 不传默认1 1:icp 2: edi 参数无效 // "IcpType":1,//方案类型 不传默认1 1:icp 2: edi 参数无效
"CompanyName":actionBody.demands[i].companyName, "CompanyName": actionBody.demands[i].companyName,
"CompanyAddress":actionBody.demands[i].companyAddress, "CompanyAddress": actionBody.demands[i].companyAddress,
"Area":actionBody.demands[i].area + "(渠道)", "Area": actionBody.demands[i].area + "(渠道)",
"Note":actionBody.demands[i].description "Note": actionBody.demands[i].description
} }
} }
}) })
if(aliResult.status != 0) { if (aliResult.status != 0) {
// 统计失败次数 // 统计失败次数
} }
} }
// 判断数据是否符合 执行后四步 的条件 // 判断数据是否符合 执行后四步 的条件
if(npobj.length != actionBody.demands.length || spobj.length != actionBody.demands.length) { if (npobj.length != actionBody.demands.length || spobj.length != actionBody.demands.length) {
return system.getResultFail(-5018,"提交阿里需求失败"); return system.getResultFail(-5018, "提交阿里需求失败");
} }
// 睡3秒 意义:等待阿里异步分配成功。如果不等待则提交方案会失败 无法生成支付链接,需求状态错误 // 睡3秒 意义:等待阿里异步分配成功。如果不等待则提交方案会失败 无法生成支付链接,需求状态错误
await this.sleep(3000) await this.sleep(3000)
// 遍历 执行后面步骤 创建企服需求单(提交方案需要)。提交方案。需求沟通提交 // 遍历 执行后面步骤 创建企服需求单(提交方案需要)。提交方案。需求沟通提交
for(var i = 0;i < actionBody.demands.length;i++) { for (var i = 0; i < actionBody.demands.length; i++) {
// 第二步 // 第二步
// 创建企服通需求单 // 创建企服通需求单
var objString1 = JSON.stringify(pobj); var objString1 = JSON.stringify(pobj);
var obj1 = JSON.parse(objString1); var obj1 = JSON.parse(objString1);
obj1.actionBody = npobj[i]; obj1.actionBody = npobj[i];
var opResult = await this.submitNeed(obj1, obj1.actionBody); var opResult = await this.submitNeed(obj1, obj1.actionBody);
console.log("needBatchUpload-opResult",opResult) console.log("needBatchUpload-opResult", opResult)
// 第三步 // 第三步
// 提交Icp注册方案 // 提交Icp注册方案
// 程序执行比异步分配需求快,所以写成两个循环 // 程序执行比异步分配需求快,所以写成两个循环
...@@ -792,15 +793,15 @@ class UtilsNeedService2 extends AppServiceBase { ...@@ -792,15 +793,15 @@ class UtilsNeedService2 extends AppServiceBase {
obj2.actionBody = spobj[i]; obj2.actionBody = spobj[i];
var subRes = await this.qcCenterOrderSve.submitIcpProgramme(obj2); var subRes = await this.qcCenterOrderSve.submitIcpProgramme(obj2);
console.log("----------------------------------start"); console.log("----------------------------------start");
console.log("needBatchUpload-res",subRes) console.log("needBatchUpload-res", subRes)
console.log("----------------------------------end"); console.log("----------------------------------end");
// 第四步 // 第四步
// 需求沟通记录接口 // 需求沟通记录接口
var writeRes = await this.writeCommunicationLog({actionBody:{intentionBizId:npobj[i].intentionBizId,note:"测试反馈"}}); var writeRes = await this.writeCommunicationLog({ actionBody: { intentionBizId: npobj[i].intentionBizId, note: "测试反馈" } });
console.log("needBatchUpload-writeRes",writeRes) console.log("needBatchUpload-writeRes", writeRes)
// 整合前端需要的数据2 // 整合前端需要的数据2
demands.push({ demands.push({
uniqueCode:actionBody.demands[i].uniqueCode, uniqueCode: actionBody.demands[i].uniqueCode,
demandCode: npobj[i].intentionBizId demandCode: npobj[i].intentionBizId
}) })
} }
...@@ -808,16 +809,16 @@ class UtilsNeedService2 extends AppServiceBase { ...@@ -808,16 +809,16 @@ class UtilsNeedService2 extends AppServiceBase {
// 首先切割掉BizId最后一位 是, // 首先切割掉BizId最后一位 是,
BizIds = BizIds.substr(0, BizIds.length - 1); BizIds = BizIds.substr(0, BizIds.length - 1);
// 2020 0924 lin 修改 reqbyget 为 reqbyLTget // 2020 0924 lin 修改 reqbyget 为 reqbyLTget
var aliConfirmResult = await this.aliclient.reqbyLTget({ action: "ConfirmIcpIntention", reqbody: {BizIds:BizIds}, apiVersion: "2019-05-08" }); var aliConfirmResult = await this.aliclient.reqbyLTget({ action: "ConfirmIcpIntention", reqbody: { BizIds: BizIds }, apiVersion: "2019-05-08" });
console.log("needBatchUpload-aliConfirmResult",aliConfirmResult) console.log("needBatchUpload-aliConfirmResult", aliConfirmResult)
// 获取链接失败 // 获取链接失败
if(aliConfirmResult.status != 0) { if (aliConfirmResult.status != 0) {
return system.getResultFail(-5018,"confirmIcpIntention fail"); return system.getResultFail(-5018, "confirmIcpIntention fail");
} }
var res = { var res = {
paymentLink:aliConfirmResult.data.ConfirmUrl, paymentLink: aliConfirmResult.data.ConfirmUrl,
batchNumber:actionBody.batchNumber, batchNumber: actionBody.batchNumber,
demands:demands demands: demands
} }
// 2020 0916 lin 新增返回格式 成功status为1 因为queue判断成功请求的条件为status1 // 2020 0916 lin 新增返回格式 成功status为1 因为queue判断成功请求的条件为status1
return system.getResultRedisQueueSuccess(res); return system.getResultRedisQueueSuccess(res);
...@@ -983,7 +984,7 @@ class UtilsNeedService2 extends AppServiceBase { ...@@ -983,7 +984,7 @@ class UtilsNeedService2 extends AppServiceBase {
} }
} }
bizTypeChange(bizType) { bizTypeChange(bizType) {
switch(bizType) { switch (bizType) {
case "ICP许可证": case "ICP许可证":
return "5" return "5"
case "EDI许可证": case "EDI许可证":
...@@ -991,7 +992,7 @@ class UtilsNeedService2 extends AppServiceBase { ...@@ -991,7 +992,7 @@ class UtilsNeedService2 extends AppServiceBase {
} }
} }
needBizTypeChange(type) { needBizTypeChange(type) {
switch(type) { switch (type) {
case "ICP许可证": case "ICP许可证":
return "icpsq" return "icpsq"
case "EDI许可证": case "EDI许可证":
...@@ -1033,11 +1034,11 @@ class UtilsNeedService2 extends AppServiceBase { ...@@ -1033,11 +1034,11 @@ class UtilsNeedService2 extends AppServiceBase {
var obj = { var obj = {
"intentionBizId": actionBody.intentionBizId, "intentionBizId": actionBody.intentionBizId,
"type": actionBody.type, "type": actionBody.type,
"description":actionBody.description, "description": actionBody.description,
"mobile":actionBody.mobile "mobile": actionBody.mobile
} }
var res = await this.submitNeed(pobj,obj); var res = await this.submitNeed(pobj, obj);
if(res.status == 0) { if (res.status == 0) {
return system.getResultSuccess(res.data); return system.getResultSuccess(res.data);
} }
return system.getResult(null, res) return system.getResult(null, res)
...@@ -1051,11 +1052,11 @@ class UtilsNeedService2 extends AppServiceBase { ...@@ -1051,11 +1052,11 @@ class UtilsNeedService2 extends AppServiceBase {
async needCloseAliEsp(pobj, actionBody) { async needCloseAliEsp(pobj, actionBody) {
var obj = { var obj = {
"intentionBizId": actionBody.intentionBizId, "intentionBizId": actionBody.intentionBizId,
"mobile":actionBody.mobile "mobile": actionBody.mobile
} }
pobj.actionType = "needClose"; pobj.actionType = "needClose";
var res = await this.needClose(pobj,obj); var res = await this.needClose(pobj, obj);
if(res.status == 0) { if (res.status == 0) {
return system.getResultSuccess(res.data); return system.getResultSuccess(res.data);
} }
return system.getResult(null, res) return system.getResult(null, res)
...@@ -1100,7 +1101,7 @@ class UtilsNeedService2 extends AppServiceBase { ...@@ -1100,7 +1101,7 @@ class UtilsNeedService2 extends AppServiceBase {
pobj.actionType = "getItemByChannelNeedNo"; pobj.actionType = "getItemByChannelNeedNo";
var url = this.centerOrderUrl + "action/need/springBoard"; var url = this.centerOrderUrl + "action/need/springBoard";
var needInfoResult = await this.restPostUrl(pobj, url); var needInfoResult = await this.restPostUrl(pobj, url);
if(needInfoResult.status != 0) { if (needInfoResult.status != 0) {
return system.getResult(null, "needInfo is empty"); return system.getResult(null, "needInfo is empty");
} }
// 第二部 询价 // 第二部 询价
...@@ -1131,7 +1132,7 @@ class UtilsNeedService2 extends AppServiceBase { ...@@ -1131,7 +1132,7 @@ class UtilsNeedService2 extends AppServiceBase {
pobj.actionType = "getProductPrice"; pobj.actionType = "getProductPrice";
var url = settings.centerAppUrl() + "action/opProduct/springBoard"; var url = settings.centerAppUrl() + "action/opProduct/springBoard";
var productPriceResult = await this.restPostUrl(pobj, url); var productPriceResult = await this.restPostUrl(pobj, url);
if(productPriceResult.status != 0) { if (productPriceResult.status != 0) {
return system.getResult(null, "productPrice is empty"); return system.getResult(null, "productPrice is empty");
} }
// 获取userpin 为什么在这里获取?原因:getWay获取不到手机号 再去调用其他接口浪费资源 // 获取userpin 为什么在这里获取?原因:getWay获取不到手机号 再去调用其他接口浪费资源
...@@ -1233,7 +1234,7 @@ class UtilsNeedService2 extends AppServiceBase { ...@@ -1233,7 +1234,7 @@ class UtilsNeedService2 extends AppServiceBase {
orderPrice: Number(pobj.actionBody.orderPrice / 100), orderPrice: Number(pobj.actionBody.orderPrice / 100),
phone: needInfoResult.data.publishMobile, phone: needInfoResult.data.publishMobile,
needId: solutiondata.data.channelNeedNo, needId: solutiondata.data.channelNeedNo,
companyName:solutiondata.data.solutionContent.solution.CompanyName || ''//1 companyName: solutiondata.data.solutionContent.solution.CompanyName || ''//1
}, },
appInfo: pobj.appInfo appInfo: pobj.appInfo
} }
...@@ -1271,23 +1272,23 @@ class UtilsNeedService2 extends AppServiceBase { ...@@ -1271,23 +1272,23 @@ class UtilsNeedService2 extends AppServiceBase {
} }
// 2020 0927 lin 新增 edi状态更新 // 2020 0927 lin 新增 edi状态更新
async ediNotify(pobj,actionBody) { async ediNotify(pobj, actionBody) {
if(actionBody.operationType == "USER_UPLOAD_PRODUCE" ) { if (actionBody.operationType == "USER_UPLOAD_PRODUCE") {
if(actionBody.extInfo) { if (actionBody.extInfo) {
// businessLicense:['business_license/12195411 61213057/1599115976393/p08xo9frgzj.png'] // businessLicense:['business_license/12195411 61213057/1599115976393/p08xo9frgzj.png']
// idCardList:[' ["card/1219541161213057/1599115980036/s1nn3sozulo.png"] '] // idCardList:[' ["card/1219541161213057/1599115980036/s1nn3sozulo.png"] ']
// 注意idCardList 是二维数组 需要再转换一下 不知道为什么 // 注意idCardList 是二维数组 需要再转换一下 不知道为什么
var extJson = JSON.parse(actionBody.extInfo); var extJson = JSON.parse(actionBody.extInfo);
var businessLicenseArr = []; var businessLicenseArr = [];
if(extJson.idCardList) { if (extJson.idCardList) {
// 抽出数组 // 抽出数组
var idCardListA = extJson.idCardList; var idCardListA = extJson.idCardList;
var idCardListArr = []; var idCardListArr = [];
for(var i = 0; i < idCardListA.length; i++) { for (var i = 0; i < idCardListA.length; i++) {
idCardListArr.push(await this.opDownFileInfo(idCardListA[i])); idCardListArr.push(await this.opDownFileInfo(idCardListA[i]));
} }
} }
for(var i = 0; i < extJson.businessLicense.length; i++) { for (var i = 0; i < extJson.businessLicense.length; i++) {
businessLicenseArr.push(await this.opDownFileInfo(extJson.businessLicense[i])); businessLicenseArr.push(await this.opDownFileInfo(extJson.businessLicense[i]));
} }
actionBody.extInfo = { actionBody.extInfo = {
...@@ -1305,7 +1306,7 @@ class UtilsNeedService2 extends AppServiceBase { ...@@ -1305,7 +1306,7 @@ class UtilsNeedService2 extends AppServiceBase {
pobj.actionType = "receiveEdiStatusNotify"; pobj.actionType = "receiveEdiStatusNotify";
var url = settings.centerOrderUrl() + "action/ediApi/springBoard"; var url = settings.centerOrderUrl() + "action/ediApi/springBoard";
var rtn = await this.restPostUrl(pobj, url); var rtn = await this.restPostUrl(pobj, url);
if(rtn.status) { if (rtn.status) {
return rtn; return rtn;
} }
// 只有上传材料才在这里推送,produceNoticeAliEsp不做关于材料上传的推送 // 只有上传材料才在这里推送,produceNoticeAliEsp不做关于材料上传的推送
...@@ -1364,7 +1365,7 @@ class UtilsNeedService2 extends AppServiceBase { ...@@ -1364,7 +1365,7 @@ class UtilsNeedService2 extends AppServiceBase {
// 待定 // 待定
// solutionBizId // solutionBizId
// note // note
if(actionBody.operateType == "INVALID") { if (actionBody.operateType == "INVALID") {
var url = settings.centerOrderUrl() + "action/ediApi/springBoard"; var url = settings.centerOrderUrl() + "action/ediApi/springBoard";
var rtn = await this.restPostUrl(pobj, url); var rtn = await this.restPostUrl(pobj, url);
} }
...@@ -1378,7 +1379,7 @@ class UtilsNeedService2 extends AppServiceBase { ...@@ -1378,7 +1379,7 @@ class UtilsNeedService2 extends AppServiceBase {
* @param {*} actionBody * @param {*} actionBody
*/ */
async submitNeed2(pobj, actionBody) { async submitNeed2(pobj, actionBody) {
if(actionBody.type == "esp.wangwen" || actionBody.type == "esp.food") { if (actionBody.type == "esp.wangwen" || actionBody.type == "esp.food") {
actionBody.area = this.wangwenAreaChange(actionBody.area) actionBody.area = this.wangwenAreaChange(actionBody.area)
} }
if (!actionBody.intentionBizId) { if (!actionBody.intentionBizId) {
...@@ -1410,17 +1411,18 @@ class UtilsNeedService2 extends AppServiceBase { ...@@ -1410,17 +1411,18 @@ class UtilsNeedService2 extends AppServiceBase {
if (pobj.actionBody.description && pobj.actionBody.description.indexOf("备#") < 0) { if (pobj.actionBody.description && pobj.actionBody.description.indexOf("备#") < 0) {
pobj.actionBody.level = "A"; pobj.actionBody.level = "A";
} else { } else {
var levelurl = "http://106.13.228.212:8000/recProbability"; // var levelurl = "http://106.13.228.212:8000/recProbability";
var levelresult = await this.restPostUrl({ intentionBizId: pobj.actionBody.intentionBizId, type: pobj.actionBody.type, note: pobj.actionBody.description }, levelurl); // var levelresult = await this.restPostUrl({ intentionBizId: pobj.actionBody.intentionBizId, type: pobj.actionBody.type, note: pobj.actionBody.description }, levelurl);
if (levelresult.status == 0) { // if (levelresult.status == 0) {
pobj.actionBody.level = levelresult.data.level; // pobj.actionBody.level = levelresult.data.level;
pobj.actionBody.probability = levelresult.data.per; // pobj.actionBody.probability = levelresult.data.per;
} else { // } else {
// pobj.actionBody.level = "C"
// }
pobj.actionBody.level = "C" pobj.actionBody.level = "C"
} }
}
if(pobj.actionBody.phone=="17319425791"){ if (pobj.actionBody.phone == "17319425791") {
pobj.actionBody.level = "F"; pobj.actionBody.level = "F";
} }
...@@ -1450,7 +1452,7 @@ class UtilsNeedService2 extends AppServiceBase { ...@@ -1450,7 +1452,7 @@ class UtilsNeedService2 extends AppServiceBase {
async icpNotifyNew(pobj) { async icpNotifyNew(pobj) {
var actionBody = pobj.actionBody; var actionBody = pobj.actionBody;
var self = this; var self = this;
if(actionBody.isDirectBuy && actionBody.isDirectBuy==1){ if (actionBody.isDirectBuy && actionBody.isDirectBuy == 1) {
actionBody.bizId = actionBody.orderNo actionBody.bizId = actionBody.orderNo
} }
if (!actionBody.bizId) { if (!actionBody.bizId) {
......
...@@ -1318,12 +1318,12 @@ class UtilsOrderService extends AppServiceBase { ...@@ -1318,12 +1318,12 @@ class UtilsOrderService extends AppServiceBase {
if (!actionBody.quantity || Number(actionBody.quantity) <= 0) { if (!actionBody.quantity || Number(actionBody.quantity) <= 0) {
return system.getResult(null, "订单数量为空或有误,100030"); return system.getResult(null, "订单数量为空或有误,100030");
} }
if (!actionBody.goodsId) { // if (!actionBody.goodsId) {
return system.getResult(null, "官网产品id不能为空") // return system.getResult(null, "官网产品id不能为空")
} // }
if (!actionBody.customerId) { // if (!actionBody.customerId) {
return system.getResult(null, '客户Id不能为空') // return system.getResult(null, '客户Id不能为空')
} // }
if (actionBody.deliveryData.nclones.length <= 0) { if (actionBody.deliveryData.nclones.length <= 0) {
return system.getResult(null, '尼斯不能为空') return system.getResult(null, '尼斯不能为空')
} }
...@@ -1334,13 +1334,15 @@ class UtilsOrderService extends AppServiceBase { ...@@ -1334,13 +1334,15 @@ class UtilsOrderService extends AppServiceBase {
let product_item = [];//产品项 let product_item = [];//产品项
for (let i = 0; i < nclones.length; i++) { for (let i = 0; i < nclones.length; i++) {
let nclone = nclones[i]; let nclone = nclones[i];
let totalSum = 300;
if (nclone.nclThree.length > 10) { if (nclone.nclThree.length > 10) {
actionBody.additions = { actionBody.additions = {
"payCode": "zzsbzc-2", // Y 支付价格code "payCode": "zzsbzc-2", // Y 支付价格code
"quantity": nclone.nclThree.length - 10// Y 购买数量 "quantity": nclone.nclThree.length - 10// Y 购买数量
} }
totalSum += (nclone.nclThree.length-10)*30
} }
actionBody.totalSum = 0; actionBody.totalSum = totalSum;
actionBody.quantity = 1; actionBody.quantity = 1;
actionBody.deliveryData.nclones = [nclone] actionBody.deliveryData.nclones = [nclone]
actionBody.payTotalSum = actionBody.totalSum; actionBody.payTotalSum = actionBody.totalSum;
......
...@@ -23,7 +23,6 @@ class utils360Sve extends AppServiceBase { ...@@ -23,7 +23,6 @@ class utils360Sve extends AppServiceBase {
* @param {*} actionBody * @param {*} actionBody
*/ */
async submitService(pobj, actionBody,req) { async submitService(pobj, actionBody,req) {
// 获取userpin 为什么在这里获取?原因:getWay获取不到手机号 再去调用其他接口浪费资源 // 获取userpin 为什么在这里获取?原因:getWay获取不到手机号 再去调用其他接口浪费资源
pobj.actionType = "getLoginByUserName"; pobj.actionType = "getLoginByUserName";
pobj.actionBody.channelUserId = actionBody.contactMobile; // 即:86_18512345678 pobj.actionBody.channelUserId = actionBody.contactMobile; // 即:86_18512345678
...@@ -101,6 +100,7 @@ class utils360Sve extends AppServiceBase { ...@@ -101,6 +100,7 @@ class utils360Sve extends AppServiceBase {
}, },
appInfo: pobj.appInfo appInfo: pobj.appInfo
} }
// 还需要推送fq 需要提醒会计。目前没有
this.utilsPushSve.aliBusiness2Delivery(deliveryObj, "submitService"); this.utilsPushSve.aliBusiness2Delivery(deliveryObj, "submitService");
return system.getResultSuccess({orderNo:pobj.actionBody.orderNo}); return system.getResultSuccess({orderNo:pobj.actionBody.orderNo});
} }
......
...@@ -13,17 +13,20 @@ class baiduClient { ...@@ -13,17 +13,20 @@ class baiduClient {
//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 = "https://gwgp-mwnn9gk4o4e.i.bdcloudapi.com";//开发
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 = "ed0f5c4c7c2d4e87aa335d9b07bf9bd4";
let secretKey = "f600c4e91f6d43998d637401e6e34ef9"; // let secretKey = "f600c4e91f6d43998d637401e6e34ef9";
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-mwnn9gk4o4e.i.bdcloudapi.com" let canonicalHeaders = "host:gwgp-nbzljnwusrw.i.bdcloudapi.com"
//中间结果1:规范化请求和前缀字符串 //中间结果1:规范化请求和前缀字符串
let canonicalRequest = "POST" + "\n" + path + "\n" + "\n" + canonicalHeaders; let canonicalRequest = "POST" + "\n" + path + "\n" + "\n" + canonicalHeaders;
//authStringPrefix(前缀字符串,由除sk字段外的签名信息生成) //authStringPrefix(前缀字符串,由除sk字段外的签名信息生成)
...@@ -64,7 +67,7 @@ class baiduClient { ...@@ -64,7 +67,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-mwnn9gk4o4e.i.bdcloudapi.com" host:"gwgp-nbzljnwusrw.i.bdcloudapi.com"
}, // set the http request headers }, // set the http request headers
}); });
console.log('baidu++++res+++',res) console.log('baidu++++res+++',res)
......
const system = require("../system");
class dingClient {
constructor() {
this.execClient = system.getObject('util.execClient');
this.gatewayurl = "https://oapi.dingtalk.com/robot/send?access_token=2f1ada261ea84f6c621db487ac18d11eba8984202bd82adda8810770a8240572"
}
//推送峰擎异常提醒
async gatewayPushError(err) {
let c = `注意提醒:阿里->推送峰擎异常,老板们加油,加油,加油 !!!${JSON.stringify(err)}`
let t = new Date().toLocaleString()
this.execClient.execPost({
"msgtype": "text",
"text": {"content": t + c}
}, this.gatewayurl).catch(alierr=>{
console.log(alierr)
});
}
}
module.exports = dingClient;
...@@ -14,11 +14,17 @@ module.exports = { ...@@ -14,11 +14,17 @@ 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",
"serviceSubmitOption", "submitWangwenSolution", "closeNeed", "recordLog", "recordLogList", "foodServiceSubmitOption", "submitFoodSolution", "ncServiceSubmitOption", "ncSubmitSolution", "ncCloseNeed", "ncWriteCommunicationRecord", "ncGetCommunicationRecord", "rtServiceSubmitOption", "rtSubmitSolution",
"foodCloseNeed", "foodRecordLog", "foodRecordLogList", "getParamsFor360", "addOrderWeb", "getPayRecords", "getLoginInfo", "putUserMobileByVcode", "rtCloseNeed", "rtWriteCommunicationRecord", "rtGetCommunicationRecord", "getParamsFor360", "addOrderWeb", "getPayRecords", "getLoginInfo", "putUserMobileByVcode",
"putUserPwdByMobile", "icpNotifyNew" "putUserPwdByMobile", "icpNotifyNew"
], ],
apiMustUserpinList: ["submitNeed", "paySuccess", "icpNotify", "getLoginInfo", "icpNotifyNew", "submitIcpProgramme","serviceProviderSubmitMaterial","abolishIcpProgramme","submitService","serviceProviderNotification"], apiMustUserpinList: [
"icpOrderClose",
"submitNeed", "paySuccess", "icpNotify", "getLoginInfo", "icpNotifyNew", "submitIcpProgramme","serviceProviderSubmitMaterial","abolishIcpProgramme",
"submitService","serviceProviderNotification",
"ncServiceSubmitOption", "ncSubmitSolution", "ncCloseNeed", "ncWriteCommunicationRecord", "ncGetCommunicationRecord", "rtServiceSubmitOption", "rtSubmitSolution",
"rtCloseNeed", "rtWriteCommunicationRecord", "rtGetCommunicationRecord",
],
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"]
} }
} }
...@@ -121,7 +121,7 @@ var settings = { ...@@ -121,7 +121,7 @@ var settings = {
if (this.env == "dev") { if (this.env == "dev") {
return "http://centerTmtransactioon.apps.com:4006/"; return "http://centerTmtransactioon.apps.com:4006/";
} else { } else {
return "http://center-app-service/"; return "http://center-tmtransaction-service/";
} }
}, },
zzzdUrl: function () { zzzdUrl: function () {
......
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