Browse Source

报表,越权取资金监管数据

MaiXinRong 2 months ago
parent
commit
8a28ce2f48
1 changed files with 21 additions and 8 deletions
  1. 21 8
      app/lib/rm/tender_financial.js

+ 21 - 8
app/lib/rm/tender_financial.js

@@ -1,10 +1,10 @@
 'use strict';
 
 /**
- *
+ * 
  *
  * @author Mai
- * @date
+ * @date 20250613
  * @version
  */
 
@@ -13,25 +13,38 @@ class reportMemoryFinancial {
         this.ctx = ctx;
     }
 
+    async checkTender(tid) {
+        this.tender = this.ctx.tender ? this.ctx.tender : await this.ctx.tender.getDataById(tid);
+    }
+
     async pay(tid) {
-        return await this.ctx.service.financialPay.getAllDataByCondition({ where: { tid }});
+        await this.checkTender(tid);
+        if (!this.tender || !this.tender.spid) return [];
+        return await this.ctx.service.financialPay.getAllDataByCondition({ where: { spid: this.tender.spid }});
     }
 
     async payContract(tid) {
-        return await this.ctx.service.financialPayContract.getAllDataByCondition({ where: { tid } });
+        await this.checkTender(tid);
+        if (!this.tender || !this.tender.spid) return [];
+        return await this.ctx.service.financialPayContract.getAllDataByCondition({ where: { spid: this.tender.spid } });
     }
 
     async payTender(tid) {
-        return await this.ctx.service.financialPayTender.getAllDataByCondition({ where: { tid } });
+        await this.checkTender(tid);
+        if (!this.tender || !this.tender.spid) return [];
+        return await this.ctx.service.financialPayTender.getAllDataByCondition({ where: { spid: this.tender.spid } });
     }
 
     async transfer(tid) {
-        const tender = this.ctx.tender ? this.ctx.tender : await this.ctx.tender.getDataById(tid);
-        return await this.ctx.service.financialTransfer.getAllDataByCondition({ where: { spid: tender.spid } });
+        await this.checkTender(tid);
+        if (!this.tender || !this.tender.spid) return [];
+        return await this.ctx.service.financialTransfer.getAllDataByCondition({ where: { spid: this.tender.spid } });
     }
 
     async transferTender(tid) {
-        return await this.ctx.service.financialTransferTender.getAllDataByCondition({ where: { tid } });
+        await this.checkTender(tid);
+        if (!this.tender || !this.tender.spid) return [];
+        return await this.ctx.service.financialTransferTender.getAllDataByCondition({ where: { spid: this.tender.spid } });
     }
 }