Commit cb2750ac by 兰国旗

状态逻辑整理

parent ff75d910
...@@ -1117,6 +1117,7 @@ class RegCenterOrderService { ...@@ -1117,6 +1117,7 @@ class RegCenterOrderService {
let solutionFlowList = []; let solutionFlowList = [];
var deliveryFlowList = []; var deliveryFlowList = [];
let deliveryContent = {}; let deliveryContent = {};
var applicationStatusList
var orderInfo = await this.orderinfoDao.model.findOne({ var orderInfo = await this.orderinfoDao.model.findOne({
attributes: ["uapp_id", "channelOrderNo"], attributes: ["uapp_id", "channelOrderNo"],
...@@ -1127,96 +1128,19 @@ class RegCenterOrderService { ...@@ -1127,96 +1128,19 @@ class RegCenterOrderService {
var uappId = orderInfo.uapp_id; var uappId = orderInfo.uapp_id;
var channelOrderNo = orderInfo.channelOrderNo var channelOrderNo = orderInfo.channelOrderNo
} }
// if (orderdeliveryInfo[0] && orderdeliveryInfo[0].deliveryContent) {//如果存在交付信息的话就去进行逻辑判断
// deliveryContent = orderdeliveryInfo[0].deliveryContent;
// } else {
// if (ab.consultType == "QYJYTC1") {
// bizTypeName = "企业经营套餐一"
// }
// if (ab.consultType == "QYJYTC2") {
// bizTypeName = "企业经营套餐二"
// }
// switch (productType) {
// case "GSZZ":
// deliveryContent['GSZZ'] = {
// bizType: ab.consultType,
// bizTypeName: bizTypeName,
// productType: productType,
// productTypeName: "工商执照",
// status: ab.ApplicationStatus,
// statusName: this.regDeliveryStatusName[ab.ApplicationStatus],
// channelStatus: this.regDeliveryStatus[ab.ApplicationStatus],
// customerInfo: needsolutioninfo.solutionContent.customerInfo,
// update_at: new Date().Format("yyyy-MM-dd hh:mm:ss"),
// officialFile: ab.officialFile || "",
// deliveryFlowList: []
// }
// break;
// case "YHKH":
// deliveryContent['YHKH'] = {
// bizType: ab.consultType,
// bizTypeName: bizTypeName,
// productType: productType,
// productTypeName: "银行开户",
// status: ab.ApplicationStatus,
// statusName: this.regDeliveryStatusName[ab.ApplicationStatus],
// channelStatus: this.regDeliveryStatus[ab.ApplicationStatus],
// update_at: new Date().Format("yyyy-MM-dd hh:mm:ss"),
// officialFile: ab.officialFile || "",
// deliveryFlowList: []
// }
// break;
// case "SWBD":
// deliveryContent['SWBD'] = {
// bizType: ab.consultType,
// bizTypeName: bizTypeName,
// productType: productType,
// productTypeName: "税务报道",
// status: ab.ApplicationStatus,
// statusName: this.regDeliveryStatusName[ab.ApplicationStatus],
// channelStatus: this.regDeliveryStatus[ab.ApplicationStatus],
// update_at: new Date().Format("yyyy-MM-dd hh:mm:ss"),
// officialFile: ab.officialFile || "",
// deliveryFlowList: []
// }
// break;
// case "DLJZ": //判断是否有交付信息
// deliveryContent['DLJZ'] = { if (orderdeliveryInfo[0] && orderdeliveryInfo[0].deliveryContent) {
// bizType: ab.consultType, deliveryContent = orderdeliveryInfo[0].deliveryContent;
// bizTypeName: bizTypeName, //判断大类是否是套餐
// productType: productType, if (ab.consultType && ab.consultType == "GSREG") {//非套餐
// productTypeName: "代理记账", if (deliveryContent && deliveryContent.status && deliveryContent.ApplicationStatus && deliveryContent.solutionFlowList) {
// status: ab.ApplicationStatus, // if (this.regStatus[deliveryContent.status] && this.regStatus[deliveryContent.status] > ab.ApplicationStatus) {
// statusName: this.regDeliveryStatusName[ab.ApplicationStatus], // return system.getResultFail(-403, "操作失败,交付流程未按顺序执行");
// channelStatus: this.regDeliveryStatus[ab.ApplicationStatus],
// update_at: new Date().Format("yyyy-MM-dd hh:mm:ss"),
// officialFile: ab.officialFile || "",
// deliveryFlowList: []
// }
// break;
// case "DZFW":
// deliveryContent['DZFW'] = {
// bizType: ab.consultType,
// bizTypeName: bizTypeName,
// productType: productType,
// productTypeName: "地址服务",
// status: ab.ApplicationStatus,
// statusName: this.regDeliveryStatusName[ab.ApplicationStatus],
// channelStatus: this.regDeliveryStatus[ab.ApplicationStatus],
// update_at: new Date().Format("yyyy-MM-dd hh:mm:ss"),
// officialFile: ab.officialFile || "",
// deliveryFlowList: []
// }
// break;
// }
// } // }
//2021-5-18 新增百度公司注册与公司注册套餐区分 start if (this.regStatus[deliveryContent.ApplicationStatus] && this.regStatus[deliveryContent.ApplicationStatus] == ab.ApplicationStatus && ab.ApplicationStatus == 705) {
if (ab.consultType && ab.consultType == "GSREG") {//公司注册 return system.getResultFail(-405, "操作失败,该方案已完成,不能更改");
}
if (ab.ApplicationStatus == 702) {//材料收集环节 if (ab.ApplicationStatus == 702) {//材料收集环节
if (needsolutioninfo.solutionContent.status != "PAID") { if (needsolutioninfo.solutionContent.status != "PAID") {
return system.getResultFail(-702, "交付流程错误,请先完成支付"); return system.getResultFail(-702, "交付流程错误,请先完成支付");
...@@ -1284,6 +1208,9 @@ class RegCenterOrderService { ...@@ -1284,6 +1208,9 @@ class RegCenterOrderService {
needsolutioninfo.status = "ywc"; needsolutioninfo.status = "ywc";
deliveryContent.statusName = this.regSolutionStatus.SUCCESS; deliveryContent.statusName = this.regSolutionStatus.SUCCESS;
} }
solutionFlowList = deliveryContent.solutionFlowList || [];
applicationStatusList = deliveryContent.applicationStatusList || [];
}
} }
if (ab.consultType && ab.consultType == "QYJYTC1" || ab.consultType && ab.consultType == "QYJYTC2") {//公司注册套餐1和公司注册套餐2 if (ab.consultType && ab.consultType == "QYJYTC1" || ab.consultType && ab.consultType == "QYJYTC2") {//公司注册套餐1和公司注册套餐2
if (ab.productType && ab.productType == "GSZZ") {//工商执照 if (ab.productType && ab.productType == "GSZZ") {//工商执照
...@@ -1296,7 +1223,7 @@ class RegCenterOrderService { ...@@ -1296,7 +1223,7 @@ class RegCenterOrderService {
var afterStatusList = [//用户支付后的流程状态 var afterStatusList = [//用户支付后的流程状态
"COLLECTING", "AUDITING", "ENGRAVING", "SUCCESS" "COLLECTING", "AUDITING", "ENGRAVING", "SUCCESS"
]; ];
if (!deliveryContent[ab.productType].channelStatus || afterStatusList.indexOf(deliveryContent[ab.productType].channelStatus) < 0) { if (!deliveryContent[ab.productType] || afterStatusList.indexOf(deliveryContent[ab.productType].channelStatus) < 0) {
return system.getResultFail(-703, "交付流程错误,请先完成材料收集"); return system.getResultFail(-703, "交付流程错误,请先完成材料收集");
} }
if (deliveryContent[ab.productType] && deliveryContent[ab.productType].channelStatus && deliveryContent[ab.productType].channelStatus == "SUCCESS") { if (deliveryContent[ab.productType] && deliveryContent[ab.productType].channelStatus && deliveryContent[ab.productType].channelStatus == "SUCCESS") {
...@@ -1379,46 +1306,13 @@ class RegCenterOrderService { ...@@ -1379,46 +1306,13 @@ class RegCenterOrderService {
} }
} }
} }
} //如果存在交付信息的话就去进行逻辑判断
//2021-5-18 新增百度公司注册与公司注册套餐区分 end
if (ab.consultType && ab.consultType == "GSREG") {
if (orderdeliveryInfo[0] && orderdeliveryInfo[0].deliveryContent) {//如果存在交付信息的话就去进行逻辑判断
deliveryContent = orderdeliveryInfo[0].deliveryContent;
if (deliveryContent && deliveryContent.status && deliveryContent.ApplicationStatus && deliveryContent.solutionFlowList) {
// if (this.regStatus[deliveryContent.status] && this.regStatus[deliveryContent.status] > ab.ApplicationStatus) {
// return system.getResultFail(-403, "操作失败,交付流程未按顺序执行");
// }
if (this.regStatus[deliveryContent.ApplicationStatus] && this.regStatus[deliveryContent.ApplicationStatus] == ab.ApplicationStatus && ab.ApplicationStatus == 705) {
return system.getResultFail(-405, "操作失败,该方案已完成,不能更改");
}
solutionFlowList = deliveryContent.solutionFlowList || [];
}
}
// else {//如果交付信息不存在的话就去进行赋值
// deliveryContent = needsolutioninfo.solutionContent;
// solutionFlowList = needsolutioninfo.solutionContent.solutionFlowList
// }
deliveryContent.solutionFlowList = solutionFlowList;
let applicationStatusList = deliveryContent.applicationStatusList || [];
let statusObj = {
"OfficialFileURL": ab.OfficialFileURL || "",
"ApplicationStatus": ab.ApplicationStatus,
"ApplicationStatusName": this.regSolutionStatus[ab.ApplicationStatus],
"created_at": new Date().Format("yyyy-MM-dd hh:mm:ss")
};
applicationStatusList.push(statusObj);
deliveryContent.applicationStatusList = applicationStatusList;
deliveryContent["applicationStatus"] = ab.applicationStatus;
} else {
if (deliveryContent && deliveryContent[ab.productType] && deliveryContent[ab.productType].status && deliveryContent[ab.productType].deliveryFlowList) { if (deliveryContent && deliveryContent[ab.productType] && deliveryContent[ab.productType].status && deliveryContent[ab.productType].deliveryFlowList) {
if (this.regStatus[deliveryContent.ApplicationStatus] && this.regStatus[deliveryContent.ApplicationStatus] == ab.ApplicationStatus && ab.ApplicationStatus == 705) { if (this.regStatus[deliveryContent.ApplicationStatus] && this.regStatus[deliveryContent.ApplicationStatus] == ab.ApplicationStatus && ab.ApplicationStatus == 705) {
return system.getResultFail(-406, "操作失败,该交付已完成,不能更改"); return system.getResultFail(-406, "操作失败,该交付已完成,不能更改");
} }
deliveryFlowList = deliveryContent[ab.productType].solutionFlowList || []; deliveryFlowList = deliveryContent[ab.productType].solutionFlowList || [];
} } else {//如果交付信息不存在的话就去进行赋值
else {//如果交付信息不存在的话就去进行赋值
let startTime let startTime
let endTime let endTime
if (ab.startTime) { if (ab.startTime) {
...@@ -1525,6 +1419,167 @@ class RegCenterOrderService { ...@@ -1525,6 +1419,167 @@ class RegCenterOrderService {
deliveryContent[ab.productType].statusName = this.regDeliveryStatusName[ab.ApplicationStatus] deliveryContent[ab.productType].statusName = this.regDeliveryStatusName[ab.ApplicationStatus]
deliveryContent[ab.productType].channelStatus = this.regDeliveryStatus[ab.ApplicationStatus] deliveryContent[ab.productType].channelStatus = this.regDeliveryStatus[ab.ApplicationStatus]
} }
} else {//如果交付信息不存在
if (ab.consultType && ab.consultType == "GSREG") {//非套餐
solutionFlowList = needsolutioninfo.solutionContent.solutionFlowList
deliveryContent.solutionFlowList = solutionFlowList;
deliveryContent = needsolutioninfo.solutionContent;
deliveryContent['ApplicationStatus'] = ab.ApplicationStatus
applicationStatusList = deliveryContent.applicationStatusList || [];
if (ab.ApplicationStatus == 702) {//材料收集环节
if (needsolutioninfo.solutionContent.status != "PAID") {
return system.getResultFail(-702, "交付流程错误,请先完成支付");
}
deliveryContent['ApplicationStatus'] = 702;
solutionFlowList.push({
file: ab.OfficialFileURL || "",
status: "COLLECTING", statusName: this.regSolutionStatus.COLLECTING, updated_at: new Date()
});
deliveryContent.status = "COLLECTING";
deliveryContent.statusName = this.regSolutionStatus.COLLECTING;
}
if (ab.ApplicationStatus == 703) {//工商审核环节
var afterStatusList = [//用户支付后的流程状态
"COLLECTING", "AUDITING", "ENGRAVING", "SUCCESS"
];
if (!deliveryContent.status || afterStatusList.indexOf(deliveryContent.status) < 0) {
return system.getResultFail(-703, "交付流程错误,请先完成材料收集");
}
if (deliveryContent.status == "SUCCESS") {
return system.getResultFail(-706, "该方案已完成,不可更改");
}
deliveryContent['ApplicationStatus'] = 703;
solutionFlowList.push({
file: ab.OfficialFileURL || "",
status: "AUDITING", statusName: this.regSolutionStatus.AUDITING, updated_at: new Date()
});
deliveryContent.status = "AUDITING";
deliveryContent.statusName = this.regSolutionStatus.AUDITING;
console.log('deliveryContent-----sss---', deliveryContent)
console.log('deliveryContent-----ss+++', typeof (deliveryContent))
deliveryContent['deliveryContent'] = deliveryContents
}
if (ab.ApplicationStatus == 704) {//刻章环节
var afterStatusList = [//用户支付后的流程状态
"COLLECTING", "AUDITING", "ENGRAVING", "SUCCESS"
];
if (!deliveryContent.status || afterStatusList.indexOf(deliveryContent.status) < 0) {
return system.getResultFail(-704, "交付流程错误,请先工商审核");
}
if (deliveryContent.status == "SUCCESS") {
return system.getResultFail(-707, "该方案已完成,不可更改");
}
deliveryContent['ApplicationStatus'] = 704;
solutionFlowList.push({
file: ab.OfficialFileURL || "",
status: "ENGRAVING", statusName: this.regSolutionStatus.ENGRAVING, updated_at: new Date()
});
deliveryContent.status = "ENGRAVING";
deliveryContent.statusName = this.regSolutionStatus.ENGRAVING;
}
if (ab.ApplicationStatus == 705) {//已完成
if (deliveryContent.status != "ENGRAVING") {
return system.getResultFail(-705, "交付流程错误,请先刻章");
}
if (deliveryContent.status == "SUCCESS") {
return system.getResultFail(-708, "该方案已完成,不可更改");
}
deliveryContent['ApplicationStatus'] = 705;
solutionFlowList.push({
file: ab.OfficialFileURL || "",
status: "SUCCESS", statusName: this.regSolutionStatus.SUCCESS, updated_at: new Date()
});
deliveryContent.status = "SUCCESS";
needsolutioninfo.status = "ywc";
deliveryContent.statusName = this.regSolutionStatus.SUCCESS;
}
}
if (ab.consultType && ab.consultType == "QYJYTC1" || ab.consultType && ab.consultType == "QYJYTC2") {//公司注册套餐1和公司注册套餐2
if (ab.consultType == "QYJYTC1") {
bizTypeName = "企业经营套餐一"
}
if (ab.consultType == "QYJYTC2") {
bizTypeName = "企业经营套餐二"
}
switch (productType) {
case "GSZZ":
deliveryContent['GSZZ'] = {
bizType: ab.consultType,
bizTypeName: bizTypeName,
productType: productType,
productTypeName: "工商执照",
status: ab.ApplicationStatus,
statusName: this.regDeliveryStatusName[ab.ApplicationStatus],
channelStatus: this.regDeliveryStatus[ab.ApplicationStatus],
customerInfo: needsolutioninfo.solutionContent.customerInfo,
update_at: new Date().Format("yyyy-MM-dd hh:mm:ss"),
officialFile: ab.officialFile || "",
deliveryFlowList: []
}
break;
case "YHKH":
deliveryContent['YHKH'] = {
bizType: ab.consultType,
bizTypeName: bizTypeName,
productType: productType,
productTypeName: "银行开户",
status: ab.ApplicationStatus,
statusName: this.regDeliveryStatusName[ab.ApplicationStatus],
channelStatus: this.regDeliveryStatus[ab.ApplicationStatus],
update_at: new Date().Format("yyyy-MM-dd hh:mm:ss"),
officialFile: ab.officialFile || "",
deliveryFlowList: []
}
break;
case "SWBD":
deliveryContent['SWBD'] = {
bizType: ab.consultType,
bizTypeName: bizTypeName,
productType: productType,
productTypeName: "税务报道",
status: ab.ApplicationStatus,
statusName: this.regDeliveryStatusName[ab.ApplicationStatus],
channelStatus: this.regDeliveryStatus[ab.ApplicationStatus],
update_at: new Date().Format("yyyy-MM-dd hh:mm:ss"),
officialFile: ab.officialFile || "",
deliveryFlowList: []
}
break;
case "DLJZ":
deliveryContent['DLJZ'] = {
bizType: ab.consultType,
bizTypeName: bizTypeName,
productType: productType,
productTypeName: "代理记账",
status: ab.ApplicationStatus,
statusName: this.regDeliveryStatusName[ab.ApplicationStatus],
channelStatus: this.regDeliveryStatus[ab.ApplicationStatus],
update_at: new Date().Format("yyyy-MM-dd hh:mm:ss"),
officialFile: ab.officialFile || "",
deliveryFlowList: []
}
break;
case "DZFW":
deliveryContent['DZFW'] = {
bizType: ab.consultType,
bizTypeName: bizTypeName,
productType: productType,
productTypeName: "地址服务",
status: ab.ApplicationStatus,
statusName: this.regDeliveryStatusName[ab.ApplicationStatus],
channelStatus: this.regDeliveryStatus[ab.ApplicationStatus],
update_at: new Date().Format("yyyy-MM-dd hh:mm:ss"),
officialFile: ab.officialFile || "",
deliveryFlowList: []
}
break;
}
}
}
deliveryContent = JSON.stringify(deliveryContent); deliveryContent = JSON.stringify(deliveryContent);
let orderdeliveryData = { let orderdeliveryData = {
sourceOrderNo: ab.orderNo, sourceOrderNo: ab.orderNo,
......
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