整体修正

main_dev_1.0^2
冉成楼 4 months ago
parent ffabc01b5f
commit 450551adaa

@ -0,0 +1,39 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Bus.App
{
public class PassportLoginRequest
{
/// <example>System</example>
public string Account { get; set; }
/// <example>e10adc3949ba59abbe56e057f20f883e</example>
public string Password { get; set; }
/// <summary>
/// 应用的AppSecrect目前没判定可以随便填一个。如果需要判定请根据注释调整LoginParse.Do方法
/// </summary>
/// <example>openauth</example>
public string AppKey { get; set; }
public void Trim()
{
if (string.IsNullOrEmpty(Account))
{
throw new Exception("用户名不能为空");
}
if (string.IsNullOrEmpty(Password))
{
throw new Exception("密码不能为空");
}
Account = Account.Trim();
Password = Password.Trim();
if (!string.IsNullOrEmpty(AppKey)) AppKey = AppKey.Trim();
}
}
}

@ -1,4 +1,5 @@
using Microsoft.AspNetCore.Authorization;
using Bus.App;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using OpenAuth.Repository.Domain;
using System;
@ -24,9 +25,9 @@ namespace Bus.Controllers
[AllowAnonymous]
[HttpPost]
public string haha(DroneCaseInfo d)
public string haha(PassportLoginRequest d)
{
return d.Id;
return d.AppKey;
}
}
}

@ -14,23 +14,12 @@
<PackageReference Include="AutoMapper" Version="14.0.0" />
<PackageReference Include="DocXCore.Standard" Version="1.0.1" />
<PackageReference Include="EnyimMemcachedCore" Version="2.6.4" />
<PackageReference Include="log4net" Version="2.0.15" />
<PackageReference Include="MessagePack" Version="3.0.308" />
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.1" />
<PackageReference Include="NetTopologySuite" Version="2.5.0" />
<PackageReference Include="NetTopologySuite.IO.Esri.Shapefile" Version="1.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="NPOI" Version="2.7.3" />
<PackageReference Include="NUnit" Version="3.13.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0" />
<PackageReference Include="PinYinConverterCore" Version="1.0.2" />
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.8" />
<PackageReference Include="StackExchange.Redis" Version="2.6.111" />
<PackageReference Include="System.Drawing.Common" Version="7.0.0" />
<PackageReference Include="System.IO.Packaging" Version="8.0.1" />
<PackageReference Include="System.Text.RegularExpressions" Version="4.3.1" />
</ItemGroup>
<ItemGroup>

@ -1,11 +1,10 @@
using System.Reflection;
using System.Runtime.Loader;
using Autofac;
using Autofac;
using Autofac.Extras.Quartz;
using ce.autofac.extension;
using Infrastructure.Cache;
using Infrastructure.Extensions.AutofacManager;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.DependencyModel;
using OpenAuth.App.Interface;
using OpenAuth.App.SSO;
@ -14,6 +13,8 @@ using OpenAuth.Auth.AuthStrategies;
using OpenAuth.Auth.Interface;
using OpenAuth.Repository;
using SqlSugar;
using System.Reflection;
using System.Runtime.Loader;
namespace OpenAuth.App
{
@ -26,46 +27,23 @@ namespace OpenAuth.App
//builder.RegisterGeneric(typeof(SimpleClient<>)).As(typeof(ISimpleClient<>)).InstancePerLifetimeScope();
//builder.RegisterGeneric(typeof(SugarRepositiry<>)).As(typeof(ISugarRepositiry<>)).InstancePerLifetimeScope();
//builder.RegisterGeneric(typeof(SugarUnitOfWork<>)).As(typeof(ISugarUnitOfWork<>)).InstancePerLifetimeScope();
builder.RegisterAssemblyTypes(typeof(AuthStrategyContext).Assembly).InstancePerLifetimeScope();
//注入授权
builder.RegisterType(typeof(LocalAuth)).As(typeof(IAuth)).InstancePerLifetimeScope();
builder.RegisterAssemblyTypes(typeof(AuthStrategyContext).Assembly).InstancePerLifetimeScope();
builder.RegisterType<AuthContextFactory>().AsSelf().InstancePerLifetimeScope();
builder.RegisterType<LoginParse>().AsSelf().InstancePerLifetimeScope();
builder.RegisterAssemblyTypes(typeof(UserManager).Assembly).InstancePerLifetimeScope();
//注册app层
builder.RegisterAssemblyTypes(Assembly.GetExecutingAssembly()).InstancePerLifetimeScope();
//builder.RegisterAssemblyTypes(Assembly.GetExecutingAssembly()).InstancePerLifetimeScope();
// builder.RegisterAssemblyTypes(Assembly.GetExecutingAssembly())
//.Where(t => t.Name.EndsWith("App"))
//.AsSelf()
//.InstancePerLifetimeScope();
builder.RegisterType(typeof(RedisCacheContext)).As(typeof(ICacheContext)).InstancePerLifetimeScope();
//builder.RegisterType(typeof(CacheContext)).As(typeof(ICacheContext));
builder.RegisterType(typeof(HttpContextAccessor)).As(typeof(IHttpContextAccessor))
.InstancePerLifetimeScope();
try
{
foreach (Assembly assembly in ce.autofac.extension.Extensions.GetAssemblies())
{
foreach (Type type in assembly.GetTypes().Where((Func<Type, bool>)(t =>
typeof(IBLL).IsAssignableFrom(t) &&
t.GetCustomAttribute<BLLNameAttribute>() != null)))
{
BLLNameAttribute customAttribute = type.GetCustomAttribute<BLLNameAttribute>();
Type serviceType =
type.GetInterfaces().FirstOrDefault(
(Func<Type, bool>)(t => typeof(IBLL).IsAssignableFrom(t)));
if (serviceType != null)
{
builder.RegisterType(type).AsImplementedInterfaces()
.Named(customAttribute.BLLName, serviceType);
builder.RegisterType(type).Named(customAttribute.BLLName, type);
}
}
}
}
catch (Exception e)
{
Console.WriteLine(e);
throw;
}
builder.RegisterType(typeof(HttpContextAccessor)).As(typeof(IHttpContextAccessor)).InstancePerLifetimeScope();
InitDependency(builder);
builder.RegisterModule(new QuartzAutofacFactoryModule());
@ -91,8 +69,7 @@ namespace OpenAuth.App
{
try
{
assemblyList.Add(
AssemblyLoadContext.Default.LoadFromAssemblyName(new AssemblyName(_compilation.Name)));
assemblyList.Add(AssemblyLoadContext.Default.LoadFromAssemblyName(new AssemblyName(_compilation.Name)));
}
catch (Exception ex)
{

@ -1,6 +1,4 @@
using Castle.Core.Internal;
using ClosedXML.Excel;
using Infrastructure;
using Infrastructure;
using Infrastructure.Extensions;
using Microsoft.AspNetCore.Mvc;
using OpenAuth.Auth.Interface;
@ -29,57 +27,7 @@ namespace OpenAuth.App
this.auth = auth;
}
/// <summary>
/// 创建表
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
[HttpPost]
public string CreateTable([FromBody] CreateTableReq req)
{
string tableName = req.TableName;
List<TableInfo> tableInfo = req.TableInfos;
if(tableName == null||tableInfo.Count==0) {
return "数据不能为空";
}
string sql = @"CREATE TABLE ""public""." + tableName+"("+ "id varchar(255) COLLATE \"pg_catalog\".\"default\" NOT NULL,";
string explanation = "";
int type = 0;
for (int i = 0; i < tableInfo.Count; i++) {
TableInfo table = tableInfo[i];
if ("id".Equals(table.Name.ToLower())){
continue;
}
sql = sql +table.Name+" "+ table.Type;
if (!table.Name.IsNullOrEmpty()) {
explanation = explanation + "COMMENT ON COLUMN \"public\"." + tableName + "." + table.Name + " Is "+"'"+ table.Explanation+"'"+";" ;
}
if ("varchar".Equals(table.Name.ToLower())) {
sql = sql +"("+255+")";
}
if (table.Type.Contains("geom")) {
type = 1;
}
/*if (table.IsNull) {
sql = sql+" "+"NOT NUll";
}*/
sql = sql + ",";
if (tableInfo.Count-1==i) {
sql = sql + "CONSTRAINT "+ tableName +"_pkey PRIMARY KEY (\"id\"));";
}
}
Console.WriteLine(sql);
int count = client.Ado.ExecuteCommand(sql);
Console.WriteLine(count);
string sql1 = "ALTER TABLE \"public\"." + tableName+ " OWNER TO \"postgres\"";
client.Ado.ExecuteCommand(sql1);
addExplain(explanation);
SysUser user = auth.GetCurrentUser().User;
string sql22 = "insert into table_record (\"TableName\",\"Type\",\"ColumnJson\",\"CreateUser\") values('" + tableName+"'," + type+",'"+ String.Join(":",tableInfo.Select(
p=> $"{p.Name},{p.Type},{p.Explanation}"))+ "','"+user.Account+"')";
client.Ado.ExecuteCommand(sql22);
return "创建成功";
}
[HttpPost]
public string CreateView([FromBody] CreateViewReq req) {
@ -87,103 +35,9 @@ namespace OpenAuth.App
return "创建成功";
}
[HttpPost]
public List<TableInfo> UploadExcel(UploadExcelReq req)
{
using (var workbook = new XLWorkbook(req.file.OpenReadStream())){
string tableName = req.tableName;
var wooksheet = workbook.Worksheet(1);
IXLRows row = wooksheet.RowsUsed();
List<IXLRow> rowCells = row.ToList();
IXLRow row1 = rowCells[0];
IXLCells cells = row1.CellsUsed();
string sqltable = @"CREATE TABLE if not exists ""public""." + "table_relation_record " + "(" + "id varchar(255) COLLATE \"pg_catalog\".\"default\" NOT NULL," +
"name varchar(32) COLLATE \"pg_catalog\".\"default\"," +
"relation text COLLATE \"pg_catalog\".\"default\","+
" CONSTRAINT \"table_relation_record_pkey\" PRIMARY KEY (\"id\"))\r\n;" +
"ALTER TABLE \"public\".\"table_relation_record\" OWNER TO \"postgres\";";
addExplain(sqltable);
string sql = @"CREATE TABLE ""public""." + tableName + "(" + "id varchar(255) COLLATE \"pg_catalog\".\"default\" NOT NULL,";
string explanation = "";
List<TableInfo> listTableInfo = new List<TableInfo>();
int k = 0;
JsonObject json = new JsonObject();
foreach (IXLCell cell in row1.CellsUsed())
{
if (cell.GetString().IsNullOrEmpty()) {
break;}
json.Add(cell.GetString(), "cloum" + k);
TableInfo tableInfo = new TableInfo();
tableInfo.Name = "cloum" + k;
tableInfo.Type = "varchar";
// tableInfo.Length = 255;
tableInfo.Explanation = cell.GetString();
listTableInfo.Add(tableInfo);
sql = sql + "cloum" + k + " " + "varchar(255),";
explanation = explanation + "COMMENT ON COLUMN \"public\"." + tableName + "." + "cloum" + k + " Is " + "'" + cell.GetString() + "'" + ";";
k++;
}
Dictionary<String, Object> dict = new Dictionary<String, Object>();
dict.Add("id", Guid.NewGuid());
dict.Add("name", tableName);
dict.Add("relation", json.ToJsonString());
client.Insertable(dict).AS("table_relation_record").ExecuteCommand();
sql = sql + "CONSTRAINT " + tableName + "_pkey PRIMARY KEY (\"id\"));";
string sql1 = "ALTER TABLE \"public\"." + tableName + " OWNER TO \"postgres\"";
addExplain(sql);
addExplain(sql1);
addExplain(explanation);
var count = wooksheet.RowCount();
List<Dictionary<String,Object>> listmap = new List<Dictionary<String, Object>>();
foreach (IXLRow rowValue in wooksheet.RowsUsed()) {
if (rowValue.RowNumber() == 1) {
continue;
}
Dictionary<String, Object> map = new Dictionary<String, Object>();
map.Add("id", Guid.NewGuid());
int g = 0;
foreach (IXLCell cell in rowValue.CellsUsed()) {
map.Add("cloum" + g, cell.GetString());
g++;
}
listmap.Add(map);
}
client.Insertable(listmap).AS(tableName).ExecuteCommand();
return listTableInfo;
}
}
[HttpPost]
public string UpdateTable([FromBody] CreateTableReq req)
{
List<TableInfo> infos = req.TableInfos;
string sql = "";
foreach (TableInfo info in infos) {
if (!info.YuanName.IsNullOrEmpty())
{
sql = sql + @"ALTER TABLE ""public""."+req.TableName+"RENAME COLUMN"+info.YuanName + " TO " + info.Name+ ";";
}
}
if (!sql.IsNullOrEmpty()) { addExplain(sql); }
return "创建成功";
}
public void addExplain(String sql) {
client.Ado.ExecuteCommand(sql);
}
public bool CheckTableExist(string tableName)

@ -1,4 +1,4 @@
using DocumentFormat.OpenXml.Spreadsheet;

using Infrastructure;
using Microsoft.Extensions.Configuration;
using NPOI.HSSF.UserModel;
@ -11,10 +11,8 @@ using OpenAuth.Repository.Domain;
using SqlSugar;
using System.Linq.Expressions;
using System.Text;
using Castle.Core.Internal;
using DocumentFormat.OpenXml.Drawing.Charts;
using OpenAuth.Auth.Interface;
using DocumentFormat.OpenXml.EMMA;
namespace OpenAuth.App.FormModule
{
@ -573,7 +571,7 @@ namespace OpenAuth.App.FormModule
var info = list.FindAll(t =>
t.DbObjectType == DbObjectType.Table && t.Name.ToLower() != "lr_db_codecolumns" &&
t.Name.ToLower() != "lr_db_codetable" && t.Name.ToLower() != "lr_db_history")
.WhereIF(!key.IsNullOrEmpty(), t => t.Name.ToLower().Contains(key.ToLower())).ToList();
.WhereIF(!string.IsNullOrEmpty(key), t => t.Name.ToLower().Contains(key.ToLower())).ToList();
return new Response<List<DbTableInfo>>
{
Result = info

@ -8,9 +8,7 @@ using System.Text;
using System.Threading.Tasks;
using SqlSugar;
using OpenAuth.App.Request;
using OpenAuth.App.Response;
using Infrastructure;
using OpenAuth.Repository.Core;
using System.Data;
using System.Text.RegularExpressions;
using OpenAuth.App.FormScheme.Response;
@ -23,19 +21,11 @@ using OpenAuth.App.FormScheme.Request;
using System.Collections.Concurrent;
using ce.autofac.extension;
using OpenAuth.App.DataCodeRule;
using Infrastructure.Extensions;
using OpenAuth.App.BasicQueryService;
using OpenAuth.App.Permission;
using NPOI.SS.Formula.Functions;
using OpenAuth.App.DataSource;
using System.Data.SqlTypes;
using DocumentFormat.OpenXml.Spreadsheet;
using NPOI.HSSF.UserModel;
using NPOI.SS.UserModel;
using OpenAuth.App.FormModule;
using Microsoft.Extensions.Logging;
using OpenAuth.Auth.Interface;
using Castle.Core.Internal;
using Utils.Web.Model;
namespace OpenAuth.App.FormScheme

@ -1,6 +1,4 @@
using DocumentFormat.OpenXml.InkML;
using DocumentFormat.OpenXml.Spreadsheet;
using Microsoft.AspNetCore.SignalR;
using Microsoft.AspNetCore.SignalR;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;

@ -9,13 +9,11 @@ using System.Threading.Tasks;
using Infrastructure;
using SqlSugar;
using OpenAuth.App.BaseApp.Request;
using DocumentFormat.OpenXml.Office2010.Excel;
using Infrastructure.Helpers;
using OpenAuth.Repository.Core;
using OpenAuth.App.BaseApp.WFTask;
using OpenAuth.App.BaseApp.ImMsgManager;
using Microsoft.Extensions.Configuration;
using DocumentFormat.OpenXml.EMMA;
using OpenAuth.Auth.Interface;
namespace OpenAuth.App.BaseApp

@ -1,8 +1,6 @@
using ce.autofac.extension;
using Infrastructure.Helpers;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.SignalR.Client;
namespace OpenAuth.App.BaseApp.ImMsgManager
{
public static class SendHubs
@ -18,25 +16,25 @@ namespace OpenAuth.App.BaseApp.ImMsgManager
// 参数
public static async Task callMethod(string imurl2, string imopen,string methodName, params object[] args)
{
if (imopen=="false")
{
return;
}
//if (imopen=="false")
//{
// return;
//}
if (string.IsNullOrEmpty(imurl2))
{
IHttpContextAccessor accessor = IocManager.Instance.GetService<IHttpContextAccessor>();
if (accessor.HttpContext != null)
{
imurl2 = accessor.HttpContext.Request.Host.Value;
imurl2 = ((!accessor.HttpContext.Request.IsHttps) ? ("http://" + imurl2) : ("https://" + imurl2));
}
}
//if (string.IsNullOrEmpty(imurl2))
//{
// IHttpContextAccessor accessor = IocManager.Instance.GetService<IHttpContextAccessor>();
// if (accessor.HttpContext != null)
// {
// imurl2 = accessor.HttpContext.Request.Host.Value;
// imurl2 = ((!accessor.HttpContext.Request.IsHttps) ? ("http://" + imurl2) : ("https://" + imurl2));
// }
//}
HubConnection connection = new HubConnectionBuilder().WithUrl(imurl2 + "/chathub").Build();
await connection.StartAsync();
await connection.InvokeCoreAsync(methodName, args);
await connection.StopAsync();
//HubConnection connection = new HubConnectionBuilder().WithUrl(imurl2 + "/chathub").Build();
//await connection.StartAsync();
//await connection.InvokeCoreAsync(methodName, args);
//await connection.StopAsync();
}
}
}

@ -8,7 +8,6 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using OpenAuth.App.BaseApp.WFTask;
using DocumentFormat.OpenXml.Drawing.Diagrams;
using OpenAuth.Repository.Domain;
using OpenAuth.App.Interface;
using OpenAuth.Auth.Interface;

@ -3,49 +3,11 @@
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<OutputType>Library</OutputType>
<Nullable>enable</Nullable>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DocumentationFile>bin\Debug\net5.0\OpenAuth.App.xml</DocumentationFile>
<NoWarn>1701;1702;1591;1573;1572;1570</NoWarn>
</PropertyGroup>
<ItemGroup>
<Compile Remove="Model\**" />
<EmbeddedResource Remove="Model\**" />
<None Remove="Model\**" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Autofac" Version="8.3.0" />
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="10.0.0" />
<PackageReference Include="Autofac.Extras.Quartz" Version="10.0.0" />
<PackageReference Include="ce.autofac.extension" Version="6.0.2" />
<PackageReference Include="ClosedXML" Version="0.102.2" />
<PackageReference Include="Flurl.Http" Version="3.2.4" />
<PackageReference Include="MessagePack" Version="3.0.308" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.16" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="8.0.16" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="8.0.16" />
<PackageReference Include="Microsoft.AspNetCore.SignalR" Version="1.2.0" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="8.0.6" />
<PackageReference Include="Microsoft.Extensions.DependencyModel" Version="8.0.2" />
<PackageReference Include="Microsoft.Extensions.Http" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Log4Net.AspNetCore" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="8.0.0" />
<PackageReference Include="Microsoft.IdentityModel.JsonWebTokens" Version="7.7.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" />
<PackageReference Include="Moq" Version="4.13.1" />
<PackageReference Include="Npgsql" Version="6.0.13" />
<PackageReference Include="Npgsql.NetTopologySuite" Version="6.0.13" />
<PackageReference Include="NPOI" Version="2.7.3" />
<PackageReference Include="NUnit" Version="3.13.1" />
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0" />
<PackageReference Include="Quartz" Version="3.14.0" />
<PackageReference Include="System.Drawing.Common" Version="7.0.0" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="7.7.1" />
<PackageReference Include="System.IO.Packaging" Version="8.0.1" />
</ItemGroup>
<ItemGroup>
@ -56,9 +18,4 @@
<ProjectReference Include="..\Utils.Web\Utils.Web.csproj" />
</ItemGroup>
<ItemGroup>
<Folder Include="FormModule\Response\" />
<Folder Include="Permission\" />
</ItemGroup>
</Project>

@ -2,8 +2,6 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using DocumentFormat.OpenXml.Spreadsheet;
using DocumentFormat.OpenXml.Wordprocessing;
using Infrastructure;
using Infrastructure.Extensions;
using Infrastructure.Helpers;

@ -17,7 +17,6 @@ using System.Linq;
using Newtonsoft.Json;
using OpenAuth.App.BaseApp.Jobs;
using System.Text;
using DocumentFormat.OpenXml.Spreadsheet;
using Infrastructure.Utilities;
using OpenAuth.Auth.Interface;
using System.Diagnostics;

@ -1,18 +1,13 @@
using System.Data;
using DocumentFormat.OpenXml.Office2010.Excel;
using Infrastructure;
using Infrastructure.Extensions;
using JetBrains.Annotations;
using Microsoft.Extensions.Configuration;
using Moq;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using NPOI.SS.Formula.Functions;
using OpenAuth.Auth.Interface;
using OpenAuth.App.BaseApp.WFTask.Response;
using OpenAuth.App.FormScheme;
using OpenAuth.App.FormScheme.Response;
using OpenAuth.App.Interface;
using OpenAuth.App.Request;
using OpenAuth.Repository;
using OpenAuth.Repository.Domain;

@ -6,16 +6,6 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="MessagePack" Version="3.0.308" />
<PackageReference Include="Microsoft.IdentityModel.JsonWebTokens" Version="7.7.1" />
<PackageReference Include="Npgsql" Version="6.0.13" />
<PackageReference Include="System.Drawing.Common" Version="7.0.0" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="7.7.1" />
<PackageReference Include="System.IO.Packaging" Version="8.0.1" />
<PackageReference Include="System.Text.RegularExpressions" Version="4.3.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Infrastructure\Infrastructure.csproj" />
<ProjectReference Include="..\OpenAuth.Repository\OpenAuth.Repository.csproj" />

@ -8,14 +8,6 @@
<ItemGroup>
<PackageReference Include="ce.autofac.extension" Version="6.0.2" />
<PackageReference Include="MessagePack" Version="3.0.308" />
<PackageReference Include="Microsoft.IdentityModel.JsonWebTokens" Version="7.7.1" />
<PackageReference Include="Npgsql" Version="6.0.13" />
<PackageReference Include="System.Drawing.Common" Version="7.0.0" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="7.7.1" />
<PackageReference Include="System.IO.Packaging" Version="8.0.1" />
<PackageReference Include="System.Text.Json" Version="8.0.5" />
<PackageReference Include="System.Text.RegularExpressions" Version="4.3.1" />
</ItemGroup>
<ItemGroup>

@ -31,21 +31,21 @@ namespace OpenAuth.Controllers
_logger = logger;
}
[HttpPost]
public Response<string> CreateTable([FromBody] CreateTableReq req)
{
Response<string> response = new Response<string>();
try
{
response.Result = _app.CreateTable(req);
}
catch (Exception ex)
{
response.Code = 500;
response.Message = ex.InnerException?.Message ?? ex.Message;
}
return response;
}
//[HttpPost]
//public Response<string> CreateTable([FromBody] CreateTableReq req)
//{
// Response<string> response = new Response<string>();
// try
// {
// response.Result = _app.CreateTable(req);
// }
// catch (Exception ex)
// {
// response.Code = 500;
// response.Message = ex.InnerException?.Message ?? ex.Message;
// }
// return response;
//}
[HttpPost]
@ -67,39 +67,39 @@ namespace OpenAuth.Controllers
[HttpPost]
public Response<List<TableInfo>> uploadExcel(UploadExcelReq req)
{
//[HttpPost]
//public Response<List<TableInfo>> uploadExcel(UploadExcelReq req)
//{
Response<List<TableInfo>> response = new Response<List<TableInfo>>();
try
{
response.Result = _app.UploadExcel(req);
}
catch (Exception ex)
{
response.Code = 500;
response.Message = ex.InnerException?.Message ?? ex.Message;
}
return response;
}
// Response<List<TableInfo>> response = new Response<List<TableInfo>>();
// try
// {
// response.Result = _app.UploadExcel(req);
// }
// catch (Exception ex)
// {
// response.Code = 500;
// response.Message = ex.InnerException?.Message ?? ex.Message;
// }
// return response;
//}
[HttpPost]
public Response<string> UpdateTable([FromBody] CreateTableReq req)
{
Response<string> response = new Response<string>();
try
{
response.Result = _app.UpdateTable(req);
}
catch (Exception ex)
{
response.Code = 500;
response.Message = ex.InnerException?.Message ?? ex.Message;
}
return response;
}
//[HttpPost]
//public Response<string> UpdateTable([FromBody] CreateTableReq req)
//{
// Response<string> response = new Response<string>();
// try
// {
// response.Result = _app.UpdateTable(req);
// }
// catch (Exception ex)
// {
// response.Code = 500;
// response.Message = ex.InnerException?.Message ?? ex.Message;
// }
// return response;
//}
[HttpGet]
public Response<PageInfo<List<TableRecord>>> LoadTableRecordInfo(string keyword, int page = 1, int limit = 15)

@ -1,5 +1,4 @@
using DocumentFormat.OpenXml.Office2010.Excel;
using Infrastructure;
using Infrastructure;
using Infrastructure.Helpers;
using Infrastructure.Helpers.Excel;
using Infrastructure.Helpers.Excel.Model;

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
@ -8,19 +8,11 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="MessagePack" Version="3.0.308" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.3.0" />
<PackageReference Include="Microsoft.IdentityModel.JsonWebTokens" Version="7.7.1" />
<PackageReference Include="Npgsql" Version="6.0.13" />
<PackageReference Include="System.Drawing.Common" Version="7.0.0" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="7.7.1" />
<PackageReference Include="System.IO.Packaging" Version="8.0.1" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="2.3.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Infrastructure\Infrastructure.csproj" />
<ProjectReference Include="..\OpenAuth.App\OpenAuth.App.csproj" />
<ProjectReference Include="..\Utils.Web\Utils.Web.csproj" />
</ItemGroup>
</Project>

@ -9,8 +9,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Infrastructure", "Infrastru
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenAuth.Repository", "OpenAuth.Repository\OpenAuth.Repository.csproj", "{4BD1F522-FC5C-4DEB-ACE9-1242BCE235BD}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenAuth.App", "OpenAuth.App\OpenAuth.App.csproj", "{00D63D11-D95D-4960-9F49-B102344303A7}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "01 基础模块", "01 基础模块", "{02EA681E-C7D8-13C7-8484-4AC65E1B71E8}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "02 基础服务", "02 基础服务", "{2A791A38-1992-4CDE-9B7F-FDD85B4C5C20}"
@ -27,12 +25,14 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenAuth.Auth", "OpenAuth.A
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Utils.Web", "Utils.Web\Utils.Web.csproj", "{5C927D05-615E-403A-8315-2B9BF39A06D1}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenAuth.Controllers", "OpenAuth.Controllers\OpenAuth.Controllers.csproj", "{0A3C89F2-50F3-45F6-AA0A-C276257552E2}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bus.App", "Bus.App\Bus.App.csproj", "{488C5305-3D8C-46D6-88B6-DB38EB653E9C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bus.Controllers", "Bus.Controllers\Bus.Controllers.csproj", "{24A0AADD-3509-48E5-BDFC-8367A3355555}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenAuth.Controllers", "OpenAuth.Controllers\OpenAuth.Controllers.csproj", "{759D4D96-F77A-48A3-A207-0D8725A965C2}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenAuth.App", "OpenAuth.App\OpenAuth.App.csproj", "{F1115299-7B4F-4405-AD21-307C376B129F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -51,10 +51,6 @@ Global
{4BD1F522-FC5C-4DEB-ACE9-1242BCE235BD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4BD1F522-FC5C-4DEB-ACE9-1242BCE235BD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4BD1F522-FC5C-4DEB-ACE9-1242BCE235BD}.Release|Any CPU.Build.0 = Release|Any CPU
{00D63D11-D95D-4960-9F49-B102344303A7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{00D63D11-D95D-4960-9F49-B102344303A7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{00D63D11-D95D-4960-9F49-B102344303A7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{00D63D11-D95D-4960-9F49-B102344303A7}.Release|Any CPU.Build.0 = Release|Any CPU
{3466DD71-9623-4704-BA7F-F864F38E73A3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3466DD71-9623-4704-BA7F-F864F38E73A3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3466DD71-9623-4704-BA7F-F864F38E73A3}.Release|Any CPU.ActiveCfg = Release|Any CPU
@ -67,10 +63,6 @@ Global
{5C927D05-615E-403A-8315-2B9BF39A06D1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5C927D05-615E-403A-8315-2B9BF39A06D1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5C927D05-615E-403A-8315-2B9BF39A06D1}.Release|Any CPU.Build.0 = Release|Any CPU
{0A3C89F2-50F3-45F6-AA0A-C276257552E2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0A3C89F2-50F3-45F6-AA0A-C276257552E2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0A3C89F2-50F3-45F6-AA0A-C276257552E2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0A3C89F2-50F3-45F6-AA0A-C276257552E2}.Release|Any CPU.Build.0 = Release|Any CPU
{488C5305-3D8C-46D6-88B6-DB38EB653E9C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{488C5305-3D8C-46D6-88B6-DB38EB653E9C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{488C5305-3D8C-46D6-88B6-DB38EB653E9C}.Release|Any CPU.ActiveCfg = Release|Any CPU
@ -79,6 +71,14 @@ Global
{24A0AADD-3509-48E5-BDFC-8367A3355555}.Debug|Any CPU.Build.0 = Debug|Any CPU
{24A0AADD-3509-48E5-BDFC-8367A3355555}.Release|Any CPU.ActiveCfg = Release|Any CPU
{24A0AADD-3509-48E5-BDFC-8367A3355555}.Release|Any CPU.Build.0 = Release|Any CPU
{759D4D96-F77A-48A3-A207-0D8725A965C2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{759D4D96-F77A-48A3-A207-0D8725A965C2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{759D4D96-F77A-48A3-A207-0D8725A965C2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{759D4D96-F77A-48A3-A207-0D8725A965C2}.Release|Any CPU.Build.0 = Release|Any CPU
{F1115299-7B4F-4405-AD21-307C376B129F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F1115299-7B4F-4405-AD21-307C376B129F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F1115299-7B4F-4405-AD21-307C376B129F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F1115299-7B4F-4405-AD21-307C376B129F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -87,13 +87,13 @@ Global
{A44BD472-84E3-4D70-9DC5-06210617D6EE} = {A651C0AB-3E8E-4F90-A754-6BE8A1D7E61B}
{8F9EAD1A-9407-41BA-844A-02282B4646F3} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
{4BD1F522-FC5C-4DEB-ACE9-1242BCE235BD} = {2A791A38-1992-4CDE-9B7F-FDD85B4C5C20}
{00D63D11-D95D-4960-9F49-B102344303A7} = {91563DFE-D0AA-4780-99EF-D3C941BEF386}
{3466DD71-9623-4704-BA7F-F864F38E73A3} = {2A791A38-1992-4CDE-9B7F-FDD85B4C5C20}
{68D5B7CD-E897-434F-9EE0-21EF72A92C22} = {2A791A38-1992-4CDE-9B7F-FDD85B4C5C20}
{5C927D05-615E-403A-8315-2B9BF39A06D1} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
{0A3C89F2-50F3-45F6-AA0A-C276257552E2} = {91563DFE-D0AA-4780-99EF-D3C941BEF386}
{488C5305-3D8C-46D6-88B6-DB38EB653E9C} = {4E2621F7-BAF9-4A80-B4D9-E914C6B0CD2F}
{24A0AADD-3509-48E5-BDFC-8367A3355555} = {4E2621F7-BAF9-4A80-B4D9-E914C6B0CD2F}
{759D4D96-F77A-48A3-A207-0D8725A965C2} = {91563DFE-D0AA-4780-99EF-D3C941BEF386}
{F1115299-7B4F-4405-AD21-307C376B129F} = {91563DFE-D0AA-4780-99EF-D3C941BEF386}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {88FD47DB-4BD4-4B0F-9E12-49383F5AFFEB}

@ -12,21 +12,9 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Autofac" Version="8.3.0" />
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="10.0.0" />
<PackageReference Include="MessagePack" Version="3.0.308" />
<PackageReference Include="Microsoft.IdentityModel.JsonWebTokens" Version="7.7.1" />
<PackageReference Include="Moq" Version="4.13.1" />
<PackageReference Include="Npgsql" Version="6.0.13" />
<PackageReference Include="NUnit" Version="3.13.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0" />
<PackageReference Include="SqlSugarCore" Version="5.1.4.146" />
<PackageReference Include="System.Drawing.Common" Version="7.0.0" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="7.7.1" />
<PackageReference Include="System.IO.Packaging" Version="8.0.1" />
<PackageReference Include="System.Text.RegularExpressions" Version="4.3.1" />
</ItemGroup>
<ItemGroup>

@ -28,37 +28,18 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="log4net" Version="2.0.15" />
<PackageReference Include="MessagePack" Version="3.0.308" />
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="10.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="8.0.16" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="8.0.16" />
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="8.0.16" />
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.DependencyModel" Version="8.0.2" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Log4Net.AspNetCore" Version="8.0.0" />
<PackageReference Include="Microsoft.IdentityModel.JsonWebTokens" Version="7.7.1" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.17.2" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="8.0.7" />
<PackageReference Include="MiniProfiler.AspNetCore" Version="4.2.22" />
<PackageReference Include="MiniProfiler.AspNetCore.Mvc" Version="4.2.22" />
<PackageReference Include="MiniProfiler.Shared" Version="4.2.22" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Npgsql" Version="6.0.13" />
<PackageReference Include="NPOI" Version="2.7.3" />
<PackageReference Include="NUnit" Version="3.13.1" />
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0" />
<PackageReference Include="Quartz" Version="3.14.0" />
<PackageReference Include="Quartz.Extensions.DependencyInjection" Version="3.14.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="8.1.1" />
<PackageReference Include="System.Drawing.Common" Version="7.0.0" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="7.7.1" />
<PackageReference Include="System.IO.Packaging" Version="8.0.1" />
<PackageReference Include="System.Text.Json" Version="8.0.5" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Bus.Controllers\Bus.Controllers.csproj" />
<ProjectReference Include="..\Infrastructure\Infrastructure.csproj" />
<ProjectReference Include="..\OpenAuth.Controllers\OpenAuth.Controllers.csproj" />
</ItemGroup>

@ -1,7 +1,6 @@
using System.Reflection;
using System.Text.RegularExpressions;
using Autofac;
using Autofac.Extensions.DependencyInjection;
using ce.autofac.extension;
using Infrastructure;
using Infrastructure.Extensions.AutofacManager;
@ -196,7 +195,7 @@ namespace OpenAuth.WebApi
},
db =>
{
NpgsqlConnection.GlobalTypeMapper.UseNetTopologySuite();
//NpgsqlConnection.GlobalTypeMapper.UseNetTopologySuite();
//单例参数配置,所有上下文生效
db.Aop.OnLogExecuting = (sql, pars) =>
{
@ -249,7 +248,7 @@ namespace OpenAuth.WebApi
public void Configure(IApplicationBuilder app, IHostEnvironment env)
{
//loggerFactory.AddLog4Net();
IocManager.Instance.Container = app.ApplicationServices.GetAutofacRoot();
//IocManager.Instance.Container = app.ApplicationServices.GetAutofacRoot();
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();

@ -0,0 +1,8 @@
namespace TestApp
{
public class Class1
{
public int Id { get; set; }
public int Name { get; set; }
}
}

@ -0,0 +1,37 @@
using System;
using System.ComponentModel.DataAnnotations;
namespace TestApp.SSO
{
public class PassportLoginRequest
{
/// <example>System</example>
public string Account { get; set; }
/// <example>e10adc3949ba59abbe56e057f20f883e</example>
public string Password { get; set; }
/// <summary>
/// 应用的AppSecrect目前没判定可以随便填一个。如果需要判定请根据注释调整LoginParse.Do方法
/// </summary>
/// <example>openauth</example>
public string AppKey { get; set; }
public void Trim()
{
if (string.IsNullOrEmpty(Account))
{
throw new Exception("用户名不能为空");
}
if (string.IsNullOrEmpty(Password))
{
throw new Exception("密码不能为空");
}
Account = Account.Trim();
Password = Password.Trim();
if (!string.IsNullOrEmpty(AppKey)) AppKey = AppKey.Trim();
}
}
}

@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

@ -6,13 +6,6 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="MessagePack" Version="3.0.308" />
<PackageReference Include="System.Drawing.Common" Version="7.0.0" />
<PackageReference Include="System.IO.Packaging" Version="8.0.1" />
<PackageReference Include="System.Text.RegularExpressions" Version="4.3.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Infrastructure\Infrastructure.csproj" />
</ItemGroup>

Loading…
Cancel
Save