|
@@ -1394,7 +1394,7 @@ module.exports = app => {
|
|
|
* @param auditorId
|
|
|
* @return {Promise<*>}
|
|
|
*/
|
|
|
- async getAuditGroupByList(stageId, times) {
|
|
|
+ async getAuditGroupByList(stageId, times, transaction = false) {
|
|
|
// const sql =
|
|
|
// 'SELECT la.`aid`, pa.`name`, pa.`company`, pa.`role`, la.`times`, la.`sid`, la.`aid`, la.`order`, la.`status`' +
|
|
|
// ' FROM ?? AS la Left Join ?? AS pa On la.`aid` = pa.`id` ' +
|
|
@@ -1406,7 +1406,7 @@ module.exports = app => {
|
|
|
' LEFT JOIN ?? la ON sa.`aid` = la.`aid` AND sa.`order` = la.`order`' +
|
|
|
' Left JOIN ?? AS pa On la.`aid` = pa.`id` WHERE la.`sid` = ? and la.`times` = ? and la.`is_old` = ? order BY la.`order`';
|
|
|
const sqlParam = [this.tableName, stageId, times, 0, this.tableName, this.ctx.service.projectAccount.tableName, stageId, times, 0];
|
|
|
- return await this.db.query(sql, sqlParam);
|
|
|
+ return transaction !== false ? await transaction.query(sql, sqlParam) : await this.db.query(sql, sqlParam);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -1736,7 +1736,6 @@ module.exports = app => {
|
|
|
try {
|
|
|
const auditors = await this.getAuditGroupByList(stageId, times);
|
|
|
const now_audit = this._.find(auditors, { aid: data.old_aid });
|
|
|
- console.log(now_audit);
|
|
|
if (data.operate === 'add') {
|
|
|
if (now_audit.status !== auditConst.status.uncheck && now_audit.status !== auditConst.status.checking) {
|
|
|
throw '当前人下无法操作新增';
|
|
@@ -1783,6 +1782,11 @@ module.exports = app => {
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
+ if (this.ctx.tender.info.shenpi.stage === shenpiConst.sp_status.gdspl || this.ctx.tender.info.shenpi.stage === shenpiConst.sp_status.gdzs) {
|
|
|
+ const newAuditors = await this.getAuditGroupByList(stageId, times, transaction);
|
|
|
+ await this.ctx.service.shenpiAudit.updateAuditList(transaction, this.ctx.tender.id, this.ctx.tender.info.shenpi.stage, shenpiConst.sp_type.stage, this._.map(newAuditors, 'aid'));
|
|
|
+ }
|
|
|
+ // 更新到审批流程方法
|
|
|
await transaction.commit();
|
|
|
} catch (err) {
|
|
|
await transaction.rollback();
|