Commit 8be567a5 by linboxuan

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

parents 53883a73 52885c31
node_modules/
.idea
.history/
\ No newline at end of file
.history/
.vscode
\ No newline at end of file
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="JavaScriptSettings">
<option name="languageLevel" value="ES6" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/zhichan.iml" filepath="$PROJECT_DIR$/.idea/zhichan.iml" />
</modules>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.tmp" />
<excludeFolder url="file://$MODULE_DIR$/temp" />
<excludeFolder url="file://$MODULE_DIR$/tmp" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
\ No newline at end of file
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"program": "${workspaceFolder}/bigdata/main.js"
}
]
}
\ No newline at end of file
node_modules/
.idea
.history/
.vscode
\ No newline at end of file
......@@ -53,7 +53,7 @@ class APIBase {
await this.redisClient.setWithEx(shaStr, JSON.stringify(result), 3600);
}
var tmpResult = pobj.actionType && pobj.actionType.indexOf("List") < 0 ? result : { status: result.status, message: result.message, requestId: result.requestId };
this.execClientNew.execLogs("center-channel-doexecMethod-reqPath:" + req.path, pobj, "center-channel-doexecMethod", tmpResult, null);
this.execClientNew.execLogs("api-center-channel-doexecMethod-reqPath:" + req.path, pobj, "center-channel-doexecMethod", tmpResult, null);
return result;
} catch (e) {
const stackStr = e.stack ? e.stack : JSON.stringify(e);
......
......@@ -36,8 +36,11 @@ class IcbcToolsAPI extends WEBBase {
case "getCompanyIcpByName"://工商icp证照查询
opResult = await this.icbcSve.getCompanyIcpByName(action_body, req);
break;
case "searchCertification"://企业证书查询
opResult = await this.icbcSve.searchCertification(action_body,req);
// case "searchCertification"://企业证书查询
// opResult = await this.icbcSve.searchCertification(action_body,req);
// break;
case "searchCertification"://企业证书查询(综合)
opResult = await this.icbcSve.getLicenseList(action_body,req);
break;
default:
opResult = system.getResult(null, "action_type参数错误");
......
......@@ -5,6 +5,7 @@ const logCtl = system.getObject("service.common.oplogSve");
class opLog extends WEBBase {
constructor() {
super();
this.pushlogSve = system.getObject("service.common.pushlogSve");
}
async info(pobj, qobj, req) {
this.logCtl.info(pobj);
......@@ -12,5 +13,29 @@ class opLog extends WEBBase {
async error(pobj, qobj, req) {
this.logCtl.error(pobj);
}
/**
* 获取推送失败日志列表
* @param pobj
* @param qobj
* @param req
* @returns {Promise<void>}
*/
async getPushFailLogList(pobj,qobj,req){
let list = await this.pushlogSve.getPushFailLogList(pobj.actionBody);
return list;
}
/**
* 重新推送
* @param pobj
* @param qobj
* @param req
* @returns {Promise<void>}
*/
async rePush(pobj,qobj,req){
let result = await this.pushlogSve.rePush(pobj.actionBody);
return result;
}
}
module.exports = opLog;
\ No newline at end of file
......@@ -60,6 +60,9 @@ class OpNeed extends APIBase {
case "getStatisticsByProduct":
opResult = await this.utilsOpNeedSve.getStatisticsByProduct(pobj);
break;
case "getNeedProductType":
opResult = await this.utilsOpNeedSve.getNeedProductType(pobj);
break;
case "getStatisticsByArea":
opResult = await this.utilsOpNeedSve.getStatisticsByArea(pobj);
break;
......
......@@ -55,7 +55,11 @@ class QcAPI extends APIBase {
case "closeOrderDelivery"://交付商关闭交付单
opResult = await this.qcCenterOrderSve.closeOrderDelivery(pobj);
break;
// 2021-3-23 laolan 易名退款
case "eNameCloseOrder":
opResult = await this.baseOrderSve.eNameCloseOrder(pobj);
break;
// --------- 网文 ---------
case "ncSubmitMaterial"://交付材料提交(网文)2020-11-11
......
......@@ -92,7 +92,6 @@ class TradetransferAPI extends WEBBase {
//阿里网关
async aliclienttransfer(p, obj) {
console.log("----------------sssssssssssssssssss-------------------------------------------")
console.log(p.actionBody)
if (p.actionBody) {
console.log(p.actionBody)
......
......@@ -11,6 +11,7 @@ class AccessAuthAPI extends APIBase {
this.utilsTmAliyunSve = system.getObject("service.utilsSve.utilsTmAliyunSve");
this.utilsTmOrderCallService = system.getObject("service.utilsSve.utilsTmOrderCallSve");
this.utilsNeedSve = system.getObject("service.utilsSve.utilsNeedSve");
this.utilsOpOrderSve = system.getObject("service.utilsSve.utilsOpOrderSve");
}
async QueryTradeIntentionUserList(pobj, qobj, req) {
pobj.appInfo={uapp_id:18}
......@@ -27,7 +28,7 @@ class AccessAuthAPI extends APIBase {
return rtn;
}
async taskAgainFqPushInfo(pobj, qobj, req) {//再次推送蜂擎业务数据
var rtn = await this.utilsPushSve.aliBusiness2Fq(pobj, pobj.opType);
var rtn = await this.utilsPushSve.business2Channel(pobj, pobj.opType);
this.pushlogSve.delDbPushfaillogById(Number(pobj.id || 0));
return rtn;
}
......@@ -116,5 +117,29 @@ class AccessAuthAPI extends APIBase {
return system.getResultSuccess();
}
/**
* 需求商机同步任务
* @param pobj
* @param qobj
* @param req
* @returns {Promise<{msg: *, data, bizmsg: (*|string), status: number}>}
*/
async taskSyncNeedBusiness(pobj,qobj,req){
let result = await this.utilsNeedSve.syncNeedBusiness();
return result;
}
/**
* 订单商机同步任务
* @param pobj
* @param qobj
* @param req
* @returns {Promise<{msg: *, data, bizmsg: (*|string), status: number}>}
*/
async taskSyncOrderBusiness(pobj,qobj,req){
let result = await this.utilsOpOrderSve.syncOrderBusiness();
return result;
}
}
module.exports = AccessAuthAPI;
\ No newline at end of file
var WEBBase = require("../../web.base");
var system = require("../../../system");
var settings = require("../../../../config/settings");
class ProductAPI extends WEBBase {
constructor() {
super();
this.utilsOrderSve = system.getObject("service.utilsSve.utilsOrderSve");
this.utilsProductSve = system.getObject("service.utilsSve.utilsProductSve");
}
/**
* 接口跳转-POST请求
* action_process 执行的流程
* action_type 执行的类型
* action_body 执行的参数
*/
* 接口跳转-POST请求
* action_process 执行的流程
* action_type 执行的类型
* action_body 执行的参数
*/
async springBoard(pobj, qobj, req) {
if (!pobj.actionProcess) {
return system.getResult(null, "actionProcess参数不能为空");
......@@ -22,19 +25,26 @@ class ProductAPI extends WEBBase {
var result = await this.opActionProcess(pobj, pobj.actionType, req);
return result;
}
async opActionProcess(pobj, action_type, req) {
pobj.requestId = req.requestId;
var opResult = null;
switch (action_type) {
case "addOrder"://创建订单
opResult = await this.utilsOrderSve.addOrder(pobj, pobj.actionBody);
//处理推送到峰擎
// opType:值为query、add
this.pushNewFq(pobj, opResult);
break;
case "addOrderWeb"://创建订单 官网
opResult = await this.utilsOrderSve.addOrderWeb(pobj,pobj.actionBody);
opResult = await this.utilsOrderSve.addOrderWeb(pobj, pobj.actionBody);
break;
case "getOrderInfo"://获取订单列表信息
opResult = await this.utilsOrderSve.getOrderInfo(pobj, pobj.actionBody);
break;
case "getPathName":
opResult = await this.utilsProductSve.getAllPathName(pobj);
break;
case "getOrderStatisticsByUappId":
opResult = await this.utilsOrderSve.getOrdersStatisticsByUappId(pobj);
break;
......@@ -69,19 +79,31 @@ class ProductAPI extends WEBBase {
// opResult = await this.utilsOrderSve.addOrder(pobj, pobj.actionBody);
// break;
case "addUsuallyContacts"://添加常用联系人、申请人
opResult = await this.utilsOrderSve.addUsuallyContacts(pobj,pobj.actionBody);
opResult = await this.utilsOrderSve.addUsuallyContacts(pobj, pobj.actionBody);
break;
case "delUsuallyContacts"://删除常用联系人、申请人
opResult = await this.utilsOrderSve.delUsuallyContacts(pobj,pobj.actionBody);
opResult = await this.utilsOrderSve.delUsuallyContacts(pobj, pobj.actionBody);
break;
case "updateUsuallyContacts"://修改常用联系人、申请人
opResult = await this.utilsOrderSve.updateUsuallyContacts(pobj,pobj.actionBody);
opResult = await this.utilsOrderSve.updateUsuallyContacts(pobj, pobj.actionBody);
break;
case "getUsuallyContacts"://查询常用联系人、申请人
opResult = await this.utilsOrderSve.getUsuallyContacts(pobj,pobj.actionBody);
opResult = await this.utilsOrderSve.getUsuallyContacts(pobj, pobj.actionBody);
break;
case "importOrders":
opResult = await this.utilsOrderSve.importOrders(pobj, req);
break;
case "pushTest":
opResult = await this.utilsOrderSve.pushTest(pobj,pobj.actionBody);
opResult = await this.utilsOrderSve.pushTest(pobj, pobj.actionBody);
break;
case "receiveAliTmOrder"://接收阿里商标订单
opResult = await this.utilsOrderSve.receiveAliTmOrder(pobj, pobj.actionBody);
break;
case "receiveAliTmStatus"://接收阿里商标状态
opResult = await this.utilsOrderSve.receiveAliTmStatus(pobj, pobj.actionBody);
break;
case "receiveAliTmOrderRefund"://接收阿里商标订单退款信息
opResult = await this.utilsOrderSve.receiveAliTmOrderRefund(pobj, pobj.actionBody);
break;
default:
opResult = system.getResult(null, "action_type参数错误");
......@@ -90,5 +112,19 @@ class ProductAPI extends WEBBase {
return opResult;
}
async pushNewFq(pobj, result) {
this.execClientNew.execLogs("pushNewFq-1", pobj, "center-channel-order-pushNewFq", result, null);
if (result.status == 0 && result.data && result.data.channelOrderNo) {
try {
pobj.actionType = "getOrderInfoByChannelOrderNo";
pobj.actionBody.channelOrderNo = result.data.channelOrderNo;
await this.utilsOrderSve.pushNewFqByChannelOrderNo(pobj);
} catch (e) {
const stackStr = e.stack ? e.stack : JSON.stringify(e);
this.execClientNew.execLogs("pushNewFq异常:", pobj, "center-channel-pushNewFq", null, stackStr);
}
}
}
}
module.exports = ProductAPI;
......@@ -50,9 +50,6 @@ class Need extends APIBase {
opResult = await this.utilsNeedSve.getItemByChannelNeedNo(pobj,pobj.actionBody);
break;
case "getSolutionByChannelSolutionNo":
opResult = await this.utilsNeedSve.getItemByChannelNeedNo(pobj, pobj.actionBody);
break
case "getSolutionByChannelSolutionNo":
opResult = await this.utilsNeedSve.getSolutionByChannelSolutionNo(pobj, pobj.actionBody);
break;
case "getItemByNeedNo":
......@@ -124,6 +121,22 @@ class Need extends APIBase {
// break;
break;
//-----------接入百度ICP------end----------------------------------
case "importNeeds":
opResult = await this.utilsNeedSve.importNeeds(pobj,req);
break;
case "getymicpProduce"://获取易名的icp产品信息
opResult = await this.centerorderSve.getymicpProduce(pobj);
break;
//百度商标接入
case "submitTmNeed"://提交需求
opResult = await this.utilsNeedSve.submitTmNeed(pobj, pobj.actionBody);
break;
case "tmFeedbackSubmit"://商标用户反馈
opResult = await this.utilsNeedSve.tmFeedbackSubmit(pobj);
break;
case "tmStatusNotify"://商标状态通知
opResult = await this.utilsNeedSve.tmStatusNotify(pobj);
break;
default:
opResult = system.getResult(null, "action_type参数错误");
break;
......
......@@ -55,4 +55,4 @@ class PaymentAPI extends WEBBase {
return opResult;
}
}
module.exports = PaymentAPI;
\ No newline at end of file
module.exports = PaymentAPI;
var APIBase = require("../../api.base");
var system = require("../../../system");
var settings = require("../../../../config/settings");
const uuidv4 = require('uuid/v4');
/**
* 商标需求
* 庄冰 2021.03.17
*/
class Consultation extends APIBase {
constructor() {
super();
this.gatewaypushlogSve = system.getObject("service.common.gatewaypushlogSve");
}
getUUID() {
var uuid = uuidv4();
var u = uuid.replace(/\-/g, "");
return u;
}
getResultSuccess(requestId) {
return {
"status": 0,
"msg": "success",
"data":null,
"requestId": requestId
};
}
getResultFail(errmsg) {
var self = this;
return {
"status":-1,
"msg": errmsg,
"requestId": self.getUUID(),
"data":null,
"bizmsg":"empty"
};
}
//需求提交
async submit(pobj,obj,req) {
var self = this;
if(!pobj.appInfo || !pobj.appInfo.uapp_key || !pobj.appInfo.uapp_secret){
return self.getResultFail("未知应用或应用未启用");
}
if (!pobj.intentionBizId) {
return self.getResultFail("intentionBizId不能为空");
}
if (!pobj.phone) {
return self.getResultFail("phone不能为空");
}
if (!pobj.consultType) {
return self.getResultFail("consultType不能为空");
}
pobj.type = pobj.consultType;
pobj.mobile = pobj.phone;
pobj.action_type = "submitTmNeed";
var param = {
requestId: req.requestId || self.getUUID(),
requestUrl: pobj.appInfo.app_code+"/tm/consultation/submit",
requestjson: JSON.stringify(pobj),//请求地址
pushUrl: "/action/intentionapi/springBoard",//调用地址
pushActionType: "submitTmNeed",//调用参数
pushtimes: 0,//推送次数
pushStatus: "wts",//推送状态
}
await self.gatewaypushlogSve.create(param);
return self.getResultSuccess(param.requestId);
}
/**
* 需求关闭CloseTradeMarkProduct
* @param {*} pobj
* @param {*} obj
* @param {*} req
*/
async close(pobj,obj,req){
if (!pobj.IntentionBizId) {
return self.getResultFail("IntentionBizId不能为空");
}
var reqUrl = settings.centerOrderUrl() + "action/opNeed/springBoard";
var reqObj={
actionType:"opNeedClose",
actionBody:{needNo:pobj.IntentionBizId},
appInfo:pobj.appInfo
}
var result = await this.utilsNeedSve.restPostUrl(reqObj,reqUrl);
return result;
}
}
module.exports = Consultation;
\ No newline at end of file
var APIBase = require("../../api.base");
var system = require("../../../system");
var settings = require("../../../../config/settings");
const uuidv4 = require('uuid/v4');
/**
* 商标通知接口
* 庄冰 2021.03.17
*/
class Feedback extends APIBase {
constructor() {
super();
this.gatewaypushlogSve = system.getObject("service.common.gatewaypushlogSve");
}
getUUID() {
var uuid = uuidv4();
var u = uuid.replace(/\-/g, "");
return u;
}
getResultSuccess(requestId) {
return {
"status": 0,
"msg": "success",
"data":null,
"requestId": requestId
};
}
getResultFail(errmsg) {
var self = this;
return {
"status":-1,
"msg": errmsg,
"requestId": self.getUUID(),
"data":null,
"bizmsg":"empty"
};
}
//需求反馈
async submit(pobj,obj,req) {
var self = this;
if(!pobj.appInfo || !pobj.appInfo.uapp_key || !pobj.appInfo.uapp_secret){
return self.getResultFail("未知应用或应用未启用");
}
if (!pobj.intentionBizId) {
return self.getResultFail("intentionBizId不能为空");
}
if (!pobj.description) {
return self.getResultFail("description不能为空");
}
pobj.action_type = "tmFeedbackSubmit";
var param = {
requestId: req.requestId || self.getUUID(),
requestUrl: pobj.appInfo.app_code+"/tm/feedback/submit",
requestjson: JSON.stringify(pobj),//请求地址
pushUrl: "/action/intentionapi/springBoard",//调用地址
pushActionType: "tmFeedbackSubmit",//调用参数
pushtimes: 0,//推送次数
pushStatus: "wts",//推送状态
}
await self.gatewaypushlogSve.create(param);
return self.getResultSuccess(param.requestId);
}
}
module.exports = Feedback;
\ No newline at end of file
var APIBase = require("../../api.base");
var system = require("../../../system");
var settings = require("../../../../config/settings");
const uuidv4 = require('uuid/v4');
/**
* tm通知接口
* 庄冰 2021.03.18
*/
class Order extends APIBase {
constructor() {
super();
this.gatewaypushlogSve = system.getObject("service.common.gatewaypushlogSve");
}
getUUID() {
var uuid = uuidv4();
var u = uuid.replace(/\-/g, "");
return u;
}
getResultSuccess(requestId) {
return {
"status": 0,
"msg": "success",
"data":null,
"requestId": requestId
};
}
getResultFail(errmsg) {
var self = this;
return {
"status":-1,
"msg": errmsg,
"requestId": self.getUUID(),
"data":null,
"bizmsg":"empty"
};
}
//状态变更
async notify(pobj,obj,req) {
var self = this;
if(!pobj.appInfo || !pobj.appInfo.uapp_key || !pobj.appInfo.uapp_secret){
return self.getResultFail("未知应用或应用未启用");
}
if (!pobj.bizId) {
return self.getResultFail("bizId不能为空");
}
if (!pobj.status) {
return self.getResultFail("status不能为空");
}
pobj.action_type = "tmStatusNotify";
var param = {
requestId: req.requestId || self.getUUID(),
requestUrl: pobj.appInfo.app_code+"/tm/status/notify",
requestjson: JSON.stringify(pobj),//请求地址
pushUrl: "/action/intentionapi/springBoard",//调用地址
pushActionType: "tmStatusNotify",//调用参数
pushtimes: 0,//推送次数
pushStatus: "wts",//推送状态
}
await self.gatewaypushlogSve.create(param);
return self.getResultSuccess(param.requestId);
}
}
module.exports = Order;
\ No newline at end of file
var APIBase = require("../../api.base");
var system = require("../../../system");
var settings = require("../../../../config/settings");
const uuidv4 = require('uuid/v4');
/**
* 商标方案信息(接收fqboss推送的商标方案信息,并推送至渠道)
* 庄冰 2021.03.18
*/
class Tmcase extends APIBase {
constructor() {
super();
this.utilsNeedSve = system.getObject("service.utilsSve.utilsNeedSve");
this.baseUrl = settings.centerOrderUrl()+"notifyaction/opNeedSolution/"
}
async updateTmStatus(pobj, qobj, req) {
var reqUrl = this.baseUrl + "updateTmStatus";
var result = await this.utilsNeedSve.restPostUrl(pobj,reqUrl);
return result;
}
//接收辅助、担保商标注册信息
async nbtzreceiveAssistTmData(pobj, qobj, req) {
var reqUrl = this.baseUrl + "nbtzreceiveAssistTmData";
var result = await this.utilsNeedSve.restPostUrl(pobj,reqUrl);
if(result && result.status==0){
await this.pushData2Platform()
}
return result;
}
//接收辅助、担保商标注册修改信息
async nbtzreceiveEditAssistTmData(pobj, qobj, req) {
var reqUrl = this.baseUrl + "nbtzreceiveEditAssistTmData";
var result = await this.utilsNeedSve.restPostUrl(pobj,reqUrl);
return result;
}
//提交方案确认
async submitTmConfirm(pobj, qobj, req) {
if (!pobj.IntentionBizId) {
return self.getResultFail("IntentionBizId不能为空");
}
var reqUrl = this.baseUrl + "nbtzreceiveEditAssistTmData";
var result = await this.utilsNeedSve.restPostUrl(pobj,reqUrl);
return result;
}
/**
* 关闭注册⽅案
* @param {*} pobj
* @param {*} obj
* @param {*} req
*/
async closeSolution(pobj,obj,req){
if (!pobj.BizId) {
return self.getResultFail("BizId不能为空");
}
if (!pobj.IntentionBizId) {
return self.getResultFail("IntentionBizId不能为空");
}
var reqUrl = this.baseUrl + "closeSolution";
var result = await this.utilsNeedSve.restPostUrl(pobj,reqUrl);
return result;
}
/**
* 推送数据至平台方(百度、阿里)
* needSolution 需求方案
* appInfo app
* opflag 操作标志:QueryTradeIntentionUserList:查询需求列表,SaveTradeMarkProductSolution:提交注册⽅案-商标信息
* SaveTradeMarkMaterialDetail:补全注册⽅案-申请⼈信息 ConfirmTradeIntention:确认注册⽅案
*
*/
async pushData2Platform(needSolution,appInfo,opflag){
if(appInfo.uapp_id==18){//阿里云商机
}
if(appInfo.uapp_id==44){//百度云商机
}
}
}
module.exports = Tmcase;
\ No newline at end of file
......@@ -38,7 +38,7 @@ class WEBBase {
opTitle: "api服务提供方appKey:" + settings.appKey,
});
var tmpResult = pobj.actionType && pobj.actionType.indexOf("List") < 0 ? result : { status: result.status, message: result.message, requestId: result.requestId };
this.execClientNew.execLogs("reqPath:" + req.path, pobj, "center-channel-doexecMethod-web", tmpResult, null);
this.execClientNew.execLogs("web-center-channel--reqPath:" + req.path, pobj, "center-channel-doexecMethod-web", tmpResult, null);
return result;
} catch (e) {
console.log(e.stack, "api调用出现异常,请联系管理员..........")
......@@ -53,16 +53,16 @@ class WEBBase {
agent: req.uagent,
opTitle: "api调用出现异常,请联系管理员error,appKey:" + settings.appKey,
});
this.logCtl.error({
appid: req.app.id,
appkey: req.app.uappKey,
requestId: req.requestId,
op: req.classname + "/" + methodname,
content: e.stack,
clientIp: pobj.clientIp,
agent: req.uagent,
optitle: "api调用出现异常,请联系管理员",
});
// this.logCtl.error({
// appid: req.app.id,
// appkey: req.app.uappKey,
// requestId: req.requestId,
// op: req.classname + "/" + methodname,
// content: e.stack,
// clientIp: pobj.clientIp,
// agent: req.uagent,
// optitle: "api调用出现异常,请联系管理员",
// });
var rtnerror = system.getResultFail(-200, "出现异常,error:" + e.stack);
rtnerror.requestId = req.requestId;
return rtnerror;
......
......@@ -10,6 +10,7 @@ module.exports = (db, DataTypes) => {
pushActionType: DataTypes.STRING,//调用参数
pushtimes:DataTypes.INTEGER,//推送次数
pushStatus:DataTypes.STRING,//推送状态
error:DataTypes.STRING(5000),//错误信息
}, {
paranoid: false,//假的删除
underscored: true,
......
......@@ -6,511 +6,482 @@ const uuidv4 = require('uuid/v4');
const cryptoJS = require('crypto-js');
class AppServiceBase {
constructor() {
this.restClient = system.getObject("util.restClient");
this.execClientNew = system.getObject("util.execClientNew");
this.execClient = system.getObject('util.execClient');
this.cacheManager = system.getObject("db.common.cacheManager");
this.pushlogSve = system.getObject("service.common.pushlogSve");
this.pushlogFailType = { OLDRPC: 1, NEWRPC: 2, FAILLOG: 3, FQ: 4 };
this.logCtl = system.getObject("service.common.oplogSve");
}
/**
* 验证签名
* @param {*} params 要验证的参数
* @param {*} app_key 应用的校验key
*/
async verifySign(params, app_key) {
if (!params) {
return system.getResult(null, "请求参数为空");
constructor() {
this.dingClient = system.getObject("util.dingClient");
this.restClient = system.getObject("util.restClient");
this.execClientNew = system.getObject("util.execClientNew");
this.execClient = system.getObject('util.execClient');
this.cacheManager = system.getObject("db.common.cacheManager");
this.pushlogSve = system.getObject("service.common.pushlogSve");
this.pushlogFailType = {OLDRPC: 1, NEWRPC: 2, FAILLOG: 3, FQ: 4};
this.logCtl = system.getObject("service.common.oplogSve");
}
if (!params.sign) {
return system.getResult(null, "请求参数sign为空");
}
var signArr = [];
var keys = Object.keys(params).sort();
if (keys.length == 0) {
return system.getResult(null, "请求参数信息为空");
}
for (let k = 0; k < keys.length; k++) {
const tKey = keys[k];
if (tKey != "sign" && params[tKey] && !(typeof (params[tKey]) === "object")) {
signArr.push(tKey + "=" + params[tKey]);
}
}
if (signArr.length == 0) {
return system.getResult(null, "请求参数组装签名参数信息为空");
}
var resultSignStr = signArr.join("&") + "&key=" + app_key;
var resultTmpSign = md5(resultSignStr).toUpperCase();
if (params.sign != resultTmpSign) {
return system.getResult(null, "返回值签名验证失败");
}
return system.getResultSuccess();
}
async restPostUrl(pobj, url) {
try {
var rtn = await this.restClient.execPost(pobj, url);
if (!rtn || !rtn.stdout) {
return system.getResult(null, "restPost data is empty");
}
var result = JSON.parse(rtn.stdout);
return result;
} catch (e) {
var errorMsg = "error:" + e.stack;
//日志记录
this.logCtl.error({
appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "",
appkey: pobj.appInfo ? pobj.appInfo.uapp_key || "" : "",
requestId: pobj.requestId || "",
op: "service/app.base.js/restPostUrl",
content: errorMsg,
// clientIp: pobj.clientIp,
optitle: pobj.opType + "推送操作异常->restPostUrl",
});
return system.getResult(null, errorMsg);
}
}
async restPostWithHValueUrl(pobj, url, hValue) {//curl请求带请求头信息
try {
if (!hValue) {
hValue = "YLc6GsgLtuRGaVA5Om848x18NxLtHlyA";
}
var rtn = await this.restClient.execPostWithHValue(pobj, url, hValue);
if (!rtn || !rtn.stdout) {
return system.getResult(null, "execPostWithHValue data is empty");
}
var result = JSON.parse(rtn.stdout);
return result;
} catch (e) {
var errorMsg = "error:" + e.stack;
//日志记录
this.logCtl.error({
appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "",
appkey: pobj.appInfo ? pobj.appInfo.uapp_key || "" : "",
requestId: pobj.requestId || "",
op: "service/app.base.js/restPostWithHValueUrl",
content: errorMsg,
// clientIp: pobj.clientIp,
optitle: pobj.opType + "推送操作异常->restPostWithHValueUrl",
});
return system.getResult(null, errorMsg);
}
}
async restPostWithHAuthorizationUrl(pobj, userToken, url) {//curl请求带请求头信息
try {
var rtn = await this.restClient.restPostWithHAuthorizationUrl(userToken, url);
if (!rtn || !rtn.stdout) {
return system.getResult(null, "restPostWithHAuthorizationUrl data is empty");
}
var result = JSON.parse(rtn.stdout);
return result;
} catch (e) {
var errorMsg = "error:" + e.stack;
//日志记录
this.logCtl.error({
appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "",
appkey: pobj.appInfo ? pobj.appInfo.uapp_key || "" : "",
requestId: pobj.requestId || "",
op: "service/app.base.js/restPostWithHAuthorizationUrl",
content: errorMsg,
// clientIp: pobj.clientIp,
optitle: pobj.opType + "推送操作异常->restPostWithHAuthorizationUrl",
});
return system.getResult(null, errorMsg);
/**
* 验证签名
* @param {*} params 要验证的参数
* @param {*} app_key 应用的校验key
*/
async verifySign(params, app_key) {
if (!params) {
return system.getResult(null, "请求参数为空");
}
if (!params.sign) {
return system.getResult(null, "请求参数sign为空");
}
var signArr = [];
var keys = Object.keys(params).sort();
if (keys.length == 0) {
return system.getResult(null, "请求参数信息为空");
}
for (let k = 0; k < keys.length; k++) {
const tKey = keys[k];
if (tKey != "sign" && params[tKey] && !(typeof (params[tKey]) === "object")) {
signArr.push(tKey + "=" + params[tKey]);
}
}
if (signArr.length == 0) {
return system.getResult(null, "请求参数组装签名参数信息为空");
}
var resultSignStr = signArr.join("&") + "&key=" + app_key;
var resultTmpSign = md5(resultSignStr).toUpperCase();
if (params.sign != resultTmpSign) {
return system.getResult(null, "返回值签名验证失败");
}
return system.getResultSuccess();
}
}
async execPostUrl(pobj, url) {
try {
var rtn = await this.execClient.execPost(pobj, url);
if (!rtn || !rtn.stdout) {
return system.getResult(null, "execPost data is empty");
}
var result = JSON.parse(rtn.stdout);
return result;
} catch (e) {
var errorMsg = "error:" + e.stack;
//日志记录
this.logCtl.error({
appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "",
appkey: pobj.appInfo ? pobj.appInfo.uapp_key || "" : "",
requestId: pobj.requestId || "",
op: "service/app.base.js/execPostUrl",
content: errorMsg,
// clientIp: pobj.clientIp,
optitle: pobj.opType + "基类操作异常->execPostUrl",
});
return system.getResult(null, errorMsg);
async restPostUrl(pobj, url) {
try {
var rtn = await this.restClient.execPost(pobj, url);
if (!rtn || !rtn.stdout) {
return system.getResult(null, "restPost data is empty");
}
var result = JSON.parse(rtn.stdout);
return result;
} catch (e) {
const stackStr = e.stack ? e.stack : JSON.stringify(e);
this.execClientNew.execLogs(`推送操作异常-api-center-channel-url:${url}`, pobj, "center-channel-restPostUrl", null, stackStr);
return system.getResult(null, stackStr);
}
}
}
async opAliyunRpcVerifyParam(pobj) {//参数信息验证
var verify = system.getResultSuccess();
if (!pobj.interface_params) {
verify = system.getResult(null, "interface_params can not be empty,100440");
async restPostWithHValueUrl(pobj, url, hValue) {//curl请求带请求头信息
try {
if (!hValue) {
hValue = "YLc6GsgLtuRGaVA5Om848x18NxLtHlyA";
}
var rtn = await this.restClient.execPostWithHValue(pobj, url, hValue);
if (!rtn || !rtn.stdout) {
return system.getResult(null, "execPostWithHValue data is empty");
}
var result = JSON.parse(rtn.stdout);
return result;
} catch (e) {
const stackStr = e.stack ? e.stack : JSON.stringify(e);
this.execClientNew.execLogs(`操作异常-api-center-channel-url:${url}`, pobj, "center-channel-restPostWithHValueUrl", null, stackStr);
return system.getResult(null, stackStr);
}
}
var interface_params_info = JSON.parse(pobj.interface_params);
if (!interface_params_info || !interface_params_info.action) {
verify = system.getResult(null, "interface_params.action can not be empty,100443");
async restPostWithHAuthorizationUrl(pobj, userToken, url) {//curl请求带请求头信息
try {
var rtn = await this.restClient.restPostWithHAuthorizationUrl(userToken, url);
if (!rtn || !rtn.stdout) {
return system.getResult(null, "restPostWithHAuthorizationUrl data is empty");
}
var result = JSON.parse(rtn.stdout);
return result;
} catch (e) {
const stackStr = e.stack ? e.stack : JSON.stringify(e);
this.execClientNew.execLogs(`操作异常-api-center-channel-url:${url}`, pobj, "center-channel-restPostWithHAuthorizationUrl", null, stackStr);
return system.getResult(null, stackStr);
}
}
verify.data = interface_params_info;
return verify;
}
/**
* 阿里RPC调用
* @param {*} pobj {action: rpcParam.action,reqbody: pobj.actionBody,rpcParam: rpcParam}
* @param {*} params {为阿里的接口参数}
*/
async opAliyunRpcReq(pobj, params) {
try {
// var action = obj.action;
// var reqbody = obj.reqbody;
// var rpcParam = obj.rpcParam;
var aliyunClient = system.getObject("util.aliyunClient");
var rtn = await aliyunClient.reqCustomByGet(params);
return rtn;
} catch (e) {
var errorMsg = "error:" + e.stack;
//日志记录
this.logCtl.error({
appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "",
appkey: pobj.appInfo ? pobj.appInfo.uapp_key || "" : "",
requestId: pobj.requestId || "",
op: "service/impl/utilsSve/opAliyunClientPost.js/opAliyunRpcReq",
content: errorMsg,
// clientIp: pobj.clientIp,
optitle: pobj.opType + "推送操作异常->opAliyunRpcReq",
});
return system.getResult(null, errorMsg);
async execPostUrl(pobj, url) {
try {
var rtn = await this.execClient.execPost(pobj, url);
if (!rtn || !rtn.stdout) {
return system.getResult(null, "execPost data is empty");
}
var result = JSON.parse(rtn.stdout);
return result;
} catch (e) {
const stackStr = e.stack ? e.stack : JSON.stringify(e);
this.execClientNew.execLogs(`操作异常-api-center-channel-url:${url}`, pobj, "center-channel-restPostWithHAuthorizationUrl", null, stackStr);
return system.getResult(null, stackStr);
}
}
}
// /**
// * 阿里RPC调用-post请求
// * @param {*} pobj {action: rpcParam.action,reqbody: pobj.actionBody,rpcParam: rpcParam}
// * @param {*} params {为阿里的接口参数}
// */
// async opAliyunRpcReqByPost(pobj, params) {
// try {
// // var action = obj.action;
// // var reqbody = obj.reqbody;
// // var rpcParam = obj.rpcParam;
// var aliyunClient = system.getObject("util.aliyunClient");
// var rtn = await aliyunClient.reqCustomByPost(params);
// return rtn;
// } catch (e) {
// var errorMsg = "error:" + e.stack;
// //日志记录
// this.logCtl.error({
// appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "",
// appkey: pobj.appInfo ? pobj.appInfo.uapp_key || "" : "",
// requestId: pobj.requestId || "",
// op: "service/impl/utilsSve/opAliyunClientPost.js/opAliyunRpcReqByPost",
// content: errorMsg,
// // clientIp: pobj.clientIp,
// optitle: pobj.opType + "推送操作异常->opAliyunRpcReqByPost",
// });
// return system.getResult(null, errorMsg);
// }
// }
/**
* 处理成功后的信息
* @param {*} pobj
* @param {*} result
* @param {*} opTitleDesc
* @param {*} failType this.pushlogFailType
*/
async disposePushResult(pobj, result, opTitleDesc, failType) {//处理结果信息--内部使用
var opType = pobj.opType || "";
if (result.status != 0) {
this.pushlogSve.createFailLogDb({
appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "",
appkey: pobj.appInfo ? pobj.appInfo.uapp_key || "" : "",
requestId: pobj.requestId || "",
content: JSON.stringify(pobj),//推送的参数信息
resultInfo: JSON.stringify(result),
clientIp: pobj.clientIp || "",
failType: failType || 3,
opTitle: opType + "推送操作失败->" + opTitleDesc,
pushNumber: pobj.pushNumber || 1
});
result.data = null;
return result;
async opAliyunRpcVerifyParam(pobj) {//参数信息验证
var verify = system.getResultSuccess();
if (!pobj.interface_params) {
verify = system.getResult(null, "interface_params can not be empty,100440");
}
var interface_params_info = JSON.parse(pobj.interface_params);
if (!interface_params_info || !interface_params_info.action) {
verify = system.getResult(null, "interface_params.action can not be empty,100443");
}
verify.data = interface_params_info;
return verify;
}
this.pushlogSve.createDb({
appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "",
appkey: pobj.appInfo ? pobj.appInfo.uapp_key || "" : "",
requestId: pobj.requestId || "",
op: "推送业务类型:" + opType,
content: JSON.stringify(pobj),//推送的参数信息
resultInfo: JSON.stringify(result),
returnType: '1',
opTitle: opType + "数据推送成功->" + opTitleDesc
});
// result.data = null;
return result;
}
/**
* 处理失败的结果信息--内部使用
* @param {*} pobj
* @param {*} result
* @param {*} opTitleDesc
* @param {*} failType this.pushlogFailType
*/
async disposePushResultFail(pobj, result, opTitleDesc, failType) {//处理失败的结果信息--内部使用
var opType = pobj.opType || "";
this.pushlogSve.createFailLogDb({
appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "",
appkey: pobj.appInfo ? pobj.appInfo.uapp_key || "" : "",
requestId: pobj.requestId || "",
content: JSON.stringify(pobj),//推送的参数信息
resultInfo: JSON.stringify(result),
clientIp: pobj.clientIp || "",
failType: failType || 3,
opTitle: opType + "推送操作失败->" + opTitleDesc,
pushNumber: pobj.pushNumber || 1
});
result.data = null;
return result;
}
async getAliossjavaFileUrl(pobj, params) {//上传ali oss 文件调用
var opType = pobj.opType || "";
try {
var aliOssFileInfo = await this.execPostUrl(params, settings.aliossjavaUrl());
if (aliOssFileInfo == true) {
var fileUrl = params.filedir + "/" + params.objectName;
return system.getResultSuccess(fileUrl);
}
this.pushlogSve.createFailLogDb({
appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "",
appkey: pobj.appInfo ? pobj.appInfo.uapp_key || "" : "",
requestId: pobj.requestId || "",
content: JSON.stringify(params),//推送的参数信息
resultInfo: JSON.stringify(aliOssFileInfo),
clientIp: pobj.clientIp || "",
failType: 3,
opTitle: opType + "aliossjava-upload阿里上传文件操作失败->getAliossjavaFileUrl",
pushNumber: 1
});
return system.getResult(null, "java ali oss upload fail");
} catch (e) {
this.logCtl.error({
appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "",
appkey: pobj.appInfo ? pobj.appInfo.uapp_key || "" : "",
requestId: pobj.requestId || "",
op: "service/app.base.js/getAliossjavaFileUrl",
content: "error:" + e.stack,
// clientIp: pobj.clientIp,
optitle: pobj.opType || "" + "aliossjava-upload阿里上传文件操作异常->getAliossjavaFileUrl",
});
return system.getResult(-200, "java ali oss upload error");
/**
* 阿里RPC调用
* @param {*} pobj {action: rpcParam.action,reqbody: pobj.actionBody,rpcParam: rpcParam}
* @param {*} params {为阿里的接口参数}
*/
async opAliyunRpcReq(pobj, params) {
try {
// var action = obj.action;
// var reqbody = obj.reqbody;
// var rpcParam = obj.rpcParam;
var aliyunClient = system.getObject("util.aliyunClient");
var rtn = await aliyunClient.reqCustomByGet(params);
return rtn;
} catch (e) {
params.appInfo = pobj.appInfo;
const stackStr = e.stack ? e.stack : JSON.stringify(e);
this.execClientNew.execLogs(`推送操作异常-api-center-channel`, params, "center-channel-opAliyunRpcReq", null, stackStr);
return system.getResult(null, stackStr);
}
}
}
async opDownFileInfo(docUrl, result) { //从oss下载到本地并上传到自己oss,之后删除本地文件
/*docUrl下载链接,全路径,如:https://XXXXXX.pdf?XXXXX */
try {
var tmpFileName = docUrl.substring(0, docUrl.lastIndexOf("?"));
var fileName = tmpFileName.substr(tmpFileName.lastIndexOf("/") + 1, tmpFileName.lenght);
var fileType = tmpFileName.substr(tmpFileName.lastIndexOf(".") + 1, tmpFileName.lenght);
//解码后的文件全名:xxx.pdf
var fileAllName = decodeURIComponent(fileName);//为xxx.pdf
var saveFilePath = '/tmp/' + fileAllName;
// 下载文件到指定的路径
var tmpp = await this.restClient.execDownload("'" + docUrl + "'", saveFilePath);
//上传 saveFilePath的文件 到ossClient
var uuid = uuidv4();
var u = uuid.replace(/\-/g, "");
var upFileName = "alifile_" + u + "." + fileType;
var rtn = await this.ossClient.upfile(upFileName, saveFilePath);
result.data = rtn;
//删除本地文件
fs.unlink(saveFilePath, function (err) { });
} catch (e) {
result.code = -200;
result.message = "通过flowId获取到的文件url下载操作异常异常error";
console.log(e.stack);
//日志记录
logCtl.error({
optitle: "e签宝通过flowId获取到的文件url下载操作异常异常error",
op: "base/service/impl/utilesignbaoSve/opDownFileInfo",
content: "请求参数:docUrl=" + docUrl + ",异常信息error:" + e.stack,
clientIp: ""
});
/**
* 处理成功后的信息
* @param {*} pobj
* @param {*} result
* @param {*} opTitleDesc
* @param {*} failType this.pushlogFailType
*/
async disposePushResult(pobj, result, opTitleDesc, failType) {//处理结果信息--内部使用
let opType = pobj.opType || "";
let content = JSON.stringify(pobj);
if (result.status != 0) {
return this.disposePushResultFail(pobj, result, opTitleDesc, failType);
}
this.pushlogSve.createDb({
appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "",
appkey: pobj.appInfo ? pobj.appInfo.uapp_key || "" : "",
requestId: pobj.requestId || "",
op: "推送业务类型:" + opType,
content: content,//推送的参数信息
resultInfo: JSON.stringify(result),
returnType: '1',
opTitle: opType + "数据推送成功->" + opTitleDesc
});
// 更改需求推送状态
if (opType.indexOf('Need') >= 0 && opType.indexOf('Business') >= 0) {
pobj.actionType = 'updateNeedPushStatus';
let url = settings.centerOrderUrl() + 'action/opNeed/springBoard';
this.execPostByTimeOut(null, pobj, url, null, null, 60);
}
if (["pushOrder", "pushOrderBusiness", "pushOrderICPBusiness", "pushOrderICPBusinessNew"].includes(opType) && pobj.actionBody && pobj.actionBody.orderNo) {
pobj.actionBody.pushNumber = pobj.pushNumber || 1;
pobj.actionBody.pushStatus = 3;//推送状态0待推送2推送失败3已成功推送
this.disposeOrderPush(pobj);
}
return result;
}
return result;
}
async getOpInterfaceByProductId(appInfo, product_id) {//获取产品调用接口
var getProductInterfaceUrl = settings.centerAppUrl() + "action/opProduct/springBoard";
var getProductInterfaceObj = {
"actionType": "getProductInterface",
"appInfo": appInfo,
"actionBody": { "product_id": product_id }
};
var productItemInterfaceResult = await this.restPostUrl(getProductInterfaceObj, getProductInterfaceUrl);
return productItemInterfaceResult;
}
/**
* 处理失败的结果信息--内部使用
* @param {*} pobj
* @param {*} result
* @param {*} opTitleDesc
* @param {*} failType this.pushlogFailType
*/
async disposePushResultFail(pobj, result, opTitleDesc, failType) {//处理失败的结果信息--内部使用
var opType = pobj.opType || "";
let pushNumber = pobj.pushNumber || 1;
if (pushNumber == 10) {
pobj.actionBody.pushNumber = pushNumber;
pobj.actionBody.pushStatus = 2;//推送状态0待推送2推送失败3已成功推送
this.disposeOrderPush(pobj);
if (result.errorMsg && result.errorMsg == "订单产品查询出来产品与传递得产品数量不一致") {
this.disposeOrderPushFailSendDing(pobj);
}
}
let resultInfo = JSON.stringify(result);
this.pushlogSve.createFailLogDb({
appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "",
appkey: pobj.appInfo ? pobj.appInfo.uapp_key || "" : "",
requestId: pobj.requestId || "",
content: JSON.stringify(pobj),//推送的参数信息
resultInfo: resultInfo,
clientIp: pobj.clientIp || "",
failType: failType || 3,
opTitle: opType + "推送操作失败->" + opTitleDesc,
pushNumber: pushNumber
});
result.data = null;
return result;
}
async getConvertSemiangleStr(str) {//去除空格及全角转半角
var result = "";
str = str.replace(/\s+/g, "");
var len = str.length;
for (var i = 0; i < len; i++) {
var cCode = str.charCodeAt(i);
//全角与半角相差(除空格外):65248(十进制)
cCode = (cCode >= 0xFF01 && cCode <= 0xFF5E) ? (cCode - 65248) : cCode;
//处理空格
cCode = (cCode == 0x03000) ? 0x0020 : cCode;
result += String.fromCharCode(cCode);
async disposeOrderPushFailSendDing(pobj) {
let params = {
orderNo: pobj.actionBody.orderNo,
city: pobj.actionBody.city,
area: pobj.actionBody.area,
companyCategory: pobj.actionBody.companyCategory,
appName: pobj.actionBody.appName,
sku: pobj.actionBody.sku,
error: "订单产品查询出来产品与传递得产品数量不一致,请重新选择!"
}
this.dingClient.businessPushFqByChannel(params);
}
return result;
}
/*
返回20位业务订单号
prefix:业务前缀
*/
async getBusUid(prefix) {
prefix = (prefix || "");
if (prefix) {
prefix = prefix.toUpperCase();
async disposeOrderPush(pobj) {
pobj.actionType = 'updateOrderPushStatus';
let url = settings.centerOrderUrl() + 'action/order/springBoard';
this.execPostByTimeOut(null, pobj, url, null, null, 60);
}
var prefixlength = prefix.length;
var subLen = 8 - prefixlength;
var uidStr = "";
if (subLen > 0) {
uidStr = await this.getUidInfo(subLen, 60);
async getAliossjavaFileUrl(pobj, params) {//上传ali oss 文件调用
let opType = pobj.opType || "";
try {
let aliOssFileInfo = await this.execPostUrl(params, settings.aliossjavaUrl());
if (aliOssFileInfo == true) {
let fileUrl = params.filedir + "/" + params.objectName;
return system.getResultSuccess(fileUrl);
}
this.pushlogSve.createFailLogDb({
appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "",
appkey: pobj.appInfo ? pobj.appInfo.uapp_key || "" : "",
requestId: pobj.requestId || "",
content: JSON.stringify(params),//推送的参数信息
resultInfo: JSON.stringify(aliOssFileInfo),
clientIp: pobj.clientIp || "",
failType: 3,
opTitle: opType + "aliossjava-upload阿里上传文件操作失败->getAliossjavaFileUrl",
pushNumber: 1
});
return system.getResult(null, "java ali oss upload fail");
} catch (e) {
params.appInfo = pobj.appInfo;
const stackStr = e.stack ? e.stack : JSON.stringify(e);
this.execClientNew.execLogs(`aliossjava-upload阿里上传文件操作异常-api-center-channel`, params, "center-channel-getAliossjavaFileUrl", null, stackStr);
return system.getResult(-200, "java ali oss upload error");
}
}
var timStr = moment().format("YYYYMMDDHHmm");
return prefix + timStr + uidStr;
}
/*
len:返回长度
radix:参与计算的长度,最大为62
*/
async getUidInfo(len, radix) {
var chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'.split('');//长度62,到yz长度为长36
var uuid = [], i;
radix = radix || chars.length;
if (len) {
for (i = 0; i < len; i++) uuid[i] = chars[0 | Math.random() * radix];
} else {
var r;
uuid[8] = uuid[13] = uuid[18] = uuid[23] = '-';
uuid[14] = '4';
for (i = 0; i < 36; i++) {
if (!uuid[i]) {
r = 0 | Math.random() * 16;
uuid[i] = chars[(i == 19) ? (r & 0x3) | 0x8 : r];
}
}
async opDownFileInfo(docUrl, result) { //从oss下载到本地并上传到自己oss,之后删除本地文件
/*docUrl下载链接,全路径,如:https://XXXXXX.pdf?XXXXX */
try {
var tmpFileName = docUrl.substring(0, docUrl.lastIndexOf("?"));
var fileName = tmpFileName.substr(tmpFileName.lastIndexOf("/") + 1, tmpFileName.lenght);
var fileType = tmpFileName.substr(tmpFileName.lastIndexOf(".") + 1, tmpFileName.lenght);
//解码后的文件全名:xxx.pdf
var fileAllName = decodeURIComponent(fileName);//为xxx.pdf
var saveFilePath = '/tmp/' + fileAllName;
// 下载文件到指定的路径
var tmpp = await this.restClient.execDownload("'" + docUrl + "'", saveFilePath);
//上传 saveFilePath的文件 到ossClient
var uuid = uuidv4();
var u = uuid.replace(/\-/g, "");
var upFileName = "alifile_" + u + "." + fileType;
var rtn = await this.ossClient.upfile(upFileName, saveFilePath);
result.data = rtn;
//删除本地文件
fs.unlink(saveFilePath, function (err) {
});
} catch (e) {
result.code = -200;
result.message = "通过flowId获取到的文件url下载操作异常异常error";
console.log(e.stack);
//日志记录
logCtl.error({
optitle: "e签宝通过flowId获取到的文件url下载操作异常异常error",
op: "base/service/impl/utilesignbaoSve/opDownFileInfo",
content: "请求参数:docUrl=" + docUrl + ",异常信息error:" + e.stack,
clientIp: ""
});
}
return result;
}
return uuid.join('');
}
getUUID() {
var uuid = uuidv4();
var u = uuid.replace(/\-/g, "");
return u;
}
/**
* 加密信息
* @param {*} encrypt_key
* @param {*} encrypt_secret
* @param {*} opStr
*/
async encryptStr(encrypt_key, encrypt_secret, opStr) {
if (!opStr) {
return system.getResult(null, "opStr is empty");
async getOpInterfaceByProductId(appInfo, product_id) {//获取产品调用接口
var getProductInterfaceUrl = settings.centerAppUrl() + "action/opProduct/springBoard";
var getProductInterfaceObj = {
"actionType": "getProductInterface",
"appInfo": appInfo,
"actionBody": {"product_id": product_id}
};
var productItemInterfaceResult = await this.restPostUrl(getProductInterfaceObj, getProductInterfaceUrl);
return productItemInterfaceResult;
}
let keyHex = cryptoJS.enc.Utf8.parse(encrypt_key);
let ivHex = cryptoJS.enc.Utf8.parse(encrypt_secret.substring(0, 8));
var cipherStr = cryptoJS.TripleDES.encrypt(opStr, keyHex, { iv: ivHex }).toString();
return cipherStr;
}
/**
* 解密信息
* @param {*} encrypt_key
* @param {*} encrypt_secret
* @param {*} opStr
*/
async decryptStr(encrypt_key, encrypt_secret, opStr) {
if (!opStr) {
return system.getResult(null, "opStr is empty");
async getConvertSemiangleStr(str) {//去除空格及全角转半角
var result = "";
str = str.replace(/\s+/g, "");
var len = str.length;
for (var i = 0; i < len; i++) {
var cCode = str.charCodeAt(i);
//全角与半角相差(除空格外):65248(十进制)
cCode = (cCode >= 0xFF01 && cCode <= 0xFF5E) ? (cCode - 65248) : cCode;
//处理空格
cCode = (cCode == 0x03000) ? 0x0020 : cCode;
result += String.fromCharCode(cCode);
}
return result;
}
try {
let keyHex = cryptoJS.enc.Utf8.parse(encrypt_key);
let ivHex = cryptoJS.enc.Utf8.parse(encrypt_secret.substring(0, 8));
var bytes = cryptoJS.TripleDES.decrypt(opStr, keyHex, {
iv: ivHex
});
var plaintext = bytes.toString(cryptoJS.enc.Utf8);
if (!plaintext) {
return system.getResult(null, "解密失败" + opStr);
}
return system.getResultSuccess(plaintext);
} catch (error) {
return system.getResultFail(-200, "解密异常:" + opStr);
/*
返回20位业务订单号
prefix:业务前缀
*/
async getBusUid(prefix) {
prefix = (prefix || "");
if (prefix) {
prefix = prefix.toUpperCase();
}
var prefixlength = prefix.length;
var subLen = 8 - prefixlength;
var uidStr = "";
if (subLen > 0) {
uidStr = await this.getUidInfo(subLen, 60);
}
var timStr = moment().format("YYYYMMDDHHmm");
return prefix + timStr + uidStr;
}
}
/**
* 带超时时间的post请求
* @param {*} req 请求信息
* @param {*} params 请求数据-json格式
* @param {*} url 请求地址
* @param {*} ContentType 请求头类型,默认application/json
* @param {*} headData 请求头内容-json格式,如:请求头中传递token,格式:{token:"9098902q849q0434q09439"}
* @param {*} timeOut 超时时间
*/
async execPostByTimeOut(req, params, url, ContentType, headData, timeOut = 60) {
const result = await this.execClientNew.execPostTimeOutByBusiness('sve.base', params, url, ContentType, headData, timeOut, req);
return result;
}
/**
* 验证签名
* @param {*} params 要验证的参数
* @param {*} app_secret 应用的校验key
*/
async verifySign(params, app_secret) {
if (!params) {
return system.getResult(null, "请求参数为空");
/*
len:返回长度
radix:参与计算的长度,最大为62
*/
async getUidInfo(len, radix) {
var chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'.split('');//长度62,到yz长度为长36
var uuid = [], i;
radix = radix || chars.length;
if (len) {
for (i = 0; i < len; i++) uuid[i] = chars[0 | Math.random() * radix];
} else {
var r;
uuid[8] = uuid[13] = uuid[18] = uuid[23] = '-';
uuid[14] = '4';
for (i = 0; i < 36; i++) {
if (!uuid[i]) {
r = 0 | Math.random() * 16;
uuid[i] = chars[(i == 19) ? (r & 0x3) | 0x8 : r];
}
}
}
return uuid.join('');
}
if (!params.sign) {
return system.getResult(null, "请求参数sign为空");
getUUID() {
var uuid = uuidv4();
var u = uuid.replace(/\-/g, "");
return u;
}
var signArr = [];
var keys = Object.keys(params).sort();
if (keys.length == 0) {
return system.getResult(null, "请求参数信息为空");
/**
* 加密信息
* @param {*} encrypt_key
* @param {*} encrypt_secret
* @param {*} opStr
*/
async encryptStr(encrypt_key, encrypt_secret, opStr) {
if (!opStr) {
return system.getResult(null, "opStr is empty");
}
let keyHex = cryptoJS.enc.Utf8.parse(encrypt_key);
let ivHex = cryptoJS.enc.Utf8.parse(encrypt_secret.substring(0, 8));
var cipherStr = cryptoJS.TripleDES.encrypt(opStr, keyHex, {iv: ivHex}).toString();
return cipherStr;
}
for (let k = 0; k < keys.length; k++) {
const tKey = keys[k];
if (tKey != "sign" && params[tKey]) {
let tmpKeyValue = params[tKey];
if (tmpKeyValue instanceof Array || tmpKeyValue instanceof Object) {
tmpKeyValue = JSON.stringify(tmpKeyValue);
}
signArr.push(tKey + "=" + tmpKeyValue);
}
/**
* 解密信息
* @param {*} encrypt_key
* @param {*} encrypt_secret
* @param {*} opStr
*/
async decryptStr(encrypt_key, encrypt_secret, opStr) {
if (!opStr) {
return system.getResult(null, "opStr is empty");
}
try {
let keyHex = cryptoJS.enc.Utf8.parse(encrypt_key);
let ivHex = cryptoJS.enc.Utf8.parse(encrypt_secret.substring(0, 8));
var bytes = cryptoJS.TripleDES.decrypt(opStr, keyHex, {
iv: ivHex
});
var plaintext = bytes.toString(cryptoJS.enc.Utf8);
if (!plaintext) {
return system.getResult(null, "解密失败" + opStr);
}
return system.getResultSuccess(plaintext);
} catch (error) {
return system.getResultFail(-200, "解密异常:" + opStr);
}
}
if (signArr.length == 0) {
return system.getResult(null, "请求参数组装签名参数信息为空");
/**
* 带超时时间的post请求
* @param {*} req 请求信息
* @param {*} params 请求数据-json格式
* @param {*} url 请求地址
* @param {*} ContentType 请求头类型,默认application/json
* @param {*} headData 请求头内容-json格式,如:请求头中传递token,格式:{token:"9098902q849q0434q09439"}
* @param {*} timeOut 超时时间
*/
async execPostByTimeOut(req, params, url, ContentType, headData, timeOut = 60) {
const result = await this.execClientNew.execPostTimeOutByBusiness('sve.base', params, url, ContentType, headData, timeOut, req);
return result;
}
var resultSignStr = signArr.join("&") + "&key=" + app_secret;
var resultTmpSign = md5(resultSignStr).toUpperCase();
if (params.sign != resultTmpSign) {
return system.getResult(null, "返回值签名验证失败");
/**
* 验证签名
* @param {*} params 要验证的参数
* @param {*} app_secret 应用的校验key
*/
async verifySign(params, app_secret) {
if (!params) {
return system.getResult(null, "请求参数为空");
}
if (!params.sign) {
return system.getResult(null, "请求参数sign为空");
}
var signArr = [];
var keys = Object.keys(params).sort();
if (keys.length == 0) {
return system.getResult(null, "请求参数信息为空");
}
for (let k = 0; k < keys.length; k++) {
const tKey = keys[k];
if (tKey != "sign" && params[tKey]) {
let tmpKeyValue = params[tKey];
if (tmpKeyValue instanceof Array || tmpKeyValue instanceof Object) {
tmpKeyValue = JSON.stringify(tmpKeyValue);
}
signArr.push(tKey + "=" + tmpKeyValue);
}
}
if (signArr.length == 0) {
return system.getResult(null, "请求参数组装签名参数信息为空");
}
var resultSignStr = signArr.join("&") + "&key=" + app_secret;
var resultTmpSign = md5(resultSignStr).toUpperCase();
if (params.sign != resultTmpSign) {
return system.getResult(null, "返回值签名验证失败");
}
return system.getResultSuccess();
}
return system.getResultSuccess();
}
async getFQbossSign(pobj){
var signArr = [];
var keys = Object.keys(pobj).sort();
for (let k = 0; k < keys.length; k++) {
const tKey = keys[k];
if (tKey != "sign" && pobj[tKey]) {
signArr.push(tKey + "=" + pobj[tKey]);
}
async getFQbossSign(pobj) {
var signArr = [];
var keys = Object.keys(pobj).sort();
for (let k = 0; k < keys.length; k++) {
const tKey = keys[k];
if (tKey != "sign" && pobj[tKey]) {
signArr.push(tKey + "=" + pobj[tKey]);
}
}
var resultSignStr = signArr.join("&") + "&key=" + "9c83f5f5c41347fc9bb47951fef3199b";
return md5(resultSignStr).toUpperCase();
}
var resultSignStr = signArr.join("&") + "&key=" + "9c83f5f5c41347fc9bb47951fef3199b";
return md5(resultSignStr).toUpperCase();
}
}
module.exports = AppServiceBase;
......@@ -5,7 +5,8 @@ const AppServiceBase = require("../../app.base");
const uappId = {
'ali':"18", //(阿里icp、edi)
'baidu':"44", //(百度icp、edi)
'zc360':"50" //360icp、edi
'zc360':"50", //360icp、edi
"ename":"52" //易名
}
//tui song baidu zhuanyong pinyin 2020-11-6
const cityLetter = {
......@@ -85,6 +86,7 @@ class BaseCenterOrderService extends AppServiceBase {
//提交Icp注册方案
async submitIcpProgramme(pobj) {
console.log('提交Icp注册方案---',pobj)
var res = await this.reqCenterOrderApi(pobj, "action/qcapi/springBoard");
if (res && res.status == 0 && res.data && res.data.needinfo && res.data.needsolution) {
var needinfo = res.data.needinfo;//需求信息
......@@ -154,6 +156,25 @@ class BaseCenterOrderService extends AppServiceBase {
console.log('pushObj++',pushObj)
var pushIcpSolutionRes = await this.pushBaiduIcpSolution(pushObj, needsolution.solutionNo, pobj.appInfo, self);
}
if(needinfo.uapp_id == uappId.ename){
//推送数据至易名
// var bizType = needinfo.channelTypeCode;//业务类型里
// solution.Area = cityLetter[solution.Area]
console.log('solution.Area++',solution.Area)
console.log('solution++',solution)
var pushObj = {
IntentionBizId: needinfo.channelNeedNo,
CompanyName: solution.CompanyName,
CompanyAddress: solution.CompanyAddress,
Area: solution.Area,
IcpType:solution.IcpType
};
if (needsolution.channelSolutionNo) {
pushObj["BizId"] = needsolution.channelSolutionNo;
}
console.log('pushObj++',pushObj);
var pushIcpSolutionRes = await this.pushEnameIcpSolution(pushObj, needsolution.solutionNo, pobj.appInfo, self);
}
this.logCtl.info({
appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "",
appkey: pobj.appInfo ? pobj.appInfo.uapp_key || "" : "",
......@@ -172,7 +193,7 @@ class BaseCenterOrderService extends AppServiceBase {
},
appInfo: pobj.appInfo
}
await this.utilsPushSve.aliBusiness2Delivery(reqParams, "updateChanceStatus");
await this.utilsPushSve.business2Channel(reqParams, "updateChanceStatus");
}
return res;
}
......@@ -275,6 +296,46 @@ class BaseCenterOrderService extends AppServiceBase {
return pushRes;
}
//推送ICP方案易名 2021-02-25 庄冰
async pushEnameIcpSolution(pushObj, solutionNo, appInfo, self) {
console.log('pushObj++Ename+++',pushObj);
//推送方案信息
var rtn = await self.execClient.execEnamePost(pushObj, settings.enameClientUrl()+"SubmitIcpSolution");
console.log("url+++++",settings.enameClientUrl()+"SubmitIcpSolution")
console.log("rtn+++++",rtn)
if (!rtn || !rtn.stdout) {
return system.getResult(null, "execPost data is empty");
}
var pushRes = JSON.parse(rtn.stdout);
// var pushRes = await self.baiduclient.baiduReqbyget({ path: "/api/bla/provider/plan", reqbody: pushObj });
console.log("pushRes++++",pushRes)
if (pushRes && pushRes.ErrorCode == "200" && pushRes.Success==true && pushRes.BizId) {
var reqObj2 = {
actionType: "receiveProgrammeNo",
appInfo: appInfo,
actionBody: {
solutionNo: solutionNo,
solutionBizId: pushRes.BizId
}
};
var a = await self.reqCenterOrderApi(reqObj2);//保存渠道方案id
console.log("保存渠道方案id aaaa++ ",a)
if (a && a.status == 0 && pushRes.ConfirmUrl) {
var reqObj3 = {
actionType: "receiveIcpConfirmUrl",
appInfo: appInfo,
actionBody: {
solutionNo: solutionNo,
confirmUrl: pushRes.ConfirmUrl
}
};
var url = await self.reqCenterOrderApi(reqObj3);//保存用户确认方案url
console.log('save confirmUrl ++ ',url)
}
}
return pushRes;
}
//推送ICP方案baidu 2020-10-26 laolan
async pushBaiduIcpSolution(pushObj, solutionNo, appInfo, self) {
console.log('pushObj++baidu+++',pushObj)
......@@ -505,89 +566,141 @@ class BaseCenterOrderService extends AppServiceBase {
var result = await this.utilsPushSve.business2Channel(reqPushParams, "serviceProviderSubmit2Material");
console.log('result+++-cailiao--++++----',result)
console.log('result+++-reqPushParams--++++----',reqPushParams)
}else{
if(res.data.uapp_id == uappId.ali){
//推送数据至阿里
var BizId = needsolution.channelSolutionNo;//⽅案业务ID
var pushObj = {
"CompanyName":material.CompanyName,
"BizId": BizId,
"Domain": material.Domain,
"CorporateName": material.CorporateName,
"IncludeForeignInvestment": material.IncludeForeignInvestment,
"PartnerBusinessLicense": material.PartnerBusinessLicense,
"PartnerIdCardList": material.PartnerIdCardList,
"PartnerDomainCertificate": material.PartnerDomainCertificate,
"PartnerPreviewOtherList": material.PartnerPreviewOtherList || [],
"PartnerPlan": material.PartnerPlan || "",
"PartnerForeignInvestment": material.PartnerForeignInvestment || "",
"PartnerLaw": material.PartnerLaw || "",
"PartnerStampOtherList": material.PartnerStampOtherList || [],
"PartnerSignOtherList": material.PartnerSignOtherList || [],
"PartnerSignAndStampOtherList": material.PartnerSignAndStampOtherList || []
};
var self = this;
//推送方案材料
var ali =await self.aliclient.reqbyget({ action: "SavePartnerSubmitMaterial", reqbody: pushObj, apiVersion: "2019-05-08" });
console.log('ali tui ziliao ++',ali)
if(ali && ali.status == 200){
var aliFlag = 200
}else{
var aliFlag = -200
}else{
if(res.data.uapp_id == uappId.ali){
//推送数据至阿里
var BizId = needsolution.channelSolutionNo;//⽅案业务ID
var pushObj = {
"CompanyName":material.CompanyName,
"BizId": BizId,
"Domain": material.Domain,
"CorporateName": material.CorporateName,
"IncludeForeignInvestment": material.IncludeForeignInvestment,
"PartnerBusinessLicense": material.PartnerBusinessLicense,
"PartnerIdCardList": material.PartnerIdCardList,
"PartnerDomainCertificate": material.PartnerDomainCertificate,
"PartnerPreviewOtherList": material.PartnerPreviewOtherList || [],
"PartnerPlan": material.PartnerPlan || "",
"PartnerForeignInvestment": material.PartnerForeignInvestment || "",
"PartnerLaw": material.PartnerLaw || "",
"PartnerStampOtherList": material.PartnerStampOtherList || [],
"PartnerSignOtherList": material.PartnerSignOtherList || [],
"PartnerSignAndStampOtherList": material.PartnerSignAndStampOtherList || []
};
var self = this;
//推送方案材料
var ali =await self.aliclient.reqbyget({ action: "SavePartnerSubmitMaterial", reqbody: pushObj, apiVersion: "2019-05-08" });
console.log('ali tui ziliao ++',ali)
if(ali && ali.status == 200){
var aliFlag = 200
}else{
var aliFlag = -200
}
}
}
if(res.data.uapp_id == uappId.baidu){
//推送数据至百度
var BizId = needsolution.orderChannelNo;
console.log('BizId++',BizId)
var pushObj = {
"businessLicense" : {
"createdAt" : material.BusinessLicense.CreatedAt || "",
"enterpriseCode" :material.BusinessLicense.EnterpriseCode || "",
"legalRepresentative" :material.BusinessLicense.LegalRepresentative || "",
"address" :material.BusinessLicense.Address || "",
"registeredCapital" : material.BusinessLicense.RegisteredCapital || "",
"name" :material.BusinessLicense.Name || "",
"businessTerm" :material.BusinessLicense.BusinessTerm || "",
"type" : material.BusinessLicense.Type || "",
"scopeBusiness" :material.BusinessLicense.ScopeBusiness || ""
},
"partnerForeignInvestment": material.PartnerForeignInvestment || "",
"orderNo": BizId,
"domain": material.Domain,
"corporateName": material.CorporateName,
"includeForeignInvestment": material.IncludeForeignInvestment,
"partnerBusinessLicense": material.PartnerBusinessLicense,
"partnerIdCardList": material.PartnerIdCardList,
"partnerDomainCertificate": material.PartnerDomainCertificate,
"partnerPreviewOtherList": material.PartnerPreviewOtherList || [],
"partnerPlan": material.PartnerPlan || "",
"partnerLaw": material.PartnerLaw || "",
"partnerStampOtherList": material.PartnerStampOtherList || [],
"partnerSignOtherList": material.PartnerSignOtherList || [],
"partnerSignAndStampOtherList": material.PartnerSignAndStampOtherList || []
};
var self = this;
//推送方案材料
var baidu = await self.baiduclient.baiduReqbyget({ path: "/api/bla/provider/license/material", reqbody: pushObj });
console.log('baidu tui ziliao +++++',baidu)
console.log('baidu pushObj ziliao +++++',pushObj)
if(baidu && baidu.data && baidu.data.result){
var baiduFlag = 200
}else{
var baiduFlag = -200
if(res.data.uapp_id == uappId.baidu){
//推送数据至百度
var BizId = needsolution.orderChannelNo;
console.log('BizId++',BizId)
var pushObj = {
"businessLicense" : {
"createdAt" : material.BusinessLicense.CreatedAt || "",
"enterpriseCode" :material.BusinessLicense.EnterpriseCode || "",
"legalRepresentative" :material.BusinessLicense.LegalRepresentative || "",
"address" :material.BusinessLicense.Address || "",
"registeredCapital" : material.BusinessLicense.RegisteredCapital || "",
"name" :material.BusinessLicense.Name || "",
"businessTerm" :material.BusinessLicense.BusinessTerm || "",
"type" : material.BusinessLicense.Type || "",
"scopeBusiness" :material.BusinessLicense.ScopeBusiness || ""
},
"partnerForeignInvestment": material.PartnerForeignInvestment || "",
"orderNo": BizId,
"domain": material.Domain,
"corporateName": material.CorporateName,
"includeForeignInvestment": material.IncludeForeignInvestment,
"partnerBusinessLicense": material.PartnerBusinessLicense,
"partnerIdCardList": material.PartnerIdCardList,
"partnerDomainCertificate": material.PartnerDomainCertificate,
"partnerPreviewOtherList": material.PartnerPreviewOtherList || [],
"partnerPlan": material.PartnerPlan || "",
"partnerLaw": material.PartnerLaw || "",
"partnerStampOtherList": material.PartnerStampOtherList || [],
"partnerSignOtherList": material.PartnerSignOtherList || [],
"partnerSignAndStampOtherList": material.PartnerSignAndStampOtherList || []
};
var self = this;
//推送方案材料
var baidu = await self.baiduclient.baiduReqbyget({ path: "/api/bla/provider/license/material", reqbody: pushObj });
console.log('baidu tui ziliao +++++',baidu)
console.log('baidu pushObj ziliao +++++',pushObj)
if(baidu && baidu.data && baidu.data.result){
var baiduFlag = 200
}else{
var baiduFlag = -200
}
}
if(res.data.uapp_id == uappId.ename){
var aliFlag = -200;
//推送数据至易名
var BizId = needsolution.channelSolutionNo;//⽅案业务ID
var pushObj = {
"CompanyName":material.CompanyName,
// "BizId": BizId,
"OrderNo": BizId,
"Domain": material.Domain,
"CorporateName": material.CorporateName,
"IncludeForeignInvestment": material.IncludeForeignInvestment,
"PartnerBusinessLicense": material.PartnerBusinessLicense,
"PartnerIdCardList": material.PartnerIdCardList,
"PartnerDomainCertificate": material.PartnerDomainCertificate,
"PartnerPreviewOtherList": material.PartnerPreviewOtherList || [],
"PartnerPlan": material.PartnerPlan || "",
"PartnerForeignInvestment": material.PartnerForeignInvestment || "",
"PartnerLaw": material.PartnerLaw || "",
"PartnerStampOtherList": material.PartnerStampOtherList || [],
"PartnerSignOtherList": material.PartnerSignOtherList || [],
"PartnerSignAndStampOtherList": material.PartnerSignAndStampOtherList || [],
"BusinessLicense" : {
"CreatedAt" : material.BusinessLicense.CreatedAt || "",
"EnterpriseCode" :material.BusinessLicense.EnterpriseCode || "",
"LegalRepresentative" :material.BusinessLicense.LegalRepresentative || "",
"Address" :material.BusinessLicense.Address || "",
"RegisteredCapital" : material.BusinessLicense.RegisteredCapital || "",
"Name" :material.BusinessLicense.Name || "",
"BusinessTerm" :material.BusinessLicense.BusinessTerm || "",
"Type" : material.BusinessLicense.Type || "",
"ScopeBusiness" :material.BusinessLicense.ScopeBusiness || ""
},
};
var self = this;
//推送方案材料
var rtn = await self.execClient.execEnamePost(pushObj, settings.enameClientUrl()+"SavePartnerSubmitMaterial");
console.log("url+++++",settings.enameClientUrl()+"SavePartnerSubmitMaterial")
console.log("rtn+++++",rtn)
if (!rtn || !rtn.stdout) {
aliFlag = -200;
}else{
var pushRes = JSON.parse(rtn.stdout);
if(pushRes && pushRes.Success && pushRes.Success==true){
aliFlag == 200;
}else{
aliFlag == -200;
}
}
}
if(aliFlag == 200 || baiduFlag == 200){
return system.getResultSuccess();
}
}
if(aliFlag == 200 || baiduFlag == 200){
return system.getResultSuccess();
}
}
console.log('rsrsr++++------------++++',res)
console.log('rsrsr++++------------++++',res)
return res
}
return res
}
//队列通知交付状态变更
async serviceProvider2Notification(pobj){
......@@ -688,7 +801,11 @@ class BaseCenterOrderService extends AppServiceBase {
var pushObj = {
BizId: res.data.BizId,
OfficialFileURL: res.data.OfficialFileURL,
ApplicationStatus: res.data.ApplicationStatus
ApplicationStatus: res.data.ApplicationStatus,
//2021-3-18 addNew
CertificateNumber:res.data.CertificateNumber || "",//证书编号
CertificateStartTime:res.data.CertificateStartTime || "",//证书有效期 开始时间
CertificateEndTime:res.data.CertificateEndTime || ""//证书有效期 结束时间
};
//推送状态变更
var ali = await this.aliclient.reqbyget({ action: "AcceptPartnerNotification", reqbody: pushObj, apiVersion: "2019-05-08" });
......@@ -699,6 +816,29 @@ class BaseCenterOrderService extends AppServiceBase {
}
}
if(res.data.uapp_id == uappId.ename){
var enameFlag =-200;
//推送数据至易名
var pushObj = {
OrderNo: res.data.channelOrderNo,
OfficialFileURL: res.data.OfficialFileURL,
ApplicationStatus: res.data.ApplicationStatus
};
var rtn = await this.execClient.execEnamePost(pushObj, settings.enameClientUrl()+"AcceptPartnerNotification");
console.log("url+++++",settings.enameClientUrl()+"AcceptPartnerNotification")
console.log("rtn+++++",rtn)
if (!rtn || !rtn.stdout) {
enameFlag = -200;
}else{
var pushRes = JSON.parse(rtn.stdout);
if(pushRes && pushRes.Success && pushRes.Success==true){
enameFlag == 200;
}else{
enameFlag == -200;
}
}
}
if(res.data.uapp_id == uappId.baidu){
res.data.ApplicationStatus = baiduIcpStatus[res.data.ApplicationStatus];
console.log('res.data.channelOrderNo',res.data.channelOrderNo)
......@@ -727,13 +867,14 @@ class BaseCenterOrderService extends AppServiceBase {
}
}
if(aliFlag == 200 || baiduFlag == 200 || zc360Flag == 200){
if(aliFlag == 200 || baiduFlag == 200 || zc360Flag == 200 || enameFlag == 200){
return system.getResultSuccess();
}
}
return res;
}
return res;
}
//交付单关闭
async closeOrderDelivery(pobj) {
......@@ -751,5 +892,38 @@ class BaseCenterOrderService extends AppServiceBase {
}
return res;
}
//易名退款,关闭订单 2021-3-23
async eNameCloseOrder(pobj){
console.log("eNameCloseOrder+++",pobj)
var pushObj = {}
var orderNo
var note
orderNo = pobj.actionBody.orderNo
note = pobj.actionBody.note
pobj.actionType = "delENameOrder"
var res = await this.utilsOrderSve.delENameOrder(pobj, pobj.actionBody);
if (res.status < 0) {
return system.getResultFail(-5022, "订单关闭失败");
}
console.log('delOrder---',res)
if (res && res.status == 0 && res.data && res.data.channelOrderNo) {
pushObj = {
OrderNo:res.data.channelOrderNo,
Note:note
}
console.log('eNameCloseOrder+++pushObj----',pushObj)
var rtn = await this.execClient.execEnamePost(pushObj, settings.enameClientUrl()+"CloseOrder");
console.log('eNameCloseOrder+++rtn----',rtn)
if(rtn && rtn.stdout){
var pushRes = JSON.parse(rtn.stdout);
if(pushRes && pushRes.Success && pushRes.Success==true){
console.log('ename----',pushRes)
return pushRes
}
}
}
return res
}
}
module.exports = BaseCenterOrderService;
\ No newline at end of file
......@@ -198,7 +198,7 @@ class CenterorderService extends AppServiceBase {
pobj.actionBody.appName = pobj.appInfo.app_name;
if (solutiondata.status == 0) {
pobj.actionBody.orderNo = pobj.actionBody.channelOrder.channelOrderNo;
this.utilsPushSve.aliBusiness2Fq(pobj, "pushOrderBusiness");
this.utilsPushSve.business2Channel(pobj, "pushOrderBusiness");
}
return system.getResultSuccess();
}
......@@ -337,7 +337,7 @@ class CenterorderService extends AppServiceBase {
},
appInfo: pobj.appInfo
}
let aliPushRes = await this.utilsPushSve.aliBusiness2Fq(fqobj, "pushOrderICPBusiness");
let aliPushRes = await this.utilsPushSve.business2Channel(fqobj, "pushOrderICPBusiness");
if(pobj.actionBody.isDirectBuy && pobj.actionBody.isDirectBuy=="true"){//直接下单需执行添加订单业务员操作
if(aliPushRes && aliPushRes.status==0){
if(aliPushRes.data && aliPushRes.data.data){
......@@ -357,14 +357,14 @@ class CenterorderService extends AppServiceBase {
var salesmanRes = JSON.parse(addRes.stdout);
if (salesmanRes.status == 0) {
deliveryObj.actionBody.needsolution = salesmanRes.data;
await this.utilsPushSve.aliBusiness2Delivery(deliveryObj, "pushDeliveryOrder");
await this.utilsPushSve.business2Channel(deliveryObj, "pushDeliveryOrder");
}
}
}
}
}else {
this.utilsPushSve.aliBusiness2Delivery(deliveryObj, "pushDeliveryOrder");
this.utilsPushSve.business2Channel(deliveryObj, "pushDeliveryOrder");
}
return system.getResultSuccess();
}
......@@ -648,6 +648,18 @@ class CenterorderService extends AppServiceBase {
pobj.actionBody.regType = "baidu.radiotv";
}
if(pobj && pobj.appInfo && pobj.appInfo.uapp_id && pobj.appInfo.uapp_id=='52'){
if (pobj.actionBody.channelItemCode == '5') {
pobj.actionBody.regType = "yiming.icp";
} else if (pobj.actionBody.channelItemCode == '7') {
pobj.actionBody.regType = "yiming.edi";
}
else if (pobj.actionBody.channelItemCode == 'icpnb') {
pobj.actionBody.regType = "yiming.icpnb";
}else if (pobj.actionBody.channelItemCode == 'edinb') {
pobj.actionBody.regType = "yiming.edinb";
}
}
var fqobj = {
actionBody: {
area: pobj.actionBody.province,
......@@ -663,7 +675,7 @@ class CenterorderService extends AppServiceBase {
},
appInfo: pobj.appInfo
}
var baiduPushRes = await this.utilsPushSve.baiduBusiness2Fq(fqobj, "pushOrderICPBusinessNew");
var baiduPushRes = await this.utilsPushSve.business2Channel(fqobj, "pushOrderICPBusinessNew");
var deliveryObj = {
actionBody: {
orderNo: orderrtn.data.orderNo,//pobj.actionBody.channelOrder.channelOrderNo,
......@@ -697,20 +709,169 @@ class CenterorderService extends AppServiceBase {
var salesmanRes = JSON.parse(addRes.stdout);
if (salesmanRes.status == 0) {
deliveryObj.actionBody.needsolution = salesmanRes.data;
await this.utilsPushSve.baiduBusiness2Delivery(deliveryObj, "pushDeliveryOrder");
await this.utilsPushSve.business2Channel(deliveryObj, "pushDeliveryOrder");
}
}
}
}
}else{
this.utilsPushSve.baiduBusiness2Delivery(deliveryObj, "pushDeliveryOrder");
this.utilsPushSve.business2Channel(deliveryObj, "pushDeliveryOrder");
}
return system.getResultSuccess();
}
//获取易名的icp产品信息
async getymicpProduce(pobj) {
pobj.actionType = 'getymicpProduce'
let url = settings.centerAppUrl() + "action/opProduct/springBoard";
return await this.restPostUrl(pobj, url);
}
async tmPaySuccess(pobj) {
// var sobj = {
// actionType: "getProduceByChannelItemCode",
// actionBody: { typeCode: pobj.actionBody.channelTypeCode},
// appInfo: pobj.appInfo,
// actionProcess: pobj.actionProcess
// }
// var url = settings.centerAppUrl() + "action/opProduct/springBoard";
// var rtn = await this.execClient.execPost(sobj, url);
// if (!rtn || !rtn.stdout) {
// return system.getResultFail(-5010, "产品查询失败");
// }
// var data = JSON.parse(rtn.stdout);
// if (data.status != 0) {
// return system.getResultFail(-5010, "产品查询失败");
// }
// pobj.actionBody.orderNo = pobj.actionBody.bizId;
// pobj.actionBody.totalSum = data.data.price;
// pobj.actionBody.orderPrice = data.data.price;
// pobj.actionBody.payTotalSum = data.data.price;
// pobj.actionBody.payCode = data.data.payCode;
// pobj.actionBody.channelItemCode = data.data.channelItemCode;
// pobj.actionBody.channelNeedNo = data.data.channelNeedNo;
// pobj.actionBody.needNo = data.data.needNo;
// pobj.actionBody.quantity = 1;
// pobj.actionBody.channelOrder = {
// channelServiceNo: pobj.actionBody.orderNo,
// channelOrderNo: pobj.actionBody.orderNo,
// orderStatus: 2
// }
// var orderrtn = await this.utilsOrderSve.addOrder(pobj, pobj.actionBody);
// if (orderrtn.status != 0 && orderrtn.status != -1) {
// return system.getResultFail(-5012, "订单创建失败");
// }
// if (orderrtn.data) {
// pobj.actionBody.orderNo = orderrtn.data.orderNo;
// }
// pobj.actionBody.channelSolutionNo = pobj.actionBody.bizId;
// pobj.actionType = "receiveSolutionPayInfoNew";
// var url = settings.centerOrderUrl() + "action/icapi/springBoard";
// var solutionrtn = await this.execClient.execPost(pobj, url);
// if (!solutionrtn || !solutionrtn.stdout) {
// return system.getResultFail(-5011, "方案查询失败");
// }
// var solutiondata = JSON.parse(solutionrtn.stdout);
// if (solutiondata.status != 0) {
// return system.getResultFail(-5011, "方案查询失败");
// }
// if (!solutiondata.data) {
// return system.getResultFail(-5012, "方案查询数据为空");
// }
// if (solutiondata.data && solutiondata.data.channelNeedNo) {
// pobj.actionBody.needId = solutiondata.data.channelNeedNo;
// }
// if (pobj.actionBody.channelItemCode == '5') {
// pobj.actionBody.regType = "baidu.icp";
// } else if (pobj.actionBody.channelItemCode == '7') {
// pobj.actionBody.regType = "baidu.edi";
// }
// else if (pobj.actionBody.channelItemCode == 'NC') {
// pobj.actionBody.regType = "baidu.wangwen";
// }
// else if (pobj.actionBody.channelItemCode == 'RT') {
// pobj.actionBody.regType = "baidu.radiotv";
// }
// if(pobj && pobj.appInfo && pobj.appInfo.uapp_id && pobj.appInfo.uapp_id=='52'){
// if (pobj.actionBody.channelItemCode == '5') {
// pobj.actionBody.regType = "yiming.icp";
// } else if (pobj.actionBody.channelItemCode == '7') {
// pobj.actionBody.regType = "yiming.edi";
// }
// else if (pobj.actionBody.channelItemCode == 'icpnb') {
// pobj.actionBody.regType = "yiming.icpnb";
// }else if (pobj.actionBody.channelItemCode == 'edinb') {
// pobj.actionBody.regType = "yiming.edinb";
// }
// }
// var fqobj = {
// actionBody: {
// area: pobj.actionBody.province,
// idempotentSource: pobj.actionBody.regType,
// orderNo: pobj.actionBody.channelOrder.channelOrderNo,
// orderPrice: Number(pobj.actionBody.orderPrice / 100),
// phone: pobj.actionBody.publishMobile,
// needId: solutiondata.data.channelNeedNo,
// companyName:solutiondata.data.solutionContent.solution.CompanyName || '',
// //2021-1-21 laolan add new
// appName:pobj.appInfo.app_name || '',
// sku:data.data.service_code || ''
// },
// appInfo: pobj.appInfo
// }
// var baiduPushRes = await this.utilsPushSve.baiduBusiness2Fq(fqobj, "pushOrderICPBusinessNew");
// var deliveryObj = {
// actionBody: {
// orderNo: orderrtn.data.orderNo,//pobj.actionBody.channelOrder.channelOrderNo,
// needsolution: solutiondata.data.solutionContent,
// channelNeedNo: solutiondata.data.channelNeedNo,
// channelSolutionNo: solutiondata.data.channelSolutionNo,
// skuCode: data.data.payCode,
// servicer: {
// code: 'gsb',
// name: '公司宝'
// }
// },
// appInfo: pobj.appInfo
// };
// if(pobj.actionBody.isDirectBuy && pobj.actionBody.isDirectBuy==1){//直接下单需执行添加订单业务员操作
// if(baiduPushRes && baiduPushRes.status==0){
// if(baiduPushRes.data && baiduPushRes.data.data){
// var resData = baiduPushRes.data.data;
// var salesmanInfo = {
// salesmanName:resData.orderList && resData.orderList.length>0?resData.orderList[0].operatorName:"",
// salesmanChannelId:resData.orderList && resData.orderList.length>0?resData.orderList[0].operator:"",
// };
// var salesmanObj={
// appInfo:pobj.appInfo,
// actionType:"addIcpSalesmanInfo",//添加业务员信息
// actionBody:{salesmanInfo:salesmanInfo,orderNo:orderrtn.data.orderNo}
// };
// var url = settings.centerOrderUrl() + "action/qcapi/springBoard";
// var addRes = await this.execClient.execPost(salesmanObj, url);
// if (addRes && addRes.stdout) {
// var salesmanRes = JSON.parse(addRes.stdout);
// if (salesmanRes.status == 0) {
// deliveryObj.actionBody.needsolution = salesmanRes.data;
// await this.utilsPushSve.baiduBusiness2Delivery(deliveryObj, "pushDeliveryOrder");
// }
// }
// }
// }
// }else{
// this.utilsPushSve.baiduBusiness2Delivery(deliveryObj, "pushDeliveryOrder");
// }
return system.getResultSuccess();
}
}
module.exports = CenterorderService;
// var task = new CenterorderService();
// var pobj={
// "actionType":"submitProgramme",
// "actionBody":{
......
......@@ -3,54 +3,70 @@ const ServiceBase = require("../../sve.base");
var settings = require("../../../../config/settings");
const uuidv4 = require('uuid/v4');
const getRawBody = require('raw-body');
class GatewaypushlogService extends ServiceBase {
constructor() {
super("common", ServiceBase.getDaoName(GatewaypushlogService));
this.execClient = system.getObject("util.execClient");
this.dingClient = system.getObject("util.dingClient");
}
constructor() {
super("common", ServiceBase.getDaoName(GatewaypushlogService));
this.execClient = system.getObject("util.execClient");
this.dingClient = system.getObject("util.dingClient");
}
async taskAliIcapi() {
try {
var sql = "select * from gateway_pushlog where pushStatus='wts' and pushtimes<4"
var icloginfos = await this.customQuery(sql);
if (icloginfos.length > 0) {
var count = 100;
if (icloginfos.length < count) {
count = icloginfos.length;
}
var self = this;
for (var i = 0; i < count; i++) {
var icloginfo = icloginfos[i];
var requestdata = null;
if (icloginfo && icloginfo.requestjson) {
requestdata = JSON.parse(icloginfo.requestjson);
}
var url = settings.gatewayUrl() + "action/intentionapi/springBoard";
var rtn = await self.execClient.execPost(requestdata, url);
var data = JSON.parse(rtn.stdout);
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)
async taskAliIcapi() {
try {
var sql = "select * from gateway_pushlog where pushStatus='wts' and pushtimes<4"
var icloginfos = await this.customQuery(sql);
if (icloginfos.length > 0) {
var count = 100;
if (icloginfos.length < count) {
count = icloginfos.length;
}
var self = this;
for (var i = 0; i < count; i++) {
try {
var icloginfo = icloginfos[i];
var requestdata = null;
if (icloginfo && icloginfo.requestjson) {
requestdata = JSON.parse(icloginfo.requestjson);
}
var url = settings.gatewayUrl() + "action/intentionapi/springBoard";
var rtn = await self.execClient.execPost(requestdata, url);
var data = rtn
data = JSON.parse(rtn.stdout);
if (data.success) {
icloginfo.pushStatus = "yts";
} else {
if (data.errorMsg != "状态错误") {//除1 2 4 11其它状态没处理、返回的状态错误
data.push_url = url;
data.api = "center-channel/taskAliIcapi-for";
data.requestdata = requestdata;
data.message = "error info";
this.dingClient.gatewayPushError(data);
}
icloginfo.error = JSON.stringify(data);
icloginfo.pushtimes += 1;
}
this.update(icloginfo);
} catch (e) {
const stackStr = e.stack ? e.stack : JSON.stringify(e);
icloginfo.error = stackStr;
this.update(icloginfo);
this.dingClient.gatewayPushError({
message: "Exception info",
api: "center-channel/taskAliIcapi-for",
e
})
}
}
}
icloginfo.pushtimes += 1;
}
await this.update(icloginfo);
}
}
return system.getResultSuccess();
return system.getResultSuccess();
} catch (error) {
this.dingClient.gatewayPushError({message:"Exception",api:"center-channel/taskAliIcapi"})
return system.getResultFail(-1,error);
} catch (error) {
this.dingClient.gatewayPushError({message: "Exception", api: "center-channel/taskAliIcapi", error})
return system.getResultFail(-1, error);
}
}
}
}
module.exports = GatewaypushlogService;
......@@ -123,7 +123,7 @@ class NcService extends AppServiceBase {
appInfo: pobj.appInfo
}
var self = this;
self.utilsPushSve.aliBusiness2Delivery(reqParams, "updateChanceStatus");
self.utilsPushSve.business2Channel(reqParams, "updateChanceStatus");
//日志记录
self.logCtl.info({
appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "",
......@@ -206,16 +206,7 @@ class NcService extends AppServiceBase {
var reqUrl = this.centerOrderUrl + "action/qcapi/springBoard";
var result = await this.restPostUrl(pobj, reqUrl);
console.log('nc 关闭需求result-----',result)
if (result.status == 0) {
if (result.data && result.data.orderNo) {
pobj.actionBody.orderNo = result.data.orderNo;
var orderrtn = await this.utilsOrderSve.delOrder(pobj, pobj.actionBody);
console.log("orderrtn +++ +++ ++",orderrtn)
if (orderrtn.status < 0) {
return system.getResultFail(-5022, "订单关闭失败");
}
}
if (result && result.status == 0) {
//推送交付系统
var reqParams = {
actionBody: {
......@@ -225,7 +216,7 @@ class NcService extends AppServiceBase {
opType: "updateChanceStatus",
appInfo: pobj.appInfo
}
this.utilsPushSve.aliBusiness2Delivery(reqParams, "updateChanceStatus");
this.utilsPushSve.business2Channel(reqParams, "updateChanceStatus");
//日志记录
this.logCtl.info({
appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "",
......@@ -246,7 +237,7 @@ class NcService extends AppServiceBase {
var a = await this.baiduclient.baiduReqbyget({ path: "/api/bla/provider/requirement/update", reqbody: pushObj});
console.log('nc closeNeed+++',a)
}
this.utilsPushSve.aliBusiness2Fq(pobj, "pushCloseICPNeed");
this.utilsPushSve.business2Channel(pobj, "pushCloseICPNeed");
}
return result;
}
......
......@@ -51,6 +51,45 @@ class PushlogService extends ServiceBase {
return result;
}
async getPushFailLogList(actionBody) {
var sql = "SELECT id,appid,`content`,failType,pushNumber,opTitle,resultInfo,created_at FROM `center_channel_pushfaillog` WHERE pushNumber=10 ";
let whereParams = {};
if(actionBody.appid){
sql += " and appid = :appid";
whereParams.appid = actionBody.appid;
}
if(actionBody.likeStr){
sql += " and content like :likeStr";
whereParams.likeStr = "%"+ actionBody.likeStr +"%";
}
sql += " order by created_at desc"
var list = await this.pushfaillogDao.customQuery(sql,whereParams);
var result = system.getResultSuccess(list);
return result;
}
/**
* 重新推送
* @param actionBody
* @returns {Promise<void>}
*/
async rePush(actionBody){
let content = actionBody.content;
let sql = 'update `center_channel_pushfaillog` set pushNumber = :pushNumber';
let params = {
pushNumber: actionBody.pushNumber || 9
}
if(Object.keys(content).length>0){
sql += ',content=:content';
params.content = JSON.stringify(actionBody.content);
}
sql += ' where id = :id';
params.id = actionBody.id;
let result = await this.customUpdate(sql,params);
return system.getResult(result);
}
async addPublicServiceLog(pobj, req) {
var sql = "INSERT INTO `igirl_api`.`center_channel_public_servicelog` (`appkey`,`pushUrl`,`pushContent`,`resultInfo`,`pushNumber`,`clientIp`,created_at)" +
"VALUES(:appkey,:pushUrl,:pushContent,:resultInfo,:pushNumber,:clientIp,:created_at)";
......
......@@ -74,7 +74,7 @@ class QcCenterOrderService extends AppServiceBase {
},
appInfo: pobj.appInfo
}
this.utilsPushSve.aliBusiness2Delivery(reqParams, "updateChanceStatus");
this.utilsPushSve.business2Channel(reqParams, "updateChanceStatus");
//
return system.getResultSuccess(pushIcpSolutionRes);
}
......
......@@ -126,7 +126,7 @@ class RegCenterOrderService extends AppServiceBase {
appInfo: pobj.appInfo
}
console.log('fqobj----',fqobj)
var baiduPushRes = await this.utilsPushSve.baiduBusiness2Fq(fqobj, "pushOrderICPBusinessNew");
var baiduPushRes = await this.utilsPushSve.business2Channel(fqobj, "pushOrderICPBusinessNew");
var deliveryObj = {
actionBody: {
orderNo: orderrtn.data.orderNo,//pobj.actionBody.channelOrder.channelOrderNo,
......@@ -160,14 +160,14 @@ class RegCenterOrderService extends AppServiceBase {
var salesmanRes = JSON.parse(addRes.stdout);
if (salesmanRes.status == 0) {
deliveryObj.actionBody.needsolution = salesmanRes.data;
await this.utilsPushSve.baiduBusiness2Delivery(deliveryObj, "pushDeliveryOrder");
await this.utilsPushSve.business2Channel(deliveryObj, "pushDeliveryOrder");
}
}
}
}
}else{
this.utilsPushSve.baiduBusiness2Delivery(deliveryObj, "pushDeliveryOrder");
this.utilsPushSve.business2Channel(deliveryObj, "pushDeliveryOrder");
}
return system.getResultSuccess();
}
......@@ -217,13 +217,15 @@ class RegCenterOrderService extends AppServiceBase {
var url = settings.centerAppUrl() + "action/opProduct/springBoard";
var rtn = await this.execClient.execPost(sobj, url);
if (!rtn || !rtn.stdout) {
return system.getResultFail(-5015, "需求型查询失败");
return system.getResultFail(-5015, "需求型查询失败");
}
var data = JSON.parse(rtn.stdout);
if (data.status != 0) {
return system.getResultFail(-5016, "需求型查询失败");
return system.getResultFail(-5016, "需求型查询失败");
}
pobj.actionBody.service_product_id= data.data.service_product_id;
pobj.actionBody.productId = data.data.service_product_id;
pobj.actionBody.appName = pobj.appInfo.app_name;
pobj.actionBody.type_code = data.data.type_code;
pobj.actionBody.type_name = data.data.type_name;
pobj.actionBody.channel_type_code = data.data.channel_type_code;
......@@ -263,9 +265,7 @@ class RegCenterOrderService extends AppServiceBase {
pobj.actionBody.idempotentId = pobj.actionBody.intentionBizId;
// pobj.actionBody.idempotentSource = pobj.actionBody.type;
pobj.actionBody.customerName = pobj.actionBody.userName;
//2021-1-21 laolan add new
pobj.actionBody.appName = pobj.appInfo.app_name || '',
this.utilsPushSve.baiduBusiness2Fq(pobj, "pushNeedICPBusinessNew");
this.utilsPushSve.business2Channel(pobj, "pushNeedICPBusinessNew");
}
return result;
}
......@@ -286,7 +286,7 @@ class RegCenterOrderService extends AppServiceBase {
if (pobj.intentionStatus) {
// 如果需求当前字段为5(已关闭)则通知fq
if (pobj.intentionStatus == 5) {
self.utilsPushSve.baiduBusiness2Fq(pobj, "pushCloseICPNeed");
self.utilsPushSve.business2Channel(pobj, "pushCloseICPNeed");
}
}
var data = JSON.parse(rtn.stdout);
......@@ -324,7 +324,7 @@ class RegCenterOrderService extends AppServiceBase {
},
appInfo: pobj.appInfo
}
this.utilsPushSve.baiduBusiness2Delivery(deliveryObj, "pushDeliveryOrder");
this.utilsPushSve.business2Channel(deliveryObj, "pushDeliveryOrder");
}
if (rtn.status == 0 && actionBody.status != 1 && actionBody.status != 2 && rtn.data) {
var tmpObj = {
......@@ -335,7 +335,7 @@ class RegCenterOrderService extends AppServiceBase {
},
appInfo: pobj.appInfo
}
this.utilsPushSve.baiduBusiness2Delivery(tmpObj, "pushDeliveryStatusNotify");
this.utilsPushSve.business2Channel(tmpObj, "pushDeliveryStatusNotify");
pobj.actionBody.orderNo = rtn.data.orderNo;
if (actionBody.status == 11) {
var orderrtn = await self.utilsOrderSve.delOrder(pobj, pobj.actionBody);
......@@ -343,7 +343,7 @@ class RegCenterOrderService extends AppServiceBase {
return system.getResultFail(-5022, "订单关闭失败");
}
tmpObj.actionBody.orderNo = rtn.data.channelSolutionNo;
self.utilsPushSve.baiduBusiness2Fq(tmpObj, "pushOrderICPClose");
self.utilsPushSve.business2Channel(tmpObj, "pushOrderICPClose");
}
}//通知更新状态
return rtn;
......@@ -352,18 +352,18 @@ class RegCenterOrderService extends AppServiceBase {
//关闭reg订单
async regOrderClose(pobj) {
var actionBody = pobj.actionBody;
// var actionBody = pobj.actionBody;
var self = this;
var url = settings.centerOrderUrl() + "action/regapi/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;
pobj.actionType="delOrder";
var orderrtn = await self.utilsOrderSve.delOrder(pobj, actionBody);
if (orderrtn.status < 0) {
return system.getResultFail(-5022, "订单关闭失败");
}
// pobj.actionBody.orderNo = rtn.data.orderNo;
// pobj.actionType="delOrder";
// var orderrtn = await self.utilsOrderSve.delOrder(pobj, actionBody);
// if (orderrtn.status < 0) {
// return system.getResultFail(-5022, "订单关闭失败");
// }
var tmpObj = {
actionBody: {
orderNo: rtn.data.orderNo,
......@@ -372,7 +372,7 @@ class RegCenterOrderService extends AppServiceBase {
},
appInfo: pobj.appInfo
}
this.utilsPushSve.baiduBusiness2Delivery(tmpObj, "pushDeliveryStatusNotify");
this.utilsPushSve.business2Channel(tmpObj, "pushDeliveryStatusNotify");
// tmpObj.actionBody.orderNo = channelOrderNo;
var tmpObj2 = {
actionBody: {
......@@ -382,7 +382,7 @@ class RegCenterOrderService extends AppServiceBase {
},
appInfo: pobj.appInfo
};
self.utilsPushSve.baiduBusiness2Fq(tmpObj2, "pushOrderICPClose");
self.utilsPushSve.business2Channel(tmpObj2, "pushOrderICPClose");
}//通知更新状态
return rtn;
}
......@@ -474,7 +474,7 @@ class RegCenterOrderService extends AppServiceBase {
},
appInfo: pobj.appInfo
}
await this.utilsPushSve.baiduBusiness2Delivery(reqParams, "updateChanceStatus");
await this.utilsPushSve.business2Channel(reqParams, "updateChanceStatus");
}
return res;
}
......@@ -506,23 +506,8 @@ class RegCenterOrderService extends AppServiceBase {
var reqUrl = this.centerOrderUrl + "action/regapi/springBoard";
var result = await this.restPostUrl(pobj, reqUrl);
console.log('regNeedClose+++result', result)
var i;
var len;
if(result && result.data ){
len = result.data.length
}
var orders = []
if (result.status == 0) {
for(i=0;i<len;i++){
if (result.data && result.data[i].orderNo) {
orders.push(result.data[i].orderNo)
pobj.actionBody.orderNo = orders;
var orderrtn = await this.utilsOrderSve.delOrders(pobj, pobj.actionBody);
if (orderrtn.status < 0) {
return system.getResultFail(-5022, "订单关闭失败");
}
}
}
if (result && result.status == 0) {
//推送交付系统
var reqParams = {
actionBody: {
......@@ -532,7 +517,7 @@ class RegCenterOrderService extends AppServiceBase {
opType: "updateChanceStatus",
appInfo: pobj.appInfo
}
this.utilsPushSve.baiduBusiness2Delivery(reqParams, "updateChanceStatus");
this.utilsPushSve.business2Channel(reqParams, "updateChanceStatus");
//日志记录
this.logCtl.info({
appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "",
......@@ -561,7 +546,7 @@ class RegCenterOrderService extends AppServiceBase {
resultInfo: "",
optitle: "推送baidu-reg关闭需求->closeNeed",
});
this.utilsPushSve.baiduBusiness2Fq(pobj, "pushCloseICPNeed");
this.utilsPushSve.business2Channel(pobj, "pushCloseICPNeed");
}
return result;
......@@ -638,7 +623,7 @@ class RegCenterOrderService extends AppServiceBase {
opType: "updateChanceStatus",
appInfo: pobj.appInfo
}
self.utilsPushSve.baiduBusiness2Delivery(reqParams, "updateChanceStatus");
self.utilsPushSve.business2Channel(reqParams, "updateChanceStatus");
var fqobj = {
actionBody: {
"bizId": pobj.actionBody.intentionBizId,
......@@ -648,7 +633,7 @@ class RegCenterOrderService extends AppServiceBase {
opType: "aliFollowup",
appInfo: pobj.appInfo
}
self.utilsPushSve.baiduBusiness2Fq(fqobj, "aliFollowup");
self.utilsPushSve.business2Channel(fqobj, "aliFollowup");
return result
}
......
......@@ -126,7 +126,7 @@ class RtService extends AppServiceBase {
appInfo: pobj.appInfo
}
var self = this;
self.utilsPushSve.aliBusiness2Delivery(reqParams, "updateChanceStatus");
self.utilsPushSve.business2Channel(reqParams, "updateChanceStatus");
//日志记录
self.logCtl.info({
appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "",
......@@ -209,16 +209,7 @@ class RtService extends AppServiceBase {
var reqUrl = this.centerOrderUrl + "action/qcapi/springBoard";
var result = await this.restPostUrl(pobj, reqUrl);
console.log('rt 关闭需求result-----',result)
if (result.status == 0) {
if (result.data && result.data.orderNo) {
pobj.actionBody.orderNo = result.data.orderNo;
var orderrtn = await this.utilsOrderSve.delOrder(pobj, pobj.actionBody);
console.log("orderrtn +++ +++ ++",orderrtn)
if (orderrtn.status < 0) {
return system.getResultFail(-5022, "订单关闭失败");
}
}
if (result && result.status == 0) {
//推送交付系统
var reqParams = {
actionBody: {
......@@ -228,7 +219,7 @@ class RtService extends AppServiceBase {
opType: "updateChanceStatus",
appInfo: pobj.appInfo
}
this.utilsPushSve.aliBusiness2Delivery(reqParams, "updateChanceStatus");
this.utilsPushSve.business2Channel(reqParams, "updateChanceStatus");
//日志记录
this.logCtl.info({
appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "",
......@@ -249,7 +240,7 @@ class RtService extends AppServiceBase {
var a = await this.baiduclient.baiduReqbyget({ path: "/api/bla/provider/requirement/update", reqbody: pushObj});
console.log('rt closeNeed+++',a)
}
this.utilsPushSve.aliBusiness2Fq(pobj, "pushCloseICPNeed");
this.utilsPushSve.business2Channel(pobj, "pushCloseICPNeed");
}
return result;
}
......
......@@ -176,6 +176,29 @@ module.exports = SignService;
// }
// }
// task.createSign(obj,"7cbb892450174167b5c7e01we4717z51").then(d=>{
// console.log(d,"!!!!!!!!!!!!!!!!!!!!!!!!!!");
//订单
// var obj={
// "isDirectBuy":"1",
// "orderNo":"CR-9T8MhbouU8J-test0001",
// "phone":"15732031337",
// "area":"110100",
// "companyProperties":"有限公司",
// "taxpayerType":"一般纳税人",
// "consultType":"GSREG",
// "companyName":"公司名称",
// "engagedIndustry":"从事行业",
// "bizScope":"经营范围",
// "hasAddress":true
// };
//需求
// var obj={
// "intentionBizId": "baidu_test_000101",
// "phone": "18506013355",
// "userName": "测试03",
// "description": "测试03描述",
// "area": "上海",
// "consultType": "GSREG"
// };
// task.createSign(obj,"7cbb892450174167b5c7e01we4716t51").then(sign=>{
// console.log(sign,"..............Sign");
// });
\ No newline at end of file
......@@ -3,129 +3,222 @@ var settings = require("../../../../config/settings");
const AppServiceBase = require("../../app.base");
class IcbcService extends AppServiceBase {
constructor() {
super();
this.zcApiUrl = settings.reqZcApi();
this.certificationUrl = settings.certificationUrl();
this.restClient = system.getObject("util.redisClient");
//处理企业资质证书数据
this.disposeCertificationData = "disposeCertificationData";
//企业资质证书查询
this.searchCertificationData = "searchCertificationData";
}
//企业模糊查询
async getCompanyListByVague(obj, req) {
var url = this.zcApiUrl + "api/tool/toolApi/getCompanyListByVague";
return await this.opReqResult(url, obj, req);
}
//企业详情
async getDetailByCompanyName(queryobj, req) {
var url = this.zcApiUrl + "api/tool/toolApi/getDetailByCompanyName";
return await this.opReqResult(url, queryobj, req);
}
//企业变更记录查询
async getCompanyChangeByName(queryobj, req) {
var url = this.zcApiUrl + "api/tool/toolApi/getCompanyChangeByName";
return await this.opReqResult(url, queryobj, req);
}
//工商icp证照查询
async getCompanyIcpByName(queryobj, req) {
var url = this.zcApiUrl + "api/tool/toolApi/getCompanyIcpByName";
return await this.opReqResult(url, queryobj, req);
}
constructor() {
super();
this.zcApiUrl = settings.reqZcApi();
this.certificationUrl = settings.certificationUrl();
this.restClient = system.getObject("util.redisClient");
//处理企业资质证书数据
this.disposeCertificationData = "disposeCertificationData";
//企业资质证书查询
this.searchCertificationData = "searchCertificationData";
//result工具类
this.utilsResultSve = system.getObject("service.utilsSve.utilsResultSve");
}
//企业模糊查询
async getCompanyListByVague(obj, req) {
var url = this.zcApiUrl + "api/tool/toolApi/getCompanyListByVague";
return await this.opReqResult(url, obj, req);
}
//企业详情
async getDetailByCompanyName(queryobj, req) {
var url = this.zcApiUrl + "api/tool/toolApi/getDetailByCompanyName";
return await this.opReqResult(url, queryobj, req);
}
//企业变更记录查询
async getCompanyChangeByName(queryobj, req) {
var url = this.zcApiUrl + "api/tool/toolApi/getCompanyChangeByName";
return await this.opReqResult(url, queryobj, req);
}
//工商icp证照查询
async getCompanyIcpByName(queryobj, req) {
var url = this.zcApiUrl + "api/tool/toolApi/getCompanyIcpByName";
return await this.opReqResult(url, queryobj, req);
}
//企业证书查询
// async searchCertification(queryobj, req) {
// if (!queryobj.companyName) {
// return system.getResultFail(-1, 'companyName can not be empty');
// }
// var hashValue = await this.restClient.hget(this.searchCertificationData, queryobj.companyName);
// if (hashValue) {
// return system.getResultSuccess(JSON.parse(hashValue));
// }
// let url = this.certificationUrl + "gsb/SearchCertification";
// let data = {
// "company_name": queryobj.companyName,
// "pageSize": 20,
// "pageIndex": 1,
// "isExactlySame": "True"
// }
// let result = await this.opReqResult(url, data, req);
// if (!result) {
// return system.getResultFail(-1, '查询失败!!!');
// }
// if (result.Status != 200) {
// return system.getResultFail(-1, '查询失败');
// }
// //对结果处理
// // "Tag": 1为qichacha,0为gsb
// var setValue = {};
// setValue[queryobj.companyName] = JSON.stringify(result.Result);
// if (result.Tag == 1) {
// this.restClient.hmset(this.disposeCertificationData, setValue);
// }
// this.restClient.hmset(this.searchCertificationData, setValue);
// return system.getResult(result.Result);
// }
//企业证书查询
// async searchCertification(queryobj, req) {
// if (!queryobj.companyName) {
// return system.getResultFail(-1, 'companyName can not be empty');
// }
// var hashValue = await this.restClient.hget(this.searchCertificationData, queryobj.companyName);
// if (hashValue) {
// return system.getResultSuccess(JSON.parse(hashValue));
// }
// let url = this.certificationUrl + "gsb/SearchCertification";
// let data = {
// "company_name": queryobj.companyName,
// "pageSize": 20,
// "pageIndex": 1,
// "isExactlySame": "True"
// }
// let result = await this.opReqResult(url, data, req);
// if (!result) {
// return system.getResultFail(-1, '查询失败!!!');
// }
// if (result.Status != 200) {
// return system.getResultFail(-1, '查询失败');
// }
// //对结果处理
// // "Tag": 1为qichacha,0为gsb
// var setValue = {};
// setValue[queryobj.companyName] = JSON.stringify(result.Result);
// if (result.Tag == 1) {
// this.restClient.hmset(this.disposeCertificationData, setValue);
// }
// this.restClient.hmset(this.searchCertificationData, setValue);
// return system.getResult(result.Result);
// }
//企业证书查询 用友数据源
async searchCertification(queryobj, req) {
if (!queryobj.companyName) {
return system.getResultFail(-1, 'companyName can not be empty');
}
var hashValue = await this.restClient.hget(this.searchCertificationData, queryobj.companyName);
if (hashValue) {
return system.getResultSuccess(JSON.parse(hashValue));
}
//获取token
let url = settings.icNameUrl() + 'openPlatform/platform/getToken';
let params = {
"accessKey":"111",
"accessSecret":"222"
}
let ret = await this.opReqResult(url,params,req);
if(ret.status != 1){
system.getResultFail(-1,'获取开放平台token失败');
}
let token = ret.data;
//企业证书查询 用友数据源
async searchCertification(queryobj, req) {
if (!queryobj.companyName) {
return system.getResultFail(-1, 'companyName can not be empty');
}
var hashValue = await this.restClient.hget(this.searchCertificationData, queryobj.companyName);
if (hashValue) {
return system.getResultSuccess(JSON.parse(hashValue));
}
//获取token
let url = settings.icNameUrl() + 'openPlatform/platform/getToken';
let params = {
"accessKey": "111",
"accessSecret": "222"
}
req.headers.token='sss'
let ret = await this.opReqResult(url, params, req);
if (ret.status != 1) {
return system.getResultFail(-1, '获取开放平台token失败');
}
let token = ret.data;
url = settings.icNameUrl() + "openPlatform/busenterprise/cloudapi";
let data = {
"path":"/apis/dst/patents/certificate",
"name": queryobj.companyName
}
let rtn = await this.execClient.restGetWithHAuthorizationUrl(token,url, data);
if (!rtn || !rtn.stdout) {
return system.getResult(null, "restPostWithHAuthorizationUrl data is empty");
url = settings.icNameUrl() + "openPlatform/busenterprise/cloudapi";
//资质查询
let data = {
// "path": "/apis/dst/patents/getLicense",
"path": "/apis/dst/patents/certificate",
"name": queryobj.companyName,
"pageNum":1
};
let rtn = await this.execClient.restGetWithHAuthorizationUrl(token, url, data);
if (!rtn || !rtn.stdout) {
return system.getResult(null, "restPostWithHAuthorizationUrl data is empty");
};
var result = JSON.parse(rtn.stdout);
if (!result) {
return system.getResultFail(-1, '查询失败!!!');
}
if (result.error_code != 0) {
return system.getResultFail(-1, '查询失败');
}
let item = result.result.items;
//对结果处理
// "Tag": 1为qichacha,0为gsb
var setValue = {};
setValue[queryobj.companyName] = JSON.stringify(item);
// if (result.Tag == 1) {
// this.restClient.hmset(this.disposeCertificationData, setValue);
// }
this.restClient.hmset(this.searchCertificationData, setValue);
return system.getResult(item);
}
var result = JSON.parse(rtn.stdout);
if (!result) {
return system.getResultFail(-1, '查询失败!!!');
}
if (result.error_code != 0) {
return system.getResultFail(-1, '查询失败');
/**
* 获取资质证书(集合)
* @param obj
* @param req
* @returns {Promise<void>}
*/
async getLicenseList(obj,req){
let companyName = obj.companyName;
let url = settings.icNameUrl() + 'openPlatform/platform/getToken';
let params = {
"accessKey": "111",
"accessSecret": "222"
}
req.headers.token='sss'
let ret = await this.opReqResult(url, params, req);
if (ret.status != 1) {
return system.getResultFail(-1, '获取开放平台token失败');
}
let token = ret.data;
let url2 = settings.icNameUrl() + "/openPlatform/busenterprise/cloudapi";
let params1 = {
"path": "/apis/dst/patents/certificate",
"name": companyName,
"pageNum":1
}
let params2 = {
"path": "/apis/dst/patents/getLicense",
"name": companyName,
"pageNum":1
}
let params3 = {
"companyName":companyName
}
let funcs = [];
funcs.push(this.execClient.restGetWithHAuthorizationUrl(token, url2, params1));
funcs.push(this.execClient.restGetWithHAuthorizationUrl(token, url2, params2));
funcs.push(this.getCompanyIcpByName(params3,req));
let results = await Promise.all(funcs);
if(results.length==0){
return system.getResultFail(-1,'查询失败,请稍后再试');
}
let ret1 = JSON.parse(results[0].stdout);
let ret2 = JSON.parse(results[1].stdout);
let ret3 = results[2];
let resultData = [];
if(ret1.error_code == 0 && ret1.result.items.length >0){
for(let i =0;i<ret1.result.items.length;i++){
let d = ret1.result.items[i];
let obj = {
licencenumber:d.certNo,
licencename:d.certificateName,
startDate:d.startDate,
endDate:d.endDate,
detail:d.detail
};
resultData.push(obj);
}
}
if(ret2.error_code == 0 && ret2.result.items.length >0){
for(let i =0;i<ret2.result.items.length;i++){
let d = ret2.result.items[i];
let obj = {
licencenumber:d.licencenumber,
licencename:d.licencename,
startDate:d.fromdate,
endDate:d.todate,
detail:d.detail
};
if(!resultData.includes(obj)){
resultData.push(obj);
}
}
}
if(ret3.status == 0 && ret3.data.list.length>0){
for(let i =0;i<ret3.data.list.length;i++){
let d = ret3.data.list[i];
let obj = {
licencenumber:d.liscense,
licencename:"icp备案",
examine_date:d.examine_date
};
resultData.push(obj);
}
}
return system.getResultSuccess(resultData);
}
let item = result.result.items;
//对结果处理
// "Tag": 1为qichacha,0为gsb
var setValue = {};
setValue[queryobj.companyName] = JSON.stringify(item);
// if (result.Tag == 1) {
// this.restClient.hmset(this.disposeCertificationData, setValue);
// }
this.restClient.hmset(this.searchCertificationData, setValue);
return system.getResult(item);
}
async opReqResult(reqUrl, queryobj, req) {
var rtn = await this.execClient.execPushDataPost(queryobj, reqUrl, req.headers["token"], req.headers["request-id"]);
var data = JSON.parse(rtn.stdout);
return data;
}
async opReqResult(reqUrl, queryobj, req) {
var rtn = await this.execClient.execPushDataPost(queryobj, reqUrl, req.headers["token"], req.headers["request-id"]);
var data = JSON.parse(rtn.stdout);
return data;
}
}
module.exports = IcbcService;
module.exports = IcbcService;
\ No newline at end of file
......@@ -82,7 +82,7 @@ class utils360Sve extends AppServiceBase {
content: JSON.stringify(pushObj),//推送的参数信息
resultInfo: JSON.stringify(result),
returnType: '1',
logLevel: '1',
logLevel: 1,
opTitle: "推送360信息返回成功"
});
} else {
......
......@@ -21,7 +21,7 @@ class utilsDeliverSve extends AppServiceBase{
return system.getResultFail();
}
pobj.actionBody = verifyResult.data;
this.utilsPushSve.aliBusiness2Delivery(pobj, "pushTmReDeliver");
this.utilsPushSve.business2Channel(pobj, "pushTmReDeliver");
return system.getResultSuccess();
}catch (e) {
return system.getResultFail();
......@@ -123,7 +123,7 @@ class utilsDeliverSve extends AppServiceBase{
if(orderResult.data && orderResult.data.orderStatus === 2){
// 推送交付中心
pobj.actionBody = verifyResult.data;
this.utilsPushSve.aliBusiness2Delivery(pobj, "pushTmReDeliver");
this.utilsPushSve.business2Channel(pobj, "pushTmReDeliver");
}
return result;
}catch (e) {
......
......@@ -45,7 +45,7 @@ class UtilsFgbusinesschancService extends AppServiceBase {
}
var tmpResult = await self.restPostUrl(tmpPobj, reqUrl);
if (tmpResult.status == 0) {
self.utilsPushSve.aliBusiness2Fq(tmpPobj, "pushRePurchaseBusiness");
self.utilsPushSve.business2Channel(tmpPobj, "pushRePurchaseBusiness");
}
}
}
......
var system = require("../../../system");
const AppServiceBase = require("../../app.base");
var settings = require("../../../../config/settings");
const { json } = require("sequelize");
const {json} = require("sequelize");
const {AREACOMM} = require("../../../../config/businessConfig");
//此类用来db中配置来进行调用-主要功能是推送蜂擎业务
class UtilsFqAliyunService extends AppServiceBase {
constructor() {
super();
this.ucommuneOperatorPhone = settings.ucommuneOperatorPhone()
}
async pushOrderBusinessByProductCode2Fq(pobj) {//推送自定义产品码的订单商机到峰擎(订单已经支付成功才推送)
console.log(JSON.stringify(pobj), ".................pushOrderBusinessByProductCode2Fq...............pobj");
var verifyResult = await this.verifyParam(pobj);
var orderInfo = pobj.actionBody.order_info;
var orderContact = pobj.actionBody.order_contact ? pobj.actionBody.order_contact : pobj.actionBody.delivery_content.orderContact;
var productInfo = pobj.actionBody.product_info;
if (!orderInfo) {
verifyResult = system.getResult(null, "orderInfo can not be empty,100420");
}
if (!orderInfo.orderStatus || orderInfo.orderStatus < 2) {
verifyResult = system.getResult(null, "orderInfo status must be paid,100423");
}
if (!orderContact || !orderContact.mobile) {
verifyResult = system.getResult(null, "orderInfo.orderContact.mobile can not be empty,100425");
}
if (!productInfo || !productInfo.service_business_code) {
verifyResult = system.getResult(null, "orderInfo.productInfo.service_business_code can not be empty,100427");
}
if (!['360.icp', '360.edi'].includes(productInfo.service_business_code)) {
if (!productInfo || !productInfo.price_item || !productInfo.price_item.service_code) {
verifyResult = system.getResult(null, "orderInfo.productInfo.price_item.service_code can not be empty,100430");
}
}
if (verifyResult.status != 0) {
return await this.disposePushResultFail(pobj, verifyResult, "fq->pushOrderBusinessByProductCode2Fq->verifyResult", this.pushlogFailType.FQ);
constructor() {
super();
this.centerOrderUrl = settings.centerOrderUrl();
this.ucommuneOperatorPhone = settings.ucommuneOperatorPhone()
}
var interface_params_info = verifyResult.data;
var ucommuneOperatorPhone = pobj.appInfo && pobj.appInfo.contact_mobile ? pobj.appInfo.contact_mobile : this.ucommuneOperatorPhone
console.log("推送的业务员手机号为:", ucommuneOperatorPhone)
var params = {
idempotentId: orderInfo.orderNo,// 是 业务 ID
idempotentSource: productInfo.service_business_code,// 是 业务来源(ic_jdyun、ic_ali)
idempotentSourceName: productInfo.service_business_name || productInfo.service_business_code,// 是 京东云应用、阿里云应用
area: productInfo.price_item.price_desc,// 否 所属城市
phone: orderContact.mobile,// 是 手机号
userId: orderInfo.channelUserId,// 否 用户 ID
companyName: "",// 否 公司名称
orderNo:orderInfo.orderNo,
orderPrice: orderInfo.totalSum,// 是 订单金额
productId: productInfo.price_item.service_code,// 是 产品 ID
productQuantity: orderInfo.quantity,// 是 产品数量
operator_phone: ucommuneOperatorPhone, // 2020 0704 推送fq 必填字段 这里以下为新增 7.7修改由写死改为从settings获取
createdat: orderInfo.created_at,// 2020 0722 lin新增 张超推送文档新增必填字段
thirdPartyCustomerId: orderInfo.channelUserId,
pay_flow_no: orderInfo.pay_flow_no,// 支付流水号
pay_channel: orderInfo.pay_channel,// 支付渠道(微信、支付宝)(必填)
pay_time: orderInfo.pay_time,//付款时间
pay_payer_bank_no: orderInfo.pay_payer_bank_no,//付款人账号
sku: productInfo.price_item.service_code,
appName: pobj.appInfo.app_name
};
// var result = await this.opAliyunClientPost(pobj, "pushOrderBusiness", interface_params_info.opUrl, interface_params_info.key, interface_params_info.secret, params);
var result = await this.opAliyunClientPost(pobj, interface_params_info.opUrl, interface_params_info.key, interface_params_info.secret, params);
return await this.disposePushResult(pobj, result, "fq->pushOrderBusinessByProductCode2Fq->result", this.pushlogFailType.FQ);
}
async pushOrderBusinessByProductCode2Fq(pobj) {//推送自定义产品码的订单商机到峰擎(订单已经支付成功才推送)
console.log(JSON.stringify(pobj), ".................pushOrderBusinessByProductCode2Fq...............pobj");
var verifyResult = await this.verifyParam(pobj);
var orderInfo = pobj.actionBody.order_info;
var orderContact = pobj.actionBody.order_contact ? pobj.actionBody.order_contact : pobj.actionBody.delivery_content.orderContact;
var productInfo = pobj.actionBody.product_info;
if (!orderInfo) {
verifyResult = system.getResult(null, "orderInfo can not be empty,100420");
}
if (!orderInfo.orderStatus || orderInfo.orderStatus < 2) {
verifyResult = system.getResult(null, "orderInfo status must be paid,100423");
}
if (!orderContact || !orderContact.mobile) {
verifyResult = system.getResult(null, "orderInfo.orderContact.mobile can not be empty,100425");
}
if (!productInfo || !productInfo.service_business_code) {
verifyResult = system.getResult(null, "orderInfo.productInfo.service_business_code can not be empty,100427");
}
if (!['360.icp', '360.edi'].includes(productInfo.service_business_code)) {
if (!productInfo || !productInfo.price_item || !productInfo.price_item.service_code) {
verifyResult = system.getResult(null, "orderInfo.productInfo.price_item.service_code can not be empty,100430");
}
}
if (verifyResult.status != 0) {
return await this.disposePushResultFail(pobj, verifyResult, "fq->pushOrderBusinessByProductCode2Fq->verifyResult", this.pushlogFailType.FQ);
}
/**
* 推送阿里信息操作到峰擎
* 阿里操作的信息不变外加增加组装的一些参数(推送工商需求商机、推送工商订单商机、推送关闭工商需求)
* @param {*} pobj
*/
async pushAliBusiness2Fq(pobj) {//推送阿里信息操作到峰擎
var verifyResult = await this.verifyParam(pobj);
if (verifyResult.status != 0) {
return await this.disposePushResultFail(pobj, verifyResult, "fq->pushAliBusiness2Fq->verifyResult", this.pushlogFailType.FQ);
var interface_params_info = verifyResult.data;
var ucommuneOperatorPhone = pobj.appInfo && pobj.appInfo.contact_mobile ? pobj.appInfo.contact_mobile : this.ucommuneOperatorPhone
console.log("推送的业务员手机号为:", ucommuneOperatorPhone)
var params = {
idempotentId: orderInfo.orderNo,// 是 业务 ID
idempotentSource: productInfo.service_business_code,// 是 业务来源(ic_jdyun、ic_ali)
idempotentSourceName: productInfo.service_business_name || productInfo.service_business_code,// 是 京东云应用、阿里云应用
area: productInfo.price_item.price_desc,// 否 所属城市
phone: orderContact.mobile,// 是 手机号
userId: orderInfo.channelUserId,// 否 用户 ID
companyName: "",// 否 公司名称
orderNo: orderInfo.orderNo,
orderPrice: orderInfo.totalSum,// 是 订单金额
productId: productInfo.price_item.service_code,// 是 产品 ID
productQuantity: orderInfo.quantity,// 是 产品数量
operator_phone: ucommuneOperatorPhone, // 2020 0704 推送fq 必填字段 这里以下为新增 7.7修改由写死改为从settings获取
createdat: orderInfo.created_at,// 2020 0722 lin新增 张超推送文档新增必填字段
thirdPartyCustomerId: orderInfo.channelUserId,
pay_flow_no: orderInfo.pay_flow_no,// 支付流水号
pay_channel: orderInfo.pay_channel,// 支付渠道(微信、支付宝)(必填)
pay_time: orderInfo.pay_time,//付款时间
pay_payer_bank_no: orderInfo.pay_payer_bank_no,//付款人账号
sku: productInfo.price_item.service_code,
appName: pobj.appInfo.app_name
};
// var result = await this.opAliyunClientPost(pobj, "pushOrderBusiness", interface_params_info.opUrl, interface_params_info.key, interface_params_info.secret, params);
var result = await this.opAliyunClientPost(pobj, interface_params_info.opUrl, interface_params_info.key, interface_params_info.secret, params);
return await this.disposePushResult(pobj, result, "fq->pushOrderBusinessByProductCode2Fq->result", this.pushlogFailType.FQ);
}
var interface_params_info = verifyResult.data;
var result = await this.opAliyunClientPost(pobj, interface_params_info.opUrl, interface_params_info.key, interface_params_info.secret, pobj.actionBody);
return await this.disposePushResult(pobj, result, "fq->pushAliBusiness2Fq->result", this.pushlogFailType.FQ);
}
//--------------------------------------------------内部辅助方法-------------------start-----------------
async opAliyunClientPost(pobj, url, key, secret, params) {
try {
var rc = system.getObject("util.aliyunClient");
var rtn = await rc.post(url, key, secret, params);
this.logCtl.info({
appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "",
appkey: pobj.appInfo ? pobj.appInfo.uapp_key || "" : "",
requestId: pobj.requestId || "",
op: "service/impl/utilsSve/opAliyunClientPost.js/opAliyunClientPost",
content: rtn,
// clientIp: pobj.clientIp,
optitle: pobj.opType + "推送结果1->fq->opAliyunClientPost",
});
// typeof element === 'string' || typeof element === 'number'
if (typeof rtn.code === 'number' && rtn.code != 200 && rtn.success != true) {
return system.getResult(null, "推送失败,失败原因11:" + JSON.stringify(rtn));
}
if (typeof rtn.code === 'string' && rtn.code != "200" && rtn.success != true) {
return system.getResult(null, "推送失败,失败原因12:" + JSON.stringify(rtn));
}
return system.getResultSuccess(rtn.data, "推送成功");
} catch (e) {
//日志记录
this.logCtl.error({
appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "",
appkey: pobj.appInfo ? pobj.appInfo.uapp_key || "" : "",
requestId: pobj.requestId || "",
op: "service/impl/utilsSve/opAliyunClientPost.js/opAliyunClientPost",
content: "error:" + e.stack,
// clientIp: pobj.clientIp,
optitle: pobj.opType + "推送操作异常->fq->opAliyunClientPost",
});
return system.getResult(null, "推送操作异常->fq->opAliyunClientPost->error:" + e.stack);
/**
* 推送阿里信息操作到峰擎
* 阿里操作的信息不变外加增加组装的一些参数(推送工商需求商机、推送工商订单商机、推送关闭工商需求)
* @param {*} pobj
*/
async pushAliBusiness2Fq(pobj) {//推送阿里信息操作到峰擎
var verifyResult = await this.verifyParam(pobj);
if (verifyResult.status != 0) {
return await this.disposePushResultFail(pobj, verifyResult, "fq->pushAliBusiness2Fq->verifyResult", this.pushlogFailType.FQ);
}
var interface_params_info = verifyResult.data;
if (interface_params_info.opUrl.indexOf("/cts-open-agency/crm/opportunity/submit") >= 0) {
await this.transformNeedActionBody(pobj);
}
let result = await this.opAliyunClientPost(pobj, interface_params_info.opUrl, interface_params_info.key, interface_params_info.secret, pobj.actionBody);
return await this.disposePushResult(pobj, result, "fq->pushAliBusiness2Fq->result", this.pushlogFailType.FQ);
}
}
async opICClientPost(pobj, url, key, secret, params) {
try {
var rc = system.getObject("util.aliyunClient");
var rtn = await rc.post(url, key, secret, params);
this.logCtl.info({
appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "",
appkey: pobj.appInfo ? pobj.appInfo.uapp_key || "" : "",
requestId: pobj.requestId || "",
op: "service/impl/utilsSve/opAliyunClientPost.js/opAliyunClientPost",
content: rtn,
// clientIp: pobj.clientIp,
optitle: pobj.opType + "推送结果2->fq->opAliyunClientPost",
});
if (typeof rtn.code === 'number' && rtn.code != 200 && rtn.success != true) {
return system.getResult(null, "推送失败,失败原因21:" + JSON.stringify(rtn));
}
if (typeof rtn.code === 'string' && rtn.code != "200" && rtn.success != true) {
return system.getResult(null, "推送失败,失败原因22:" + JSON.stringify(rtn));
}
return system.getResultSuccess(rtn.data, "推送成功");
} catch (e) {
//日志记录
this.logCtl.error({
appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "",
appkey: pobj.appInfo ? pobj.appInfo.uapp_key || "" : "",
requestId: pobj.requestId || "",
op: "service/impl/utilsSve/opAliyunClientPost.js/opAliyunClientPost",
content: "error:" + e.stack,
// clientIp: pobj.clientIp,
optitle: pobj.opType + "推送操作异常->fq->opAliyunClientPost",
});
return system.getResult(null, "推送操作异常->fq->opAliyunClientPost->error:" + e.stack);
async transformNeedActionBody(pobj) {
if (!pobj.actionBody.area || pobj.actionBody.area === "null") {
pobj.actionBody.area = "全国";
}
if (pobj.actionBody.area != "全国" && pobj.actionBody.area.indexOf("市") < 0 && pobj.actionBody.area.indexOf("省") < 0) {
pobj.actionBody.area = AREACOMM.areaTransform[pobj.actionBody.area] || pobj.actionBody.area;
}
if (pobj.actionBody.intentionBizId && (!pobj.actionBody.appName || !pobj.actionBody.productId)) {
//获取需求信息
let tmpActionBody = {
actionBody: {needNo: pobj.actionBody.intentionBizId}
}
var reqUrl = this.centerOrderUrl + "action/need/getNeedItemByChannelNeedNo";
var itemResult = await this.restPostUrl(tmpActionBody, reqUrl);
if (itemResult.status == 0 && itemResult.data) {
pobj.actionBody.appName = itemResult.data.appName;
pobj.actionBody.productId = itemResult.data.serviceProductId;
}
}
}
}
//--------------------------------------------------内部辅助方法-------------------start-----------------
async verifyParam(pobj) {//参数信息验证
var verify = system.getResultSuccess();
if (!pobj.interface_params) {
verify = system.getResult(null, "interface_params can not be empty,100400");
async opAliyunClientPost(pobj, url, key, secret, params) {
try {
var rc = system.getObject("util.aliyunClient");
var rtn = await rc.post(url, key, secret, params);
if (typeof (rtn) == "string") {
rtn = JSON.parse(rtn);
}
this.execClientNew.execLogs(`utilsFqAliyunSve-opAliyunClientPost-result:url=${url}`, pobj, "center-channel-opAliyunClientPost", rtn, null);
if (rtn.success && rtn.code == 200) {
return system.getResultSuccess(rtn.data, "推送成功");
} else {
let errorMsg = "";
if (rtn.errorMessage && rtn.errorMessage.indexOf("订单产品查询出来产品与传递得产品数量不一致") >= 0) {
errorMsg = "订单产品查询出来产品与传递得产品数量不一致";
}
return system.getResultNewFail(-1, `推送失败,失败原因11:${JSON.stringify(rtn)}`, null, errorMsg);
}
} catch (e) {
const stackStr = e.stack ? e.stack : JSON.stringify(e);
this.execClientNew.execLogs(`utilsFqAliyunSve-opAliyunClientPost-error:url=${url}`, pobj, "center-channel-opAliyunClientPost", null, stackStr);
return system.getResult(null, "推送操作异常->fq->opAliyunClientPost->error:" + e.stack);
}
}
var interface_params_info = JSON.parse(pobj.interface_params);
if (!interface_params_info || !interface_params_info.opUrl || !interface_params_info.key || !interface_params_info.secret) {
verify = system.getResult(null, "interface_params(opUrl、key、secret) can not be empty,100410");
}
verify.data = interface_params_info;
return verify;
}
//下订单到ic
async pushOrder2IC(pobj, opType) {
console.log(JSON.stringify(pobj), ".................pushOrderBusinessByProductCode2Fq...............pobj");
var interface_list = pobj.interface_info ? pobj.interface_info : pobj.actionBody.product_info.interface_info;
if (!interface_list) {
return system.getResult(null, "暂无推送配置");
}
var interface_list_temp = interface_list.filter(f => f.op_type == opType)
if (!interface_list_temp || interface_list_temp.length == 0) {
return system.getResult(null, "暂无【" + opType + "】的推送配置");
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.opUrl || !interface_params_info.key || !interface_params_info.secret) {
verify = system.getResult(null, "interface_params(opUrl、key、secret) can not be empty,100410");
}
verify.data = interface_params_info;
return verify;
}
var verifyResult = system.getResultSuccess();
var productInfo = pobj.actionBody.product_info;
if (!productInfo || !productInfo.service_business_code) {
verifyResult = system.getResult(null, "orderInfo.productInfo.service_business_code can not be empty,100427");
}
if (!productInfo || !productInfo.price_item || !productInfo.price_item.service_code) {
verifyResult = system.getResult(null, "orderInfo.productInfo.price_item.service_code can not be empty,100430");
}
var interface_params_info = JSON.parse(interface_list_temp[0].params);
//新增订单(商标自助注册) IC
let icOrderParams = {
"idempotentSource": "pcwebsbzc",// 来源编号,写死:pcwebsbzc,必填
"idempotentSourceName": "PC官网",// 来源编号,写死:PC官网,必填
"product_img_url": pobj.actionBody.deliveryData.tm.picUrl,//产品图片
"productId": productInfo.price_item.service_code,// 云服产品skuid,必填
"goodsId": pobj.actionBody.goodsId,// 官网产品id
"customerId": pobj.actionBody.customerId, //客户Id,必填
"product_item": pobj.actionBody.product_item,
"device_token": pobj.actionBody.device_token //设备编号参数
//下订单到ic
async pushOrder2IC(pobj, opType) {
console.log(JSON.stringify(pobj), ".................pushOrderBusinessByProductCode2Fq...............pobj");
var interface_list = pobj.interface_info ? pobj.interface_info : pobj.actionBody.product_info.interface_info;
if (!interface_list) {
return system.getResult(null, "暂无推送配置");
}
var interface_list_temp = interface_list.filter(f => f.op_type == opType)
if (!interface_list_temp || interface_list_temp.length == 0) {
return system.getResult(null, "暂无【" + opType + "】的推送配置");
}
var verifyResult = system.getResultSuccess();
var productInfo = pobj.actionBody.product_info;
if (!productInfo || !productInfo.service_business_code) {
verifyResult = system.getResult(null, "orderInfo.productInfo.service_business_code can not be empty,100427");
}
if (!productInfo || !productInfo.price_item || !productInfo.price_item.service_code) {
verifyResult = system.getResult(null, "orderInfo.productInfo.price_item.service_code can not be empty,100430");
}
var interface_params_info = JSON.parse(interface_list_temp[0].params);
//新增订单(商标自助注册) IC
let icOrderParams = {
"idempotentSource": "pcwebsbzc",// 来源编号,写死:pcwebsbzc,必填
"idempotentSourceName": "PC官网",// 来源编号,写死:PC官网,必填
"product_img_url": pobj.actionBody.deliveryData.tm.picUrl,//产品图片
"productId": productInfo.price_item.service_code,// 云服产品skuid,必填
"goodsId": pobj.actionBody.goodsId,// 官网产品id
"customerId": pobj.actionBody.customerId, //客户Id,必填
"product_item": pobj.actionBody.product_item,
"device_token": pobj.actionBody.device_token //设备编号参数
}
pobj.params = icOrderParams;
var result = await this.opAliyunClientPost(pobj, interface_params_info.opUrl, interface_params_info.key, interface_params_info.secret, icOrderParams);
return await this.disposePushResult(pobj, result, "fq->pushOrder2IC->result", this.pushlogFailType.FQ);
}
pobj.params = icOrderParams;
var result = await this.opICClientPost(pobj, interface_params_info.opUrl, interface_params_info.key, interface_params_info.secret, icOrderParams);
return await this.disposePushResult(pobj, result, "fq->pushOrder2IC->result", this.pushlogFailType.FQ);
}
//--------------------------------------------------内部辅助方法-------------------end-----------------
//--------------------------------------------------内部辅助方法-------------------end-----------------
// async tttt(){
// let rtn={
// "requestId":null,
// "code":"200",
// "data":{
// "_id":"261931196584429568",
// "operator":"null",
// "operator_name":null,
// "customer":"261918243919368192"
// },
// "success":true,
// "errorCode":"OK",
// "errorMessage":"操作成功",
// "timestamp":"2021-03-30T16:45:15.730+0800"
// }
// if (rtn.success && rtn.code == 200) {
// console.log(11111)
// } else {
// console.log(22222)
// }
//
// }
}
module.exports = UtilsFqAliyunService;
// let tmp=new UtilsFqAliyunService();
// tmp.tttt();
\ No newline at end of file
var system = require("../../../system");
var settings = require("../../../../config/settings");
const AppServiceBase = require("../../app.base");
const fs = require("fs");
const {json} = require("sequelize");
const {getResult, getResultSuccess} = require("../../../system");
//需求操作类----操作类型-公用的
class UtilsNeedCommService extends AppServiceBase {
constructor() {
super();
this.centerOrderUrl = settings.centerOrderUrl();
this.utilsPushSve = system.getObject("service.utilsSve.utilsPushSve");
this.aliclient = system.getObject("util.aliyunClient");
this.ossClient = system.getObject("util.ossClient");
this.restClient = system.getObject("util.restClient");
this.utilsOrderSve = system.getObject("service.utilsSve.utilsOrderSve");
this.qcCenterOrderSve = system.getObject("service.common.qcCenterOrderSve");
this.opPushQueueUrl = settings.opPushQueueUrl();
this.utilsAuthSve = system.getObject("service.utilsSve.utilsAuthSve");
}
/**
* 提交需求
* @param {*} pobj
* @param {*} actionBody
*/
async submitNeed(pobj, actionBody) {
if (actionBody.type == "esp.wangwen" || actionBody.type == "esp.food") {
actionBody.area = this.wangwenAreaChange(actionBody.area)
}
if (!actionBody.type && actionBody.consultType)
actionBody.type = actionBody.consultType
if (!actionBody.intentionBizId) {
return system.getResult(null, "actionBody.intentionBizId can not be empty,100380");
}
var sobj = pobj;
sobj.actionType = "getProductTypeInfo";
var url = settings.centerAppUrl() + "action/opProduct/springBoard";
var rtn = await this.execClient.execPost(sobj, url);
if (!rtn || !rtn.stdout) {
return system.getResultFail(-5015, "需求类型查询失败");
}
var data = JSON.parse(rtn.stdout);
if (data.status != 0) {
return system.getResultFail(-5015, "需求类型查询失败");
}
pobj.actionBody.service_product_id = data.data.service_product_id;
pobj.actionBody.productId = data.data.service_product_id;
pobj.actionBody.appName = pobj.appInfo.app_name;
pobj.actionBody.type_code = data.data.type_code;
pobj.actionBody.type_name = data.data.type_name;
pobj.actionBody.channel_type_code = data.data.channel_type_code;
pobj.actionBody.channel_type_name = data.data.channel_type_name;
pobj.actionBody.type = pobj.actionBody.channel_type_code;
pobj.actionBody.phone = pobj.actionBody.phone || pobj.actionBody.mobile;
pobj.actionBody.idempotentId = pobj.actionBody.intentionBizId;
pobj.actionBody.idempotentSourceName = pobj.appInfo.app_name;
pobj.actionType = "submitNeed";
var reqUrl = this.centerOrderUrl + "action/need/springBoard";
var result = await this.restPostUrl(pobj, reqUrl);
if (result.status == 0) {
//做推送信息
}
return result;
}
}
module.exports = UtilsNeedCommService;
......@@ -39,19 +39,21 @@ class UtilsNeedService extends AppServiceBase {
var url = settings.centerAppUrl() + "action/opProduct/springBoard";
var rtn = await this.execClient.execPost(sobj, url);
if (!rtn || !rtn.stdout) {
return system.getResultFail(-5015, "需求型查询失败");
return system.getResultFail(-5015, "需求型查询失败");
}
var data = JSON.parse(rtn.stdout);
if (data.status != 0) {
return system.getResultFail(-5015, "需求型查询失败");
return system.getResultFail(-5015, "需求型查询失败");
}
pobj.actionBody.service_product_id= data.data.service_product_id;
pobj.actionBody.productId = data.data.service_product_id;
pobj.actionBody.appName = pobj.appInfo.app_name;
pobj.actionBody.type_code = data.data.type_code;
pobj.actionBody.type_name = data.data.type_name;
pobj.actionBody.channel_type_code = data.data.channel_type_code;
pobj.actionBody.channel_type_name = data.data.channel_type_name;
pobj.actionBody.type = pobj.actionBody.channel_type_code;
pobj.actionBody.phone = pobj.actionBody.phone || pobj.actionBody.mobile;
pobj.actionBody.appName = pobj.appInfo.app_name;
pobj.actionBody.idempotentId = pobj.actionBody.intentionBizId;
pobj.actionBody.idempotentSourceName = pobj.appInfo.app_name;
if (pobj.actionBody.channel_type_code == 5) {
......@@ -101,28 +103,109 @@ class UtilsNeedService extends AppServiceBase {
var result = await this.restPostUrl(pobj, reqUrl);
if (result.status == 0) {
if (pobj.actionBody.channel_type_code == "esp.companyreg") {
this.utilsPushSve.aliBusiness2Fq(pobj, "pushNeedBusiness");
this.utilsPushSve.business2Channel(pobj, "pushNeedBusiness");
} else {
if (["ali.tm","ali.tmd"].includes(pobj.actionBody.type)){
this.utilsPushSve.aliBusiness2Fq(pobj, "pushNeedTMBusiness");
this.utilsPushSve.business2Channel(pobj, "pushNeedTMBusiness");
}else {
var reqParams = {
actionBody: pobj.actionBody,
appInfo: pobj.appInfo
}
this.utilsPushSve.aliBusiness2Delivery(reqParams, "addChance");
this.utilsPushSve.business2Channel(reqParams, "addChance");
pobj.actionBody.description = pobj.actionBody.description + " 成交概率:" + pobj.actionBody.level
if (pobj.actionBody.probability) {
pobj.actionBody.description = pobj.actionBody.description + "(" + pobj.actionBody.probability + ") "
}
this.utilsPushSve.aliBusiness2Fq(pobj, "pushNeedICPBusiness");
this.utilsPushSve.business2Channel(pobj, "pushNeedICPBusiness");
}
}
}
return result;
}
/**
* 提交商标需求,对接百度云商标
* @param {*} pobj
* @param {*} actionBody
*/
async submitTmNeed(pobj, actionBody) {
if(!actionBody.type && actionBody.consultType)
actionBody.type = actionBody.consultType
if (!actionBody.intentionBizId) {
return system.getResult(null, "actionBody.intentionBizId can not be empty,100380");
}
var sobj = pobj;
sobj.actionType = "getProductTypeInfo";
var url = settings.centerAppUrl() + "action/opProduct/springBoard";
var rtn = await this.execClient.execPost(sobj, url);
if (!rtn || !rtn.stdout) {
return system.getResultFail(-5015, "需求类型查询失败");
}
var data = JSON.parse(rtn.stdout);
if (data.status != 0) {
return system.getResultFail(-5015, "需求类型查询失败");
}
pobj.actionBody.service_product_id= data.data.service_product_id;
pobj.actionBody.productId = data.data.service_product_id;
pobj.actionBody.appName = pobj.appInfo.app_name;
pobj.actionBody.type_code = data.data.type_code;
pobj.actionBody.type_name = data.data.type_name;
pobj.actionBody.channel_type_code = data.data.channel_type_code;
pobj.actionBody.channel_type_name = data.data.channel_type_name;
pobj.actionBody.type = pobj.actionBody.channel_type_code;
pobj.actionBody.phone = pobj.actionBody.phone || pobj.actionBody.mobile;
pobj.actionBody.idempotentId = pobj.actionBody.intentionBizId;
pobj.actionBody.idempotentSourceName = pobj.appInfo.app_name;
if (pobj.actionBody.channel_type_code == 5) {
pobj.actionBody.type = "ali.icp";
pobj.actionBody.idempotentSource = "icp_ali";
} else if (pobj.actionBody.channel_type_code == 7) {
pobj.actionBody.type = "ali.edi";
pobj.actionBody.idempotentSource = "edi_ali";
} else if (pobj.actionBody.channel_type_code == "tmjy") {
pobj.actionBody.type = "ali.tmd";
pobj.actionBody.idempotentSource = "tmd_ali";
}else if (pobj.actionBody.channel_type_code == 1) {
pobj.actionBody.type = "ali.tmd";
pobj.actionBody.idempotentSource = "tmd_ali";
}else if (pobj.actionBody.channel_type_code == 2) {
pobj.actionBody.type = "ali.tm";
pobj.actionBody.idempotentSource = "tm_ali";
}else if (pobj.actionBody.channel_type_code == 'esp.companyreg'){
pobj.actionBody.type = "ali.ic";
pobj.actionBody.idempotentSource = "ic_ali";
}else if (pobj.actionBody.channel_type_code == 'esp.companyreg_cloud'){
pobj.actionBody.type = "ali.ic";
pobj.actionBody.idempotentSource = "ic_ali";
}
if(pobj.appInfo.uapp_id=='44'){//百度云
if (pobj.actionBody.channel_type_code == 1) {
pobj.actionBody.type = "baidu.tmd";
pobj.actionBody.idempotentSource = "tmd_baidu";
}else if (pobj.actionBody.channel_type_code == 2) {
pobj.actionBody.type = "baidu.tm";
pobj.actionBody.idempotentSource = "tm_baidu";
}
}
if (pobj.actionBody.description && pobj.actionBody.description.indexOf("备#") < 0) {
pobj.actionBody.level = "A";
} else {
pobj.actionBody.level = "C"
}
if (pobj.actionBody.phone == "17319425791") {
pobj.actionBody.level = "F";
}
pobj.actionType = "submitNeed";
var reqUrl = this.centerOrderUrl + "action/need/springBoard";
var result = await this.restPostUrl(pobj, reqUrl);
if (result.status == 0) {
this.utilsPushSve.business2Channel(pobj, "pushNeedTMBusiness");
}
return result;
}
//调用center-order icp需求反馈
async reqCenterOrderQcApi(pobj, reqUrl) {
......@@ -145,18 +228,59 @@ class UtilsNeedService extends AppServiceBase {
"sign": await this.getFQbossSign(pobj.actionBody),
actionBody: pobj.actionBody
}, settings.fqbossTmUrl())
self.utilsPushSve.aliBusiness2Fq(pobj, "pushTMFeedback");
self.utilsPushSve.business2Channel(pobj, "pushTMFeedback");
}else
// 2020 0803 lin 修改;
if (pobj.intentionStatus) {
// 如果需求当前字段为5(已关闭)则通知fq
if (pobj.intentionStatus == 5) {
self.utilsPushSve.aliBusiness2Fq(pobj, "pushCloseICPNeed");
self.utilsPushSve.business2Channel(pobj, "pushCloseICPNeed");
}
}
return data;
}
//商标需求反馈
async tmFeedbackSubmit(pobj) {
var url = this.centerOrderUrl + "action/qcapi/springBoard";
var self = this;
pobj.actionType = "tmFeedbackSubmit";
if (pobj.actionBody && pobj.actionBody.intentionStatus) {
pobj.intentionStatus = pobj.actionBody.intentionStatus;
}
var rtn = await this.execClient.execPost(pobj, url);
var data = JSON.parse(rtn.stdout);
if (data.data && (data.data.channelTypeCode == 1||data.data.channelTypeCode == 2)) {//商标
pobj.actionBody.status = "888"
this.execPostUrl({
"actionProcess": "AliTm",
"appCode": "100099",
"sign": await this.getFQbossSign(pobj.actionBody),
actionBody: pobj.actionBody
}, settings.fqbossTmUrl())
self.utilsPushSve.business2Channel(pobj, "pushTMFeedback");
}
return data;
}
//商标状态通知
async tmStatusNotify(pobj) {
var self = this;
// 引用属性,channel依赖bizId order依赖intentionBizId
pobj.intentionBizId = pobj.bizId
var sobj = {
"actionType": "getItemByChannelSolutionNo",
"actionBody": pobj
}
var result = this.getItemByChannelSolutionNo(sobj,sobj.actionBody);
if (result.status == 0) {
let pushres = await this.execPostUrl({ "actionProcess": "AliTm", "appCode": "100099", "sign": await this.getFQbossSign(pobj), actionBody: pobj },settings.fqbossTmUrl())
console.log("推送fqboos----->",pushres)
return this.getResult(result.requestId, pushres.message);
}
return this.getResult(result.requestId)
}
/**
* 提交需求-----del
* @param {*} pobj
......@@ -174,6 +298,9 @@ class UtilsNeedService extends AppServiceBase {
if (data.status != 0) {
return system.getResultFail(-5015, "需求类型查询失败");
}
pobj.actionBody.service_product_id= data.data.service_product_id;
pobj.actionBody.productId = data.data.service_product_id;
pobj.actionBody.appName = pobj.appInfo.app_name;
pobj.actionBody.type_code = data.data.type_code;
pobj.actionBody.type_name = data.data.type_name;
pobj.actionBody.channel_type_code = data.data.channel_type_code;
......@@ -183,7 +310,7 @@ class UtilsNeedService extends AppServiceBase {
var result = await this.restPostUrl(pobj, reqUrl);
if (result.status == 0) {
if (pobj.actionBody.channel_type_code == "esp.companyreg") {
this.utilsPushSve.aliBusiness2Fq(pobj, "pushNeedBusiness");
this.utilsPushSve.business2Channel(pobj, "pushNeedBusiness");
}
// else{
// if(pobj.actionBody.channel_type_code==5){
......@@ -286,14 +413,6 @@ class UtilsNeedService extends AppServiceBase {
// 明天找栋源确认 如果需要增加 在这个文件搜索updateChanceStatus
// 2020 1016 lin 新增 需求关闭时判断 方案状态 订单状态,打个比方如果已经生成订单了 那么肯定不能直接关闭需求
if (result.status == 0) {
if (result.data) {
pobj.actionBody.orderNo = result.data;
var orderrtn = await self.utilsOrderSve.delOrder(pobj, pobj.actionBody);
if (orderrtn.status < 0) {
return system.getResultFail(-5022, "订单关闭失败");
}
}
//推送交付系统
var reqParams = {
actionBody: {
......@@ -303,8 +422,8 @@ class UtilsNeedService extends AppServiceBase {
opType: "updateChanceStatus",
appInfo: pobj.appInfo
}
self.utilsPushSve.aliBusiness2Delivery(reqParams, "updateChanceStatus");
self.utilsPushSve.aliBusiness2Fq(pobj, "pushCloseICPNeed");
self.utilsPushSve.business2Channel(reqParams, "updateChanceStatus");
self.utilsPushSve.business2Channel(pobj, "pushCloseICPNeed");
}
return result;
}
......@@ -353,7 +472,7 @@ class UtilsNeedService extends AppServiceBase {
opType: "updateChanceStatus",
appInfo: pobj.appInfo
}
self.utilsPushSve.aliBusiness2Delivery(reqParams, "updateChanceStatus");
self.utilsPushSve.business2Channel(reqParams, "updateChanceStatus");
//日志记录
self.logCtl.info({
appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "",
......@@ -367,7 +486,7 @@ class UtilsNeedService extends AppServiceBase {
// 推送ali
var a = await self.aliclient.reqbyget({ action: "CloseIntention", reqbody: { BizId: actionBody.channelNeedNo, Note: actionBody.note }, apiVersion: "2019-05-08" });
console.log(a);
self.utilsPushSve.aliBusiness2Fq(pobj, "pushCloseICPNeed");
self.utilsPushSve.business2Channel(pobj, "pushCloseICPNeed");
}
return result
}
......@@ -469,7 +588,7 @@ class UtilsNeedService extends AppServiceBase {
},
appInfo: pobj.appInfo
}
this.utilsPushSve.aliBusiness2Delivery(deliveryObj, "pushDeliveryOrder");
this.utilsPushSve.business2Channel(deliveryObj, "pushDeliveryOrder");
}
if (rtn.status == 0 && actionBody.status != 1 && actionBody.status != 2 && rtn.data) {
var tmpObj = {
......@@ -480,7 +599,7 @@ class UtilsNeedService extends AppServiceBase {
},
appInfo: pobj.appInfo
}
this.utilsPushSve.aliBusiness2Delivery(tmpObj, "pushDeliveryStatusNotify");
this.utilsPushSve.business2Channel(tmpObj, "pushDeliveryStatusNotify");
pobj.actionBody.orderNo = rtn.data.orderNo;
if (actionBody.status == 11) {
var orderrtn = await self.utilsOrderSve.delOrder(pobj, pobj.actionBody);
......@@ -488,7 +607,7 @@ class UtilsNeedService extends AppServiceBase {
return system.getResultFail(-5022, "订单关闭失败");
}
tmpObj.actionBody.orderNo = rtn.data.channelSolutionNo;
self.utilsPushSve.aliBusiness2Fq(tmpObj, "pushOrderICPClose");
self.utilsPushSve.business2Channel(tmpObj, "pushOrderICPClose");
}
}//通知更新状态
}
......@@ -589,7 +708,7 @@ class UtilsNeedService extends AppServiceBase {
opType: "updateChanceStatus",
appInfo: pobj.appInfo
}
self.utilsPushSve.aliBusiness2Delivery(reqParams, "updateChanceStatus");
self.utilsPushSve.business2Channel(reqParams, "updateChanceStatus");
var fqobj = {
actionBody: {
"bizId": pobj.actionBody.intentionBizId,
......@@ -599,7 +718,7 @@ class UtilsNeedService extends AppServiceBase {
opType: "aliFollowup",
appInfo: pobj.appInfo
}
self.utilsPushSve.aliBusiness2Fq(fqobj, "aliFollowup");
self.utilsPushSve.business2Channel(fqobj, "aliFollowup");
return system.getResultSuccess();
}
......@@ -689,7 +808,7 @@ class UtilsNeedService extends AppServiceBase {
var reqUrl = this.centerOrderUrl + "action/need/springBoard";
var result = await this.restPostUrl(pobj, reqUrl);
if (result.status == 0) {
this.utilsPushSve.aliBusiness2Fq(pobj, "pushCloseNeed");
this.utilsPushSve.business2Channel(pobj, "pushCloseNeed");
return system.getResultSuccess();
} else {
return system.getResult(null, "推送失敗 100388");
......@@ -858,7 +977,7 @@ class UtilsNeedService extends AppServiceBase {
async testsymq(pobj) {
var a = null;
try {
a = await this.utilsPushSve.aliBusiness2Delivery(pobj.actionBody, pobj.actionBody.pushtype);
a = await this.utilsPushSve.business2Channel(pobj.actionBody, pobj.actionBody.pushtype);
return system.getResultSuccess(a);
} catch (error) {
return system.getResultSuccess(error);
......@@ -1270,8 +1389,8 @@ class UtilsNeedService extends AppServiceBase {
},
appInfo: pobj.appInfo
}
this.utilsPushSve.aliBusiness2Fq(fqobj, "pushOrderICPBusiness");
this.utilsPushSve.aliBusiness2Delivery(deliveryObj, "pushDeliveryOrder");
this.utilsPushSve.business2Channel(fqobj, "pushOrderICPBusiness");
this.utilsPushSve.business2Channel(deliveryObj, "pushDeliveryOrder");
break;
case "USER_CONFIRM_PRODUCE":
break;
......@@ -1343,7 +1462,7 @@ class UtilsNeedService extends AppServiceBase {
appInfo: pobj.appInfo
}
console.log(deliveryObj)
this.utilsPushSve.aliBusiness2Delivery(deliveryObj, "pushDeliveryOrder");
this.utilsPushSve.business2Channel(deliveryObj, "pushDeliveryOrder");
}
if (rtn.status == 0 && actionBody.operationType != "USER_PAY_PRODUCE" && actionBody.operationType != "USER_UPLOAD_PRODUCE" && rtn.data) {
console.log("pushDeliveryStatusNotify start ------")
......@@ -1356,7 +1475,7 @@ class UtilsNeedService extends AppServiceBase {
appInfo: pobj.appInfo
}
console.log(tmpObj)
var res = await this.utilsPushSve.aliBusiness2Delivery(tmpObj, "pushDeliveryStatusNotify");
var res = await this.utilsPushSve.business2Channel(tmpObj, "pushDeliveryStatusNotify");
console.log("res")
console.log(res);
console.log("pushDeliveryStatusNotify end ------")
......@@ -1367,7 +1486,7 @@ class UtilsNeedService extends AppServiceBase {
return system.getResultFail(-5022, "订单关闭失败");
}
tmpObj.actionBody.orderNo = rtn.data.channelSolutionNo;
self.utilsPushSve.aliBusiness2Fq(tmpObj, "pushOrderICPClose");
self.utilsPushSve.business2Channel(tmpObj, "pushOrderICPClose");
}
}//通知更新状态
return rtn;
......@@ -1413,6 +1532,9 @@ class UtilsNeedService extends AppServiceBase {
if (data.status != 0) {
return system.getResultFail(-5015, "需求類型查询失败");
}
pobj.actionBody.service_product_id= data.data.service_product_id;
pobj.actionBody.productId = data.data.service_product_id;
pobj.actionBody.appName = pobj.appInfo.app_name;
pobj.actionBody.type_code = data.data.type_code;
pobj.actionBody.type_name = data.data.type_name;
pobj.actionBody.channel_type_code = data.data.channel_type_code;
......@@ -1433,6 +1555,22 @@ class UtilsNeedService extends AppServiceBase {
pobj.actionBody.type = "baidu.radiotv";
pobj.actionBody.idempotentSource = "baidu_radiotv";
}
if(pobj.appInfo && pobj.appInfo.uapp_id && pobj.appInfo.uapp_id=="52"){
if (pobj.actionBody.channel_type_code == 5) {
pobj.actionBody.type = "yiming.icp";
pobj.actionBody.idempotentSource = "yiming.icp";
} else if (pobj.actionBody.channel_type_code == 7) {
pobj.actionBody.type = "yiming.edi";
pobj.actionBody.idempotentSource = "yiming.edi";
} else if (pobj.actionBody.channel_type_code == "icpnb") {
pobj.actionBody.type = "yiming.icpnb";
pobj.actionBody.idempotentSource = "yiming.icpnb";
} else if (pobj.actionBody.channel_type_code == "edinb") {
pobj.actionBody.type = "yiming.edinb";
pobj.actionBody.idempotentSource = "yiming.edinb";
}
}
if (pobj.actionBody.description && pobj.actionBody.description.indexOf("备#") < 0) {
pobj.actionBody.level = "A";
} else {
......@@ -1471,9 +1609,7 @@ class UtilsNeedService extends AppServiceBase {
pobj.actionBody.idempotentId = pobj.actionBody.intentionBizId;
// pobj.actionBody.idempotentSource = pobj.actionBody.type;
pobj.actionBody.customerName = pobj.actionBody.userName;
//2021-1-21 laolan add new
pobj.actionBody.appName = pobj.appInfo.app_name || '',
this.utilsPushSve.baiduBusiness2Fq(pobj, "pushNeedICPBusinessNew");
this.utilsPushSve.business2Channel(pobj, "pushNeedICPBusinessNew");
}
}
return result;
......@@ -1509,7 +1645,7 @@ class UtilsNeedService extends AppServiceBase {
},
appInfo: pobj.appInfo
}
this.utilsPushSve.baiduBusiness2Delivery(deliveryObj, "pushDeliveryOrder");
this.utilsPushSve.business2Channel(deliveryObj, "pushDeliveryOrder");
}
if (rtn.status == 0 && actionBody.status != 1 && actionBody.status != 2 && rtn.data) {
var tmpObj = {
......@@ -1520,7 +1656,7 @@ class UtilsNeedService extends AppServiceBase {
},
appInfo: pobj.appInfo
}
this.utilsPushSve.baiduBusiness2Delivery(tmpObj, "pushDeliveryStatusNotify");
this.utilsPushSve.business2Channel(tmpObj, "pushDeliveryStatusNotify");
pobj.actionBody.orderNo = rtn.data.orderNo;
if (actionBody.status == 11) {
var orderrtn = await self.utilsOrderSve.delOrder(pobj, pobj.actionBody);
......@@ -1528,7 +1664,7 @@ class UtilsNeedService extends AppServiceBase {
return system.getResultFail(-5022, "订单关闭失败");
}
tmpObj.actionBody.orderNo = rtn.data.channelSolutionNo;
self.utilsPushSve.baiduBusiness2Fq(tmpObj, "pushOrderICPClose");
self.utilsPushSve.business2Channel(tmpObj, "pushOrderICPClose");
}
}//通知更新状态
return rtn;
......@@ -1555,7 +1691,7 @@ class UtilsNeedService extends AppServiceBase {
},
appInfo: pobj.appInfo
}
this.utilsPushSve.baiduBusiness2Delivery(tmpObj, "pushDeliveryStatusNotify");
this.utilsPushSve.business2Channel(tmpObj, "pushDeliveryStatusNotify");
// tmpObj.actionBody.orderNo = channelOrderNo;
var tmpObj2 = {
actionBody: {
......@@ -1565,11 +1701,45 @@ class UtilsNeedService extends AppServiceBase {
},
appInfo: pobj.appInfo
};
self.utilsPushSve.baiduBusiness2Fq(tmpObj2, "pushOrderICPClose");
self.utilsPushSve.business2Channel(tmpObj2, "pushOrderICPClose");
}//通知更新状态
return rtn;
}
//-----------接入百度ICP------end----------------------------------
//需求导入
async importNeeds(pobj,req){
let url = this.centerOrderUrl + 'action/need/springBoard';
if(!pobj.actionBody.needsArr){
return system.getResultFail(-1,'导入数据不能为空');
}
if(!pobj.actionBody.uapp_id){
return system.getResultFail(-1,'渠道id 不能为空');
}
pobj.actionType = 'bulkCreateNeeds';
let result = await this.restPostUrl(pobj, url);
return result;
}
/**
* 同步需求商机
* @param pobj
* @param qobj
* @param req
* @returns {Promise<{msg: *, data, bizmsg: *|string, status: number}>}
*/
async syncNeedBusiness(pobj,qobj,req){
let url = this.centerOrderUrl + 'task/taskAction/taskNeed';
let data = {identifyCode : 'syncNeed'}
let result = await this.execPostByTimeOut(req,data,url,"json",null,60)
if (!result || result.status != 0) {
return system.getResult(null, result.msg);
}
if (!result.data || result.data.status != 0) {
return system.getResult(null, result.data.msg);
}
return system.getResult(result.data.data);
}
}
module.exports = UtilsNeedService;
......
......@@ -6,8 +6,9 @@ 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)
'ename':52
}
//需求操作类----ali对接的需求
class UtilsNeedService2 extends AppServiceBase {
......@@ -52,12 +53,14 @@ class UtilsNeedService2 extends AppServiceBase {
if (data.status != 0) {
return system.getResultFail(-5015, "需求類型查询失败");
}
pobj.actionBody.service_product_id= data.data.service_product_id;
pobj.actionBody.productId = data.data.service_product_id;
pobj.actionBody.appName = pobj.appInfo.app_name;
pobj.actionBody.type_code = data.data.type_code;
pobj.actionBody.type_name = data.data.type_name;
pobj.actionBody.channel_type_code = data.data.channel_type_code;
pobj.actionBody.channel_type_name = data.data.channel_type_name;
pobj.actionBody.type = pobj.actionBody.channel_type_code;
pobj.actionBody.appName = pobj.appInfo.app_name;
if (pobj.actionBody.channel_type_code == 5) {
pobj.actionBody.type = "ali.icp";
} else if (pobj.actionBody.channel_type_code == 7) {
......@@ -90,19 +93,19 @@ class UtilsNeedService2 extends AppServiceBase {
var result = await this.restPostUrl(pobj, reqUrl);
if (result.status == 0) {
if (pobj.actionBody.channel_type_code == "esp.companyreg") {
this.utilsPushSve.aliBusiness2Fq(pobj, "pushNeedBusiness");
this.utilsPushSve.business2Channel(pobj, "pushNeedBusiness");
} else {
var reqParams = {
actionBody: pobj.actionBody,
appInfo: pobj.appInfo
}
this.utilsPushSve.aliBusiness2Delivery(reqParams, "addChance");
this.utilsPushSve.business2Channel(reqParams, "addChance");
pobj.actionBody.description = pobj.actionBody.description + " 成交概率:" + pobj.actionBody.level
if (pobj.actionBody.probability) {
pobj.actionBody.description = pobj.actionBody.description + "(" + pobj.actionBody.probability + ") "
}
this.utilsPushSve.aliBusiness2Fq(pobj, "pushNeedICPBusiness");
this.utilsPushSve.business2Channel(pobj, "pushNeedICPBusiness");
}
}
return result;
......@@ -121,7 +124,7 @@ class UtilsNeedService2 extends AppServiceBase {
if (pobj.intentionStatus) {
// 如果需求当前字段为5(已关闭)则通知fq
if (pobj.intentionStatus == 5) {
self.utilsPushSve.aliBusiness2Fq(pobj, "pushCloseICPNeed");
self.utilsPushSve.business2Channel(pobj, "pushCloseICPNeed");
}
}
var rtn = await this.execClient.execPost(pobj, url);
......@@ -146,6 +149,9 @@ class UtilsNeedService2 extends AppServiceBase {
if (data.status != 0) {
return system.getResultFail(-5015, "需求类型查询失败");
}
pobj.actionBody.service_product_id= data.data.service_product_id;
pobj.actionBody.productId = data.data.service_product_id;
pobj.actionBody.appName = pobj.appInfo.app_name;
pobj.actionBody.type_code = data.data.type_code;
pobj.actionBody.type_name = data.data.type_name;
pobj.actionBody.channel_type_code = data.data.channel_type_code;
......@@ -157,7 +163,7 @@ class UtilsNeedService2 extends AppServiceBase {
var result = await this.restPostUrl(pobj, reqUrl);
if (result.status == 0) {
if (pobj.actionBody.channel_type_code == "esp.companyreg") {
this.utilsPushSve.aliBusiness2Fq(pobj, "pushNeedBusiness");
this.utilsPushSve.business2Channel(pobj, "pushNeedBusiness");
}
// else{
// if(pobj.actionBody.channel_type_code==5){
......@@ -249,8 +255,8 @@ class UtilsNeedService2 extends AppServiceBase {
opType: "updateChanceStatus",
appInfo: pobj.appInfo
}
self.utilsPushSve.aliBusiness2Delivery(reqParams, "updateChanceStatus");
self.utilsPushSve.aliBusiness2Fq(pobj, "pushCloseICPNeed");
self.utilsPushSve.business2Channel(reqParams, "updateChanceStatus");
self.utilsPushSve.business2Channel(pobj, "pushCloseICPNeed");
}
return result
}
......@@ -303,7 +309,7 @@ class UtilsNeedService2 extends AppServiceBase {
opType: "updateChanceStatus",
appInfo: pobj.appInfo
}
self.utilsPushSve.aliBusiness2Delivery(reqParams, "updateChanceStatus");
self.utilsPushSve.business2Channel(reqParams, "updateChanceStatus");
//日志记录
self.logCtl.info({
appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "",
......@@ -323,7 +329,7 @@ class UtilsNeedService2 extends AppServiceBase {
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");
self.utilsPushSve.business2Channel(pobj, "pushCloseICPNeed");
}
return result;
}
......@@ -399,7 +405,7 @@ class UtilsNeedService2 extends AppServiceBase {
},
appInfo: pobj.appInfo
}
this.utilsPushSve.aliBusiness2Delivery(deliveryObj, "pushDeliveryOrder");
this.utilsPushSve.business2Channel(deliveryObj, "pushDeliveryOrder");
}
if (rtn.status == 0 && actionBody.status != 1 && actionBody.status != 2 && rtn.data) {
var tmpObj = {
......@@ -410,7 +416,7 @@ class UtilsNeedService2 extends AppServiceBase {
},
appInfo: pobj.appInfo
}
this.utilsPushSve.aliBusiness2Delivery(tmpObj, "pushDeliveryStatusNotify");
this.utilsPushSve.business2Channel(tmpObj, "pushDeliveryStatusNotify");
pobj.actionBody.orderNo = rtn.data.orderNo;
if (actionBody.status == 11) {
var orderrtn = await self.utilsOrderSve.delOrder(pobj, pobj.actionBody);
......@@ -418,7 +424,7 @@ class UtilsNeedService2 extends AppServiceBase {
return system.getResultFail(-5022, "订单关闭失败");
}
tmpObj.actionBody.orderNo = rtn.data.channelSolutionNo;
self.utilsPushSve.aliBusiness2Fq(tmpObj, "pushOrderICPClose");
self.utilsPushSve.business2Channel(tmpObj, "pushOrderICPClose");
}
}//通知更新状态
return rtn;
......@@ -517,6 +523,11 @@ class UtilsNeedService2 extends AppServiceBase {
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.data == uappId.ename) {
console.log('settings.enameClientUrl()+"WriteCommunicationLog"----',settings.enameClientUrl()+"WriteCommunicationLog")
var resss = await self.execClient.execEnamePost({ IntentionBizId: pobj.actionBody.intentionBizId, Note: pobj.actionBody.note }, settings.enameClientUrl()+"WriteCommunicationLog");
console.log("ename+resss", resss)
}
}
//推送交付系统
......@@ -528,7 +539,7 @@ class UtilsNeedService2 extends AppServiceBase {
opType: "updateChanceStatus",
appInfo: pobj.appInfo
}
self.utilsPushSve.aliBusiness2Delivery(reqParams, "updateChanceStatus");
self.utilsPushSve.business2Channel(reqParams, "updateChanceStatus");
var fqobj = {
actionBody: {
"bizId": pobj.actionBody.intentionBizId,
......@@ -538,7 +549,7 @@ class UtilsNeedService2 extends AppServiceBase {
opType: "aliFollowup",
appInfo: pobj.appInfo
}
self.utilsPushSve.aliBusiness2Fq(fqobj, "aliFollowup");
self.utilsPushSve.business2Channel(fqobj, "aliFollowup");
return system.getResultSuccess();
}
......@@ -546,7 +557,7 @@ class UtilsNeedService2 extends AppServiceBase {
async queryExpertApplyCommunicationLogs(pobj) {
var reqUrl = this.centerOrderUrl + "action/need/springBoard";
var result = await this.restPostUrl(pobj, reqUrl);
console.log('jilu+++result++++', result)
console.log('jilu+++result++++1--', 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({
......@@ -576,6 +587,20 @@ class UtilsNeedService2 extends AppServiceBase {
});
console.log('xxcc+++', res)
}
if (result.data.uapp_id == uappId.ename) {// yiming / ename
console.log("queryExpertApplyCommunicationLogs---ename---pobj--", pobj)
console.log('settings.enameClientUrl()+"queryExpertApplyCommunicationLogs"----',settings.enameClientUrl()+"queryExpertApplyCommunicationLogs")
var res = await self.execClient.execEnamePost({
BeginTime: pobj.actionBody.BeginTime ? pobj.actionBody.BeginTime : "",
EndTime: pobj.actionBody.EndTime ? pobj.actionBody.EndTime : "",
BizId: pobj.actionBody.intentionBizId,
UserFeedBack: pobj.actionBody.userFeedBack || true,
PageNum: pobj.actionBody.pageNum || 1,
PageSize: pobj.actionBody.pageSize || 10,
}, settings.enameClientUrl()+"queryExpertApplyCommunicationLogs");
console.log('ename+++queryExpertApplyCommunicationLogs---res---', res)
}
}
if(res && res.data && res.data.result){
......@@ -645,7 +670,7 @@ class UtilsNeedService2 extends AppServiceBase {
var reqUrl = this.centerOrderUrl + "action/need/springBoard";
var result = await this.restPostUrl(pobj, reqUrl);
if (result.status == 0) {
this.utilsPushSve.aliBusiness2Fq(pobj, "pushCloseNeed");
this.utilsPushSve.business2Channel(pobj, "pushCloseNeed");
return system.getResultSuccess();
} else {
return system.getResult(null, "推送失敗 100388");
......@@ -815,7 +840,7 @@ class UtilsNeedService2 extends AppServiceBase {
async testsymq(pobj) {
var a = null;
try {
a = await this.utilsPushSve.aliBusiness2Delivery(pobj.actionBody, pobj.actionBody.pushtype);
a = await this.utilsPushSve.business2Channel(pobj.actionBody, pobj.actionBody.pushtype);
return system.getResultSuccess(a);
} catch (error) {
return system.getResultSuccess(error);
......@@ -1245,8 +1270,8 @@ class UtilsNeedService2 extends AppServiceBase {
},
appInfo: pobj.appInfo
}
this.utilsPushSve.aliBusiness2Fq(fqobj, "pushOrderICPBusiness");
this.utilsPushSve.aliBusiness2Delivery(deliveryObj, "pushDeliveryOrder");
this.utilsPushSve.business2Channel(fqobj, "pushOrderICPBusiness");
this.utilsPushSve.business2Channel(deliveryObj, "pushDeliveryOrder");
break;
case "USER_CONFIRM_PRODUCE":
break;
......@@ -1317,7 +1342,7 @@ class UtilsNeedService2 extends AppServiceBase {
appInfo: pobj.appInfo
}
console.log(deliveryObj)
this.utilsPushSve.aliBusiness2Delivery(deliveryObj, "pushDeliveryOrder");
this.utilsPushSve.business2Channel(deliveryObj, "pushDeliveryOrder");
}
if (rtn.status == 0 && actionBody.operationType != "USER_PAY_PRODUCE" && actionBody.operationType != "USER_UPLOAD_PRODUCE" && rtn.data) {
console.log("pushDeliveryStatusNotify start ------")
......@@ -1330,10 +1355,8 @@ class UtilsNeedService2 extends AppServiceBase {
appInfo: pobj.appInfo
}
console.log(tmpObj)
var res = await this.utilsPushSve.aliBusiness2Delivery(tmpObj, "pushDeliveryStatusNotify");
console.log("res")
console.log(res);
console.log("pushDeliveryStatusNotify end ------")
var res = await this.utilsPushSve.business2Channel(tmpObj, "pushDeliveryStatusNotify");
console.log(res,"res-------pushDeliveryStatusNotify end ------")
pobj.actionBody.orderNo = rtn.data.orderNo;
if (actionBody.operationType == "ABC_CLOSE_PRODUCE") {
var orderrtn = await self.utilsOrderSve.delOrder(pobj, pobj.actionBody);
......@@ -1341,7 +1364,7 @@ class UtilsNeedService2 extends AppServiceBase {
return system.getResultFail(-5022, "订单关闭失败");
}
tmpObj.actionBody.orderNo = rtn.data.channelSolutionNo;
self.utilsPushSve.aliBusiness2Fq(tmpObj, "pushOrderICPClose");
self.utilsPushSve.business2Channel(tmpObj, "pushOrderICPClose");
}
}//通知更新状态
return rtn;
......@@ -1381,18 +1404,20 @@ class UtilsNeedService2 extends AppServiceBase {
var url = settings.centerAppUrl() + "action/opProduct/springBoard";
var rtn = await this.execClient.execPost(sobj, url);
if (!rtn || !rtn.stdout) {
return system.getResultFail(-5015, "需求型查询失败");
return system.getResultFail(-5015, "需求型查询失败");
}
var data = JSON.parse(rtn.stdout);
if (data.status != 0) {
return system.getResultFail(-5015, "需求型查询失败");
return system.getResultFail(-5015, "需求型查询失败");
}
pobj.actionBody.service_product_id= data.data.service_product_id;
pobj.actionBody.productId = data.data.service_product_id;
pobj.actionBody.appName = pobj.appInfo.app_name;
pobj.actionBody.type_code = data.data.type_code;
pobj.actionBody.type_name = data.data.type_name;
pobj.actionBody.channel_type_code = data.data.channel_type_code;
pobj.actionBody.channel_type_name = data.data.channel_type_name;
pobj.actionBody.type = pobj.actionBody.channel_type_code;
pobj.actionBody.appName = pobj.appInfo.app_name;
if (pobj.actionBody.channel_type_code == 5) {
pobj.actionBody.type = "baidu.icp";
} else if (pobj.actionBody.channel_type_code == 7) {
......@@ -1423,19 +1448,19 @@ class UtilsNeedService2 extends AppServiceBase {
var result = await this.restPostUrl(pobj, reqUrl);
if (result.status == 0) {
if (pobj.actionBody.channel_type_code == "esp.companyreg") {
this.utilsPushSve.aliBusiness2Fq(pobj, "pushNeedBusiness");
this.utilsPushSve.business2Channel(pobj, "pushNeedBusiness");
} else {
var reqParams = {
actionBody: pobj.actionBody,
appInfo: pobj.appInfo
}
this.utilsPushSve.aliBusiness2Delivery(reqParams, "addChance");
this.utilsPushSve.business2Channel(reqParams, "addChance");
pobj.actionBody.description = pobj.actionBody.description + " 成交概率:" + pobj.actionBody.level
if (pobj.actionBody.probability) {
pobj.actionBody.description = pobj.actionBody.description + "(" + pobj.actionBody.probability + ") "
}
this.utilsPushSve.aliBusiness2Fq(pobj, "pushNeedICPBusiness");
this.utilsPushSve.business2Channel(pobj, "pushNeedICPBusiness");
}
}
return result;
......@@ -1471,7 +1496,7 @@ class UtilsNeedService2 extends AppServiceBase {
},
appInfo: pobj.appInfo
}
this.utilsPushSve.aliBusiness2Delivery(deliveryObj, "pushDeliveryOrder");
this.utilsPushSve.business2Channel(deliveryObj, "pushDeliveryOrder");
}
if (rtn.status == 0 && actionBody.status != 1 && actionBody.status != 2 && rtn.data) {
var tmpObj = {
......@@ -1482,7 +1507,7 @@ class UtilsNeedService2 extends AppServiceBase {
},
appInfo: pobj.appInfo
}
this.utilsPushSve.aliBusiness2Delivery(tmpObj, "pushDeliveryStatusNotify");
this.utilsPushSve.business2Channel(tmpObj, "pushDeliveryStatusNotify");
pobj.actionBody.orderNo = rtn.data.orderNo;
if (actionBody.status == 11) {
var orderrtn = await self.utilsOrderSve.delOrder(pobj, pobj.actionBody);
......@@ -1490,7 +1515,7 @@ class UtilsNeedService2 extends AppServiceBase {
return system.getResultFail(-5022, "订单关闭失败");
}
tmpObj.actionBody.orderNo = rtn.data.channelSolutionNo;
self.utilsPushSve.aliBusiness2Fq(tmpObj, "pushOrderICPClose");
self.utilsPushSve.business2Channel(tmpObj, "pushOrderICPClose");
}
}//通知更新状态
return rtn;
......
......@@ -18,7 +18,7 @@ class UtilsOpNeedService extends AppServiceBase {
}
/**
* 提交需求 h5/pc 通用
* 提交需求 h5/pc 通用提交需求接口
* @param {*} pobj
* @param {*} actionBody
*/
......@@ -32,19 +32,21 @@ class UtilsOpNeedService extends AppServiceBase {
if (opResult.status != 0) {
return system.getResultFail(-5015, "需求类型查询失败");
}
pobj.actionBody.service_product_id= opResult.data.service_product_id;
pobj.actionBody.productId = opResult.data.service_product_id;
pobj.actionBody.appName = pobj.appInfo.app_name;
pobj.actionBody.type_code = opResult.data.type_code;
pobj.actionBody.type_name = opResult.data.type_name;
pobj.actionBody.channel_type_code = opResult.data.channel_type_code;
pobj.actionBody.channel_type_name = opResult.data.channel_type_name;
pobj.actionBody.appName = pobj.appInfo.app_name;
}
// 提交需求 暂未做推送
pobj.actionType = "opSubmitNeed";
var reqUrl = this.centerOrderUrl + "action/opNeed/springBoard";
var result = await this.restPostUrl(pobj, reqUrl);
if (result.status == 0) {
if (pobj.actionBody.channel_type_code == "esp.companyreg") {
this.utilsPushSve.aliBusiness2Fq(pobj, "pushNeedBusiness");
if (pobj.actionBody.channel_type_code == "esp.companyreg" || pobj.actionBody.channel_type_code == "esp.companyreg_cloud") {
this.utilsPushSve.business2Channel(pobj, "pushNeedBusiness");
}
}
return result;
......@@ -166,7 +168,7 @@ class UtilsOpNeedService extends AppServiceBase {
},
appInfo: pobj.appInfo
}
this.utilsPushSve.aliBusiness2Delivery(tmpObj, "pushDeliveryStatusNotify");
this.utilsPushSve.business2Channel(tmpObj, "pushDeliveryStatusNotify");
tmpObj.actionBody.orderNo = rtn.data.channelSolutionNo;
pobj.actionBody.orderNo = rtn.data.orderNo;
if (actionBody.status == 11) {
......@@ -174,7 +176,7 @@ class UtilsOpNeedService extends AppServiceBase {
if (orderrtn.status < 0) {
return system.getResultFail(-5022, "订单关闭失败");
}
self.utilsPushSve.aliBusiness2Fq(tmpObj, "pushOrderICPClose");
self.utilsPushSve.business2Channel(tmpObj, "pushOrderICPClose");
}
}//通知更新状态
return rtn;
......@@ -407,6 +409,20 @@ class UtilsOpNeedService extends AppServiceBase {
}
/**
* 获取需求 的产品类型
* @param pobj
* @returns {Promise<void>}
*/
async getNeedProductType(pobj){
let url = this.centerOrderUrl + "action/opNeed/springBoard";
let result = await this.restPostUrl(pobj, url);
if(result.status != 0){
return system.getResultFail(-1);
}
return result;
}
/**
* 需求量对比
* @param pobj
* @returns {Promise<void>}
......
......@@ -115,5 +115,25 @@ class UtilsOpOrderService extends AppServiceBase {
}
}
}
/**
* 同步订单商机
* @param pobj
* @param qobj
* @param req
* @returns {Promise<{msg: *, data, bizmsg: *|string, status: number}>}
*/
async syncOrderBusiness(pobj,qobj,req){
let url = this.centerOrderUrl + 'task/taskAction/taskOrder';
let data = {identifyCode : 'syncOrder'}
let result = await this.execPostByTimeOut(req,data,url,"json",null,60)
if (!result || result.status != 0) {
return system.getResult(null, result.msg);
}
if (!result.data || result.data.status != 0) {
return system.getResult(null, result.data.msg);
}
return system.getResult(result.data.data);
}
}
module.exports = UtilsOpOrderService;
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -153,6 +153,44 @@ class UtilsProductService extends AppServiceBase {
let result = await this.restPostUrl(pobj,url);
return result;
}
}
module.exports = UtilsProductService;
/**
* 根据path_name 聚合
* @param pobj
* @returns {Promise<{msg: string, data, bizmsg: *|string, status: number}|any>}
*/
async getAllPathName(pobj){
let url = settings.centerAppUrl() + 'action/opProduct/springBoard';
pobj.actionType = 'getAllPathName';
let result = await this.restPostUrl(pobj,url);
if(result.status !=0){
return system.getResultFail(-1,'获取数据失败,请稍后再试!');
}
let data = result.data;
let map = new Map();
for(let i =0;i<data.length;i++){
let item = data[i];
let strs = item.path_name.split('/');
let classOne = strs[1];
let classTwo = strs[2];
if(map.has(classOne)){
let val = map.get(classOne);
val.push(classTwo)
map.set(classOne,val);
}else{
let arr = [];
arr.push(classTwo)
map.set(classOne,arr);
}
}
let resultData = [];
map.forEach((v,k) =>{
let obj = {};
obj['key'] = k;
obj['data'] = v;
resultData.push(obj)
})
return system.getResult(resultData);
}
}
module.exports = UtilsProductService;
\ No newline at end of file
const system = require("../../../system");
var settings = require("../../../../config/settings");
const querystring = require('querystring');
const settings = require("../../../../config/settings");
const AppServiceBase = require("../../app.base");
class UtilsPushService extends AppServiceBase {
constructor() {
super();
};
async aliBusiness2Delivery(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/aliBusiness2Delivery",
content: JSON.stringify(pobj),
resultInfo: productItemInterfaceResult.data ? JSON.stringify(productItemInterfaceResult.data) : "接口数据为空",
optitle: opType + "推送蜂擎获取的接口信息->aliBusiness2Delivery",
});
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 business2Channel(pobj, opType) {//供业务调用,在代码中调用,不在db中做配置进行调用
console.log("business2Channel++++++++start++++++++++");
console.log(pobj,"business2Channel++++++++++++++++++");
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";
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/aliBusiness2Fq",
content: JSON.stringify(pobj),
resultInfo: productItemInterfaceResult.data ? JSON.stringify(productItemInterfaceResult.data) : "接口数据为空",
optitle: pobj.opType + "推送蜂擎获取的接口信息->aliBusiness2Fq",
});
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 pushBusInfo(pobj, opType, isDelProductInfo) {//推送业务总入口,不在db中做配置进行调用
console.log(JSON.stringify(pobj), ".......pushBusInfo........................."+opType);
var interface_list = pobj.interface_info ? pobj.interface_info : pobj.actionBody.product_info.interface_info;
if (!interface_list) {
return system.getResult(null, "暂无推送配置");
}
var interface_list_temp = interface_list.filter(f => f.op_type == opType);
console.log(interface_list_temp,"interface_list_temp+++++++++++++++");
if (!interface_list_temp || interface_list_temp.length == 0) {
return system.getResult(null, "暂无【" + opType + "】的推送配置");
}
var self = this;
let result;
if (interface_list_temp && interface_list_temp.length == 1) {
const element = interface_list_temp[0];
let reflexActionRes = await self.reflexAction(element, opType, pobj, isDelProductInfo);
self.execClientNew.execLogs("pushBusInfo-reflexAction-result:", pobj, "center-channel-reflexAction", reflexActionRes, null);
return reflexActionRes;
} else {
for (let index = 0; index < interface_list_temp.length; index++) {
const element = interface_list_temp[index];
result = await self.reflexAction(element, opType, pobj, isDelProductInfo);
self.execClientNew.execLogs("pushBusInfo-for---reflexAction-result:", pobj, "center-channel-reflexAction", result, null);
}
return result;
}
}
//不要在此类中增加新的方法
class UtilsPushService extends AppServiceBase {
constructor() {
super();
};
async againPushBusInfo(pobj) {//再次推送业务总入口-重试
var interface_info = pobj.interface_info ? pobj.interface_info : pobj.actionBody.product_info.interface_info;
if (!interface_info) {
return system.getResult(null, "暂无推送配置");
}
var result = await this.reflexAction(interface_info, pobj.opType, pobj, pobj.isDelProductInfo || 1);
this.execClientNew.execLogs("againPushBusInfo-reflexAction-result:", pobj, "center-channel-reflexAction", result, null);
if (result.status != 0) {
return result;
async business2Channel(pobj, opType) {//供业务调用,在代码中调用,不在db中做配置进行调用,适用所有渠道推送
pobj.actionType = "getAppInterface";
let reqUrl = settings.centerAppUrl() + "action/opProduct/springBoard";
let productItemInterfaceResult = await this.restPostUrl(pobj, reqUrl);
pobj.interface_info = productItemInterfaceResult.data;
//日志记录
this.execClientNew.execLogs(`${pobj.opType}推送蜂擎获取的接口信息->business2Channel->app(getAppInterface)`, pobj, "center-channel-utilsPushSve-business2Channel", productItemInterfaceResult.data, null);
if (pobj.interface_info && pobj.interface_info.length > 0) {
await this.pushBusInfo(pobj, opType, 1);
return system.getResultSuccess();
}
return system.getResult(null, "push Fail,interface_info data is empty");
}
return system.getResultSuccess();
}
async reflexAction(interface_info, opType, pobj, isDelProductInfo) {
console.log(interface_info,"reflexAction+++++++++++++++"+opType);
console.log(pobj,"reflexAction++++++2+++++++++"+opType);
var refResult = null;
pobj.interface_info = interface_info;
pobj.opType = opType;
pobj.isDelProductInfo = isDelProductInfo;
try {
if (interface_info.interface_type == "bd") {
if (!interface_info.method_name) {
return system.getResult(null, "产品接口参数信息有误,100350");
}//操作的方法名称
var invokeObj = system.getObject(interface_info.interface_url);
if (!invokeObj[interface_info.method_name]) {
return system.getResult(null, "产品接口参数方法信息有误,100360");
async pushBusInfo(pobj, opType, isDelProductInfo) {//推送业务总入口,不在db中做配置进行调用
console.log(JSON.stringify(pobj), ".......pushBusInfo........................." + opType);
var interface_list = pobj.interface_info ? pobj.interface_info : pobj.actionBody.product_info.interface_info;
if (!interface_list) {
return system.getResult(null, "暂无推送配置");
}
pobj.interface_params = interface_info.params;
var params = [pobj];
var doRes = await invokeObj[interface_info.method_name].apply(invokeObj, params);
return doRes;
}
else if (interface_info.interface_type == "yc") {
var actionBody = pobj.actionBody;
if (!interface_info.interface_url) {
return system.getResult(null, "产品接口interface_url参数不能为空,100370");
var interface_list_temp = interface_list.filter(f => f.op_type == opType);
// console.log(interface_list_temp, "interface_list_temp+++++++++++++++");
if (!interface_list_temp || interface_list_temp.length == 0) {
return system.getResult(null, "暂无【" + opType + "】的推送配置");
}
if (actionBody.product_info && actionBody.product_info.price_list) {
delete actionBody.product_info["price_list"];
var self = this;
let result;
if (interface_list_temp && interface_list_temp.length == 1) {
const element = interface_list_temp[0];
let reflexActionRes = await self.reflexAction(element, opType, pobj, isDelProductInfo);
self.execClientNew.execLogs("utilsPushSve-pushBusInfo-result11:", pobj, "center-channel-reflexAction", reflexActionRes, null);
return reflexActionRes;
} else {
for (let index = 0; index < interface_list_temp.length; index++) {
const element = interface_list_temp[index];
result = await self.reflexAction(element, opType, pobj, isDelProductInfo);
self.execClientNew.execLogs("utilsPushSve-pushBusInfo-result22:", pobj, "center-channel-reflexAction", result, null);
}
return result;
}
if (actionBody.product_info && actionBody.product_info.interface_info) {
delete actionBody.product_info["interface_info"];
}
async againPushBusInfo(pobj) {//再次推送业务总入口-重试
var interface_info = pobj.interface_info ? pobj.interface_info : pobj.actionBody.product_info.interface_info;
if (!interface_info) {
return system.getResult(null, "暂无推送配置");
}
if (isDelProductInfo && isDelProductInfo == 1 && actionBody.product_info) {
delete actionBody["product_info"];
}//是否删除产品信息进行推送
refResult = await this.restPostUrl(pobj.actionBody, interface_info.interface_url);
if (refResult.code == 1) {
refResult.status = 0
var result = await this.reflexAction(interface_info, pobj.opType, pobj, pobj.isDelProductInfo || 1);
this.execClientNew.execLogs("againPushBusInfo-reflexAction-result:", pobj, "center-channel-reflexAction", result, null);
if (result.status != 0) {
return result;
}
this.disposePushResult(pobj, refResult, "ycUrlPush->reflexAction->refResult", this.pushlogFailType.NEWRPC);
}
return system.getResultSuccess();
} catch (e) {
var errorResult = system.getResult(null, "送异常-->reflexAction->" + e.stack)
return await this.disposePushResultFail(pobj, errorResult, "数据推送异常-->reflexAction-->errorResult", this.pushlogFailType.FAILLOG);
return system.getResultSuccess();
}
}
//---------百度---zhuangbing--2020.10.28------start--------------------------------------------
async baiduBusiness2Fq(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/baiduBusiness2Fq",
content: JSON.stringify(pobj),
resultInfo: productItemInterfaceResult.data ? JSON.stringify(productItemInterfaceResult.data) : "接口数据为空",
optitle: pobj.opType + "推送蜂擎获取的接口信息->baiduBusiness2Fq",
pobj:pobj
});
if (pobj.interface_info) {
var pushBusInfo = await this.pushBusInfo(pobj, opType, 1);
return system.getResultSuccess(pushBusInfo);
}
return system.getResult(null, "push Fail,interface_info data is empty");
}
async baiduBusiness2Delivery(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;
console.log(pobj,"baiduBusiness2Delivery-zhuangbing------------------------------"+opType);
console.log(productItemInterfaceResult);
//日志记录
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/baiduBusiness2Delivery",
content: JSON.stringify(pobj),
resultInfo: productItemInterfaceResult.data ? JSON.stringify(productItemInterfaceResult.data) : "接口数据为空",
optitle: opType + "推送蜂擎获取的接口信息->baiduBusiness2Delivery",
pobj:pobj
});
if (pobj.interface_info) {
await this.pushBusInfo(pobj, opType, 1);
return system.getResultSuccess();
async reflexAction(interface_info, opType, pobj, isDelProductInfo) {
console.log(`pobj=${JSON.stringify(pobj)},interface_info=${JSON.stringify(interface_info)}`, `reflexAction.......opType=${opType}`);
var refResult = null;
pobj.interface_info = interface_info;
pobj.opType = opType;
pobj.isDelProductInfo = isDelProductInfo;
try {
if (interface_info.interface_type == "bd") {
if (!interface_info.method_name) {
return system.getResult(null, "产品接口参数信息有误,100350");
}//操作的方法名称
var invokeObj = system.getObject(interface_info.interface_url);
if (!invokeObj[interface_info.method_name]) {
return system.getResult(null, "产品接口参数方法信息有误,100360");
}
pobj.interface_params = interface_info.params;
var params = [pobj];
var doRes = await invokeObj[interface_info.method_name].apply(invokeObj, params);
return doRes;
} else if (interface_info.interface_type == "yc") {
var actionBody = pobj.actionBody;
if (!interface_info.interface_url) {
return system.getResult(null, "产品接口interface_url参数不能为空,100370");
}
if (actionBody.product_info && actionBody.product_info.price_list) {
delete actionBody.product_info["price_list"];
}
if (actionBody.product_info && actionBody.product_info.interface_info) {
delete actionBody.product_info["interface_info"];
}
if (isDelProductInfo && isDelProductInfo == 1 && actionBody.product_info) {
delete actionBody["product_info"];
}//是否删除产品信息进行推送
refResult = await this.restPostUrl(pobj.actionBody, interface_info.interface_url);
if (refResult.code == 1) {
refResult.status = 0
}
this.disposePushResult(pobj, refResult, "ycUrlPush->reflexAction->refResult", this.pushlogFailType.NEWRPC);
}
return system.getResultSuccess();
} catch (e) {
var errorResult = system.getResult(null, "送异常-->reflexAction->" + e.stack)
return await this.disposePushResultFail(pobj, errorResult, "数据推送异常-->reflexAction-->errorResult", this.pushlogFailType.FAILLOG);
}
}
return system.getResult(null, "push Fail,interface_info data is empty");
}
//---------百度---zhuangbing--2020.10.28------end--------------------------------------------
}
module.exports = UtilsPushService;
var system = require("../../../system");
const AppServiceBase = require("../../app.base");
//外部请求结果校验以及相应工具处理类
class utilsTlBankSve extends AppServiceBase {
constructor() {
super();
}
//格式化时间
convertDate(time) {
if (time == null) {
return "";
}
var date = new Date(Number(time * 1000));
var y = 1900 + date.getYear();
var m = "0" + (date.getMonth() + 1);
var d = "0" + date.getDate();
return y + "-" + m.substring(m.length - 2, m.length) + "-" + d.substring(d.length - 2, d.length);
}
//计算并返回指定字段
formulaContinued(tms) {
let result = [];
for (let i = 0; i < tms.length; i++) {
let tmInfo = tms[i];
let tm_expiry = '';
if (!tmInfo.MARKNAME) { //REGDATE注册公告日期
continue;
}
if (tmInfo.REGDATE) {
let zcrqFormat = new Date(tmInfo.REGDATE * 1000); //注册日期
zcrqFormat.setFullYear(zcrqFormat.getFullYear() + 10); //专用起始日期计算
zcrqFormat.setMonth(zcrqFormat.getMonth()); //专用起始日期计算
zcrqFormat.setDate(zcrqFormat.getDate()); //专用起始日期计算
tm_expiry = this.convertDate(zcrqFormat); //计算商标到期日
}
let tmObject = {
"tm_comName": tmInfo.AGENTNAME, //代理机构
"tm_img": tmInfo.MARKIMAGE, //商标图片
"tm_name": tmInfo.MARKNAME, //商标名称
"tm_appDate": tmInfo.APPDATE, //申请日期
"tm_isInvalid": tmInfo.ISINVALID, //状态
"tm_expiry": tm_expiry //商标到期日
}
result.push(tmObject);
}
return result;
}
}
module.exports = utilsTlBankSve;
\ No newline at end of file
......@@ -102,7 +102,7 @@ class utils360Sve extends AppServiceBase {
appInfo: pobj.appInfo
}
// 还需要推送fq 需要提醒会计。目前没有
this.utilsPushSve.aliBusiness2Delivery(deliveryObj, "submitService");
this.utilsPushSve.business2Channel(deliveryObj, "submitService");
return system.getResultSuccess({orderNo:pobj.actionBody.orderNo});
}
......@@ -160,7 +160,7 @@ class utils360Sve extends AppServiceBase {
deliveryObj.actionBody.serviceStartTime = actionBody.serviceStartTime,
deliveryObj.actionBody.serviceEndTime = actionBody.serviceEndTime
}
this.utilsPushSve.aliBusiness2Delivery(deliveryObj, "notifyService");
this.utilsPushSve.business2Channel(deliveryObj, "notifyService");
return system.getResultSuccess();
}
......
......@@ -613,7 +613,7 @@ class UtilsTmAliyunService extends AppServiceBase {
return result;
}
async taskAliTmUpdate() {//操作阿里商标更新任务---外部调用
async taskAliTmUpdate() {//操作阿里商标(钉钉自主注册,没有上线)更新任务---外部调用
var pobj = { actionBody: {} };
var dbAliAllTmListResult = await this.getAllAliChannelTmDelivery(pobj);
if (dbAliAllTmListResult.status != 0) {
......
......@@ -140,8 +140,8 @@ class UtilsTmOrderCallService extends AppServiceBase {
}
var getjsonurl=settings.tmtransactionUrl()+"/tmtransaction/action/trademarktransaction/springBoard"
var jsonurl=await this.restPostUrl(obj,getjsonurl);
if(!jsonurl){
console.log(jsonurl);
if(!jsonurl || !jsonurl.data){
console.log(`createjsonfile返回错误,返回值:${jsonurl}`);
return system.getResultSuccess();
}
var upobj={
......
......@@ -169,6 +169,9 @@ class ServiceBase {
async customQuery(sql, paras, t) {
return this.dao.customQuery(sql, paras, t);
}
async customUpdate(sql, paras, t) {
return this.dao.customUpdate(sql, paras, t);
}
async findCount(whereObj = null) {
return this.dao.findCount(whereObj);
}
......
var fs = require("fs");
var objsettings = require("../config/objsettings");
var settings = require("../config/settings");
class System {
static declare(ns) {
var ar = ns.split('.');
var root = System;
for (var i = 0, len = ar.length; i < len; ++i) {
var n = ar[i];
if (!root[n]) {
root[n] = {};
root = root[n];
} else {
root = root[n];
}
}
}
static register(key, ClassObj) {
if (System.objTable[key] != null) {
throw new Error("相同key的对象已经存在");
} else {
let obj = new ClassObj();
System.objTable[key] = obj;
}
return System.objTable[key];
}
static getResult(data, opmsg = "操作成功", req) {
return {
status: !data ? -1 : 0,
msg: opmsg,
data: data || "",
bizmsg: req && req.session && req.session.bizmsg ? req.session.bizmsg : "empty"
};
}
static getErrResult2(errmsg) {
return this.getResult2(null, null, null, errmsg);
}
static getResult2(data, req, okmsg = "操作成功", errmsg = "操作失败") {
var result = {
status: 0,
msg: okmsg,
data: data,
};
if (req && req.session && req.session.bizmsg) {
result.bizmsg = req.session.bizmsg;
req.session.bizmsg = null;
} else {
result.bizmsg = "empty";
}
if (!data) {
result.status = -1;
result.msg = errmsg;
}
return result;
}
static getResult3(data, req, okmsg = "操作成功", errmsg = "操作失败") {
var total = data.total;
data = data.hits;
var sources = [];
data.forEach(function (d) {
sources.push(d._source);
})
var result = {
status: 0,
msg: okmsg,
total: total,
data: sources,
};
if (req && req.session && req.session.bizmsg) {
result.bizmsg = req.session.bizmsg;
req.session.bizmsg = null;
} else {
result.bizmsg = "empty";
}
if (!data) {
result.status = -1;
result.msg = errmsg;
}
return result;
}
static getResult4(j, req, okmsg = "操作成功", errmsg = "操作失败") {
var aggs = j.aggregations;
var codes_count = aggs.ncl_one_codes_count;
var bucketlist = codes_count.buckets;
var bucklist = [];
bucketlist.forEach(function (d) {
bucklist.push(d);
})
var data = j.hits;
var total = data.total;
var hit = data.hits;
var sources = [];
hit.forEach(function (d) {
sources.push(d._source);
})
var result = {
status: 0,
msg: okmsg,
total: total,
data: sources,
buckets: bucklist,
};
if (req && req.session && req.session.bizmsg) {
result.bizmsg = req.session.bizmsg;
req.session.bizmsg = null;
} else {
result.bizmsg = "empty";
}
if (!hit) {
result.status = -1;
result.msg = errmsg;
}
return result;
}
static getResultjuhe4(j, req, okmsg = "操作成功", errmsg = "操作失败") {
var aggs = j.aggregations;
var codes_count = aggs.ncl_one_codes_count;
var bucketlist = codes_count.buckets;
var bucklist = [];
bucketlist.forEach(function (d) {
bucklist.push(d);
})
var result = {
status: 0,
msg: okmsg,
buckets: bucklist,
};
if (!bucklist) {
result.status = -1;
result.msg = errmsg;
}
return result;
}
static getResultjuhetwo(j, req, okmsg = "操作成功", errmsg = "操作失败") {
var aggs = j.aggregations;
var notice_count = aggs.notice_count;
var bucketlist = notice_count.buckets;
var bucklist = [];
bucketlist.forEach(function (d) {
var notice_issue = d.key;
var date = d.date_max.value;
var data = {
notice_issue: notice_issue,
date: date
}
bucklist.push(data);
})
var result = {
status: 0,
msg: okmsg,
buckets: bucklist,
};
if (!bucklist) {
result.status = -1;
result.msg = errmsg;
}
return result;
}
/**
* 请求返回成功
* @param {*} data 操作成功返回的数据
* @param {*} okmsg 操作成功的描述
*/
static getResultSuccess(data, okmsg = "success") {
return {
status: 0,
msg: okmsg,
data: data || "成功"
};
}
// 2020 0916 lin 新增返回格式 成功status为1
static getResultRedisQueueSuccess(data, okmsg = "success") {
return {
status: 1,
msg: okmsg,
data: data || null,
};
}
/**
* 请求返回成功 自定义
* @param {*} data 操作成功返回的数据
* @param {*} okmsg 操作成功的描述
*/
static getResultCustomSuccess(data, okmsg = "success") {
return {
status: 0,
msg: okmsg,
...data
};
}
/**
* 请求返回失败
* @param {*} status 操作失败状态,默认为-1
* @param {*} errmsg 操作失败的描述,默认为fail
* @param {*} data 操作失败返回的数据
*/
static getResultFail(status = -1, errmsg = "fail", data = "") {
return {
status: status,
msg: errmsg,
data: data,
};
}
static getObject(objpath) {
var pathArray = objpath.split(".");
var packageName = pathArray[0];
var groupName = pathArray[1];
var filename = pathArray[2];
var classpath = "";
if (filename) {
classpath = objsettings[packageName] + "/" + groupName;
} else {
classpath = objsettings[packageName];
filename = groupName;
}
var objabspath = classpath + "/" + filename + ".js";
if (System.objTable[objabspath] != null) {
console.log(objabspath, "get cached obj....");
return System.objTable[objabspath];
} else {
console.log("no cached...");
var ClassObj = require(objabspath);
return System.register(objabspath, ClassObj);
}
}
static getUiConfig(appid) {
var configPath = settings.basepath + "/app/base/db/metadata/" + appid + "/index.js";
if (settings.env == "dev") {
delete require.cache[configPath];
}
var configValue = require(configPath);
return configValue;
}
static getUiConfig2(appid) {
var configPath = settings.basepath + "/app/base/db/metadata/index.js";
// if(settings.env=="dev"){
// console.log("delete "+configPath+"cache config");
// delete require.cache[configPath];
// }
delete require.cache[configPath];
var configValue = require(configPath);
return configValue[appid];
}
static get_client_ip(req) {
var ip = req.headers['x-forwarded-for'] ||
req.ip ||
req.connection.remoteAddress ||
req.socket.remoteAddress ||
(req.connection.socket && req.connection.socket.remoteAddress) || '';
var x = ip.match(/(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9])\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[0-9])$/);
if (x) {
return x[0];
} else {
return "localhost";
}
};
static y2f(y) {
if (!y) {
return 0;
}
return (Number(y) * 100).toFixed(0);
}
static f2y(f) {
if (!f) {
return 0;
}
return parseFloat((Number(f) / 100).toFixed(2));
}
static f2y4list(list, fields, prev) {
if (!list || list.length == 0 || !fields || fields.length == 0) {
return;
}
prev = prev || "";
for (var item of list) {
for (var f of fields) {
var v = item[f];
if (v) {
try {
item[f + "_y"] = prev + parseFloat((Number(v) / 100).toFixed(2));
} catch (error) {
console.log(error);
}
}
}
}
}
static declare(ns) {
var ar = ns.split('.');
var root = System;
for (var i = 0, len = ar.length; i < len; ++i) {
var n = ar[i];
if (!root[n]) {
root[n] = {};
root = root[n];
} else {
root = root[n];
}
}
}
static register(key, ClassObj) {
if (System.objTable[key] != null) {
throw new Error("相同key的对象已经存在");
} else {
let obj = new ClassObj();
System.objTable[key] = obj;
}
return System.objTable[key];
}
static getResult(data, opmsg = "操作成功", req) {
return {
status: !data ? -1 : 0,
msg: opmsg,
data: data || "",
bizmsg: req && req.session && req.session.bizmsg ? req.session.bizmsg : "empty"
};
}
static getErrResult2(errmsg) {
return this.getResult2(null, null, null, errmsg);
}
static getResult2(data, req, okmsg = "操作成功", errmsg = "操作失败") {
var result = {
status: 0,
msg: okmsg,
data: data,
};
if (req && req.session && req.session.bizmsg) {
result.bizmsg = req.session.bizmsg;
req.session.bizmsg = null;
} else {
result.bizmsg = "empty";
}
if (!data) {
result.status = -1;
result.msg = errmsg;
}
return result;
}
static getResult3(data, req, okmsg = "操作成功", errmsg = "操作失败") {
var total = data.total;
data = data.hits;
var sources = [];
data.forEach(function (d) {
sources.push(d._source);
})
var result = {
status: 0,
msg: okmsg,
total: total,
data: sources,
};
if (req && req.session && req.session.bizmsg) {
result.bizmsg = req.session.bizmsg;
req.session.bizmsg = null;
} else {
result.bizmsg = "empty";
}
if (!data) {
result.status = -1;
result.msg = errmsg;
}
return result;
}
static getResult4(j, req, okmsg = "操作成功", errmsg = "操作失败") {
var aggs = j.aggregations;
var codes_count = aggs.ncl_one_codes_count;
var bucketlist = codes_count.buckets;
var bucklist = [];
bucketlist.forEach(function (d) {
bucklist.push(d);
})
var data = j.hits;
var total = data.total;
var hit = data.hits;
var sources = [];
hit.forEach(function (d) {
sources.push(d._source);
})
var result = {
status: 0,
msg: okmsg,
total: total,
data: sources,
buckets: bucklist,
};
if (req && req.session && req.session.bizmsg) {
result.bizmsg = req.session.bizmsg;
req.session.bizmsg = null;
} else {
result.bizmsg = "empty";
}
if (!hit) {
result.status = -1;
result.msg = errmsg;
}
return result;
}
static getResultjuhe4(j, req, okmsg = "操作成功", errmsg = "操作失败") {
var aggs = j.aggregations;
var codes_count = aggs.ncl_one_codes_count;
var bucketlist = codes_count.buckets;
var bucklist = [];
bucketlist.forEach(function (d) {
bucklist.push(d);
})
var result = {
status: 0,
msg: okmsg,
buckets: bucklist,
};
if (!bucklist) {
result.status = -1;
result.msg = errmsg;
}
return result;
}
static getResultjuhetwo(j, req, okmsg = "操作成功", errmsg = "操作失败") {
var aggs = j.aggregations;
var notice_count = aggs.notice_count;
var bucketlist = notice_count.buckets;
var bucklist = [];
bucketlist.forEach(function (d) {
var notice_issue = d.key;
var date = d.date_max.value;
var data = {
notice_issue: notice_issue,
date: date
}
bucklist.push(data);
})
var result = {
status: 0,
msg: okmsg,
buckets: bucklist,
};
if (!bucklist) {
result.status = -1;
result.msg = errmsg;
}
return result;
}
/**
* 请求返回成功
* @param {*} data 操作成功返回的数据
* @param {*} okmsg 操作成功的描述
*/
static getResultSuccess(data, okmsg = "success") {
return {
status: 0,
msg: okmsg,
data: data || "成功"
};
}
// 2020 0916 lin 新增返回格式 成功status为1
static getResultRedisQueueSuccess(data, okmsg = "success") {
return {
status: 1,
msg: okmsg,
data: data || null,
};
}
/**
* 请求返回成功 自定义
* @param {*} data 操作成功返回的数据
* @param {*} okmsg 操作成功的描述
*/
static getResultCustomSuccess(data, okmsg = "success") {
return {
status: 0,
msg: okmsg,
...data
};
}
/**
* 请求返回失败
* @param {*} status 操作失败状态,默认为-1
* @param {*} errmsg 操作失败的描述,默认为fail
* @param {*} data 操作失败返回的数据
*/
static getResultFail(status = -1, errmsg = "fail", data = "") {
return {
status: status,
msg: errmsg,
data: data,
};
}
/**
* 请求返回失败
* @param status
* @param errmsg
* @param data
* @param errorMsg
* @returns {{msg: string, data: string, status: number, errorMsg: *}}
*/
static getResultNewFail(status = -1, errmsg = "fail", data = "", errorMsg) {
return {
status: status,
msg: errmsg,
errorMsg: errorMsg,
data: data,
};
}
static getObject(objpath) {
var pathArray = objpath.split(".");
var packageName = pathArray[0];
var groupName = pathArray[1];
var filename = pathArray[2];
var classpath = "";
if (filename) {
classpath = objsettings[packageName] + "/" + groupName;
} else {
classpath = objsettings[packageName];
filename = groupName;
}
var objabspath = classpath + "/" + filename + ".js";
if (System.objTable[objabspath] != null) {
console.log(objabspath, "get cached obj....");
return System.objTable[objabspath];
} else {
console.log("no cached...");
var ClassObj = require(objabspath);
return System.register(objabspath, ClassObj);
}
}
static getUiConfig(appid) {
var configPath = settings.basepath + "/app/base/db/metadata/" + appid + "/index.js";
if (settings.env == "dev") {
delete require.cache[configPath];
}
var configValue = require(configPath);
return configValue;
}
static getUiConfig2(appid) {
var configPath = settings.basepath + "/app/base/db/metadata/index.js";
// if(settings.env=="dev"){
// console.log("delete "+configPath+"cache config");
// delete require.cache[configPath];
// }
delete require.cache[configPath];
var configValue = require(configPath);
return configValue[appid];
}
static get_client_ip(req) {
var ip = req.headers['x-forwarded-for'] ||
req.ip ||
req.connection.remoteAddress ||
req.socket.remoteAddress ||
(req.connection.socket && req.connection.socket.remoteAddress) || '';
var x = ip.match(/(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9])\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[0-9])$/);
if (x) {
return x[0];
} else {
return "localhost";
}
};
static y2f(y) {
if (!y) {
return 0;
}
return (Number(y) * 100).toFixed(0);
}
static f2y(f) {
if (!f) {
return 0;
}
return parseFloat((Number(f) / 100).toFixed(2));
}
static f2y4list(list, fields, prev) {
if (!list || list.length == 0 || !fields || fields.length == 0) {
return;
}
prev = prev || "";
for (var item of list) {
for (var f of fields) {
var v = item[f];
if (v) {
try {
item[f + "_y"] = prev + parseFloat((Number(v) / 100).toFixed(2));
} catch (error) {
console.log(error);
}
}
}
}
}
}
Date.prototype.Format = function (fmt) { //author: meizz
var o = {
"M+": this.getMonth() + 1, //月份
"d+": this.getDate(), //日
"h+": this.getHours(), //小时
"m+": this.getMinutes(), //分
"s+": this.getSeconds(), //秒
"q+": Math.floor((this.getMonth() + 3) / 3), //季度
"S": this.getMilliseconds() //毫秒
};
if (/(y+)/.test(fmt))
fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
for (var k in o)
if (new RegExp("(" + k + ")").test(fmt))
fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
return fmt;
var o = {
"M+": this.getMonth() + 1, //月份
"d+": this.getDate(), //日
"h+": this.getHours(), //小时
"m+": this.getMinutes(), //分
"s+": this.getSeconds(), //秒
"q+": Math.floor((this.getMonth() + 3) / 3), //季度
"S": this.getMilliseconds() //毫秒
};
if (/(y+)/.test(fmt))
fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
for (var k in o)
if (new RegExp("(" + k + ")").test(fmt))
fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
return fmt;
}
System.exTime = 4 * 3600;//缓存过期时间,4小时
System.exTime = 4 * 3600; //缓存过期时间,4小时
System.objTable = {};
......
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) {
if (process.env.APP_ENV === "prod") {
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)
});
constructor() {
this.execClient = system.getObject('util.execClient');
this.gatewayurl = "https://oapi.dingtalk.com/robot/send?access_token=2f1ada261ea84f6c621db487ac18d11eba8984202bd82adda8810770a8240572"
this.businessToFqUrl = "https://oapi.dingtalk.com/robot/send?access_token=9e215f0f1d77980ee6b39e88a82a7c6e5d290775f76d9a8346e97697f8df9788"
this.businessTo360Url = "https://oapi.dingtalk.com/robot/send?access_token=2947bdf6163288a5a5c654640e78ea718d21fcae6601efbb4edd53209abc1c45";
}
//推送峰擎异常提醒
async gatewayPushError(err) {
if (process.env.APP_ENV === "prod") {
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)
});
}
}
}
//渠道钉钉提醒
async gatewayPushByChannel(orderNo,appInfo){
let gatewayUrl = setttings.dingRobotUrl(appInfo.uapp_id);
if (process.env.APP_ENV != "dev" && gatewayUrl) {
let c = `注意提醒:${appInfo.app_name}->有订单待处理,订单号${orderNo},老板们加油,加油,加油 !!!`
let t = new Date().toLocaleString()
this.execClient.execPost({
"msgtype": "text",
"text": {"content": t + c}
}, gatewayUrl).catch(err => {
console.log(err)
});
//渠道钉钉提醒
async gatewayPushTo360(orderNo) {
if (process.env.APP_ENV != "dev") {
let c = `注意提醒:360云商机->有订单待处理,订单号${orderNo},老板们加油,加油,加油 !!!`
let t = new Date().toLocaleString()
this.execClient.execPost({
"msgtype": "text",
"text": {"content": t + c}
}, this.businessTo360Url).catch(err => {
console.log(err)
});
}
}
//渠道订单到峰擎--sku没有查询到
async businessPushFqByChannel(params) {
if (process.env.APP_ENV != "dev") {
let c = `注意提醒:${appInfo.app_name}->有订单待处理,渠道下sku查询不到,参数:${JSON.stringify(params)},老板们加油,加油,加油 !!!`
let t = new Date().toLocaleString()
this.execClient.execPost({
"msgtype": "text",
"text": {"content": t + c},
at: {
atMobiles: ["13051727697", "13453222948", "18201231253"]//孟令强、王斌、郭峰
},
}, this.businessToFqUrl).catch(err => {
console.log(err)
});
}
}
}
}
module.exports = dingClient;
......@@ -18,6 +18,10 @@ class ExecClient {
this.cmdBaiduPostPattern = "curl -k -H 'Content-type: application/json' -H 'Authorization: {Authorization}' -d '{data}' {url}";
this.cmdGetpatternToken = "curl -G -k -H 'authorization:{token}' -d '{data}' {url}";
//易名
this.cmdEnamePostPattern = "curl -k -H 'Content-type: application/json' -d '{data}' {url}";
}
getUUID() {
var uuid = uuidv4();
......@@ -60,6 +64,14 @@ class ExecClient {
console.log(cmd);
return cmd;
}
FetchEnamePostCmd(subData, url) {
var data = JSON.stringify(subData);
var cmd = this.cmdEnamePostPattern.replace(/\{data\}/g,
data).replace(/\{url\}/g, url);
console.log(cmd);
return cmd;
}
FetchPushDataPostCmd(subData, url, token, requestId) {
var requestId = requestId || this.getUUID();
var data = JSON.stringify(subData);
......@@ -90,6 +102,11 @@ class ExecClient {
var result = await this.exec(cmd);
return result;
}
async execEnamePost(subData, url) {
let cmd = this.FetchEnamePostCmd(subData, url);
var result = await this.exec(cmd);
return result;
}
async execPushDataPost(subData, url, token, requestId) {
if(settings.env == 'dev'){
axios.defaults.headers['token'] = token;
......
......@@ -6,22 +6,24 @@ const settings = require("../../../app/config/settings");
const axios = require('axios');
const moment = require('moment');
const uuid = require('uuid');
class ExecClientNew {
constructor() {
this.cmdGetPattern = "curl -G -X GET '{url}'";
this.cmdPostPattern = "curl -k -H 'Content-type: application/json' -d '{data}' {url}";
// this.cmdPushDataPostPattern = "curl -k -H 'Content-type: application/json' -H 'token:{tk}' -H 'appkey:{appkey}' -d '{data}' {url}";
}
/**
* 带超时时间的post请求
* @param {*} execFile 执行文件
* @param {*} params 请求数据-json格式
* @param {*} url 请求地址
* @param {*} ContentType 请求头类型,默认application/json
* @param {*} headData 请求头内容-json格式,如:请求头中传递token,格式:{token:"9098902q849q0434q09439"}
* @param {*} timeOut 超时时间设置,单位秒
* @param {*} req 请求信息
*/
* 带超时时间的post请求
* @param {*} execFile 执行文件
* @param {*} params 请求数据-json格式
* @param {*} url 请求地址
* @param {*} ContentType 请求头类型,默认application/json
* @param {*} headData 请求头内容-json格式,如:请求头中传递token,格式:{token:"9098902q849q0434q09439"}
* @param {*} timeOut 超时时间设置,单位秒
* @param {*} req 请求信息
*/
async execPostTimeOutByBusiness(execFile, params, url, ContentType, headData, timeOut = 60, req) {
var rtn = null;
var reqResult = null;
......@@ -99,6 +101,7 @@ class ExecClientNew {
return reqResult;
}
}
/**
* 记录日志信息
* @param {*} opTitle 操作的标题
......@@ -109,37 +112,39 @@ class ExecClientNew {
*/
async execLogs(opTitle, params, identifyCode, resultInfo, errorInfo) {
var reqUrl = settings.opNewLogUrl();
params = typeof params === 'object' ? JSON.stringify(params) : params || "";
resultInfo = typeof resultInfo === 'object' ? JSON.stringify(resultInfo) : resultInfo || "";
errorInfo = typeof errorInfo === 'object' ? JSON.stringify(errorInfo) : errorInfo || "";
let tmpParams1 = typeof params === 'object' ? JSON.stringify(params) : params || "";
let tmpResultInfo = typeof resultInfo === 'object' ? JSON.stringify(resultInfo) : resultInfo || "";
let tmpErrorInfo = typeof errorInfo === 'object' ? JSON.stringify(errorInfo) : errorInfo || "";
var tmpParams = {
opTitle: opTitle || "",
identifyCode: identifyCode || "",
messageBody: params,
resultInfo: resultInfo || "",
errorInfo: errorInfo || "",
messageBody: tmpParams1,
resultInfo: tmpResultInfo || "",
errorInfo: tmpErrorInfo || "",
requestId: resultInfo ? resultInfo.requestId || "" : "",
created_at: moment().format("YYYY-MM-DD HH:mm:ss:SSS"),
timestamp: Date.now()
}
this.execPostTimeOut(tmpParams, reqUrl, 'application/json', null, 20);
}
/**
* get请求
* @param {*} params 提交的数据-格式JSON
* @param {*} url
* @param {*} headData 请求信息,JSON格式
* @param {*} url
* @param {*} headData 请求信息,JSON格式
*/
async execGet(params, url, headData) {
let cmd = this.FetchGetCmd(params, url, headData);
var result = await this.exec(cmd);
return result;
}
/**
*
*
* @param {*} params 提交的数据JSON格式
* @param {*} url
* @param {*} headData 请求信息,JSON格式
* @param {*} url
* @param {*} headData 请求信息,JSON格式
* @param {*} timeOut 超时时间
*/
async execGetTimeOut(params, url, headData, timeOut = 5000) {
......@@ -148,9 +153,10 @@ class ExecClientNew {
var options = {
timeout: timeOut,
};
const { stdout, stderr } = await exec(cmd, options);
return { stdout, stderr };
const {stdout, stderr} = await exec(cmd, options);
return {stdout, stderr};
}
/**
* 带超时时间的post请求
* @param {*} params 请求数据-json格式
......@@ -169,6 +175,7 @@ class ExecClientNew {
var result = await this.exec(cmd, options, headData);
return result;
}
/**
* 带超时时间的post请求
* @param {*} params 请求数据-json格式
......@@ -195,14 +202,16 @@ class ExecClientNew {
async exec(cmd) {
//await后面表达式返回的promise对象,是then的语法糖,await返回then函数的返回值
//异常需要try/catch自己捕获或外部catch捕获
const { stdout, stderr } = await exec(cmd);
return { stdout, stderr };
const {stdout, stderr} = await exec(cmd);
return {stdout, stderr};
}
FetchGetCmd(params, url, headData) {
var cmd = this.cmdGetPattern.replace(
/\{data\}/g, params).replace(/\{url\}/g, url);
return cmd;
}
FetchPostCmd(params, url, ContentType, headData) {
if (!ContentType) {
ContentType = "application/json";
......@@ -245,9 +254,9 @@ class ExecClientNew {
}
/**
* 返回20位业务订单号
* @param {*} prefix 业务前缀
*/
* 返回20位业务订单号
* @param {*} prefix 业务前缀
*/
async getBusUid(prefix) {
prefix = (prefix || "");
if (prefix) {
......@@ -262,6 +271,7 @@ class ExecClientNew {
var timStr = moment().format("YYYYMMDDHHmm");
return prefix + timStr + uidStr;
}
/**
* 返回指定长度的字符串
* @param {*} len 返回长度
......@@ -286,6 +296,7 @@ class ExecClientNew {
}
return uuid.join('');
}
//--------------------------------------------------辅助方法end-----------------
}
......
......@@ -17,22 +17,27 @@ module.exports = {
"ncSubmitMaterial", "ncNotification", "ncSubmitSolution", "ncCloseNeed", "ncClosePlan",
"rtSubmitMaterial", "rtNotification", "rtSubmitSolution", "rtCloseNeed", "rtClosePlan",
"getParamsFor360", "addOrderWeb", "getPayRecords", "getLoginInfo", "putUserMobileByVcode",
"putUserPwdByMobile", "icpNotifyNew","getOrderStatisticsByUappId","getOrderStatisticsByProduct","getOrdersComparison","getOrdersComparisonList",
"putUserPwdByMobile", "icpNotifyNew", "getOrderStatisticsByUappId", "getOrderStatisticsByProduct", "getOrdersComparison", "getOrdersComparisonList",
"importOrders", "importNeeds", "receiveAliTmOrder", "receiveAliTmOrderRefund","receiveAliTmStatus",
//百度工商注册
"regGetInfoByChannelNeedNo","submitRegNeed","regFeedbackSubmit","regOrderStatus","regOrderClose",
"getSolutionByChannelOrderNo","regSubmitSolution","regNeedClose",
"regWriteCommunicationLog","regQueryExpertCommunicationLogs","regUpdateOrderStatus","regPaySuccess"
"regGetInfoByChannelNeedNo", "submitRegNeed", "regFeedbackSubmit", "regOrderStatus", "regOrderClose",
"getSolutionByChannelOrderNo", "regSubmitSolution", "regNeedClose",
"regWriteCommunicationLog", "regQueryExpertCommunicationLogs", "regUpdateOrderStatus", "regPaySuccess",
//yiming/ename
"eNameCloseOrder",
],
apiMustUserpinList: [
"icpOrderClose",
"submitNeed", "paySuccess", "icpNotify", "getLoginInfo", "icpNotifyNew", "submitIcpProgramme","serviceProviderSubmitMaterial","abolishIcpProgramme",
"submitService","serviceProviderNotification",
"ncSubmitMaterial","ncNotification","ncSubmitSolution","ncCloseNeed","ncClosePlan",
"rtSubmitMaterial","rtNotification","rtSubmitSolution","rtCloseNeed","rtClosePlan",
"submitNeed", "paySuccess", "icpNotify", "getLoginInfo", "icpNotifyNew", "submitIcpProgramme", "serviceProviderSubmitMaterial", "abolishIcpProgramme",
"submitService", "serviceProviderNotification",
"ncSubmitMaterial", "ncNotification", "ncSubmitSolution", "ncCloseNeed", "ncClosePlan",
"rtSubmitMaterial", "rtNotification", "rtSubmitSolution", "rtCloseNeed", "rtClosePlan",
//百度工商注册
"regGetInfoByChannelNeedNo","submitRegNeed","regFeedbackSubmit","regOrderStatus","regOrderClose",
"getSolutionByChannelOrderNo","regSubmitSolution","regNeedClose",
"regWriteCommunicationLog","regQueryExpertCommunicationLogs","regUpdateOrderStatus","regPaySuccess"
"regGetInfoByChannelNeedNo", "submitRegNeed", "regFeedbackSubmit", "regOrderStatus", "regOrderClose",
"getSolutionByChannelOrderNo", "regSubmitSolution", "regNeedClose",
"regWriteCommunicationLog", "regQueryExpertCommunicationLogs", "regUpdateOrderStatus", "regPaySuccess",
//yiming/ename
"eNameCloseOrder",
],
apiSecretPathList: [
"/api/icp/consultation/submit",
......@@ -47,7 +52,88 @@ module.exports = {
"/api/ic/feedback/submit",
"/api/ic/order/notify",
"/api/ic/order/close",
"/api/ic/tool/icname"
"/api/ic/tool/icname",
"/api/tm/consultation/submit",
"/api/tm/feedback/submit",
"/api/tm/status/notify",
"/api/tm/tmcase/nbtzreceiveAssistTmData",
"/api/tm/tmcase/nbtzreceiveEditAssistTmData"
]
},
AREACOMM: {
areaTransform: {
"上海": "上海市",
"东莞": "东莞市",
"佛山": "佛山市",
"北京": "北京市",
"南京": "南京市",
"南昌": "南昌市",
"南通": "南通市",
"台州": "台州市",
"合肥": "合肥市",
"嘉兴": "嘉兴市",
"大连": "大连市",
"天津": "天津市",
"太原": "太原市",
"宁波": "宁波市",
"常州": "常州市",
"广州": "广州市",
"徐州": "徐州市",
"成都": "成都市",
"扬州": "扬州市",
"无锡": "无锡市",
"昆明": "昆明市",
"杭州": "杭州市",
"武汉": "武汉市",
"沈阳": "沈阳市",
"济南": "济南市",
"深圳": "深圳市",
"温州": "温州市",
"烟台": "烟台市",
"福州": "福州市",
"绍兴": "绍兴市",
"苏州": "苏州市",
"西安": "西安市",
"贵阳": "贵阳市",
"郑州": "郑州市",
"重庆": "重庆市",
"金华": "金华市",
"长春": "长春市",
"长沙": "长沙市",
"青岛": "青岛市",
"开封": "开封市",
"哈尔滨": "哈尔滨市",
"石家庄": "石家庄市",
"福建": "福建省",
"广西": "广西",
"广东": "广东省",
"安徽": "安徽省",
"河南": "河南省",
"湖北": "湖北省",
"浙江": "浙江省",
"江苏": "江苏省",
"山东": "山东省",
"陕西": "陕西省",
"宁夏": "宁夏",
"甘肃": "甘肃省",
"新疆": "新疆",
"青海": "青海省",
"河北": "河北省",
"山西": "山西省",
"辽宁": "辽宁省",
"吉林": "吉林省",
"黑龙江": "黑龙江省",
"江西": "江西省",
"湖南": "湖南省",
"四川": "四川省",
"贵州": "贵州省",
"云南": "云南省",
"内蒙古": "内蒙古",
"西藏": "西藏",
"含外资": "含外资",
"全外资": "全外资",
"香港": "香港",
"海南": "海南省",
}
}
}
var settings = {
redis: {
host: "39.107.234.14",
port: 6379,
password: "123123",
host: "59.110.125.77",
port: 30479,
password: "havzMSYc3aBZXOjpG3",
db: 5,
},
database: {
......
......@@ -12,7 +12,7 @@ const settings = require("../../config/settings");
module.exports = function (app) {
//-----------------------新的模式---------web---------开始
app.use('/tlpay/aliPayNotify', async function (req, res) {
app.use('/tlpay/aliPayNotify', async function (req, res) {//钉钉接入的搁浅
try {
var client_ip = system.get_client_ip(req);
var result = await utilsOrderSve.opH5AliDingPayBackNotify(req.body, client_ip);
......
......@@ -30,6 +30,13 @@ var settings = {
}
return "http://43.247.184.94:7200/center_channel_req_log/_doc?pretty";
},
enameClientUrl:function(){
if (this.env == 'dev') {
return "https://ote.ename.com/icp/";//开发
}else{
return "https://api.ename.com/icp/";//线上
}
},
//百度icp、edi、nc、rt
baiduClientParams: function () {
if (this.env == 'dev') {
......@@ -443,12 +450,6 @@ var settings = {
// 2020 1119 lin 正式环境已经给出,鲁班发的ip
return "http://139.196.159.202:8980/"
}
},
dingRobotUrl: function(uapp_id) {
if(uapp_id == 50){//360云商机
return "https://oapi.dingtalk.com/robot/send?access_token=2947bdf6163288a5a5c654640e78ea718d21fcae6601efbb4edd53209abc1c45";
}
return "";
}
};
module.exports = settings;
# <a name="menu" href="">企业服务信息查询</a>
1. [获取token](#getToken)
5. [企业基本信息](#getRegisterInfo)
5. [企业股东及出资信息](#getShareHolderInfo)
5. [企业变更信息](#getRegisterChangeInfo)
5. [企业主要管理人员](#getMainManagerInfo)
5. [企业专利详情](#getPatentDetailInfo)
5. [企业专利列表](#getPatentInfo)
7. [企业商标列表](#getTrademarkInfo)
5. [企业软件著作权信息](#getSoftwareCopyrightInfo)
5. [企业作品著作权信息](#getWorksCopyrightInfo)
5. [企业LOGO](#getEntLogoInfo)
11. [企业年报社保信息](#getEntAnnReportSocialSecurityInfo)
5. [上市公司基本信息](#getListedCompanyBaseMessageInfoV2)
5. [上市公司十大股东](#getListedCompanyShareHolderInfoV2)
5. [企业实缴风险预警](#getEntPaidInRiskWarmInfo)
5. [企业数据发现](#getDataExploreInfo)
5. [企业基因标签](#getEntLable)
17. [企业联系方式汇总](#getEntContactInfo)
11. [企业/农专年报列表](#getEntSFCAnnreportList)
5. [企业年报基本信息](#getEntAnnReportInfo)
5. [企业年报网站网店信息](#getEntAnnReportWebSiteInfo)
5. [企业年报股东及出资信息](#getEntAnnReportInvInfo)
5. [企业年报资产状况](#getEntAnnReportAssetsInfo)
5. [企业年报对外担保信息](#getEntAnnReportForGuaranteeInfo)
11. [农专年报基本信息](#getSfcAnnReportInfo)
5. [农专年报网站网店信息](#getSfcAnnReportWebSiteInfo)
5. [农专年报资产状况](#getSfcAnnReportAssetsInfo)
5. [企业商标详情](#getTrademarkDetailInfo)
5. [企业年报对外投资](#getEntAnnReportToInvInfo)
5. [企业年报股权变更信息](#getEntAnnReportStockChanageInfo)
## **<a name=""> 域名</a>**
##### URL
https://fqdev.gongsibao.com 测试
## **<a name="getToken"> 获取token</a>**
[返回到目录](#menu)
##### URL
[/openPlatform/platform/getToken]
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
``` javascript
{
"accessKey":"111",
"accessSecret":"222"
}
```
#### 返回结果
```javascript
{
"status": 1,
"data": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhcHBJZCI6MSwiZXhwIjoxNjEzNjMzMTk0LCJpYXQiOjE2MTM2MzEzOTQsImNoYW5uZWxJZCI6MX0.MQoqGHwcXVrRfbftlxgY3-o6uCi6V2jQJL5z_chLHq4",
"msg": "success"
}
```
## **<a name="getRegisterInfo"> 获取企业基本信息</a>**
[返回到目录](#menu)
##### URL
[/openPlatform/busservices/cloudApi]
#### 参数格式 `JSON`
#### HTTP请求方式 `GET`
``` javascript
{
"path":"getRegisterInfo",
"entName":"汉唐信通(北京)科技有限公司" //企业名称
}
```
#### 返回结果
```javascript
{
"status": 1,
"data": [
{
"ENTSTATUS": "在营(开业)企业", //经营状态
"INDUSTRY_CODE": "M", //行业领域代码
"CANDATE": "", //注销日期
"REGORG": "北京市海淀区市场监督管理局", //登记机关
"OLDNAME": "", //曾用名
"JWD": "东经:116.171798 北纬:40.067381", //地理坐标
"APPRDATE": "2021-01-07", //核准日期
"OPFROM": "2014-08-07", //经营期限自
"SHXYDM": "911101083066224948", //统一社会信用代码
"ORGID": "306622494", //组织机构代码
"DOM": "北京市海淀区北清路164号28-38号院1003号", //地址
"INDUSTRY": "科学研究和技术服务业", //行业领域
"REGCAP": 100.0, //注册资本
"REGCAPCUR": "人民币", //注册资本币种
"REVDATE": "", //吊销日期
"ENTTYPE": "有限责任公司(法人独资)", //企业类型
"FRDB": "李丽", //法定代表人
"ENDDATE": "", //死亡日期
"OPSCOPE": "技术开发、技术推广、技术转让、技术咨询、技术服务;计算机系统服务。。。", //经营业务范围
"ESDATE": "2014-08-07", //成立日期
"OPTO": "2034-08-06", //经营期限至
"ENTNAME": "汉唐信通(北京)科技有限公司", //企业名称
"PROVINCE": "北京市", //登记地省份
"ENGNAME": "Hantang Xintong (Beijing) Technology Co., Ltd.", //企业英文名
"WEBSITE": "http://www.gongsibao.com" //企业官网
}
],
"msg": "success"
}
```
## **<a name="getShareHolderInfo"> 企业股东及出资信息</a>**
[返回到目录](#menu)
##### URL
[/openPlatform/busservices/cloudApi]
#### 参数格式 `JSON`
#### HTTP请求方式 `GET`
``` javascript
{
"path":"getShareHolderInfo",
"entName":"汉唐信通(北京)科技有限公司", //企业名称
"pageNo": 1, //页码
"pageSize": 10 //每页显示最大数量,最大100
}
```
#### 返回结果
```javascript
{
"status": 1,
"data": [
{
"INV": "汉唐信通(北京)咨询股份有限公司", //股东名称
"SUBCONAM": 100.0, //认缴出资额
"CONDATE": "2014-09-07", //出资时间
"CONCUR": "人民币", //出资币种
"SHXYDM": "911101057889696760", //统一社会信用代码
"CONRATIO": 1.0, //出资比例
"INVTYPE": "法人股东" //股东类型
}
],
"msg": "success"
}
```
## **<a name="getRegisterChangeInfo"> 企业变更信息</a>**
[返回到目录](#menu)
##### URL
[/openPlatform/busservices/cloudApi]
#### 参数格式 `JSON`
#### HTTP请求方式 `GET`
``` javascript
{
"path":"getRegisterChangeInfo",
"entName":"汉唐信通(北京)科技有限公司", //企业名称
"pageNo": 1, //页码
"pageSize": 10 //每页显示最大数量,最大100
}
```
#### 返回结果
```javascript
{
"status": 1,
"data": [
{
"ALTDATE": "2020-11-23", //变更时间
"ALTAF": "北京市海淀区北清路164号28-38号院1003号", //变更后内容
"ALTITEM": "住所", //变更事项
"ALTBE": "北京市海淀区温泉镇创客小镇社区配套商业楼15#楼一层118室" //变更前内容
}
],
"msg": "success"
}
```
## **<a name="getMainManagerInfo"> 企业主要管理人员</a>**
[返回到目录](#menu)
##### URL
[/openPlatform/busservices/cloudApi]
#### 参数格式 `JSON`
#### HTTP请求方式 `GET`
``` javascript
{
"path":"getMainManagerInfo",
"entName":"汉唐信通(北京)科技有限公司", //企业名称
"pageNo": 1, //页码
"pageSize": 10 //每页显示最大数量,最大100
}
```
#### 返回结果
```javascript
{
"status": 1,
"data": [
{
"ISFRDB": "是", //是否法定代表人
"POSITION": "执行董事,经理", //职务
"NAME": "李丽" //姓名
}
],
"msg": "success"
}
```
## **<a name="getPatentDetailInfo"> 企业专利详情</a>**
[返回到目录](#menu)
##### URL
[/openPlatform/busservices/postApi]
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
``` javascript
{
"path":"getPatentDetailInfo",
"rowKey":"a8a5d4f45975af887565e5ef209bfc73|9b75ce7f30c1d9024bfb0a2e6d802593" //专利列表接口返回的rowKey
}
```
#### 返回结果
```javascript
{
"status": 1,
"data": [
{
"FZL_MC": "一种基于知识图谱的企业商机挖掘方法和装置", //专利名称
"FZL_SQH": "CN202011090162.0", //申请号
"FZL_SQR": "2020-10-13", //申请日期
"FZL_ZLLX": "发明专利", //专利类型
"FZL_ZFLH": "G06F16/2458(2019.01)I", //主分类号
"FZL_FLH": "G06F16/2458(2019.01)I;G06F16/36(2019.01)I;G06Q30/02(2012.01)I", //分类号
"FZL_GKGGH": "CN112231350A", //公开(公告)号
"FZL_GKGGR": "2021-01-15", //公开(公告)日
"FZL_ZFLH_3CN": "计算;推算;计数", //专利技术领域
"FZL_SQZLQR": "汉唐信通(北京)科技有限公司", //申请(专利权)人
"FZL_FMSJR": "任智军;李丽;樊辉;高宇强;黄静;胥辛雨", //发明(设计)人
"FZL_FLZT": "实质审查的生效", //法律状态
"FZL_VALIDITY": "公开", //专利有效性
"FZL_ZLDLJG": "北京易知宝知识产权代理事务所(普通合伙) 11875", //专利代理机构
"FZL_DLR": "史琳琳", //代理人
"FZL_ZY": "本公开提供一种基于知识图谱的企业商机挖掘方法及装置、计算设备及存储介。。。" //摘要
}
],
"msg": "success"
}
```
## **<a name="getPatentInfo"> 企业专利列表</a>**
[返回到目录](#menu)
##### URL
[/openPlatform/busservices/cloudApi]
#### 参数格式 `JSON`
#### HTTP请求方式 `GET`
``` javascript
{
"path":"getPatentInfo",
"entName":"汉唐信通(北京)科技有限公司", //企业名称
"pageNo": 1, //页码
"pageSize": 10 //每页显示最大数量,最大100
}
```
#### 返回结果
```javascript
{
"status": 1,
"data": [
{
"ROWKEY": "a8a5d4f45975af887565e5ef209bfc73|9b75ce7f30c1d9024bfb0a2e6d802593", //rowkey,查询专利详情使用
"FZL_MC": "一种基于知识图谱的企业商机挖掘方法和装置", //专利名称
"FZL_SQH": "CN202011090162.0", //申请号
"FZL_SQR": "2020-10-13", //申请日期
"FZL_ZLLX": "发明专利", //专利类型
"FZL_ZFLH": "G06F16/2458(2019.01)I", //主分类号
"FZL_FLH": "G06F16/2458(2019.01)I;G06F16/36(2019.01)I;G06Q30/02(2012.01)I", //分类号
"FZL_GKGGH": "CN112231350A", //公开(公告)号
"FZL_GKGGR": "2021-01-15", //公开(公告)日
"FZL_ZFLH_3CN": "计算;推算;计数", //专利技术领域
"FZL_SQZLQR": "汉唐信通(北京)科技有限公司", //申请(专利权)人
"FZL_FMSJR": "任智军;李丽;樊辉;高宇强;黄静;胥辛雨", //发明(设计)人
"FZL_FLZT": "实质审查的生效", //法律状态
"FZL_VALIDITY": "公开", //专利有效性
"FZL_ZLDLJG": "北京易知宝知识产权代理事务所(普通合伙) 11875", //专利代理机构
"FZL_DLR": "史琳琳", //代理人
"FZL_DZ": "100089 北京市海淀区温泉镇创客小镇社区配套商业楼15#楼一层118室", //详细地址
"FZL_YXQ": "", //优先权
"FFL_SQGGH": "" //授权号
}
],
"msg": "success"
}
```
## **<a name="getTrademarkInfo"> 企业商标列表</a>**
[返回到目录](#menu)
##### URL
[/openPlatform/busservices/cloudApi]
#### 参数格式 `JSON`
#### HTTP请求方式 `GET`
``` javascript
{
"path":"getTrademarkInfo",
"entName":"汉唐信通(北京)科技有限公司", //企业名称
"pageNo": 1, //页码
"pageSize": 10 //每页显示最大数量,最大100
}
```
#### 返回结果
```javascript
{
"status": 1,
"data": [
{
"ROWKEY": "a8a5d4f45975af887565e5ef209bfc73|f91096e4db8cc9d1a130064ca7537ee8", //Rowkey,查询商标详情使用
"MARKNAME": "公司宝", //商标名称
"APPDATE": "2019-11-27", //申请日期
"UNIONTYPE": "45", //国际分类
"UNIONTYPENAME": "社会服务", //国际分类名称
"TYPEDETAILDES": "计算机软件许可(法律服务);域名注册(法律服务);知识产权代理。。。法律研究;诉讼服务", //商品服务列表
"BEGINDATE": "", //专用期起
"ENDDATE": "", //专用期止
"CHECKDATE": "", //初审公告日期
"REGDATE": "", //注册公告日期
"MARKTYPE": "一般", //商标类型
"MARKIMAGE": "/9j/4QCpRXhpZgAASUkqAAgAAAAFABIBAwABAAAAA", //商标图片
"NOTE": "否", //是否共有商标
"TYPEDETAIL": "4506;4505", //类似群
"MARKCODE_KEY": "42645186", //注册号
"ISINVALID": "有效", //状态
"ISCOLOR": "", //指定颜色
"AGENTNAME": "汉唐信通(北京)咨询股份有限公司", //代理机构
"REGVOLUMN": "", //注册公告期
"CHECKVOLUMN": "", //初审公告期
"LIUCHENG": "商标注册申请", //商标流程
"LIUCHENGDATE": "2020-06-13", //流程日期
"ADDR": "北京市海淀区北清路164号17-27号院813号", //申请人中文地址
"FSTAPPDATE": "" //优先权时间
}
],
"msg": "success"
}
```
## **<a name="getSoftwareCopyrightInfo"> 企业软件著作权信息</a>**
[返回到目录](#menu)
##### URL
[/openPlatform/busservices/cloudApi]
#### 参数格式 `JSON`
#### HTTP请求方式 `GET`
``` javascript
{
"path":"getSoftwareCopyrightInfo",
"entName":"汉唐信通(北京)科技有限公司", //企业名称
"pageNo": 1, //页码
"pageSize": 10 //每页显示最大数量,最大100
}
```
#### 返回结果
```javascript
{
"status": 1,
"data": [
{
"FRJ_HYFLH": "其他行业", //行业领域
"FRJ_DJH": "2019SR1110958", //登记号
"FRJ_RJQC": "蜂擎云服CRM系统", //软件全称
"FRJ_DJDATE": "2019-11-01", //登记日期
"FRJ_SCFBDATE": "2019-01-28", //首次发表日期
"FRJ_BBH": "V1.0", //版本号
"FRJ_ZZQR_GJ": "汉唐信通(北京)科技有限公司:中国", //著作权人
"FRJ_RJJC": "蜂擎云服CRM", //软件简称
"FRJ_RJFLH": "行业应用软件" //软件分类
}
],
"msg": "success"
}
```
## **<a name="getWorksCopyrightInfo"> 企业作品著作权信息</a>**
[返回到目录](#menu)
##### URL
[/openPlatform/busservices/cloudApi]
#### 参数格式 `JSON`
#### HTTP请求方式 `GET`
``` javascript
{
"path":"getWorksCopyrightInfo",
"entName":"汉唐信通(北京)科技有限公司", //企业名称
"pageNo": 1, //页码
"pageSize": 10 //每页显示最大数量,最大100
}
```
#### 返回结果
```javascript
{
"status": 1,
"data": [
{
"FZD_SCFBDATE": "2015-08-20", //首次发表日期
"FZD_DJH": "国作登字-2016-F-00297528", //登记号
"FZD_DJDATE": "2016-08-19", //登记日期
"FZD_CZWCDATE": "2015-08-20", //创作完成日期
"FZD_ZPMC": "表情小蜜蜂", //作品名称
"FZD_ZPLB": "美术", //作品类别
"FZD_ZZNAME": "" //著作权人
}
],
"msg": "success"
}
```
## **<a name="getEntLogoInfo"> 企业LOGO</a>**
[返回到目录](#menu)
##### URL
[/openPlatform/busservices/cloudApi]
#### 参数格式 `JSON`
#### HTTP请求方式 `GET`
``` javascript
{
"path":"getEntLogoInfo",
"entName":"汉唐信通(北京)科技有限公司" //企业名称
}
```
#### 返回结果
```javascript
{
"status": 1,
"data": [
{
"LOGO": "iVBORw0KGgoAAAANSUhEUgAAASwAAAEsCAYAAAA/wD/qDQzy5/" //企业LOGO,Base64编码格式
}
],
"msg": "success"
}
```
## **<a name="getEntAnnReportSocialSecurityInfo"> 企业年报社保信息</a>**
[返回到目录](#menu)
##### URL
[/openPlatform/busservices/cloudApi]
#### 参数格式 `JSON`
#### HTTP请求方式 `GET`
``` javascript
{
"path":"getEntAnnReportSocialSecurityInfo",
"entName":"汉唐信通(北京)科技有限公司", //企业名称
"pageNo": 1, //页码
"pageSize": 10 //每页显示最大数量,最大100
}
```
#### 返回结果
```javascript
{
"status": 1,
"data": [
{
"D1": "", //单位参加城镇职工基本养老保险累计欠缴金额
"C1": "", //参加城镇职工基本养老保险本期实际缴费基数
"D2": "", //单位参加失业保险累计欠缴金额
"B1": "", //单位参加城镇职工基本养老保险缴费基数
"C2": "", //参加失业保险本期实际缴费基数
"D3": "", //单位参加职工基本医疗保险累计欠缴金额
"A1": "279", //城镇职工基本养老保险
"B2": "", //单位参加失业保险缴费基数
"C3": "", //参加职工基本医疗保险本期实际缴费基数
"D4": "", //单位参加工伤保险累计欠缴金额
"A2": "279", //失业保险
"B3": "", //单位参加职工基本医疗保险缴费基数
"C4": "", //参加工伤保险本期实际缴费基数
"D5": "", //单位参加生育保险累计欠缴金额
"A3": "279", //职工基本医疗保险
"C5": "", //参加生育保险本期实际缴费基数
"A4": "279", //工伤保险
"B5": "", //单位参加生育保险缴费基数
"A5": "279" //生育保险
}
],
"msg": "success"
}
```
## **<a name="getListedCompanyBaseMessageInfoV2"> 上市公司基本信息</a>**
[返回到目录](#menu)
##### URL
[/openPlatform/busservices/cloudApi]
#### 参数格式 `JSON`
#### HTTP请求方式 `GET`
``` javascript
{
"path":"getListedCompanyBaseMessageInfoV2",
"entName":"汉唐信通(北京)科技有限公司"
}
```
#### 返回结果
```javascript
{
"status": 1,
"data": [
{
"ENAME": "Fengqing Network Technology Co.,Ltd.", //英文全称
"BUILD_DATE": "1995-01-18", //成立日期
"DECLAREDATE": "2021-01-14", //信息发布日期
"LIST_ENDDATE": "", //退市日期
"STAFF_NUM": "1780", //员工人数
"WEB_SITE": "www.Fengqing.com", //公司网址
"PRI_BIZ": "以蜂擎企业云服务为核心为客户提供企业云服务与解决方案。", //主营业务
"CURNCY": "人民币", //币种
"ESNAME": "Fengqing", //英文简称
"ISIN": "CNE0001017Y6", //ISIN代码
"TRADE_MKT_REF": "上海证券交易所", //市场代码
"REGI_CAP": "328082.98", //注册资本
"CSNAME": "蜂擎网络", //中文简称
"LIST_DATE": "2001-05-18", //上市日期
"STK_TYPE_REF": "国内A股", //证券类别
"COM_BRIEF": "公司是根据《中华人民共和国公司法》于1983年12月6日注册成立的股份有限公司。本公司根据2004年4月29日股东大会决议,公司名称。。。", //公司简介
"STOCKCODE": "600588", //证券代码
"REGI_ADDR": "北京市朝阳区", //注册地址
"OFFICE_ADDR": "北京市朝阳区", //办公地址
"CNAME": "蜂擎网络科技股份有限公司", //中文全称
"STOCKSNAME": "蜂擎网络", //股票简称
"STATUS_TYPE_REF": "上市" //上市状态
}
],
"msg": "success"
}
```
## **<a name="getListedCompanyShareHolderInfoV2"> 上市公司十大股东</a>**
[返回到目录](#menu)
##### URL
[/openPlatform/busservices/cloudApi]
#### 参数格式 `JSON`
#### HTTP请求方式 `GET`
``` javascript
{
"path":"getListedCompanyShareHolderInfoV2",
"entName":"汉唐信通(北京)科技有限公司" //企业名称
}
```
#### 返回结果
```javascript
{
"status": 1,
"data": [
{
"ORGCODE": "73209192", //股东代码
"ADD_NUM": "-1,964,765", //本期变动数量
"DECLAREDATE": "2020-10-31", //信息发布日期
"FROZEN_PLEDGE_NUM": "0", //质押或冻结的股份数量
"RANK": "10", //股东排名
"HOLD_PCT": "1.693", //持股数量占总股本比例
"SHR_HLD_TYPE": "境内法人股", //股东股权性质
"HOLD_NUM": "55000000", //持股数量
"ENDDATE": "2020-09-30", //截止日期
"NAME": "上海合道资产管理有限公司-合道科创1期私募证券投资基金" //股东名称
}
],
"msg": "success"
}
```
## **<a name="getEntPaidInRiskWarmInfo"> 企业实缴风险预警</a>**
[返回到目录](#menu)
##### URL
[/openPlatform/busservices/cloudApi]
#### 参数格式 `JSON`
#### HTTP请求方式 `GET`
``` javascript
{
"path":"getEntPaidInRiskWarmInfo",
"entName":"汉唐信通(北京)科技有限公司" //企业名称
}
```
#### 返回结果
```javascript
{
"status": 1,
"data": [
{
"ACCONAM": 100.0, //实缴出资额
"RATE": 1.0, //实缴比例
"ENTNAME": "汉唐信通(北京)科技有限公司" //企业名称
}
],
"msg": "success"
}
```
## **<a name="getDataExploreInfo"> 企业数据发现</a>**
[返回到目录](#menu)
##### URL
[/openPlatform/busservices/cloudApi]
#### 参数格式 `JSON`
#### HTTP请求方式 `GET`
``` javascript
{
"path":"getDataExploreInfo",
"entName":"汉唐信通(北京)科技有限公司" //企业名称
}
```
#### 返回结果
```javascript
{
"status": 1,
"data": [
{
"DESCRIPTION": "企业2009年07月19日在上海证券交易所主板上市。", //认定依据
"SOURCE": "中国证券监督管理委员会", //信息来源
"LEVEL": "2", //影响程度,1=提示,2=中性
"EVENT": "A股 | 蜂擎云服 710577.SH", //发现内容
"MONITORTIME": "2007-04-20" //发现时间
}
],
"msg": "success"
}
```
## **<a name="getEntLable"> 企业基因标签</a>**
[返回到目录](#menu)
##### URL
[/openPlatform/busservices/cloudApi]
#### 参数格式 `JSON`
#### HTTP请求方式 `GET`
``` javascript
{
"path":"getEntLable",
"entName":"汉唐信通(北京)科技有限公司", //企业名称
"pageNo": 1, //页码
"pageSize": 10 //每页显示最大数量,最大100
}
```
#### 返回结果
```javascript
{
"status": 1,
"data": [
{
"TAG": "域名备案企业" //标签名称
},
{
"TAG": "高新企业" //标签名称
}
],
"msg": "success"
}
```
## **<a name="getEntContactInfo"> 企业联系方式汇总</a>**
[返回到目录](#menu)
##### URL
[/openPlatform/busservices/cloudApi]
#### 参数格式 `JSON`
#### HTTP请求方式 `GET`
``` javascript
{
"path":"getEntContactInfo",
"entName":"汉唐信通(北京)科技有限公司" //企业名称
}
```
#### 返回结果
```javascript
{
"status": 1,
"data": [
{
"CONTACT": "010-84927588", //联系方式
"CONTACT_TYPE": "固话", //联系方式类型
"UPDATE": "2019-03-29" //更新时间
}
],
"msg": "success"
}
```
## **<a name="getEntSFCAnnreportList"> 企业/农专年报列表</a>**
[返回到目录](#menu)
##### URL
[/openPlatform/busservices/cloudApi]
#### 参数格式 `JSON`
#### HTTP请求方式 `GET`
``` javascript
{
"path":"getEntSFCAnnreportList",
"entName":"汉唐信通(北京)科技有限公司" //企业名称
}
```
#### 返回结果
```javascript
{
"status": 1,
"data": [
{
"NBYEAR": "2018", //年报年份
"NBDATE": "2019-03-29", //年报时间
"ENTTYPE": "企业" //企业类型
}
],
"msg": "success"
}
```
## **<a name="getEntAnnReportInfo"> 企业年报基本信息</a>**
[返回到目录](#menu)
##### URL
[/openPlatform/busservices/cloudApi]
#### 参数格式 `JSON`
#### HTTP请求方式 `GET`
``` javascript
{
"path":"getEntAnnReportInfo",
"entName":"汉唐信通(北京)科技有限公司", //企业名称
"reportDate": 2019 //年报年份
}
```
#### 返回结果
```javascript
{
"status": 1,
"data": [
{
"ISWEB": "是", //是否有网站或网店
"ENTSTATUS": "开业", //企业经营状态
"POSTCODE": "100000", //邮政编码
"ISGQZR": "否", //有限责任公司本年度是否发生股东股权转让
"ENTNAME": "汉唐信通(北京)科技有限公司", //企业名称
"TEL": "010-8492788", //企业联系电话
"EMAIL": "lisa@gongsibao.com", //电子邮箱
"SHXYDM": "911101083066224948", //统一社会信用代码
"ISGMGQ": "是", //企业是否有投资信息或购买其他公司股权
"ADDR": "北京市海淀区北清路164号17-27号院813号", //企业通信地址
"EMPNUM": "10000" //从业人数
}
],
"msg": "success"
}
```
## **<a name="getEntAnnReportWebSiteInfo"> 企业年报网站网店信息</a>**
[返回到目录](#menu)
##### URL
[/openPlatform/busservices/cloudApi]
#### 参数格式 `JSON`
#### HTTP请求方式 `GET`
``` javascript
{
"path":"getEntAnnReportWebSiteInfo",
"entName":"汉唐信通(北京)科技有限公司", //企业名称
"reportDate": 2019 //年报年份
}
```
#### 返回结果
```javascript
{
"status": 1,
"data": [
{
"WEBTYPE": "网站", //网站网店类型
"WEBURL": "www.callcentermkt.com", //网站(网店)网址
"WEBNAME": "汉唐信通(北京)科技有限公司" //网站(网店)名称
}
],
"msg": "success"
}
```
## **<a name="getEntAnnReportInvInfo"> 企业年报股东及出资信息</a>**
[返回到目录](#menu)
##### URL
[/openPlatform/busservices/cloudApi]
#### 参数格式 `JSON`
#### HTTP请求方式 `GET`
``` javascript
{
"path":"getEntAnnReportInvInfo",
"entName":"汉唐信通(北京)科技有限公司", //企业名称
"reportDate": 2019 //年报年份
}
```
#### 返回结果
```javascript
{
"status": 1,
"data": [
{
"ACCONAM": 100.0, //实缴出资额
"ACCCUR": "人民币", //实缴币种
"ACCDATE": "2015-05-23", //实缴出资时间
"CONFORM": "货币", //认缴出资方式
"CONAM": 100.0, //认缴出资额
"CONDATE": "2015-05-23", //认缴出资时间
"CONCUR": "人民币", //认缴出资币种
"SHANAME": "汉唐信通(北京)咨询股份有限公司", //股东名称
"ACCFORM": "货币" //实缴出资方式
}
],
"msg": "success"
}
```
## **<a name="getEntAnnReportAssetsInfo"> 企业年报资产状况</a>**
[返回到目录](#menu)
##### URL
[/openPlatform/busservices/cloudApi]
#### 参数格式 `JSON`
#### HTTP请求方式 `GET`
``` javascript
{
"path":"getEntAnnReportAssetsInfo",
"entName":"汉唐信通(北京)科技有限公司", //企业名称
"reportDate": 2019 //年报年份
}
```
#### 返回结果
```javascript
{
"status": 1,
"data": [
{
"ASSGRO": "10", //资产总额
"LIAGRO": "0", //负债总额
"RATGRO": "0", //纳税总额
"TOTEQU": "10", //所有者权益合计
"VENDINC": "0", //营业总收入
"PROGRO": "0", //利润总额
"NETINC": "0", //净利润
"MAIBUSINC": "0" //其中主营业务收入
}
],
"msg": "success"
}
```
## **<a name="getEntAnnReportForGuaranteeInfo"> 企业年报对外担保信息</a>**
[返回到目录](#menu)
##### URL
[/openPlatform/busservices/cloudApi]
#### 参数格式 `JSON`
#### HTTP请求方式 `GET`
``` javascript
{
"path":"getEntAnnReportForGuaranteeInfo",
"entName":"汉唐信通(北京)科技有限公司", //企业名称
"reportDate": 2019 //年报年份
}
```
#### 返回结果
```javascript
{
"status": 1,
"data": [
{
"ZQZL": "合同", //主债权种类
"ZQSE": 400.0, //主债权数额
"ZWR": "沂南县佳乐食品有限公司", //债务人
"ZQQXTO": "2016-08-19", //履行债务的期限至
"ZQR": "沂南县城区信用社", //债权人
"BZFS": "一般保证", //保证的方式
"ZQQXFROM": "2016-08-28", //履行债务的期限自
"BZQJ": "期限" //保证的期间
},
],
"msg": "success"
}
```
## **<a name="getSfcAnnReportInfo"> 农专年报基本信息</a>**
[返回到目录](#menu)
##### URL
[/openPlatform/busservices/cloudApi]
#### 参数格式 `JSON`
#### HTTP请求方式 `GET`
``` javascript
{
"path":"getSfcAnnReportInfo",
"entName":"榆中丰瑞祥养殖专业合作社", //企业名称
"reportDate": 2014 //年报年份
}
```
#### 返回结果
```javascript
{
"status": 1,
"data": [
{
"MEMNUM_XZ": 0.0, //本年度新增成员人数
"MEMNUM": 5.0, //成员人数
"REGNO": "620123NA000885X", //注册号
"FARSPEARTNAME": "榆中丰瑞祥养殖专业合作社", //合作社名称
"TEL": "13919486253", //联系电话
"EMAIL": "941743007@qq.com", //电子邮箱
"MEMNUM_NM": 5.0, //成员人数中农民人数
"MEMNUM_TC": 0.0 //本年度退出成员人数
}
],
"msg": "success"
}
```
## **<a name="getSfcAnnReportWebSiteInfo"> 农专年报网站网店信息</a>**
[返回到目录](#menu)
##### URL
[/openPlatform/busservices/cloudApi]
#### 参数格式 `JSON`
#### HTTP请求方式 `GET`
``` javascript
{
"path":"getSfcAnnReportWebSiteInfo",
"entName":"阿克苏天山雪润果业农民专业合作社", //企业名称
"reportDate": 2014 //年报年份
}
```
#### 返回结果
```javascript
{
"status": 1,
"data": [
{
"WEBTYPE": "网店", //网站网店类型
"WEBURL": "http://tsaksgnlm.taobao.com", //网站(网店)网址
"WEBNAME": "天山阿克苏果农联盟" //网站(网店)名称
},
],
"msg": "success"
}
```
## **<a name="getSfcAnnReportAssetsInfo"> 农专年报资产状况</a>**
[返回到目录](#menu)
##### URL
[/openPlatform/busservices/cloudApi]
#### 参数格式 `JSON`
#### HTTP请求方式 `GET`
``` javascript
{
"path":"getSfcAnnReportAssetsInfo",
"entName":"汉唐信通(北京)科技有限公司", //企业名称
"reportDate": 2014 //年报年份
}
```
#### 返回结果
```javascript
{
"status": 1,
"data": [
{
"PRIYEAPROFIT": "5", //盈余总额
"PRIYEASUB": "0", //获得政府扶持资金、补助
"RATGRO": "0", //纳税金额
"PRIYEALOAN": "0", //金融贷款
"PRIYEASALES": "50" //销售额或营业收入
}
],
"msg": "success"
}
```
## **<a name="getTrademarkDetailInfo"> 企业商标详情</a>**
[返回到目录](#menu)
##### URL
[/openPlatform/busservices/postApi]
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
``` javascript
{
"path":"getTrademarkDetailInfo",
"rowKey": "a8a5d4f45975af887565e5ef209bfc73|f91096e4db8cc9d1a130064ca7537ee8" //商标列表接口返回的rowKey
}
```
#### 返回结果
```javascript
{
"status": 1,
"data": [
{
"MARKTYPE": "一般", //商标类型
"REGVOLUMN": "", //注册公告期
"TYPEDETAILDES": "计算机软件许可(法律服务);域名注册(法律服务)。。。法律研究;诉讼服务", //商品服务列表
"REGDATE": "", //注册公告日期
"TYPEDETAIL": "4506;4505", //类似群
"ISCOLOR": "", //指定颜色
"MARKIMAGE": "/9j/4QCpRXhpZgAASUkqAAgAAAAFABIAAADIBAgAUAA", //商标图片
"MARKCODE_KEY": "42645186", //注册号
"UNIONTYPENAME": "社会服务", //国际分类名称
"LIUCHENGDATE": "2020-06-13", //流程日期
"ISINVALID": "有效", //状态
"ENDDATE": "", //专用期止
"AGENTNAME": "汉唐信通(北京)咨询股份有限公司", //代理机构
"FSTAPPDATE": "", //优先权时间
"ADDR": "北京市海淀区北清路164号17-27号院813号", //申请人中文地址
"APPDATE": "2019-11-27", //申请日期
"UNIONTYPE": "45", //国际分类
"NOTE": "否", //是否共有商标
"CHECKDATE": "", //初审公告日期
"MARKNAME": "公司宝", //商标名称
"BEGINDATE": "", //专用期起
"LIUCHENG": "商标注册申请", //商标流程
"CHECKVOLUMN": "" //初审公告期
}
],
"msg": "success"
}
```
## **<a name="getEntAnnReportToInvInfo"> 企业年报对外投资</a>**
[返回到目录](#menu)
##### URL
[/openPlatform/busservices/cloudApi]
#### 参数格式 `JSON`
#### HTTP请求方式 `GET`
``` javascript
{
"path":"getEntAnnReportToInvInfo",
"entName":"汉唐信通(北京)科技有限公司", //企业名称
"reportDate":2014 //年报年份
}
```
#### 返回结果
```javascript
{
"status": 1,
"data": [
{
"REGNO": "91370102MA3QXNA", //投资设立企业或购买股权企业名称
"ENTNAME": "汉唐信通(山东)科技有限公司" //注册号/统一社会信用代码
},
{
"REGNO": "91410204MA47HAC", //投资设立企业或购买股权企业名称
"ENTNAME": "开封市智程锦云人力资源服务有限公司" //注册号/统一社会信用代码
}
],
"msg": "success"
}
```
## **<a name="getEntAnnReportStockChanageInfo"> 企业年报股权变更信息</a>**
[返回到目录](#menu)
##### URL
[/openPlatform/busservices/cloudApi]
#### 参数格式 `JSON`
#### HTTP请求方式 `GET`
``` javascript
{
"path":"getEntAnnReportStockChanageInfo",
"entName":"阿里巴巴(中国)网络技术有限公司", //企业名称
"reportDate":2018 //年报年份
}
```
#### 返回结果
```javascript
{
"status": 1,
"data": [
{
"INV": "淘宝(中国)软件有限公司", //股东名称
"TRANSAMPR": 0.0, //变更前股权比例
"ALTDATE": "2018-11-27", //股权变更日期
"TRANSAMAFT": 78.4 //变更后股权比例
},
{
"INV": "Alibaba.com China Limited", //股东名称
"TRANSAMPR": 100.0, //变更前股权比例
"ALTDATE": "2018-11-27", //股权变更日期
"TRANSAMAFT": 21.6 //变更后股权比例
}
],
"msg": "success"
}
```
\ No newline at end of file
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