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;
}
......
......@@ -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