Commit 9a43c0a6 by 兰国旗

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

parents 8cdbe604 70a85181
...@@ -116,6 +116,10 @@ class QcAPI extends APIBase { ...@@ -116,6 +116,10 @@ class QcAPI extends APIBase {
opResult = await this.rtSve.rtCloseOrderDelivery(pobj); opResult = await this.rtSve.rtCloseOrderDelivery(pobj);
break; break;
// --------- 推送icp信息至渠道和作方 zhuangbing-20201116--------
case "pushIcpSolution2Channel"://推送ICP方案至渠道(百度)
opResult = await this.baseOrderSve.pushIcpSolution2Channel(pobj);
break;
default: default:
opResult = system.getResult(null, "action_type参数错误"); opResult = system.getResult(null, "action_type参数错误");
break; break;
......
...@@ -126,6 +126,15 @@ class TmQueryAPI extends WEBBase { ...@@ -126,6 +126,15 @@ class TmQueryAPI extends WEBBase {
case "tmtrend": //商标申请及注册趋势 case "tmtrend": //商标申请及注册趋势
opResult = await this.tmquerySve.tmtrend(action_body,req); opResult = await this.tmquerySve.tmtrend(action_body,req);
break; break;
case "tmnclrankdetail": //商标类别申请排名详情
opResult = await this.tmquerySve.tmnclrankdetail(action_body, req);
break;
case "tmcompanyrank": //商标企业分布统计详情
opResult = await this.tmquerySve.tmcompanyrank(action_body, req);
break;
case "tmaddressrankdetail": //商标地区分布统计排名详情
opResult = await this.tmquerySve.tmaddressrankdetail(action_body, req);
break;
case "findTrademarkNameAccuratejuhe": //通过商标名来进行精准查询,商标注册地域/大类分布 case "findTrademarkNameAccuratejuhe": //通过商标名来进行精准查询,商标注册地域/大类分布
opResult = await this.tmquerySve.findTrademarkNameAccuratejuhe(action_body,req); opResult = await this.tmquerySve.findTrademarkNameAccuratejuhe(action_body,req);
break; break;
......
...@@ -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参数错误");
......
...@@ -76,26 +76,29 @@ class edi extends APIBase { ...@@ -76,26 +76,29 @@ class edi extends APIBase {
if(!pobj.companyInfo) { if(!pobj.companyInfo) {
return system.getResult(null, "companyInfo cannot be empty"); return system.getResult(null, "companyInfo cannot be empty");
} }
if(!pobj.companyInfo.companyName) { if(!pobj.companyInfo.corpName) {
return system.getResult(null, "companyName cannot be empty"); return system.getResult(null, "corpName cannot be empty");
} }
if(!pobj.companyInfo.taxpayerType) { if(!pobj.companyInfo.taxpayerTypeEnum) {
return system.getResult(null, "taxpayerType cannot be empty"); return system.getResult(null, "taxpayerTypeEnum cannot be empty");
} }
if(!pobj.companyInfo.acctgSystemId) { if(!pobj.companyInfo.acctgSystemId) {
return system.getResult(null, "acctgSystemId cannot be empty"); return system.getResult(null, "acctgSystemId cannot be empty");
} }
if(!pobj.companyInfo.companyForm) { if(!pobj.companyInfo.enterpriseFormEnum) {
return system.getResult(null, "companyForm cannot be empty"); return system.getResult(null, "enterpriseFormEnum cannot be empty");
} }
if(!pobj.companyInfo.industry) { if(!pobj.companyInfo.taxIndustryId) {
return system.getResult(null, "industry cannot be empty"); return system.getResult(null, "taxIndustryId cannot be empty");
} }
if(!pobj.companyInfo.taxpayerNumber) { if(!pobj.companyInfo.taxNo) {
return system.getResult(null, "taxpayerNumber cannot be empty"); return system.getResult(null, "taxNo cannot be empty");
} }
if(!pobj.companyInfo.companyArea) { if(!pobj.companyInfo.serviceTypeEnum) {
return system.getResult(null, "companyArea cannot be empty"); return system.getResult(null, "serviceTypeEnum cannot be empty");
}
if(!pobj.companyInfo.taxClaimMethodEnum) {
return system.getResult(null, "taxClaimMethodEnum cannot be empty");
} }
return system.getResultSuccess() return system.getResultSuccess()
} }
......
...@@ -102,86 +102,146 @@ class BaseCenterOrderService extends AppServiceBase { ...@@ -102,86 +102,146 @@ class BaseCenterOrderService extends AppServiceBase {
needsolution.solutionContent = JSON.parse(needsolution.solutionContent); needsolution.solutionContent = JSON.parse(needsolution.solutionContent);
} }
var solution = needsolution.solutionContent.solution; var solution = needsolution.solutionContent.solution;
var self = this; if(ab.isTest && ab.isTest==1){
//推送方案 var reqPushParams = {
// 2020 0916 lin 修改 增加获取返回值 actionBody: {
//var pushIcpSolutionRes = await this.pushIcpSolution(pushObj, needsolution.solutionNo, pobj.appInfo, self); uapp_id:needinfo.uapp_id,
channelNeedNo:needinfo.channelNeedNo,
CompanyName:solution.CompanyName,
IcpType:solution.IcpType,
CompanyAddress:solution.CompanyAddress,
Area:solution.Area,
Note: solution.Note,
ActionType:solution.ActionType,
channelSolutionNo:needsolution.channelSolutionNo,
solutionNo:needsolution.solutionNo,
},
appInfo: pobj.appInfo
};
await this.utilsPushSve.business2Channel(reqPushParams, "pushIcpSolution2Channel");
}else{
var self = this;
//2020-10-26 laolan 区分百度与阿里
if(needinfo.uapp_id == uappId.ali){
//推送数据至阿里
// var bizType = needinfo.channelTypeCode;//业务类型里
var pushObj = {
IntentionBizId: needinfo.channelNeedNo,
CompanyName: solution.CompanyName,
IcpType: solution.IcpType,
CompanyAddress: solution.CompanyAddress,
Area: solution.Area,
Note: solution.Note,
ActionType:solution.ActionType,
Source:"官网"
};
if (needsolution.channelSolutionNo) {
pushObj["BizId"] = needsolution.channelSolutionNo;
}
var pushIcpSolutionRes = await this.pushIcpSolution(pushObj, needsolution.solutionNo, pobj.appInfo, self);
}
if(needinfo.uapp_id == uappId.baidu){
//推送数据至baidu
// var bizType = needinfo.channelTypeCode;//业务类型里
solution.Area = cityLetter[solution.Area]
console.log('solution.Area++',solution.Area)
var pushObj = {
requirementId: needinfo.channelNeedNo,
companyName: solution.CompanyName,
companyAddress: solution.CompanyAddress,
area: solution.Area,
type:solution.IcpType
};
if (needsolution.channelSolutionNo) {
pushObj["bizId"] = needsolution.channelSolutionNo;
}
console.log('pushObj++',pushObj)
var pushIcpSolutionRes = await this.pushBaiduIcpSolution(pushObj, needsolution.solutionNo, pobj.appInfo, self);
}
this.logCtl.info({
appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "",
appkey: pobj.appInfo ? pobj.appInfo.uapp_key || "" : "",
requestId: pobj.requestId || "",
op: "service/impl/common/qcCenterOrderSve.js/submitIcpProgramme",
content: JSON.stringify(pobj),
resultInfo: JSON.stringify(needinfo),
optitle: "createSolution推送蜂擎获取的接口信息->aliBusiness2Delivery",
});
}
var reqParams = {
actionBody: {
intentionBizId: needinfo.channelNeedNo,
status: "createSolution"
},
appInfo: pobj.appInfo
}
this.utilsPushSve.aliBusiness2Delivery(reqParams, "updateChanceStatus");
//
// return system.getResultSuccess(pushIcpSolutionRes);
}
return res;
}
//推送ICP方案至渠道方
async pushIcpSolution2Channel(pobj){
var actionBody = pobj.actionBody;
var appInfo = pobj.appInfo;
var pushRes = {
status:-1,msg:"推送失败"
};
var self = this;
if(actionBody){
//2020-10-26 laolan 区分百度与阿里 //2020-10-26 laolan 区分百度与阿里
if(needinfo.uapp_id == uappId.ali){ if(actionBody.uapp_id == uappId.ali){
//推送数据至阿里 //推送数据至阿里
// var bizType = needinfo.channelTypeCode;//业务类型里
var pushObj = { var pushObj = {
IntentionBizId: needinfo.channelNeedNo, IntentionBizId: actionBody.channelNeedNo,
CompanyName: solution.CompanyName, CompanyName: actionBody.CompanyName,
IcpType: solution.IcpType, IcpType: actionBody.IcpType,
CompanyAddress: solution.CompanyAddress, CompanyAddress: actionBody.CompanyAddress,
Area: solution.Area, Area: actionBody.Area,
Note: solution.Note, Note: actionBody.Note,
ActionType:solution.ActionType, ActionType:actionBody.ActionType,
Source:"官网" Source:"官网"
}; };
if (needsolution.channelSolutionNo) { if (actionBody.channelSolutionNo) {
pushObj["BizId"] = needsolution.channelSolutionNo; pushObj["BizId"] = actionBody.channelSolutionNo;
} }
var pushIcpSolutionRes = await this.pushIcpSolution(pushObj, needsolution.solutionNo, pobj.appInfo, self); pushRes = await this.pushIcpSolution(pushObj, actionBody.solutionNo, actionBody.appInfo, self);
} }
if(actionBody.uapp_id == uappId.baidu){
if(needinfo.uapp_id == uappId.baidu){
//推送数据至baidu //推送数据至baidu
// var bizType = needinfo.channelTypeCode;//业务类型里 actionBody.Area = cityLetter[actionBody.Area];
solution.Area = cityLetter[solution.Area]
console.log('solution.Area++',solution.Area)
var pushObj = { var pushObj = {
requirementId: needinfo.channelNeedNo, requirementId: actionBody.channelNeedNo,
companyName: solution.CompanyName, companyName: actionBody.CompanyName,
companyAddress: solution.CompanyAddress, companyAddress: actionBody.CompanyAddress,
area: solution.Area, area: actionBody.Area,
type:solution.IcpType type:actionBody.IcpType
}; };
if (needsolution.channelSolutionNo) { if (actionBody.channelSolutionNo) {
pushObj["bizId"] = needsolution.channelSolutionNo; pushObj["bizId"] = actionBody.channelSolutionNo;
} }
console.log('pushObj++',pushObj) pushRes = await this.pushBaiduIcpSolution(pushObj, actionBody.solutionNo, actionBody.appInfo, self);
var pushIcpSolutionRes = await this.pushBaiduIcpSolution(pushObj, needsolution.solutionNo, pobj.appInfo, self);
} }
// // 2020 0806 lin 新增推送
// var reqParams = {
// actionType: "produceData",// Y 功能名称
// actionBody: {
// pushUrl: pushUrl,// Y 推送地址
// actionType: "updateChanceStatus",// Y 推送地址接收时的功能名称
// notifyUrl: "",// N 推送成功后通知的Url
// identifyCode: "ali.vat",// Y 操作的业务标识
// messageBody: pobj.actionBody, // Y 推送的业务消息,必须有一项对象属性值
// headData: ""//N 请求头信息,Json格式,如:{token:"XXXXXXX"}
// },
// requestId: pobj.requestId || "" // N 请求id
// }
// this.opQueuePushClientPost(pobj, this.opPushQueueUrl, reqParams);
this.logCtl.info({ this.logCtl.info({
appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "", appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "",
appkey: pobj.appInfo ? pobj.appInfo.uapp_key || "" : "", appkey: pobj.appInfo ? pobj.appInfo.uapp_key || "" : "",
requestId: pobj.requestId || "", requestId: pobj.requestId || "",
op: "service/impl/common/qcCenterOrderSve.js/submitIcpProgramme", op: "app/base/service/impl/common/baseCenterOrderSve.js/pushIcpSolution2Channel",
content: JSON.stringify(pobj), content: JSON.stringify(pobj),
resultInfo: JSON.stringify(needinfo), resultInfo: JSON.stringify(pushRes),
optitle: "createSolution推送蜂擎获取的接口信息->aliBusiness2Delivery", optitle: "pushIcpSolution2Channel推送ICP方案至渠道方->pushIcpSolution2Channel",
}); });
var reqParams = {
actionBody: {
intentionBizId: needinfo.channelNeedNo,
status: "createSolution"
},
appInfo: pobj.appInfo
}
this.utilsPushSve.aliBusiness2Delivery(reqParams, "updateChanceStatus");
//
return system.getResultSuccess(pushIcpSolutionRes);
} }
return res; if(pushRes.status==0 || pushRes.status==1 ){
return system.getResultRedisQueueSuccess();
}
return pushRes;
} }
//推送ICP方案ali //推送ICP方案ali
async pushIcpSolution(pushObj, solutionNo, appInfo, self) { async pushIcpSolution(pushObj, solutionNo, appInfo, self) {
//推送方案信息 //推送方案信息
...@@ -215,10 +275,11 @@ class BaseCenterOrderService extends AppServiceBase { ...@@ -215,10 +275,11 @@ class BaseCenterOrderService extends AppServiceBase {
var a = await self.reqCenterOrderApi(reqObj3);//保存用户确认方案url var a = await self.reqCenterOrderApi(reqObj3);//保存用户确认方案url
} }
} }
return confirmRes; // return confirmRes;
} }
} }
} }
return pushRes;
} }
//推送ICP方案baidu 2020-10-26 laolan //推送ICP方案baidu 2020-10-26 laolan
...@@ -251,10 +312,11 @@ class BaseCenterOrderService extends AppServiceBase { ...@@ -251,10 +312,11 @@ class BaseCenterOrderService extends AppServiceBase {
}; };
var url = await self.reqCenterOrderApi(reqObj3);//保存用户确认方案url var url = await self.reqCenterOrderApi(reqObj3);//保存用户确认方案url
console.log('save confirmUrl ++ ',url) console.log('save confirmUrl ++ ',url)
return pushRes; // return pushRes;
} }
} }
} }
return pushRes;
} }
//服务商icp方案关闭 2020-10-26 laolan //服务商icp方案关闭 2020-10-26 laolan
......
...@@ -307,7 +307,7 @@ class CenterorderService extends AppServiceBase { ...@@ -307,7 +307,7 @@ class CenterorderService extends AppServiceBase {
orderPrice: Number(pobj.actionBody.orderPrice / 100), orderPrice: Number(pobj.actionBody.orderPrice / 100),
phone: pobj.actionBody.publishMobile, phone: pobj.actionBody.publishMobile,
needId: solutiondata.data.channelNeedNo, needId: solutiondata.data.channelNeedNo,
companyName:solutiondata.data.solutionContent.solution.CompanyName || '' //companyName:solutiondata.data.solutionContent.solution.CompanyName || ''
}, },
appInfo: pobj.appInfo appInfo: pobj.appInfo
} }
...@@ -325,8 +325,35 @@ class CenterorderService extends AppServiceBase { ...@@ -325,8 +325,35 @@ class CenterorderService extends AppServiceBase {
}, },
appInfo: pobj.appInfo appInfo: pobj.appInfo
} }
this.utilsPushSve.aliBusiness2Fq(fqobj, "pushOrderICPBusiness"); let aliPushRes = await this.utilsPushSve.aliBusiness2Fq(fqobj, "pushOrderICPBusiness");
if(pobj.actionBody.isDirectBuy && pobj.actionBody.isDirectBuy=="true"){//直接下单需执行添加订单业务员操作
if(aliPushRes && aliPushRes.status==0){
if(aliPushRes.data && aliPushRes.data.data){
var resData = aliPushRes.data.data;
var salesmanInfo = {
salesmanName:resData.orderList && resData.orderList.length>0?resData.orderList[0].operatorName:"",
salesmanChannelId:resData.orderList && resData.orderList.length>0?resData.orderList[0].operator:"",
};
var salesmanObj={
appInfo:pobj.appInfo,
actionType:"addIcpSalesmanInfo",//添加业务员信息
actionBody:{salesmanInfo:salesmanInfo,orderNo:orderrtn.data.orderNo}
};
var url = settings.centerOrderUrl() + "action/qcapi/springBoard";
var addRes = await this.execClient.execPost(salesmanObj, url);
if (addRes && addRes.stdout) {
var salesmanRes = JSON.parse(addRes.stdout);
if (salesmanRes.status == 0) {
deliveryObj.actionBody.needsolution = salesmanRes.data;
await this.utilsPushSve.aliBusiness2Delivery(deliveryObj, "pushDeliveryOrder");
}
}
}
}
}else {
this.utilsPushSve.aliBusiness2Delivery(deliveryObj, "pushDeliveryOrder"); this.utilsPushSve.aliBusiness2Delivery(deliveryObj, "pushDeliveryOrder");
}
return system.getResultSuccess(); return system.getResultSuccess();
} }
//--------------------------阿里IC---end-------------------------------------------------------- //--------------------------阿里IC---end--------------------------------------------------------
......
...@@ -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,11 @@ class GatewaypushlogService extends ServiceBase { ...@@ -31,6 +32,11 @@ class GatewaypushlogService extends ServiceBase {
if (data.success) { if (data.success) {
icloginfo.pushStatus = "yts"; icloginfo.pushStatus = "yts";
} else { } else {
if (data.errorMsg!="状态错误") {//除1 2 4 11其它状态没处理、返回的状态错误
data.push_url = url
data.api = "center-channel/taskAliIcapi"
this.dingClient.gatewayPushError(data)
}
icloginfo.pushtimes += 1; icloginfo.pushtimes += 1;
} }
await this.update(icloginfo); await this.update(icloginfo);
...@@ -39,6 +45,7 @@ class GatewaypushlogService extends ServiceBase { ...@@ -39,6 +45,7 @@ class GatewaypushlogService extends ServiceBase {
return system.getResultSuccess(); return system.getResultSuccess();
} catch (error) { } catch (error) {
this.dingClient.gatewayPushError({message:"Exception",api:"center-channel/taskAliIcapi"})
return system.getResultFail(-1,error); return system.getResultFail(-1,error);
} }
} }
......
...@@ -134,20 +134,23 @@ module.exports = SignService; ...@@ -134,20 +134,23 @@ module.exports = SignService;
// "status":"16" // "status":"16"
// } // }
// var obj = { // var obj = {
// "bizId":"OD2020110629779500", // "bizId":"OD2020110629779501",
// "contactMobile":"18550295628", // "companyInfo":{
// "contactName":"范锋华", // "companyName":"苏州磐荣信息科技有限公司",
// "timeUnit":"year", // "taxpayerTypeEnum":"NORMAL_TAXPAYER",
// "quantity":1, // "acctgSystemId":"10001",
// "companyInfo":{ // "enterpriseFormEnum":"1",
// "companyName":"苏州磐荣信息科技有限公司", // "taxIndustryId":1,
// "taxpayerType":"NORMAL_TAXPAYER", // "taxNo":"123456789",
// "acctgSystemId":"10001", // "serviceTypeEnum":"ACCOUTING",
// "companyForm":"1", // "taxClaimMethodEnum":"TAX_DECLARATION"
// "industry":1, // },
// "taxpayerNumber":"123456789", // "contactMobile":"18550295628",
// "companyArea":"北京" // "contactName":"范锋华",
// "timeUnit":"year",
// "quantity":1
// } // }
// } // }
// task.createSign(obj,"7cbb892450174167b5c7e01we4717z51").then(d=>{ // task.createSign(obj,"7cbb892450174167b5c7e01we4717z51").then(d=>{
// console.log(d,"!!!!!!!!!!!!!!!!!!!!!!!!!!"); // console.log(d,"!!!!!!!!!!!!!!!!!!!!!!!!!!");
......
...@@ -110,6 +110,24 @@ class TmqueryService { ...@@ -110,6 +110,24 @@ class TmqueryService {
return await this.opReqResult(url, queryobj, req); return await this.opReqResult(url, queryobj, req);
} }
//商标类别申请排名详情
async tmnclrankdetail(queryobj, req) {
var url = this.zcApiUrl + "api/trademark/tmqueryApi/tmnclrankdetail";
return await this.opReqResult(url, queryobj, req);
}
//商标企业分布统计详情
async tmcompanyrank(queryobj, req) {
var url = this.zcApiUrl + "api/trademark/tmqueryApi/tmcompanyrank";
return await this.opReqResult(url, queryobj, req);
}
//商标地区分布统计排名详情
async tmaddressrankdetail(queryobj, req) {
var url = this.zcApiUrl + "api/trademark/tmqueryApi/tmaddressrankdetail";
return await this.opReqResult(url, queryobj, req);
}
//通过商标名来进行精准查询,商标注册地域/大类分布 //通过商标名来进行精准查询,商标注册地域/大类分布
async findTrademarkNameAccuratejuhe(queryobj,req){ async findTrademarkNameAccuratejuhe(queryobj,req){
var url = this.zcApiUrl + "api/trademark/tmqueryApi/findTrademarkNameAccuratejuhe"; var url = this.zcApiUrl + "api/trademark/tmqueryApi/findTrademarkNameAccuratejuhe";
......
var system = require("../../../system");
const AppServiceBase = require("../../app.base");
var settings = require("../../../../config/settings");
//此类用来db中配置来进行调用-主要功能是推送渠道合作方
class UtilsChannelPartnerService extends AppServiceBase {
constructor() {
super();
this.opPushQueueUrl = settings.opPushQueueUrl();
}
/**
* 推送业务信息到渠道合作方
* 业务操作的信息不变外加增加组装的一些参数(推送方案、订单交付信息)
* @param {*} pobj
*/
async pushBusiness2Channel(pobj) {//推送业务信息到渠道合作方
console.log(pobj,"pushBusiness2Channel-zhuangbing------------------------------");
var verifyResult = await this.verifyParam(pobj);
if (verifyResult.status != 0) {
return await this.disposePushResultFail(pobj, verifyResult, "deliver->pushBusiness2Channel->verifyResult", this.pushlogFailType.FQ);
}
var interface_params_info = verifyResult.data;
if(interface_params_info.headData){
if(pobj && pobj.appInfo && pobj.appInfo.app_code){
interface_params_info.headData.appcode = pobj.appInfo.app_code;
}
}
var reqParams = {
actionType: "produceData",// Y 功能名称
actionBody: {
pushUrl: interface_params_info.pushUrl,// Y 推送地址
actionType: interface_params_info.actionType,// Y 推送地址接收时的功能名称
notifyUrl: interface_params_info.notifyUrl || "",// N 推送成功后通知的Url
identifyCode: interface_params_info.identifyCode,// Y 操作的业务标识
messageBody: pobj.actionBody, // Y 推送的业务消息,必须有一项对象属性值
headData: interface_params_info.headData //N 请求头信息,Json格式,如:{token:"XXXXXXX"}
},
requestId: pobj.requestId || "" // N 请求id
}
var opQueuePushClientPostRes = await this.opQueuePushClientPost(pobj, this.opPushQueueUrl, reqParams);
console.log(opQueuePushClientPostRes,"pushBusiness2Channel-zhuangbing----2--------------------------");
}
//--------------------------------------------------内部辅助方法-------------------start-----------------
async opQueuePushClientPost(pobj, pushQueueUrl, reqParams) {
try {
var rtn = await this.restPostUrl(reqParams, pushQueueUrl);
if (rtn.status != 1) {
return system.getResult(null, "推送队列接收数据失败,失败原因:" + JSON.stringify(rtn));
}
return system.getResultSuccess(null, "推送成功");
} catch (e) {
//日志记录
this.logCtl.error({
appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "",
appkey: pobj.appInfo ? pobj.appInfo.uapp_key || "" : "",
requestId: pobj.requestId || "",
op: "utilsSve/utilsChannelPartnerSve/opQueuePushClientPost",
content: "error:" + e.stack,
// clientIp: pobj.clientIp,
optitle: pobj.opType + "推送操作异常deliver->opQueuePushClientPost",
});
return system.getResult(null, "推送操作异常deliver->opQueuePushClientPost->error:" + e.stack);
}
}
async verifyParam(pobj) {//参数信息验证
var verify = system.getResultSuccess();
if (!pobj.interface_params) {
verify = system.getResult(null, "interface_params can not be empty,100400");
}
var interface_params_info = JSON.parse(pobj.interface_params);
if (!interface_params_info || !interface_params_info.pushUrl || !interface_params_info.headData) {
verify = system.getResult(null, "interface_params(pushUrl、headData) can not be empty,100430");
}
verify.data = interface_params_info;
return verify;
}
//--------------------------------------------------内部辅助方法-------------------end-----------------
}
module.exports = UtilsChannelPartnerService;
...@@ -14,6 +14,7 @@ class UtilsDeliverSystemService extends AppServiceBase { ...@@ -14,6 +14,7 @@ class UtilsDeliverSystemService extends AppServiceBase {
* @param {*} pobj * @param {*} pobj
*/ */
async pushBusiness2DeliverSystem(pobj) {//推送业务信息到交付系统 async pushBusiness2DeliverSystem(pobj) {//推送业务信息到交付系统
console.log(pobj,"pushBusiness2DeliverSystem-zhuangbing------------------------------");
var verifyResult = await this.verifyParam(pobj); var verifyResult = await this.verifyParam(pobj);
if (verifyResult.status != 0) { if (verifyResult.status != 0) {
return await this.disposePushResultFail(pobj, verifyResult, "deliver->pushBusiness2DeliverSystem->verifyResult", this.pushlogFailType.FQ); return await this.disposePushResultFail(pobj, verifyResult, "deliver->pushBusiness2DeliverSystem->verifyResult", this.pushlogFailType.FQ);
...@@ -36,7 +37,8 @@ class UtilsDeliverSystemService extends AppServiceBase { ...@@ -36,7 +37,8 @@ class UtilsDeliverSystemService extends AppServiceBase {
}, },
requestId: pobj.requestId || "" // N 请求id requestId: pobj.requestId || "" // N 请求id
} }
await this.opQueuePushClientPost(pobj, this.opPushQueueUrl, reqParams); var opQueuePushClientPostRes = await this.opQueuePushClientPost(pobj, this.opPushQueueUrl, reqParams);
console.log(opQueuePushClientPostRes,"pushBusiness2DeliverSystem-zhuangbing----2--------------------------");
} }
//--------------------------------------------------内部辅助方法-------------------start----------------- //--------------------------------------------------内部辅助方法-------------------start-----------------
......
...@@ -60,14 +60,15 @@ class UtilsNeedService extends AppServiceBase { ...@@ -60,14 +60,15 @@ 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") {
...@@ -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);
...@@ -200,6 +201,19 @@ class UtilsNeedService extends AppServiceBase { ...@@ -200,6 +201,19 @@ class UtilsNeedService extends AppServiceBase {
var itemResult = await this.restPostUrl(pobj, reqUrl); var itemResult = await this.restPostUrl(pobj, reqUrl);
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
...@@ -1340,14 +1354,15 @@ class UtilsNeedService extends AppServiceBase { ...@@ -1340,14 +1354,15 @@ 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") {
...@@ -1441,8 +1456,10 @@ class UtilsNeedService extends AppServiceBase { ...@@ -1441,8 +1456,10 @@ class UtilsNeedService extends AppServiceBase {
var url = settings.centerOrderUrl() + "action/qcapi/springBoard"; var url = settings.centerOrderUrl() + "action/qcapi/springBoard";
var rtn = await this.restPostUrl(pobj, url); var rtn = await this.restPostUrl(pobj, url);
if (rtn.status == 0 && rtn.data) { if (rtn.status == 0 && rtn.data) {
var channelOrderNo = pobj.actionBody.orderNo;
pobj.actionBody.orderNo = rtn.data.orderNo; pobj.actionBody.orderNo = rtn.data.orderNo;
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, "订单关闭失败");
} }
...@@ -1455,8 +1472,16 @@ class UtilsNeedService extends AppServiceBase { ...@@ -1455,8 +1472,16 @@ class UtilsNeedService extends AppServiceBase {
appInfo: pobj.appInfo appInfo: pobj.appInfo
} }
this.utilsPushSve.baiduBusiness2Delivery(tmpObj, "pushDeliveryStatusNotify"); this.utilsPushSve.baiduBusiness2Delivery(tmpObj, "pushDeliveryStatusNotify");
tmpObj.actionBody.orderNo = rtn.data.channelSolutionNo; // tmpObj.actionBody.orderNo = channelOrderNo;
self.utilsPushSve.baiduBusiness2Fq(tmpObj, "pushOrderICPClose"); var tmpObj2 = {
actionBody: {
orderNo: channelOrderNo,
channelNeedNo: rtn.data.channelNeedNo,
needsolution: rtn.data.solutionContent
},
appInfo: pobj.appInfo
};
self.utilsPushSve.baiduBusiness2Fq(tmpObj2, "pushOrderICPClose");
}//通知更新状态 }//通知更新状态
return rtn; return rtn;
} }
......
...@@ -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");
} }
...@@ -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,17 +510,17 @@ class UtilsNeedService2 extends AppServiceBase { ...@@ -509,17 +510,17 @@ 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)
} }
} }
//推送交付系统 //推送交付系统
var reqParams = { var reqParams = {
actionBody: { actionBody: {
...@@ -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,10 +578,10 @@ class UtilsNeedService2 extends AppServiceBase { ...@@ -577,10 +578,10 @@ class UtilsNeedService2 extends AppServiceBase {
requirementId: pobj.actionBody.intentionBizId requirementId: pobj.actionBody.intentionBizId
} }
}); });
console.log('xxcc+++',res) console.log('xxcc+++', res)
} }
} }
// 2020 0820 lin 新增 拉去有跟进信息的需求但 并 记录 // 2020 0820 lin 新增 拉去有跟进信息的需求但 并 记录
// console.log(pobj.actionBody.intentionBizId,res.data.TotalItemNum) // console.log(pobj.actionBody.intentionBizId,res.data.TotalItemNum)
// if(res.data.TotalItemNum > 0) { // if(res.data.TotalItemNum > 0) {
...@@ -591,7 +592,10 @@ class UtilsNeedService2 extends AppServiceBase { ...@@ -591,7 +592,10 @@ class UtilsNeedService2 extends AppServiceBase {
// var updateRes = await this.utilsneedSve.dao.customUpdate(sql, paramWhere); // var updateRes = await this.utilsneedSve.dao.customUpdate(sql, paramWhere);
// } // }
// func(); // func();
return res; if(res && res.data && res.data.result){
res.data['Data'] = res.data.result
}
return getResultSuccess(res);
} }
/** /**
...@@ -630,10 +634,10 @@ class UtilsNeedService2 extends AppServiceBase { ...@@ -630,10 +634,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 +672,7 @@ class UtilsNeedService2 extends AppServiceBase { ...@@ -668,7 +672,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";
...@@ -680,15 +684,15 @@ class UtilsNeedService2 extends AppServiceBase { ...@@ -680,15 +684,15 @@ class UtilsNeedService2 extends AppServiceBase {
}; };
for (let item of result.data) { for (let item of result.data) {
if (item.Type == 1 && item.RegisterNumber) { if (item.Type == 1 && item.RegisterNumber) {
pobj.actionBody.intentionBizId = item.BizId; pobj.actionBody.intentionBizId = item.BizId;
pobj.actionBody.mobile = item.Mobile ? item.Mobile : ""; pobj.actionBody.mobile = item.Mobile ? item.Mobile : "";
//pobj.actionBody.Area = item.Area || "北京" //pobj.actionBody.Area = item.Area || "北京"
pobj.actionBody.area = '大陆地区 ' pobj.actionBody.area = '大陆地区 '
pobj.actionBody.userName = item.UserName ? item.UserName : ""; pobj.actionBody.userName = item.UserName ? item.UserName : "";
pobj.actionBody.description = item.RegisterNumber pobj.actionBody.description = item.RegisterNumber
pobj.notes = `${item.RegisterNumber ? "RegisterNumber:" + item.RegisterNumber : ""}${item.Classification ? "Classification:" + item.Classification : ""}`; pobj.notes = `${item.RegisterNumber ? "RegisterNumber:" + item.RegisterNumber : ""}${item.Classification ? "Classification:" + item.Classification : ""}`;
let res = await this.submitNeed(JSON.parse(JSON.stringify(pobj)), { intentionBizId: item.BizId }); let res = await this.submitNeed(JSON.parse(JSON.stringify(pobj)), { intentionBizId: item.BizId });
console.log(res) console.log(res)
} }
} }
return system.getResultSuccess(); return system.getResultSuccess();
...@@ -715,14 +719,14 @@ class UtilsNeedService2 extends AppServiceBase { ...@@ -715,14 +719,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 +735,58 @@ class UtilsNeedService2 extends AppServiceBase { ...@@ -731,58 +735,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 +796,15 @@ class UtilsNeedService2 extends AppServiceBase { ...@@ -792,15 +796,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 +812,16 @@ class UtilsNeedService2 extends AppServiceBase { ...@@ -808,16 +812,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,16 +987,16 @@ class UtilsNeedService2 extends AppServiceBase { ...@@ -983,16 +987,16 @@ class UtilsNeedService2 extends AppServiceBase {
} }
} }
bizTypeChange(bizType) { bizTypeChange(bizType) {
switch(bizType) { switch (bizType) {
case "ICP许可证": case "ICP许可证":
return "5" return "5"
case "EDI许可证": case "EDI许可证":
return "7" return "7"
} }
} }
needBizTypeChange(type) { needBizTypeChange(type) {
switch(type) { switch (type) {
case "ICP许可证": case "ICP许可证":
return "icpsq" return "icpsq"
case "EDI许可证": case "EDI许可证":
return "edisq" return "edisq"
...@@ -1033,11 +1037,11 @@ class UtilsNeedService2 extends AppServiceBase { ...@@ -1033,11 +1037,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 +1055,11 @@ class UtilsNeedService2 extends AppServiceBase { ...@@ -1051,11 +1055,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)
...@@ -1093,14 +1097,14 @@ class UtilsNeedService2 extends AppServiceBase { ...@@ -1093,14 +1097,14 @@ class UtilsNeedService2 extends AppServiceBase {
// } // }
// } // }
switch (actionBody.operationType) { switch (actionBody.operationType) {
case "USER_PAY_PRODUCE": case "USER_PAY_PRODUCE":
// 修改需求,方案 订单状态 // 修改需求,方案 订单状态
// 第一步查处需求单 原因 询价/创建 需要商品数据 用户数据 // 第一步查处需求单 原因 询价/创建 需要商品数据 用户数据
pobj.actionBody.needNo = pobj.actionBody.intentionBizId pobj.actionBody.needNo = pobj.actionBody.intentionBizId
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 +1135,7 @@ class UtilsNeedService2 extends AppServiceBase { ...@@ -1131,7 +1135,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获取不到手机号 再去调用其他接口浪费资源
...@@ -1180,10 +1184,10 @@ class UtilsNeedService2 extends AppServiceBase { ...@@ -1180,10 +1184,10 @@ class UtilsNeedService2 extends AppServiceBase {
// var reqUrl = this.centerOrderUrl + "action/order/springBoard"; // var reqUrl = this.centerOrderUrl + "action/order/springBoard";
// qobj.actionBody.channelOrder.orderStatus = 2;// 2作为orderinfo的orderStatus的值。含义为已付款 // qobj.actionBody.channelOrder.orderStatus = 2;// 2作为orderinfo的orderStatus的值。含义为已付款
// var result = await this.restPostUrl(qobj, reqUrl); // var result = await this.restPostUrl(qobj, reqUrl);
pobj.actionBody.bizId = actionBody.bizId, pobj.actionBody.bizId = actionBody.bizId,
pobj.actionBody.userName = needInfoResult.data.publishName, pobj.actionBody.userName = needInfoResult.data.publishName,
pobj.actionBody.mobile = needInfoResult.data.publishMobile, pobj.actionBody.mobile = needInfoResult.data.publishMobile,
pobj.actionBody.orderNo = actionBody.bizId; pobj.actionBody.orderNo = actionBody.bizId;
pobj.actionBody.totalSum = productPriceResult.data.price; pobj.actionBody.totalSum = productPriceResult.data.price;
pobj.actionBody.orderPrice = productPriceResult.data.price; pobj.actionBody.orderPrice = productPriceResult.data.price;
pobj.actionBody.payTotalSum = productPriceResult.data.price; pobj.actionBody.payTotalSum = productPriceResult.data.price;
...@@ -1233,7 +1237,7 @@ class UtilsNeedService2 extends AppServiceBase { ...@@ -1233,7 +1237,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
} }
...@@ -1256,13 +1260,13 @@ class UtilsNeedService2 extends AppServiceBase { ...@@ -1256,13 +1260,13 @@ class UtilsNeedService2 extends AppServiceBase {
this.utilsPushSve.aliBusiness2Fq(fqobj, "pushOrderICPBusiness"); this.utilsPushSve.aliBusiness2Fq(fqobj, "pushOrderICPBusiness");
this.utilsPushSve.aliBusiness2Delivery(deliveryObj, "pushDeliveryOrder"); this.utilsPushSve.aliBusiness2Delivery(deliveryObj, "pushDeliveryOrder");
break; break;
case "USER_CONFIRM_PRODUCE": case "USER_CONFIRM_PRODUCE":
break; break;
case "USER_REFUSE_PRODUCE": case "USER_REFUSE_PRODUCE":
break; break;
case "ABC_CLOSE_PRODUCE": case "ABC_CLOSE_PRODUCE":
break; break;
case "USER_UPLOAD_PRODUCE": case "USER_UPLOAD_PRODUCE":
break; break;
default: default:
return system.getResult(null, "operationType参数错误"); return system.getResult(null, "operationType参数错误");
...@@ -1271,23 +1275,23 @@ class UtilsNeedService2 extends AppServiceBase { ...@@ -1271,23 +1275,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 +1309,7 @@ class UtilsNeedService2 extends AppServiceBase { ...@@ -1305,7 +1309,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 +1368,7 @@ class UtilsNeedService2 extends AppServiceBase { ...@@ -1364,7 +1368,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 +1382,7 @@ class UtilsNeedService2 extends AppServiceBase { ...@@ -1378,7 +1382,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 +1414,18 @@ class UtilsNeedService2 extends AppServiceBase { ...@@ -1410,17 +1414,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 +1455,7 @@ class UtilsNeedService2 extends AppServiceBase { ...@@ -1450,7 +1455,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;
......
...@@ -29,6 +29,28 @@ class UtilsPushService extends AppServiceBase { ...@@ -29,6 +29,28 @@ class UtilsPushService extends AppServiceBase {
return system.getResult(null, "push Fail,interface_info data is empty"); return system.getResult(null, "push Fail,interface_info data is empty");
} }
async business2Channel(pobj, opType) {//供业务调用,在代码中调用,不在db中做配置进行调用
pobj.actionType = "getAppInterface";
var reqUrl = settings.centerAppUrl() + "action/opProduct/springBoard";
var productItemInterfaceResult = await this.restPostUrl(pobj, reqUrl);
pobj.interface_info = productItemInterfaceResult.data;
//日志记录
this.logCtl.info({
appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "",
appkey: pobj.appInfo ? pobj.appInfo.uapp_key || "" : "",
requestId: pobj.requestId || "",
op: "service/impl/utilsSve/utilsPushSve.js/service/app.base.js/business2Channel",
content: JSON.stringify(pobj),
resultInfo: productItemInterfaceResult.data ? JSON.stringify(productItemInterfaceResult.data) : "接口数据为空",
optitle: opType + "推送获取的接口信息->business2Channel",
});
if (pobj.interface_info) {
await this.pushBusInfo(pobj, opType, 1);
return system.getResultSuccess();
}
return system.getResult(null, "push Fail,interface_info data is empty");
}
async aliBusiness2Fq(pobj, opType) {//供业务调用,在代码中调用,不在db中做配置进行调用 async aliBusiness2Fq(pobj, opType) {//供业务调用,在代码中调用,不在db中做配置进行调用
pobj.actionType = "getAppInterface"; pobj.actionType = "getAppInterface";
...@@ -165,6 +187,8 @@ class UtilsPushService extends AppServiceBase { ...@@ -165,6 +187,8 @@ class UtilsPushService extends AppServiceBase {
var reqUrl = settings.centerAppUrl() + "action/opProduct/springBoard"; var reqUrl = settings.centerAppUrl() + "action/opProduct/springBoard";
var productItemInterfaceResult = await this.restPostUrl(pobj, reqUrl); var productItemInterfaceResult = await this.restPostUrl(pobj, reqUrl);
pobj.interface_info = productItemInterfaceResult.data; pobj.interface_info = productItemInterfaceResult.data;
console.log(pobj,"baiduBusiness2Delivery-zhuangbing------------------------------"+opType);
console.log(productItemInterfaceResult);
//日志记录 //日志记录
this.logCtl.info({ this.logCtl.info({
appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "", appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "",
......
...@@ -89,13 +89,14 @@ class utils360Sve extends AppServiceBase { ...@@ -89,13 +89,14 @@ class utils360Sve extends AppServiceBase {
"timeUnit":pobj.actionBody.timeUnit, "timeUnit":pobj.actionBody.timeUnit,
"quantity":pobj.actionBody.quantity, "quantity":pobj.actionBody.quantity,
"companyInfo":{ "companyInfo":{
"companyName":pobj.actionBody.companyInfo.companyName, "corpName":pobj.actionBody.companyInfo.corpName,
"taxpayerType":pobj.actionBody.companyInfo.taxpayerType, "taxpayerTypeEnum":pobj.actionBody.companyInfo.taxpayerTypeEnum,
"acctgSystemId":pobj.actionBody.companyInfo.acctgSystemId, "acctgSystemId":pobj.actionBody.companyInfo.acctgSystemId,
"companyForm":pobj.actionBody.companyInfo.companyForm, "enterpriseFormEnum":pobj.actionBody.companyInfo.enterpriseFormEnum,
"industry":pobj.actionBody.companyInfo.industry, "taxIndustryId":pobj.actionBody.companyInfo.taxIndustryId,
"taxpayerNumber":pobj.actionBody.companyInfo.taxpayerNumber, "taxNo":pobj.actionBody.companyInfo.taxNo,
"companyArea":pobj.actionBody.companyInfo.companyArea "serviceTypeEnum":pobj.actionBody.companyInfo.serviceTypeEnum,
"taxClaimMethodEnum":pobj.actionBody.companyInfo.taxClaimMethodEnum
} }
}, },
appInfo: pobj.appInfo appInfo: pobj.appInfo
......
const crypto = require('crypto'); const crypto = require('crypto');
const sha256 = require('sha256'); const sha256 = require('sha256');
const system = require("../system"); const system = require("../system");
var settings = require("../../config/settings");
class baiduClient { class baiduClient {
constructor() { constructor() {
this.pushlogSve = system.getObject("service.common.pushlogSve"); this.pushlogSve = system.getObject("service.common.pushlogSve");
this.execClient = system.getObject("util.execClient"); this.execClient = system.getObject("util.execClient");
this.baiduClientParams = settings.baiduClientParams();
} }
//2020 1027 laolan 调用百度网关 //2020 1027 laolan 调用百度网关
async baiduPost( path, actionBody) { async baiduPost( path, actionBody) {
console.log('actionBody++',actionBody) console.log('actionBody++',actionBody)
// let domain = "https://gwgp-mwnn9gk4o4e.i.bdcloudapi.com";//开发 let domain = this.baiduClientParams.domain;
let domain = "https://gwgp-nbzljnwusrw.i.bdcloudapi.com";//线上
let url = domain+path; let url = domain+path;
let version ="bce-auth-v1"; let version ="bce-auth-v1";
// let accessKey = "ed0f5c4c7c2d4e87aa335d9b07bf9bd4"; let accessKey = this.baiduClientParams.accessKey;
// let secretKey = "f600c4e91f6d43998d637401e6e34ef9"; let secretKey = this.baiduClientParams.secretKey;
let accessKey = "0e5abf33ef07457f8dbd779287747c0c";
let secretKey = "9d86f04a85db4cdfa95ba8ad28009188";
let timestamp = new Date().toISOString() let timestamp = new Date().toISOString()
let site = timestamp.lastIndexOf("."); let site = timestamp.lastIndexOf(".");
timestamp = timestamp.substring(0,site)+"Z" timestamp = timestamp.substring(0,site)+"Z"
let signedHeaders = "host"; let signedHeaders = "host";
let extime = 1800; let extime = 1800;
let canonicalHeaders = "host:gwgp-nbzljnwusrw.i.bdcloudapi.com" let canonicalHeaders = "host:"+this.baiduClientParams.host;
//中间结果1:规范化请求和前缀字符串 //中间结果1:规范化请求和前缀字符串
let canonicalRequest = "POST" + "\n" + path + "\n" + "\n" + canonicalHeaders; let canonicalRequest = "POST" + "\n" + path + "\n" + "\n" + canonicalHeaders;
//authStringPrefix(前缀字符串,由除sk字段外的签名信息生成) //authStringPrefix(前缀字符串,由除sk字段外的签名信息生成)
...@@ -64,7 +63,7 @@ class baiduClient { ...@@ -64,7 +63,7 @@ class baiduClient {
formatParams: true, // default true, format the parameter name to first letter upper case formatParams: true, // default true, format the parameter name to first letter upper case
method: 'POST', // set the http method, default is GET method: 'POST', // set the http method, default is GET
headers: { headers: {
host:"gwgp-nbzljnwusrw.i.bdcloudapi.com" host:this.baiduClientParams.host
}, // set the http request headers }, // set the http request headers
}); });
console.log('baidu++++res+++',res) console.log('baidu++++res+++',res)
...@@ -94,3 +93,5 @@ class baiduClient { ...@@ -94,3 +93,5 @@ class baiduClient {
} }
} }
module.exports = baiduClient; module.exports = baiduClient;
// var task = new baiduClient();
// console.log(task.baiduClientParams,"11111111111111111");
\ No newline at end of file
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;
...@@ -3,6 +3,7 @@ const util = require('util'); ...@@ -3,6 +3,7 @@ const util = require('util');
const exec = util.promisify(require('child_process').exec); const exec = util.promisify(require('child_process').exec);
const uuidv4 = require('uuid/v4'); const uuidv4 = require('uuid/v4');
var settings = require("../../config/settings"); var settings = require("../../config/settings");
const axios = require('axios');
class ExecClient { class ExecClient {
constructor() { constructor() {
this.cmdPostPattern = "curl --user admines:adminGSBes. -k -H 'Content-type: application/json' -d '{data}' {url}"; this.cmdPostPattern = "curl --user admines:adminGSBes. -k -H 'Content-type: application/json' -d '{data}' {url}";
...@@ -23,7 +24,10 @@ class ExecClient { ...@@ -23,7 +24,10 @@ class ExecClient {
async exec(cmd) { async exec(cmd) {
//await后面表达式返回的promise对象, 是then的语法糖,await返回then函数的返回值 //await后面表达式返回的promise对象, 是then的语法糖,await返回then函数的返回值
//异常需要try/catch自己捕获或外部catch捕获 //异常需要try/catch自己捕获或外部catch捕获
const { stdout, stderr } = await exec(cmd); var options = {
maxBuffer: 1024 * 1024 * 20
};
const { stdout, stderr } = await exec(cmd,options);
return { stdout, stderr }; return { stdout, stderr };
} }
...@@ -62,6 +66,13 @@ class ExecClient { ...@@ -62,6 +66,13 @@ class ExecClient {
return cmd; return cmd;
} }
async execPost(subData, url) { async execPost(subData, url) {
if(settings.env == 'dev'){
const rs = await axios.post(url,subData);
const ret ={
stdout:JSON.stringify(rs.data)
}
return ret;
}
let cmd = this.FetchPostCmd(subData, url); let cmd = this.FetchPostCmd(subData, url);
var result = await this.exec(cmd); var result = await this.exec(cmd);
return result; return result;
...@@ -77,6 +88,15 @@ class ExecClient { ...@@ -77,6 +88,15 @@ class ExecClient {
return result; return result;
} }
async execPushDataPost(subData, url, token, requestId) { async execPushDataPost(subData, url, token, requestId) {
if(settings.env == 'dev'){
axios.defaults.headers['token'] = token;
// axios.defaults.headers['request-id'] = requestId;
const rs = await axios.post(url,subData);
const ret ={
stdout:JSON.stringify(rs.data)
}
return ret;
}
let cmd = this.FetchPushDataPostCmd(subData, url, token, requestId); let cmd = this.FetchPushDataPostCmd(subData, url, token, requestId);
var options = { var options = {
maxBuffer: 1024 * 1024 * 20 maxBuffer: 1024 * 1024 * 20
...@@ -127,6 +147,21 @@ class ExecClient { ...@@ -127,6 +147,21 @@ class ExecClient {
async exec360GetToken(url){ async exec360GetToken(url){
const qs = require('qs') const qs = require('qs')
let obj = {"scope":"smart_business","grant_type":"client_credentials"} let obj = {"scope":"smart_business","grant_type":"client_credentials"}
if(settings.env == 'dev'){
const rs = await axios({
method: 'post',
url: url,
data:qs.stringify(obj),
auth: {
username:"gongsibao",
password:"qPa4PsVsxbQ847i5pOKSmfPKrzRoNKqx"
}
})
const ret ={
stdout:JSON.stringify(rs.data)
}
return ret;
}
let cmd = this.Fetch360PostCmd(qs.stringify(obj),url); let cmd = this.Fetch360PostCmd(qs.stringify(obj),url);
console.log(cmd); console.log(cmd);
var result = await this.exec(cmd); var result = await this.exec(cmd);
......
...@@ -20,6 +20,7 @@ module.exports = { ...@@ -20,6 +20,7 @@ module.exports = {
"putUserPwdByMobile", "icpNotifyNew" "putUserPwdByMobile", "icpNotifyNew"
], ],
apiMustUserpinList: [ apiMustUserpinList: [
"icpOrderClose",
"submitNeed", "paySuccess", "icpNotify", "getLoginInfo", "icpNotifyNew", "submitIcpProgramme","serviceProviderSubmitMaterial","abolishIcpProgramme", "submitNeed", "paySuccess", "icpNotify", "getLoginInfo", "icpNotifyNew", "submitIcpProgramme","serviceProviderSubmitMaterial","abolishIcpProgramme",
"submitService","serviceProviderNotification", "submitService","serviceProviderNotification",
"ncGetNeedList","ncSubmitMaterial","ncNotification","ncSubmitSolution","ncWriteCommunicationRecord","ncGetCommunicationRecord","ncCloseNeed","ncClosePlan","ncCloseOrderDelivery", "ncGetNeedList","ncSubmitMaterial","ncNotification","ncSubmitSolution","ncWriteCommunicationRecord","ncGetCommunicationRecord","ncCloseNeed","ncClosePlan","ncCloseOrderDelivery",
......
...@@ -30,6 +30,22 @@ var settings = { ...@@ -30,6 +30,22 @@ var settings = {
} }
return "http://43.247.184.94:7200/center_channel_req_log/_doc?pretty"; return "http://43.247.184.94:7200/center_channel_req_log/_doc?pretty";
}, },
baiduClientParams: function () {
if (this.env == 'dev') {
return {
domain:"https://gwgp-mwnn9gk4o4e.i.bdcloudapi.com",//开发
accessKey:"ed0f5c4c7c2d4e87aa335d9b07bf9bd4",
secretKey:"f600c4e91f6d43998d637401e6e34ef9",
host:"gwgp-mwnn9gk4o4e.i.bdcloudapi.com"
};
}
return {
domain:"https://gwgp-nbzljnwusrw.i.bdcloudapi.com",//线上
accessKey:"0e5abf33ef07457f8dbd779287747c0c",
secretKey:"9d86f04a85db4cdfa95ba8ad28009188",
host:"gwgp-nbzljnwusrw.i.bdcloudapi.com"
};
},
fbQueryUrl: function () { fbQueryUrl: function () {
if (this.env == 'dev' || this.env == 'test') { if (this.env == 'dev' || this.env == 'test') {
return 'http://43.247.184.92:15505' return 'http://43.247.184.92:15505'
...@@ -39,7 +55,9 @@ var settings = { ...@@ -39,7 +55,9 @@ var settings = {
}, },
opPushQueueUrl: function () { opPushQueueUrl: function () {
if (this.env == "dev" || this.env == "test") { if (this.env == "dev" || this.env == "test") {
return "http://192.168.18.101:4018/api/queueAction/producer/springBoard"; // return "http://192.168.18.101:4018/api/queueAction/producer/springBoard";
// 2020 1112 lin修改 替换为线上测试队列环境。经过宋哥批准。兴业提供的地址
return "http://gsbqueue.frp.sxy97.xyz/api/queueAction/producer/springBoard"
} else { } else {
return "http://sytxpublic-msgq-service/api/queueAction/producer/springBoard"; return "http://sytxpublic-msgq-service/api/queueAction/producer/springBoard";
} }
...@@ -121,7 +139,7 @@ var settings = { ...@@ -121,7 +139,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