Commit fe02f685 by linboxuan

needBatchUpload

parent 2f1550c2
......@@ -85,7 +85,7 @@ class Need extends APIBase {
case "confirmIcpIntention":// 2020 0827 lin 新增 4.3 用户需求确认
opResult = await this.utilsNeedSve.confirmIcpIntention(pobj, pobj.actionBody);
break;
case "needBatchUpload":// 2020 0827 lin 新增 4.3 用户需求确认
case "needBatchUpload":// 2020 0914 lin 新增 刷单一条龙服务
opResult = await this.utilsNeedSve.needBatchUpload(pobj, pobj.actionBody);
break;
case "testsymq":
......
......@@ -14,6 +14,7 @@ class UtilsNeedService extends AppServiceBase {
this.restClient = system.getObject("util.restClient");
this.utilsOrderSve = system.getObject("service.utilsSve.utilsOrderSve");
this.utilsneedSve = system.getObject("service.common.gatewaypushlogSve");
this.qcCenterOrderSve = system.getObject("service.common.qcCenterOrderSve");
this.opPushQueueUrl = settings.opPushQueueUrl();
}
......@@ -613,11 +614,91 @@ class UtilsNeedService extends AppServiceBase {
}
}
// 2020 0914 lin 新增 刷单一条龙功能
// 2020 0914 lin 新增 刷单一条龙服务
async needBatchUpload(pobj,actionBody) {
for(var i = 0;i < actionBody.demands;i++) {
var BizIds = [];
var demands = [];
for(var i = 0;i < actionBody.demands.length;i++) {
// 第一步
// 地区转换
var area = this.areaChange(actionBody.demands[i].area)
// SubmitIcpIntention需要的类型转换ICP许可证 = 5/EDI许可证 = 7
var bizType = this.bizTypeChange(actionBody.demands[i].type)
// 声明调用4.1需要的参数
var obj = {
Mobile: actionBody.demands[i].contactMobile,// 手机号
UserName:actionBody.demands[i].contactName,// 用户名
Description:actionBody.demands[i].description,
Area:area,
BizType:bizType,
Channel:"gsb",
Token:"gsb",
}
var aliResult = await this.aliclient.reqbyget({ action: "SubmitIcpIntention", reqbody: obj, apiVersion: "2019-05-08" });
console.log("needBatchUpload-aliResult",aliResult)
if(aliResult.status != 0) {
// 统计失败次数
}
// 第二步
// 创建企服通需求单
var npobj = pobj;
npobj.actionBody = {
intentionBizId: aliResult.data.BizId,
type: this.bizTypeChange(actionBody.demands[i].type),
description:actionBody.demands[i].description,
mobile:actionBody.demands[i].contactMobile
}
var opResult = await this.submitNeed(npobj,npobj.actionBody);
console.log("needBatchUpload-opResult",opResult)
// 第三步
// 提交Icp注册方案
var spobj = pobj;
spobj.actionType = "submitIcpProgramme";
spobj.actionBody = {
"needNo": aliResult.data.BizId,//渠道需求号
"solutionContent":{
// submitIcpProgramme需要的类型转换 ICP许可证 = icpsq/EDI许可证 = edisq
"bizType":actionBody.demands[i].type,//产品类型 icpsq edisq
"solution":{
// "IcpType":1,//方案类型 不传默认1 1:icp 2: edi 参数无效
"CompanyName":actionBody.demands[i].companyName,
"CompanyAddress":actionBody.demands[i].companyAddress,
"Area":actionBody.demands[i].area,
"Note":actionBody.demands[i].description
}
}
}
var subRes = await this.qcCenterOrderSve.submitIcpProgramme(pobj);
console.log("needBatchUpload-res",subRes)
// 第四步
// 需求沟通记录接口
var writeRes = await this.writeCommunicationLog({actionBody:{intentionBizId:"20200804200124000001",note:"测试反馈"}});
console.log("needBatchUpload-writeRes",writeRes)
// 整合前端需要的数据
BizIds.push(aliResult.data.BizId)
demands.push({
uniqueCode:actionBody.demands[i].uniqueCode,
demandCode: opResult.data.needNo
})
}
// 第五步 用户需求确认
var aliConfirmResult = await this.aliclient.reqbyget({ action: "ConfirmIcpIntention", reqbody: {BizIds:BizIds}, apiVersion: "2019-05-08" });
console.log("needBatchUpload-aliConfirmResult",aliConfirmResult)
// 获取链接失败
if(aliConfirmResult.status != 0) {
var res = {
paymentLink:"",
batchNumber:actionBody.batchNumber,
demands:demands
}
return system.getResult(res,"confirmIcpIntention fail");
}
var res = {
paymentLink:aliConfirmResult.confirmUrl,
batchNumber:actionBody.batchNumber,
demands:demands
}
return system.getResultSuccess(res);
}
async testsymq(pobj) {
var a = null;
......@@ -630,6 +711,96 @@ class UtilsNeedService extends AppServiceBase {
}
areaChange(area) {
switch (area) {
case "北京":
return "1";
case "上海":
return "2"
case "福建":
return "3"
case "广西":
return "4"
case "广东":
return "5"
case "安徽":
return "6"
case "河南":
return "7"
case "湖北":
return "8"
case "浙江":
return "9"
case "江苏":
return "10"
case "山东":
return "11"
case "陕西":
return "12"
case "宁夏":
return "13"
case "甘肃":
return "14"
case "新疆":
return "15"
case "青海":
return "16"
case "天津":
return "17"
case "重庆":
return "18"
case "河北":
return "19"
case "山西":
return "20"
case "辽宁":
return "21"
case "吉林":
return "22"
case "黑龙江":
return "23"
case "江西":
return "24"
case "湖南":
return "25"
case "四川":
return "26"
case "贵州":
return "27"
case "云南":
return "28"
case "内蒙古":
return "29"
case "西藏":
return "30"
case "含外资":
return "31"
case "全外资":
return "32"
case "香港":
return "33"
case "海南":
return "34"
default:
return "35"
}
}
bizTypeChange(bizType) {
switch(bizType) {
case "ICP许可证":
return "5"
case "EDI许可证":
return "7"
}
}
needBizTypeChange(type) {
switch(type) {
case "ICP许可证":
return "icpsq"
case "EDI许可证":
return "edisq"
}
}
urlSplit(url) {
var arr = url.split("?")[1]; //根据?跟个url
var arr2 = arr[1].split("&"); //根据&重新分割参数
......
......@@ -248,7 +248,8 @@ module.exports = function (app) {
"getNeedListUser",
"manualEvaluation", "diagnosisInfo", "check", "enterpriseInfo", "diagnosisDetail",
"submitIcpIntention", "queryIntentionList", "confirmIcpIntention",
"tmAccept", "tmStatus"
"tmAccept", "tmStatus",
"needBatchUpload"
];
if (lst.indexOf(req.body.actionType) >= 0) {
var userpin = req.headers["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