|
@@ -20,11 +20,12 @@ const checkAuditFlow = async function(ctx) {
|
|
|
|
|
|
const shenpi_status = info.shenpi.ledger;
|
|
|
// 进一步比较审批流是否与审批流程设置的相同,不同则替换为固定审批流或固定的终审
|
|
|
- const auditList = await ctx.service.ledgerAudit.getAuditors(tender.id, tender.times);
|
|
|
+ const auditList = await ctx.service.ledgerAudit.getAuditors(tender.id, tender.ledger_times);
|
|
|
if (shenpi_status === shenpiConst.sp_status.gdspl) {
|
|
|
const shenpiList = await ctx.service.shenpiAudit.getAllDataByCondition({ where: { tid: tender.id, sp_type: shenpiConst.sp_type.ledger, sp_status: shenpi_status } });
|
|
|
// 判断2个id数组是否相同,不同则删除原审批流,切换成固定的审批流
|
|
|
let sameAudit = auditList.length === shenpiList.length;
|
|
|
+ console.log(sameAudit);
|
|
|
if (sameAudit) {
|
|
|
for (const audit of auditList) {
|
|
|
const shenpi = shenpiList.find(x => { return x.audit_id === audit.audit_id; });
|
|
@@ -38,7 +39,7 @@ const checkAuditFlow = async function(ctx) {
|
|
|
} else if (shenpi_status === shenpiConst.sp_status.gdzs) {
|
|
|
const shenpiInfo = await ctx.service.shenpiAudit.getDataByCondition({ tid: tender.id, sp_type: shenpiConst.sp_type.ledger, sp_status: shenpi_status });
|
|
|
// 判断最后一个id是否与固定终审id相同,不同则删除原审批流中如果存在的id和添加终审
|
|
|
- const lastAuditors = auditList.filter(x => { x.order === auditList[auditList.length - 1].order; });
|
|
|
+ const lastAuditors = auditList.filter(x => { x.audit_order === auditList[auditList.length - 1].audit_order; });
|
|
|
if (shenpiInfo && (lastAuditors.length === 0 || (lastAuditors.length > 1 || shenpiInfo.audit_id !== lastAuditors[0].audit_id))) {
|
|
|
await ctx.service.ledgerAudit.updateLastAudit(tender, auditList, shenpiInfo.audit_id);
|
|
|
} else if (!shenpiInfo) {
|