Commit 6b35f967 by 陈思聪

fix:百度工商注册新流程

parent 9c9dc36e
......@@ -7,10 +7,9 @@ class CompanycaseCtl extends CtlBase {
/* 接受到百度推送过来的工商注册申请材料 */
async receiveSubmitMaterialsFormBaidu(pobj) {
let data = pobj.d;
console.log("接受到百度推送过来的工商注册申请材料:"+JSON.stringify(data))
console.log("接受到百度推送过来的工商注册申请材料:"+JSON.stringify(pobj))
try {
await this.service.receiveSubmitMaterialsFormBaidu(data);
await this.service.receiveSubmitMaterialsFormBaidu(pobj);
} catch (err) {
console.log(err)
return system.getResult(null, err.message)
......@@ -81,5 +80,18 @@ class CompanycaseCtl extends CtlBase {
return system.getResult(null, err.message)
}
}
// 获取工商注册信息详情
async getGongshangRegDetail(pobj, qobj, req) {
try {
if (!pobj.id) {
throw new Error("参数错误")
}
const rs = await this.service.getGongshangRegDetail(pobj);
return system.getResult(rs);
} catch (err) {
return system.getResult(null, err.message)
}
}
}
module.exports = CompanycaseCtl;
......@@ -14,9 +14,11 @@ class CompanycaseService extends ServiceBase {
this.newmaterialDao = system.getObject("db.delivery.newmaterialDao");
this.statuslogDao = system.getObject("db.bizchance.statuslogDao");
this.qualificationDao = system.getObject("db.delivery.qualificationDao");
this.logClient = system.getObject("util.logClient");
}
async receiveSubmitMaterialsFormBaidu(data){
// this.logClient.log(pobj, req, null, e.stack);
console.log(`mmmmmmmmmmmm接受到百度推送过来的工商材料信息`+JSON.stringify(data))
const actionBody = data.d
const deliverData = await this.deliveryDao.findOne({
......@@ -107,10 +109,18 @@ class CompanycaseService extends ServiceBase {
}
if(deliverData.delivery_info && deliverData.delivery_info.channelMaterials){
console.log(`【提交材料】+++++new走百度新接口提交材料${pobj.deliver_id}`)
await TOQFT.getClientByType(deliverData.product_code).submitMaterialsNew(pobj.username, deliverData, pobj.cache_info);
let res = await TOQFT.getClientByType(deliverData.product_code).submitMaterialsNew(pobj.username, deliverData, pobj.cache_info);
console.log(`【提交材料】+++++new走百度新接口提交材料${pobj.deliver_id} 响应:${res}`)
if(!res.success){
throw new Error(`提交材料给百度失败,原因${res.msg}`)
}
if([system.SERVERSESTATUS.COLLECTING].includes(deliverData.delivery_status)){
console.log(`【提交材料】+++++new走百度新接口更新工商注册状态${pobj.deliver_id}`)
await TOQFT.getClientByType(deliverData.product_code).updateGongshangRegStatus(pobj.username, deliverData, system.SERVERSESTATUS.AUDITING);
let res1 = await TOQFT.getClientByType(deliverData.product_code).updateGongshangRegStatus(pobj.username, deliverData, system.SERVERSESTATUS.AUDITING);
console.log(`【提交材料】+++++new走百度新接口更新工商注册状态${pobj.deliver_id} 响应:${res1}`)
if(!res1.success){
throw new Error(`提交材料给百度失败,原因${res1h.msg}`)
}
}
}else{
console.log(`+++++old走百度老接口提交材料${pobj.deliver_id}`)
......@@ -164,6 +174,47 @@ class CompanycaseService extends ServiceBase {
/**
* 工商信息初审未通过、工商信息提交中、工商局审核未通过、工商局审核通过、补正复审中、补正复审未通过、刻章中、刻章完成、证件已上传、证件已邮寄
*
* @param {*} pobj
* @param {*} qobj
* @param {*} req
*/
async getGongshangRegDetail(pobj, qobj, req) {
console.log(`更新百度工商注册新流程状态开始:`+JSON.stringify(pobj));
const deliverData = await this.deliveryDao.findOne({
id: pobj.id
});
if (!deliverData) {
throw new Error("查不到此交付单");
}
if(!deliverData.delivery_info){
throw new Error("交付单详情为空");
}
if(!deliverData.delivery_info.channelMaterials){
throw new Error("百度未同步公司注册申请材料");
}
if(!deliverData.delivery_info.channelMaterials.who){
throw new Error("who参数为空");
}
// 更新百度工商注册流程状态
let client = TOQFT.getClientByType(deliverData.product_code);
console.log(">>>>开始调用百度获取工商注册信息详情接口:"+pobj.id)
const res = await client.getGongshangMaterial(pobj.username, deliverData, pobj.status);
console.log(">>>>结束调用百度获取工商注册信息详情接口:"+pobj.id+",结果="+JSON.stringify(res))
if(!res.success){
throw new Error(`百度获取工商注册信息详情接口失败,原因${res.msg}`)
}
return res.data
}
/**
* 工商信息初审未通过、工商信息提交中、工商局审核未通过、工商局审核通过、补正复审中、补正复审未通过、刻章中、刻章完成、证件已上传、证件已邮寄
*
* @param {*} pobj
* @param {*} qobj
......@@ -195,8 +246,8 @@ class CompanycaseService extends ServiceBase {
"ICB_SUBMITTING",// 工商信息提交中
"ICB_AUDIT_FAILED",// 工商局审核未通过
"ICB_AUDIT_PASS",// 工商局审核通过
"ICB_RE-AUDITING",// 补正复审中
"ICB_RE-AUDIT_FAILED",// 补正复审未通过
"ICB_RE_AUDITING",// 补正复审中
"ICB_RE_AUDIT_FAILED",// 补正复审未通过
"ENGRAVING",// 刻章中
"ENGRAVED",// 刻章完成
"LICENSE_UPLOADED",// 证件已上传
......@@ -227,13 +278,24 @@ class CompanycaseService extends ServiceBase {
console.log(">>>>开始调用百度接口更新工商状态接口:"+pobj.id)
const res = await client.updateGongshangRegStatus(pobj.username, deliverData, pobj.status);
console.log(">>>>结束调用百度接口更新工商状态接口:"+pobj.id+",结果="+JSON.stringify(res))
if(!res.success){
throw new Error(`百度更新工商状态接口调用失败,原因${res.msg}`)
}
if("LICENSE_UPLOADED" == pobj.status){
console.log(">>>>开始调用百度接口更新回传营业执照:"+pobj.id)
await client.submitLicense(pobj.username,deliverData,licenseUrl)
const res1 = await client.submitLicense(pobj.username,deliverData,licenseUrl)
console.log(">>>>结束调用百度接口更新回传营业执照:"+pobj.id+"结果="+JSON.stringify(res1))
if(!res1.success){
throw new Error(`百度回传营业执照接口失败,原因${res1.msg}`)
}
}else if("LICENSE_POSTED" == pobj.status){
console.log(">>>>开始调用百度接口更新回传刻章信息:"+pobj.id)
await client.submitEngraving(pobj.username,deliverData,licenseUrl)
const res1 = await client.submitEngraving(pobj.username,deliverData,expressNum)
console.log(">>>>结束调用百度接口更新回传刻章信息:"+pobj.id+"结果="+JSON.stringify(res1))
if(!res1.success){
throw new Error(`百度回传刻章信息接口失败,原因${res1.msg}`)
}
}
return "SUCCESS"
......@@ -323,8 +385,13 @@ class CompanycaseService extends ServiceBase {
}
if(system.SERVICECODE.COMPANYCASE == deliverData.product_code && deliverData.delivery_info.channelMaterials){
console.log(`【更新交付单状态】new 调用百度新接口更新工商注册状态.(id=${pobj.id})`)
await TOQFT.getClientByType(deliverData.product_code).updateGongshangRegStatus(pobj.username, deliverData, status);
if(system.SERVERSESTATUS.RECEIVED != deliverData.delivery_status && system.SERVERSESTATUS.SUCCESS != status){
console.log(`【更新交付单状态】new 调用百度新接口更新工商注册状态.(id=${pobj.id})`)
let res = await TOQFT.getClientByType(deliverData.product_code).updateGongshangRegStatus(pobj.username, deliverData, status);
if(!res.success){
throw new Error(`更新百度工商注册流程状态失败,原因${res.msg}`)
}
}
}else{
console.log(`【更新交付单状态】old 调用百度老接口更新工商注册状态.(id=${pobj.id})`)
await TOQFT.getClientByType(deliverData.product_code).changeStatus(pobj.username, deliverData, materials);
......
......@@ -91,21 +91,27 @@ class GongshangClient extends BaseClient {
*/
async updateGongshangRegStatus(username, deliverData, updateStatus){
let updateBaiduGongshangStatus = null;
if(system.SERVERSESTATUS.AUDITING == updateStatus){ // 收集材料环节
updateBaiduGongshangStatus = 'ICB_AUDITING' // 工商局审核中
}else if(system.SERVERSESTATUS.ENGRAVING == updateStatus){ // 刻章环节
updateBaiduGongshangStatus = 'COLLECTING_ENGRAVE_MATERIAL' // 刻章资料收集中
}else {
console.log(`【百度工商注册新流程】deliveryId: ${deliverData.id} 交付单状态为:${updateStatus} 不需要通知百度`)
return ;
if([system.SERVERSESTATUS.AUDITING,system.SERVERSESTATUS.ENGRAVING].includes(updateStatus)){
if(system.SERVERSESTATUS.AUDITING == updateStatus){ // 收集材料环节
updateBaiduGongshangStatus = 'ICB_AUDITING' // 工商局审核中
}else if(system.SERVERSESTATUS.ENGRAVING == updateStatus){ // 刻章环节
updateBaiduGongshangStatus = 'COLLECTING_ENGRAVE_MATERIAL' // 刻章资料收集中
}else {
console.log(`【百度工商注册新流程】deliveryId: ${deliverData.id} 交付单状态为:${updateStatus} 不需要通知百度`)
return ;
}
}else{
updateBaiduGongshangStatus = updateStatus;
}
console.log(`【百度工商注册新流程】deliveryId: ${deliverData.id} 交付单状态为:${updateStatus} 告知百度状态为:${updateBaiduGongshangStatus}`)
let pushData = {
deliveryId: deliverData.id,
who: deliverData.delivery_info.channelMaterials.who,
status: updateStatus
status: updateBaiduGongshangStatus
}
console.log(`开始调用百度更新工商状态接口(deliveryId=${deliverData.id}),请求参数:`+JSON.stringify(pushData))
......
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