[後端] 修改同步分割串問題, 專案名稱

This commit is contained in:
dev02 2023-05-16 10:52:15 +08:00
parent 1abd1f3c5b
commit d312a3c293
7 changed files with 64 additions and 53 deletions

View File

@ -2,7 +2,9 @@
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using Repository.BackendRepository.Implement;
using Repository.BackendRepository.Interface;
using Serilog.Core;
using System;
using System.Collections.Generic;
using System.Linq;
@ -14,16 +16,18 @@ namespace Backend.Controllers
{
private readonly ILogger<LoginController> logger;
private readonly IUserInfoRepository userInfoRepository;
private readonly IBackendRepository backendRepository;
public LoginController(ILogger<LoginController> logger,
IUserInfoRepository userInfoRepository)
public LoginController(ILogger<LoginController> logger, IUserInfoRepository userInfoRepository, IBackendRepository backendRepository)
{
this.logger = logger;
this.userInfoRepository = userInfoRepository;
this.backendRepository = backendRepository;
}
public IActionResult Index()
{
ViewBag.ProjectName = backendRepository.GetOneAsync<string>("select system_key from variable where deleted = 0 and system_type = 'project_name';").Result;
return View();
}
@ -92,6 +96,7 @@ namespace Backend.Controllers
/// <returns></returns>
public IActionResult ForgotPassword()
{
ViewBag.ProjectName = backendRepository.GetOneAsync<string>("select system_key from variable where deleted = 0 and system_type = 'project_name';").Result;
return View("~/Views/Login/ForgotPassword.cshtml");
}
@ -147,5 +152,33 @@ namespace Backend.Controllers
return RedirectToAction("Index", "Login");
}
/// <summary>
/// 獲取專案名稱(東別)
/// </summary>
/// <returns></returns>
[HttpPost]
[Route("Variable/ProjectName")]
public async Task<ApiResult<Variable>> ProjectName()
{
ApiResult<Variable> apiResult = new ApiResult<Variable>();
try
{
var variable = await backendRepository.GetOneAsync<Variable>("select * from variable where deleted = 0 and system_type = 'project_name';");
apiResult.Data = variable;
apiResult.Code = "0000";
apiResult.Msg = "成功";
}
catch (Exception exception)
{
apiResult.Code = "9999";
apiResult.Msg = "系統內部錯誤,請聯絡管理者。";
logger.LogError("【LogginController/ProjectName】" + exception.Message);
}
return apiResult;
}
}
}

View File

@ -76,6 +76,7 @@ namespace Backend.Controllers
ViewBag.myUserInfo = myUserInfo;
ViewBag.role = showview.Result;
ViewBag.ProjectName = backendRepository.GetOneAsync<string>("select system_key from variable where deleted = 0 and system_type = 'project_name';").Result;
#region
var content = JsonConvert.SerializeObject(filterContext.ActionArguments);
var parameter = content.CompareTo("{}") == 0 ? null : content;

View File

@ -242,31 +242,6 @@ namespace Backend.Controllers
return apiResult;
}
/// <summary>
/// 獲取專案名稱(東別)
/// </summary>
/// <returns></returns>
[HttpPost]
public async Task<ApiResult<Variable>> ProjectName()
{
ApiResult<Variable> apiResult = new ApiResult<Variable>();
try
{
var variable = await backendRepository.GetOneAsync<Variable>("select * from variable where deleted = 0 and system_type = 'project_name';");
apiResult.Data = variable;
apiResult.Code = "0000";
apiResult.Msg = "成功";
}
catch (Exception exception)
{
apiResult.Code = "9999";
apiResult.Msg = "系統內部錯誤,請聯絡管理者。";
Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message);
}
return apiResult;
}
}
}

View File

@ -179,7 +179,7 @@ namespace Backend.Services.Implement
string[] s2 = s1[0].Split('/');
var displayName = s1[1].Split('=')[1];
row.name = s1[0].Replace('/', '_').Remove(s1[0].Length - 1, 1).Remove(0, 1);
row.name = s1[0].Remove(s1[0].Length - 1, 1).Remove(0, 1);
row.displayName = displayName;
row.isHistory = false;
@ -275,30 +275,30 @@ namespace Backend.Services.Implement
var newConPoint = conPoint.Where(x => !x.isHistory).ToArray();
foreach(var n in newConPoint)
{
if (n.name.Split('_').Length == 9)
if (n.name.Split('/').Length == 9)
{
result.Add(new ImpNiaItem
{
device_area_tag = n.name.Split('_')[0],
device_building_tag = n.name.Split('_')[1],
device_system_tag = n.name.Split('_')[2],
device_name_tag = n.name.Split('_')[3],
device_point_name = n.name.Split('_')[8],
device_area_tag = n.name.Split('/')[0],
device_building_tag = n.name.Split('/')[1],
device_system_tag = n.name.Split('/')[2],
device_name_tag = n.name.Split('/')[3],
device_point_name = n.name.Split('/')[8],
full_name = n.displayName,
parent_path = oneStationName,
isHistory = n.isHistory
});
}
else if (n.name.Split('_').Length == 11) //Arena_D2_CWB_L110_CAP_D2_CWB_L110_CAP_MET1_ER
else if (n.name.Split('/').Length == 11) //Arena_D2_CWB_L110_CAP_D2_CWB_L110_CAP_MET1_ER
{
if (n.name.Split('_')[6] == "S" || n.name.Split('_')[6] == "CWB") //for security system and CWB system
if (n.name.Split('/')[6] == "S" || n.name.Split('/')[6] == "CWB") //for security system and CWB system
{
result.Add(new ImpNiaItem {
device_building_tag = n.name.Split('_')[5],
device_system_tag = n.name.Split('_')[6],
device_floor_tag = n.name.Split('_')[7],
device_name_tag = n.name.Split('_')[8],
device_point_name = n.name.Split('_')[10],
device_building_tag = n.name.Split('/')[5],
device_system_tag = n.name.Split('/')[6],
device_floor_tag = n.name.Split('/')[7],
device_name_tag = n.name.Split('/')[8],
device_point_name = n.name.Split('/')[10],
full_name = n.displayName,
parent_path = oneStationName,
isHistory = n.isHistory
@ -308,11 +308,11 @@ namespace Backend.Services.Implement
{
result.Add(new ImpNiaItem
{
device_building_tag = n.name.Split('_')[5],
//device_system_tag = n.name.Split('_')[1],
device_floor_tag = n.name.Split('_')[7],
device_name_tag = n.name.Split('_')[6],
device_point_name = n.name.Split('_')[10],
device_building_tag = n.name.Split('/')[5],
//device_system_tag = n.name.Split('/')[1],
device_floor_tag = n.name.Split('/')[7],
device_name_tag = n.name.Split('/')[6],
device_point_name = n.name.Split('/')[10],
full_name = n.displayName,
parent_path = oneStationName,
isHistory = n.isHistory

View File

@ -7,7 +7,7 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>忘記密碼 | IBMS後台管理系統</title>
<title>忘記密碼 | @ViewData["ProjectName"]後台管理系統</title>
<!-- base css -->
<link id="vendorsbundle" rel="stylesheet" media="screen, print" href="~/css/vendors.bundle.css">
<link id="appbundle" rel="stylesheet" media="screen, print" href="~/css/app.bundle.css">
@ -29,7 +29,7 @@
<div class="page-logo m-0 w-100 align-items-center justify-content-center rounded border-bottom-left-radius-0 border-bottom-right-radius-0 px-2">
<div class="w-100 page-logo-link press-scale-down d-flex align-items-center">
<img src="/img/dome.png" width="50%" aria-roledescription="logo">
<span class="page-logo-text">IBMS後台管理系統</span>
<span class="page-logo-text">@ViewData["ProjectName"]後台管理系統</span>
</div>
</div>
<div class="card p-4 border-top-left-radius-0 border-top-right-radius-0">

View File

@ -7,7 +7,7 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>登入 | IBMS後台管理系統</title>
<title>登入 | @ViewData["ProjectName"]後台管理系統</title>
<!-- base css -->
<link id="vendorsbundle" rel="stylesheet" media="screen, print" href="~/css/vendors.bundle.css">
@ -31,7 +31,7 @@
<div class="page-logo m-0 w-100 align-items-center justify-content-center rounded border-bottom-left-radius-0 border-bottom-right-radius-0 px-2">
<div class="w-100 page-logo-link press-scale-down d-flex align-items-center">
<img src="/img/dome.png" width="50%" aria-roledescription="logo">
<span class="page-logo-text">IBMS後台管理系統</span>
<span class="page-logo-text">@(ViewBag.ProjectName)後台管理系統</span>
</div>
</div>
<div class="card p-4 border-top-left-radius-0 border-top-right-radius-0">

View File

@ -4,7 +4,7 @@
<meta charset="utf-8" />
<meta name="description" content="Page Title">
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>@ViewData["Title"] - IBMS後台管理系統</title>
<title>@ViewData["Title"] - @ViewData["ProjectName"]後台管理系統</title>
<!-- base css -->
<link id="vendorsbundle" rel="stylesheet" media="screen, print" href="~/css/vendors.bundle.css" asp-append-version="true">
@ -353,7 +353,7 @@
</a>
</form>
</div>-->
<h1 class="subheader-title">IBMS後台管理系統</h1>
<h1 class="subheader-title">@ViewData["ProjectName"]後台管理系統</h1>
<div class="ml-auto d-flex">
<!-- activate app search icon (mobile) -->
@ -998,3 +998,5 @@
@RenderSection("Scripts", required: false)
</body>
</html>
<script>
</scirpt>