|
@@ -1450,7 +1450,7 @@ module.exports = app => {
|
|
|
jobs: auditList[0].jobs,
|
|
|
company: auditList[0].company,
|
|
|
times: changeData.times,
|
|
|
- usite: lastauditInfo.usite + 1,
|
|
|
+ usite: 0,
|
|
|
usort,
|
|
|
status: audit.flow.auditStatus.revise,
|
|
|
sin_time: new Date(),
|
|
@@ -1532,9 +1532,43 @@ module.exports = app => {
|
|
|
this.transaction = await this.db.beginTransaction();
|
|
|
let result = false;
|
|
|
try {
|
|
|
+ const changeData = await this.getDataByCondition({ cid });
|
|
|
+ const pid = this.ctx.session.sessionProject.id;
|
|
|
+ // 获取所有审核人列表
|
|
|
+ const auditors = await this.ctx.service.changeAudit.getAllAuditors(changeData.tid);
|
|
|
+ // 添加到消息推送表
|
|
|
+ const noticeContent = await this.getNoticeContent(pid, changeData.tid, changeData.cid, this.ctx.session.sessionUser.accountId, '撤销重新审批');
|
|
|
+ const records = [];
|
|
|
+ auditors.forEach(auditor => {
|
|
|
+ records.push({
|
|
|
+ pid,
|
|
|
+ type: pushType.change,
|
|
|
+ uid: auditor.uid,
|
|
|
+ status: audit.flow.status.checked,
|
|
|
+ content: noticeContent,
|
|
|
+ });
|
|
|
+ });
|
|
|
+ await this.transaction.insert('zh_notice', records);
|
|
|
await this.ctx.service.changeHistory.returnHistory(this.transaction, cid);
|
|
|
await this.transaction.delete(this.ctx.service.changeAudit.tableName, { cid, times });
|
|
|
await this.transaction.delete(this.ctx.service.changeHistory.tableName, { cid });
|
|
|
+
|
|
|
+ const lastauditInfo = await this.ctx.service.changeAudit.getLastUser(cid, times - 1, 1, 0);
|
|
|
+ // 新增一个撤销修订状态到审批流程中
|
|
|
+ const revise_audit = {
|
|
|
+ tid: lastauditInfo.tid,
|
|
|
+ cid,
|
|
|
+ uid: this.ctx.session.sessionUser.accountId,
|
|
|
+ name: lastauditInfo.name,
|
|
|
+ jobs: lastauditInfo.jobs,
|
|
|
+ company: lastauditInfo.company,
|
|
|
+ times: times - 1,
|
|
|
+ usite: 0,
|
|
|
+ usort: lastauditInfo.usort + 1,
|
|
|
+ status: audit.flow.auditStatus.cancelRevise,
|
|
|
+ sin_time: new Date(),
|
|
|
+ };
|
|
|
+ await this.transaction.insert(this.ctx.service.changeAudit.tableName, revise_audit);
|
|
|
await this.transaction.commit();
|
|
|
result = true;
|
|
|
} catch (error) {
|