|
@@ -376,7 +376,7 @@ module.exports = app => {
|
|
|
|
|
|
async getTp(tenderId, status) {
|
|
async getTp(tenderId, status) {
|
|
if (this.ctx.tender.isTourist && status === 0) {
|
|
if (this.ctx.tender.isTourist && status === 0) {
|
|
- const sql5 = 'SELECT SUM(total_price) AS total_price FROM ?? WHERE tid = ?';
|
|
|
|
|
|
+ const sql5 = 'SELECT SUM(cast (total_price as decimal(18,6))) AS total_price FROM ?? WHERE tid = ?';
|
|
const sqlParam5 = [this.tableName, tenderId];
|
|
const sqlParam5 = [this.tableName, tenderId];
|
|
const result5 = await this.db.query(sql5, sqlParam5);
|
|
const result5 = await this.db.query(sql5, sqlParam5);
|
|
return result5[0].total_price ? result5[0].total_price : 0;
|
|
return result5[0].total_price ? result5[0].total_price : 0;
|
|
@@ -384,7 +384,7 @@ module.exports = app => {
|
|
switch (status) {
|
|
switch (status) {
|
|
case 0: // 包含你的所有变更令
|
|
case 0: // 包含你的所有变更令
|
|
const sql =
|
|
const sql =
|
|
- 'SELECT SUM(a.total_price) AS total_price FROM ?? AS a WHERE a.tid = ? AND ' +
|
|
|
|
|
|
+ 'SELECT SUM(cast (a.total_price as decimal(18,6))) AS total_price FROM ?? AS a WHERE a.tid = ? AND ' +
|
|
'(a.uid = ? OR (a.status != ? AND a.cid IN (SELECT b.cid FROM ?? AS b WHERE b.uid = ? AND a.times = b.times GROUP BY b.cid)) OR a.status = ? )';
|
|
'(a.uid = ? OR (a.status != ? AND a.cid IN (SELECT b.cid FROM ?? AS b WHERE b.uid = ? AND a.times = b.times GROUP BY b.cid)) OR a.status = ? )';
|
|
const sqlParam = [
|
|
const sqlParam = [
|
|
this.tableName,
|
|
this.tableName,
|
|
@@ -398,13 +398,13 @@ module.exports = app => {
|
|
const result = await this.db.query(sql, sqlParam);
|
|
const result = await this.db.query(sql, sqlParam);
|
|
return result[0].total_price ? result[0].total_price : 0;
|
|
return result[0].total_price ? result[0].total_price : 0;
|
|
case 1: // 待处理(你的)
|
|
case 1: // 待处理(你的)
|
|
- const sql6 = 'SELECT SUM(a.total_price) AS total_price FROM ?? as a WHERE cid in(SELECT b.cid FROM ?? as b WHERE tid = ? AND uid = ? AND status = ?)';
|
|
|
|
|
|
+ const sql6 = 'SELECT SUM(cast (a.total_price as decimal(18,6))) AS total_price FROM ?? as a WHERE cid in(SELECT b.cid FROM ?? as b WHERE tid = ? AND uid = ? AND status = ?)';
|
|
const sqlParam6 = [this.tableName, this.ctx.service.changeAudit.tableName, tenderId, this.ctx.session.sessionUser.accountId, audit.flow.auditStatus.checking];
|
|
const sqlParam6 = [this.tableName, this.ctx.service.changeAudit.tableName, tenderId, this.ctx.session.sessionUser.accountId, audit.flow.auditStatus.checking];
|
|
const result6 = await this.db.query(sql6, sqlParam6);
|
|
const result6 = await this.db.query(sql6, sqlParam6);
|
|
return result6[0].total_price ? result6[0].total_price : 0;
|
|
return result6[0].total_price ? result6[0].total_price : 0;
|
|
case 5: // 待上报(所有的)PS:取未上报,退回,修订的变更令
|
|
case 5: // 待上报(所有的)PS:取未上报,退回,修订的变更令
|
|
const sql2 =
|
|
const sql2 =
|
|
- 'SELECT SUM(a.total_price) AS total_price FROM ?? AS a WHERE ' +
|
|
|
|
|
|
+ 'SELECT SUM(cast (a.total_price as decimal(18,6))) AS total_price FROM ?? AS a WHERE ' +
|
|
'a.cid IN (SELECT b.cid FROM ?? AS b WHERE b.uid = ? AND a.times = b.times GROUP BY b.cid) ' +
|
|
'a.cid IN (SELECT b.cid FROM ?? AS b WHERE b.uid = ? AND a.times = b.times GROUP BY b.cid) ' +
|
|
'AND (a.status = ? OR a.status = ? OR a.status = ?) AND a.tid = ?';
|
|
'AND (a.status = ? OR a.status = ? OR a.status = ?) AND a.tid = ?';
|
|
const sqlParam2 = [
|
|
const sqlParam2 = [
|
|
@@ -421,13 +421,13 @@ module.exports = app => {
|
|
case 2: // 进行中(所有的)
|
|
case 2: // 进行中(所有的)
|
|
case 4: // 终止(所有的)
|
|
case 4: // 终止(所有的)
|
|
const sql3 =
|
|
const sql3 =
|
|
- 'SELECT SUM(a.total_price) AS total_price FROM ?? AS a WHERE ' +
|
|
|
|
|
|
+ 'SELECT SUM(cast (a.total_price as decimal(18,6))) AS total_price FROM ?? AS a WHERE ' +
|
|
'a.cid IN (SELECT b.cid FROM ?? AS b WHERE b.uid = ? AND a.times = b.times GROUP BY b.cid) AND a.status = ? AND a.tid = ?';
|
|
'a.cid IN (SELECT b.cid FROM ?? AS b WHERE b.uid = ? AND a.times = b.times GROUP BY b.cid) AND a.status = ? AND a.tid = ?';
|
|
const sqlParam3 = [this.tableName, this.ctx.service.changeAudit.tableName, this.ctx.session.sessionUser.accountId, status, tenderId];
|
|
const sqlParam3 = [this.tableName, this.ctx.service.changeAudit.tableName, this.ctx.session.sessionUser.accountId, status, tenderId];
|
|
const result3 = await this.db.query(sql3, sqlParam3);
|
|
const result3 = await this.db.query(sql3, sqlParam3);
|
|
return result3[0].total_price ? result3[0].total_price : 0;
|
|
return result3[0].total_price ? result3[0].total_price : 0;
|
|
case 3: // 已完成(所有的)
|
|
case 3: // 已完成(所有的)
|
|
- const sql4 = 'SELECT SUM(total_price) AS total_price FROM ?? WHERE status = ? AND tid = ?';
|
|
|
|
|
|
+ const sql4 = 'SELECT SUM(cast (total_price as decimal(18,6))) AS total_price FROM ?? WHERE status = ? AND tid = ?';
|
|
const sqlParam4 = [this.tableName, status, tenderId];
|
|
const sqlParam4 = [this.tableName, status, tenderId];
|
|
const result4 = await this.db.query(sql4, sqlParam4);
|
|
const result4 = await this.db.query(sql4, sqlParam4);
|
|
return result4[0].total_price ? result4[0].total_price : 0;
|
|
return result4[0].total_price ? result4[0].total_price : 0;
|