Bläddra i källkod

修复固定审批流无法同步到变更问题

ellisran 1 år sedan
förälder
incheckning
4f0503b920

+ 4 - 4
app/middleware/change_apply_audit_check.js

@@ -47,12 +47,12 @@ module.exports = options => {
                         change.sp_group = group ? group.id : 0;
                         yield this.service.changeApply.defaultUpdate({ id: change.id, sp_group: change.sp_group });
                     }
-                    if (change.sp_group === 0) {
+                    const condition = { tid: this.tender.id, sp_type: shenpiConst.sp_type.change, sp_status: shenpi_status, sp_group: change.sp_group };
+                    const shenpiList = yield this.service.shenpiAudit.getAllDataByCondition({ where: condition, orders: [['audit_order', 'asc']] });
+                    yield this.service.shenpiAudit.noYbShenpiList(change.uid, shenpiList);
+                    if (change.sp_group === 0 && shenpiList.length === 0) {
                         this.tender.info.shenpi.change = shenpiConst.sp_status.sqspr;
                     } else {
-                        const condition = { tid: this.tender.id, sp_type: shenpiConst.sp_type.change, sp_status: shenpi_status, sp_group: change.sp_group };
-                        const shenpiList = yield this.service.shenpiAudit.getAllDataByCondition({ where: condition, orders: [['audit_order', 'asc']] });
-                        yield this.service.shenpiAudit.noYbShenpiList(change.uid, shenpiList);
                         // 判断2个id数组是否相同,不同则删除原审批流,切换成固定的审批流
                         let sameAudit = auditList.length === shenpiList.length;
                         if (sameAudit) {

+ 3 - 3
app/middleware/change_audit_check.js

@@ -49,11 +49,11 @@ module.exports = options => {
                         change.sp_group = group ? group.id : 0;
                         yield this.service.change.defaultUpdate({ sp_group: change.sp_group }, { where: { cid: change.cid } });
                     }
-                    if (change.sp_group === 0) {
+                    const condition = { tid: this.tender.id, sp_type: shenpiConst.sp_type.change, sp_status: shenpi_status, sp_group: change.sp_group };
+                    const shenpiList = yield this.service.shenpiAudit.getAllDataByCondition({ where: condition, orders: [['audit_order', 'asc']] });
+                    if (change.sp_group === 0 && shenpiList.length === 0) {
                         this.tender.info.shenpi.change = shenpiConst.sp_status.sqspr;
                     } else {
-                        const condition = { tid: this.tender.id, sp_type: shenpiConst.sp_type.change, sp_status: shenpi_status, sp_group: change.sp_group };
-                        const shenpiList = yield this.service.shenpiAudit.getAllDataByCondition({ where: condition });
                         // const shenpiIdList = _.map(shenpiList, 'audit_id');
                         // 判断2个id数组是否相同,不同则删除原审批流,切换成固定的审批流
                         let sameAudit = auditList.length === shenpiList.length;

+ 4 - 4
app/middleware/change_plan_audit_check.js

@@ -47,12 +47,12 @@ module.exports = options => {
                         change.sp_group = group ? group.id : 0;
                         yield this.service.changePlan.defaultUpdate({ id: change.id, sp_group: change.sp_group });
                     }
-                    if (change.sp_group === 0) {
+                    const condition = { tid: this.tender.id, sp_type: shenpiConst.sp_type.change, sp_status: shenpi_status, sp_group: change.sp_group };
+                    const shenpiList = yield this.service.shenpiAudit.getAllDataByCondition({ where: condition, orders: [['audit_order', 'asc']] });
+                    yield this.service.shenpiAudit.noYbShenpiList(change.uid, shenpiList);
+                    if (change.sp_group === 0 && shenpiList.length === 0) {
                         this.tender.info.shenpi.change = shenpiConst.sp_status.sqspr;
                     } else {
-                        const condition = { tid: this.tender.id, sp_type: shenpiConst.sp_type.change, sp_status: shenpi_status, sp_group: change.sp_group };
-                        const shenpiList = yield this.service.shenpiAudit.getAllDataByCondition({ where: condition, orders: [['audit_order', 'asc']] });
-                        yield this.service.shenpiAudit.noYbShenpiList(change.uid, shenpiList);
                         // 判断2个id数组是否相同,不同则删除原审批流,切换成固定的审批流
                         let sameAudit = auditList.length === shenpiList.length;
                         if (sameAudit) {

+ 4 - 4
app/middleware/change_project_audit_check.js

@@ -47,12 +47,12 @@ module.exports = options => {
                         change.sp_group = group ? group.id : 0;
                         yield this.service.changeProject.defaultUpdate({ id: change.id, sp_group: change.sp_group });
                     }
-                    if (change.sp_group === 0) {
+                    const condition = { tid: this.tender.id, sp_type: shenpiConst.sp_type.change, sp_status: shenpi_status, sp_group: change.sp_group };
+                    const shenpiList = yield this.service.shenpiAudit.getAllDataByCondition({ where: condition, orders: [['audit_order', 'asc']] });
+                    yield this.service.shenpiAudit.noYbShenpiList(change.uid, shenpiList);
+                    if (change.sp_group === 0 && shenpiList.length === 0) {
                         this.tender.info.shenpi.change = shenpiConst.sp_status.sqspr;
                     } else {
-                        const condition = { tid: this.tender.id, sp_type: shenpiConst.sp_type.change, sp_status: shenpi_status, sp_group: change.sp_group };
-                        const shenpiList = yield this.service.shenpiAudit.getAllDataByCondition({ where: condition, orders: [['audit_order', 'asc']] });
-                        yield this.service.shenpiAudit.noYbShenpiList(change.uid, shenpiList);
                         // 判断2个id数组是否相同,不同则删除原审批流,切换成固定的审批流
                         let sameAudit = auditList.length === shenpiList.length;
                         if (sameAudit) {