|
@@ -603,101 +603,101 @@ module.exports = app => {
|
|
|
await transaction.updateRows(this.tableName, updateOther);
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
- // 无下一审核人表示,审核结束
|
|
|
- if (nextAuditors.length > 0) {
|
|
|
- const nextAuditUpdateData = nextAuditors.map(x => { return { id: x.id, status: auditConst.status.checking, begin_time: time }});
|
|
|
- await transaction.updateRows(this.tableName, nextAuditUpdateData);
|
|
|
-
|
|
|
- // 短信通知-需要审批提醒功能
|
|
|
- const nextAuditorIds = nextAuditors.map(x => { return x.audit_id; });
|
|
|
- await this.ctx.helper.sendAliSms(nextAuditorIds, smsTypeConst.const.XD, smsTypeConst.judge.approval.toString(), SmsAliConst.template.revise_check);
|
|
|
- // 微信模板通知
|
|
|
- const shenpiUrl = await this.ctx.helper.urlToShort(
|
|
|
- this.ctx.protocol + '://' + this.ctx.host + '/wap/tender/' + revise.tid + '/revise/' + revise.id + '/info'
|
|
|
- );
|
|
|
- const wechatData = {
|
|
|
- wap_url: shenpiUrl,
|
|
|
- status: wxConst.status.check,
|
|
|
- tips: wxConst.tips.check,
|
|
|
- code: this.ctx.session.sessionProject.code,
|
|
|
- begin_time: Date.parse(revise.begin_time),
|
|
|
- };
|
|
|
- await this.ctx.helper.sendWechat(nextAuditorIds, smsTypeConst.const.XD, smsTypeConst.judge.approval.toString(), wxConst.template.revise, wechatData);
|
|
|
- for (const audit of nextAuditors) {
|
|
|
- await this.ctx.service.noticeAgain.addNoticeAgain(transaction, smsTypeConst.const.XD, {
|
|
|
- pid: this.ctx.session.sessionProject.id,
|
|
|
- tid: this.ctx.tender.id,
|
|
|
- uid: audit.audit_id,
|
|
|
- sp_type: 'revise',
|
|
|
- sp_id: audit.id,
|
|
|
- table_name: this.tableName,
|
|
|
- template: wxConst.template.revise,
|
|
|
- wx_data: wechatData,
|
|
|
+ // 无下一审核人表示,审核结束
|
|
|
+ if (nextAuditors.length > 0) {
|
|
|
+ const nextAuditUpdateData = nextAuditors.map(x => { return { id: x.id, status: auditConst.status.checking, begin_time: time }});
|
|
|
+ await transaction.updateRows(this.tableName, nextAuditUpdateData);
|
|
|
+
|
|
|
+ // 短信通知-需要审批提醒功能
|
|
|
+ const nextAuditorIds = nextAuditors.map(x => { return x.audit_id; });
|
|
|
+ await this.ctx.helper.sendAliSms(nextAuditorIds, smsTypeConst.const.XD, smsTypeConst.judge.approval.toString(), SmsAliConst.template.revise_check);
|
|
|
+ // 微信模板通知
|
|
|
+ const shenpiUrl = await this.ctx.helper.urlToShort(
|
|
|
+ this.ctx.protocol + '://' + this.ctx.host + '/wap/tender/' + revise.tid + '/revise/' + revise.id + '/info'
|
|
|
+ );
|
|
|
+ const wechatData = {
|
|
|
+ wap_url: shenpiUrl,
|
|
|
+ status: wxConst.status.check,
|
|
|
+ tips: wxConst.tips.check,
|
|
|
+ code: this.ctx.session.sessionProject.code,
|
|
|
+ begin_time: Date.parse(revise.begin_time),
|
|
|
+ };
|
|
|
+ await this.ctx.helper.sendWechat(nextAuditorIds, smsTypeConst.const.XD, smsTypeConst.judge.approval.toString(), wxConst.template.revise, wechatData);
|
|
|
+ for (const audit of nextAuditors) {
|
|
|
+ await this.ctx.service.noticeAgain.addNoticeAgain(transaction, smsTypeConst.const.XD, {
|
|
|
+ pid: this.ctx.session.sessionProject.id,
|
|
|
+ tid: this.ctx.tender.id,
|
|
|
+ uid: audit.audit_id,
|
|
|
+ sp_type: 'revise',
|
|
|
+ sp_id: audit.id,
|
|
|
+ table_name: this.tableName,
|
|
|
+ template: wxConst.template.revise,
|
|
|
+ wx_data: wechatData,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ const users = this._.map(auditList.filter(x => { return x.audit_id !== accountId}), 'audit_id');
|
|
|
+ users.push(revise.uid);
|
|
|
+ await this.ctx.helper.sendAliSms(users, smsTypeConst.const.XD, smsTypeConst.judge.result.toString(), SmsAliConst.template.revise_result2, {
|
|
|
+ status: SmsAliConst.status.success,
|
|
|
});
|
|
|
- }
|
|
|
- const users = this._.map(auditList.filter(x => { return x.audit_id !== accountId}), 'audit_id');
|
|
|
- users.push(revise.uid);
|
|
|
- await this.ctx.helper.sendAliSms(users, smsTypeConst.const.XD, smsTypeConst.judge.result.toString(), SmsAliConst.template.revise_result2, {
|
|
|
- status: SmsAliConst.status.success,
|
|
|
- });
|
|
|
- } else {
|
|
|
- // 同步修订信息
|
|
|
- await transaction.update(this.ctx.service.ledgerRevise.tableName, {
|
|
|
- id: revise.id, status: auditConst.status.checked, end_time: time,
|
|
|
- });
|
|
|
- await this.ctx.service.tenderTag.saveTenderTag(revise.tid, {revise_time: new Date()}, transaction);
|
|
|
- // 最新一期跟台账相关的缓存数据应过期
|
|
|
- const lastStage = await this.ctx.service.stage.getFlowLatestStage(revise.tid, true);
|
|
|
- const cacheTime = new Date();
|
|
|
- if (lastStage) {
|
|
|
- await transaction.update(this.ctx.service.stage.tableName, {
|
|
|
- id: lastStage.id,
|
|
|
- cache_time_l: cacheTime,
|
|
|
- cache_time_r: cacheTime,
|
|
|
+ } else {
|
|
|
+ // 同步修订信息
|
|
|
+ await transaction.update(this.ctx.service.ledgerRevise.tableName, {
|
|
|
+ id: revise.id, status: auditConst.status.checked, end_time: time,
|
|
|
+ });
|
|
|
+ await this.ctx.service.tenderTag.saveTenderTag(revise.tid, {revise_time: new Date()}, transaction);
|
|
|
+ // 最新一期跟台账相关的缓存数据应过期
|
|
|
+ const lastStage = await this.ctx.service.stage.getFlowLatestStage(revise.tid, true);
|
|
|
+ const cacheTime = new Date();
|
|
|
+ if (lastStage) {
|
|
|
+ await transaction.update(this.ctx.service.stage.tableName, {
|
|
|
+ id: lastStage.id,
|
|
|
+ cache_time_l: cacheTime,
|
|
|
+ cache_time_r: cacheTime,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ // 重算台账、计量、工程变更
|
|
|
+ const reviseCalc = new RevisePrice(this.ctx);
|
|
|
+ const pcTp = await reviseCalc.calcRevise(revise, transaction);
|
|
|
+ const sum = revise.sum || await this.ctx.service.reviseBills.addUp({
|
|
|
+ tender_id: revise.tid, /* , is_leaf: true*/
|
|
|
+ });
|
|
|
+ await transaction.update(this.ctx.service.tender.tableName, {
|
|
|
+ id: revise.tid,
|
|
|
+ total_price: sum.total_price, deal_tp: sum.deal_tp,
|
|
|
+ });
|
|
|
+ // 修订附件取消修订中标记
|
|
|
+ await transaction.update(this.ctx.service.ledgerAtt.tableName, { revising: 0 }, { where: { revise_id: revise.id } });
|
|
|
+ // 更新台账缓存
|
|
|
+ await this.ctx.service.tenderCache.updateStageCache4Revise(transaction, revise.tid, sum, pcTp);
|
|
|
+ // 清除变更新增部位maxLid缓存,防止树结构混乱
|
|
|
+ await this.ctx.service.changeLedger._removeCacheMaxLid(revise.tid);
|
|
|
+
|
|
|
+ // 短信通知-审批通过提醒功能
|
|
|
+ await this.ctx.helper.sendAliSms(revise.uid, smsTypeConst.const.XD, smsTypeConst.judge.result.toString(), SmsAliConst.template.revise_result, {
|
|
|
+ status: SmsAliConst.status.success,
|
|
|
});
|
|
|
+ const users = this._.pull(this._.map(auditList, 'audit_id'), revise.uid);
|
|
|
+ await this.ctx.helper.sendAliSms(users, smsTypeConst.const.XD, smsTypeConst.judge.result.toString(), SmsAliConst.template.revise_result2, {
|
|
|
+ status: SmsAliConst.status.success,
|
|
|
+ });
|
|
|
+ users.push(revise.uid);
|
|
|
+ // 微信模板通知
|
|
|
+ const shenpiUrl = await this.ctx.helper.urlToShort(
|
|
|
+ this.ctx.protocol + '://' + this.ctx.host + '/wap/tender/' + revise.tid + '/revise/' + revise.id + '/info'
|
|
|
+ );
|
|
|
+ const wechatData2 = {
|
|
|
+ wap_url: shenpiUrl,
|
|
|
+ status: wxConst.status.success,
|
|
|
+ tips: wxConst.tips.success,
|
|
|
+ begin_time: Date.parse(revise.begin_time),
|
|
|
+ code: this.ctx.session.sessionProject.code,
|
|
|
+ };
|
|
|
+ await this.ctx.helper.sendWechat(users, smsTypeConst.const.XD, smsTypeConst.judge.result.toString(), wxConst.template.revise, wechatData2);
|
|
|
+ // 审批通过 - 检查三方特殊推送
|
|
|
+ await this.ctx.service.specMsg.addReviseMsg(transaction, pid, revise, pushOperate.ledger.checked);
|
|
|
}
|
|
|
- // 重算台账、计量、工程变更
|
|
|
- const reviseCalc = new RevisePrice(this.ctx);
|
|
|
- const pcTp = await reviseCalc.calcRevise(revise, transaction);
|
|
|
- const sum = revise.sum || await this.ctx.service.reviseBills.addUp({
|
|
|
- tender_id: revise.tid, /* , is_leaf: true*/
|
|
|
- });
|
|
|
- await transaction.update(this.ctx.service.tender.tableName, {
|
|
|
- id: revise.tid,
|
|
|
- total_price: sum.total_price, deal_tp: sum.deal_tp,
|
|
|
- });
|
|
|
- // 修订附件取消修订中标记
|
|
|
- await transaction.update(this.ctx.service.ledgerAtt.tableName, { revising: 0 }, { where: { revise_id: revise.id } });
|
|
|
- // 更新台账缓存
|
|
|
- await this.ctx.service.tenderCache.updateStageCache4Revise(transaction, revise.tid, sum, pcTp);
|
|
|
- // 清除变更新增部位maxLid缓存,防止树结构混乱
|
|
|
- await this.ctx.service.changeLedger._removeCacheMaxLid(revise.tid);
|
|
|
-
|
|
|
- // 短信通知-审批通过提醒功能
|
|
|
- await this.ctx.helper.sendAliSms(revise.uid, smsTypeConst.const.XD, smsTypeConst.judge.result.toString(), SmsAliConst.template.revise_result, {
|
|
|
- status: SmsAliConst.status.success,
|
|
|
- });
|
|
|
- const users = this._.pull(this._.map(auditList, 'audit_id'), revise.uid);
|
|
|
- await this.ctx.helper.sendAliSms(users, smsTypeConst.const.XD, smsTypeConst.judge.result.toString(), SmsAliConst.template.revise_result2, {
|
|
|
- status: SmsAliConst.status.success,
|
|
|
- });
|
|
|
- users.push(revise.uid);
|
|
|
- // 微信模板通知
|
|
|
- const shenpiUrl = await this.ctx.helper.urlToShort(
|
|
|
- this.ctx.protocol + '://' + this.ctx.host + '/wap/tender/' + revise.tid + '/revise/' + revise.id + '/info'
|
|
|
- );
|
|
|
- const wechatData2 = {
|
|
|
- wap_url: shenpiUrl,
|
|
|
- status: wxConst.status.success,
|
|
|
- tips: wxConst.tips.success,
|
|
|
- begin_time: Date.parse(revise.begin_time),
|
|
|
- code: this.ctx.session.sessionProject.code,
|
|
|
- };
|
|
|
- await this.ctx.helper.sendWechat(users, smsTypeConst.const.XD, smsTypeConst.judge.result.toString(), wxConst.template.revise, wechatData2);
|
|
|
- // 审批通过 - 检查三方特殊推送
|
|
|
- await this.ctx.service.specMsg.addReviseMsg(transaction, pid, revise, pushOperate.ledger.checked);
|
|
|
}
|
|
|
await transaction.commit();
|
|
|
} catch (err) {
|