更新水電報表api

This commit is contained in:
張家睿 2024-01-23 14:41:38 +08:00
parent 718f2768f7
commit 5c8abc1f19
5 changed files with 86 additions and 82 deletions

View File

@ -9,6 +9,7 @@ using System.IO;
using static FrontendWebApi.Models.Bill; using static FrontendWebApi.Models.Bill;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using System.Text.Json; using System.Text.Json;
using Newtonsoft.Json.Linq;
// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860 // For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
@ -17,8 +18,8 @@ namespace FrontendWebApi.ApiControllers
{ {
//[Route("api/[controller]")] //[Route("api/[controller]")]
//[ApiController] //[ApiController]
public class TenantBillController //public class TenantBillController
//public class TenantBillController : MyBaseApiController<TenantBillController> public class TenantBillController : MyBaseApiController<TenantBillController>
{ {
private readonly IBackendRepository backendRepository; private readonly IBackendRepository backendRepository;
@ -60,7 +61,7 @@ namespace FrontendWebApi.ApiControllers
} }
[HttpPost] [HttpPost]
public async Task<ApiResult<string>> AddOneTenantList(TenantList tl) public async Task<ApiResult<string>> AddOneTenantList([FromBody] TenantList tl)
{ {
ApiResult<string> apiResult = new ApiResult<string>(); ApiResult<string> apiResult = new ApiResult<string>();
@ -91,7 +92,7 @@ namespace FrontendWebApi.ApiControllers
} }
[HttpPost] [HttpPost]
public async Task<ApiResult<string>> UpdateOneTenantList(TenantList tl) public async Task<ApiResult<string>> UpdateOneTenantList([FromBody] TenantList tl)
{ {
ApiResult<string> apiResult = new ApiResult<string>(); ApiResult<string> apiResult = new ApiResult<string>();
@ -122,7 +123,7 @@ namespace FrontendWebApi.ApiControllers
} }
[HttpPost] [HttpPost]
public async Task<ApiResult<string>> DelOneTenantList(TenantList tl) public async Task<ApiResult<string>> DelOneTenantList([FromBody] TenantList tl)
{ {
ApiResult<string> apiResult = new ApiResult<string>(); ApiResult<string> apiResult = new ApiResult<string>();
@ -144,13 +145,21 @@ namespace FrontendWebApi.ApiControllers
return apiResult; return apiResult;
} }
public class MyJsonData
{
public string Name { get; set; }
public int Age { get; set; }
}
[HttpPost] [HttpPost]
public async Task<ApiResult<List<TenantBill>>> GetTenantBill(string tableType, string building_tag) public async Task<ApiResult<List<TenantBill>>> GetTenantBill([FromBody] TenantBill tb)
{ {
ApiResult<List<TenantBill>> apiResult = new ApiResult<List<TenantBill>>(); ApiResult<List<TenantBill>> apiResult = new ApiResult<List<TenantBill>>();
List<TenantBill> tenantBill = new List<TenantBill>(); List<TenantBill> tenantBill = new List<TenantBill>();
try try
{ {
string tableType = tb.tableType;
string building_tag = tb.building_tag;
string ElecOrWater = tableType == "elec" ? "E4" : "W1"; string ElecOrWater = tableType == "elec" ? "E4" : "W1";
string sqlString = null; string sqlString = null;
if (building_tag == "ALL") if (building_tag == "ALL")
@ -193,13 +202,13 @@ namespace FrontendWebApi.ApiControllers
} }
[HttpPost] [HttpPost]
public async Task<ApiResult<string>> UpdateTenantBill(TenantBill tb, string tableType) public async Task<ApiResult<string>> UpdateTenantBill([FromBody] TenantBill tb)
{ {
ApiResult<string> apiResult = new ApiResult<string>(); ApiResult<string> apiResult = new ApiResult<string>();
try try
{ {
string bill_per = tableType == "elec" ? "bill_perKWH" : "bill_perRCV"; string bill_per = tb.tableType == "elec" ? "bill_perKWH" : "bill_perRCV";
var updated_at = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); var updated_at = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
var start_timestamp = tb.start_timestamp.ToString("yyyy-MM-dd HH:mm:ss"); var start_timestamp = tb.start_timestamp.ToString("yyyy-MM-dd HH:mm:ss");
var end_timestamp = tb.end_timestamp.ToString("yyyy-MM-dd HH:mm:ss"); var end_timestamp = tb.end_timestamp.ToString("yyyy-MM-dd HH:mm:ss");

View File

@ -11,6 +11,7 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="Autodesk.Forge" Version="1.9.7" /> <PackageReference Include="Autodesk.Forge" Version="1.9.7" />
<PackageReference Include="Haukcode.WkHtmlToPdfDotNet" Version="1.5.86" />
<PackageReference Include="iTextSharp" Version="5.5.13.2" /> <PackageReference Include="iTextSharp" Version="5.5.13.2" />
<PackageReference Include="Microsoft.AspNet.WebApi.Cors" Version="5.2.7" /> <PackageReference Include="Microsoft.AspNet.WebApi.Cors" Version="5.2.7" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="3.1.21" /> <PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="3.1.21" />

View File

@ -34,8 +34,11 @@ namespace FrontendWebApi.Models
public string updated_by { get; set; } public string updated_by { get; set; }
public DateTime? updated_at { get; set; } public DateTime? updated_at { get; set; }
public string tenant_guid { get; set; } public string tenant_guid { get; set; }
public string tableType { get; set; }
public string building_tag { get; set; }
} }
public class OutputBill public class OutputBill
{ {
public string tenant_name { get; set; } public string tenant_name { get; set; }

View File

@ -13,40 +13,39 @@
"JwtLifeSeconds": 3600 "JwtLifeSeconds": 3600
}, },
"DBConfig": { "DBConfig": {
"MySqlDBConfig": { "MySqlDBConfig": {
"Server": "FYlY+w0XDIz+jmF2rlZWJw==", //0.201 "Server": "CYGthbCeGtAXT4s1NOSJHQ==", //0.132
"Port": "js2LutKe+rdjzdxMPQUrvQ==", "Port": "mkF51jVbg40V5K5eTh2Ckw==",
//"Database": "VJB2XC+lAtzuHObDGMVOAA==", //30 //"Database": "VJB2XC+lAtzuHObDGMVOAA==", //30
//"Database": "IgYBsgG2VLKKxFb64j7LOA==", //wsp //"Database": "IgYBsgG2VLKKxFb64j7LOA==", //wsp
//"Database": "7gWfmZ28HGIJZbxEbK+0yg==", //tpe_dome_dome "Database": "7gWfmZ28HGIJZbxEbK+0yg==", //tpe_dome_dome
"Database": "+5RAiFLJVU+LRyDxF1K/pcLZaoZa4k/thZqF6xKoCag=", //dome_online_0821
//"Database": "siTUcDaC/g2yGTMFWD72Kg==", //tpe_dome_hotel //"Database": "siTUcDaC/g2yGTMFWD72Kg==", //tpe_dome_hotel
//"Database": "iuaY0h0+TWkir44/eZLDqw==", //tpe_dome_office //"Database": "Rq7Gn4x6LwBvVtl7GY8LbA==", //mcut
//"Database": "Rq7Gn4x6LwBvVtl7GY8LbA==", //MCUT //"Database": "XZ2fOBnta9kdVGEb7y92cg==", //ibms_mcut
"Root": "SzdxEgaJJ7tcTCrUl2zKsA==", "Root": "SzdxEgaJJ7tcTCrUl2zKsA==",
"Password": "FVAPxztxpY4gJJKQ/se4bQ==" "Password": "FVAPxztxpY4gJJKQ/se4bQ=="
} }
//"MSSqlDBConfig": { //"MSSqlDBConfig": {
// "Server": "avZg8PA8C9GVgYZBgEKzCg==", // "Server": "avZg8PA8C9GVgYZBgEKzCg==",
// "Port": "lJA0KPkG6RvFfTgWiXFyUw==", // "Port": "lJA0KPkG6RvFfTgWiXFyUw==",
// "Database": "VvfWH/59gQguY2eA2xBCug==", // "Database": "VvfWH/59gQguY2eA2xBCug==",
// "Root": "sD8GZ9UPiIQGU6dU011/4A==", // "Root": "sD8GZ9UPiIQGU6dU011/4A==",
// "Password": "2gi7rOmGha2VdXC5vtHxhg==" // "Password": "2gi7rOmGha2VdXC5vtHxhg=="
//} //}
//"MSSqlDBConfig": { //172.16.220.250 //"MSSqlDBConfig": { //172.16.220.250
// "Server": "zp3Nilx0PISEEC4caZWqCg==", // "Server": "zp3Nilx0PISEEC4caZWqCg==",
// "Port": "7puf4kd9qJ/q0fq2QASWeQ==", // "Port": "7puf4kd9qJ/q0fq2QASWeQ==",
// "Database": "VvfWH/59gQguY2eA2xBCug==", // "Database": "VvfWH/59gQguY2eA2xBCug==",
// "Root": "sD8GZ9UPiIQGU6dU011/4A==", // "Root": "sD8GZ9UPiIQGU6dU011/4A==",
// "Password": "Jue6jMFRi11meN6xbdKwDA==" // "Password": "Jue6jMFRi11meN6xbdKwDA=="
//} //}
//"MSSqlDBConfig": { //"MSSqlDBConfig": {
// "Server": "FPhyer7n0h/pw/yCMzKcPQ==", // "Server": "FPhyer7n0h/pw/yCMzKcPQ==",
// "Port": "7puf4kd9qJ/q0fq2QASWeQ==", // "Port": "7puf4kd9qJ/q0fq2QASWeQ==",
// "Database": "VvfWH/59gQguY2eA2xBCug==", // "Database": "VvfWH/59gQguY2eA2xBCug==",
// "Root": "sD8GZ9UPiIQGU6dU011/4A==", // "Root": "sD8GZ9UPiIQGU6dU011/4A==",
// "Password": "Jue6jMFRi11meN6xbdKwDA==" // "Password": "Jue6jMFRi11meN6xbdKwDA=="
//} //}
}
} }
}

View File

@ -11,49 +11,41 @@
"SignKey": "TaipeiDome123456", //ñ<EFBFBD><EFBFBD>//<EFBFBD>̤<EFBFBD>16<EFBFBD>r<EFBFBD><EFBFBD> "SignKey": "TaipeiDome123456", //ñ<EFBFBD><EFBFBD>//<EFBFBD>̤<EFBFBD>16<EFBFBD>r<EFBFBD><EFBFBD>
"JwtLifeSeconds": 86400 "JwtLifeSeconds": 86400
}, },
"DBConfig": { "DBConfig": {
//"MySqlDBConfig": { "MySqlDBConfig": {
// "Server": "avZg8PA8C9GVgYZBgEKzCg==", "Server": "CYGthbCeGtAXT4s1NOSJHQ==", //0.132
// "Port": "JKuuq+uwXTv3d/3a4itt6A==", "Port": "mkF51jVbg40V5K5eTh2Ckw==",
// "Database": "VvfWH/59gQguY2eA2xBCug==", //"Database": "VJB2XC+lAtzuHObDGMVOAA==", //30
// "Root": "HHJtgEbqTcvCJtK4Lzg1Jg==", //"Database": "IgYBsgG2VLKKxFb64j7LOA==", //wsp
// "Password": "2gi7rOmGha2VdXC5vtHxhg==" "Database": "7gWfmZ28HGIJZbxEbK+0yg==", //tpe_dome_dome
//}, //"Database": "siTUcDaC/g2yGTMFWD72Kg==", //tpe_dome_hotel
"MySqlDBConfig": { //"Database": "Rq7Gn4x6LwBvVtl7GY8LbA==", //mcut
"Server": "FYlY+w0XDIz+jmF2rlZWJw==", //0.201 //"Database": "XZ2fOBnta9kdVGEb7y92cg==", //ibms_mcut
"Port": "js2LutKe+rdjzdxMPQUrvQ==", "Root": "SzdxEgaJJ7tcTCrUl2zKsA==",
//"Database": "VJB2XC+lAtzuHObDGMVOAA==", // "Password": "FVAPxztxpY4gJJKQ/se4bQ=="
//"Database": "IgYBsgG2VLKKxFb64j7LOA==", //wsp },
//"Database": "Rq7Gn4x6LwBvVtl7GY8LbA==", //MCUT "MSSqlDBConfig": {
//"Database": "7gWfmZ28HGIJZbxEbK+0yg==", //tpe_dome_dome "Server": "bJm+UAtbeaTjDmp/A5ep2w==", //0.130
//"Database": "siTUcDaC/g2yGTMFWD72Kg==", //tpe_dome_hotel "Port": "S5cUXKnKOacFtFy9+0dtpw==",
//"Database": "iuaY0h0+TWkir44/eZLDqw==", //tpe_dome_office "Database": "VvfWH/59gQguY2eA2xBCug==", //taipei_dome
"Database": "+5RAiFLJVU+LRyDxF1K/pcLZaoZa4k/thZqF6xKoCag=", //dome_online_0821 "Root": "4GCCJGAXzLa8ecdmPAkYKg==",
"Root": "SzdxEgaJJ7tcTCrUl2zKsA==", "Password": "0O24es2ZRF5uoJ4aU+YCdg=="
"Password": "FVAPxztxpY4gJJKQ/se4bQ==" }
}, //"MSSqlDBConfig": {
"MSSqlDBConfig": { // "Server": "avZg8PA8C9GVgYZBgEKzCg==",
"Server": "bJm+UAtbeaTjDmp/A5ep2w==", //0.130 // "Port": "lJA0KPkG6RvFfTgWiXFyUw==",
"Port": "S5cUXKnKOacFtFy9+0dtpw==", // "Database": "VvfWH/59gQguY2eA2xBCug==",
"Database": "VvfWH/59gQguY2eA2xBCug==", //taipei_dome // "Root": "sD8GZ9UPiIQGU6dU011/4A==",
"Root": "4GCCJGAXzLa8ecdmPAkYKg==", // "Password": "2gi7rOmGha2VdXC5vtHxhg=="
"Password": "0O24es2ZRF5uoJ4aU+YCdg==" //}
//"MSSqlDBConfig": {
// "Server": "ueFp+VFb200lhh1Uctc97WH0/tX6tfXYU2v1oxCWuuM=",
// "Port": "S5cUXKnKOacFtFy9+0dtpw==",
// "Database": "VvfWH/59gQguY2eA2xBCug==",
// "Root": "+plVKQ+enAqt7BYV2uMQng==",
// "Password": "0O24es2ZRF5uoJ4aU+YCdg=="
//}
} }
//"MSSqlDBConfig": {
// "Server": "avZg8PA8C9GVgYZBgEKzCg==",
// "Port": "lJA0KPkG6RvFfTgWiXFyUw==",
// "Database": "VvfWH/59gQguY2eA2xBCug==",
// "Root": "sD8GZ9UPiIQGU6dU011/4A==",
// "Password": "2gi7rOmGha2VdXC5vtHxhg=="
//}
//"MSSqlDBConfig": {
// "Server": "ueFp+VFb200lhh1Uctc97WH0/tX6tfXYU2v1oxCWuuM=",
// "Port": "S5cUXKnKOacFtFy9+0dtpw==",
// "Database": "VvfWH/59gQguY2eA2xBCug==",
// "Root": "+plVKQ+enAqt7BYV2uMQng==",
// "Password": "0O24es2ZRF5uoJ4aU+YCdg=="
//}
} }
}