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 {
opResult = await this.rtSve.rtCloseOrderDelivery(pobj);
break;
// --------- 推送icp信息至渠道和作方 zhuangbing-20201116--------
case "pushIcpSolution2Channel"://推送ICP方案至渠道(百度)
opResult = await this.baseOrderSve.pushIcpSolution2Channel(pobj);
break;
default:
opResult = system.getResult(null, "action_type参数错误");
break;
......
......@@ -126,6 +126,15 @@ class TmQueryAPI extends WEBBase {
case "tmtrend": //商标申请及注册趋势
opResult = await this.tmquerySve.tmtrend(action_body,req);
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": //通过商标名来进行精准查询,商标注册地域/大类分布
opResult = await this.tmquerySve.findTrademarkNameAccuratejuhe(action_body,req);
break;
......
......@@ -110,6 +110,11 @@ class Need extends APIBase {
case "icpOrderClose"://关闭ICP订单
opResult = await this.utilsNeedSve.icpOrderClose(pobj, pobj.actionBody);
break;
case "getSolutionByChannelOrderNo"://根据渠道订单获取方案信息
opResult = await this.utilsNeedSve.getSolutionByChannelOrderNo(pobj, pobj.actionBody);
// opResult = await this.utilsNeedSve.getItemByChannelSolutionNo(pobj, pobj.actionBody);
// break;
break;
//-----------接入百度ICP------end----------------------------------
default:
opResult = system.getResult(null, "action_type参数错误");
......
......@@ -76,26 +76,29 @@ class edi extends APIBase {
if(!pobj.companyInfo) {
return system.getResult(null, "companyInfo cannot be empty");
}
if(!pobj.companyInfo.companyName) {
return system.getResult(null, "companyName cannot be empty");
if(!pobj.companyInfo.corpName) {
return system.getResult(null, "corpName cannot be empty");
}
if(!pobj.companyInfo.taxpayerType) {
return system.getResult(null, "taxpayerType cannot be empty");
if(!pobj.companyInfo.taxpayerTypeEnum) {
return system.getResult(null, "taxpayerTypeEnum cannot be empty");
}
if(!pobj.companyInfo.acctgSystemId) {
return system.getResult(null, "acctgSystemId cannot be empty");
}
if(!pobj.companyInfo.companyForm) {
return system.getResult(null, "companyForm cannot be empty");
if(!pobj.companyInfo.enterpriseFormEnum) {
return system.getResult(null, "enterpriseFormEnum cannot be empty");
}
if(!pobj.companyInfo.industry) {
return system.getResult(null, "industry cannot be empty");
if(!pobj.companyInfo.taxIndustryId) {
return system.getResult(null, "taxIndustryId cannot be empty");
}
if(!pobj.companyInfo.taxpayerNumber) {
return system.getResult(null, "taxpayerNumber cannot be empty");
if(!pobj.companyInfo.taxNo) {
return system.getResult(null, "taxNo cannot be empty");
}
if(!pobj.companyInfo.companyArea) {
return system.getResult(null, "companyArea cannot be empty");
if(!pobj.companyInfo.serviceTypeEnum) {
return system.getResult(null, "serviceTypeEnum cannot be empty");
}
if(!pobj.companyInfo.taxClaimMethodEnum) {
return system.getResult(null, "taxClaimMethodEnum cannot be empty");
}
return system.getResultSuccess()
}
......
......@@ -102,86 +102,146 @@ class BaseCenterOrderService extends AppServiceBase {
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);
if(ab.isTest && ab.isTest==1){
var reqPushParams = {
actionBody: {
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 区分百度与阿里
if(needinfo.uapp_id == uappId.ali){
if(actionBody.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,
IntentionBizId: actionBody.channelNeedNo,
CompanyName: actionBody.CompanyName,
IcpType: actionBody.IcpType,
CompanyAddress: actionBody.CompanyAddress,
Area: actionBody.Area,
Note: actionBody.Note,
ActionType:actionBody.ActionType,
Source:"官网"
};
if (needsolution.channelSolutionNo) {
pushObj["BizId"] = needsolution.channelSolutionNo;
if (actionBody.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(needinfo.uapp_id == uappId.baidu){
if(actionBody.uapp_id == uappId.baidu){
//推送数据至baidu
// var bizType = needinfo.channelTypeCode;//业务类型里
solution.Area = cityLetter[solution.Area]
console.log('solution.Area++',solution.Area)
actionBody.Area = cityLetter[actionBody.Area];
var pushObj = {
requirementId: needinfo.channelNeedNo,
companyName: solution.CompanyName,
companyAddress: solution.CompanyAddress,
area: solution.Area,
type:solution.IcpType
requirementId: actionBody.channelNeedNo,
companyName: actionBody.CompanyName,
companyAddress: actionBody.CompanyAddress,
area: actionBody.Area,
type:actionBody.IcpType
};
if (needsolution.channelSolutionNo) {
pushObj["bizId"] = needsolution.channelSolutionNo;
if (actionBody.channelSolutionNo) {
pushObj["bizId"] = actionBody.channelSolutionNo;
}
console.log('pushObj++',pushObj)
var pushIcpSolutionRes = await this.pushBaiduIcpSolution(pushObj, needsolution.solutionNo, pobj.appInfo, self);
pushRes = await this.pushBaiduIcpSolution(pushObj, actionBody.solutionNo, actionBody.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",
op: "app/base/service/impl/common/baseCenterOrderSve.js/pushIcpSolution2Channel",
content: JSON.stringify(pobj),
resultInfo: JSON.stringify(needinfo),
optitle: "createSolution推送蜂擎获取的接口信息->aliBusiness2Delivery",
resultInfo: JSON.stringify(pushRes),
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
async pushIcpSolution(pushObj, solutionNo, appInfo, self) {
//推送方案信息
......@@ -215,10 +275,11 @@ class BaseCenterOrderService extends AppServiceBase {
var a = await self.reqCenterOrderApi(reqObj3);//保存用户确认方案url
}
}
return confirmRes;
// return confirmRes;
}
}
}
return pushRes;
}
//推送ICP方案baidu 2020-10-26 laolan
......@@ -251,10 +312,11 @@ class BaseCenterOrderService extends AppServiceBase {
};
var url = await self.reqCenterOrderApi(reqObj3);//保存用户确认方案url
console.log('save confirmUrl ++ ',url)
return pushRes;
// return pushRes;
}
}
}
return pushRes;
}
//服务商icp方案关闭 2020-10-26 laolan
......
......@@ -307,7 +307,7 @@ class CenterorderService extends AppServiceBase {
orderPrice: Number(pobj.actionBody.orderPrice / 100),
phone: pobj.actionBody.publishMobile,
needId: solutiondata.data.channelNeedNo,
companyName:solutiondata.data.solutionContent.solution.CompanyName || ''
//companyName:solutiondata.data.solutionContent.solution.CompanyName || ''
},
appInfo: pobj.appInfo
}
......@@ -325,8 +325,35 @@ class CenterorderService extends AppServiceBase {
},
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");
}
return system.getResultSuccess();
}
//--------------------------阿里IC---end--------------------------------------------------------
......
......@@ -7,6 +7,7 @@ class GatewaypushlogService extends ServiceBase {
constructor() {
super("common", ServiceBase.getDaoName(GatewaypushlogService));
this.execClient = system.getObject("util.execClient");
this.dingClient = system.getObject("util.dingClient");
}
async taskAliIcapi() {
......@@ -31,6 +32,11 @@ class GatewaypushlogService extends ServiceBase {
if (data.success) {
icloginfo.pushStatus = "yts";
} else {
if (data.errorMsg!="状态错误") {//除1 2 4 11其它状态没处理、返回的状态错误
data.push_url = url
data.api = "center-channel/taskAliIcapi"
this.dingClient.gatewayPushError(data)
}
icloginfo.pushtimes += 1;
}
await this.update(icloginfo);
......@@ -39,6 +45,7 @@ class GatewaypushlogService extends ServiceBase {
return system.getResultSuccess();
} catch (error) {
this.dingClient.gatewayPushError({message:"Exception",api:"center-channel/taskAliIcapi"})
return system.getResultFail(-1,error);
}
}
......
......@@ -134,20 +134,23 @@ module.exports = SignService;
// "status":"16"
// }
// var obj = {
// "bizId":"OD2020110629779500",
// "contactMobile":"18550295628",
// "contactName":"范锋华",
// "timeUnit":"year",
// "quantity":1,
// "companyInfo":{
// "companyName":"苏州磐荣信息科技有限公司",
// "taxpayerType":"NORMAL_TAXPAYER",
// "acctgSystemId":"10001",
// "companyForm":"1",
// "industry":1,
// "taxpayerNumber":"123456789",
// "companyArea":"北京"
// "bizId":"OD2020110629779501",
// "companyInfo":{
// "companyName":"苏州磐荣信息科技有限公司",
// "taxpayerTypeEnum":"NORMAL_TAXPAYER",
// "acctgSystemId":"10001",
// "enterpriseFormEnum":"1",
// "taxIndustryId":1,
// "taxNo":"123456789",
// "serviceTypeEnum":"ACCOUTING",
// "taxClaimMethodEnum":"TAX_DECLARATION"
// },
// "contactMobile":"18550295628",
// "contactName":"范锋华",
// "timeUnit":"year",
// "quantity":1
// }
// }
// task.createSign(obj,"7cbb892450174167b5c7e01we4717z51").then(d=>{
// console.log(d,"!!!!!!!!!!!!!!!!!!!!!!!!!!");
......
......@@ -110,6 +110,24 @@ class TmqueryService {
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){
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 {
* @param {*} pobj
*/
async pushBusiness2DeliverSystem(pobj) {//推送业务信息到交付系统
console.log(pobj,"pushBusiness2DeliverSystem-zhuangbing------------------------------");
var verifyResult = await this.verifyParam(pobj);
if (verifyResult.status != 0) {
return await this.disposePushResultFail(pobj, verifyResult, "deliver->pushBusiness2DeliverSystem->verifyResult", this.pushlogFailType.FQ);
......@@ -36,7 +37,8 @@ class UtilsDeliverSystemService extends AppServiceBase {
},
requestId: pobj.requestId || "" // N 请求id
}
await this.opQueuePushClientPost(pobj, this.opPushQueueUrl, reqParams);
var opQueuePushClientPostRes = await this.opQueuePushClientPost(pobj, this.opPushQueueUrl, reqParams);
console.log(opQueuePushClientPostRes,"pushBusiness2DeliverSystem-zhuangbing----2--------------------------");
}
//--------------------------------------------------内部辅助方法-------------------start-----------------
......
......@@ -60,14 +60,15 @@ class UtilsNeedService extends AppServiceBase {
if (pobj.actionBody.description && pobj.actionBody.description.indexOf("备#") < 0) {
pobj.actionBody.level = "A";
} else {
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);
if (levelresult.status == 0) {
pobj.actionBody.level = levelresult.data.level;
pobj.actionBody.probability = levelresult.data.per;
} else {
pobj.actionBody.level = "C"
}
// 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);
// if (levelresult.status == 0) {
// pobj.actionBody.level = levelresult.data.level;
// pobj.actionBody.probability = levelresult.data.per;
// } else {
// pobj.actionBody.level = "C"
// }
pobj.actionBody.level = "C"
}
if (pobj.actionBody.phone == "17319425791") {
......@@ -106,7 +107,7 @@ class UtilsNeedService extends AppServiceBase {
}
var self = this;
pobj.actionType = "receiveIcpFeedback";
if(pobj.actionBody && pobj.actionBody.intentionStatus){
if (pobj.actionBody && pobj.actionBody.intentionStatus) {
pobj.intentionStatus = pobj.actionBody.intentionStatus;
}
var rtn = await this.execClient.execPost(pobj, url);
......@@ -200,6 +201,19 @@ class UtilsNeedService extends AppServiceBase {
var itemResult = await this.restPostUrl(pobj, reqUrl);
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
......@@ -1340,14 +1354,15 @@ class UtilsNeedService extends AppServiceBase {
if (pobj.actionBody.description && pobj.actionBody.description.indexOf("备#") < 0) {
pobj.actionBody.level = "A";
} else {
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);
if (levelresult.status == 0) {
pobj.actionBody.level = levelresult.data.level;
pobj.actionBody.probability = levelresult.data.per;
} else {
pobj.actionBody.level = "C"
}
// 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);
// if (levelresult.status == 0) {
// pobj.actionBody.level = levelresult.data.level;
// pobj.actionBody.probability = levelresult.data.per;
// } else {
// pobj.actionBody.level = "C"
// }
pobj.actionBody.level = "C"
}
if (pobj.actionBody.phone == "17319425791") {
......@@ -1441,8 +1456,10 @@ class UtilsNeedService extends AppServiceBase {
var url = settings.centerOrderUrl() + "action/qcapi/springBoard";
var rtn = await this.restPostUrl(pobj, url);
if (rtn.status == 0 && rtn.data) {
var channelOrderNo = pobj.actionBody.orderNo;
pobj.actionBody.orderNo = rtn.data.orderNo;
var orderrtn = await self.utilsOrderSve.delOrder(pobj, pobj.actionBody);
pobj.actionType="delOrder";
var orderrtn = await self.utilsOrderSve.delOrder(pobj, actionBody);
if (orderrtn.status < 0) {
return system.getResultFail(-5022, "订单关闭失败");
}
......@@ -1455,8 +1472,16 @@ class UtilsNeedService extends AppServiceBase {
appInfo: pobj.appInfo
}
this.utilsPushSve.baiduBusiness2Delivery(tmpObj, "pushDeliveryStatusNotify");
tmpObj.actionBody.orderNo = rtn.data.channelSolutionNo;
self.utilsPushSve.baiduBusiness2Fq(tmpObj, "pushOrderICPClose");
// tmpObj.actionBody.orderNo = channelOrderNo;
var tmpObj2 = {
actionBody: {
orderNo: channelOrderNo,
channelNeedNo: rtn.data.channelNeedNo,
needsolution: rtn.data.solutionContent
},
appInfo: pobj.appInfo
};
self.utilsPushSve.baiduBusiness2Fq(tmpObj2, "pushOrderICPClose");
}//通知更新状态
return rtn;
}
......
......@@ -6,8 +6,8 @@ const { json } = require("sequelize");
const { getResult, getResultSuccess } = require("../../../system");
//区分渠道的uappid
const uappId = {
'ali':"18", //(阿里icp、edi)
'baidu':"44" //(百度icp、edi)
'ali': "18", //(阿里icp、edi)
'baidu': "44" //(百度icp、edi)
}
//需求操作类----ali对接的需求
class UtilsNeedService2 extends AppServiceBase {
......@@ -35,7 +35,7 @@ class UtilsNeedService2 extends AppServiceBase {
* @param {*} 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)
}
if (!actionBody.intentionBizId) {
......@@ -69,17 +69,18 @@ class UtilsNeedService2 extends AppServiceBase {
if (pobj.actionBody.description && pobj.actionBody.description.indexOf("备#") < 0) {
pobj.actionBody.level = "A";
} else {
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);
if (levelresult.status == 0) {
pobj.actionBody.level = levelresult.data.level;
pobj.actionBody.probability = levelresult.data.per;
} else {
pobj.actionBody.level = "C"
}
// 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);
// if (levelresult.status == 0) {
// pobj.actionBody.level = levelresult.data.level;
// pobj.actionBody.probability = levelresult.data.per;
// } else {
// pobj.actionBody.level = "C"
// }
pobj.actionBody.level = "C"
}
if(pobj.actionBody.phone=="17319425791"){
if (pobj.actionBody.phone == "17319425791") {
pobj.actionBody.level = "F";
}
......@@ -259,8 +260,8 @@ class UtilsNeedService2 extends AppServiceBase {
* @param {*} actionBody
*/
async needCloseIcp(pobj, actionBody) {
console.log('guanbi icp xuqiu pobj+++',pobj)
if(actionBody.uapp_id == uappId.ali){
console.log('guanbi icp xuqiu pobj+++', pobj)
if (actionBody.uapp_id == uappId.ali) {
if (!actionBody.channelNeedNo) {
return system.getResult(null, "actionBody.channelNeedNo can not be empty,100395");
}
......@@ -282,9 +283,9 @@ class UtilsNeedService2 extends AppServiceBase {
resultInfo: JSON.stringify(result),
optitle: "abolishIcpProgrammeByNeed推送蜂擎获取的接口信息->aliBusiness2Delivery",
});
console.log('result close',result)
console.log('result close', result)
if (result.status == 0) {
if (result.data && result.data.orderNo ) {
if (result.data && result.data.orderNo) {
pobj.actionBody.orderNo = result.data.orderNo;
var orderrtn = await self.utilsOrderSve.delOrder(pobj, pobj.actionBody);
if (orderrtn.status < 0) {
......@@ -313,14 +314,14 @@ class UtilsNeedService2 extends AppServiceBase {
optitle: "updateChanceStatus推送蜂擎获取的接口信息->aliBusiness2Delivery",
});
// 推送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" });
}
// 推送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 }});
}
console.log("closed need a+++",a);
// 推送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 } });
}
console.log("closed need a+++", a);
self.utilsPushSve.aliBusiness2Fq(pobj, "pushCloseICPNeed");
return system.getResultSuccess();
} else {
......@@ -380,7 +381,7 @@ class UtilsNeedService2 extends AppServiceBase {
}
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();
}
pobj.actionType = "receiveIcpStatusNotify";
......@@ -391,7 +392,7 @@ class UtilsNeedService2 extends AppServiceBase {
actionBody: {
orderNo: rtn.data.orderNo,//pobj.actionBody.channelOrder.channelOrderNo,
needsolution: rtn.data.solutionContent,
channelNeedNo: rtn.data.channelNeedNo||"",
channelNeedNo: rtn.data.channelNeedNo || "",
channelSolutionNo: rtn.data.channelSolutionNo,
servicer: {
code: 'gsb',
......@@ -509,17 +510,17 @@ class UtilsNeedService2 extends AppServiceBase {
var reqUrl = this.centerOrderUrl + "action/need/springBoard";
var result = await this.restPostUrl(pobj, reqUrl);
//2020-10-28 laolan start
if(result && result.status == 0 && result.data){
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" });
console.log("ali+res",res)
}
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 } });
console.log("baidu+res",ress)
}
if (result && result.status == 0 && result.data) {
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" });
console.log("ali+res", res)
}
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 } });
console.log("baidu+res", ress)
}
}
//推送交付系统
var reqParams = {
actionBody: {
......@@ -553,9 +554,9 @@ class UtilsNeedService2 extends AppServiceBase {
//2020-10-28 laolan start
var reqUrl = this.centerOrderUrl + "action/need/springBoard";
var result = await this.restPostUrl(pobj, reqUrl);
console.log('jilu+++result++++',result)
if(result && result.status == 0 && result.data && result.data.uapp_id){
if(result.data.uapp_id == uappId.ali){
console.log('jilu+++result++++', result)
if (result && result.status == 0 && result.data && result.data.uapp_id) {
if (result.data.uapp_id == uappId.ali) {
var res = await this.aliclient.reqbyget({
action: "QueryExpertApplyCommunicationLogs", reqbody: {
BeginTime: pobj.actionBody.BeginTime ? pobj.actionBody.BeginTime : "",
......@@ -568,8 +569,8 @@ class UtilsNeedService2 extends AppServiceBase {
});
}
if(result.data.uapp_id == uappId.baidu){
console.log("bbbbb++",pobj)
if (result.data.uapp_id == uappId.baidu) {
console.log("bbbbb++", pobj)
var res = await this.baiduclient.baiduReqbyget({
path: "/api/bla/provider/communication/list", reqbody: {
beginTime: pobj.actionBody.BeginTime ? pobj.actionBody.BeginTime : "",
......@@ -577,10 +578,10 @@ class UtilsNeedService2 extends AppServiceBase {
requirementId: pobj.actionBody.intentionBizId
}
});
console.log('xxcc+++',res)
console.log('xxcc+++', res)
}
}
// 2020 0820 lin 新增 拉去有跟进信息的需求但 并 记录
// console.log(pobj.actionBody.intentionBizId,res.data.TotalItemNum)
// if(res.data.TotalItemNum > 0) {
......@@ -591,7 +592,10 @@ class UtilsNeedService2 extends AppServiceBase {
// var updateRes = await this.utilsneedSve.dao.customUpdate(sql, paramWhere);
// }
// 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 {
* @param {*} 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" });
}
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 });
}
if (result.code == 200) {
......@@ -668,7 +672,7 @@ class UtilsNeedService2 extends AppServiceBase {
// if (!pobj.actionBody.userFeedBack) {
// return system.getResult(null, "actionBody.userFeedBack can not be empty,100494");
// }
console.log('xxxqqqq+++chaxun+++',pobj)
console.log('xxxqqqq+++chaxun+++', pobj)
pobj.actionBody.data = [];
await this.queryByAli(pobj, 1);
pobj.actionType = "getUnCreated";
......@@ -680,15 +684,15 @@ class UtilsNeedService2 extends AppServiceBase {
};
for (let item of result.data) {
if (item.Type == 1 && item.RegisterNumber) {
pobj.actionBody.intentionBizId = item.BizId;
pobj.actionBody.mobile = item.Mobile ? item.Mobile : "";
//pobj.actionBody.Area = item.Area || "北京"
pobj.actionBody.area = '大陆地区 '
pobj.actionBody.intentionBizId = item.BizId;
pobj.actionBody.mobile = item.Mobile ? item.Mobile : "";
//pobj.actionBody.Area = item.Area || "北京"
pobj.actionBody.area = '大陆地区 '
pobj.actionBody.userName = item.UserName ? item.UserName : "";
pobj.actionBody.description = item.RegisterNumber
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 });
console.log(res)
pobj.actionBody.description = item.RegisterNumber
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 });
console.log(res)
}
}
return system.getResultSuccess();
......@@ -715,14 +719,14 @@ class UtilsNeedService2 extends AppServiceBase {
}
// 2020 0914 lin 新增 刷单一条龙服务
async needBatchUpload(pobj,actionBody) {
var BizIds="";
async needBatchUpload(pobj, actionBody) {
var BizIds = "";
var demands = [];
// 声明两个数组 用来走后四步用
var npobj = [];
var spobj = [];
// 遍历生成阿里需求 并把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)
......@@ -731,58 +735,58 @@ class UtilsNeedService2 extends AppServiceBase {
// 声明调用4.1需要的参数
var obj = {
Mobile: actionBody.demands[i].contactMobile,// 手机号
UserName:actionBody.demands[i].contactName,// 用户名
Description:actionBody.demands[i].description,
Area:area,
BizType:bizType,
Channel:"gsb",
Token:"gsb",
UserName: actionBody.demands[i].contactName,// 用户名
Description: actionBody.demands[i].description,
Area: area,
BizType: bizType,
Channel: "gsb",
Token: "gsb",
}
// 4.1 提交阿里需求
// 2020 0924 lin 修改 reqbyget 为 reqbyLTget
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
BizIds += aliResult.data.BizId + ",";
npobj.push({
"intentionBizId": aliResult.data.BizId,
"type": this.bizTypeChange(actionBody.demands[i].type),
"description":actionBody.demands[i].description,
"mobile":actionBody.demands[i].contactMobile
"description": actionBody.demands[i].description,
"mobile": actionBody.demands[i].contactMobile
})
spobj.push({
"needNo": aliResult.data.BizId,//渠道需求号
"solutionContent":{
"solutionContent": {
// submitIcpProgramme需要的类型转换 ICP许可证 = icpsq/EDI许可证 = edisq
"bizType":actionBody.demands[i].type,//产品类型 icpsq edisq
"solution":{
// "IcpType":1,//方案类型 不传默认1 1:icp 2: edi 参数无效
"CompanyName":actionBody.demands[i].companyName,
"CompanyAddress":actionBody.demands[i].companyAddress,
"Area":actionBody.demands[i].area + "(渠道)",
"Note":actionBody.demands[i].description
"bizType": actionBody.demands[i].type,//产品类型 icpsq edisq
"solution": {
// "IcpType":1,//方案类型 不传默认1 1:icp 2: edi 参数无效
"CompanyName": actionBody.demands[i].companyName,
"CompanyAddress": actionBody.demands[i].companyAddress,
"Area": actionBody.demands[i].area + "(渠道)",
"Note": actionBody.demands[i].description
}
}
})
if(aliResult.status != 0) {
if (aliResult.status != 0) {
// 统计失败次数
}
}
// 判断数据是否符合 执行后四步 的条件
if(npobj.length != actionBody.demands.length || spobj.length != actionBody.demands.length) {
return system.getResultFail(-5018,"提交阿里需求失败");
if (npobj.length != actionBody.demands.length || spobj.length != actionBody.demands.length) {
return system.getResultFail(-5018, "提交阿里需求失败");
}
// 睡3秒 意义:等待阿里异步分配成功。如果不等待则提交方案会失败 无法生成支付链接,需求状态错误
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 obj1 = JSON.parse(objString1);
obj1.actionBody = npobj[i];
var opResult = await this.submitNeed(obj1, obj1.actionBody);
console.log("needBatchUpload-opResult",opResult)
console.log("needBatchUpload-opResult", opResult)
// 第三步
// 提交Icp注册方案
// 程序执行比异步分配需求快,所以写成两个循环
......@@ -792,15 +796,15 @@ class UtilsNeedService2 extends AppServiceBase {
obj2.actionBody = spobj[i];
var subRes = await this.qcCenterOrderSve.submitIcpProgramme(obj2);
console.log("----------------------------------start");
console.log("needBatchUpload-res",subRes)
console.log("needBatchUpload-res", subRes)
console.log("----------------------------------end");
// 第四步
// 需求沟通记录接口
var writeRes = await this.writeCommunicationLog({actionBody:{intentionBizId:npobj[i].intentionBizId,note:"测试反馈"}});
console.log("needBatchUpload-writeRes",writeRes)
var writeRes = await this.writeCommunicationLog({ actionBody: { intentionBizId: npobj[i].intentionBizId, note: "测试反馈" } });
console.log("needBatchUpload-writeRes", writeRes)
// 整合前端需要的数据2
demands.push({
uniqueCode:actionBody.demands[i].uniqueCode,
uniqueCode: actionBody.demands[i].uniqueCode,
demandCode: npobj[i].intentionBizId
})
}
......@@ -808,16 +812,16 @@ class UtilsNeedService2 extends AppServiceBase {
// 首先切割掉BizId最后一位 是,
BizIds = BizIds.substr(0, BizIds.length - 1);
// 2020 0924 lin 修改 reqbyget 为 reqbyLTget
var aliConfirmResult = await this.aliclient.reqbyLTget({ action: "ConfirmIcpIntention", reqbody: {BizIds:BizIds}, apiVersion: "2019-05-08" });
console.log("needBatchUpload-aliConfirmResult",aliConfirmResult)
var aliConfirmResult = await this.aliclient.reqbyLTget({ action: "ConfirmIcpIntention", reqbody: { BizIds: BizIds }, apiVersion: "2019-05-08" });
console.log("needBatchUpload-aliConfirmResult", aliConfirmResult)
// 获取链接失败
if(aliConfirmResult.status != 0) {
return system.getResultFail(-5018,"confirmIcpIntention fail");
if (aliConfirmResult.status != 0) {
return system.getResultFail(-5018, "confirmIcpIntention fail");
}
var res = {
paymentLink:aliConfirmResult.data.ConfirmUrl,
batchNumber:actionBody.batchNumber,
demands:demands
paymentLink: aliConfirmResult.data.ConfirmUrl,
batchNumber: actionBody.batchNumber,
demands: demands
}
// 2020 0916 lin 新增返回格式 成功status为1 因为queue判断成功请求的条件为status1
return system.getResultRedisQueueSuccess(res);
......@@ -983,16 +987,16 @@ class UtilsNeedService2 extends AppServiceBase {
}
}
bizTypeChange(bizType) {
switch(bizType) {
case "ICP许可证":
switch (bizType) {
case "ICP许可证":
return "5"
case "EDI许可证":
return "7"
}
}
needBizTypeChange(type) {
switch(type) {
case "ICP许可证":
switch (type) {
case "ICP许可证":
return "icpsq"
case "EDI许可证":
return "edisq"
......@@ -1033,11 +1037,11 @@ class UtilsNeedService2 extends AppServiceBase {
var obj = {
"intentionBizId": actionBody.intentionBizId,
"type": actionBody.type,
"description":actionBody.description,
"mobile":actionBody.mobile
"description": actionBody.description,
"mobile": actionBody.mobile
}
var res = await this.submitNeed(pobj,obj);
if(res.status == 0) {
var res = await this.submitNeed(pobj, obj);
if (res.status == 0) {
return system.getResultSuccess(res.data);
}
return system.getResult(null, res)
......@@ -1051,11 +1055,11 @@ class UtilsNeedService2 extends AppServiceBase {
async needCloseAliEsp(pobj, actionBody) {
var obj = {
"intentionBizId": actionBody.intentionBizId,
"mobile":actionBody.mobile
"mobile": actionBody.mobile
}
pobj.actionType = "needClose";
var res = await this.needClose(pobj,obj);
if(res.status == 0) {
var res = await this.needClose(pobj, obj);
if (res.status == 0) {
return system.getResultSuccess(res.data);
}
return system.getResult(null, res)
......@@ -1093,14 +1097,14 @@ class UtilsNeedService2 extends AppServiceBase {
// }
// }
switch (actionBody.operationType) {
case "USER_PAY_PRODUCE":
case "USER_PAY_PRODUCE":
// 修改需求,方案 订单状态
// 第一步查处需求单 原因 询价/创建 需要商品数据 用户数据
pobj.actionBody.needNo = pobj.actionBody.intentionBizId
pobj.actionType = "getItemByChannelNeedNo";
var url = this.centerOrderUrl + "action/need/springBoard";
var needInfoResult = await this.restPostUrl(pobj, url);
if(needInfoResult.status != 0) {
if (needInfoResult.status != 0) {
return system.getResult(null, "needInfo is empty");
}
// 第二部 询价
......@@ -1131,7 +1135,7 @@ class UtilsNeedService2 extends AppServiceBase {
pobj.actionType = "getProductPrice";
var url = settings.centerAppUrl() + "action/opProduct/springBoard";
var productPriceResult = await this.restPostUrl(pobj, url);
if(productPriceResult.status != 0) {
if (productPriceResult.status != 0) {
return system.getResult(null, "productPrice is empty");
}
// 获取userpin 为什么在这里获取?原因:getWay获取不到手机号 再去调用其他接口浪费资源
......@@ -1180,10 +1184,10 @@ class UtilsNeedService2 extends AppServiceBase {
// var reqUrl = this.centerOrderUrl + "action/order/springBoard";
// qobj.actionBody.channelOrder.orderStatus = 2;// 2作为orderinfo的orderStatus的值。含义为已付款
// var result = await this.restPostUrl(qobj, reqUrl);
pobj.actionBody.bizId = actionBody.bizId,
pobj.actionBody.userName = needInfoResult.data.publishName,
pobj.actionBody.mobile = needInfoResult.data.publishMobile,
pobj.actionBody.orderNo = actionBody.bizId;
pobj.actionBody.bizId = actionBody.bizId,
pobj.actionBody.userName = needInfoResult.data.publishName,
pobj.actionBody.mobile = needInfoResult.data.publishMobile,
pobj.actionBody.orderNo = actionBody.bizId;
pobj.actionBody.totalSum = productPriceResult.data.price;
pobj.actionBody.orderPrice = productPriceResult.data.price;
pobj.actionBody.payTotalSum = productPriceResult.data.price;
......@@ -1233,7 +1237,7 @@ class UtilsNeedService2 extends AppServiceBase {
orderPrice: Number(pobj.actionBody.orderPrice / 100),
phone: needInfoResult.data.publishMobile,
needId: solutiondata.data.channelNeedNo,
companyName:solutiondata.data.solutionContent.solution.CompanyName || ''//1
companyName: solutiondata.data.solutionContent.solution.CompanyName || ''//1
},
appInfo: pobj.appInfo
}
......@@ -1256,13 +1260,13 @@ class UtilsNeedService2 extends AppServiceBase {
this.utilsPushSve.aliBusiness2Fq(fqobj, "pushOrderICPBusiness");
this.utilsPushSve.aliBusiness2Delivery(deliveryObj, "pushDeliveryOrder");
break;
case "USER_CONFIRM_PRODUCE":
case "USER_CONFIRM_PRODUCE":
break;
case "USER_REFUSE_PRODUCE":
case "USER_REFUSE_PRODUCE":
break;
case "ABC_CLOSE_PRODUCE":
case "ABC_CLOSE_PRODUCE":
break;
case "USER_UPLOAD_PRODUCE":
case "USER_UPLOAD_PRODUCE":
break;
default:
return system.getResult(null, "operationType参数错误");
......@@ -1271,23 +1275,23 @@ class UtilsNeedService2 extends AppServiceBase {
}
// 2020 0927 lin 新增 edi状态更新
async ediNotify(pobj,actionBody) {
if(actionBody.operationType == "USER_UPLOAD_PRODUCE" ) {
if(actionBody.extInfo) {
async ediNotify(pobj, actionBody) {
if (actionBody.operationType == "USER_UPLOAD_PRODUCE") {
if (actionBody.extInfo) {
// businessLicense:['business_license/12195411 61213057/1599115976393/p08xo9frgzj.png']
// idCardList:[' ["card/1219541161213057/1599115980036/s1nn3sozulo.png"] ']
// 注意idCardList 是二维数组 需要再转换一下 不知道为什么
var extJson = JSON.parse(actionBody.extInfo);
var businessLicenseArr = [];
if(extJson.idCardList) {
if (extJson.idCardList) {
// 抽出数组
var idCardListA = extJson.idCardList;
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]));
}
}
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]));
}
actionBody.extInfo = {
......@@ -1305,7 +1309,7 @@ class UtilsNeedService2 extends AppServiceBase {
pobj.actionType = "receiveEdiStatusNotify";
var url = settings.centerOrderUrl() + "action/ediApi/springBoard";
var rtn = await this.restPostUrl(pobj, url);
if(rtn.status) {
if (rtn.status) {
return rtn;
}
// 只有上传材料才在这里推送,produceNoticeAliEsp不做关于材料上传的推送
......@@ -1364,7 +1368,7 @@ class UtilsNeedService2 extends AppServiceBase {
// 待定
// solutionBizId
// note
if(actionBody.operateType == "INVALID") {
if (actionBody.operateType == "INVALID") {
var url = settings.centerOrderUrl() + "action/ediApi/springBoard";
var rtn = await this.restPostUrl(pobj, url);
}
......@@ -1378,7 +1382,7 @@ class UtilsNeedService2 extends AppServiceBase {
* @param {*} 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)
}
if (!actionBody.intentionBizId) {
......@@ -1410,17 +1414,18 @@ class UtilsNeedService2 extends AppServiceBase {
if (pobj.actionBody.description && pobj.actionBody.description.indexOf("备#") < 0) {
pobj.actionBody.level = "A";
} else {
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);
if (levelresult.status == 0) {
pobj.actionBody.level = levelresult.data.level;
pobj.actionBody.probability = levelresult.data.per;
} else {
pobj.actionBody.level = "C"
}
// 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);
// if (levelresult.status == 0) {
// pobj.actionBody.level = levelresult.data.level;
// pobj.actionBody.probability = levelresult.data.per;
// } else {
// pobj.actionBody.level = "C"
// }
pobj.actionBody.level = "C"
}
if(pobj.actionBody.phone=="17319425791"){
if (pobj.actionBody.phone == "17319425791") {
pobj.actionBody.level = "F";
}
......@@ -1450,7 +1455,7 @@ class UtilsNeedService2 extends AppServiceBase {
async icpNotifyNew(pobj) {
var actionBody = pobj.actionBody;
var self = this;
if(actionBody.isDirectBuy && actionBody.isDirectBuy==1){
if (actionBody.isDirectBuy && actionBody.isDirectBuy == 1) {
actionBody.bizId = actionBody.orderNo
}
if (!actionBody.bizId) {
......
......@@ -1318,12 +1318,12 @@ class UtilsOrderService extends AppServiceBase {
if (!actionBody.quantity || Number(actionBody.quantity) <= 0) {
return system.getResult(null, "订单数量为空或有误,100030");
}
if (!actionBody.goodsId) {
return system.getResult(null, "官网产品id不能为空")
}
if (!actionBody.customerId) {
return system.getResult(null, '客户Id不能为空')
}
// if (!actionBody.goodsId) {
// return system.getResult(null, "官网产品id不能为空")
// }
// if (!actionBody.customerId) {
// return system.getResult(null, '客户Id不能为空')
// }
if (actionBody.deliveryData.nclones.length <= 0) {
return system.getResult(null, '尼斯不能为空')
}
......@@ -1334,13 +1334,15 @@ class UtilsOrderService extends AppServiceBase {
let product_item = [];//产品项
for (let i = 0; i < nclones.length; i++) {
let nclone = nclones[i];
let totalSum = 300;
if (nclone.nclThree.length > 10) {
actionBody.additions = {
"payCode": "zzsbzc-2", // Y 支付价格code
"quantity": nclone.nclThree.length - 10// Y 购买数量
}
totalSum += (nclone.nclThree.length-10)*30
}
actionBody.totalSum = 0;
actionBody.totalSum = totalSum;
actionBody.quantity = 1;
actionBody.deliveryData.nclones = [nclone]
actionBody.payTotalSum = actionBody.totalSum;
......
......@@ -29,6 +29,28 @@ class UtilsPushService extends AppServiceBase {
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中做配置进行调用
pobj.actionType = "getAppInterface";
......@@ -165,6 +187,8 @@ class UtilsPushService extends AppServiceBase {
var reqUrl = settings.centerAppUrl() + "action/opProduct/springBoard";
var productItemInterfaceResult = await this.restPostUrl(pobj, reqUrl);
pobj.interface_info = productItemInterfaceResult.data;
console.log(pobj,"baiduBusiness2Delivery-zhuangbing------------------------------"+opType);
console.log(productItemInterfaceResult);
//日志记录
this.logCtl.info({
appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "",
......
......@@ -89,13 +89,14 @@ class utils360Sve extends AppServiceBase {
"timeUnit":pobj.actionBody.timeUnit,
"quantity":pobj.actionBody.quantity,
"companyInfo":{
"companyName":pobj.actionBody.companyInfo.companyName,
"taxpayerType":pobj.actionBody.companyInfo.taxpayerType,
"corpName":pobj.actionBody.companyInfo.corpName,
"taxpayerTypeEnum":pobj.actionBody.companyInfo.taxpayerTypeEnum,
"acctgSystemId":pobj.actionBody.companyInfo.acctgSystemId,
"companyForm":pobj.actionBody.companyInfo.companyForm,
"industry":pobj.actionBody.companyInfo.industry,
"taxpayerNumber":pobj.actionBody.companyInfo.taxpayerNumber,
"companyArea":pobj.actionBody.companyInfo.companyArea
"enterpriseFormEnum":pobj.actionBody.companyInfo.enterpriseFormEnum,
"taxIndustryId":pobj.actionBody.companyInfo.taxIndustryId,
"taxNo":pobj.actionBody.companyInfo.taxNo,
"serviceTypeEnum":pobj.actionBody.companyInfo.serviceTypeEnum,
"taxClaimMethodEnum":pobj.actionBody.companyInfo.taxClaimMethodEnum
}
},
appInfo: pobj.appInfo
......
const crypto = require('crypto');
const sha256 = require('sha256');
const system = require("../system");
var settings = require("../../config/settings");
class baiduClient {
constructor() {
this.pushlogSve = system.getObject("service.common.pushlogSve");
this.execClient = system.getObject("util.execClient");
this.baiduClientParams = settings.baiduClientParams();
}
//2020 1027 laolan 调用百度网关
async baiduPost( path, actionBody) {
console.log('actionBody++',actionBody)
// let domain = "https://gwgp-mwnn9gk4o4e.i.bdcloudapi.com";//开发
let domain = "https://gwgp-nbzljnwusrw.i.bdcloudapi.com";//线上
let domain = this.baiduClientParams.domain;
let url = domain+path;
let version ="bce-auth-v1";
// let accessKey = "ed0f5c4c7c2d4e87aa335d9b07bf9bd4";
// let secretKey = "f600c4e91f6d43998d637401e6e34ef9";
let accessKey = "0e5abf33ef07457f8dbd779287747c0c";
let secretKey = "9d86f04a85db4cdfa95ba8ad28009188";
let accessKey = this.baiduClientParams.accessKey;
let secretKey = this.baiduClientParams.secretKey;
let timestamp = new Date().toISOString()
let site = timestamp.lastIndexOf(".");
timestamp = timestamp.substring(0,site)+"Z"
let signedHeaders = "host";
let extime = 1800;
let canonicalHeaders = "host:gwgp-nbzljnwusrw.i.bdcloudapi.com"
let canonicalHeaders = "host:"+this.baiduClientParams.host;
//中间结果1:规范化请求和前缀字符串
let canonicalRequest = "POST" + "\n" + path + "\n" + "\n" + canonicalHeaders;
//authStringPrefix(前缀字符串,由除sk字段外的签名信息生成)
......@@ -64,7 +63,7 @@ class baiduClient {
formatParams: true, // default true, format the parameter name to first letter upper case
method: 'POST', // set the http method, default is GET
headers: {
host:"gwgp-nbzljnwusrw.i.bdcloudapi.com"
host:this.baiduClientParams.host
}, // set the http request headers
});
console.log('baidu++++res+++',res)
......@@ -94,3 +93,5 @@ class 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');
const exec = util.promisify(require('child_process').exec);
const uuidv4 = require('uuid/v4');
var settings = require("../../config/settings");
const axios = require('axios');
class ExecClient {
constructor() {
this.cmdPostPattern = "curl --user admines:adminGSBes. -k -H 'Content-type: application/json' -d '{data}' {url}";
......@@ -23,7 +24,10 @@ class ExecClient {
async exec(cmd) {
//await后面表达式返回的promise对象, 是then的语法糖,await返回then函数的返回值
//异常需要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 };
}
......@@ -62,6 +66,13 @@ class ExecClient {
return cmd;
}
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);
var result = await this.exec(cmd);
return result;
......@@ -77,6 +88,15 @@ class ExecClient {
return result;
}
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);
var options = {
maxBuffer: 1024 * 1024 * 20
......@@ -127,6 +147,21 @@ class ExecClient {
async exec360GetToken(url){
const qs = require('qs')
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);
console.log(cmd);
var result = await this.exec(cmd);
......
......@@ -20,6 +20,7 @@ module.exports = {
"putUserPwdByMobile", "icpNotifyNew"
],
apiMustUserpinList: [
"icpOrderClose",
"submitNeed", "paySuccess", "icpNotify", "getLoginInfo", "icpNotifyNew", "submitIcpProgramme","serviceProviderSubmitMaterial","abolishIcpProgramme",
"submitService","serviceProviderNotification",
"ncGetNeedList","ncSubmitMaterial","ncNotification","ncSubmitSolution","ncWriteCommunicationRecord","ncGetCommunicationRecord","ncCloseNeed","ncClosePlan","ncCloseOrderDelivery",
......
......@@ -30,6 +30,22 @@ var settings = {
}
return "http://43.247.184.94:7200/center_channel_req_log/_doc?pretty";
},
baiduClientParams: function () {
if (this.env == 'dev') {
return {
domain:"https://gwgp-mwnn9gk4o4e.i.bdcloudapi.com",//开发
accessKey:"ed0f5c4c7c2d4e87aa335d9b07bf9bd4",
secretKey:"f600c4e91f6d43998d637401e6e34ef9",
host:"gwgp-mwnn9gk4o4e.i.bdcloudapi.com"
};
}
return {
domain:"https://gwgp-nbzljnwusrw.i.bdcloudapi.com",//线上
accessKey:"0e5abf33ef07457f8dbd779287747c0c",
secretKey:"9d86f04a85db4cdfa95ba8ad28009188",
host:"gwgp-nbzljnwusrw.i.bdcloudapi.com"
};
},
fbQueryUrl: function () {
if (this.env == 'dev' || this.env == 'test') {
return 'http://43.247.184.92:15505'
......@@ -39,7 +55,9 @@ var settings = {
},
opPushQueueUrl: function () {
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 {
return "http://sytxpublic-msgq-service/api/queueAction/producer/springBoard";
}
......@@ -121,7 +139,7 @@ var settings = {
if (this.env == "dev") {
return "http://centerTmtransactioon.apps.com:4006/";
} else {
return "http://center-app-service/";
return "http://center-tmtransaction-service/";
}
},
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