|
@@ -30,7 +30,7 @@ module.exports = app => {
|
|
// ***** 查询审批人相关
|
|
// ***** 查询审批人相关
|
|
// 获取全部参与人
|
|
// 获取全部参与人
|
|
async getAuditors(phaseId, auditTimes) {
|
|
async getAuditors(phaseId, auditTimes) {
|
|
- return await this.getAllDataByCondition({ where: { phase_id: phaseId, audit_times: auditTimes } }); // 全部参与的审批人
|
|
|
|
|
|
+ return await this.getAllDataByCondition({ where: { phase_id: phaseId, audit_times: auditTimes }, orders: [['active_order', 'asc']] }); // 全部参与的审批人
|
|
}
|
|
}
|
|
// 获取全部参与人 分组
|
|
// 获取全部参与人 分组
|
|
async getAuditorGroup(phaseId, auditTimes) {
|
|
async getAuditorGroup(phaseId, auditTimes) {
|
|
@@ -141,8 +141,8 @@ module.exports = app => {
|
|
*/
|
|
*/
|
|
async _syncAuditOrder(transaction, phaseId, auditOrder, auditTimes, selfOperate = '-') {
|
|
async _syncAuditOrder(transaction, phaseId, auditOrder, auditTimes, selfOperate = '-') {
|
|
const sql = `Update ${this.tableName} SET audit_order = audit_order${selfOperate}1, active_order = active_order${selfOperate}1
|
|
const sql = `Update ${this.tableName} SET audit_order = audit_order${selfOperate}1, active_order = active_order${selfOperate}1
|
|
- WHERE master_id = ? and master_type = ? and audit_times = ? and active_order >= ?`;
|
|
|
|
- return await transaction.query(sql, [phaseId, this.masterType, times, order]);
|
|
|
|
|
|
+ WHERE phase_id = ? and audit_times = ? and active_order >= ?`;
|
|
|
|
+ return await transaction.query(sql, [phaseId, auditTimes, auditOrder]);
|
|
}
|
|
}
|
|
/**
|
|
/**
|
|
* 新增审核人
|
|
* 新增审核人
|
|
@@ -329,7 +329,8 @@ module.exports = app => {
|
|
try {
|
|
try {
|
|
const audit_time = new Date();
|
|
const audit_time = new Date();
|
|
// 更新原报数据
|
|
// 更新原报数据
|
|
- await transaction.update(this.tableName, { audit_status: auditConst.phasePay.status.checked, audit_time }, { where: { phase_id: phasePay.id, audit_times: phasePay.audit_times, audit_order: 0 } });
|
|
|
|
|
|
+ await transaction.update(this.tableName, { audit_status: auditConst.phasePay.status.checked, audit_time },
|
|
|
|
+ { where: { phase_id: phasePay.id, audit_times: phasePay.audit_times, audit_order: 0 } });
|
|
// 更新下一审批人数据
|
|
// 更新下一审批人数据
|
|
const updateData = audits.map(x => { return { id: x.id, audit_status: auditConst.phasePay.status.checking } });
|
|
const updateData = audits.map(x => { return { id: x.id, audit_status: auditConst.phasePay.status.checking } });
|
|
await transaction.updateRows(this.tableName, updateData);
|
|
await transaction.updateRows(this.tableName, updateData);
|
|
@@ -352,9 +353,9 @@ module.exports = app => {
|
|
tips: wxConst.tips.check,
|
|
tips: wxConst.tips.check,
|
|
code: this.ctx.session.sessionProject.code,
|
|
code: this.ctx.session.sessionProject.code,
|
|
};
|
|
};
|
|
- await this.ctx.helper.sendWechat(users, smsTypeConst.const.JS, smsTypeConst.judge.approval.toString(), wxConst.template.phasePay, wechatData);
|
|
|
|
|
|
+ await this.ctx.helper.sendWechat(users, smsTypeConst.const.PAY, smsTypeConst.judge.approval.toString(), wxConst.template.phasePay, wechatData);
|
|
for (const a of audits) {
|
|
for (const a of audits) {
|
|
- await this.ctx.service.noticeAgain.addNoticeAgain(transaction, smsTypeConst.const.JS, {
|
|
|
|
|
|
+ await this.ctx.service.noticeAgain.addNoticeAgain(transaction, smsTypeConst.const.PAY, {
|
|
pid: this.ctx.session.sessionProject.id,
|
|
pid: this.ctx.session.sessionProject.id,
|
|
tid: phasePay.tid,
|
|
tid: phasePay.tid,
|
|
uid: a.audit_id,
|
|
uid: a.audit_id,
|
|
@@ -402,7 +403,8 @@ module.exports = app => {
|
|
audit_time: time,
|
|
audit_time: time,
|
|
});
|
|
});
|
|
await this.ctx.service.noticeAgain.stopNoticeAgain(transaction, this.tableName, selfAudit.id);
|
|
await this.ctx.service.noticeAgain.stopNoticeAgain(transaction, this.tableName, selfAudit.id);
|
|
- let auditStatus;
|
|
|
|
|
|
+ // 计算合同支付
|
|
|
|
+ const paySum = await this.ctx.service.phasePayDetail.calculateSave(phasePay, transaction);
|
|
if (phasePay.curAuditors.length === 1 || selfAudit.audit_type === auditType.key.or) {
|
|
if (phasePay.curAuditors.length === 1 || selfAudit.audit_type === auditType.key.or) {
|
|
// 或签更新他人审批状态
|
|
// 或签更新他人审批状态
|
|
if (selfAudit.audit_type === auditType.key.or) {
|
|
if (selfAudit.audit_type === auditType.key.or) {
|
|
@@ -420,11 +422,17 @@ module.exports = app => {
|
|
if (updateOther.length > 0) transaction.updateRows(this.tableName, updateOther);
|
|
if (updateOther.length > 0) transaction.updateRows(this.tableName, updateOther);
|
|
}
|
|
}
|
|
// 无下一审核人表示,审核结束
|
|
// 无下一审核人表示,审核结束
|
|
- auditStatus = nextAudits.length > 0 ? auditConst.phasePay.status.checking : auditConst.phasePay.status.checked;
|
|
|
|
if (nextAudits.length > 0) {
|
|
if (nextAudits.length > 0) {
|
|
// 流程至下一审批人
|
|
// 流程至下一审批人
|
|
const updateData = nextAudits.map(x => { return { id: x.id, audit_status: auditConst.phasePay.status.checking }; });
|
|
const updateData = nextAudits.map(x => { return { id: x.id, audit_status: auditConst.phasePay.status.checking }; });
|
|
await transaction.updateRows(this.tableName, updateData);
|
|
await transaction.updateRows(this.tableName, updateData);
|
|
|
|
+ // 计算合同支付
|
|
|
|
+ const paySum = await this.ctx.service.phasePayDetail.calculateSave(phasePay, transaction);
|
|
|
|
+ await transaction.update(this.ctx.service.phasePay.tableName, {
|
|
|
|
+ id: phasePay.id, audit_max_sort: selfAudit.active_order + 1, audit_status: auditConst.phasePay.status.checking, ...paySum
|
|
|
|
+ });
|
|
|
|
+ // 拷贝新流程合同支付
|
|
|
|
+ await this.ctx.service.phasePayDetail.initPhaseDataByAudit(transaction, phasePay, phasePay.audit_times, selfAudit.active_order + 1);
|
|
|
|
|
|
// todo 添加短信通知-需要审批提醒功能
|
|
// todo 添加短信通知-需要审批提醒功能
|
|
const shenpiUrl = await this.ctx.helper.urlToShort(this.ctx.protocol + '://' + this.ctx.host + '/wap/tender/' + this.ctx.tender.id + '/phasePay/' + phasePay.phase_order);
|
|
const shenpiUrl = await this.ctx.helper.urlToShort(this.ctx.protocol + '://' + this.ctx.host + '/wap/tender/' + this.ctx.tender.id + '/phasePay/' + phasePay.phase_order);
|
|
@@ -437,9 +445,9 @@ module.exports = app => {
|
|
tips: wxConst.tips.check,
|
|
tips: wxConst.tips.check,
|
|
code: this.ctx.session.sessionProject.code,
|
|
code: this.ctx.session.sessionProject.code,
|
|
};
|
|
};
|
|
- await this.ctx.helper.sendWechat(users, smsTypeConst.const.JS, smsTypeConst.judge.approval.toString(), wxConst.template.phasePay, wechatData);
|
|
|
|
|
|
+ await this.ctx.helper.sendWechat(users, smsTypeConst.const.PAY, smsTypeConst.judge.approval.toString(), wxConst.template.phasePay, wechatData);
|
|
for (const a of nextAudits) {
|
|
for (const a of nextAudits) {
|
|
- await this.ctx.service.noticeAgain.addNoticeAgain(transaction, smsTypeConst.const.JS, {
|
|
|
|
|
|
+ await this.ctx.service.noticeAgain.addNoticeAgain(transaction, smsTypeConst.const.PAY, {
|
|
pid: this.ctx.session.sessionProject.id,
|
|
pid: this.ctx.session.sessionProject.id,
|
|
tid: this.ctx.tender.id,
|
|
tid: this.ctx.tender.id,
|
|
uid: a.audit_id,
|
|
uid: a.audit_id,
|
|
@@ -451,6 +459,12 @@ module.exports = app => {
|
|
});
|
|
});
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
|
|
+ const final_auditor_str = (selfAudit.audit_type === auditType.key.common)
|
|
|
|
+ ? `${selfAudit.name}${(selfAudit.role ? '-' + selfAudit.role : '')}`
|
|
|
|
+ : ctx.helper.transFormToChinese(selfAudit.audit_order) + '审';
|
|
|
|
+ await transaction.update(this.ctx.service.phasePay.tableName, {
|
|
|
|
+ id: phasePay.id, audit_end_time: time, audit_status: auditConst.phasePay.status.checked, final_auditor_str, ...paySum
|
|
|
|
+ });
|
|
// 添加短信通知-审批通过提醒功能
|
|
// 添加短信通知-审批通过提醒功能
|
|
const users = this._.uniq(phasePay.userIds);
|
|
const users = this._.uniq(phasePay.userIds);
|
|
// 微信模板通知
|
|
// 微信模板通知
|
|
@@ -462,17 +476,16 @@ module.exports = app => {
|
|
tips: wxConst.tips.success,
|
|
tips: wxConst.tips.success,
|
|
code: this.ctx.session.sessionProject.code,
|
|
code: this.ctx.session.sessionProject.code,
|
|
};
|
|
};
|
|
- await this.ctx.helper.sendWechat(users, smsTypeConst.const.JS, smsTypeConst.judge.result.toString(), wxConst.template.phasePay, wechatData);
|
|
|
|
|
|
+ await this.ctx.helper.sendWechat(users, smsTypeConst.const.PAY, smsTypeConst.judge.result.toString(), wxConst.template.phasePay, wechatData);
|
|
// todo 审批通过 - 检查三方特殊推送
|
|
// todo 审批通过 - 检查三方特殊推送
|
|
// await this.ctx.service.specMsg.addPhasePayMsg(transaction, this.ctx.session.sessionProject.id, phasePay, pushOperate.phasePay.checked);
|
|
// await this.ctx.service.specMsg.addPhasePayMsg(transaction, this.ctx.session.sessionProject.id, phasePay, pushOperate.phasePay.checked);
|
|
}
|
|
}
|
|
// todo 上报/审批 - 检查三方特殊推送
|
|
// todo 上报/审批 - 检查三方特殊推送
|
|
// await this.ctx.service.specMsg.addPhasePayMsg(transaction, this.ctx.session.sessionProject.id, phasePay, pushOperate.phasePay.flow);
|
|
// await this.ctx.service.specMsg.addPhasePayMsg(transaction, this.ctx.session.sessionProject.id, phasePay, pushOperate.phasePay.flow);
|
|
} else {
|
|
} else {
|
|
- auditStatus = auditConst.phasePay.status.checking;
|
|
|
|
|
|
+ // 同步 期信息
|
|
|
|
+ await transaction.update(this.ctx.service.phasePay.tableName, { id: phasePay.id, audit_status: auditConst.phasePay.status.checking, ...paySum });
|
|
}
|
|
}
|
|
- // 同步 期信息
|
|
|
|
- await transaction.update(this.ctx.service.phasePay.tableName, { id: phasePay.id, audit_status: auditStatus });
|
|
|
|
await transaction.commit();
|
|
await transaction.commit();
|
|
} catch (err) {
|
|
} catch (err) {
|
|
await transaction.rollback();
|
|
await transaction.rollback();
|
|
@@ -518,9 +531,12 @@ module.exports = app => {
|
|
await transaction.updateRows(this.tableName, updateData);
|
|
await transaction.updateRows(this.tableName, updateData);
|
|
await this.ctx.service.noticeAgain.stopNoticeAgain(transaction, this.tableName, this._.map(updateData, 'id'));
|
|
await this.ctx.service.noticeAgain.stopNoticeAgain(transaction, this.tableName, this._.map(updateData, 'id'));
|
|
// 更新 期信息
|
|
// 更新 期信息
|
|
|
|
+ const paySum = await this.ctx.service.phasePayDetail.calculateSave(phasePay, transaction);
|
|
await transaction.update(this.ctx.service.phasePay.tableName, {
|
|
await transaction.update(this.ctx.service.phasePay.tableName, {
|
|
- id: phasePay.id, audit_status: auditConst.phasePay.status.checkNo, audit_times: phasePay.audit_times + 1,
|
|
|
|
|
|
+ id: phasePay.id, audit_status: auditConst.phasePay.status.checkNo, audit_times: phasePay.audit_times + 1, audit_max_sort: 0, ...paySum
|
|
});
|
|
});
|
|
|
|
+ // 拷贝新流程合同支付
|
|
|
|
+ await this.ctx.service.phasePayDetail.initPhaseDataByAudit(transaction, phasePay, phasePay.audit_times + 1, 0);
|
|
// 拷贝新一次审核流程列表
|
|
// 拷贝新一次审核流程列表
|
|
await transaction.insert(this.tableName, newAuditors);
|
|
await transaction.insert(this.tableName, newAuditors);
|
|
|
|
|
|
@@ -535,7 +551,7 @@ module.exports = app => {
|
|
tips: wxConst.tips.back,
|
|
tips: wxConst.tips.back,
|
|
code: this.ctx.session.sessionProject.code,
|
|
code: this.ctx.session.sessionProject.code,
|
|
};
|
|
};
|
|
- await this.ctx.helper.sendWechat(users, smsTypeConst.const.JS, smsTypeConst.judge.result.toString(), wxConst.template.phasePay, wechatData);
|
|
|
|
|
|
+ await this.ctx.helper.sendWechat(users, smsTypeConst.const.PAY, smsTypeConst.judge.result.toString(), wxConst.template.phasePay, wechatData);
|
|
// todo 上报/审批 - 检查三方特殊推送
|
|
// todo 上报/审批 - 检查三方特殊推送
|
|
// await this.ctx.service.specMsg.addPhasePayMsg(transaction, this.ctx.session.sessionProject.id, phasePay, pushOperate.phasePay.flow);
|
|
// await this.ctx.service.specMsg.addPhasePayMsg(transaction, this.ctx.session.sessionProject.id, phasePay, pushOperate.phasePay.flow);
|
|
await transaction.commit();
|
|
await transaction.commit();
|
|
@@ -614,12 +630,14 @@ module.exports = app => {
|
|
const preAuditorIds = preAuditors.map(x => { return x.audit_id; });
|
|
const preAuditorIds = preAuditors.map(x => { return x.audit_id; });
|
|
|
|
|
|
// 同步 期信息
|
|
// 同步 期信息
|
|
|
|
+ const paySum = await this.ctx.service.phasePayDetail.calculateSave(phasePay, transaction);
|
|
await transaction.update(this.ctx.service.phasePay.tableName, {
|
|
await transaction.update(this.ctx.service.phasePay.tableName, {
|
|
- id: phasePay.id, audit_status: auditConst.phasePay.status.checkNoPre,
|
|
|
|
|
|
+ id: phasePay.id, audit_max_sort: selfAudit.active_order + 1, ...paySum,
|
|
});
|
|
});
|
|
|
|
+ // 拷贝新流程合同支付
|
|
|
|
+ await this.ctx.service.phasePayDetail.initPhaseDataByAudit(transaction, phasePay, phasePay.audit_times, selfAudit.active_order + 1);
|
|
const shenpiUrl = await this.ctx.helper.urlToShort(this.ctx.protocol + '://' + this.ctx.host + '/wap/tender/' + phasePay.tid + '/phasePay/' + phasePay.phase_order);
|
|
const shenpiUrl = await this.ctx.helper.urlToShort(this.ctx.protocol + '://' + this.ctx.host + '/wap/tender/' + phasePay.tid + '/phasePay/' + phasePay.phase_order);
|
|
- const users = this._.map(phasePay.auditAssists.filter(x => {return preAuditorIds.indexOf(x.user_id) >= 0 }), 'ass_user_id');
|
|
|
|
- users.push(...preAuditorIds);
|
|
|
|
|
|
+ const users = preAuditorIds;
|
|
// 微信模板通知
|
|
// 微信模板通知
|
|
const wechatData = {
|
|
const wechatData = {
|
|
wap_url: shenpiUrl,
|
|
wap_url: shenpiUrl,
|
|
@@ -628,9 +646,9 @@ module.exports = app => {
|
|
tips: wxConst.tips.check,
|
|
tips: wxConst.tips.check,
|
|
code: this.ctx.session.sessionProject.code,
|
|
code: this.ctx.session.sessionProject.code,
|
|
};
|
|
};
|
|
- await this.ctx.helper.sendWechat(users, smsTypeConst.const.JS, smsTypeConst.judge.approval.toString(), wxConst.template.phasePay, wechatData);
|
|
|
|
|
|
+ await this.ctx.helper.sendWechat(users, smsTypeConst.const.PAY, smsTypeConst.judge.approval.toString(), wxConst.template.phasePay, wechatData);
|
|
for (const a of newAuditors) {
|
|
for (const a of newAuditors) {
|
|
- await this.ctx.service.noticeAgain.addNoticeAgain(transaction, smsTypeConst.const.JS, {
|
|
|
|
|
|
+ await this.ctx.service.noticeAgain.addNoticeAgain(transaction, smsTypeConst.const.PAY, {
|
|
pid: this.ctx.session.sessionProject.id,
|
|
pid: this.ctx.session.sessionProject.id,
|
|
tid: phasePay.tid,
|
|
tid: phasePay.tid,
|
|
uid: a.audit_id,
|
|
uid: a.audit_id,
|
|
@@ -706,8 +724,10 @@ module.exports = app => {
|
|
|
|
|
|
// 同步 期信息
|
|
// 同步 期信息
|
|
await transaction.update(this.ctx.service.phasePay.tableName, {
|
|
await transaction.update(this.ctx.service.phasePay.tableName, {
|
|
- id: phasePay.id, audit_status: auditConst.phasePay.status.checking,
|
|
|
|
|
|
+ id: phasePay.id, audit_status: auditConst.phasePay.status.checking, audit_end_time: null, final_auditor_str: '', audit_max_sort: finalAudit.active_order + 2,
|
|
});
|
|
});
|
|
|
|
+ // 拷贝新流程合同支付
|
|
|
|
+ await this.ctx.service.phasePayDetail.initPhaseDataByAudit(transaction, phasePay, phasePay.audit_times + 1, finalAudit.active_order + 2);
|
|
|
|
|
|
// todo 添加短信通知-需要审批提醒功能
|
|
// todo 添加短信通知-需要审批提醒功能
|
|
const shenpiUrl = await this.ctx.helper.urlToShort(this.ctx.protocol + '://' + this.ctx.host + '/wap/tender/' + phasePay.tid + '/phasePay/' + phasePay.phase_order);
|
|
const shenpiUrl = await this.ctx.helper.urlToShort(this.ctx.protocol + '://' + this.ctx.host + '/wap/tender/' + phasePay.tid + '/phasePay/' + phasePay.phase_order);
|
|
@@ -721,9 +741,9 @@ module.exports = app => {
|
|
tips: wxConst.tips.check,
|
|
tips: wxConst.tips.check,
|
|
code: this.ctx.session.sessionProject.code,
|
|
code: this.ctx.session.sessionProject.code,
|
|
};
|
|
};
|
|
- await this.ctx.helper.sendWechat(users, smsTypeConst.const.JS, smsTypeConst.judge.approval.toString(), wxConst.template.phasePay, wechatData);
|
|
|
|
|
|
+ await this.ctx.helper.sendWechat(users, smsTypeConst.const.PAY, smsTypeConst.judge.approval.toString(), wxConst.template.phasePay, wechatData);
|
|
for (const a of checkingAuditors) {
|
|
for (const a of checkingAuditors) {
|
|
- await this.ctx.service.noticeAgain.addNoticeAgain(transaction, smsTypeConst.const.JS, {
|
|
|
|
|
|
+ await this.ctx.service.noticeAgain.addNoticeAgain(transaction, smsTypeConst.const.PAY, {
|
|
pid: this.ctx.session.sessionProject.id,
|
|
pid: this.ctx.session.sessionProject.id,
|
|
tid: phasePay.tid,
|
|
tid: phasePay.tid,
|
|
uid: a.audit_id,
|
|
uid: a.audit_id,
|
|
@@ -746,7 +766,7 @@ module.exports = app => {
|
|
* 原报撤回,直接改动审批人状态
|
|
* 原报撤回,直接改动审批人状态
|
|
* 如果存在审批人数据,将其改为原报流程数据,但保留原提交人
|
|
* 如果存在审批人数据,将其改为原报流程数据,但保留原提交人
|
|
*
|
|
*
|
|
- * 一审 1 A checking -> A uncheck status改 pay/jl:删0(jl为增量数据,只删重复部分) 1->0 删1
|
|
|
|
|
|
+ * 一审 1 A checking -> A uncheck status改 pay:1->0 删1
|
|
* ...
|
|
* ...
|
|
*
|
|
*
|
|
* @param phasePay
|
|
* @param phasePay
|
|
@@ -754,7 +774,6 @@ module.exports = app => {
|
|
* @private
|
|
* @private
|
|
*/
|
|
*/
|
|
async _userCheckCancel(phasePay) {
|
|
async _userCheckCancel(phasePay) {
|
|
-
|
|
|
|
const transaction = await this.db.beginTransaction();
|
|
const transaction = await this.db.beginTransaction();
|
|
try {
|
|
try {
|
|
// 整理当前流程审核人状态更新
|
|
// 整理当前流程审核人状态更新
|
|
@@ -768,9 +787,14 @@ module.exports = app => {
|
|
await transaction.updateRows(this.tableName, updateData);
|
|
await transaction.updateRows(this.tableName, updateData);
|
|
await this.ctx.service.noticeAgain.deleteNoticeAgain(transaction, this.tableName, this._.map(updateData, 'id'));
|
|
await this.ctx.service.noticeAgain.deleteNoticeAgain(transaction, this.tableName, this._.map(updateData, 'id'));
|
|
await transaction.update(this.ctx.service.phasePay.tableName, {
|
|
await transaction.update(this.ctx.service.phasePay.tableName, {
|
|
- id: phasePay.id, audit_times: phasePay.audit_times,
|
|
|
|
|
|
+ id: phasePay.id, audit_times: phasePay.audit_times, audit_max_sort: 0,
|
|
audit_status: phasePay.audit_times === 1 ? auditConst.phasePay.status.uncheck : auditConst.phasePay.status.checkNo,
|
|
audit_status: phasePay.audit_times === 1 ? auditConst.phasePay.status.uncheck : auditConst.phasePay.status.checkNo,
|
|
});
|
|
});
|
|
|
|
+ await transaction.delete(this.ctx.service.phasePayDetail.tableName,
|
|
|
|
+ { phase_id: phasePay.id, audit_times: phasePay.audit_times, audit_sort: 0});
|
|
|
|
+ await transaction.update(this.ctx.service.phasePayDetail.tableName,
|
|
|
|
+ { audit_sort: 0, master_id: phasePay.id + '-' + phasePay.audit_times + '-0' },
|
|
|
|
+ { where: { phase_id: phasePay.id, audit_times: phasePay.audit_times, audit_sort: 1 } });
|
|
|
|
|
|
// todo 上报/审批 - 检查三方特殊推送
|
|
// todo 上报/审批 - 检查三方特殊推送
|
|
// await this.ctx.service.specMsg.addPhasePayMsg(transaction, this.ctx.session.sessionProject.id, phasePay, pushOperate.phasePay.flow);
|
|
// await this.ctx.service.specMsg.addPhasePayMsg(transaction, this.ctx.session.sessionProject.id, phasePay, pushOperate.phasePay.flow);
|
|
@@ -811,7 +835,7 @@ module.exports = app => {
|
|
tid: phasePay.tid, phase_id: phasePay.id, audit_id: x.audit_id,
|
|
tid: phasePay.tid, phase_id: phasePay.id, audit_id: x.audit_id,
|
|
audit_times: x.audit_times, active_order: x.active_order + 1,
|
|
audit_times: x.audit_times, active_order: x.active_order + 1,
|
|
audit_type: x.audit_type, audit_order: x.audit_order,
|
|
audit_type: x.audit_type, audit_order: x.audit_order,
|
|
- status: x.audit_id === selfAuditor.audit_id ? auditConst.phasePay.status.checkCancel : auditConst.phasePay.status.checkSkip,
|
|
|
|
|
|
+ audit_status: x.audit_id === selfAuditor.audit_id ? auditConst.phasePay.status.checkCancel : auditConst.phasePay.status.checkSkip,
|
|
audit_time: time, opinion: '',
|
|
audit_time: time, opinion: '',
|
|
name: x.name, company: x.company, role: x.role, mobile: x.mobile,
|
|
name: x.name, company: x.company, role: x.role, mobile: x.mobile,
|
|
});
|
|
});
|
|
@@ -821,7 +845,7 @@ module.exports = app => {
|
|
tid: phasePay.tid, phase_id: phasePay.id, audit_id: x.audit_id,
|
|
tid: phasePay.tid, phase_id: phasePay.id, audit_id: x.audit_id,
|
|
audit_times: x.audit_times, active_order: x.active_order + 2,
|
|
audit_times: x.audit_times, active_order: x.active_order + 2,
|
|
audit_type: x.audit_type, audit_order: x.audit_order,
|
|
audit_type: x.audit_type, audit_order: x.audit_order,
|
|
- status: auditConst.phasePay.status.checking,
|
|
|
|
|
|
+ audit_status: auditConst.phasePay.status.checking,
|
|
audit_time: time, opinion: '',
|
|
audit_time: time, opinion: '',
|
|
name: x.name, company: x.company, role: x.role, mobile: x.mobile,
|
|
name: x.name, company: x.company, role: x.role, mobile: x.mobile,
|
|
});
|
|
});
|
|
@@ -829,8 +853,9 @@ module.exports = app => {
|
|
await transaction.insert(this.tableName, [...checkCancelAuditors, ...checkingAuditors]);
|
|
await transaction.insert(this.tableName, [...checkCancelAuditors, ...checkingAuditors]);
|
|
// 当前审批人变成待审批
|
|
// 当前审批人变成待审批
|
|
await transaction.updateRows(this.tableName, phasePay.curAuditors.map(x => { return {
|
|
await transaction.updateRows(this.tableName, phasePay.curAuditors.map(x => { return {
|
|
- id: x.id, audit_time: null, status: auditConst.phasePay.status.uncheck, active_order: x.active_order + 2
|
|
|
|
|
|
+ id: x.id, audit_time: null, audit_status: auditConst.phasePay.status.uncheck, active_order: x.active_order + 2
|
|
}}));
|
|
}}));
|
|
|
|
+ await this.ctx.service.phasePayDetail.initPhaseDataByAuditCancel(transaction, phasePay, phasePay.audit_times, selfAuditor.active_order + 1, phasePay.audit_times, selfAuditor.active_order + 2);
|
|
await this.ctx.service.noticeAgain.deleteNoticeAgain(transaction, this.tableName, this._.map(phasePay.curAuditors, 'id'));
|
|
await this.ctx.service.noticeAgain.deleteNoticeAgain(transaction, this.tableName, this._.map(phasePay.curAuditors, 'id'));
|
|
// 同步 期信息
|
|
// 同步 期信息
|
|
await transaction.update(this.ctx.service.phasePay.tableName, {
|
|
await transaction.update(this.ctx.service.phasePay.tableName, {
|
|
@@ -887,8 +912,9 @@ module.exports = app => {
|
|
|
|
|
|
// 同步 期信息
|
|
// 同步 期信息
|
|
await transaction.update(this.ctx.service.phasePay.tableName, {
|
|
await transaction.update(this.ctx.service.phasePay.tableName, {
|
|
- id: phasePay.id, audit_times: phasePay.audit_times, status: auditConst.phasePay.status.checking,
|
|
|
|
|
|
+ id: phasePay.id, audit_times: phasePay.audit_times, audit_status: auditConst.phasePay.status.checking,
|
|
});
|
|
});
|
|
|
|
+ await this.ctx.service.phasePayDetail.initPhaseDataByAuditCancel(transaction, phasePay, phasePay.audit_times, selfAuditor.active_order + 1, phasePay.audit_times, selfAuditor.active_order + 2);
|
|
// todo 上报/审批 - 检查三方特殊推送
|
|
// todo 上报/审批 - 检查三方特殊推送
|
|
// await this.ctx.service.specMsg.addPhasePayMsg(transaction, this.ctx.session.sessionProject.id, phasePay, pushOperate.phasePay.flow);
|
|
// await this.ctx.service.specMsg.addPhasePayMsg(transaction, this.ctx.session.sessionProject.id, phasePay, pushOperate.phasePay.flow);
|
|
await transaction.commit();
|
|
await transaction.commit();
|
|
@@ -944,8 +970,11 @@ module.exports = app => {
|
|
|
|
|
|
// 计算并合同支付最终数据
|
|
// 计算并合同支付最终数据
|
|
await transaction.update(this.ctx.service.phasePay.tableName, {
|
|
await transaction.update(this.ctx.service.phasePay.tableName, {
|
|
- id: phasePay.id, audit_times: phasePay.audit_times - 1, status: auditConst.phasePay.status.checking,
|
|
|
|
|
|
+ id: phasePay.id, audit_times: phasePay.audit_times - 1, audit_status: auditConst.phasePay.status.checking,
|
|
});
|
|
});
|
|
|
|
+ await transaction.update(this.ctx.service.phasePayDetail.tableName,
|
|
|
|
+ { audit_times: selfAuditor.audit_times, audit_sort: selfAuditor.active_order + 2, master_id: `${phasePay.id}-${selfAuditor.audit_times}-${selfAuditor.active_order + 2}` },
|
|
|
|
+ { where: { phase_id: phasePay.id, audit_times: phasePay.audit_times, audit_sort: 0 } });
|
|
// todo 上报/审批 - 检查三方特殊推送
|
|
// todo 上报/审批 - 检查三方特殊推送
|
|
// await this.ctx.service.specMsg.addPhasePayMsg(transaction, this.ctx.session.sessionProject.id, phasePay, pushOperate.phasePay.flow);
|
|
// await this.ctx.service.specMsg.addPhasePayMsg(transaction, this.ctx.session.sessionProject.id, phasePay, pushOperate.phasePay.flow);
|
|
await transaction.commit();
|
|
await transaction.commit();
|
|
@@ -969,7 +998,7 @@ module.exports = app => {
|
|
const transaction = await this.db.beginTransaction();
|
|
const transaction = await this.db.beginTransaction();
|
|
try {
|
|
try {
|
|
await transaction.update(this.tableName, {
|
|
await transaction.update(this.tableName, {
|
|
- id: selfAuditor.id, status: auditConst.phasePay.status.checking, opinion: '', audit_time: null,
|
|
|
|
|
|
+ id: selfAuditor.id, audit_status: auditConst.phasePay.status.checking, opinion: '', audit_time: null,
|
|
});
|
|
});
|
|
await transaction.commit();
|
|
await transaction.commit();
|
|
} catch(err) {
|
|
} catch(err) {
|