Commit cb2750ac by 兰国旗

状态逻辑整理

parent ff75d910
......@@ -1117,6 +1117,7 @@ class RegCenterOrderService {
let solutionFlowList = [];
var deliveryFlowList = [];
let deliveryContent = {};
var applicationStatusList
var orderInfo = await this.orderinfoDao.model.findOne({
attributes: ["uapp_id", "channelOrderNo"],
......@@ -1127,306 +1128,373 @@ class RegCenterOrderService {
var uappId = orderInfo.uapp_id;
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'] = {
// 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;
// }
// }
//2021-5-18 新增百度公司注册与公司注册套餐区分 start
if (ab.consultType && ab.consultType == "GSREG") {//公司注册
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, "该方案已完成,不可更改");
//判断是否有交付信息
if (orderdeliveryInfo[0] && orderdeliveryInfo[0].deliveryContent) {
deliveryContent = orderdeliveryInfo[0].deliveryContent;
//判断大类是否是套餐
if (ab.consultType && ab.consultType == "GSREG") {//非套餐
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, "操作失败,该方案已完成,不能更改");
}
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;
}
solutionFlowList = deliveryContent.solutionFlowList || [];
applicationStatusList = deliveryContent.applicationStatusList || [];
}
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 (ab.consultType && ab.consultType == "QYJYTC1" || ab.consultType && ab.consultType == "QYJYTC2") {//公司注册套餐1和公司注册套餐2
if (ab.productType && ab.productType == "GSZZ") {//工商执照
if (ab.ApplicationStatus == 702) {//材料收集环节
if (needsolutioninfo.solutionContent.status != "PAID") {
return system.getResultFail(-702, "交付流程错误,请先完成支付");
}
}
if (ab.ApplicationStatus == 703) {//工商审核环节
var afterStatusList = [//用户支付后的流程状态
"COLLECTING", "AUDITING", "ENGRAVING", "SUCCESS"
];
if (!deliveryContent[ab.productType] || afterStatusList.indexOf(deliveryContent[ab.productType].channelStatus) < 0) {
return system.getResultFail(-703, "交付流程错误,请先完成材料收集");
}
if (deliveryContent[ab.productType] && deliveryContent[ab.productType].channelStatus && deliveryContent[ab.productType].channelStatus == "SUCCESS") {
return system.getResultFail(-706, "该方案已完成,不可更改");
}
}
if (ab.ApplicationStatus == 704) {//刻章环节
var afterStatusList = [//用户支付后的流程状态
"COLLECTING", "AUDITING", "ENGRAVING", "SUCCESS"
];
if (!deliveryContent[ab.productType].channelStatus || afterStatusList.indexOf(deliveryContent[ab.productType].channelStatus) < 0) {
return system.getResultFail(-704, "交付流程错误,请先工商审核");
}
if (deliveryContent[ab.productType] && deliveryContent[ab.productType].channelStatus && deliveryContent[ab.productType].channelStatus == "SUCCESS") {
return system.getResultFail(-707, "该方案已完成,不可更改");
}
}
if (ab.ApplicationStatus == 705) {//已完成
if (deliveryContent[ab.productType] && deliveryContent[ab.productType].channelStatus && deliveryContent[ab.productType].channelStatus != "ENGRAVING") {
return system.getResultFail(-705, "交付流程错误,请先刻章");
}
if (deliveryContent[ab.productType] && deliveryContent[ab.productType].channelStatus && deliveryContent[ab.productType].channelStatus == "SUCCESS") {
return system.getResultFail(-708, "该方案已完成,不可更改");
}
}
}
if (deliveryContent.status == "SUCCESS") {
return system.getResultFail(-708, "该方案已完成,不可更改");
if (ab.productType && ab.productType == "DZFW") {//地址服务
if (ab.ApplicationStatus == 702) {//材料收集环节
if (needsolutioninfo.solutionContent.status != "PAID") {
return system.getResultFail(-702, "交付流程错误,请先完成支付");
}
}
if (ab.ApplicationStatus == 703) {//工商审核环节
var afterStatusList = [//用户支付后的流程状态
"COLLECTING", "AUDITING", "ENGRAVING", "SUCCESS"
];
if (!deliveryContent[ab.productType].channelStatus || afterStatusList.indexOf(deliveryContent[ab.productType].channelStatus) < 0) {
return system.getResultFail(-703, "交付流程错误,请先完成材料收集");
}
if (deliveryContent[ab.productType] && deliveryContent[ab.productType].channelStatus && deliveryContent[ab.productType].channelStatus == "SUCCESS") {
return system.getResultFail(-706, "该方案已完成,不可更改");
}
}
if (ab.ApplicationStatus == 706) {//服务中
var afterStatusList = [//用户支付后的流程状态
"COLLECTING", "AUDITING", "SUCCESS"
];
if (!deliveryContent[ab.productType].channelStatus || afterStatusList.indexOf(deliveryContent[ab.productType].channelStatus) < 0) {
return system.getResultFail(-704, "交付流程错误,请先工商审核");
}
if (deliveryContent[ab.productType] && deliveryContent[ab.productType].channelStatus && deliveryContent[ab.productType].channelStatus == "SUCCESS") {
return system.getResultFail(-707, "该方案已完成,不可更改");
}
}
if (ab.ApplicationStatus == 705) {//已完成
if (deliveryContent[ab.productType] && deliveryContent[ab.productType].channelStatus && deliveryContent[ab.productType].channelStatus != "ACTIVE") {
return system.getResultFail(-705, "交付流程错误,请先变更状态为服务中");
}
if (deliveryContent[ab.productType] && deliveryContent[ab.productType].channelStatus && deliveryContent[ab.productType].channelStatus == "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.productType && ab.productType == "GSZZ") {//工商执照
if (ab.ApplicationStatus == 702) {//材料收集环节
if (needsolutioninfo.solutionContent.status != "PAID") {
return system.getResultFail(-702, "交付流程错误,请先完成支付");
if (ab.productType && ab.productType == "YHKH" || ab.productType == "SWBD") {//银行开户、税务报道:有已接单,已完成状态
if (ab.ApplicationStatus == 705) {//已完成
if (deliveryContent[ab.productType] && deliveryContent[ab.productType].channelStatus && deliveryContent[ab.productType].channelStatus == "SUCCESS") {
return system.getResultFail(-707, "该方案已完成,不可更改");
}
}
}
if (ab.ApplicationStatus == 703) {//工商审核环节
var afterStatusList = [//用户支付后的流程状态
"COLLECTING", "AUDITING", "ENGRAVING", "SUCCESS"
];
if (!deliveryContent[ab.productType].channelStatus || afterStatusList.indexOf(deliveryContent[ab.productType].channelStatus) < 0) {
return system.getResultFail(-703, "交付流程错误,请先完成材料收集");
if (ab.productType && ab.productType == "DLJZ") {//代理记账:有已接单,服务中,已完成状态
if (ab.ApplicationStatus == 706) {//服务中
if (deliveryContent[ab.productType] && deliveryContent[ab.productType].channelStatus && deliveryContent[ab.productType].channelStatus == "ACTIVE") {
return system.getResultFail(-707, "该交付单已在服务中,不能重复提交");
}
}
if (deliveryContent[ab.productType] && deliveryContent[ab.productType].channelStatus && deliveryContent[ab.productType].channelStatus == "SUCCESS") {
return system.getResultFail(-706, "该方案已完成,不可更改");
if (ab.ApplicationStatus == 705) {//已完成
if (deliveryContent[ab.productType] && deliveryContent[ab.productType].channelStatus && deliveryContent[ab.productType].channelStatus == "SUCCESS") {
return system.getResultFail(-707, "该交付单已在服务中,不能重复提交");
}
}
}
if (ab.ApplicationStatus == 704) {//刻章环节
var afterStatusList = [//用户支付后的流程状态
"COLLECTING", "AUDITING", "ENGRAVING", "SUCCESS"
];
if (!deliveryContent[ab.productType].channelStatus || afterStatusList.indexOf(deliveryContent[ab.productType].channelStatus) < 0) {
return system.getResultFail(-704, "交付流程错误,请先工商审核");
//如果存在交付信息的话就去进行逻辑判断
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) {
return system.getResultFail(-406, "操作失败,该交付已完成,不能更改");
}
if (deliveryContent[ab.productType] && deliveryContent[ab.productType].channelStatus && deliveryContent[ab.productType].channelStatus == "SUCCESS") {
return system.getResultFail(-707, "该方案已完成,不可更改");
deliveryFlowList = deliveryContent[ab.productType].solutionFlowList || [];
} else {//如果交付信息不存在的话就去进行赋值
let startTime
let endTime
if (ab.startTime) {
startTime = (new Date(ab.startTime * 1000)).Format("yyyy-MM-dd hh:mm:ss")
}
}
if (ab.ApplicationStatus == 705) {//已完成
if (deliveryContent[ab.productType] && deliveryContent[ab.productType].channelStatus && deliveryContent[ab.productType].channelStatus != "ENGRAVING") {
return system.getResultFail(-705, "交付流程错误,请先刻章");
if (ab.startTime) {
endTime = (new Date(ab.endTime * 1000)).Format("yyyy-MM-dd hh:mm:ss")
}
if (deliveryContent[ab.productType] && deliveryContent[ab.productType].channelStatus && deliveryContent[ab.productType].channelStatus == "SUCCESS") {
return system.getResultFail(-708, "该方案已完成,不可更改");
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: "代理记账",
startTime: startTime || "",
endTime: endTime || "",
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: "地址服务",
startTime: startTime || "",
endTime: endTime || "",
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[ab.productType].deliveryFlowList.push({
status: ab.ApplicationStatus,
statusName: this.regDeliveryStatusName[ab.ApplicationStatus],
file: ab.officialFile || "",
update_at: new Date().Format("yyyy-MM-dd hh:mm:ss")
});
deliveryContent[ab.productType].status = ab.ApplicationStatus
deliveryContent[ab.productType].statusName = this.regDeliveryStatusName[ab.ApplicationStatus]
deliveryContent[ab.productType].channelStatus = this.regDeliveryStatus[ab.ApplicationStatus]
}
if (ab.productType && ab.productType == "DZFW") {//地址服务
} 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[ab.productType].channelStatus || afterStatusList.indexOf(deliveryContent[ab.productType].channelStatus) < 0) {
if (!deliveryContent.status || afterStatusList.indexOf(deliveryContent.status) < 0) {
return system.getResultFail(-703, "交付流程错误,请先完成材料收集");
}
if (deliveryContent[ab.productType] && deliveryContent[ab.productType].channelStatus && deliveryContent[ab.productType].channelStatus == "SUCCESS") {
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 == 706) {//服务中
if (ab.ApplicationStatus == 704) {//刻章环节
var afterStatusList = [//用户支付后的流程状态
"COLLECTING", "AUDITING", "SUCCESS"
"COLLECTING", "AUDITING", "ENGRAVING", "SUCCESS"
];
if (!deliveryContent[ab.productType].channelStatus || afterStatusList.indexOf(deliveryContent[ab.productType].channelStatus) < 0) {
if (!deliveryContent.status || afterStatusList.indexOf(deliveryContent.status) < 0) {
return system.getResultFail(-704, "交付流程错误,请先工商审核");
}
if (deliveryContent[ab.productType] && deliveryContent[ab.productType].channelStatus && deliveryContent[ab.productType].channelStatus == "SUCCESS") {
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[ab.productType] && deliveryContent[ab.productType].channelStatus && deliveryContent[ab.productType].channelStatus != "ACTIVE") {
return system.getResultFail(-705, "交付流程错误,请先变更状态为服务中");
if (deliveryContent.status != "ENGRAVING") {
return system.getResultFail(-705, "交付流程错误,请先刻章");
}
if (deliveryContent[ab.productType] && deliveryContent[ab.productType].channelStatus && deliveryContent[ab.productType].channelStatus == "SUCCESS") {
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.productType && ab.productType == "YHKH" || ab.productType == "SWBD") {//银行开户、税务报道:有已接单,已完成状态
if (ab.ApplicationStatus == 705) {//已完成
if (deliveryContent[ab.productType] && deliveryContent[ab.productType].channelStatus && deliveryContent[ab.productType].channelStatus == "SUCCESS") {
return system.getResultFail(-707, "该方案已完成,不可更改");
}
}
}
if (ab.productType && ab.productType == "DLJZ") {//代理记账:有已接单,服务中,已完成状态
if (ab.ApplicationStatus == 706) {//服务中
if (deliveryContent[ab.productType] && deliveryContent[ab.productType].channelStatus && deliveryContent[ab.productType].channelStatus == "ACTIVE") {
return system.getResultFail(-707, "该交付单已在服务中,不能重复提交");
}
}
if (ab.ApplicationStatus == 705) {//已完成
if (deliveryContent[ab.productType] && deliveryContent[ab.productType].channelStatus && deliveryContent[ab.productType].channelStatus == "SUCCESS") {
return system.getResultFail(-707, "该交付单已在服务中,不能重复提交");
}
}
}
}
//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 (this.regStatus[deliveryContent.ApplicationStatus] && this.regStatus[deliveryContent.ApplicationStatus] == ab.ApplicationStatus && ab.ApplicationStatus == 705) {
return system.getResultFail(-406, "操作失败,该交付已完成,不能更改");
}
deliveryFlowList = deliveryContent[ab.productType].solutionFlowList || [];
}
else {//如果交付信息不存在的话就去进行赋值
let startTime
let endTime
if (ab.startTime) {
startTime = (new Date(ab.startTime * 1000)).Format("yyyy-MM-dd hh:mm:ss")
}
if (ab.startTime) {
endTime = (new Date(ab.endTime * 1000)).Format("yyyy-MM-dd hh:mm:ss")
}
if (ab.consultType && ab.consultType == "QYJYTC1" || ab.consultType && ab.consultType == "QYJYTC2") {//公司注册套餐1和公司注册套餐2
if (ab.consultType == "QYJYTC1") {
bizTypeName = "企业经营套餐一"
}
......@@ -1486,8 +1554,6 @@ class RegCenterOrderService {
bizTypeName: bizTypeName,
productType: productType,
productTypeName: "代理记账",
startTime: startTime || "",
endTime: endTime || "",
status: ab.ApplicationStatus,
statusName: this.regDeliveryStatusName[ab.ApplicationStatus],
channelStatus: this.regDeliveryStatus[ab.ApplicationStatus],
......@@ -1503,8 +1569,6 @@ class RegCenterOrderService {
bizTypeName: bizTypeName,
productType: productType,
productTypeName: "地址服务",
startTime: startTime || "",
endTime: endTime || "",
status: ab.ApplicationStatus,
statusName: this.regDeliveryStatusName[ab.ApplicationStatus],
channelStatus: this.regDeliveryStatus[ab.ApplicationStatus],
......@@ -1515,15 +1579,6 @@ class RegCenterOrderService {
break;
}
}
deliveryContent[ab.productType].deliveryFlowList.push({
status: ab.ApplicationStatus,
statusName: this.regDeliveryStatusName[ab.ApplicationStatus],
file: ab.officialFile || "",
update_at: new Date().Format("yyyy-MM-dd hh:mm:ss")
});
deliveryContent[ab.productType].status = ab.ApplicationStatus
deliveryContent[ab.productType].statusName = this.regDeliveryStatusName[ab.ApplicationStatus]
deliveryContent[ab.productType].channelStatus = this.regDeliveryStatus[ab.ApplicationStatus]
}
deliveryContent = JSON.stringify(deliveryContent);
let orderdeliveryData = {
......
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