From 785dbd08597884e5a9ef927c5f6dca26d635ea1f Mon Sep 17 00:00:00 2001 From: "jay.chang" Date: Tue, 5 Mar 2024 11:54:37 +0800 Subject: [PATCH] =?UTF-8?q?[WebApi]=E6=B0=B4=E9=9B=BB=E5=A0=B1=E8=A1=A8Bug?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- FrontendWebApi/ApiControllers/TenantBillController.cs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/FrontendWebApi/ApiControllers/TenantBillController.cs b/FrontendWebApi/ApiControllers/TenantBillController.cs index f98ef55..c5e1593 100644 --- a/FrontendWebApi/ApiControllers/TenantBillController.cs +++ b/FrontendWebApi/ApiControllers/TenantBillController.cs @@ -314,16 +314,14 @@ namespace FrontendWebApi.ApiControllers string checkDataSql = $@"(SELECT sum(sub_result) FROM ( {month} ) combined_result - WHERE start_timestamp BETWEEN '{start_timestamp}' and '{end_timestamp}' - GROUP BY device_number) "; + WHERE start_timestamp BETWEEN '{start_timestamp}' and '{end_timestamp}') "; var existData = await backendRepository.GetAllAsync(checkDataSql); if (existData.Count != 0) { - result = $@"(SELECT sum(sub_result) + result = $@"(SELECT ROUND(sum(sub_result)) FROM ( {month} ) combined_result - WHERE start_timestamp BETWEEN '{start_timestamp}' and '{end_timestamp}' - GROUP BY device_number) "; + WHERE start_timestamp BETWEEN '{start_timestamp}' and '{end_timestamp}') "; } sqlString = $@"UPDATE {TenantBilltable} @@ -416,6 +414,7 @@ namespace FrontendWebApi.ApiControllers { t.start_timestamp = tb.start_timestamp; t.end_timestamp = tb.end_timestamp; + t.tableType = t.device_name_tag == "E4" ? "elec": "water"; await UpdateTenantBill(t); } }