Commit fa4fdbcc by 庄冰

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

parents dc5383c9 4db671c8
...@@ -36,8 +36,11 @@ class IcbcToolsAPI extends WEBBase { ...@@ -36,8 +36,11 @@ class IcbcToolsAPI extends WEBBase {
case "getCompanyIcpByName"://工商icp证照查询 case "getCompanyIcpByName"://工商icp证照查询
opResult = await this.icbcSve.getCompanyIcpByName(action_body, req); opResult = await this.icbcSve.getCompanyIcpByName(action_body, req);
break; break;
case "searchCertification"://企业证书查询 // case "searchCertification"://企业证书查询
opResult = await this.icbcSve.searchCertification(action_body,req); // opResult = await this.icbcSve.searchCertification(action_body,req);
// break;
case "searchCertification"://企业证书查询(综合)
opResult = await this.icbcSve.getLicenseList(action_body,req);
break; break;
default: default:
opResult = system.getResult(null, "action_type参数错误"); opResult = system.getResult(null, "action_type参数错误");
......
...@@ -6,6 +6,7 @@ class ProductAPI extends WEBBase { ...@@ -6,6 +6,7 @@ class ProductAPI extends WEBBase {
constructor() { constructor() {
super(); super();
this.utilsOrderSve = system.getObject("service.utilsSve.utilsOrderSve"); this.utilsOrderSve = system.getObject("service.utilsSve.utilsOrderSve");
this.utilsProductSve = system.getObject("service.utilsSve.utilsProductSve");
} }
/** /**
...@@ -41,6 +42,9 @@ class ProductAPI extends WEBBase { ...@@ -41,6 +42,9 @@ class ProductAPI extends WEBBase {
case "getOrderInfo"://获取订单列表信息 case "getOrderInfo"://获取订单列表信息
opResult = await this.utilsOrderSve.getOrderInfo(pobj, pobj.actionBody); opResult = await this.utilsOrderSve.getOrderInfo(pobj, pobj.actionBody);
break; break;
case "getPathName":
opResult = await this.utilsProductSve.getAllPathName(pobj);
break;
case "getOrderStatisticsByUappId": case "getOrderStatisticsByUappId":
opResult = await this.utilsOrderSve.getOrdersStatisticsByUappId(pobj); opResult = await this.utilsOrderSve.getOrdersStatisticsByUappId(pobj);
break; break;
......
...@@ -50,9 +50,6 @@ class Need extends APIBase { ...@@ -50,9 +50,6 @@ class Need extends APIBase {
opResult = await this.utilsNeedSve.getItemByChannelNeedNo(pobj,pobj.actionBody); opResult = await this.utilsNeedSve.getItemByChannelNeedNo(pobj,pobj.actionBody);
break; break;
case "getSolutionByChannelSolutionNo": case "getSolutionByChannelSolutionNo":
opResult = await this.utilsNeedSve.getItemByChannelNeedNo(pobj, pobj.actionBody);
break
case "getSolutionByChannelSolutionNo":
opResult = await this.utilsNeedSve.getSolutionByChannelSolutionNo(pobj, pobj.actionBody); opResult = await this.utilsNeedSve.getSolutionByChannelSolutionNo(pobj, pobj.actionBody);
break; break;
case "getItemByNeedNo": case "getItemByNeedNo":
......
...@@ -10,6 +10,7 @@ module.exports = (db, DataTypes) => { ...@@ -10,6 +10,7 @@ module.exports = (db, DataTypes) => {
pushActionType: DataTypes.STRING,//调用参数 pushActionType: DataTypes.STRING,//调用参数
pushtimes:DataTypes.INTEGER,//推送次数 pushtimes:DataTypes.INTEGER,//推送次数
pushStatus:DataTypes.STRING,//推送状态 pushStatus:DataTypes.STRING,//推送状态
error:DataTypes.STRING(5000),//错误信息
}, { }, {
paranoid: false,//假的删除 paranoid: false,//假的删除
underscored: true, underscored: true,
......
...@@ -3,59 +3,70 @@ const ServiceBase = require("../../sve.base"); ...@@ -3,59 +3,70 @@ const ServiceBase = require("../../sve.base");
var settings = require("../../../../config/settings"); var settings = require("../../../../config/settings");
const uuidv4 = require('uuid/v4'); const uuidv4 = require('uuid/v4');
const getRawBody = require('raw-body'); const getRawBody = require('raw-body');
class GatewaypushlogService extends ServiceBase { class GatewaypushlogService extends ServiceBase {
constructor() { constructor() {
super("common", ServiceBase.getDaoName(GatewaypushlogService)); super("common", ServiceBase.getDaoName(GatewaypushlogService));
this.execClient = system.getObject("util.execClient"); this.execClient = system.getObject("util.execClient");
this.dingClient = system.getObject("util.dingClient"); this.dingClient = system.getObject("util.dingClient");
} }
async taskAliIcapi() { async taskAliIcapi() {
try { try {
var sql = "select * from gateway_pushlog where pushStatus='wts' and pushtimes<4" var sql = "select * from gateway_pushlog where pushStatus='wts' and pushtimes<4"
var icloginfos = await this.customQuery(sql); var icloginfos = await this.customQuery(sql);
if (icloginfos.length > 0) { if (icloginfos.length > 0) {
var count = 100; var count = 100;
if (icloginfos.length < count) { if (icloginfos.length < count) {
count = icloginfos.length; count = icloginfos.length;
} }
var self = this; var self = this;
for (var i = 0; i < count; i++) { for (var i = 0; i < count; i++) {
var icloginfo = icloginfos[i]; try {
var requestdata = null; var icloginfo = icloginfos[i];
if (icloginfo && icloginfo.requestjson) { var requestdata = null;
requestdata = JSON.parse(icloginfo.requestjson); 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 url = settings.gatewayUrl() + "action/intentionapi/springBoard";
var data = rtn var rtn = await self.execClient.execPost(requestdata, url);
try { var data = rtn
data = JSON.parse(rtn.stdout); data = JSON.parse(rtn.stdout);
}catch (e) { if (data.success) {
console.error(e) icloginfo.pushStatus = "yts";
} } else {
if (data.success) { if (data.errorMsg != "状态错误") {//除1 2 4 11其它状态没处理、返回的状态错误
icloginfo.pushStatus = "yts"; data.push_url = url;
} else { data.api = "center-channel/taskAliIcapi-for";
if (data.errorMsg!="状态错误") {//除1 2 4 11其它状态没处理、返回的状态错误 data.requestdata = requestdata;
data.push_url = url data.message = "error info";
data.api = "center-channel/taskAliIcapi" this.dingClient.gatewayPushError(data);
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; return system.getResultSuccess();
}
await this.update(icloginfo);
}
}
return system.getResultSuccess();
} catch (error) { } catch (error) {
this.dingClient.gatewayPushError({message:"Exception",api:"center-channel/taskAliIcapi",error}) this.dingClient.gatewayPushError({message: "Exception", api: "center-channel/taskAliIcapi", error})
return system.getResultFail(-1,error); return system.getResultFail(-1, error);
}
} }
}
} }
module.exports = GatewaypushlogService; module.exports = GatewaypushlogService;
...@@ -192,12 +192,12 @@ module.exports = SignService; ...@@ -192,12 +192,12 @@ module.exports = SignService;
// }; // };
//需求 //需求
// var obj={ // var obj={
// "intentionBizId": "baidu_test_00091", // "intentionBizId": "baidu_test_000101",
// "phone": "18506013355", // "phone": "18506013355",
// "userName": "测试03", // "userName": "测试03",
// "description": "测试03描述", // "description": "测试03描述",
// "area": "上海", // "area": "上海",
// "consultType": "7" // "consultType": "GSREG"
// }; // };
// task.createSign(obj,"7cbb892450174167b5c7e01we4716t51").then(sign=>{ // task.createSign(obj,"7cbb892450174167b5c7e01we4716t51").then(sign=>{
// console.log(sign,"..............Sign"); // console.log(sign,"..............Sign");
......
...@@ -85,6 +85,7 @@ class IcbcService extends AppServiceBase { ...@@ -85,6 +85,7 @@ class IcbcService extends AppServiceBase {
"accessKey": "111", "accessKey": "111",
"accessSecret": "222" "accessSecret": "222"
} }
req.headers.token='sss'
let ret = await this.opReqResult(url, params, req); let ret = await this.opReqResult(url, params, req);
if (ret.status != 1) { if (ret.status != 1) {
return system.getResultFail(-1, '获取开放平台token失败'); return system.getResultFail(-1, '获取开放平台token失败');
...@@ -94,8 +95,10 @@ class IcbcService extends AppServiceBase { ...@@ -94,8 +95,10 @@ class IcbcService extends AppServiceBase {
url = settings.icNameUrl() + "openPlatform/busenterprise/cloudapi"; url = settings.icNameUrl() + "openPlatform/busenterprise/cloudapi";
//资质查询 //资质查询
let data = { let data = {
// "path": "/apis/dst/patents/getLicense",
"path": "/apis/dst/patents/certificate", "path": "/apis/dst/patents/certificate",
"name": queryobj.companyName "name": queryobj.companyName,
"pageNum":1
}; };
let rtn = await this.execClient.restGetWithHAuthorizationUrl(token, url, data); let rtn = await this.execClient.restGetWithHAuthorizationUrl(token, url, data);
if (!rtn || !rtn.stdout) { if (!rtn || !rtn.stdout) {
...@@ -121,6 +124,94 @@ class IcbcService extends AppServiceBase { ...@@ -121,6 +124,94 @@ class IcbcService extends AppServiceBase {
} }
/**
* 获取资质证书(集合)
* @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);
}
......
...@@ -82,7 +82,7 @@ class utils360Sve extends AppServiceBase { ...@@ -82,7 +82,7 @@ class utils360Sve extends AppServiceBase {
content: JSON.stringify(pushObj),//推送的参数信息 content: JSON.stringify(pushObj),//推送的参数信息
resultInfo: JSON.stringify(result), resultInfo: JSON.stringify(result),
returnType: '1', returnType: '1',
logLevel: '1', logLevel: 1,
opTitle: "推送360信息返回成功" opTitle: "推送360信息返回成功"
}); });
} else { } else {
......
...@@ -88,7 +88,7 @@ class UtilsFqAliyunService extends AppServiceBase { ...@@ -88,7 +88,7 @@ class UtilsFqAliyunService extends AppServiceBase {
} }
async transformNeedActionBody(pobj) { async transformNeedActionBody(pobj) {
if (!pobj.actionBody.area) { if (!pobj.actionBody.area || pobj.actionBody.area === "null") {
pobj.actionBody.area = "全国"; pobj.actionBody.area = "全国";
} }
if (pobj.actionBody.area != "全国" && pobj.actionBody.area.indexOf("市") < 0 && pobj.actionBody.area.indexOf("省") < 0) { if (pobj.actionBody.area != "全国" && pobj.actionBody.area.indexOf("市") < 0 && pobj.actionBody.area.indexOf("省") < 0) {
......
...@@ -1263,7 +1263,7 @@ class UtilsOrderService extends AppServiceBase { ...@@ -1263,7 +1263,7 @@ class UtilsOrderService extends AppServiceBase {
}; };
this.utils360Sve.pushOrderStatus(pobj); this.utils360Sve.pushOrderStatus(pobj);
//钉钉机器人 //钉钉机器人
this.dingClient.gatewayPushByChannel(params.orderNo, pobj.appInfo); this.dingClient.gatewayPushTo360(params.orderNo);
} }
opOrderResult.data = null; opOrderResult.data = null;
return opOrderResult; return opOrderResult;
......
...@@ -153,6 +153,44 @@ class UtilsProductService extends AppServiceBase { ...@@ -153,6 +153,44 @@ class UtilsProductService extends AppServiceBase {
let result = await this.restPostUrl(pobj,url); let result = await this.restPostUrl(pobj,url);
return result; 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
...@@ -5,6 +5,7 @@ class dingClient { ...@@ -5,6 +5,7 @@ class dingClient {
this.execClient = system.getObject('util.execClient'); this.execClient = system.getObject('util.execClient');
this.gatewayurl = "https://oapi.dingtalk.com/robot/send?access_token=2f1ada261ea84f6c621db487ac18d11eba8984202bd82adda8810770a8240572" this.gatewayurl = "https://oapi.dingtalk.com/robot/send?access_token=2f1ada261ea84f6c621db487ac18d11eba8984202bd82adda8810770a8240572"
this.businessToFqUrl = "https://oapi.dingtalk.com/robot/send?access_token=9e215f0f1d77980ee6b39e88a82a7c6e5d290775f76d9a8346e97697f8df9788" this.businessToFqUrl = "https://oapi.dingtalk.com/robot/send?access_token=9e215f0f1d77980ee6b39e88a82a7c6e5d290775f76d9a8346e97697f8df9788"
this.businessTo360Url = "https://oapi.dingtalk.com/robot/send?access_token=2947bdf6163288a5a5c654640e78ea718d21fcae6601efbb4edd53209abc1c45";
} }
//推送峰擎异常提醒 //推送峰擎异常提醒
...@@ -22,15 +23,14 @@ class dingClient { ...@@ -22,15 +23,14 @@ class dingClient {
} }
//渠道钉钉提醒 //渠道钉钉提醒
async gatewayPushByChannel(orderNo, appInfo) { async gatewayPushTo360(orderNo) {
let gatewayUrl = setttings.dingRobotUrl(appInfo.uapp_id); if (process.env.APP_ENV != "dev") {
if (settings.env != "dev" && gatewayUrl) { let c = `注意提醒:360云商机->有订单待处理,订单号${orderNo},老板们加油,加油,加油 !!!`
let c = `注意提醒:${appInfo.app_name}->有订单待处理,订单号${orderNo},老板们加油,加油,加油 !!!`
let t = new Date().toLocaleString() let t = new Date().toLocaleString()
this.execClient.execPost({ this.execClient.execPost({
"msgtype": "text", "msgtype": "text",
"text": {"content": t + c} "text": {"content": t + c}
}, gatewayUrl).catch(err => { }, this.businessTo360Url).catch(err => {
console.log(err) console.log(err)
}); });
} }
......
var settings = { var settings = {
redis: { redis: {
host: "39.107.234.14", host: "59.110.125.77",
port: 6379, port: 30479,
password: "123123", password: "havzMSYc3aBZXOjpG3",
db: 5, db: 5,
}, },
database: { database: {
......
...@@ -450,12 +450,6 @@ var settings = { ...@@ -450,12 +450,6 @@ var settings = {
// 2020 1119 lin 正式环境已经给出,鲁班发的ip // 2020 1119 lin 正式环境已经给出,鲁班发的ip
return "http://139.196.159.202:8980/" 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; module.exports = settings;
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