Browse Source

调整通知表,增加tid或spid调用

ellisran 2 months ago
parent
commit
af5f696a58

+ 6 - 6
app/service/advance_audit.js

@@ -285,9 +285,9 @@ module.exports = app => {
                 // 获取推送必要信息
                 const noticeContent = await this.getNoticeContent(pid, audit.tid, advanceId, audit.audit_id, checkData.opinion);
                 // 添加推送
-                const records = [{ pid, type: pushType.advance, uid: this.ctx.advance.uid, status: auditConst.status.checked, content: noticeContent }];
+                const records = [{ pid, tid: audit.tid, type: pushType.advance, uid: this.ctx.advance.uid, status: auditConst.status.checked, content: noticeContent }];
                 auditors.forEach(audit => {
-                    records.push({ pid, type: pushType.advance, uid: audit.audit_id, status: auditConst.status.checked, content: noticeContent });
+                    records.push({ pid, tid: audit.tid, type: pushType.advance, uid: audit.audit_id, status: auditConst.status.checked, content: noticeContent });
                 });
                 await transaction.insert(this.ctx.service.noticePush.tableName, records);
                 // 无下一审核人表示,审核结束
@@ -381,9 +381,9 @@ module.exports = app => {
                 await this.ctx.service.noticeAgain.stopNoticeAgain(transaction, this.tableName, audit.id);
                 // 添加到消息推送表
                 const noticeContent = await this.getNoticeContent(pid, audit.tid, advanceId, audit.audit_id, checkData.opinion);
-                const records = [{ pid, type: pushType.advance, uid: this.ctx.advance.uid, status: auditConst.status.checkNo, content: noticeContent }];
+                const records = [{ pid, tid: audit.tid, type: pushType.advance, uid: this.ctx.advance.uid, status: auditConst.status.checkNo, content: noticeContent }];
                 auditors.forEach(audit => {
-                    records.push({ pid, type: pushType.advance, uid: audit.audit_id, status: auditConst.status.checkNo, content: noticeContent });
+                    records.push({ pid, tid: audit.tid, type: pushType.advance, uid: audit.audit_id, status: auditConst.status.checkNo, content: noticeContent });
                 });
                 await transaction.insert(this.ctx.service.noticePush.tableName, records);
 
@@ -436,9 +436,9 @@ module.exports = app => {
             const transaction = await this.db.beginTransaction();
             try {
                 // 添加到消息推送表
-                const records = [{ pid, type: pushType.advance, uid: this.ctx.advance.uid, status: auditConst.status.checkNoPre, content: noticeContent }];
+                const records = [{ pid, tid: audit.tid, type: pushType.advance, uid: this.ctx.advance.uid, status: auditConst.status.checkNoPre, content: noticeContent }];
                 auditors2.forEach(audit => {
-                    records.push({ pid, type: pushType.advance, uid: audit.audit_id, status: auditConst.status.checkNoPre, content: noticeContent });
+                    records.push({ pid, tid: audit.tid, type: pushType.advance, uid: audit.audit_id, status: auditConst.status.checkNoPre, content: noticeContent });
                 });
                 await transaction.insert(this.ctx.service.noticePush.tableName, records);
                 await transaction.update(this.tableName, { id: audit.id, status: checkData.checkType, opinion: checkData.opinion, end_time: time });

+ 5 - 0
app/service/change.js

@@ -955,6 +955,7 @@ module.exports = app => {
                 auditors.forEach(auditor => {
                     records.push({
                         pid,
+                        tid: changeData.tid,
                         type: pushType.change,
                         uid: auditor.uid,
                         status: audit.change.status.checked,
@@ -1192,6 +1193,7 @@ module.exports = app => {
                 auditors.forEach(auditor => {
                     records.push({
                         pid,
+                        tid: changeData.tid,
                         type: pushType.change,
                         uid: auditor.uid,
                         status: audit.change.status.checkNo,
@@ -1301,6 +1303,7 @@ module.exports = app => {
                 auditors.forEach(auditor => {
                     records.push({
                         pid,
+                        tid: changeData.tid,
                         type: pushType.change,
                         uid: auditor.uid,
                         status: audit.change.status.checkNoPre,
@@ -1617,6 +1620,7 @@ module.exports = app => {
                 auditors.forEach(auditor => {
                     records.push({
                         pid,
+                        tid: change.tid,
                         type: pushType.change,
                         uid: auditor.uid,
                         status: audit.change.status.revise,
@@ -1730,6 +1734,7 @@ module.exports = app => {
                 auditors.forEach(auditor => {
                     records.push({
                         pid,
+                        tid: changeData.tid,
                         type: pushType.change,
                         uid: auditor.uid,
                         status: audit.change.status.checked,

+ 7 - 5
app/service/change_apply_audit.js

@@ -519,7 +519,7 @@ module.exports = app => {
                 const records = [];
                 const auditors = await this.getAuditorsWithOwner(caId, times);
                 auditors.forEach(audit => {
-                    records.push({ pid, type: pushType.changeApply, uid: audit.aid, status: auditConst.status.checked, content: noticeContent });
+                    records.push({ pid, tid: selfAudit.tid, type: pushType.changeApply, uid: audit.aid, status: auditConst.status.checked, content: noticeContent });
                 });
                 await transaction.insert('zh_notice', records);
                 if (audits.length === 1 || selfAudit.audit_type !== auditType.key.and) {
@@ -650,9 +650,9 @@ module.exports = app => {
                 await this.ctx.service.noticeAgain.stopNoticeAgain(transaction, this.tableName, this._.map(updateData, 'id'));
                 // 添加到消息推送表
                 const noticeContent = await this.getNoticeContent(pid, selfAudit.tid, caId, selfAudit.aid, checkData.opinion);
-                const records = [{ pid, type: pushType.changeApply, uid: this.ctx.change.uid, status: auditConst.status.checkNo, content: noticeContent }];
+                const records = [{ pid, tid: selfAudit.tid, type: pushType.changeApply, uid: this.ctx.change.uid, status: auditConst.status.checkNo, content: noticeContent }];
                 auditors.forEach(audit => {
-                    records.push({ pid, type: pushType.changeApply, uid: audit.aid, status: auditConst.status.checkNo, content: noticeContent });
+                    records.push({ pid, tid: selfAudit.tid, type: pushType.changeApply, uid: audit.aid, status: auditConst.status.checkNo, content: noticeContent });
                 });
                 await transaction.insert(this.ctx.service.noticePush.tableName, records);
                 // 同步期信息
@@ -950,10 +950,11 @@ module.exports = app => {
                 const auditors = await this.getUniqAuditor(change.id, change.times); // 全部参与的审批人
                 // 添加到消息推送表
                 const noticeContent = await this.getNoticeContent(pid, change.tid, change.id, this.ctx.session.sessionUser.accountId, '发起修订');
-                const records = [{ pid, type: pushType.changeProject, uid: change.uid, status: auditConst.status.revise, content: noticeContent }];
+                const records = [{ pid, tid: change.tid, type: pushType.changeProject, uid: change.uid, status: auditConst.status.revise, content: noticeContent }];
                 auditors.forEach(auditor => {
                     records.push({
                         pid,
+                        tid: change.tid,
                         type: pushType.changeApply,
                         uid: auditor.aid,
                         status: auditConst.status.revise,
@@ -1020,10 +1021,11 @@ module.exports = app => {
                 const auditors = await this.getUniqAuditor(change.id, change.times - 1); // 全部参与的审批人
                 // 添加到消息推送表
                 const noticeContent = await this.getNoticeContent(pid, change.tid, change.id, this.ctx.session.sessionUser.accountId, '撤销修订');
-                const records = [{ pid, type: pushType.changeProject, uid: change.uid, status: auditConst.status.cancelRevise, content: noticeContent }];
+                const records = [{ pid, tid: change.tid, type: pushType.changeProject, uid: change.uid, status: auditConst.status.cancelRevise, content: noticeContent }];
                 auditors.forEach(auditor => {
                     records.push({
                         pid,
+                        tid: change.tid,
                         type: pushType.changeApply,
                         uid: auditor.aid,
                         status: auditConst.status.cancelRevise,

+ 7 - 5
app/service/change_plan_audit.js

@@ -517,7 +517,7 @@ module.exports = app => {
                 const records = [];
                 const auditors = await this.getAuditorsWithOwner(cpId, times);
                 auditors.forEach(audit => {
-                    records.push({ pid, type: pushType.changePlan, uid: audit.aid, status: auditConst.status.checked, content: noticeContent });
+                    records.push({ pid, tid: selfAudit.tid, type: pushType.changePlan, uid: audit.aid, status: auditConst.status.checked, content: noticeContent });
                 });
                 await transaction.insert('zh_notice', records);
                 if (audits.length === 1 || selfAudit.audit_type !== auditType.key.and) {
@@ -648,9 +648,9 @@ module.exports = app => {
                 await this.ctx.service.noticeAgain.stopNoticeAgain(transaction, this.tableName, this._.map(updateData, 'id'));
                 // 添加到消息推送表
                 const noticeContent = await this.getNoticeContent(pid, selfAudit.tid, cpId, selfAudit.aid, checkData.opinion);
-                const records = [{ pid, type: pushType.changePlan, uid: this.ctx.change.uid, status: auditConst.status.checkNo, content: noticeContent }];
+                const records = [{ pid, tid: selfAudit.tid, type: pushType.changePlan, uid: this.ctx.change.uid, status: auditConst.status.checkNo, content: noticeContent }];
                 auditors.forEach(audit => {
-                    records.push({ pid, type: pushType.changePlan, uid: audit.aid, status: auditConst.status.checkNo, content: noticeContent });
+                    records.push({ pid, tid: selfAudit.tid, type: pushType.changePlan, uid: audit.aid, status: auditConst.status.checkNo, content: noticeContent });
                 });
                 await transaction.insert(this.ctx.service.noticePush.tableName, records);
                 // 同步期信息
@@ -1005,10 +1005,11 @@ module.exports = app => {
                 // const auditors = await this.db.query(sql, sqlParam);
                 // 添加到消息推送表
                 const noticeContent = await this.getNoticeContent(pid, change.tid, change.id, this.ctx.session.sessionUser.accountId, '发起修订');
-                const records = [{ pid, type: pushType.changePlan, uid: change.uid, status: auditConst.status.revise, content: noticeContent }];
+                const records = [{ pid, tid: change.tid, type: pushType.changePlan, uid: change.uid, status: auditConst.status.revise, content: noticeContent }];
                 auditors.forEach(auditor => {
                     records.push({
                         pid,
+                        tid: change.tid,
                         type: pushType.changePlan,
                         uid: auditor.aid,
                         status: auditConst.status.revise,
@@ -1078,10 +1079,11 @@ module.exports = app => {
                 const auditors = await this.getUniqAuditor(change.id, change.times - 1); // 全部参与的审批人
                 // 添加到消息推送表
                 const noticeContent = await this.getNoticeContent(pid, change.tid, change.id, this.ctx.session.sessionUser.accountId, '撤销修订');
-                const records = [{ pid, type: pushType.changePlan, uid: change.uid, status: auditConst.status.cancelRevise, content: noticeContent }];
+                const records = [{ pid, tid: change.tid, type: pushType.changePlan, uid: change.uid, status: auditConst.status.cancelRevise, content: noticeContent }];
                 auditors.forEach(auditor => {
                     records.push({
                         pid,
+                        tid: change.tid,
                         type: pushType.changePlan,
                         uid: auditor.aid,
                         status: auditConst.status.cancelRevise,

+ 9 - 7
app/service/change_project_audit.js

@@ -539,7 +539,7 @@ module.exports = app => {
                 const records = [];
                 const auditors = await this.getAuditorsWithOwner(cpId, times);
                 auditors.forEach(audit => {
-                    records.push({ pid, type: pushType.changeProject, uid: audit.aid, status: auditConst.status.checked, content: noticeContent });
+                    records.push({ pid, tid: selfAudit.tid, type: pushType.changeProject, uid: audit.aid, status: auditConst.status.checked, content: noticeContent });
                 });
                 await transaction.insert('zh_notice', records);
                 if (audits.length === 1 || selfAudit.audit_type !== auditType.key.and) {
@@ -669,9 +669,9 @@ module.exports = app => {
                 await this.ctx.service.noticeAgain.stopNoticeAgain(transaction, this.tableName, this._.map(updateData, 'id'));
                 // 添加到消息推送表
                 const noticeContent = await this.getNoticeContent(pid, selfAudit.tid, cpId, selfAudit.aid, checkData.opinion);
-                const records = [{ pid, type: pushType.changeProject, uid: this.ctx.change.uid, status: auditConst.status.back, content: noticeContent }];
+                const records = [{ pid, tid: selfAudit.tid, type: pushType.changeProject, uid: this.ctx.change.uid, status: auditConst.status.back, content: noticeContent }];
                 auditors.forEach(audit => {
-                    records.push({ pid, type: pushType.changeProject, uid: audit.aid, status: auditConst.status.back, content: noticeContent });
+                    records.push({ pid, tid: selfAudit.tid, type: pushType.changeProject, uid: audit.aid, status: auditConst.status.back, content: noticeContent });
                 });
                 await transaction.insert(this.ctx.service.noticePush.tableName, records);
                 // 同步期信息
@@ -737,9 +737,9 @@ module.exports = app => {
                 // 获取推送必要信息
                 const noticeContent = await this.getNoticeContent(pid, selfAudit.tid, cpId, selfAudit.aid, checkData.opinion);
                 // 添加推送
-                const records = [{ pid, type: pushType.changeProject, uid: this.ctx.change.uid, status: auditConst.status.checkNo, content: noticeContent }];
+                const records = [{ pid, tid: selfAudit.tid, type: pushType.changeProject, uid: this.ctx.change.uid, status: auditConst.status.checkNo, content: noticeContent }];
                 auditors.forEach(audit => {
-                    records.push({ pid, type: pushType.changeProject, uid: audit.aid, status: auditConst.status.checkNo, content: noticeContent });
+                    records.push({ pid, tid: selfAudit.tid, type: pushType.changeProject, uid: audit.aid, status: auditConst.status.checkNo, content: noticeContent });
                 });
                 await transaction.insert('zh_notice', records);
                 // 本期结束
@@ -1092,10 +1092,11 @@ module.exports = app => {
                 // const auditors = await this.db.query(sql, sqlParam);
                 // 添加到消息推送表
                 const noticeContent = await this.getNoticeContent(pid, change.tid, change.id, this.ctx.session.sessionUser.accountId, '发起修订');
-                const records = [{ pid, type: pushType.changeProject, uid: change.uid, status: auditConst.status.revise, content: noticeContent }];
+                const records = [{ pid, tid: change.tid, type: pushType.changeProject, uid: change.uid, status: auditConst.status.revise, content: noticeContent }];
                 auditors.forEach(auditor => {
                     records.push({
                         pid,
+                        tid: change.tid,
                         type: pushType.changeProject,
                         uid: auditor.aid,
                         status: auditConst.status.revise,
@@ -1159,10 +1160,11 @@ module.exports = app => {
                 const auditors = await this.getUniqAuditor(change.id, change.times - 1); // 全部参与的审批人
                 // 添加到消息推送表
                 const noticeContent = await this.getNoticeContent(pid, change.tid, change.id, this.ctx.session.sessionUser.accountId, '撤销修订');
-                const records = [{ pid, type: pushType.changeProject, uid: change.uid, status: auditConst.status.cancelRevise, content: noticeContent }];
+                const records = [{ pid, tid: change.tid, type: pushType.changeProject, uid: change.uid, status: auditConst.status.cancelRevise, content: noticeContent }];
                 auditors.forEach(auditor => {
                     records.push({
                         pid,
+                        tid: change.tid,
                         type: pushType.changeProject,
                         uid: auditor.aid,
                         status: auditConst.status.cancelRevise,

+ 3 - 3
app/service/financial_pay_audit.js

@@ -356,7 +356,7 @@ module.exports = app => {
                 const records = [];
                 const auditors = await this.getAuditorsWithOwner(fp.id, fp.times);
                 auditors.forEach(audit => {
-                    records.push({ pid, type: pushType.financial, uid: audit.aid, status: auditConst.status.checked, content: noticeContent });
+                    records.push({ pid, spid: fp.spid, type: pushType.financial, uid: audit.aid, status: auditConst.status.checked, content: noticeContent });
                 });
                 await transaction.insert('zh_notice', records);
                 if (audits.length === 1 || selfAudit.audit_type !== auditType.key.and) {
@@ -437,9 +437,9 @@ module.exports = app => {
                 await transaction.updateRows(this.tableName, updateData);
                 // 添加到消息推送表
                 const noticeContent = await this.getNoticeContent(pid, fp.spid, fp.id, selfAudit.aid, checkData.opinion);
-                const records = [{ pid, type: pushType.financial, uid: fp.uid, status: auditConst.status.checkNo, content: noticeContent }];
+                const records = [{ pid, spid: fp.spid, type: pushType.financial, uid: fp.uid, status: auditConst.status.checkNo, content: noticeContent }];
                 auditors.forEach(audit => {
-                    records.push({ pid, type: pushType.financial, uid: audit.aid, status: auditConst.status.checkNo, content: noticeContent });
+                    records.push({ pid, spid: fp.spid, type: pushType.financial, uid: audit.aid, status: auditConst.status.checkNo, content: noticeContent });
                 });
                 await transaction.insert(this.ctx.service.noticePush.tableName, records);
                 // 同步期信息

+ 2 - 2
app/service/ledger_audit.js

@@ -577,7 +577,7 @@ module.exports = app => {
             const time = new Date();
 
             const noticeContent = await this.getNoticeContent(selfAuditor.tender_id, pid, accountId, opinion);
-            const defaultNoticeRecord = { pid, type: pushType.ledger, status: auditConst.status.checkNo, content: noticeContent };
+            const defaultNoticeRecord = { pid, tid: selfAuditor.tender_id, type: pushType.ledger, status: auditConst.status.checkNo, content: noticeContent };
 
             const transaction = await this.db.beginTransaction();
             try {
@@ -651,7 +651,7 @@ module.exports = app => {
             const time = new Date();
 
             const noticeContent = await this.getNoticeContent(selfAuditor.tender_id, pid, accountId, opinion);
-            const defaultNoticeRecord = { pid, type: pushType.ledger, status: auditConst.status.checked, content: noticeContent };
+            const defaultNoticeRecord = { pid, tid: selfAuditor.tender_id, type: pushType.ledger, status: auditConst.status.checked, content: noticeContent };
 
             const transaction = await this.db.beginTransaction();
             try {

+ 5 - 5
app/service/material_audit.js

@@ -364,7 +364,7 @@ module.exports = app => {
                 const records = [];
                 // const records = [{ pid, type: pushType.material, uid: this.ctx.material.user_id, status: auditConst.status.checked, content: noticeContent }];
                 auditors.forEach(audit => {
-                    records.push({ pid, type: pushType.material, uid: audit.aid, status: auditConst.status.checked, content: noticeContent });
+                    records.push({ pid, tid: selfAudit.tid, type: pushType.material, uid: audit.aid, status: auditConst.status.checked, content: noticeContent });
                 });
                 await transaction.insert('zh_notice', records);
                 const materialInfo = await this.ctx.service.material.getDataById(materialId);
@@ -568,9 +568,9 @@ module.exports = app => {
                 await this.ctx.service.noticeAgain.stopNoticeAgain(transaction, this.tableName, this._.map(updateData, 'id'));
                 // 添加到消息推送表
                 const noticeContent = await this.getNoticeContent(pid, selfAudit.tid, materialId, selfAudit.aid, checkData.opinion);
-                const records = [{ pid, type: pushType.material, uid: this.ctx.material.user_id, status: auditConst.status.checkNo, content: noticeContent }];
+                const records = [{ pid, tid: selfAudit.tid, type: pushType.material, uid: this.ctx.material.user_id, status: auditConst.status.checkNo, content: noticeContent }];
                 auditors.forEach(audit => {
-                    records.push({ pid, type: pushType.material, uid: audit.aid, status: auditConst.status.checkNo, content: noticeContent });
+                    records.push({ pid, tid: selfAudit.tid, type: pushType.material, uid: audit.aid, status: auditConst.status.checkNo, content: noticeContent });
                 });
                 await transaction.insert(this.ctx.service.noticePush.tableName, records);
                 // 同步期信息
@@ -626,9 +626,9 @@ module.exports = app => {
                 const tp_data = await this.getTpData(transaction, materialId);
                 // 添加到消息推送表
                 const noticeContent = await this.getNoticeContent(pid, selfAudit.tid, materialId, selfAudit.aid, checkData.opinion);
-                const records = [{ pid, type: pushType.material, uid: this.ctx.material.user_id, status: auditConst.status.checkNoPre, content: noticeContent }];
+                const records = [{ pid, tid: selfAudit.tid, type: pushType.material, uid: this.ctx.material.user_id, status: auditConst.status.checkNoPre, content: noticeContent }];
                 auditors2.forEach(audit => {
-                    records.push({ pid, type: pushType.material, uid: audit.aid, status: auditConst.status.checkNoPre, content: noticeContent });
+                    records.push({ pid, tid: selfAudit.tid, type: pushType.material, uid: audit.aid, status: auditConst.status.checkNoPre, content: noticeContent });
                 });
                 await transaction.insert('zh_notice', records);
                 const updateData = [];

+ 3 - 2
app/service/phase_pay_audit.js

@@ -391,6 +391,7 @@ module.exports = app => {
                 const noticeContent = await this._getNoticeContent(this.ctx.session.sessionProject.id, phasePay.tid, phasePay.id, accountId, opinion);
                 const defaultNoticeRecord = {
                     pid: this.ctx.session.sessionProject.id,
+                    tid: phasePay.tid,
                     type: pushType.phasePay,
                     status: auditConst.phasePay.status.checked,
                     content: noticeContent,
@@ -517,7 +518,7 @@ module.exports = app => {
             try {
                 // 添加提醒
                 const noticeContent = await this._getNoticeContent(pid, selfAudit.tid, phasePay.id, selfAudit.audit_id, opinion);
-                const defaultNoticeRecord = { pid, type: pushType.phasePay, status: auditConst.phasePay.status.checkNo, content: noticeContent };
+                const defaultNoticeRecord = { pid, tid: selfAudit.tid, type: pushType.phasePay, status: auditConst.phasePay.status.checkNo, content: noticeContent };
                 const records = phasePay.userIds.map(x => {
                     return { uid: x, ...defaultNoticeRecord };
                 });
@@ -578,7 +579,7 @@ module.exports = app => {
                 // 添加通知
                 const noticeContent = await this._getNoticeContent(pid, phasePay.tid, phasePay.id, selfAudit.audit_id, opinion);
                 const defaultNoticeRecord = {
-                    pid, type: pushType.phasePay, status: auditConst.phasePay.status.checkNoPre, content: noticeContent,
+                    pid, tid: phasePay.tid, type: pushType.phasePay, status: auditConst.phasePay.status.checkNoPre, content: noticeContent,
                 };
                 const records = phasePay.userIds.map(x => {
                     return { uid: x, ...defaultNoticeRecord };

+ 2 - 2
app/service/revise_audit.js

@@ -574,7 +574,7 @@ module.exports = app => {
             const time = new Date();
 
             const noticeContent = await this.getNoticeContent(pid, selfAuditor.tender_id, revise.id, selfAuditor.audit_id, opinion);
-            const defaultNoticeRecord = { pid, type: pushType.revise, status: auditConst.status.checked, content: noticeContent};
+            const defaultNoticeRecord = { pid, tid: selfAuditor.tender_id, type: pushType.revise, status: auditConst.status.checked, content: noticeContent};
 
             const transaction = await this.db.beginTransaction();
             try {
@@ -719,7 +719,7 @@ module.exports = app => {
             const time = new Date();
 
             const noticeContent = await this.getNoticeContent(pid, revise.tid, revise.id, accountId, opinion);
-            const defaultNoticeRecord = { pid, type: pushType.revise, status: auditConst.status.checkNo, content: noticeContent };
+            const defaultNoticeRecord = { pid, tid: selfAuditor.tender_id, type: pushType.revise, status: auditConst.status.checkNo, content: noticeContent };
 
             // 整理当前流程审核人状态更新 warning(在try catch中写,会报auditors未初始化)
             const updateAuditData = audits.map(x => {

+ 3 - 2
app/service/settle_audit.js

@@ -422,6 +422,7 @@ module.exports = app => {
                 const noticeContent = await this._getNoticeContent(this.ctx.session.sessionProject.id, settle.tid, settle.id, accountId, opinion);
                 const defaultNoticeRecord = {
                     pid: this.ctx.session.sessionProject.id,
+                    tid: settle.tid,
                     type: pushType.settle,
                     status: auditConst.settle.status.checked,
                     content: noticeContent,
@@ -549,7 +550,7 @@ module.exports = app => {
             try {
                 // 添加提醒
                 const noticeContent = await this._getNoticeContent(pid, selfAudit.tid, settle.id, selfAudit.audit_id, opinion);
-                const defaultNoticeRecord = { pid, type: pushType.settle, status: auditConst.settle.status.checkNo, content: noticeContent };
+                const defaultNoticeRecord = { pid, tid: selfAudit.tid, type: pushType.settle, status: auditConst.settle.status.checkNo, content: noticeContent };
                 const records = settle.userIds.map(x => {
                     return { uid: x, ...defaultNoticeRecord };
                 });
@@ -612,7 +613,7 @@ module.exports = app => {
                 // 添加通知
                 const noticeContent = await this._getNoticeContent(pid, settle.tid, settle.id, selfAudit.audit_id, opinion);
                 const defaultNoticeRecord = {
-                    pid, type: pushType.settle, status: auditConst.settle.status.checkNoPre, content: noticeContent,
+                    pid, tid: settle.tid, type: pushType.settle, status: auditConst.settle.status.checkNoPre, content: noticeContent,
                 };
                 const records = settle.userIds.map(x => {
                     return { uid: x, ...defaultNoticeRecord };

+ 3 - 0
app/service/stage_audit.js

@@ -442,6 +442,7 @@ module.exports = app => {
                 const auditors = await this.getAuditGroupByListWithOwner(stageId, times);
                 const defaultNoticeRecord = {
                     pid,
+                    tid: stageInfo.tid,
                     type: pushType.stage,
                     status: auditConst.status.checked,
                     content: noticeContent,
@@ -664,6 +665,7 @@ module.exports = app => {
                 const noticeContent = await this.getNoticeContent(pid, selfAudit.tid, stageId, selfAudit.aid, checkData.opinion);
                 const defaultNoticeRecord = {
                     pid,
+                    tid: selfAudit.tid,
                     type: pushType.stage,
                     status: auditConst.status.checkNo,
                     content: noticeContent,
@@ -791,6 +793,7 @@ module.exports = app => {
                 const noticeContent = await this.getNoticeContent(pid, selfAudit.tid, stageId, selfAudit.aid, checkData.opinion);
                 const defaultNoticeRecord = {
                     pid,
+                    tid: selfAudit.tid,
                     type: pushType.stage,
                     status: auditConst.status.checkNoPre,
                     content: noticeContent,

+ 8 - 0
sql/update.sql

@@ -71,6 +71,10 @@ ALTER TABLE `zh_tender`
 ADD COLUMN `filter_budget` tinyint(4) UNSIGNED NOT NULL DEFAULT 0 COMMENT '动态投资-是否过滤' AFTER `spid`,
 ADD COLUMN `filter_fund` tinyint(4) UNSIGNED NOT NULL DEFAULT 0 COMMENT '资金监管-是否过滤' AFTER `filter_budget`;
 
+ALTER TABLE `zh_notice`
+ADD COLUMN `spid` varchar(36) NULL DEFAULT '' COMMENT '子项目id' AFTER `pid`,
+ADD COLUMN `tid` int(11) NULL DEFAULT NULL COMMENT '标段id' AFTER `spid`;
+
 ------------------------------------
 -- 表数据
 ------------------------------------
@@ -82,3 +86,7 @@ Update zh_project_col_set SET pid = id;
 Update zh_payment_folder SET folder_id = id;
 
 INSERT INTO `zh_permission` (`id`, `name`, `controller`, `action`, `pid`, `icon_class`, `create_time`, `isshow`) VALUES (77, '项目设置', 'project', 'sp-pageshow', 38, 'sp-pageshow', NULL, 1);
+
+UPDATE zh_notice SET tid = JSON_UNQUOTE(JSON_EXTRACT(content, '$.tid')) WHERE tid IS NULL;
+
+UPDATE zh_notice SET spid = JSON_UNQUOTE(JSON_EXTRACT(content, '$.spid')) WHERE spid = '';