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
8392e9fd
Commit
8392e9fd
authored
Jun 02, 2020
by
lcx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
原始数据单数据修改
parent
78ba2d91
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
66 additions
and
82 deletions
+66
-82
performance/Performance.DtoModels/Request/OriginalRequest.cs
+1
-1
performance/Performance.Services/OriginalService.cs
+65
-81
No files found.
performance/Performance.DtoModels/Request/OriginalRequest.cs
View file @
8392e9fd
...
...
@@ -10,6 +10,6 @@ public class OriginalRequest
public
int
RowNumber
{
get
;
set
;
}
public
List
<
Cell
>
Cells
{
get
;
set
;
}
public
Cell
Cell
{
get
;
set
;
}
}
}
performance/Performance.Services/OriginalService.cs
View file @
8392e9fd
...
...
@@ -39,22 +39,22 @@ public class OriginalService : IAutoInjection
public
bool
EditFactorData
(
int
userId
,
OriginalRequest
request
)
{
// 含有系数的数据
var
allData
=
imdataRepository
.
GetEntities
(
t
=>
t
.
SheetID
==
request
.
SheetId
);
var
basic
=
allData
.
FirstOrDefault
(
t
=>
t
.
ID
==
request
.
Cells
.
FirstOrDefault
(
w
=>
w
.
Id
>
0
).
Id
);
var
basic
=
allData
.
FirstOrDefault
(
t
=>
t
.
ID
==
request
.
Cell
.
Id
);
// 获取相同核算类型的数据
var
updateData
=
allData
.
Where
(
t
=>
t
.
UnitType
==
basic
.
UnitType
);
foreach
(
var
cell
in
request
.
Cells
.
Where
(
t
=>
t
.
Id
>
0
))
var
data
=
updateData
.
Where
(
t
=>
t
.
TypeName
==
request
.
Cell
.
FieldName
).
ToList
();
// 修改同一类型下的系数
var
factor
=
ConvertHelper
.
To
<
decimal
>(
request
.
Cell
.
CellValue
);
if
(
data
!=
null
&&
data
.
Any
())
{
var
data
=
updateData
.
Where
(
t
=>
t
.
TypeName
==
cell
.
FieldName
).
ToList
();
var
factor
=
ConvertHelper
.
To
<
decimal
>(
cell
.
CellValue
);
if
(
data
!=
null
&&
data
.
Any
())
data
.
ForEach
(
t
=>
{
data
.
ForEach
(
t
=>
{
t
.
FactorValue
=
factor
;
t
.
UpdateDate
=
DateTime
.
Now
;
t
.
UpdateUser
=
userId
;
});
}
t
.
FactorValue
=
factor
;
t
.
UpdateDate
=
DateTime
.
Now
;
t
.
UpdateUser
=
userId
;
});
}
return
imdataRepository
.
UpdateRange
(
updateData
.
ToArray
());
}
...
...
@@ -62,15 +62,14 @@ public bool EditFactorData(int userId, OriginalRequest request)
public
bool
EditHeaderData
(
int
userId
,
OriginalRequest
request
)
{
var
filters
=
new
List
<
string
>
{
"核算单元(医技组)"
,
"核算单元(医生组)"
,
"核算单元(护理组)"
,
"科室名称"
,
"核算单元"
,
"核算单元类型"
,
""
};
var
headers
=
request
.
Cells
.
Where
(
t
=>
!
filters
.
Contains
(
t
.
FieldName
));
var
allData
=
imheaderRepository
.
GetEntities
(
t
=>
headers
.
Select
(
w
=>
w
.
Id
).
Contains
(
t
.
ID
));
foreach
(
var
data
in
allData
)
{
data
.
CellValue
=
request
.
Cells
.
FirstOrDefault
(
w
=>
w
.
Id
==
data
.
ID
).
CellValue
.
ToString
();
data
.
UpdateDate
=
DateTime
.
Now
;
data
.
UpdateUser
=
userId
;
}
return
imheaderRepository
.
UpdateRange
(
allData
.
ToArray
());
if
(!
filters
.
Contains
(
request
.
Cell
.
FieldName
))
throw
new
PerformanceException
(
"该单元格暂不支持修改"
);
var
data
=
imheaderRepository
.
GetEntity
(
t
=>
t
.
ID
==
request
.
Cell
.
Id
);
data
.
CellValue
=
request
.
Cell
.
CellValue
.
ToString
();
data
.
UpdateDate
=
DateTime
.
Now
;
data
.
UpdateUser
=
userId
;
return
imheaderRepository
.
Update
(
data
);
}
public
bool
EditSheetData
(
int
userId
,
OriginalRequest
request
)
...
...
@@ -101,11 +100,11 @@ public bool EditSheetData(int userId, OriginalRequest request)
private
bool
EditEmployee
(
int
userId
,
OriginalRequest
request
)
{
var
employee
=
imemployeeRepository
.
GetEntity
(
t
=>
request
.
Cell
s
.
FirstOrDefault
()
.
Id
==
t
.
ID
);
var
employee
=
imemployeeRepository
.
GetEntity
(
t
=>
request
.
Cell
.
Id
==
t
.
ID
);
if
(
employee
==
null
)
throw
new
PerformanceException
(
"提交数据无效"
);
SetValue
(
employee
,
request
.
Cell
s
);
SetValue
(
employee
,
request
.
Cell
);
employee
.
UpdateDate
=
DateTime
.
Now
;
employee
.
UpdateUser
=
userId
;
return
imemployeeRepository
.
Update
(
employee
);
...
...
@@ -113,11 +112,11 @@ private bool EditEmployee(int userId, OriginalRequest request)
private
bool
EditEmployeeClinic
(
int
userId
,
OriginalRequest
request
)
{
var
employeeClinic
=
imemployeeclinicRepository
.
GetEntity
(
t
=>
request
.
Cell
s
.
FirstOrDefault
()
.
Id
==
t
.
ID
);
var
employeeClinic
=
imemployeeclinicRepository
.
GetEntity
(
t
=>
request
.
Cell
.
Id
==
t
.
ID
);
if
(
employeeClinic
==
null
)
throw
new
PerformanceException
(
"提交数据无效"
);
SetValue
(
employeeClinic
,
request
.
Cell
s
);
SetValue
(
employeeClinic
,
request
.
Cell
);
employeeClinic
.
UpdateDate
=
DateTime
.
Now
;
employeeClinic
.
UpdateUser
=
userId
;
return
imemployeeclinicRepository
.
Update
(
employeeClinic
);
...
...
@@ -125,33 +124,19 @@ private bool EditEmployeeClinic(int userId, OriginalRequest request)
private
bool
EditSpecialUnit
(
int
userId
,
OriginalRequest
request
)
{
var
specialUnit
=
imspecialunitRepository
.
GetEntity
(
t
=>
request
.
Cell
s
.
FirstOrDefault
()
.
Id
==
t
.
ID
);
var
specialUnit
=
imspecialunitRepository
.
GetEntity
(
t
=>
request
.
Cell
.
Id
==
t
.
ID
);
if
(
specialUnit
==
null
)
throw
new
PerformanceException
(
"提交数据无效"
);
SetValue
(
specialUnit
,
request
.
Cell
s
);
SetValue
(
specialUnit
,
request
.
Cell
);
specialUnit
.
UpdateDate
=
DateTime
.
Now
;
specialUnit
.
UpdateUser
=
userId
;
return
imspecialunitRepository
.
Update
(
specialUnit
);
}
private
void
SetValue
<
TEntity
>(
TEntity
entity
,
List
<
Cell
>
cells
)
private
void
SetValue
<
TEntity
>(
TEntity
entity
,
Cell
cell
)
{
PropertyInfo
[]
info
=
(
typeof
(
TEntity
)).
GetProperties
();
foreach
(
var
item
in
info
)
{
//// 修改前的值
//var result = typeof(TEntity).GetProperty(item.Name).GetValue(entity);
var
element
=
PerSheetHeader
.
employeeHeaders
.
FirstOrDefault
(
t
=>
t
.
Item8
==
item
.
Name
);
var
index
=
PerSheetHeader
.
employeeHeaders
.
IndexOf
(
element
);
if
(
index
<
0
)
continue
;
var
cell
=
cells
.
FirstOrDefault
(
t
=>
t
.
PointCell
==
index
);
if
(
cell
==
null
)
continue
;
typeof
(
TEntity
).
GetProperty
(
item
.
Name
).
SetValue
(
entity
,
cell
.
CellValue
);
}
typeof
(
TEntity
).
GetProperty
(
cell
.
FieldName
).
SetValue
(
entity
,
cell
.
CellValue
);
}
#
endregion
...
...
@@ -165,23 +150,23 @@ private bool EditFeeData(int userId, OriginalRequest request)
if
(
allData
==
null
||
!
allData
.
Any
(
t
=>
t
.
RowNumber
==
request
.
RowNumber
))
throw
new
PerformanceException
(
"提交数据无效"
);
var
updateData
=
request
.
Cell
s
.
Where
(
t
=>
t
.
Id
>
0
)
;
if
(
updateData
!=
null
&&
updateData
.
Any
()
)
var
updateData
=
request
.
Cell
;
if
(
updateData
!=
null
)
{
var
data
=
allData
.
Where
(
t
=>
t
.
RowNumber
==
request
.
RowNumber
).
ToList
();
ImDataPublic
(
request
.
Cell
s
,
data
);
ImDataPublic
(
request
.
Cell
,
data
);
var
publicTypes
=
new
string
[]
{
"核算单元(医技组)"
,
"核算单元(医生组)"
,
"核算单元(护理组)"
,
"科室名称"
,
"核算单元"
,
"核算单元类型"
};
request
.
Cells
.
Where
(
t
=>
publicTypes
.
Contains
(
t
.
FieldName
)).
ToList
().
ForEach
(
t
=>
if
(!
publicTypes
.
Contains
(
updateData
.
FieldName
))
{
var
type
=
t
.
CellValue
.
GetType
();
var
type
=
updateData
.
CellValue
.
GetType
();
if
(
type
.
Name
!=
"String"
)
{
var
entity
=
data
.
FirstOrDefault
(
w
=>
w
.
ID
==
t
.
Id
);
entity
.
CellValue
=
ConvertHelper
.
To
<
decimal
?>(
t
.
CellValue
);
var
entity
=
data
.
FirstOrDefault
(
w
=>
w
.
ID
==
updateData
.
Id
);
entity
.
CellValue
=
ConvertHelper
.
To
<
decimal
?>(
updateData
.
CellValue
);
entity
.
UpdateDate
=
DateTime
.
Now
;
entity
.
UpdateUser
=
userId
;
}
}
);
}
result
=
imdataRepository
.
UpdateRange
(
data
.
ToArray
());
}
...
...
@@ -189,7 +174,7 @@ private bool EditFeeData(int userId, OriginalRequest request)
return
result
;
}
private
void
ImDataPublic
(
IEnumerable
<
Cell
>
cells
,
List
<
im_data
>
allData
)
private
void
ImDataPublic
(
Cell
cell
,
List
<
im_data
>
allData
)
{
Dictionary
<
int
,
string
>
publicTypes
=
new
Dictionary
<
int
,
string
>
{
...
...
@@ -199,7 +184,10 @@ private void ImDataPublic(IEnumerable<Cell> cells, List<im_data> allData)
};
foreach
(
var
item
in
publicTypes
)
{
var
cellvalue
=
cells
.
FirstOrDefault
(
t
=>
t
.
FieldName
==
item
.
Value
).
CellValue
.
ToString
();
if
(
cell
.
FieldName
!=
item
.
Value
)
continue
;
var
cellvalue
=
cell
.
CellValue
.
ToString
();
var
unitType
=
allData
.
FirstOrDefault
(
t
=>
t
.
UnitType
==
item
.
Key
).
AccountingUnit
;
if
(
cellvalue
!=
unitType
)
{
...
...
@@ -209,25 +197,26 @@ private void ImDataPublic(IEnumerable<Cell> cells, List<im_data> allData)
});
}
}
var
celldept
=
cells
.
FirstOrDefault
(
t
=>
t
.
FieldName
==
"科室名称"
).
CellValue
.
ToString
();
var
department
=
allData
.
FirstOrDefault
().
Department
;
if
(
celldept
!=
department
)
if
(
cell
.
FieldName
==
"科室名称"
)
{
allData
.
ForEach
(
t
=>
var
department
=
allData
.
FirstOrDefault
().
Department
;
if
(
cell
.
CellValue
.
ToString
()
!=
department
)
{
t
.
Department
=
celldept
;
});
allData
.
ForEach
(
t
=>
{
t
.
Department
=
cell
.
CellValue
.
ToString
();
});
}
}
}
private
bool
ImDataInsert
(
int
userId
,
OriginalRequest
request
,
List
<
im_data
>
allData
)
{
var
addData
=
request
.
Cells
.
Where
(
t
=>
t
.
Id
==
0
).
ToList
();
if
(
addData
==
null
||
!
addData
.
Any
())
if
(
request
.
Cell
.
Id
==
0
)
return
true
;
// 列
var
header
s
=
imheaderRepository
.
GetEntities
(
t
=>
t
.
SheetID
==
request
.
SheetId
);
var
header
=
imheaderRepository
.
GetEntity
(
t
=>
t
.
SheetID
==
request
.
SheetId
&&
t
.
CellValue
==
request
.
Cell
.
FieldName
);
// 核算单元、科室
var
publicData
=
allData
.
First
();
// rownumber含有的核算类型
...
...
@@ -239,25 +228,20 @@ private bool ImDataInsert(int userId, OriginalRequest request, List<im_data> all
FactorValue
=
t
.
Max
(
group
=>
group
.
FactorValue
)
});
var
newData
=
addData
.
Join
(
factor
,
inner
=>
inner
.
FieldName
,
outer
=>
outer
.
TypeName
,
(
inner
,
outer
)
=>
new
{
inner
,
outer
})
.
Select
(
t
=>
{
var
singId
=
headers
.
FirstOrDefault
(
w
=>
w
.
CellValue
==
t
.
inner
.
FieldName
)?.
SignID
;
return
new
im_data
{
RowNumber
=
request
.
RowNumber
,
AccountingUnit
=
publicData
.
AccountingUnit
,
Department
=
publicData
.
Department
,
UnitType
=
t
.
outer
.
UnitType
,
TypeName
=
t
.
inner
.
FieldName
,
CellValue
=
ConvertHelper
.
To
<
decimal
>(
t
.
inner
.
CellValue
),
IsFactor
=
1
,
FactorValue
=
t
.
outer
.
FactorValue
,
SignID
=
singId
,
UpdateDate
=
DateTime
.
Now
,
UpdateUser
=
userId
,
};
});
var
newData
=
factor
.
Select
(
t
=>
new
im_data
{
RowNumber
=
request
.
RowNumber
,
AccountingUnit
=
publicData
.
AccountingUnit
,
Department
=
publicData
.
Department
,
UnitType
=
t
.
UnitType
,
TypeName
=
request
.
Cell
.
FieldName
,
CellValue
=
ConvertHelper
.
To
<
decimal
>(
request
.
Cell
.
CellValue
),
IsFactor
=
1
,
FactorValue
=
t
.
FactorValue
,
SignID
=
header
.
SignID
,
UpdateDate
=
DateTime
.
Now
,
UpdateUser
=
userId
,
});
return
imdataRepository
.
AddRange
(
newData
.
ToArray
());
}
...
...
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