Commit 5b56539f by 陈思聪

fix: 百度工商注册新流程

parent ffeaec1a
...@@ -91,6 +91,9 @@ class RegAPI extends APIBase { ...@@ -91,6 +91,9 @@ class RegAPI extends APIBase {
break; break;
case "submitGongshangMaterial"://百度工商注册新流程接口:供应商变更用户申请材料 case "submitGongshangMaterial"://百度工商注册新流程接口:供应商变更用户申请材料
opResult = await this.regCenterOrderSve.submitGongshangMaterial(pobj); opResult = await this.regCenterOrderSve.submitGongshangMaterial(pobj);
break;
case "getGongshangMaterial"://百度工商注册新流程接口:供应商获取工商注册信息详情
opResult = await this.regCenterOrderSve.getGongshangMaterial(pobj);
break; break;
//-----------接入百度reg------end---------------------------- //-----------接入百度reg------end----------------------------
default: default:
......
...@@ -30,7 +30,7 @@ class Order extends APIBase { ...@@ -30,7 +30,7 @@ class Order extends APIBase {
appInfo: pobj.appInfo appInfo: pobj.appInfo
}; };
console.log(`>>> 提交工商注册申请材料 参数...${JSON.stringify(deliveryObj)}`); console.log(`>>> 提交工商注册申请材料 参数...${JSON.stringify(deliveryObj)}`);
// await this.utilsPushSve.business2Channel(deliveryObj, "pushOrderDeliveryMaterial"); await this.utilsPushSve.business2Channel(deliveryObj, "pushOrderDeliveryMaterial");
return regCfg.getResultSuccess(pobj.requestId); return regCfg.getResultSuccess(pobj.requestId);
} }
......
...@@ -590,6 +590,25 @@ class RegCenterOrderService extends AppServiceBase { ...@@ -590,6 +590,25 @@ class RegCenterOrderService extends AppServiceBase {
return result; return result;
} }
/**
* 百度工商注册新流程接口:供应商获取工商注册信息详情
*
* @param {*} pobj
*/
async getGongshangMaterial(pobj) {
let self = this;
const deliveryId = pobj.actionBody.deliveryId
const serviceId = pobj.actionBody.serviceId
this.execClientNew.execLogs("getGongshangMaterial-开始:", pobj, "center-channel-getGongshangMaterial", null, null);
console.log(`>>>>【百度工商注册新流程接口:供应商获取工商注册信息详情 ${deliveryId}】getGongshangMaterial方法开始`, JSON.stringify(pobj))
let baiduParams = {path: `/v1/com/application-material/${serviceId}`}
console.log(`>>>>【百度工商注册新流程接口:供应商获取工商注册信息详情 交付单id:${deliveryId}】getGongshangMaterial方法`)
// 同步刻章信息给百度
let baiduRes = await self.baiduRegClient.baiduReqbyGet1(baiduParams);
console.log(`>>>>【百度工商注册新流程接口:供应商获取工商注册信息详情 交付单id:${deliveryId}】getGongshangMaterial方法,接口响应:`, JSON.stringify(baiduRes))
this.execClientNew.execLogs("submitGongshangEngraving-baiduReqbyget:", pobj, "center-channel-getGongshangMaterial", baiduParams, baiduRes);
return baiduRes;
}
/** /**
* 百度工商注册新流程接口:刻章环节,供应商使用此接口同步刻章信息 * 百度工商注册新流程接口:刻章环节,供应商使用此接口同步刻章信息
...@@ -597,6 +616,7 @@ class RegCenterOrderService extends AppServiceBase { ...@@ -597,6 +616,7 @@ class RegCenterOrderService extends AppServiceBase {
* @param {*} pobj * @param {*} pobj
*/ */
async submitGongshangEngraving(pobj) { async submitGongshangEngraving(pobj) {
let self = this;
const deliveryId = pobj.actionBody.deliveryId const deliveryId = pobj.actionBody.deliveryId
this.execClientNew.execLogs("submitGongshangEngraving-开始:", pobj, "center-channel-submitGongshangEngraving", null, null); this.execClientNew.execLogs("submitGongshangEngraving-开始:", pobj, "center-channel-submitGongshangEngraving", null, null);
console.log(`>>>>【百度工商注册新流程接口:刻章环节,供应商使用此接口同步刻章信息 ${deliveryId}】submitGongshangEngraving方法开始`, pobj) console.log(`>>>>【百度工商注册新流程接口:刻章环节,供应商使用此接口同步刻章信息 ${deliveryId}】submitGongshangEngraving方法开始`, pobj)
...@@ -625,6 +645,7 @@ class RegCenterOrderService extends AppServiceBase { ...@@ -625,6 +645,7 @@ class RegCenterOrderService extends AppServiceBase {
* @param {*} pobj * @param {*} pobj
*/ */
async submitGongshangLicense(pobj) { async submitGongshangLicense(pobj) {
let self = this;
const deliveryId = pobj.actionBody.deliveryId const deliveryId = pobj.actionBody.deliveryId
console.log(`>>>>【百度工商注册新流程接口:公司注册完成后,供应商将营业执照回传百度云 ${deliveryId}】submitGongshangLicense方法开始`, pobj) console.log(`>>>>【百度工商注册新流程接口:公司注册完成后,供应商将营业执照回传百度云 ${deliveryId}】submitGongshangLicense方法开始`, pobj)
this.execClientNew.execLogs("submitGongshangLicense-开始:", pobj, "center-channel-submitGongshangLicense", null, null); this.execClientNew.execLogs("submitGongshangLicense-开始:", pobj, "center-channel-submitGongshangLicense", null, null);
...@@ -653,10 +674,11 @@ class RegCenterOrderService extends AppServiceBase { ...@@ -653,10 +674,11 @@ class RegCenterOrderService extends AppServiceBase {
* @param {*} pobj * @param {*} pobj
*/ */
async updateGongshangRegStatus(pobj) { async updateGongshangRegStatus(pobj) {
const deliveryId = pobj.actionBody.deliveryId let self = this;
console.log(`>>>>【百度工商注册新流程接口:将工商注册流程状态更新给百度 ${deliveryId}】updateGongshangRegStatus方法开始`, pobj) const deliveryId = pobj.actionBody.deliveryId
console.log(`>>>>【百度工商注册新流程接口:将工商注册流程状态更新给百度 ${deliveryId}】updateGongshangRegStatus方法开始`, JSON.stringify(pobj))
this.execClientNew.execLogs("updateGongshangRegStatus-开始:", pobj, "center-channel-updateGongshangRegStatus", null, null); this.execClientNew.execLogs("updateGongshangRegStatus-开始:", JSON.stringify(pobj), "center-channel-updateGongshangRegStatus", null, null);
// 组装请求参数 // 组装请求参数
let pushObj = { let pushObj = {
...@@ -669,11 +691,10 @@ class RegCenterOrderService extends AppServiceBase { ...@@ -669,11 +691,10 @@ class RegCenterOrderService extends AppServiceBase {
detail: null detail: null
}; };
let baiduParams = {path: "/v1/com/status", reqbody: pushObj} let baiduParams = {path: "/v1/com/status", reqbody: pushObj}
console.log(`>>>>【百度工商注册新流程接口:将工商注册流程状态更新给百度 交付单id:${deliveryId}】updateGongshangRegStatus方法,接口请求参数:`, pushObj) console.log(`>>>>【百度工商注册新流程接口:将工商注册流程状态更新给百度 交付单id:${deliveryId}】updateGongshangRegStatus方法,接口请求参数:`, JSON.stringify(pushObj))
// 同步工商注册流程最新状态给百度 // 同步工商注册流程最新状态给百度
let baiduRes = await self.baiduRegClient.baiduReqbyput(baiduParams); let baiduRes = await self.baiduRegClient.baiduReqbyput(baiduParams);
console.log(`>>>>【百度工商注册新流程接口:将工商注册流程状态更新给百度 交付单id:${deliveryId}】updateGongshangRegStatus方法,接口响应:`, baiduRes) console.log(`>>>>【百度工商注册新流程接口:将工商注册流程状态更新给百度 交付单id:${deliveryId}】updateGongshangRegStatus方法,接口响应:`, JSON.stringify(baiduRes))
this.execClientNew.execLogs("updateGongshangRegStatus-baiduReqbyput:", pobj, "center-channel-updateGongshangRegStatus", baiduParams, baiduRes); this.execClientNew.execLogs("updateGongshangRegStatus-baiduReqbyput:", pobj, "center-channel-updateGongshangRegStatus", baiduParams, baiduRes);
return baiduRes; return baiduRes;
} }
...@@ -683,17 +704,59 @@ class RegCenterOrderService extends AppServiceBase { ...@@ -683,17 +704,59 @@ class RegCenterOrderService extends AppServiceBase {
* @param {*} pobj * @param {*} pobj
*/ */
async submitGongshangMaterial(pobj){ async submitGongshangMaterial(pobj){
let self = this;
const deliveryId = pobj.actionBody.deliveryId const deliveryId = pobj.actionBody.deliveryId
console.log(`>>>>【百度工商注册新流程接口:供应商变更用户申请材料 ${deliveryId}】submitGongshangMaterial`, pobj) console.log(`>>>>【百度工商注册新流程接口:供应商变更用户申请材料 ${deliveryId}】submitGongshangMaterial`, pobj)
this.execClientNew.execLogs("submitGongshangMaterial-开始:", pobj, "center-channel-submitGongshangMaterial", null, null); this.execClientNew.execLogs("submitGongshangMaterial-开始:", pobj, "center-channel-submitGongshangMaterial", null, null);
// 移出com结构下的type、taxerType
delete pobj.actionBody.deliverContent.com.type
delete pobj.actionBody.deliverContent.com.taxerType
// if(pobj.actionBody.deliverContent.com.addr){
// delete pobj.actionBody.deliverContent.com.addr.urls;
// }
// if(pobj.actionBody.deliverContent.shareholders){
// if(pobj.actionBody.deliverContent.shareholders.naturalPersons){
// for(let obj of pobj.actionBody.deliverContent.shareholders.naturalPersons){
// delete obj.idCardFrontPicUrl
// delete obj.idCardBackPicUrl
// }
// }
// if(pobj.actionBody.deliverContent.shareholders.legalPersons){
// for(let obj of pobj.actionBody.deliverContent.shareholders.legalPersons){
// delete obj.comLicensePicUrl
// delete obj.rptIdCardFrontPicUrl
// delete obj.rptIdCardBackPicUrl
// }
// }
// }
// if(pobj.actionBody.deliverContent.members){
// for(let obj of pobj.actionBody.deliverContent.members){
// delete obj.idCardBackPicUrl
// delete obj.idCardFrontPicUrl
// }
// }
// 移出addr结构
if(pobj.actionBody.deliverContent.com.addr &&(pobj.actionBody.deliverContent.com.addr.type ==null||pobj.actionBody.deliverContent.com.addr.type == '') ){
delete pobj.actionBody.deliverContent.com.addr;
}
// 移出members下的capital
for(let member of pobj.actionBody.deliverContent.members){
delete member.capital
}
// 组装请求参数 // 组装请求参数
let pushObj = { let pushObj = {
who: pobj.actionBody.deliverContent.companyInfo.channelMaterials.who, // 目标 who: pobj.actionBody.deliverContent.who, // 目标
com: pobj.actionBody.deliverContent.companyInfo.channelMaterials.com, // 公司基本信息 com: pobj.actionBody.deliverContent.com, // 公司基本信息
receiver: pobj.actionBody.deliverContent.companyInfo.channelMaterials.receiver, // 邮寄地址 receiver: pobj.actionBody.deliverContent.receiver, // 邮寄地址
shareholders: pobj.actionBody.deliverContent.companyInfo.channelMaterials.shareholders, // 股东信息 shareholders: pobj.actionBody.deliverContent.shareholders, // 股东信息
members:pobj.actionBody.deliverContent.companyInfo.channelMaterials.members // 主要人员信息 members:pobj.actionBody.deliverContent.members // 主要人员信息
}; };
let baiduParams = {path: "/v1/com/application-material", reqbody: pushObj} let baiduParams = {path: "/v1/com/application-material", reqbody: pushObj}
console.log(`>>>>【百度工商注册新流程接口:供应商变更用户申请材料 交付单id:${deliveryId}】submitGongshangLicense方法,接口请求参数:`, pushObj) console.log(`>>>>【百度工商注册新流程接口:供应商变更用户申请材料 交付单id:${deliveryId}】submitGongshangLicense方法,接口请求参数:`, pushObj)
......
...@@ -62,6 +62,56 @@ class baiduRegClient { ...@@ -62,6 +62,56 @@ class baiduRegClient {
return result; return result;
} }
async baiduGet( path) {
// console.log('actionBody++',actionBody)
let domain = this.baiduRegClientParams.domain;
let url = domain+path;
let version ="bce-auth-v1";
let accessKey = this.baiduRegClientParams.accessKey;
let secretKey = this.baiduRegClientParams.secretKey;
let timestamp = new Date().toISOString()
let site = timestamp.lastIndexOf(".");
timestamp = timestamp.substring(0,site)+"Z"
let signedHeaders = "host";
let extime = 1800;
let canonicalHeaders = "host:"+this.baiduRegClientParams.host;
//中间结果1:规范化请求和前缀字符串
var canonicalRequest = null
var pathParams = path.split("?");
if(pathParams && pathParams.length > 1){
canonicalRequest = "GET" + "\n" + pathParams[0] + "\n" + pathParams[1] + "\n" + canonicalHeaders;
}else{
canonicalRequest = "GET" + "\n" + path + "\n" + "\n" + canonicalHeaders;
}
// let canonicalRequest = "POST" + "\n" + path + "\n" + "\n" + canonicalHeaders;
// console.log('canonicalRequest+++++++',canonicalRequest)
//authStringPrefix(前缀字符串,由除sk字段外的签名信息生成)
let authStringPrefix = version+"/"+accessKey+"/"+timestamp+"/"+extime;
//中间结果2:派生签名密钥 signingKey
let signingKey = crypto.createHmac('sha256', secretKey)
.update(authStringPrefix)
.digest('hex');
//中间结果3:签名摘要 signature
let signature = crypto.createHmac('sha256', signingKey)
.update(canonicalRequest)
.digest('hex');
//最终结果:认证字符串 authorization
let authorization = authStringPrefix+"/"+signedHeaders+"/"+signature;
var baiduObj={
authorization:authorization
}
var rtn = await this.execClient.execBaiduGet(baiduObj, url);
this.execClientNew.execLogs("api-center-channel-baiduGet:"+url, baiduObj, "center-channel-baiduGet", rtn, null);
// console.log("baiduObj+++++",baiduObj)
// console.log("url+++++",url)
// console.log("rtn+++++",rtn)
if (!rtn || !rtn.stdout) {
return system.getResult(null, "execGet data is empty");
}
var result = JSON.parse(rtn.stdout);
return result;
}
//2022 chensc put调用百度网关 //2022 chensc put调用百度网关
async baiduPut( path, actionBody) { async baiduPut( path, actionBody) {
// console.log('actionBody++',actionBody) // console.log('actionBody++',actionBody)
...@@ -102,7 +152,7 @@ class baiduRegClient { ...@@ -102,7 +152,7 @@ class baiduRegClient {
authorization:authorization, authorization:authorization,
data:actionBody data:actionBody
} }
var rtn = await this.execClient.execBaiduPost(baiduObj, url); var rtn = await this.execClient.execBaiduPut(baiduObj, url);
this.execClientNew.execLogs("api-center-channel-baiduPut:"+url, baiduObj, "center-channel-baiduPut", rtn, null); this.execClientNew.execLogs("api-center-channel-baiduPut:"+url, baiduObj, "center-channel-baiduPut", rtn, null);
// console.log("baiduObj+++++",baiduObj) // console.log("baiduObj+++++",baiduObj)
// console.log("url+++++",url) // console.log("url+++++",url)
...@@ -154,6 +204,37 @@ class baiduRegClient { ...@@ -154,6 +204,37 @@ class baiduRegClient {
} }
} }
//百度接口 2020-10-27 laolan
async baiduReqbyGet1(obj, cbk) {
var path = obj.path;
try {
var res = await this.baiduGet(path);
console.log('baidu++++res+++',res)
this.pushlogSve.createDb({
op: "new-baiduRegReqbyGet1",
content: JSON.stringify(obj),//推送的参数信息
resultInfo: JSON.stringify(res),
returnType: '1',
logLevel: '1',
opTitle: "new-baiduReqbyGet1推送百度信息返回成功"
});
return system.getResultSuccess(res);
} catch (e) {
this.pushlogSve.createFailLogDb({
appid: obj.appInfo ? obj.appInfo.uapp_id || "" : "",
appkey: obj.appInfo ? obj.appInfo.uapp_key || "" : "",
requestId: obj.requestId || "",
content: JSON.stringify(obj),//推送的参数信息
resultInfo: "error:" + JSON.stringify(e),
clientIp: obj.clientIp || "",
failType: 1,
opTitle: "new-baiduRegReqbyGet1推送百度信息返回异常",
pushNumber: obj.pushNumber || 1
});
return system.getResultFail(-200, "出现异常,error:" + e.stack);
}
}
//百度接口 2022-04-23 //百度接口 2022-04-23
async baiduReqbyput(obj, cbk) { async baiduReqbyput(obj, cbk) {
var path = obj.path; var path = obj.path;
......
...@@ -15,6 +15,8 @@ class ExecClient { ...@@ -15,6 +15,8 @@ class ExecClient {
//360 //360
this.cmd360PostPattern = "curl -u gongsibao:qPa4PsVsxbQ847i5pOKSmfPKrzRoNKqx -d '{data}' -X POST {url}" this.cmd360PostPattern = "curl -u gongsibao:qPa4PsVsxbQ847i5pOKSmfPKrzRoNKqx -d '{data}' -X POST {url}"
this.cmdBaiduGetPattern = "curl -k -X GET -H 'Authorization: {Authorization}' {url}";
this.cmdBaiduPostPattern = "curl -k -H 'Content-type: application/json' -H 'Authorization: {Authorization}' -d '{data}' {url}"; this.cmdBaiduPostPattern = "curl -k -H 'Content-type: application/json' -H 'Authorization: {Authorization}' -d '{data}' {url}";
this.cmdBaiduPutPattern = "curl -X PUT -k -H 'Content-type: application/json' -H 'Authorization: {Authorization}' -d '{data}' {url}"; this.cmdBaiduPutPattern = "curl -X PUT -k -H 'Content-type: application/json' -H 'Authorization: {Authorization}' -d '{data}' {url}";
...@@ -60,6 +62,13 @@ class ExecClient { ...@@ -60,6 +62,13 @@ class ExecClient {
console.log(cmd); console.log(cmd);
return cmd; return cmd;
} }
FetchBaiduGetCmd(subData, url) {
var cmd = this.cmdBaiduGetPattern.replace(/\{url\}/g, url).replace(/\{Authorization\}/g, subData.authorization);
console.log(cmd);
return cmd;
}
FetchBaiduPostCmd(subData, url) { FetchBaiduPostCmd(subData, url) {
var data = JSON.stringify(subData.data); var data = JSON.stringify(subData.data);
var cmd = this.cmdBaiduPostPattern.replace(/\{data\}/g, var cmd = this.cmdBaiduPostPattern.replace(/\{data\}/g,
...@@ -110,11 +119,25 @@ class ExecClient { ...@@ -110,11 +119,25 @@ class ExecClient {
var result = await this.exec(cmd); var result = await this.exec(cmd);
return result; return result;
} }
async execBaiduPut(subData, url) {
let cmd = this.FetchBaiduPutCmd(subData, url);
var result = await this.exec(cmd);
return result;
}
async execBaiduPost(subData, url) { async execBaiduPost(subData, url) {
let cmd = this.FetchBaiduPostCmd(subData, url); let cmd = this.FetchBaiduPostCmd(subData, url);
var result = await this.exec(cmd); var result = await this.exec(cmd);
return result; return result;
} }
async execBaiduGet(subData, url) {
let cmd = this.FetchBaiduGetCmd(subData, url);
var result = await this.exec(cmd);
return result;
}
async execEnamePost(subData, url) { async execEnamePost(subData, url) {
let cmd = this.FetchEnamePostCmd(subData, url); let cmd = this.FetchEnamePostCmd(subData, url);
var result = await this.exec(cmd); var result = await this.exec(cmd);
......
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