Commit 3e02306c by 庄冰

aliyun

parent a7e64a61
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 "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
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
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