|
@@ -856,10 +856,12 @@ module.exports = app => {
|
|
|
});
|
|
|
});
|
|
|
await this.transaction.insert('zh_notice', records);
|
|
|
-
|
|
|
+ // 判断是否终审方法需要更改了,因为存在修改审批流程的操作,会使判断是否终审有问题
|
|
|
+ const curAudit = await this.ctx.service.changeAudit.getCurAuditor(changeData.cid, changeData.times);
|
|
|
+ const nextAudit = await this.ctx.service.changeAudit.getDataByCondition({ cid: changeData.cid, times: changeData.times, usort: curAudit.usort + 1, status: audit.flow.auditStatus.uncheck });
|
|
|
// 设置审批人通过
|
|
|
const audit_update = {
|
|
|
- id: postData.audit_id,
|
|
|
+ id: curAudit.id,
|
|
|
sdesc: postData.sdesc,
|
|
|
status: audit.flow.auditStatus.checked,
|
|
|
sin_time: new Date(),
|
|
@@ -896,7 +898,7 @@ module.exports = app => {
|
|
|
await this.transaction.update(this.ctx.service.changeAuditList.tableName, list_update);
|
|
|
}
|
|
|
}
|
|
|
- if (postData.audit_next_id === undefined) {
|
|
|
+ if (!nextAudit) {
|
|
|
// 变更令审批完成
|
|
|
change_update.status = audit.flow.status.checked;
|
|
|
change_update.p_code = postData.p_code;
|
|
@@ -935,20 +937,19 @@ module.exports = app => {
|
|
|
} else {
|
|
|
// 设置下一个审批人为审批状态
|
|
|
const nextAudit_update = {
|
|
|
- id: postData.audit_next_id,
|
|
|
+ id: nextAudit.id,
|
|
|
status: audit.flow.auditStatus.checking,
|
|
|
sin_time: new Date(),
|
|
|
};
|
|
|
await this.transaction.update(this.ctx.service.changeAudit.tableName, nextAudit_update);
|
|
|
|
|
|
// 添加短信通知-需要审批提醒功能
|
|
|
- const nextAuditData = await this.ctx.service.changeAudit.getDataById(postData.audit_next_id);
|
|
|
const sms = new SMS(this.ctx);
|
|
|
const code = await sms.contentChange(changeData.code);
|
|
|
const shenpiUrl = await this.ctx.helper.urlToShort(
|
|
|
this.ctx.protocol + '://' + this.ctx.host + '/wap/tender/' + changeData.tid + '/change/' + changeData.cid + '/information#shenpi'
|
|
|
);
|
|
|
- await this.ctx.helper.sendAliSms(nextAuditData.uid, smsTypeConst.const.BG, smsTypeConst.judge.approval.toString(), SmsAliConst.template.change_check, {
|
|
|
+ await this.ctx.helper.sendAliSms(nextAudit.uid, smsTypeConst.const.BG, smsTypeConst.judge.approval.toString(), SmsAliConst.template.change_check, {
|
|
|
biangeng: code,
|
|
|
code: shenpiUrl,
|
|
|
});
|
|
@@ -960,7 +961,7 @@ module.exports = app => {
|
|
|
code: this.ctx.session.sessionProject.code,
|
|
|
c_name: changeData.name,
|
|
|
};
|
|
|
- await this.ctx.helper.sendWechat(nextAuditData.uid, smsTypeConst.const.BG, smsTypeConst.judge.approval.toString(), wxConst.template.change, wechatData);
|
|
|
+ await this.ctx.helper.sendWechat(nextAudit.uid, smsTypeConst.const.BG, smsTypeConst.judge.approval.toString(), wxConst.template.change, wechatData);
|
|
|
}
|
|
|
change_update.total_price = total_price;
|
|
|
const options = {
|
|
@@ -1690,7 +1691,7 @@ module.exports = app => {
|
|
|
const updateChangeList = [];
|
|
|
for (const cl of changeList) {
|
|
|
const audit_amount = cl.audit_amount.split(',');
|
|
|
- const last_amount = audit_amount[audit_amount.length - 1];
|
|
|
+ const last_amount = audit_amount[audit_amount.length - 1] ? audit_amount[audit_amount.length - 1] : 0;
|
|
|
audit_amount.splice(-1, 1);
|
|
|
const list_update = {
|
|
|
id: cl.id,
|
|
@@ -1740,6 +1741,7 @@ module.exports = app => {
|
|
|
await this.ctx.helper.sendWechat(zsAudit.uid, smsTypeConst.const.BG, smsTypeConst.judge.approval.toString(), wxConst.template.change, wechatData);
|
|
|
|
|
|
} catch (error) {
|
|
|
+ console.log(error);
|
|
|
await this.transaction.rollback();
|
|
|
result = false;
|
|
|
}
|