Commit 232d1067 by linboxuan

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

parents f48dba9a 3426e933
var APIBase = require("../../api.base");
var system = require("../../../system");
var settings = require("../../../../config/settings");
class QcAPI extends APIBase {
constructor() {
super();
this.centerorderSve = system.getObject("service.common.qcCenterOrderSve");
}
/**
* 接口跳转-POST请求
* action_process 执行的流程
* action_type 执行的类型
* action_body 执行的参数
*/
async springBoard(pobj, qobj, req) {
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) {
var opResult = null;
switch (action_type) {
case "getNeedSolutionDetailByUser"://获取方案详情
opResult = await this.centerorderSve.reqCenterOrderApi(pobj,"action/icpapi/springBoard");
break;
case "submitIcpProgramme"://icp方案提交
opResult = await this.centerorderSve.submitIcpProgramme(pobj);
break;
case "receiveProgrammeNo"://接收渠道方案号(测试)
opResult = await this.centerorderSve.reqCenterOrderApi(pobj);
break;
case "submitIcpMaterial"://icp材料提交
opResult = await this.centerorderSve.submitIcpMaterial(pobj);
break;
case "acceptIcpPartnerNotification"://icp通知状态变更
opResult = await this.centerorderSve.acceptIcpPartnerNotification(pobj);
break;
case "abolishIcpProgramme"://服务商icp方案关闭
opResult = await this.centerorderSve.abolishIcpProgramme(pobj);
break;
case "getProgrammeInfoByChannelNeedNo"://获取需求方案列表
opResult = await this.centerorderSve.reqCenterOrderApi(pobj,"action/icpapi/springBoard");
break;
default:
opResult = system.getResult(null, "action_type参数错误");
break;
}
return opResult;
}
}
module.exports = QcAPI;
\ No newline at end of file
......@@ -58,7 +58,7 @@ class Need extends APIBase {
break;
case "icpFeedbackSubmit"://icp接收方案反馈信息
pobj.actionType = "receiveIcpFeedback";
opResult = await this.utilsNeedSve.reqCenterOrderApi(pobj);
opResult = await this.utilsNeedSve.reqCenterOrderQcApi(pobj);
break;
case "icpNotify"://icp方案更新
var rtn = await this.utilsNeedSve.icpNotify(pobj, pobj.actionBody);
......
......@@ -225,6 +225,8 @@ class CenterorderService extends AppServiceBase {
pobj.actionBody.payTotalSum = data.data.price;
pobj.actionBody.payCode = data.data.payCode;
pobj.actionBody.channelItemCode = data.data.channelItemCode;
pobj.actionBody.channelNeedNo = data.data.channelNeedNo;
pobj.actionBody.needNo = data.data.needNo;
pobj.actionBody.quantity = 1;
pobj.actionBody.channelOrder = {
channelServiceNo: pobj.actionBody.orderNo,
......
const system = require("../../../system");
const crypto = require('crypto');
var settings = require("../../../../config/settings");
const AppServiceBase = require("../../app.base");
/**
* 资质信息提报相关接口
*/
class QcCenterOrderService extends AppServiceBase {
constructor() {
super();
this.centerOrderUrl = settings.centerOrderUrl();
this.execClient = system.getObject("util.execClient");
this.aliclient = system.getObject("util.aliyunClient");
this.cacheManager = system.getObject("db.common.cacheManager");
this.utilsOrderSve = system.getObject("service.utilsSve.utilsOrderSve");
this.utilsPushSve = system.getObject("service.utilsSve.utilsPushSve");
this.utilsTmAliyunSve = system.getObject("service.utilsSve.utilsTmAliyunSve");//测试用
};
//调用center-order
async reqCenterOrderApi(pobj, reqUrl) {
var url = this.centerOrderUrl + "action/qcapi/springBoard";
if (reqUrl) {
var url = this.centerOrderUrl + reqUrl;
}
var rtn = await this.execClient.execPost(pobj, url);
var data = JSON.parse(rtn.stdout);
return data;
}
//提交Icp注册方案
async submitIcpProgramme(pobj) {
var res = await this.reqCenterOrderApi(pobj, "action/qcapi/springBoard");
if (res && res.status == 0 && res.data && res.data.needinfo && res.data.needsolution) {
var needinfo = res.data.needinfo;//需求信息
var needsolution = res.data.needsolution;//方案信息
var ab = pobj.actionBody;
if (typeof (ab.solutionContent) == "string") {
ab.solutionContent = JSON.parse(ab.solutionContent);
}
if (typeof (needsolution.solutionContent) == "string") {
needsolution.solutionContent = JSON.parse(needsolution.solutionContent);
}
var solution = needsolution.solutionContent.solution;
//推送数据至阿里
var bizType = needinfo.channelTypeCode;//业务类型里
var pushObj = {
IntentionBizId: needinfo.channelNeedNo,
CompanyName: solution.CompanyName, IcpType: solution.IcpType, CompanyAddress: solution.CompanyAddress,
Area: solution.Area, Note: solution.Note
};
var self = this;
//推送方案
// this.pushIcpSolution(pushObj,needsolution.solutionNo,pobj.appInfo,self);
return system.getResultSuccess();
}
return res;
}
//推送ICP方案
async pushIcpSolution(pushObj, solutionNo, appInfo, self) {
//推送方案信息
var pushRes = await self.aliclient.reqbyget({ action: "SubmitIcpSolution", reqbody: pushObj, apiVersion: "2019-05-08" });
if (pushRes && pushRes.status == 0 && pushRes.data) {
var resData = pushRes.data;
if (resData.BizId) {
var reqObj2 = {
actionType: "receiveProgrammeNo",
appInfo: appInfo,
actionBody: {
solutionNo: solutionNo,
solutionBizId: resData.BizId
}
};
var a = await self.reqCenterOrderApi(reqObj2);//保存渠道方案id
if (a && a.status == 0) {
//推送方案确认信息
await self.aliclient.reqbyget({action:"ConfirmIntention",reqbody:{BizId:pushObj.IntentionBizId},apiVersion:"2019-05-08"});
}
}
}
}
//icp材料提交
async submitIcpMaterial(pobj) {
var res = await this.reqCenterOrderApi(pobj, "action/qcapi/springBoard");
if (res && res.status == 0 && res.data) {
var needsolution = res.data;//方案信息
var ab = pobj.actionBody;
if (typeof (ab.material) == "string") {
ab.material = JSON.parse(ab.material);
}
var material = ab.material;
//推送数据至阿里
var BizId = ab.BizId;//⽅案业务ID
var pushObj = {
"BizId": BizId,
"Domain": material.Domain,
"CorporateName": material.CorporateName,
"IncludeForeignInvestment": material.IncludeForeignInvestment,
"PartnerBusinessLicense": material.PartnerBusinessLicense,
"PartnerIdCardList": material.PartnerIdCardList,
"PartnerDomainCertificate": material.PartnerDomainCertificate,
"PartnerPreviewOtherList": material.PartnerPreviewOtherList || [],
"PartnerPlan": material.PartnerPlan || "",
"PartnerForeignInvestment": material.PartnerForeignInvestment || "",
"PartnerLaw": material.PartnerLaw || "",
"PartnerStampOtherList": material.PartnerStampOtherList || [],
"PartnerSignOtherList": material.PartnerSignOtherList || [],
"PartnerSignAndStampOtherList": material.PartnerSignAndStampOtherList || []
};
var self = this;
//推送方案材料
// self.aliclient.reqbyget({action:"SavePartnerSubmitMaterial",reqbody:pushObj,apiVersion:"2019-05-08"});
return system.getResultSuccess();
}
return res;
}
//icp通知状态变更
async acceptIcpPartnerNotification(pobj) {
var res = await this.reqCenterOrderApi(pobj, "action/qcapi/springBoard");
if (res && res.status == 0 && res.data) {
var ab = pobj.actionBody;
//推送数据至阿里
// var pushObj = res.data;
var pushObj = {
BizId:res.data.BizId,
OfficialFileURL:res.data.OfficialFileURL,
ApplicationStatus:res.data.ApplicationStatus
};
//推送方案
// this.aliclient.reqbyget({action:"AcceptPartnerNotification",reqbody:pushObj,apiVersion:"2019-05-08"});
return system.getResultSuccess();
}
return res;
}
//服务商icp方案关闭
async abolishIcpProgramme(pobj) {
var res = await this.reqCenterOrderApi(pobj, "action/qcapi/springBoard");
if (res && res.status == 0 && res.data) {
var needsolution = res.data;//方案信息
var ab = pobj.actionBody;
if (typeof (ab.material) == "string") {
ab.material = JSON.parse(ab.material);
}
//推送数据至阿里
var pushObj = {
BizId: ab.BizId, Note: ab.Note
};
//关闭方案
// this.aliclient.reqbyget({action:"CloseIcpProduce",reqbody:pushObj,apiVersion:"2019-05-08"});
return system.getResultSuccess();
}
return res;
}
}
module.exports = QcCenterOrderService;
\ No newline at end of file
......@@ -55,7 +55,7 @@ class UtilsNeedService extends AppServiceBase {
return result;
}
//调用center-order icp需求反馈
//调用center-order
async reqCenterOrderApi(pobj, reqUrl) {
var url = this.centerOrderUrl + "action/icpapi/springBoard";
if (reqUrl) {
......@@ -67,6 +67,18 @@ class UtilsNeedService extends AppServiceBase {
return data;
}
//调用center-order icp需求反馈
async reqCenterOrderQcApi(pobj, reqUrl) {
var url = this.centerOrderUrl + "action/qcapi/springBoard";
if (reqUrl) {
var url = this.centerOrderUrl + reqUrl;
}
pobj.actionType = "receiveIcpFeedback";
var rtn = await this.execClient.execPost(pobj, url);
var data = JSON.parse(rtn.stdout);
return data;
}
/**
* 提交需求
* @param {*} pobj
......@@ -254,7 +266,7 @@ class UtilsNeedService extends AppServiceBase {
actionBody.newuserOtherList = newuserOtherList;
}
pobj.actionType = "receiveIcpStatusNotify";
var url = settings.centerOrderUrl() + "action/icpapi/springBoard";
var url = settings.centerOrderUrl() + "action/qcapi/springBoard";
var rtn = await this.restPostUrl(pobj, url);
return rtn;
}
......
......@@ -27,7 +27,7 @@ module.exports = function (app) {
app.all('*', function (req, res, next) {
req.objs = system;
res.header('Access-Control-Allow-Origin', '*');
res.header('Access-Control-Allow-Headers', 'Content-Type, Content-Length, Authorization, Accept, X-Requested-With , yourHeaderFeild');
res.header('Access-Control-Allow-Headers', 'Content-Type, Content-Length, Authorization, Accept, X-Requested-With , yourHeaderFeild,Authorization,XAPPKEY,XFROMAPPKEY,XFROMCOMPANYKEY,XREGROLE,XBIZPATH');
res.header('Access-Control-Allow-Methods', 'PUT, POST, GET, DELETE, OPTIONS');
// res.header('Access-Control-Allow-Credentials', 'true');
res.header('content-type', 'text/html;charset=UTF-8');
......
......@@ -12,7 +12,7 @@
## **<a name="submitIcpProgramme"> icp方案提交</a>**
[返回到目录](#menu)
##### URL
[/web/action/icpapi/springBoard]
[/web/action/qcapi/springBoard]
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
#### 请求头中需要增加userpin(用户登录后的凭证)的值
......@@ -52,7 +52,7 @@
## **<a name="submitIcpMaterial"> icp材料提交</a>**
[返回到目录](#menu)
##### URL
[/web/action/icpapi/springBoard]
[/web/action/qcapi/springBoard]
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
#### 请求头中需要增加userpin(用户登录后的凭证)的值
......@@ -98,7 +98,7 @@
## **<a name="getProgrammeInfoByChannelNeedNo"> 根据需求查看方案详情</a>**
[返回到目录](#menu)
##### URL
[/web/action/icpapi/springBoard]
[/web/action/qcapi/springBoard]
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
#### 请求头中需要增加userpin(用户登录后的凭证)的值
......@@ -339,7 +339,7 @@
## **<a name="acceptIcpPartnerNotification"> icp通知状态变更</a>**
[返回到目录](#menu)
##### URL
[/web/action/icapi/springBoard]
[/web/action/qcapi/springBoard]
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
#### 请求头中需要增加userpin(用户登录后的凭证)的值
......@@ -377,7 +377,7 @@ ApplicationStatus:
## **<a name="abolishIcpProgramme"> 服务商关闭icp方案</a>**
[返回到目录](#menu)
##### URL
[/web/action/icapi/springBoard]
[/web/action/qcapi/springBoard]
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
#### 请求头中需要增加userpin(用户登录后的凭证)的值
......@@ -406,7 +406,7 @@ ApplicationStatus:
## **<a name="getNeedSolutionDetailByUser"> 获取方案详情</a>**
[返回到目录](#menu)
##### URL
[/web/action/icpapi/springBoard]
[/web/action/qcapi/springBoard]
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
#### 请求头中需要增加userpin(用户登录后的凭证)的值
......
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