Commit 9298b9f0 by 王栋源

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

parents 44a80a8a a685f56f
......@@ -36,6 +36,9 @@ 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);
break;
default:
opResult = system.getResult(null, "action_type参数错误");
break;
......
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");
}
/**
* 接口跳转-POST请求
* action_process 执行的流程
* action_type 执行的类型
* action_body 执行的参数
*/
async springBoard(pobj, qobj, req) {
if (!pobj.actionProcess) {
return system.getResult(null, "actionProcess参数不能为空");
}
if (!pobj.actionType) {
return system.getResult(null, "actionType参数不能为空");
}
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 "tmAccept"://2020 0828 lin 新增 ali商标交易 创建订单接口
opResult = await this.utilsOrderSve.tmAccept(pobj, pobj.actionBody);
break;
case "tmRefuse"://2020 0828 lin 新增 ali商标交易 关闭订单接口
opResult = await this.utilsOrderSve.tmRefuse(pobj, pobj.actionBody);
break;
case "tmStatus"://2020 0828 lin 新增 ali商标交易 订单查询
opResult = await this.utilsOrderSve.tmStatus(pobj, pobj.actionBody);
break;
default:
opResult = system.getResult(null, "action_type参数错误");
break;
}
return opResult;
}
}
module.exports = ProductAPI;
......@@ -6,6 +6,12 @@ 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) {
......@@ -28,6 +34,41 @@ class IcbcService extends AppServiceBase {
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 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);
......
......@@ -795,5 +795,58 @@ class UtilsOrderService extends AppServiceBase {
return system.getResultFail(-200, e.stack);
}
}
async tmAccept(pobj) {// 2020 0828 lin 新增 ali商标交易 创建订单接口
try {
var actionBody = pobj.actionBody;
actionBody.channelItemCode = "sbjy"
actionBody.quantity = 1;
pobj.actionType = "getProductDetail";
var url = settings.centerAppUrl() + "action/opProduct/springBoard";
var productItemResult = await this.restPostUrl(pobj, url);
if (productItemResult.status != 0) {
return productItemResult;
}
pobj.actionBody.product_info = productItemResult.data;
var verifyResult = await this.isOrderVerify(pobj, pobj.actionBody);
if (verifyResult.status != 0) {
return verifyResult;
}
pobj.actionType = "getProductInterface";
pobj.actionBody.product_id = pobj.actionBody.product_info.id;
var productItemInterfaceResult = await this.restPostUrl(pobj, url);
pobj.actionBody.product_info.interface_info = productItemInterfaceResult.data;
pobj.actionType = "addOrder";
var reqUrl = this.centerOrderUrl + "action/order/springBoard";
// console.log(pobj);
var result = await this.restPostUrl(pobj, reqUrl);
result.totalSum = actionBody.totalSum;
return result;
if(result) {
var result = {
"errorCode": "error",
"errorMsg": orderinfo.msg,
"module": { "orderId": "" },
"requestId": req.requestId,
"success": false
}
return result;
}
} catch (e) {
var result = {
"errorCode": "error",
"errorMsg": e,
"module": { "orderNumber": "" },
"requestId": req.requestId,
"success": false
}
return result;
}
}
}
module.exports = UtilsOrderService;
......@@ -206,6 +206,7 @@ class RedisClient {
async delete(key) {
return this.client.delAsync(key);
}
//设置hash表数据,jsonObj格式:{key:value}
async hmset(key, jsonObj) {
return this.client.hmsetAsync(key, jsonObj);
}
......@@ -217,6 +218,18 @@ class RedisClient {
async hgetall(key) {
return this.client.hgetallAsync(key);
}
//获取指定hash表的所有key
async hkeys(key) {
return this.client.hkeysAsync(key);
}
//获取指定hash表的field对应的值
async hget(key, field) {
return this.client.hgetAsync(key, field);
}
//删除指定hash表的字段
async hdel(key, fields) {
return this.client.hdelAsync(key, ...fields);
}
async hincrby(key, f, n) {
return this.client.hincrbyAsync(key, f, n);
}
......@@ -245,13 +258,13 @@ class RedisClient {
}
}
module.exports = RedisClient;
// var client=new RedisClient();
// (async ()=>{
// await client.rpush("tasklist","xxx");
// await client.rpush("tasklist","xxx");
// var len=await client.llen("tasklist");
var client = new RedisClient();
// (async () => {
// await client.rpush("tasklist", "xxx");
// await client.rpush("tasklist", "xxx");
// var len = await client.llen("tasklist");
// //await client.clearlist("tasklist");
// len=await client.llen("tasklist");
// len = await client.llen("tasklist");
// console.log(len);
// })()
......@@ -277,10 +290,31 @@ module.exports = RedisClient;
// r.get("hello").then(function(result){
// console.log(result);
// });
// client.hmset("user_1",{name:"jy",age:13}).then(function(r){
// client.hmset("user_1", { "北京汉唐科技": "hantang-sy", age: 1314 }).then(function (r) {
// console.log(r);
// });
// client.hmset("user_1", { "北京汉唐科技-test01": "hantang-sy-test01" }).then(function (r) {
// console.log(r);
//
// });
// client.hgetall("user_1").then(function (r) {
// console.log(r, "hgetall.................");
// });
// client.hkeys("user_19").then(function (r) {
// console.log(r, "hkeys.................");//没有值则为[]
// });
// client.hget("user_19", "北京汉唐科技").then(function (r) {
// console.log(r, "hget.................");//没有值则为null
// });
// client.hdel("user_1", ["age"]).then(function (r) {
// console.log(r, "hdel.................");//删除成功为1,否则删除失败
// });
// client.hincrby("user_1","age",2).then(function(r){
// console.log(r);
// setTimeout(function(){
......
......@@ -3,7 +3,7 @@ var settings = {
host: "43.247.184.32",
port: 8967,
password: "Gongsibao2018",
db: 8,
db: 5,
},
database: {
dbname: "igirl_api",
......
......@@ -139,67 +139,67 @@ module.exports = function (app) {
}
});
//----------------------飞书小程序---------------------------------------------结束
// app-ali支付回调通知
app.use('/orderNotify/aliPayNotify', async function (req, res) {
try{
var client_ip = system.get_client_ip(req);
var result = await utilsOrderSve.aliPayNotify(req.body, client_ip);
logCtl.info({
optitle: (new Date()).Format("yyyy-MM-dd hh:mm:ss") + "记录支付宝回调处理结果 api层",
op: "center-channel/orderNotify/aliPayNotify",
content: "支付回调处理结果:" + JSON.stringify(result),
clientIp: client_ip || ""
});
if (result.status != 0) {
return res.end("FAIL");
}
return res.end("success");
} catch(e) {
logCtl.error({
// app-ali支付回调通知
app.use('/orderNotify/aliPayNotify', async function (req, res) {
try {
var client_ip = system.get_client_ip(req);
var result = await utilsOrderSve.aliPayNotify(req.body, client_ip);
logCtl.info({
optitle: (new Date()).Format("yyyy-MM-dd hh:mm:ss") + "记录支付宝回调处理结果 api层",
op: "center-channel/orderNotify/aliPayNotify",
content: "支付回调处理结果:" + JSON.stringify(result),
clientIp: client_ip || ""
});
if (result.status != 0) {
return res.end("FAIL");
}
return res.end("success");
} catch (e) {
logCtl.error({
optitle: (new Date()).Format("yyyy-MM-dd hh:mm:ss") + "支付宝回调处理异常 api层",
op: "center-channel/orderNotify/aliPayNotify",
content: "回调参数:req=" + JSON.stringify(req) + "error:" + e.stack,
clientIp: client_ip || ""
});
}
});
// app-wx支付回调
app.use('/orderNotify/wxPayNotify', async function (req, res) {
try{
var body = "";
}
});
// app-wx支付回调
app.use('/orderNotify/wxPayNotify', async function (req, res) {
try {
var body = "";
req.on('data', function(data) {
body += data;
});
req.on('end', async function() {
xml2js.parseString(body, { trim: true, explicitArray: false, explicitRoot: false }, async function(err, json) {
var client_ip = system.get_client_ip(req);
var result = await utilsOrderSve.wxPayNotify(json);
logCtl.info({
optitle: (new Date()).Format("yyyy-MM-dd hh:mm:ss") + "记录微信支付回调处理结果",
op: "center-channel/orderNotify/wxPayNotify",
content: "支付回调处理结果:" + JSON.stringify(result),
clientIp: client_ip || ""
});
if (result.status != 0) {
return res.end("FAIL");
}
return res.end("success");
})
})
} catch(e) {
logCtl.error({
req.on('data', function (data) {
body += data;
});
req.on('end', async function () {
xml2js.parseString(body, { trim: true, explicitArray: false, explicitRoot: false }, async function (err, json) {
var client_ip = system.get_client_ip(req);
var result = await utilsOrderSve.wxPayNotify(json);
logCtl.info({
optitle: (new Date()).Format("yyyy-MM-dd hh:mm:ss") + "记录微信支付回调处理结果",
op: "center-channel/orderNotify/wxPayNotify",
content: "支付回调处理结果:" + JSON.stringify(result),
clientIp: client_ip || ""
});
if (result.status != 0) {
return res.end("FAIL");
}
return res.end("success");
})
})
} catch (e) {
logCtl.error({
optitle: (new Date()).Format("yyyy-MM-dd hh:mm:ss") + "微信回调处理异常",
op: "center-channel/orderNotify/wxPayNotify",
content: "回调参数:req=" + JSON.stringify(req) + "error:" + e.stack,
clientIp: client_ip || ""
});
}
});
}
});
app.all("/web/*", async function (req, res, next) {
var result = system.getResult(null, "req method must is post");
if (req.method != "POST") {
......@@ -210,9 +210,9 @@ module.exports = function (app) {
result.msg = "actionType can not be empty";
res.end(JSON.stringify(result));
return;
}
// 2020 0812 lin 只去掉了check,因为要记录智能诊断的返回值,其他接口暂时未去掉
if (["getAppTokenByHosts", "getAppTokenByAppKey", "test","getIndustries","getSecondIndustries","getQualificationByIndustry","counselling"].indexOf(req.body.actionType) >= 0) {
}
// 2020 0812 lin 只去掉了check,因为要记录智能诊断的返回值,其他接口暂时未去掉
if (["getAppTokenByHosts", "getAppTokenByAppKey", "test", "getIndustries", "getSecondIndustries", "getQualificationByIndustry", "counselling"].indexOf(req.body.actionType) >= 0) {
req.body.actionBody.appHosts = req.host;
next();
return;
......@@ -229,25 +229,26 @@ module.exports = function (app) {
res.end(JSON.stringify(result));
return;
}
var cacheManager = system.getObject("db.common.cacheManager");
var result = await cacheManager["AppTokenByHostsCache"].getCache(token, system.exTime);
var cacheManager = system.getObject("db.common.cacheManager");
var result = await cacheManager["AppTokenByHostsCache"].getCache(token, system.exTime);
if (result.status != 0) {
res.end(JSON.stringify(result));
return;
}
req.body.appInfo = result.data;
req.body.actionProcess = result.data.app_code;
var lst = ["serviceProviderSubmitMaterial","closeOrderDelivery","serviceProviderNotification",
"tmConfirm", "getNeedSolutionDetailByUser","getProgrammeInfoByChannelNeedNo",
var lst = ["serviceProviderSubmitMaterial", "closeOrderDelivery", "serviceProviderNotification",
"tmConfirm", "getNeedSolutionDetailByUser", "getProgrammeInfoByChannelNeedNo",
"submitIcpProgramme", "submitIcpMaterial", "acceptIcpPartnerNotification", "abolishIcpProgramme",
"addOrder", "getH5PayUrl", "getOrderQrCode", "queryOrderStatus", "getOrderInfo", "getOrderDeliveryInfo", "getOrderDetails",
"getOrderDeliveryFlowInfo", "getOrderDeliveryFlowList", "getOrderLogInfo", "updateContacts", "updateTmOrder", "delOrder",
"submitProgramme", "getProgrammeListByUser", "getProgrammeInfoByNeedNo", "abolishProgramme", "getAliPayInfo",
"getPaidLogoListByUser","getCollectibleLogoListByUser","collectLogo","getLogoMaterial","cancelCollectLogo","icpNotify","createName","getNameDetail","orderConfirm",
"orderTotalSum", "collect", "reg", "orderCheck","getReOrderList","getOfficalList","addReviewList","opSubmitNeed","opNeedClose","opNeedList","getItemByNeedNo","opNeedDetailByChannelNo",
"getNeedListUser",
"manualEvaluation", "diagnosisInfo", "check", "enterpriseInfo", "diagnosisDetail",
"submitIcpIntention", "queryIntentionList", "confirmIcpIntention"
"getPaidLogoListByUser", "getCollectibleLogoListByUser", "collectLogo", "getLogoMaterial", "cancelCollectLogo", "icpNotify", "createName", "getNameDetail", "orderConfirm",
"orderTotalSum", "collect", "reg", "orderCheck", "getReOrderList", "getOfficalList", "addReviewList", "opSubmitNeed", "opNeedClose", "opNeedList", "getItemByNeedNo", "opNeedDetailByChannelNo",
"getNeedListUser",
"manualEvaluation", "diagnosisInfo", "check", "enterpriseInfo", "diagnosisDetail",
"submitIcpIntention", "queryIntentionList", "confirmIcpIntention",
"tmAccept", "tmRefuse", "tmStatus"
];
if (lst.indexOf(req.body.actionType) >= 0) {
var userpin = req.headers["userpin"] || "";
......@@ -371,7 +372,7 @@ module.exports = function (app) {
req.body.appInfo = result.data;
req.body.actionProcess = result.data.app_code;
var lst = [
"submitNeed", "paySuccess","icpNotify"
"submitNeed", "paySuccess", "icpNotify"
];
if (lst.indexOf(req.body.actionType) >= 0) {
var userpin = req.headers["userpin"] || "";
......
......@@ -176,6 +176,13 @@ var settings = {
return "http://43.247.184.94:7200/";
}
},
certificationUrl:function () {
if (this.env == "dev") {
return "http://43.247.184.92:15506/";//
} else {
return "http://43.247.184.92:15506/";
}
},
reqZcApi: function () {
if (this.env == "dev") {
return "http://zcapi.apps.com:4002/";//localsettings.reqEsDevUrl;
......
......@@ -4,6 +4,7 @@
1. [企业详情](#getDetailByCompanyName)
1. [企业变更记录查询](#getCompanyChangeByName)
1. [工商icp证照查询](#getCompanyIcpByName)
1. [企业资质证书查询](#searchCertification)
## **<a name="getCompanyListByVague"> 企业模糊查询</a>**
[返回到目录](#menu)
......@@ -304,4 +305,57 @@
"requestId": "e4e69fac26b74fb7958c0a71fc30d21d"
}
```
## **<a name="searchCertification"> 企业资质证书查询</a>**
[返回到目录](#menu)
##### URL
[/action/icbcTools/springBoard]
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
#### 渠道执行的类型 actionType:searchCertification
``` javascript
{
"companyName":"海南椰利园食品有限公司"
}
```
#### 返回结果
```javascript
{
"status": 0,
"msg": "操作成功",
"data": [
{
"EndDate": "2020-11-12 00:00:00",
"Id": "69466fbd54a6942f7644d9a8079cad91_6",
"Name": "食品生产许可证",
"No": "SC10646010800036",
"StartDate": "2015-11-13 00:00:00",
"Type": "C_997_91"
},
{
"EndDate": "2014-11-28 00:00:00",
"Id": "e8ee5244-4ffa-4289-ad27-204be9b5ee6d",
"Name": "其他食品(椰纤果)",
"No": "QS460028010044",
"StartDate": "2011-11-22 00:00:00",
"Type": "C_997_95"
},
{
"EndDate": "2014-12-22 00:00:00",
"Id": "a94341c7-5569-4dfd-9ee9-b988e957a5b5",
"Name": "罐头食品(果蔬罐头)",
"No": "QS460009013129",
"StartDate": "2011-11-22 00:00:00",
"Type": "C_997_95"
}
],
"requestId": "e4e69fac26b74fb7958c0a71fc30d21d"
}
```
\ 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