Browse Source

修复wap计量期统计数据bug

ellisran 6 months atrás
parent
commit
d4fb04dcbc
1 changed files with 13 additions and 0 deletions
  1. 13 0
      app/controller/wap_controller.js

+ 13 - 0
app/controller/wap_controller.js

@@ -335,6 +335,19 @@ module.exports = app => {
                 //     await this.ctx.service.stage.checkStageGatherData(lastStage);
                 // }
                 const stage = ctx.stage;
+                if (stage) {
+                    await this.ctx.service.stage.checkStageGatherData(stage);
+                    stage.tp = this.ctx.helper.sum([stage.contract_tp, stage.qc_tp, stage.pc_tp]);
+                    stage.pre_tp = this.ctx.helper.add(stage.pre_contract_tp, stage.pre_qc_tp);
+                    stage.end_tp = this.ctx.helper.add(stage.pre_tp, stage.tp);
+                    // if (stage.yf_tp && stage.sf_tp === 0) {
+                    //     const sf = await this.ctx.service.stagePay.getHistorySf(stage);
+                    //     if (sf && stage.readOnly) {
+                    //         await this.ctx.service.stage.update({ sf_tp: sf.tp, pre_sf_tp: sf.pre_tp }, { id: stage.id });
+                    //     }
+                    //     stage.sf_tp = sf ? sf.tp : 0;
+                    // }
+                }
                 await ctx.service.stage.loadStageAuditViewData(stage);
                 const renderData = {
                     moment,