Prechádzať zdrojové kódy

fix: 修复计量台账重新审批推送异常bug

lanjianrong 4 rokov pred
rodič
commit
b24dfa7b13
3 zmenil súbory, kde vykonal 11 pridanie a 125 odobranie
  1. 9 9
      app/const/audit.js
  2. 0 1
      app/service/ledger_audit.js
  3. 2 115
      app/service/stage_audit.js

+ 9 - 9
app/const/audit.js

@@ -33,7 +33,7 @@ const ledger = (function () {
     const auditString = []
     auditString[status.uncheck] = ''
     auditString[status.checking] = '审批中'
-    auditString[status.checked] = '审批完成'
+    auditString[status.checked] = '审批通过'
     auditString[status.checkNo] = '审批退回'
     // 文字样式
     const auditStringClass = []
@@ -55,7 +55,7 @@ const revise = (function () {
     const statusString = []
     statusString[status.uncheck] = '草稿'
     statusString[status.checking] = '审批中'
-    statusString[status.checked] = '审批完成'
+    statusString[status.checked] = '审批通过'
     statusString[status.checkNo] = '审批退回'
 
     const statusClass = []
@@ -69,7 +69,7 @@ const revise = (function () {
     const auditString = []
     auditString[status.uncheck] = ''
     auditString[status.checking] = '审批中'
-    auditString[status.checked] = '审批完成'
+    auditString[status.checked] = '审批通过'
     auditString[status.checkNo] = '审批退回'
     // 文字样式
     const auditStringClass = []
@@ -145,9 +145,9 @@ const stage = (function () {
     const auditString = []
     auditString[status.uncheck] = ''
     auditString[status.checking] = '审批中'
-    auditString[status.checked] = '完成'
-    auditString[status.checkNo] = '退回'
-    auditString[status.checkNoPre] = '退回'
+    auditString[status.checked] = '审批通过'
+    auditString[status.checkNo] = '审批退回'
+    auditString[status.checkNoPre] = '审批退回'
     auditString[status.checkAgain] = '重新审批'
     // 文字样式
     const auditStringClass = []
@@ -227,7 +227,7 @@ statusButtonClass[status.backnew] = 'btn-success'
 const statusString = []
 statusString[status.uncheck] = ''
 statusString[status.checking] = '审批中'
-statusString[status.checked] = '审批完成'
+statusString[status.checked] = '审批听过'
 // statusString[status.checkNo] = '终止';
 statusString[status.back] = '审批退回'
 statusString[status.backnew] = '审批退回'
@@ -360,7 +360,7 @@ const advance = (function () {
     const statusString = []
     statusString[status.uncheck] = ''
     statusString[status.checking] = '审批中'
-    statusString[status.checked] = '审批完成'
+    statusString[status.checked] = '审批通过'
     statusString[status.checkNo] = '审批退回'
 
     const statusClass = []
@@ -374,7 +374,7 @@ const advance = (function () {
     const auditString = []
     auditString[status.uncheck] = ''
     auditString[status.checking] = '审批中'
-    auditString[status.checked] = '审批完成'
+    auditString[status.checked] = '审批通过'
     auditString[status.checkNo] = '审批退回'
     // 文字样式
     const auditStringClass = []

+ 0 - 1
app/service/ledger_audit.js

@@ -266,7 +266,6 @@ module.exports = app => {
 
                 // 获取审核人列表
                 const auditList = await this.getAuditors(tenderId, times)
-                console.log('auditList', auditList)
                 // 添加推送
                 const noticeContent = await this.getNoticeContent(audit.tender_id, pid, audit.audit_id)
                 const records = [

+ 2 - 115
app/service/stage_audit.js

@@ -310,6 +310,7 @@ module.exports = app => {
             try {
                 // 添加推送
                 const noticeContent = await this.getNoticeContent(pid, audit.tid, stageId, audit.aid)
+                const auditors = await this.getAuditGroupByListWithOwner(stageId, times)
                 const records = [
                     {
                         pid,
@@ -319,7 +320,7 @@ module.exports = app => {
                         content: noticeContent
                     }
                 ]
-                this.ctx.stage.auditors.forEach(audit => {
+                auditors.forEach(audit => {
                     records.push({
                         pid,
                         type: pushType.stage,
@@ -745,120 +746,6 @@ module.exports = app => {
                 default:
                     throw '无效审批操作'
             }
-
-            // const transaction = await this.db.beginTransaction();
-            // try {
-            //     // 更新当前审核流程
-            //     await transaction.update(this.tableName, {id: audit.id, status: checkData.checkType, opinion: checkData.opinion, end_time: time});
-            //     if (checkData.checkType === auditConst.status.checked) { // 审批通过
-            //         const nextAudit = await this.getDataByCondition({sid: stageId, times: times, order: audit.order + 1});
-            //         // 无下一审核人表示,审核结束
-            //         if (nextAudit) {
-            //             // 计算该审批人最终数据
-            //             await this.ctx.service.stagePay.calcAllStagePays(this.ctx.stage, transaction);
-            //             // 复制一份下一审核人数据
-            //             await this.ctx.service.stagePay.copyAuditStagePays(this.ctx.stage, this.ctx.stage.times, nextAudit.order, transaction);
-            //             // 流程至下一审批人
-            //             await transaction.update(this.tableName, {id: nextAudit.id, status: auditConst.status.checking, begin_time: time});
-            //             // 同步 期信息
-            //             const tpData = await this.ctx.service.stageBills.getSumTotalPrice(this.ctx.stage);
-            //             await transaction.update(this.ctx.service.stage.tableName, {
-            //                 id: stageId, status: auditConst.status.checking,
-            //                 contract_tp: tpData.contract_tp,
-            //                 qc_tp: tpData.qc_tp,
-            //             });
-            //         } else {
-            //             // 本期结束
-            //             // 生成截止本期数据 final数据
-            //             await this.ctx.service.stageBillsFinal.generateFinalData(transaction, this.ctx.tender, this.ctx.stage);
-            //             await this.ctx.service.stagePosFinal.generateFinalData(transaction, this.ctx.tender, this.ctx.stage);
-            //             // 计算并合同支付最终数据
-            //             await this.ctx.service.stagePay.calcAllStagePays(this.ctx.stage, transaction);
-            //             // 同步 期信息
-            //             const tpData = await this.ctx.service.stageBills.getSumTotalPrice(this.ctx.stage);
-            //             await transaction.update(this.ctx.service.stage.tableName, {
-            //                 id: stageId, status: checkData.checkType,
-            //                 contract_tp: tpData.contract_tp,
-            //                 qc_tp: tpData.qc_tp,
-            //             });
-            //         }
-            //     } else if (checkData.checkType === auditConst.status.checkNo) { // 审批退回 原报, times+1
-            //         // 同步 期信息
-            //         const tpData = await this.ctx.service.stageBills.getSumTotalPrice(this.ctx.stage);
-            //         await transaction.update(this.ctx.service.stage.tableName, {
-            //             id: stageId, status: checkData.checkType,
-            //             contract_tp: tpData.contract_tp,
-            //             qc_tp: tpData.qc_tp,
-            //             times: times + 1,
-            //         });
-            //         // 拷贝新一次审核流程列表
-            //         // const auditors = await this.getAllDataByCondition({
-            //         //     where: {sid: stageId, times: times},
-            //         //     columns: ['tid', 'sid', 'aid', 'order']
-            //         // });
-            //         const sql = 'SELECT `tid`, `sid`, `aid`, `order` FROM ?? WHERE `sid` = ? and `times` = ? GROUP BY `aid`';
-            //         const sqlParam = [this.tableName, stageId, times];
-            //         const auditors = await this.db.query(sql, sqlParam);
-            //         let order = 1;
-            //         for (const a of auditors) {
-            //             a.times = times + 1;
-            //             a.order = order;
-            //             a.status = auditConst.status.uncheck;
-            //             order++;
-            //         }
-            //         await transaction.insert(this.tableName, auditors);
-            //         // 计算该审批人最终数据
-            //         await this.ctx.service.stagePay.calcAllStagePays(this.ctx.stage, transaction);
-            //         // 复制一份最新数据给原报
-            //         await this.ctx.service.stagePay.copyAuditStagePays(this.ctx.stage, this.ctx.stage.times + 1, 0, transaction);
-            //     } else if (checkData.checkType === auditConst.status.checkNoPre) { // 审批退回 上一审批人
-            //         // 同步 期信息
-            //         const tpData = await this.ctx.service.stageBills.getSumTotalPrice(this.ctx.stage);
-            //         await transaction.update(this.ctx.service.stage.tableName, {
-            //             id: stageId, status: checkData.checkType,
-            //             contract_tp: tpData.contract_tp,
-            //             qc_tp: tpData.qc_tp,
-            //         });
-            //         // 将当前审批人 与 上一审批人再次添加至流程,顺移其后审批人流程顺序
-            //         if (audit.order > 1) {
-            //             // 顺移气候审核人流程顺序
-            //             this.initSqlBuilder();
-            //             this.sqlBuilder.setAndWhere('sid', { value: this.ctx.stage.id, operate: '=', });
-            //             this.sqlBuilder.setAndWhere('order', { value: audit.order, operate: '>', });
-            //             this.sqlBuilder.setUpdateData('order', { value: 2, selfOperate: '+', });
-            //             const [sql, sqlParam] = this.sqlBuilder.build(this.tableName, 'update');
-            //             const data = await transaction.query(sql, sqlParam);
-            //
-            //             // 上一审批人,当前审批人 再次添加至流程
-            //             const preAuditor = await this.getDataByCondition({sid: stageId, times: times, order: audit.order - 1});
-            //             const newAuditors = [];
-            //             newAuditors.push({
-            //                 tid: preAuditor.tid, sid: preAuditor.sid, aid: preAuditor.aid,
-            //                 times: preAuditor.times, order: preAuditor.order + 2, status: auditConst.status.checking,
-            //                 begin_time: time,
-            //             });
-            //             newAuditors.push({
-            //                 tid: audit.tid, sid: audit.sid, aid: audit.aid,
-            //                 times: audit.times, order: audit.order + 2, status: auditConst.status.uncheck
-            //             });
-            //             await transaction.insert(this.tableName, newAuditors);
-            //
-            //             // 计算该审批人最终数据
-            //             await this.ctx.service.stagePay.calcAllStagePays(this.ctx.stage, transaction);
-            //             // 复制一份最新数据给上一人
-            //             await this.ctx.service.stagePay.copyAuditStagePays(this.ctx.stage, this.ctx.stage.times, audit.order + 1, transaction);
-            //         } else {
-            //             throw '审核数据错误';
-            //         }
-            //     } else {
-            //         throw '无效审批操作';
-            //     }
-            //
-            //     await transaction.commit();
-            // } catch (err) {
-            //     await transaction.rollback();
-            //     throw err;
-            // }
         }
 
         /**