|
@@ -33,7 +33,6 @@ module.exports = app => {
|
|
|
item.curAuditor2 = await this.ctx.service.advanceAudit.getAuditorByStatus(item.id, auditConst.status.checking);
|
|
|
}
|
|
|
}
|
|
|
- console.log(advance);
|
|
|
return advance;
|
|
|
}
|
|
|
|
|
@@ -113,9 +112,12 @@ module.exports = app => {
|
|
|
*/
|
|
|
async calcProgress(latest, payTotal) {
|
|
|
const { ctx } = this;
|
|
|
- const surplus = ctx.helper.sub(payTotal, latest.prev_total_amount);
|
|
|
- const p_ratio = ctx.helper.mul(ctx.helper.div(latest.prev_amount, payTotal), 100, 2); // 截止上期金额总数
|
|
|
- const c_ratio = ctx.helper.mul(ctx.helper.div(latest.cur_amount, payTotal), 100, 0); // 截止本期金额总数
|
|
|
+ if (!latest) {
|
|
|
+ latest = { prev_total_amount: 0, prev_amount: 0, cur_amount: 0 };
|
|
|
+ }
|
|
|
+ const surplus = ctx.helper.sub(payTotal, latest.prev_total_amount || 0);
|
|
|
+ const p_ratio = ctx.helper.mul(ctx.helper.div(latest.prev_amount || 0, payTotal), 100, 2); // 截止上期金额总数
|
|
|
+ const c_ratio = ctx.helper.mul(ctx.helper.div(latest.cur_amount || 0, payTotal), 100, 0); // 截止本期金额总数
|
|
|
const s_ratio = ctx.helper.mul(ctx.helper.div(surplus, payTotal), 100, 0); // 剩余金额总数
|
|
|
return {
|
|
|
p_amount: latest.prev_amount,
|