Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
performance
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zry
performance
Commits
d0d91b94
Commit
d0d91b94
authored
Nov 29, 2024
by
wyc
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'ORM' into develop
parents
0650f856
ddf312c5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
39 additions
and
10 deletions
+39
-10
performance/Performance.Repository/InfraRepository.cs
+20
-0
performance/Performance.Repository/Performance.Repository.csproj
+2
-1
performance/Performance.Services/AllotCompute/EPImportDataService.cs
+17
-9
performance/Performance.Services/AllotCompute/ImportDataService.cs
+0
-0
No files found.
performance/Performance.Repository/InfraRepository.cs
0 → 100644
View file @
d0d91b94
using
SqlSugar
;
namespace
Performance.Repository
{
public
class
InfraRepository
{
public
static
SqlSugarClient
GetDbclient
(
string
connectionString
)
{
return
new
SqlSugarClient
(
new
ConnectionConfig
()
{
ConnectionString
=
connectionString
,
DbType
=
SqlSugar
.
DbType
.
MySql
,
IsAutoCloseConnection
=
true
},
db
=>
{
});
}
}
}
performance/Performance.Repository/Performance.Repository.csproj
View file @
d0d91b94
...
@@ -6,8 +6,9 @@
...
@@ -6,8 +6,9 @@
<ItemGroup>
<ItemGroup>
<PackageReference Include="Npgsql" Version="5.0.18" />
<PackageReference Include="Npgsql" Version="5.0.18" />
<PackageReference Include="Oracle.ManagedDataAccess.Core" Version="3.21.
4
" />
<PackageReference Include="Oracle.ManagedDataAccess.Core" Version="3.21.
100
" />
<PackageReference Include="System.Data.SqlClient" Version="4.8.3" />
<PackageReference Include="System.Data.SqlClient" Version="4.8.3" />
<PackageReference Include="SqlSugarCore" Version="5.1.4.170" />
</ItemGroup>
</ItemGroup>
...
...
performance/Performance.Services/AllotCompute/EPImportDataService.cs
View file @
d0d91b94
...
@@ -10,9 +10,11 @@
...
@@ -10,9 +10,11 @@
using
Performance.EntityModels
;
using
Performance.EntityModels
;
using
Performance.Infrastructure
;
using
Performance.Infrastructure
;
using
Performance.Infrastructure.Extensions
;
using
Performance.Infrastructure.Extensions
;
using
Performance.Repository
;
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Data
;
using
System.Data
;
using
System.Diagnostics
;
using
System.Drawing
;
using
System.Drawing
;
using
System.IO
;
using
System.IO
;
using
System.Linq
;
using
System.Linq
;
...
@@ -131,18 +133,24 @@ public List<ImportData> ReadSheetData(per_allot allot)
...
@@ -131,18 +133,24 @@ public List<ImportData> ReadSheetData(per_allot allot)
try
try
{
{
//var connectionString = _configuration.GetValue("AppConnection:PerformanceConnectionString", "");
//var tasks = new List<Task>();
//foreach (var sheetName in importDatas.Select(w => w.SheetName).Distinct())
//{
// var task = Task.Factory.StartNew(() =>
// {
// var items = importDatas.Where(w => w.SheetName == sheetName).ToList();
// DapperExtensions.BulkInsert(connectionString, items, tableName: "im_orig_data", commandTimeout: 60 * 60 * 5);
// });
// tasks.Add(task);
//}
//Task.WaitAll(tasks.ToArray());
var
connectionString
=
_configuration
.
GetValue
(
"AppConnection:PerformanceConnectionString"
,
""
);
var
connectionString
=
_configuration
.
GetValue
(
"AppConnection:PerformanceConnectionString"
,
""
);
var
tasks
=
new
List
<
Task
>(
);
var
db
=
InfraRepository
.
GetDbclient
(
connectionString
);
foreach
(
var
sheetName
in
importDatas
.
Select
(
w
=>
w
.
SheetName
).
Distinct
())
if
(
importDatas
.
Any
())
{
{
var
task
=
Task
.
Factory
.
StartNew
(()
=>
db
.
Fastest
<
ImportData
>().
AS
(
"im_orig_data"
).
PageSize
(
100000
).
BulkCopy
(
importDatas
);
{
var
items
=
importDatas
.
Where
(
w
=>
w
.
SheetName
==
sheetName
).
ToList
();
DapperExtensions
.
BulkInsert
(
connectionString
,
items
,
tableName
:
"im_orig_data"
,
commandTimeout
:
60
*
60
*
5
);
});
tasks
.
Add
(
task
);
}
}
Task
.
WaitAll
(
tasks
.
ToArray
());
_logManageService
.
WriteMsg
(
"保存基础数据"
,
$"基础数据保存完成!"
,
1
,
allot
.
ID
,
"ReceiveMessage"
,
true
);
_logManageService
.
WriteMsg
(
"保存基础数据"
,
$"基础数据保存完成!"
,
1
,
allot
.
ID
,
"ReceiveMessage"
,
true
);
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
...
...
performance/Performance.Services/AllotCompute/ImportDataService.cs
View file @
d0d91b94
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment