|
@@ -250,6 +250,23 @@ module.exports = app => {
|
|
|
await transaction.update(this.tableName, data);
|
|
|
}
|
|
|
|
|
|
+ async updateAdvanceCache(tid) {
|
|
|
+ const advance_tp = await this.ctx.service.advance.getSumAdvance(tender.id);
|
|
|
+ await this.db.update(this.tableName, { id: tid, advance_tp });
|
|
|
+ }
|
|
|
+
|
|
|
+ async updateChangeCache(tid) {
|
|
|
+ const sql = `SELECT SUM(cast (total_price as decimal(18,6))) AS total_price, SUM(cast (positive_tp as decimal(18,6))) AS positive_tp, SUM(cast (negative_tp as decimal(18,6))) AS negative_tp
|
|
|
+ FROM ${this.ctx.service.change.tableName} WHERE tid = ? AND status = ? And valid = 1`;
|
|
|
+ const changeSum = await this.db.queryOne(sql, [tender.id, auditConst.flow.status.checked]);
|
|
|
+ await this.db.update(this.tableName, { id: tid, change_tp: changeSum.total_price || 0 });
|
|
|
+ }
|
|
|
+
|
|
|
+ async updateContractPriceCache(tender) {
|
|
|
+ const tenderInfo = await this.ctx.service.tenderInfo.getTenderInfo(tender.id, tender.project_id);
|
|
|
+ await this.db.update(this.tableName, { id: tender.id, contract_price: tenderInfo.deal_param.contractPrice || 0 });
|
|
|
+ }
|
|
|
+
|
|
|
async _refreshLedgerRela(tender, data) {
|
|
|
data.ledger_status = tender.ledger_status || 0;
|
|
|
if (tender.ledger_status === auditConst.ledger.status.uncheck) {
|