var test={
"svcCaller":"svcCaller",
"timestamp":"timestamp",
"sheetDetail":{
"customerNumber":"0000101",
"serialNo" : "serialNo",
"sheetNo" : "sheetNo",
"serviceType" : "010",
"sheetType" : "036",
"bdeptContact":"bdeptContact",
"bdeptContactPhone":"13333333333",
"dealTime1":"dealTime1",
"initiate":"311",
"solutionAtt":"http://url",
},
"opDetail":{
"requestID":"requestID",
"topology":"1",
"memo":"",
"vpnCustomcode":"0000101",
"dealTime":"",
"vpnName":"FullmeshCPE"
},
"reserved":{
"manufacturer" : "1"
}
} ;
console.log(test);
let sheetDetail=test.sheetDetail,
opDetail=test.opDetail,
reserved=test.reserved;
console.log(sheetDetail,opDetail,reserved);
//VPNID生成
function creatVPNID(sheetDetail,reserved){
let pro;
let jp;
//var initiate = 311;
//console.log(sheetDetail.initiate);
switch (sheetDetail.initiate) {
case "000":
pro = "政企";
jp = "ZhenQi";
break;
case "030":
pro = "国际公司";
jp = "GuoJi";
break;
case "100":
pro = "北京省";
jp = "BeuJing";
break;
case "200":
pro = "广东省";
jp = "GuangDong";
break;
case "210":
pro = "上海省";
jp = "ShangHai";
break;
case "220":
pro = "天津省";
jp = "TinaJin";
break;
case "230":
pro = "重庆省";
jp = "ChongQing";
break;
case "240":
pro = "辽宁省";
jp = "LiaoNing";
break;
case "250":
pro = "江苏省";
jp = "JiangSu";
break;
case "270":
pro = "湖北省";
jp = "HuBei";
break;
case "280":
pro = "四川省";
jp = "SiChuan";
break;
case "290":
pro = "陕西省";
jp = "ShaanXi";
break;
case "311":
pro = "河北省";
jp = "HeBei";
break;
case "351":
pro = "山西省";
jp = "ShanXi";
break;
case "371":
pro = "河南省";
jp = "HeNan";
break;
case "431":
pro = "吉林省";
jp = "JiLin";
break;
case "451":
pro = "黑龙江省";
jp = "HeiLongJiang";
break;
case "471":
pro = "内蒙古省";
jp = "NeiMengGu";
break;
case "531":
pro = "山东省";
jp = "ShanDong";
break;
case "551":
pro = "安徽省";
jp = "AnHui";
break;
case "571":
pro = "浙江省";
jp = "ZheJiang";
break;
case "591":
pro = "福建省";
jp = "FuJian";
break;
case "731":
pro = "湖南省";
jp = "HuNan";
break;
case "771":
pro = "广西省";
jp = "GuangXi";
break;
case "791":
pro = "江西省";
jp = "JingXi";
break;
case "851":
pro = "贵州省";
jp = "GuiZhou";
break;
case "871":
pro = "云南省";
jp = "YunNan";
break;
case "891":
pro = "西藏省";
jp = "XiZang";
break;
case "898":
pro = "海南省";
jp = "HaiNan";
break;
case "931":
pro = "甘肃省";
jp = "GanSu";
break;
case "951":
pro = "宁夏省";
jp = "NingXia";
break;
case "971":
pro = "青海省";
jp = "QingHai";
break;
case "991":
pro = "新疆省";
jp = "XinJiang";
}
let serviceType =sheetDetail.serviceType; //010:组网;011:如云;012:国际业务
let num = ""; //定义用户编号
for (let i = 0; i < 4; i++) //4位随机数,用以加在时间戳后面。
{
num += Math.floor(Math.random() * 10);
}
let manufacturer = reserved.manufacturer; //厂商
let vpnCustomcode = opDetail.vpnCustomcode;//客户标识码
let VPNID =sheetDetail.initiate + "-" + serviceType + "-" + manufacturer +
"-" + vpnCustomcode + "-" + num;
//console.log(VPNID);
return VPNID;
}
let vpnnum= creatVPNID(sheetDetail,reserved);
console.log(vpnnum);
console