1.修复多账套对接时报工切换账套不生效(严重bug)

2.切换底层逻辑,增加外部增加数据源的接口
3.增加缓存,减少频繁登录导致可能存在的突发数据库连接异常
This commit is contained in:
minjQiu
2024-07-14 18:01:02 +08:00
parent 71e2904de7
commit ad475d4ffe
24 changed files with 1161 additions and 105 deletions
Binary file not shown.
+21
View File
@@ -0,0 +1,21 @@
{
"cVouchDate": "2024-06-30",
"wcid": null,
"body": [
{
"moid": 1000000074,
"modid": 1000000092,
"mocode": null,
"moseq": 1,
"opseq": "0010",
"inopseq": "0020",
"employcode": "00006",
"actualduedate": "2024-06-30 00:00:00",
"moroutingid": 1000000010,
"outmoroutingdid": 1000000026,
"moroutingdid": 1000000027,
"opstatus": 3,
"qualifiedqty": 1
}
]
}
+114
View File
@@ -516,6 +516,58 @@
</summary>
<param name="documentPath">The physical path to XML document.</param>
</member>
<member name="T:UFIDA.U8.Framework.Api.Controllers.CommonController">
<summary>
公共服务
</summary>
</member>
<member name="F:UFIDA.U8.Framework.Api.Controllers.CommonController.logInfo">
<summary>
日志对象
</summary>
</member>
<member name="M:UFIDA.U8.Framework.Api.Controllers.CommonController.GetEncryptString(System.String)">
<summary>
获取加密字符串
</summary>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:UFIDA.U8.Framework.Api.Controllers.CommonController.GetDecryptString(System.String)">
<summary>
获取解密字符串
</summary>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:UFIDA.U8.Framework.Api.Controllers.CommonController.GetAccountConfig(UFIDA.U8.Framework.Api.Models.U8AccountConfigInput)">
<summary>
获取对接账套设置
</summary>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:UFIDA.U8.Framework.Api.Controllers.CommonController.AddAccountConfig(UFIDA.U8.Framework.Api.Models.AddU8AccountConfigInput)">
<summary>
新增对接账套设置
</summary>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:UFIDA.U8.Framework.Api.Controllers.CommonController.UpdateAccountConfig(UFIDA.U8.Framework.Api.Models.AddU8AccountConfigInput)">
<summary>
更新对接账套设置
</summary>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:UFIDA.U8.Framework.Api.Controllers.CommonController.ListAccountConfig(UFIDA.U8.Framework.Api.Models.ListU8AccountConfigInput)">
<summary>
获取对接账套设置列表
</summary>
<param name="input"></param>
<returns></returns>
</member>
<member name="T:UFIDA.U8.Framework.Api.Controllers.U8.SFCController">
<summary>
车间管理
@@ -538,5 +590,67 @@
<param name="args"></param>
<returns></returns>
</member>
<member name="T:UFIDA.U8.Framework.Api.Models.U8AccountConfigInput">
<summary>
查询参数
</summary>
</member>
<member name="T:UFIDA.U8.Framework.Api.Models.AddU8AccountConfigInput">
<inheritdoc />
</member>
<member name="T:UFIDA.U8.Framework.Api.Models.UpdateU8AccountConfigInput">
<inheritdoc />
</member>
<member name="T:UFIDA.U8.Framework.Api.Models.ListU8AccountConfigInput">
<inheritdoc />
</member>
<member name="T:UFIDA.U8.Framework.Api.Unit.CommUnit">
<summary>
公共帮助类
</summary>
</member>
<member name="M:UFIDA.U8.Framework.Api.Unit.CommUnit.GetConfig(System.String)">
<summary>
读取对应配置
</summary>
<param name="key"></param>
<returns></returns>
</member>
<member name="M:UFIDA.U8.Framework.Api.Unit.CommUnit.GetDecrypt(System.String)">
<summary>
解密
</summary>
<param name="val"></param>
<returns></returns>
</member>
<member name="M:UFIDA.U8.Framework.Api.Unit.CommUnit.GetEncrypt(System.String)">
<summary>
加密
</summary>
<param name="val"></param>
<returns></returns>
</member>
<member name="M:UFIDA.U8.Framework.Api.Unit.CommUnit.GetConnectionConfig">
<summary>
获取数据库配置信息
</summary>
<returns></returns>
<exception cref="T:System.Exception"></exception>
</member>
<member name="M:UFIDA.U8.Framework.Api.Unit.CommUnit.GetDbClient">
<summary>
获取连接对象
</summary>
<returns></returns>
</member>
<member name="M:UFIDA.U8.Framework.Api.Unit.CommUnit.GetLoginParamter(System.String,System.Boolean,System.String)">
<summary>
获取登录参数
</summary>
<param name="cAccId"></param>
<param name="bAP"></param>
<param name="pDate"></param>
<returns></returns>
</member>
</members>
</doc>
@@ -0,0 +1,186 @@
using log4net;
using System;
using System.Threading.Tasks;
using System.Web.Http;
using UFIDA.U8.Framework.Api.ControlObject.Models;
using UFIDA.U8.Framework.Api.Models;
using UFIDA.U8.Framework.Api.Unit;
// ReSharper disable InconsistentNaming
// ReSharper disable IdentifierTypo
namespace UFIDA.U8.Framework.Api.Controllers
{
/// <summary>
/// 公共服务
/// </summary>
public class CommonController : ApiController
{
/// <summary>
/// 日志对象
/// </summary>
protected readonly ILog logInfo = LogManager.GetLogger("logInfo");
/// <summary>
/// 获取加密字符串
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpGet]
[Route("api/Common/GetEncryptString")]
public BaseResult<string> GetEncryptString(string input)
{
try
{
return new BaseResult<string> { bSuccess = true, message = "加密成功", result = CommUnit.GetEncrypt(input) };
}
catch (Exception ex)
{
logInfo.Error(ex.Message, ex);
return new BaseResult<string> { bSuccess = true, message = "加密失败", result = ex.Message };
}
}
/// <summary>
/// 获取解密字符串
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpGet]
[Route("api/Common/GetDecryptString")]
public BaseResult<string> GetDecryptString(string input)
{
try
{
return new BaseResult<string> { bSuccess = true, message = "解密成功", result = CommUnit.GetDecrypt(input) };
}
catch (Exception ex)
{
logInfo.Error(ex.Message, ex);
return new BaseResult<string> { bSuccess = true, message = "解密失败", result =ex.Message };
}
}
/// <summary>
/// 获取对接账套设置
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost]
[Route("api/Common/GetAccountConfig")]
public async Task<BaseResult<dynamic>> GetAccountConfig([FromBody]U8AccountConfigInput input)
{
try
{
var db = CommUnit.GetDbClient();
var res=await db.Queryable<Common.Entity.SysU8AccountConfig>()
.Where(a => a.cAccountNo == input.cAccId)
.FirstAsync();
return new BaseResult<dynamic> { bSuccess = false, message = "查询成功", result = res };
}
catch (Exception ex)
{
logInfo.Error(ex.Message, ex);
return new BaseResult<dynamic> { bSuccess = false, message = "查询失败", result = ex.Message };
}
}
/// <summary>
/// 新增对接账套设置
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost]
[Route("api/Common/AddAccountConfig")]
public async Task<BaseResult<dynamic>> AddAccountConfig([FromBody] AddU8AccountConfigInput input)
{
try
{
var db = CommUnit.GetDbClient();
var isExists = await db.Queryable<SysU8AccountConfig>().AnyAsync(a => a.cAccountNo == input.cAccountNo);
if (isExists)
{
throw new Exception($"已存在系统号为{input.cAccountNo}的数据");
}
var id = await db.Insertable(input).ExecuteReturnIdentityAsync();
return new BaseResult<dynamic> { bSuccess = true, message = "新增成功", result = id };
}
catch (Exception ex)
{
logInfo.Error(ex.Message, ex);
return new BaseResult<dynamic> { bSuccess = false, message = "新增失败", result = ex.Message };
}
}
/// <summary>
/// 更新对接账套设置
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost]
[Route("api/Common/UpdateAccountConfig")]
public async Task<BaseResult<dynamic>> UpdateAccountConfig([FromBody]AddU8AccountConfigInput input)
{
try
{
var db = CommUnit.GetDbClient();
var isExists = await db.Queryable<Common.Entity.SysU8AccountConfig>().AnyAsync(a => a.Id==input.Id);
if (!isExists)
{
throw new Exception($"不存在系统号为{input.cAccountNo}的数据");
}
var id = await db.Updateable(input).ExecuteCommandAsync();
return new BaseResult<dynamic> { bSuccess = true, message = "更新成功", result = id };
}
catch (Exception ex)
{
logInfo.Error(ex.Message, ex);
return new BaseResult<dynamic> { bSuccess = false, message = "更新失败", result = ex.Message };
}
}
/// <summary>
/// 获取对接账套设置列表
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost]
[Route("api/Common/ListAccountConfig")]
public async Task<BaseResult<dynamic>> ListAccountConfig([FromBody] ListU8AccountConfigInput input)
{
try
{
var db = CommUnit.GetDbClient();
var res =await db.Queryable<Common.Entity.SysU8AccountConfig>()
.WhereIF(!string.IsNullOrWhiteSpace(input.cAccId), a => a.cAccountNo == input.cAccId)
.ToListAsync();
return new BaseResult<dynamic> { bSuccess = true, message = "查询成功", result = res };
}
catch (Exception ex)
{
logInfo.Error(ex.Message, ex);
return new BaseResult<dynamic> { bSuccess = false, message = "查询失败", result = ex.Message };
}
}
}
}
@@ -1,11 +1,18 @@
using log4net;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using System.Web.Http;
using Microsoft.Extensions.Caching.Memory;
using SqlSugar;
using UFIDA.U8.Framework.Api.Common.Unit.GM;
using UFIDA.U8.Framework.Api.ControlObject.Models;
using UFIDA.U8.Framework.Api.ControlObject.U8M;
using UFIDA.U8.Framework.Api.Unit;
namespace UFIDA.U8.Framework.Api.Controllers.U8
{
@@ -16,6 +23,8 @@ namespace UFIDA.U8.Framework.Api.Controllers.U8
{
protected readonly ILog logInfo = LogManager.GetLogger("logInfo");
private static MemoryCache _cache = new MemoryCache(new MemoryCacheOptions() { ExpirationScanFrequency = TimeSpan.FromMinutes(10) });
/// <summary>
/// 新增单据
/// </summary>
@@ -25,19 +34,56 @@ namespace UFIDA.U8.Framework.Api.Controllers.U8
/// <returns></returns>
[HttpPost]
[Route("api/U8/SFC/Save")]
public BaseResult<string> Save(string cAccId,string cCardNum, [FromBody] Dictionary<string, object> voucherData)
public async Task<BaseResult<dynamic>> Save(string cAccId,string cCardNum, [FromBody] Dictionary<string, object> input)
{
try
{
var db=
if (!_cache.TryGetValue($"U8M_Single", out BaseLogin baseLogin))
{
baseLogin = new BaseLogin();
var param = await CommUnit.GetLoginParamter(cAccId);
if (param == null)
{
throw new Exception("未能加载指定系统号的登录信息");
}
baseLogin.Init(param);
_cache.Set("U8M_Single", baseLogin);
}
else
{
var param = await CommUnit.GetLoginParamter(cAccId);
if (param == null)
{
throw new Exception("未能加载指定系统号的登录信息");
}
if (!baseLogin.CheckAccId(param.pAccId))
{
baseLogin.ShutDown();
baseLogin.Init(param);
}
_cache.Remove("U8M_Single");
_cache.Set("U8M_Single", baseLogin);
}
var bf = new MoRoutingBill();
var res=bf.Save( cCardNum, input);
return res;
}
catch (Exception ex)
{
logInfo.Error(ex.Message, ex);
return new BaseResult<string>(){bSuccess = false,message = ex.Message,result = ex.StackTrace};
return new BaseResult<dynamic> {bSuccess = false,message = ex.Message,result = ex.StackTrace};
}
@@ -1,39 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
namespace UFIDA.U8.Framework.Api.Controllers
{
public class ValuesController : ApiController
{
// GET api/values
public IEnumerable<string> Get()
{
return new string[] { "value1", "value2" };
}
// GET api/values/5
public string Get(int id)
{
return "value";
}
// POST api/values
public void Post([FromBody] string value)
{
}
// PUT api/values/5
public void Put(int id, [FromBody] string value)
{
}
// DELETE api/values/5
public void Delete(int id)
{
}
}
}
@@ -0,0 +1,38 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using UFIDA.U8.Framework.Api.ControlObject.Models;
namespace UFIDA.U8.Framework.Api.Models
{
/// <summary>
/// 查询参数
/// </summary>
public class U8AccountConfigInput
{
public string cAccId { get; set; }
}
/// <inheritdoc />
[SugarTable("SysU8AccountConfig", "系统U8账套对接参数配置表")]
public class AddU8AccountConfigInput : Common.Entity.SysU8AccountConfig
{
}
/// <inheritdoc />
[SugarTable("SysU8AccountConfig", "系统U8账套对接参数配置表")]
public class UpdateU8AccountConfigInput : Common.Entity.SysU8AccountConfig
{
}
/// <inheritdoc />
public class ListU8AccountConfigInput : U8AccountConfigInput
{
}
}
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\EntityFramework.6.5.1\build\EntityFramework.props" Condition="Exists('..\packages\EntityFramework.6.5.1\build\EntityFramework.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -61,6 +62,12 @@
<Reference Include="DapperExtensions, Version=1.7.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\DapperExtensions.1.7.0\lib\net461\DapperExtensions.dll</HintPath>
</Reference>
<Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<HintPath>..\packages\EntityFramework.6.5.1\lib\net45\EntityFramework.dll</HintPath>
</Reference>
<Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<HintPath>..\packages\EntityFramework.6.5.1\lib\net45\EntityFramework.SqlServer.dll</HintPath>
</Reference>
<Reference Include="log4net, Version=2.0.17.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<HintPath>..\packages\log4net.2.0.17\lib\net45\log4net.dll</HintPath>
</Reference>
@@ -181,7 +188,7 @@
<HintPath>..\packages\Newtonsoft.Json.Bson.1.0.2\lib\net45\Newtonsoft.Json.Bson.dll</HintPath>
</Reference>
<Reference Include="Oracle.ManagedDataAccess, Version=4.122.23.1, Culture=neutral, PublicKeyToken=89b483f429c47342, processorArchitecture=MSIL">
<HintPath>..\packages\Oracle.ManagedDataAccess.23.4.0\lib\net472\Oracle.ManagedDataAccess.dll</HintPath>
<HintPath>..\packages\Oracle.ManagedDataAccess.23.5.0\lib\net472\Oracle.ManagedDataAccess.dll</HintPath>
</Reference>
<Reference Include="Slapper, Version=2.0.5.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Slapper.AutoMapper.2.0.5\lib\net47\Slapper.dll</HintPath>
@@ -195,9 +202,6 @@
<Reference Include="SQLitePCLRaw.provider.dynamic_cdecl, Version=2.1.8.2226, Culture=neutral, PublicKeyToken=b68184102cba0b3b, processorArchitecture=MSIL">
<HintPath>..\packages\SQLitePCLRaw.provider.dynamic_cdecl.2.1.8\lib\netstandard2.0\SQLitePCLRaw.provider.dynamic_cdecl.dll</HintPath>
</Reference>
<Reference Include="SQLitePCLRaw.provider.e_sqlite3, Version=2.1.8.2226, Culture=neutral, PublicKeyToken=9c301db686d0bd12, processorArchitecture=MSIL">
<HintPath>..\packages\SQLitePCLRaw.provider.e_sqlite3.2.1.8\lib\netstandard2.0\SQLitePCLRaw.provider.e_sqlite3.dll</HintPath>
</Reference>
<Reference Include="SqlSugar, Version=5.1.4.162, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\SqlSugar.5.1.4.162\lib\SqlSugar.dll</HintPath>
</Reference>
@@ -209,12 +213,24 @@
<HintPath>..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
</Reference>
<Reference Include="System.ComponentModel.Composition" />
<Reference Include="System.Configuration.ConfigurationManager, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Configuration.ConfigurationManager.8.0.0\lib\net462\System.Configuration.ConfigurationManager.dll</HintPath>
</Reference>
<Reference Include="System.Data" />
<Reference Include="System.Data.Common, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Data.Common.4.3.0\lib\net451\System.Data.Common.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Data.SQLite, Version=1.0.118.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL">
<HintPath>..\packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.118.0\lib\net46\System.Data.SQLite.dll</HintPath>
</Reference>
<Reference Include="System.Data.SQLite.EF6, Version=1.0.118.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL">
<HintPath>..\packages\System.Data.SQLite.EF6.1.0.118.0\lib\net46\System.Data.SQLite.EF6.dll</HintPath>
</Reference>
<Reference Include="System.Data.SQLite.Linq, Version=1.0.118.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL">
<HintPath>..\packages\System.Data.SQLite.Linq.1.0.118.0\lib\net46\System.Data.SQLite.Linq.dll</HintPath>
</Reference>
<Reference Include="System.Diagnostics.DiagnosticSource, Version=8.0.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Diagnostics.DiagnosticSource.8.0.1\lib\net462\System.Diagnostics.DiagnosticSource.dll</HintPath>
</Reference>
@@ -383,15 +399,18 @@
<Compile Include="Areas\HelpPage\SampleGeneration\SampleDirection.cs" />
<Compile Include="Areas\HelpPage\SampleGeneration\TextSample.cs" />
<Compile Include="Areas\HelpPage\XmlDocumentationProvider.cs" />
<Compile Include="Controllers\CommonController.cs" />
<Compile Include="Controllers\HomeController.cs" />
<Compile Include="Controllers\U8\SFCController.cs" />
<Compile Include="Controllers\ValuesController.cs" />
<Compile Include="Global.asax.cs">
<DependentUpon>Global.asax</DependentUpon>
</Compile>
<Compile Include="Models\U8AccountConfigInput.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Unit\CommUnit.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App_Data\FC90.json" />
<Content Include="Areas\HelpPage\HelpPage.css" />
<Content Include="Content\bootstrap-grid.css" />
<Content Include="Content\bootstrap-grid.min.css" />
@@ -437,6 +456,9 @@
<Content Include="Areas\HelpPage\Views\Help\DisplayTemplates\ApiGroup.cshtml" />
<Content Include="Areas\HelpPage\Views\Help\Api.cshtml" />
<Content Include="log4net.config" />
<Content Include="App_Data\API_Meta.db">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<None Include="Oracle.DataAccess.Common.Configuration.Section.xsd">
<SubType>Designer</SubType>
</None>
@@ -479,11 +501,9 @@
<Content Include="Views\Shared\Error.cshtml" />
<Content Include="Views\Shared\_Layout.cshtml" />
<Content Include="SwaggerUI\lib\.DS_Store" />
<Content Include="Views\System\Index.cshtml" />
</ItemGroup>
<ItemGroup>
<Folder Include="App_Data\" />
<Folder Include="Models\" />
</ItemGroup>
<ItemGroup />
<ItemGroup>
<Content Include="Content\bootstrap.rtl.min.css.map" />
<Content Include="Content\bootstrap.rtl.css.map" />
@@ -555,7 +575,12 @@
<ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.4.1.0\build\net472\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.4.1.0\build\net472\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.targets'))" />
<Error Condition="!Exists('..\packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.118.0\build\net46\Stub.System.Data.SQLite.Core.NetFramework.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.118.0\build\net46\Stub.System.Data.SQLite.Core.NetFramework.targets'))" />
<Error Condition="!Exists('..\packages\EntityFramework.6.5.1\build\EntityFramework.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\EntityFramework.6.5.1\build\EntityFramework.props'))" />
<Error Condition="!Exists('..\packages\EntityFramework.6.5.1\build\EntityFramework.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\EntityFramework.6.5.1\build\EntityFramework.targets'))" />
</Target>
<Import Project="..\packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.118.0\build\net46\Stub.System.Data.SQLite.Core.NetFramework.targets" Condition="Exists('..\packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.118.0\build\net46\Stub.System.Data.SQLite.Core.NetFramework.targets')" />
<Import Project="..\packages\EntityFramework.6.5.1\build\EntityFramework.targets" Condition="Exists('..\packages\EntityFramework.6.5.1\build\EntityFramework.targets')" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
+133
View File
@@ -0,0 +1,133 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using System.Web;
using Microsoft.Data.Sqlite;
using SqlSugar;
using UFIDA.U8.Framework.Api.Common.Unit.GM;
using UFIDA.U8.Framework.Api.ControlObject.Models;
namespace UFIDA.U8.Framework.Api.Unit
{
/// <summary>
/// 公共帮助类
/// </summary>
public static class CommUnit
{
/// <summary>
/// 读取对应配置
/// </summary>
/// <param name="key"></param>
/// <returns></returns>
public static string GetConfig(string key)
{
return ConfigurationManager.AppSettings[key];
}
/// <summary>
/// 解密
/// </summary>
/// <param name="val"></param>
/// <returns></returns>
public static string GetDecrypt(string val)
{
return GMUtil.SM2Decrypt(GetConfig("PrivateKey"), val);
}
/// <summary>
/// 加密
/// </summary>
/// <param name="val"></param>
/// <returns></returns>
public static string GetEncrypt(string val)
{
return GMUtil.SM2Encrypt(GetConfig("PublicKey"), val);
}
/// <summary>
/// 获取数据库配置信息
/// </summary>
/// <returns></returns>
/// <exception cref="Exception"></exception>
public static ConnectionConfig GetConnectionConfig()
{
if (Enum.TryParse<DbType>(GetConfig("DbType"), true, out var dbType))
{
var connStr = GetDecrypt(GetConfig("ConnectionString"));
var path = $"{AppDomain.CurrentDomain.BaseDirectory}{connStr}";
var liteConn = new SqliteConnectionStringBuilder()
{
DataSource = path
};
var conn = new ConnectionConfig()
{
DbType = dbType,
ConnectionString = liteConn.ConnectionString,
ConfigId = "0",
IsAutoCloseConnection = true,
MoreSettings = new ConnMoreSettings()
{
IsWithNoLockQuery = true
}
};
return conn;
}
else
{
throw new Exception("请维护数据库类型");
}
}
/// <summary>
/// 获取连接对象
/// </summary>
/// <returns></returns>
public static SqlSugarClient GetDbClient()
{
var db = new SqlSugarClient(CommUnit.GetConnectionConfig());
return db;
}
/// <summary>
/// 获取登录参数
/// </summary>
/// <param name="cAccId"></param>
/// <param name="bAP"></param>
/// <param name="pDate"></param>
/// <returns></returns>
public static async Task<LoginParamter> GetLoginParamter(string cAccId,bool bAP=false,string pDate="")
{
var db = new SqlSugarClient(CommUnit.GetConnectionConfig());
var account=await db.Queryable<SysU8AccountConfig>().FirstAsync(a => a.Status == StatusEnum.Enable && a.cAccountNo == cAccId);
if (account != null)
{
var param=new LoginParamter()
{
cSrv = account.cSrv,
pAccId = account.cAcc_DataSource,
pDate = string.IsNullOrWhiteSpace(pDate)?$"{DateTime.Today:yyyy-MM-dd}":pDate,
pPassword = string.IsNullOrWhiteSpace(account.cPassword)?"":GetDecrypt(account.cPassword),
pYearId = string.IsNullOrWhiteSpace(pDate) ? $"{DateTime.Today.Year}" :$"{DateTime.Parse(pDate).Year}",
pSubId = bAP ? "AP" : "DP",
pUserId = account.cUser_Id
};
return param;
}
return null;
}
}
}
@@ -0,0 +1,56 @@
@{
Layout = null;
}
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>Index</title>
<!-- Import style -->
<link rel="stylesheet" href="//unpkg.com/element-plus/dist/index.css" />
<!-- Import Vue 3 -->
<script src="//unpkg.com/vue@3"></script>
<!-- Import component library -->
<script src="//unpkg.com/element-plus"></script>
</head>
<body>
<div id="app" align="center" height:auto>
<el-form id="loginForm" style="align:center; width:300px" label-width="100">
<el-form-item label="用户名">
<el-input />
</el-form-item>
<el-form-item label="密码">
<el-input type="password" />
</el-form-item>
<el-form-item>
<el-button v-on:click="login">登 录</el-button>
</el-form-item>
</el-form>
</div>
<script>
const App = {
data() {
return {
message: "Hello Element Plus",
};
},
methods: {
login: function () {
ElMessage.info("测试")
}
}
};
const app = Vue.createApp(App);
app.use(ElementPlus);
app.use(ElMessage);
app.mount("#app");
</script>
</body>
</html>
+18
View File
@@ -5,6 +5,8 @@
-->
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<section name="oracle.manageddataaccess.client" type="OracleInternal.Common.ODPMSectionHandler, Oracle.ManagedDataAccess, Version=4.122.23.1, Culture=neutral, PublicKeyToken=89b483f429c47342" />
</configSections>
<appSettings>
@@ -24,6 +26,8 @@
<add key="ClockSkew" value="5" />
<add key="Algorithm" value="HS256" />
<add key="RequireExpirationTime" value="true" />
<add key="ConnectionString" value="041e16f920938aada7a1017c9ade8790c34f8e781477c7397b5364847c977e506986760c37fbceb708864e688103e19850cef5ded5cbcb5477d8ed6ee7e8be249f3084e9a9be1fbc9a1e3df9de13040f3c93206ade3235f467eec9f2187e13916bf1f3d1311f82fd1cf226f61ab7df9863a710ea916a" />
<add key="DbType" value="Sqlite" />
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.8" />
@@ -139,6 +143,10 @@
<assemblyIdentity name="SQLitePCLRaw.core" publicKeyToken="1488e028ca7ab535" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.1.8.2226" newVersion="2.1.8.2226" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Data.SQLite" publicKeyToken="db937bc2d44ff139" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.0.118.0" newVersion="1.0.118.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<system.codedom>
@@ -157,8 +165,18 @@
</system.webServer>
<system.data>
<DbProviderFactories>
<remove invariant="System.Data.SQLite.EF6" />
<add name="SQLite Data Provider (Entity Framework 6)" invariant="System.Data.SQLite.EF6" description=".NET Framework Data Provider for SQLite (Entity Framework 6)" type="System.Data.SQLite.EF6.SQLiteProviderFactory, System.Data.SQLite.EF6" />
<remove invariant="System.Data.SQLite" />
<add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".NET Framework Data Provider for SQLite" type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" />
<remove invariant="Oracle.ManagedDataAccess.Client" />
<add name="ODP.NET, Managed Driver" invariant="Oracle.ManagedDataAccess.Client" description="Oracle Data Provider for .NET, Managed Driver" type="Oracle.ManagedDataAccess.Client.OracleClientFactory, Oracle.ManagedDataAccess, Version=4.122.23.1, Culture=neutral, PublicKeyToken=89b483f429c47342" />
</DbProviderFactories>
</system.data>
<entityFramework>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
<provider invariantName="System.Data.SQLite.EF6" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6" />
</providers>
</entityFramework>
</configuration>
+8 -2
View File
@@ -7,6 +7,7 @@
<package id="Dapper" version="2.1.35" targetFramework="net48" />
<package id="Dapper.SqlBuilder" version="2.0.78" targetFramework="net48" />
<package id="DapperExtensions" version="1.7.0" targetFramework="net48" />
<package id="EntityFramework" version="6.5.1" targetFramework="net48" />
<package id="jQuery" version="3.7.1" targetFramework="net48" />
<package id="log4net" version="2.0.17" targetFramework="net48" />
<package id="Microsoft.AspNet.Mvc" version="5.3.0" targetFramework="net48" />
@@ -67,18 +68,23 @@
<package id="Modernizr" version="2.8.3" targetFramework="net48" />
<package id="Newtonsoft.Json" version="13.0.3" targetFramework="net48" />
<package id="Newtonsoft.Json.Bson" version="1.0.2" targetFramework="net48" />
<package id="Oracle.ManagedDataAccess" version="23.4.0" targetFramework="net48" />
<package id="Oracle.ManagedDataAccess" version="23.5.0" targetFramework="net48" />
<package id="Slapper.AutoMapper" version="2.0.5" targetFramework="net48" />
<package id="SQLitePCLRaw.bundle_e_sqlite3" version="2.1.8" targetFramework="net48" />
<package id="SQLitePCLRaw.core" version="2.1.8" targetFramework="net48" />
<package id="SQLitePCLRaw.lib.e_sqlite3" version="2.1.8" targetFramework="net48" />
<package id="SQLitePCLRaw.provider.dynamic_cdecl" version="2.1.8" targetFramework="net48" />
<package id="SQLitePCLRaw.provider.e_sqlite3" version="2.1.8" targetFramework="net48" />
<package id="SqlSugar" version="5.1.4.162" targetFramework="net48" />
<package id="Stub.System.Data.SQLite.Core.NetFramework" version="1.0.118.0" targetFramework="net48" />
<package id="Swashbuckle" version="5.6.0" targetFramework="net48" />
<package id="Swashbuckle.Core" version="5.6.0" targetFramework="net48" />
<package id="System.Buffers" version="4.5.1" targetFramework="net48" />
<package id="System.Configuration.ConfigurationManager" version="8.0.0" targetFramework="net48" />
<package id="System.Data.Common" version="4.3.0" targetFramework="net48" />
<package id="System.Data.SQLite" version="1.0.118.0" targetFramework="net48" />
<package id="System.Data.SQLite.Core" version="1.0.118.0" targetFramework="net48" />
<package id="System.Data.SQLite.EF6" version="1.0.118.0" targetFramework="net48" />
<package id="System.Data.SQLite.Linq" version="1.0.118.0" targetFramework="net48" />
<package id="System.Diagnostics.DiagnosticSource" version="8.0.1" targetFramework="net48" />
<package id="System.Formats.Asn1" version="8.0.1" targetFramework="net48" />
<package id="System.IdentityModel.Tokens.Jwt" version="7.6.3" targetFramework="net48" />