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 {
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参数错误");
......
......@@ -6,6 +6,7 @@ class ProductAPI extends WEBBase {
constructor() {
super();
this.utilsOrderSve = system.getObject("service.utilsSve.utilsOrderSve");
this.utilsProductSve = system.getObject("service.utilsSve.utilsProductSve");
}
/**
......@@ -41,6 +42,9 @@ class ProductAPI extends WEBBase {
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;
......
......@@ -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":
......
......@@ -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,
......
......@@ -3,6 +3,7 @@ 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));
......@@ -21,6 +22,7 @@ class GatewaypushlogService extends ServiceBase {
}
var self = this;
for (var i = 0; i < count; i++) {
try {
var icloginfo = icloginfos[i];
var requestdata = null;
if (icloginfo && icloginfo.requestjson) {
......@@ -29,33 +31,42 @@ class GatewaypushlogService extends ServiceBase {
var url = settings.gatewayUrl() + "action/intentionapi/springBoard";
var rtn = await self.execClient.execPost(requestdata, url);
var data = rtn
try {
data = JSON.parse(rtn.stdout);
}catch (e) {
console.error(e)
}
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)
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;
}
await this.update(icloginfo);
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
})
}
}
}
return system.getResultSuccess();
} catch (error) {
this.dingClient.gatewayPushError({message:"Exception",api:"center-channel/taskAliIcapi",error})
return system.getResultFail(-1,error);
this.dingClient.gatewayPushError({message: "Exception", api: "center-channel/taskAliIcapi", error})
return system.getResultFail(-1, error);
}
}
}
module.exports = GatewaypushlogService;
......@@ -192,12 +192,12 @@ module.exports = SignService;
// };
//需求
// var obj={
// "intentionBizId": "baidu_test_00091",
// "intentionBizId": "baidu_test_000101",
// "phone": "18506013355",
// "userName": "测试03",
// "description": "测试03描述",
// "area": "上海",
// "consultType": "7"
// "consultType": "GSREG"
// };
// task.createSign(obj,"7cbb892450174167b5c7e01we4716t51").then(sign=>{
// console.log(sign,"..............Sign");
......
......@@ -85,6 +85,7 @@ class IcbcService extends AppServiceBase {
"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失败');
......@@ -94,8 +95,10 @@ class IcbcService extends AppServiceBase {
url = settings.icNameUrl() + "openPlatform/busenterprise/cloudapi";
//资质查询
let data = {
// "path": "/apis/dst/patents/getLicense",
"path": "/apis/dst/patents/certificate",
"name": queryobj.companyName
"name": queryobj.companyName,
"pageNum":1
};
let rtn = await this.execClient.restGetWithHAuthorizationUrl(token, url, data);
if (!rtn || !rtn.stdout) {
......@@ -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 {
content: JSON.stringify(pushObj),//推送的参数信息
resultInfo: JSON.stringify(result),
returnType: '1',
logLevel: '1',
logLevel: 1,
opTitle: "推送360信息返回成功"
});
} else {
......
......@@ -88,7 +88,7 @@ class UtilsFqAliyunService extends AppServiceBase {
}
async transformNeedActionBody(pobj) {
if (!pobj.actionBody.area) {
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) {
......
......@@ -1263,7 +1263,7 @@ class UtilsOrderService extends AppServiceBase {
};
this.utils360Sve.pushOrderStatus(pobj);
//钉钉机器人
this.dingClient.gatewayPushByChannel(params.orderNo, pobj.appInfo);
this.dingClient.gatewayPushTo360(params.orderNo);
}
opOrderResult.data = null;
return opOrderResult;
......
......@@ -153,6 +153,44 @@ class UtilsProductService extends AppServiceBase {
let result = await this.restPostUrl(pobj,url);
return result;
}
/**
* 根据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 {
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";
}
//推送峰擎异常提醒
......@@ -22,15 +23,14 @@ class dingClient {
}
//渠道钉钉提醒
async gatewayPushByChannel(orderNo, appInfo) {
let gatewayUrl = setttings.dingRobotUrl(appInfo.uapp_id);
if (settings.env != "dev" && gatewayUrl) {
let c = `注意提醒:${appInfo.app_name}->有订单待处理,订单号${orderNo},老板们加油,加油,加油 !!!`
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}
}, gatewayUrl).catch(err => {
}, this.businessTo360Url).catch(err => {
console.log(err)
});
}
......
var settings = {
redis: {
host: "39.107.234.14",
port: 6379,
password: "123123",
host: "59.110.125.77",
port: 30479,
password: "havzMSYc3aBZXOjpG3",
db: 5,
},
database: {
......
......@@ -450,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;
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