|
@@ -138,6 +138,11 @@ module.exports = app => {
|
|
|
return await this.getAuditorStagePay(pid, stage.id, stage.curTimes, stage.curOrder);
|
|
|
}
|
|
|
|
|
|
+ async resortStagePays(stage, stagePays) {
|
|
|
+ if (stage.status !== auditConst.stage.status.checked) return;
|
|
|
+ stagePays.sort((x, y) => { return x.porder - y.porder; });
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 获取某期合同支付数据
|
|
|
*
|
|
@@ -145,7 +150,9 @@ module.exports = app => {
|
|
|
* @returns {Promise<*>}
|
|
|
*/
|
|
|
async getStagePays(stage) {
|
|
|
- return await this.getAuditorStageData(stage.id, stage.curTimes, stage.curOrder);
|
|
|
+ const result = await this.getAuditorStageData(stage.id, stage.curTimes, stage.curOrder);
|
|
|
+ this.resortStagePays(stage, result);
|
|
|
+ return result;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -166,7 +173,8 @@ module.exports = app => {
|
|
|
' WHERE SP.`sid` = ? AND P.`valid` = true' +
|
|
|
' ORDER BY P.`order`';
|
|
|
const sqlParam = [sid, sid];
|
|
|
- return await this.db.query(sql, sqlParam);
|
|
|
+ const result = await this.db.query(sql, sqlParam);
|
|
|
+ return result;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -485,6 +493,11 @@ module.exports = app => {
|
|
|
throw err;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ async cacheOrder(stage, transaction) {
|
|
|
+ const sql = `UPDATE ${this.tableName} sp LEFT JOIN ${this.ctx.service.pay.tableName} p ON sp.pid = p.id SET sp.porder = p.\`order\` Where sp.sid = ?`;
|
|
|
+ await transaction.query(sql, [stage.id]);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
return StagePay;
|