Commit 99467d72 by linboxuan

receiveEdiStatusNotify

parents b245b590 5c38b252
...@@ -79,12 +79,17 @@ class QcAPI extends APIBase { ...@@ -79,12 +79,17 @@ class QcAPI extends APIBase {
case "receiveIcpConfirmUrl"://前端关闭ICP需求及方案 case "receiveIcpConfirmUrl"://前端关闭ICP需求及方案
opResult = await this.aliyunqcSve.receiveIcpConfirmUrl(pobj); opResult = await this.aliyunqcSve.receiveIcpConfirmUrl(pobj);
break; break;
case "serviceSubmitOption"://服务商提交服务操作(文网文)2020-9-26
opResult = await this.aliyunqcSve.serviceSubmitOption(pobj);
break;
case "submitWangwenSolution"://提交方案(文网文)2020-9-27
opResult = await this.aliyunqcSve.submitWangwenSolution(pobj);
break;
default: default:
opResult = system.getResult(null, "action_type参数错误"); opResult = system.getResult(null, "action_type参数错误");
break; break;
} }
return opResult; return opResult;
} }
} }
module.exports = QcAPI; module.exports = QcAPI;
\ No newline at end of file
...@@ -5,7 +5,7 @@ const moment = require('moment') ...@@ -5,7 +5,7 @@ const moment = require('moment')
* created by zhuangbing * created by zhuangbing
* created at 2020.07.27 * created at 2020.07.27
*/ */
class AliyunQcService{ class AliyunQcService {
constructor() { constructor() {
this.needsolutionDao = system.getObject("db.dbneed.needsolutionDao"); this.needsolutionDao = system.getObject("db.dbneed.needsolutionDao");
this.needinfoDao = system.getObject("db.dbneed.needinfoDao"); this.needinfoDao = system.getObject("db.dbneed.needinfoDao");
...@@ -17,6 +17,7 @@ class AliyunQcService{ ...@@ -17,6 +17,7 @@ class AliyunQcService{
GXB_ACCEPT: "⼯信部已受理", GXB_REFUSE: "⼯信部不予受理", GXB_FAIL: "⼯信部未通过", GXB_SUCCESS: "工信部通过" GXB_ACCEPT: "⼯信部已受理", GXB_REFUSE: "⼯信部不予受理", GXB_FAIL: "⼯信部未通过", GXB_SUCCESS: "工信部通过"
, CLOSE: "方案关闭" , CLOSE: "方案关闭"
}; };
<<<<<<< HEAD
this.ediSolutionStatusReference = { this.ediSolutionStatusReference = {
SOLUTION_SUBMIT: "服务单通知服务商", SOLUTION_SUBMIT: "服务单通知服务商",
USER_PAY_PRODUCE: "⽤户⽀付", USER_CONFIRM_PRODUCE: "⽤户确认资料", USER_PAY_PRODUCE: "⽤户⽀付", USER_CONFIRM_PRODUCE: "⽤户确认资料",
...@@ -29,6 +30,36 @@ class AliyunQcService{ ...@@ -29,6 +30,36 @@ class AliyunQcService{
510:"⼯商部不予受理", 510:"⼯商部不予受理",
511:"⼯商部通过", 511:"⼯商部通过",
512:"⼯商部未通过" 512:"⼯商部未通过"
=======
this.icpApplicationStatusReference = {
507: "完成账户注册",
508: "服务商完成提交资料到⼯信部",
509: "⼯商部已受理",
510: "⼯商部不予受理",
511: "⼯商部通过",
512: "⼯商部未通过"
};
//(文网文状态2020-9-26)
this.wangwenStatusReference = {
601: "完成账户注册",
602: "服务商提交资料",
603: "服务商完成提交资料到⼯信部",
604: "⼯商部已受理",
605: "⼯商部不予受理",
606: "⼯商部通过",
607: "⼯商部未通过"
};
//(文网文状态2020-9-26)
this.wangwenSolutionStatusReference = {
"SOLUTION_SUBMIT": "提交服务单",
"PARTNER_SUBMIT_MATERIAL": "服务商提交资料",
"CERT_ACCOUNT_REGISTERED": "完成账户注册",
"CERT_MATERIAL_SUBMITTED": "服务商完成提交资料到⼯信部",
"CERT_GXB_ACCEPT": "⼯商部已受理",
"CERT_GXB_SUCCESS": "⼯商部通过",
"CERT_GXB_FAIL": "⼯商部未通过",
"CERT_GXB_REFUSE": "⼯商部不予受理"
>>>>>>> 5c38b252841e34fee9b52571328ed3842659da89
}; };
} }
//根据需求关闭ICP方案(关闭需求后调用) //根据需求关闭ICP方案(关闭需求后调用)
...@@ -43,7 +74,7 @@ class AliyunQcService{ ...@@ -43,7 +74,7 @@ class AliyunQcService{
} }
//获取需求信息 //获取需求信息
var needinfo = await this.needinfoDao.model.findOne({ var needinfo = await this.needinfoDao.model.findOne({
attributes:["id","status","statusName","needNo"], attributes: ["id", "status", "statusName", "needNo"],
where: { channelNeedNo: ab.intentionBizId }, raw: true where: { channelNeedNo: ab.intentionBizId }, raw: true
}); });
if (!needinfo || !needinfo.id) { if (!needinfo || !needinfo.id) {
...@@ -54,25 +85,25 @@ class AliyunQcService{ ...@@ -54,25 +85,25 @@ class AliyunQcService{
} }
//获取方案信息 //获取方案信息
var ns = await this.needsolutionDao.model.findOne({ var ns = await this.needsolutionDao.model.findOne({
where: { needNo: needinfo.needNo,isInvalid:0 }, raw: true where: { needNo: needinfo.needNo, isInvalid: 0 }, raw: true
}); });
if(ns && ns.id){ if (ns && ns.id) {
if (ns.status == "ywc") { if (ns.status == "ywc") {
return system.getResultFail(-103, "方案状态错误,不能废弃已完成方案"); return system.getResultFail(-103, "方案状态错误,不能废弃已完成方案");
} }
var flowStatus = ns.solutionContent && ns.solutionContent.status?ns.solutionContent.status:""; var flowStatus = ns.solutionContent && ns.solutionContent.status ? ns.solutionContent.status : "";
if(flowStatus && [ "GXB_REFUSE","CLOSE"].indexOf(flowStatus)<0){ if (flowStatus && ["GXB_REFUSE", "CLOSE"].indexOf(flowStatus) < 0) {
return system.getResultFail(-104, "⽅案状态为关闭或不予受理才可关闭需求"); return system.getResultFail(-104, "⽅案状态为关闭或不予受理才可关闭需求");
} }
} }
var self = this; var self = this;
return await this.needsolutionDao.db.transaction(async function (t) { return await this.needsolutionDao.db.transaction(async function (t) {
var needObj = { var needObj = {
id:needinfo.id,status:"ygb",notes:ab.note id: needinfo.id, status: "ygb", notes: ab.note
}; };
await self.needinfoDao.update(needObj,t);//关闭需求 await self.needinfoDao.update(needObj, t);//关闭需求
if(ns && ns.id){ if (ns && ns.id) {
await self.needsolutionDao.model.update({ status: "yzf",isInvalid:1 }, { where: { id: ns.id }, transaction: t });//方案废弃 await self.needsolutionDao.model.update({ status: "yzf", isInvalid: 1 }, { where: { id: ns.id }, transaction: t });//方案废弃
return system.getResultSuccess(ns.orderNo); return system.getResultSuccess(ns.orderNo);
} }
return system.getResultSuccess(); return system.getResultSuccess();
...@@ -98,7 +129,7 @@ class AliyunQcService{ ...@@ -98,7 +129,7 @@ class AliyunQcService{
return system.getResultFail(-102, "未知需求信息"); return system.getResultFail(-102, "未知需求信息");
} }
var ns = await this.needsolutionDao.model.findAll({ var ns = await this.needsolutionDao.model.findAll({
where: { needNo: needinfo.needNo}, raw: true, where: { needNo: needinfo.needNo }, raw: true,
attributes: ["needNo", "solutionNo", "channelSolutionNo", "orderNo", "solutionContent", "status", "statusName"] attributes: ["needNo", "solutionNo", "channelSolutionNo", "orderNo", "solutionContent", "status", "statusName"]
}); });
return system.getResultSuccess(ns); return system.getResultSuccess(ns);
...@@ -111,7 +142,7 @@ class AliyunQcService{ ...@@ -111,7 +142,7 @@ class AliyunQcService{
} }
//获取方案信息 //获取方案信息
var ns = await this.needsolutionDao.model.findAll({ var ns = await this.needsolutionDao.model.findAll({
where: { channelSolutionNo: ab.BizId,isInvalid:0 }, raw: true where: { channelSolutionNo: ab.BizId, isInvalid: 0 }, raw: true
}); });
return system.getResultSuccess(ns); return system.getResultSuccess(ns);
} }
...@@ -178,7 +209,7 @@ class AliyunQcService{ ...@@ -178,7 +209,7 @@ class AliyunQcService{
ab.solutionContent.typeCode = needinfo.typeCode; ab.solutionContent.typeCode = needinfo.typeCode;
ab.solutionContent.typeName = needinfo.typeName; ab.solutionContent.typeName = needinfo.typeName;
var ns = await this.needsolutionDao.model.findAll({ var ns = await this.needsolutionDao.model.findAll({
where: { channelNeedNo: ab.needNo }, raw: true,order: [["id", 'asc']] where: { channelNeedNo: ab.needNo }, raw: true, order: [["id", 'asc']]
}); });
for (var i = 0; i < ns.length; i++) { for (var i = 0; i < ns.length; i++) {
var fa = ns[i]; var fa = ns[i];
...@@ -198,9 +229,9 @@ class AliyunQcService{ ...@@ -198,9 +229,9 @@ class AliyunQcService{
} }
if (needinfo.channelTypeCode == "7") {//edi if (needinfo.channelTypeCode == "7") {//edi
ab.solutionContent.solution.IcpType = 2; ab.solutionContent.solution.IcpType = 2;
}else if (needinfo.channelTypeCode == "5") {//icp } else if (needinfo.channelTypeCode == "5") {//icp
ab.solutionContent.solution.IcpType = 1; ab.solutionContent.solution.IcpType = 1;
}else{ } else {
return system.getResultFail(-208, "需求业务类型有误"); return system.getResultFail(-208, "需求业务类型有误");
} }
if (!solution.CompanyName) { if (!solution.CompanyName) {
...@@ -224,17 +255,17 @@ class AliyunQcService{ ...@@ -224,17 +255,17 @@ class AliyunQcService{
ab["solutionNo"] = solutionNo; ab["solutionNo"] = solutionNo;
ab["status"] = "dqr"; ab["status"] = "dqr";
var customerInfo = {//客户信息 var customerInfo = {//客户信息
"publishName":needinfo.publishName, "publishName": needinfo.publishName,
"publishMobile":needinfo.publishMobile "publishMobile": needinfo.publishMobile
}; };
var salesmanInfo = {//业务员信息 var salesmanInfo = {//业务员信息
"salesmanName":user.channel_username, "salesmanName": user.channel_username,
"salesmanMobile":user.mobile, "salesmanMobile": user.mobile,
"salesmanId":user.id, "salesmanId": user.id,
"salesmanChannelId":user.channel_userid "salesmanChannelId": user.channel_userid
}; };
ab.solutionContent["customerInfo"]= customerInfo; ab.solutionContent["customerInfo"] = customerInfo;
ab.solutionContent["salesmanInfo"]= salesmanInfo; ab.solutionContent["salesmanInfo"] = salesmanInfo;
ab.solutionContent = JSON.stringify(ab.solutionContent); ab.solutionContent = JSON.stringify(ab.solutionContent);
var self = this; var self = this;
return await this.needsolutionDao.db.transaction(async function (t) { return await this.needsolutionDao.db.transaction(async function (t) {
...@@ -273,18 +304,18 @@ class AliyunQcService{ ...@@ -273,18 +304,18 @@ class AliyunQcService{
} }
//交付商关闭交付单 //交付商关闭交付单
async closeOrderDelivery(pobj){ async closeOrderDelivery(pobj) {
var ab = pobj.actionBody; var ab = pobj.actionBody;
if (!ab.orderNo) { if (!ab.orderNo) {
return system.getResultFail(-101, "订单号不能为空"); return system.getResultFail(-101, "订单号不能为空");
} }
if (!ab.note) { if (!ab.note) {
return system.getResultFail(-106, "关闭理由不能为空"); return system.getResultFail(-106, "关闭理由不能为空");
}else{ } else {
ab.Note = ab.note; ab.Note = ab.note;
} }
var ns = await this.needsolutionDao.model.findOne({ var ns = await this.needsolutionDao.model.findOne({
where:{orderNo:ab.orderNo},raw:true where: { orderNo: ab.orderNo }, raw: true
}); });
if (!ns || !ns.id) { if (!ns || !ns.id) {
return system.getResultFail(-301, "未知方案"); return system.getResultFail(-301, "未知方案");
...@@ -308,7 +339,7 @@ class AliyunQcService{ ...@@ -308,7 +339,7 @@ class AliyunQcService{
} }
//获取方案信息 //获取方案信息
var ns = await this.needsolutionDao.model.findOne({ var ns = await this.needsolutionDao.model.findOne({
where: { channelSolutionNo: ab.BizId,isInvalid:0}, raw: true where: { channelSolutionNo: ab.BizId, isInvalid: 0 }, raw: true
}); });
if (!ns || !ns.id) { if (!ns || !ns.id) {
return system.getResultFail(-300, "未知方案"); return system.getResultFail(-300, "未知方案");
...@@ -337,21 +368,21 @@ class AliyunQcService{ ...@@ -337,21 +368,21 @@ class AliyunQcService{
solutionContent.status = "CLOSE"; solutionContent.status = "CLOSE";
solutionContent.statusName = this.icpSolutionStatusReference.CLOSE; solutionContent.statusName = this.icpSolutionStatusReference.CLOSE;
solutionContent = JSON.stringify(solutionContent); solutionContent = JSON.stringify(solutionContent);
await this.needsolutionDao.update({ id: ns.id, status: "yzf",isInvalid:1, solutionContent: solutionContent });//方案废弃 await this.needsolutionDao.update({ id: ns.id, status: "yzf", isInvalid: 1, solutionContent: solutionContent });//方案废弃
//获取方案信息 //获取方案信息
var new_ns = await this.needsolutionDao.model.findOne({ var new_ns = await this.needsolutionDao.model.findOne({
where: { id:ns.id}, raw: true where: { id: ns.id }, raw: true
}); });
return system.getResultSuccess(new_ns); return system.getResultSuccess(new_ns);
} }
//交付商提交材料信息 //交付商提交材料信息
async serviceProviderSubmitMaterial(pobj){ async serviceProviderSubmitMaterial(pobj) {
var ab = pobj.actionBody; var ab = pobj.actionBody;
if (!ab.orderNo) { if (!ab.orderNo) {
return system.getResultFail(-101, "订单号不能为空"); return system.getResultFail(-101, "订单号不能为空");
} }
var ns = await this.needsolutionDao.model.findOne({ var ns = await this.needsolutionDao.model.findOne({
where:{orderNo:ab.orderNo},raw:true where: { orderNo: ab.orderNo }, raw: true
}); });
if (!ns || !ns.id) { if (!ns || !ns.id) {
return system.getResultFail(-301, "未知方案"); return system.getResultFail(-301, "未知方案");
...@@ -376,8 +407,8 @@ class AliyunQcService{ ...@@ -376,8 +407,8 @@ class AliyunQcService{
} }
//获取方案信息 //获取方案信息
var needsolutioninfo = await this.needsolutionDao.model.findOne({ var needsolutioninfo = await this.needsolutionDao.model.findOne({
attributes:["id","needNo","solutionContent"], attributes: ["id", "needNo", "solutionContent"],
where: { channelSolutionNo: ab.BizId ,isInvalid:0}, raw: true where: { channelSolutionNo: ab.BizId, isInvalid: 0 }, raw: true
}); });
if (!needsolutioninfo || !needsolutioninfo.id) { if (!needsolutioninfo || !needsolutioninfo.id) {
return system.getResultFail(-400, "未知方案"); return system.getResultFail(-400, "未知方案");
...@@ -439,14 +470,14 @@ class AliyunQcService{ ...@@ -439,14 +470,14 @@ class AliyunQcService{
}) })
} }
//交付商通知状态变更 //交付商通知状态变更
async serviceProviderNotification(pobj){ async serviceProviderNotification(pobj) {
var ab = pobj.actionBody; var ab = pobj.actionBody;
if (!ab.orderNo) { if (!ab.orderNo) {
return system.getResultFail(-101, "订单号不能为空"); return system.getResultFail(-101, "订单号不能为空");
} }
if (!ab.status) { if (!ab.status) {
return system.getResultFail(-102, "交付状态不能为空"); return system.getResultFail(-102, "交付状态不能为空");
}else{ } else {
ab["ApplicationStatus"] = ab.status; ab["ApplicationStatus"] = ab.status;
} }
if (ab.officialFileURL) { if (ab.officialFileURL) {
...@@ -454,7 +485,7 @@ class AliyunQcService{ ...@@ -454,7 +485,7 @@ class AliyunQcService{
} }
var ns = await this.needsolutionDao.model.findOne({ var ns = await this.needsolutionDao.model.findOne({
where:{orderNo:ab.orderNo},raw:true where: { orderNo: ab.orderNo }, raw: true
}); });
if (!ns || !ns.id) { if (!ns || !ns.id) {
return system.getResultFail(-301, "未知方案"); return system.getResultFail(-301, "未知方案");
...@@ -483,7 +514,7 @@ class AliyunQcService{ ...@@ -483,7 +514,7 @@ class AliyunQcService{
} }
//获取方案信息 //获取方案信息
var needsolutioninfo = await this.needsolutionDao.model.findOne({ var needsolutioninfo = await this.needsolutionDao.model.findOne({
attributes:["id","status","solutionContent","needNo"], attributes: ["id", "status", "solutionContent", "needNo"],
where: { solutionNo: ab.solutionNo }, raw: true where: { solutionNo: ab.solutionNo }, raw: true
}); });
if (!needsolutioninfo || !needsolutioninfo.id) { if (!needsolutioninfo || !needsolutioninfo.id) {
...@@ -496,10 +527,10 @@ class AliyunQcService{ ...@@ -496,10 +527,10 @@ class AliyunQcService{
if (!solutionContent) { if (!solutionContent) {
return system.getResultFail(-402, "方案交付信息有误"); return system.getResultFail(-402, "方案交付信息有误");
} }
if (solutionContent.applicationStatus && solutionContent.applicationStatus>ab.ApplicationStatus) { if (solutionContent.applicationStatus && solutionContent.applicationStatus > ab.ApplicationStatus) {
return system.getResultFail(-403, "操作失败,交付流程未按顺序执行"); return system.getResultFail(-403, "操作失败,交付流程未按顺序执行");
} }
if (solutionContent.ApplicationStatus && solutionContent.ApplicationStatus==ab.ApplicationStatus) { if (solutionContent.ApplicationStatus && solutionContent.ApplicationStatus == ab.ApplicationStatus) {
return system.getResultFail(-405, "操作失败,该流程状态已提交,不能重复提交"); return system.getResultFail(-405, "操作失败,该流程状态已提交,不能重复提交");
} }
//获取需求信息 //获取需求信息
...@@ -515,7 +546,7 @@ class AliyunQcService{ ...@@ -515,7 +546,7 @@ class AliyunQcService{
} }
var solutionFlowList = solutionContent.solutionFlowList || []; var solutionFlowList = solutionContent.solutionFlowList || [];
if (ab.ApplicationStatus == 507) {//完成账户注册 if (ab.ApplicationStatus == 507) {//完成账户注册
if(solutionContent.status!="USER_CONFIRMED"){ if (solutionContent.status != "USER_CONFIRMED") {
return system.getResultFail(-508, "交付流程错误,用户确认递交⽂件后才能执行此操作"); return system.getResultFail(-508, "交付流程错误,用户确认递交⽂件后才能执行此操作");
} }
solutionContent.ApplicationStatus = 507; solutionContent.ApplicationStatus = 507;
...@@ -527,7 +558,7 @@ class AliyunQcService{ ...@@ -527,7 +558,7 @@ class AliyunQcService{
solutionContent.statusName = this.icpSolutionStatusReference.ACCOUNT_REGISTERED; solutionContent.statusName = this.icpSolutionStatusReference.ACCOUNT_REGISTERED;
} }
if (ab.ApplicationStatus == 508) {//"服务商完成提交资料到⼯信部 if (ab.ApplicationStatus == 508) {//"服务商完成提交资料到⼯信部
if(solutionContent.status!="ACCOUNT_REGISTERED"){ if (solutionContent.status != "ACCOUNT_REGISTERED") {
return system.getResultFail(-508, "交付流程错误,请先完成账户注册"); return system.getResultFail(-508, "交付流程错误,请先完成账户注册");
} }
solutionFlowList.push({ solutionFlowList.push({
...@@ -538,7 +569,7 @@ class AliyunQcService{ ...@@ -538,7 +569,7 @@ class AliyunQcService{
solutionContent.statusName = this.icpSolutionStatusReference.MATERIAL_SUBMITTED; solutionContent.statusName = this.icpSolutionStatusReference.MATERIAL_SUBMITTED;
} }
if (ab.ApplicationStatus == 509) {//⼯商部已受理 if (ab.ApplicationStatus == 509) {//⼯商部已受理
if(solutionContent.status!="MATERIAL_SUBMITTED"){ if (solutionContent.status != "MATERIAL_SUBMITTED") {
return system.getResultFail(-509, "交付流程错误,请先完成资料递交"); return system.getResultFail(-509, "交付流程错误,请先完成资料递交");
} }
solutionFlowList.push({ solutionFlowList.push({
...@@ -549,7 +580,7 @@ class AliyunQcService{ ...@@ -549,7 +580,7 @@ class AliyunQcService{
solutionContent.statusName = this.icpSolutionStatusReference.GXB_ACCEPT; solutionContent.statusName = this.icpSolutionStatusReference.GXB_ACCEPT;
} }
if (ab.ApplicationStatus == 510) {//⼯商部不予受理 if (ab.ApplicationStatus == 510) {//⼯商部不予受理
if(solutionContent.status!="MATERIAL_SUBMITTED"){ if (solutionContent.status != "MATERIAL_SUBMITTED") {
return system.getResultFail(-510, "交付流程错误,请先完成资料递交"); return system.getResultFail(-510, "交付流程错误,请先完成资料递交");
} }
solutionFlowList.push({ solutionFlowList.push({
...@@ -561,7 +592,7 @@ class AliyunQcService{ ...@@ -561,7 +592,7 @@ class AliyunQcService{
solutionContent.statusName = this.icpSolutionStatusReference.GXB_REFUSE; solutionContent.statusName = this.icpSolutionStatusReference.GXB_REFUSE;
} }
if (ab.ApplicationStatus == 511) {//⼯商部通过 if (ab.ApplicationStatus == 511) {//⼯商部通过
if(solutionContent.status!="GXB_ACCEPT"){ if (solutionContent.status != "GXB_ACCEPT") {
return system.getResultFail(-511, "交付流程错误,⼯信部已受理后才能执行此操作"); return system.getResultFail(-511, "交付流程错误,⼯信部已受理后才能执行此操作");
} }
solutionFlowList.push({ solutionFlowList.push({
...@@ -573,7 +604,7 @@ class AliyunQcService{ ...@@ -573,7 +604,7 @@ class AliyunQcService{
solutionContent.statusName = this.icpSolutionStatusReference.GXB_SUCCESS; solutionContent.statusName = this.icpSolutionStatusReference.GXB_SUCCESS;
} }
if (ab.ApplicationStatus == 512) {//⼯信部未通过 if (ab.ApplicationStatus == 512) {//⼯信部未通过
if(solutionContent.status!="GXB_ACCEPT"){ if (solutionContent.status != "GXB_ACCEPT") {
return system.getResultFail(-512, "交付流程错误,⼯信部已受理后才能执行此操作"); return system.getResultFail(-512, "交付流程错误,⼯信部已受理后才能执行此操作");
} }
solutionFlowList.push({ solutionFlowList.push({
...@@ -615,7 +646,7 @@ class AliyunQcService{ ...@@ -615,7 +646,7 @@ class AliyunQcService{
} }
//获取方案信息 //获取方案信息
var ns = await this.needsolutionDao.model.findOne({ var ns = await this.needsolutionDao.model.findOne({
where: { channelSolutionNo: ab.BizId ,isInvalid:0}, raw: true where: { channelSolutionNo: ab.BizId, isInvalid: 0 }, raw: true
}); });
if (!ns || !ns.id) { if (!ns || !ns.id) {
return system.getResultFail(-102, "未知方案"); return system.getResultFail(-102, "未知方案");
...@@ -633,11 +664,13 @@ class AliyunQcService{ ...@@ -633,11 +664,13 @@ class AliyunQcService{
// return system.getResultFail(-103, "该方案状态为" + ns.statusName + ",不能执行此操作"); // return system.getResultFail(-103, "该方案状态为" + ns.statusName + ",不能执行此操作");
// } // }
var solutionContent = ns.solutionContent; var solutionContent = ns.solutionContent;
var checkStatus = {ACCOUNT_REGISTERED: "完成账户注册", MATERIAL_SUBMITTED: "完成资料递交", var checkStatus = {
ACCOUNT_REGISTERED: "完成账户注册", MATERIAL_SUBMITTED: "完成资料递交",
GXB_ACCEPT: "⼯信部已受理", GXB_REFUSE: "⼯信部不予受理", GXB_FAIL: "⼯信部未通过", GXB_SUCCESS: "工信部通过" GXB_ACCEPT: "⼯信部已受理", GXB_REFUSE: "⼯信部不予受理", GXB_FAIL: "⼯信部未通过", GXB_SUCCESS: "工信部通过"
, CLOSE: "方案关闭"}; , CLOSE: "方案关闭"
if(solutionContent.status && checkStatus[solutionContent.status]){ };
return system.getResultFail(-111, "方案已进入"+solutionContent.statusName+"流程,不能执行此操作"); if (solutionContent.status && checkStatus[solutionContent.status]) {
return system.getResultFail(-111, "方案已进入" + solutionContent.statusName + "流程,不能执行此操作");
} }
//方案流程列表 //方案流程列表
var solutionFlowList = solutionContent.solutionFlowList || []; var solutionFlowList = solutionContent.solutionFlowList || [];
...@@ -652,8 +685,8 @@ class AliyunQcService{ ...@@ -652,8 +685,8 @@ class AliyunQcService{
id: needinfo.id, status: "ycd" id: needinfo.id, status: "ycd"
} }
await this.needinfoDao.update(needObj);//关闭需求 await this.needinfoDao.update(needObj);//关闭需求
}else if (ab.status == "2") {//⽤户已上传 } else if (ab.status == "2") {//⽤户已上传
if(solutionContent.status =="USER_CONFIRMED"){//防止用户确认后又否决 if (solutionContent.status == "USER_CONFIRMED") {//防止用户确认后又否决
return system.getResultFail(-112, "操作失败,⽤户已确认递交⽂件"); return system.getResultFail(-112, "操作失败,⽤户已确认递交⽂件");
} }
solutionFlowList.push({ solutionFlowList.push({
...@@ -661,8 +694,8 @@ class AliyunQcService{ ...@@ -661,8 +694,8 @@ class AliyunQcService{
}); });
solutionContent.status = "USER_UPLOADED"; solutionContent.status = "USER_UPLOADED";
solutionContent.statusName = this.icpSolutionStatusReference.USER_UPLOADED; solutionContent.statusName = this.icpSolutionStatusReference.USER_UPLOADED;
}else if (ab.status == "4") {//⽤户已确认 } else if (ab.status == "4") {//⽤户已确认
if(solutionContent.status !="MATERIAL_UNCONFIRM"){ if (solutionContent.status != "MATERIAL_UNCONFIRM") {
return system.getResultFail(-113, "操作失败,服务商递交⽂件后才能执行此操作"); return system.getResultFail(-113, "操作失败,服务商递交⽂件后才能执行此操作");
} }
solutionFlowList.push({ solutionFlowList.push({
...@@ -670,13 +703,13 @@ class AliyunQcService{ ...@@ -670,13 +703,13 @@ class AliyunQcService{
}); });
solutionContent.status = "USER_CONFIRMED"; solutionContent.status = "USER_CONFIRMED";
solutionContent.statusName = this.icpSolutionStatusReference.USER_CONFIRMED; solutionContent.statusName = this.icpSolutionStatusReference.USER_CONFIRMED;
}else if (ab.status == "11") {//⽅案已关闭 } else if (ab.status == "11") {//⽅案已关闭
solutionFlowList.push({ solutionFlowList.push({
status: "CLOSE", statusName: this.icpSolutionStatusReference.CLOSE, updated_at: new Date() status: "CLOSE", statusName: this.icpSolutionStatusReference.CLOSE, updated_at: new Date()
}); });
solutionContent.status = "CLOSE"; solutionContent.status = "CLOSE";
solutionContent.statusName = this.icpSolutionStatusReference.CLOSE; solutionContent.statusName = this.icpSolutionStatusReference.CLOSE;
}else{ } else {
return system.getResultFail(-110, "状态错误"); return system.getResultFail(-110, "状态错误");
} }
solutionContent.solutionFlowList = solutionFlowList; solutionContent.solutionFlowList = solutionFlowList;
...@@ -716,7 +749,7 @@ class AliyunQcService{ ...@@ -716,7 +749,7 @@ class AliyunQcService{
}; };
if (ab.status == "11") {//⽅案已关闭 if (ab.status == "11") {//⽅案已关闭
updateObj["status"] = "yzf"; updateObj["status"] = "yzf";
updateObj["isInvalid"]=1; updateObj["isInvalid"] = 1;
} }
await this.needsolutionDao.update(updateObj);//方案状态修改 await this.needsolutionDao.update(updateObj);//方案状态修改
var new_ns = await this.needsolutionDao.model.findOne({ var new_ns = await this.needsolutionDao.model.findOne({
...@@ -749,7 +782,7 @@ class AliyunQcService{ ...@@ -749,7 +782,7 @@ class AliyunQcService{
} }
//获取方案信息 //获取方案信息
var ns = await this.needsolutionDao.model.findOne({ var ns = await this.needsolutionDao.model.findOne({
where: { channelNeedNo: ab.intentionBizId, isInvalid:0 }, raw: true where: { channelNeedNo: ab.intentionBizId, isInvalid: 0 }, raw: true
}); });
if (!ns) { if (!ns) {
return system.getResultFail(-106, "未知方案"); return system.getResultFail(-106, "未知方案");
...@@ -761,18 +794,18 @@ class AliyunQcService{ ...@@ -761,18 +794,18 @@ class AliyunQcService{
var solutionContent = ns.solutionContent; var solutionContent = ns.solutionContent;
solutionContent.customerRemark = ab.description; solutionContent.customerRemark = ab.description;
solutionContent.needStatus = ab.intentionStatus; solutionContent.needStatus = ab.intentionStatus;
if(ab.intentionStatus == 1){ if (ab.intentionStatus == 1) {
updateObj["status"] = "ybh"; updateObj["status"] = "ybh";
updateObj["isInvalid"]=1; updateObj["isInvalid"] = 1;
}else if (ab.intentionStatus == 2) { } else if (ab.intentionStatus == 2) {
updateObj["status"] = "dqr"; updateObj["status"] = "dqr";
}else if (ab.intentionStatus == 3) { } else if (ab.intentionStatus == 3) {
updateObj["status"] = "dqr"; updateObj["status"] = "dqr";
} else if (ab.intentionStatus == 4) { } else if (ab.intentionStatus == 4) {
updateObj["status"] = "dqr"; updateObj["status"] = "dqr";
} else if (ab.intentionStatus == 5) { } else if (ab.intentionStatus == 5) {
updateObj["status"] = "yzf"; updateObj["status"] = "yzf";
updateObj["isInvalid"]=1; updateObj["isInvalid"] = 1;
} else { } else {
return system.getResultFail(-107, "需求当前状态错误--" + ab.intentionStatus); return system.getResultFail(-107, "需求当前状态错误--" + ab.intentionStatus);
} }
...@@ -792,7 +825,7 @@ class AliyunQcService{ ...@@ -792,7 +825,7 @@ class AliyunQcService{
return system.getResultFail(-102, "方案业务编号不能为空"); return system.getResultFail(-102, "方案业务编号不能为空");
} }
var ns = await this.needsolutionDao.model.findOne({ var ns = await this.needsolutionDao.model.findOne({
where: { solutionNo: ab.solutionNo,isInvalid:0 }, raw: true where: { solutionNo: ab.solutionNo, isInvalid: 0 }, raw: true
}); });
if (!ns || !ns.id) { if (!ns || !ns.id) {
return system.getResultFail(-103, "未知方案"); return system.getResultFail(-103, "未知方案");
...@@ -810,8 +843,8 @@ class AliyunQcService{ ...@@ -810,8 +843,8 @@ class AliyunQcService{
return system.getResultSuccess(); return system.getResultSuccess();
} }
//接收确认方案后阿里返回链接 //接收确认方案后阿里返回链接
async receiveIcpConfirmUrl(pobj) { async receiveIcpConfirmUrl(pobj) {
var ab = pobj.actionBody; var ab = pobj.actionBody;
if (!ab.confirmUrl) { if (!ab.confirmUrl) {
return system.getResultFail(-101, "confirmUrl不能为空"); return system.getResultFail(-101, "confirmUrl不能为空");
...@@ -820,7 +853,7 @@ class AliyunQcService{ ...@@ -820,7 +853,7 @@ class AliyunQcService{
return system.getResultFail(-102, "方案业务编号不能为空"); return system.getResultFail(-102, "方案业务编号不能为空");
} }
var ns = await this.needsolutionDao.model.findOne({ var ns = await this.needsolutionDao.model.findOne({
where: { solutionNo: ab.solutionNo,isInvalid:0 }, raw: true where: { solutionNo: ab.solutionNo, isInvalid: 0 }, raw: true
}); });
if (!ns || !ns.id) { if (!ns || !ns.id) {
return system.getResultFail(-103, "未知方案"); return system.getResultFail(-103, "未知方案");
...@@ -834,7 +867,7 @@ class AliyunQcService{ ...@@ -834,7 +867,7 @@ class AliyunQcService{
if (needinfo.status == "ycd" || needinfo.status == "ygb") { if (needinfo.status == "ycd" || needinfo.status == "ygb") {
return system.getResultFail(-105, "该方案需求状态为" + needinfo.statusName + ",不能执行此操作"); return system.getResultFail(-105, "该方案需求状态为" + needinfo.statusName + ",不能执行此操作");
} }
ns.solutionContent.confirmUrl =ab.confirmUrl; ns.solutionContent.confirmUrl = ab.confirmUrl;
var solutionContent = JSON.stringify(ns.solutionContent); var solutionContent = JSON.stringify(ns.solutionContent);
await this.needsolutionDao.model.update({ solutionContent: solutionContent }, { where: { id: ns.id } });//修改方案信息 await this.needsolutionDao.model.update({ solutionContent: solutionContent }, { where: { id: ns.id } });//修改方案信息
return system.getResultSuccess(); return system.getResultSuccess();
...@@ -844,7 +877,7 @@ class AliyunQcService{ ...@@ -844,7 +877,7 @@ class AliyunQcService{
返回20位业务订单号 返回20位业务订单号
prefix:业务前缀 prefix:业务前缀
*/ */
async getBusUid(prefix) { async getBusUid(prefix) {
prefix = (prefix || ""); prefix = (prefix || "");
if (prefix) { if (prefix) {
prefix = prefix.toUpperCase(); prefix = prefix.toUpperCase();
...@@ -862,7 +895,7 @@ class AliyunQcService{ ...@@ -862,7 +895,7 @@ class AliyunQcService{
len:返回长度 len:返回长度
radix:参与计算的长度,最大为62 radix:参与计算的长度,最大为62
*/ */
async getUidInfo(len, radix) { async getUidInfo(len, radix) {
var chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'.split('');//长度62,到yz长度为长36 var chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'.split('');//长度62,到yz长度为长36
var uuid = [], i; var uuid = [], i;
radix = radix || chars.length; radix = radix || chars.length;
...@@ -975,5 +1008,288 @@ class AliyunQcService{ ...@@ -975,5 +1008,288 @@ class AliyunQcService{
}); });
return system.getResultSuccess(new_ns); return system.getResultSuccess(new_ns);
} }
/**
* 服务商提交服务操作
* 服务商通知状态变更
* (交付系统调用)
* (文网文)2020-9-26
*/
async serviceSubmitOption(pobj) {
console.log('wwwwwwwwww', pobj)
var ab = pobj.actionBody;
var user = pobj.userInfo;
if (!user || !user.id) {
return system.getResultFail(-100, "未知用户");
}
if (!ab.solutionNo) {
return system.getResultFail(-101, "方案编号不能为空");
}
if (!ab.ApplicationStatus) {
return system.getResultFail(-102, "通知状态不能为空");
}
if (!ab.channelTpye) {
return system.getResultFail(-102, "渠道来源不能为空");
}
//获取方案信息
var needsolutioninfo = await this.needsolutionDao.model.findOne({
attributes: ["id", "status", "solutionContent", "needNo"],
where: { solutionNo: ab.solutionNo }, raw: true
});
if (!needsolutioninfo || !needsolutioninfo.id) {
return system.getResultFail(-400, "未知方案");
}
if (!needsolutioninfo.needNo) {
return system.getResultFail(-401, "方案需求信息有误");
}
var solutionContent = needsolutioninfo.solutionContent;
if (!solutionContent) {
return system.getResultFail(-402, "方案交付信息有误");
}
if (solutionContent.applicationStatus && solutionContent.applicationStatus > ab.ApplicationStatus) {
return system.getResultFail(-403, "操作失败,交付流程未按顺序执行");
}
if (solutionContent.ApplicationStatus && solutionContent.ApplicationStatus == ab.ApplicationStatus) {
return system.getResultFail(-405, "操作失败,该流程状态已提交,不能重复提交");
}
//获取需求信息
var needinfo = await this.needinfoDao.model.findOne({
where: { needNo: needsolutioninfo.needNo }, raw: true
});
if (!needinfo || !needinfo.id) {
return system.getResultFail(-201, "未知需求信息");
}
// if (needinfo.status == "ycd" || needinfo.status == "ygb") {
if (needinfo.status == "ygb") {
return system.getResultFail(-202, "serviceProviderSubmitMateria" + needinfo.statusName + ",不能执行此操作");
}
var solutionFlowList = solutionContent.solutionFlowList || [];
if (ab.ApplicationStatus == 601) {//完成账户注册
if (solutionContent.status != "USER_CONFIRM_PRODUCE") {
return system.getResultFail(-601, "交付流程错误,用户确认递交⽂件后才能执行此操作");
}
solutionContent.ApplicationStatus = 601;
solutionFlowList.push({
status: "CERT_ACCOUNT_REGISTERED", statusName: this.wangwenSolutionStatusReference.CERT_ACCOUNT_REGISTERED, updated_at: new Date()
});
solutionContent.status = "CERT_ACCOUNT_REGISTERED";
solutionContent.statusName = this.wangwenSolutionStatusReference.CERT_ACCOUNT_REGISTERED;
}
if (ab.ApplicationStatus == 602) {//服务商提交资料
if (solutionContent.status != "CERT_ACCOUNT_REGISTERED") {
return system.getResultFail(-602, "交付流程错误,请先完成账户注册");
}
solutionFlowList.push({
status: "PARTNER_SUBMIT_MATERIAL", statusName: this.wangwenSolutionStatusReference.PARTNER_SUBMIT_MATERIAL, updated_at: new Date()
});
solutionContent.status = "PARTNER_SUBMIT_MATERIAL";
solutionContent.statusName = this.wangwenSolutionStatusReference.PARTNER_SUBMIT_MATERIAL;
}
if (ab.ApplicationStatus == 603) {//服务商完成提交资料到⼯信部
if (solutionContent.status != "PARTNER_SUBMIT_MATERIAL") {
return system.getResultFail(-603, "交付流程错误,请先完成资料递交");
}
solutionFlowList.push({
status: "CERT_MATERIAL_SUBMITTED", statusName: this.wangwenSolutionStatusReference.CERT_MATERIAL_SUBMITTED, updated_at: new Date()
});
solutionContent.status = "CERT_MATERIAL_SUBMITTED";
solutionContent.statusName = this.wangwenSolutionStatusReference.CERT_MATERIAL_SUBMITTED;
}
if (ab.ApplicationStatus == 604) {//⼯商部已受理
if (solutionContent.status != "PARTNER_SUBMIT_MATERIAL") {
return system.getResultFail(-604, "交付流程错误,请先完成资料递交");
}
solutionFlowList.push({
status: "CERT_GXB_ACCEPT", statusName: this.wangwenSolutionStatusReference.CERT_GXB_ACCEPT, updated_at: new Date()
});
solutionContent.status = "CERT_GXB_ACCEPT";
solutionContent.statusName = this.wangwenSolutionStatusReference.CERT_GXB_ACCEPT;
}
if (ab.ApplicationStatus == 605) {//⼯商部不予受理
if (solutionContent.status != "PARTNER_SUBMIT_MATERIAL") {
return system.getResultFail(-605, "交付流程错误,请先完成资料递交");
}
solutionFlowList.push({
status: "CERT_GXB_REFUSE", statusName: this.wangwenSolutionStatusReference.CERT_GXB_REFUSE, updated_at: new Date()
});
solutionContent.status = "CERT_GXB_REFUSE";
needsolutioninfo.status = "ywc";
solutionContent.statusName = this.wangwenSolutionStatusReference.CERT_GXB_REFUSE;
}
if (ab.ApplicationStatus == 606) {//⼯商部通过
if (solutionContent.status != "CERT_GXB_ACCEPT") {
return system.getResultFail(-606, "交付流程错误,⼯信部已受理后才能执行此操作");
}
solutionFlowList.push({
status: "CERT_GXB_SUCCESS", statusName: this.wangwenSolutionStatusReference.CERT_GXB_SUCCESS, updated_at: new Date()
});
needsolutioninfo.status = "ywc";
solutionContent.status = "CERT_GXB_SUCCESS";
solutionContent.statusName = this.wangwenSolutionStatusReference.CERT_GXB_SUCCESS;
}
if (ab.ApplicationStatus == 607) {//⼯信部未通过
if (solutionContent.status != "CERT_GXB_ACCEPT") {
return system.getResultFail(-607, "交付流程错误,⼯信部已受理后才能执行此操作");
}
solutionFlowList.push({
status: "CERT_GXB_FAIL", statusName: this.wangwenSolutionStatusReference.CERT_GXB_FAIL, updated_at: new Date()
});
solutionContent.status = "CERT_GXB_FAIL";
needsolutioninfo.status = "ywc";
solutionContent.statusName = this.wangwenSolutionStatusReference.CERT_GXB_FAIL;
}
solutionContent.solutionFlowList = solutionFlowList;
var applicationStatusList = solutionContent.applicationStatusList || [];
var statusObj = {
"ApplicationStatus": ab.ApplicationStatus,
"ApplicationStatusName": this.wangwenSolutionStatusReference[ab.ApplicationStatus],
"created_at": new Date()
};
applicationStatusList.push(statusObj);
solutionContent.applicationStatusList = applicationStatusList;
solutionContent.applicationStatus = ab.ApplicationStatus;
needsolutioninfo.solutionContent = JSON.stringify(solutionContent);
var self = this;
return await this.needsolutionDao.db.transaction(async function (t) {
await self.needsolutionDao.update(needsolutioninfo, t);
statusObj["BizId"] = ab.BizId;
return system.getResultSuccess(statusObj);
})
}
//提交方案(文网文) 2020-9-27
async submitWangwenSolution(pobj) {
var ab = pobj.actionBody;
var user = pobj.userInfo;
if (!user || !user.id) {
return system.getResultFail(-100, "未知用户");
}
ab["createUserId"] = user.id;
if (!ab.needNo) {
return system.getResultFail(-101, "渠道需求号不能为空");
}
if (!ab.solutionContent) {
return system.getResultFail(-102, "方案信息有误");
}
//获取需求信息
var needinfo = await this.needinfoDao.model.findOne({
where: { channelNeedNo: ab.needNo }, raw: true
});
if (!needinfo || !needinfo.id) {
return system.getResultFail(-201, "未知需求信息");
}
if (needinfo.status == "ycd" || needinfo.status == "ygb") {
return system.getResultFail(-202, "该方案需求状态为" + needinfo.statusName + ",不能创建方案");
}
var bizType = needinfo.typeCode;//ab.solutionContent.bizType;//业务类型
ab.solutionContent.bizType = bizType;
if (!bizType) {
return system.getResultFail(-205, "方案类型错误");
}
// if (!bizType || !needinfo.typeCode || bizType != needinfo.typeCode) {
// return system.getResultFail(-205, "方案类型错误");
// }
if (!needinfo.channelTypeCode) {
return system.getResultFail(-206, "渠道方案类型错误");
}
ab.solutionContent.typeCode = needinfo.typeCode;
ab.solutionContent.typeName = needinfo.typeName;
var ns = await this.needsolutionDao.model.findAll({
where: { channelNeedNo: ab.needNo }, raw: true, order: [["id", 'asc']]
});
for (var i = 0; i < ns.length; i++) {
var fa = ns[i];
if (fa.status == "dqr" || fa.status == "ywc") {
return system.getResultFail(-207, "需求方案已存在,不能重复提交");
}
if (fa.status == "ybh") {
ab.channelSolutionNo = fa.channelSolutionNo;
}
if (fa.status == "yzf") {
ab.channelSolutionNo = "";
}
}
var solution = ab.solutionContent.solution;
if (!solution) {
return system.getResultFail(-103, "方案交付信息有误");
}
if (needinfo.channelTypeCode == "官网") {//esp.wangwen
ab.solutionContent.solution.IcpType = "wangwen";
} else {
return system.getResultFail(-208, "需求业务类型有误");
}
if (!solution.CompanyName) {
return system.getResultFail(-105, "企业名称不能为空");
}
if (!solution.licenseType) {
return system.getResultFail(-106, "网文类型不能为空");
}
if (!solution.actionType) {
return system.getResultFail(-106, "办理类型不能为空");
}
if (!solution.companyLocation) {
return system.getResultFail(-107, "区域不能为空");
}
var solutionFlowList = ab.solutionContent.solutionFlowList || [];
solutionFlowList.push({
status: "SOLUTION_SUBMIT", statusName: this.wangwenSolutionStatusReference.SOLUTION_SUBMIT, updated_at: new Date()
});
ab.solutionContent.status = "SOLUTION_SUBMIT";
ab.solutionContent.statusName = this.wangwenSolutionStatusReference.SOLUTION_SUBMIT;
ab.solutionContent.solutionFlowList = solutionFlowList;
ab["channelNeedNo"] = needinfo.channelNeedNo;
var solutionNo = await this.getBusUid("ns");
ab["solutionNo"] = solutionNo;
ab["status"] = "dqr";
var customerInfo = {//客户信息
"publishName": needinfo.publishName,
"publishMobile": needinfo.publishMobile
};
var salesmanInfo = {//业务员信息
"salesmanName": user.channel_username,
"salesmanMobile": user.mobile,
"salesmanId": user.id,
"salesmanChannelId": user.channel_userid
};
ab.solutionContent["customerInfo"] = customerInfo;
ab.solutionContent["salesmanInfo"] = salesmanInfo;
ab.solutionContent = JSON.stringify(ab.solutionContent);
var self = this;
return await this.needsolutionDao.db.transaction(async function (t) {
ab["needNo"] = needinfo.needNo;
var od = await self.needsolutionDao.create(ab, t);
if (od && od.id) {
var needObj = {
id: needinfo.id
};
if (!needinfo.followManUserId) {
needObj = {
id: needinfo.id,
followManUserId: user.id,//跟进人id
followManName: user.channel_username,//跟进人姓名
followManMobile: user.mobile,//跟进人手机号(合伙人)
followManOnlyCode: user.channel_userid
};
}
if (!needinfo.followContent) {
var followContent = [{
followDate: new Date(),
content: "wangwen提交方案"
}];
followContent = JSON.stringify(followContent);
needObj["followContent"] = followContent;
}
await self.needinfoDao.update(needObj, t);
needinfo = await self.needinfoDao.model.findOne({
where: { id: needinfo.id }, raw: true
});
return system.getResultSuccess({ needinfo: needinfo, needsolution: od });
} else {
return system.getResultFail(-302, "提交方案失败");
}
})
}
} }
module.exports = AliyunQcService; module.exports = AliyunQcService;
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