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
063afbf9
Commit
063afbf9
authored
Dec 12, 2023
by
wyc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
考勤上报加载上月调整,logo和医院名称(appsettings.json)
parent
49b5b0c8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
66 additions
and
61 deletions
+66
-61
performance/Performance.Api/Controllers/AppController.cs
+4
-1
performance/Performance.Services/CopyService.cs
+62
-60
No files found.
performance/Performance.Api/Controllers/AppController.cs
View file @
063afbf9
...
...
@@ -21,7 +21,9 @@ public AppController(ILogger<AppController> logger, IConfiguration configuration
public
ActionResult
AppOptions
()
{
var
OpenOAuth
=
_configuration
.
GetValue
<
bool
>(
"AppOptions:OpenOAuth"
,
false
);
return
Ok
(
new
ApiResponse
(
ResponseType
.
OK
,
""
,
new
{
OpenOAuth
}));
var
siteTitle
=
_configuration
.
GetValue
(
"AppOptions:SiteTitle"
,
""
);
var
siteLogo
=
_configuration
.
GetValue
(
"AppOptions:SiteLogo"
,
""
);
return
Ok
(
new
ApiResponse
(
ResponseType
.
OK
,
""
,
new
{
OpenOAuth
,
siteTitle
,
siteLogo
}));
}
}
}
\ No newline at end of file
performance/Performance.Services/CopyService.cs
View file @
063afbf9
...
...
@@ -2,13 +2,16 @@
using
System.Collections.Generic
;
using
System.Linq
;
using
AngleSharp.Dom.Events
;
using
K4os.Hash.xxHash
;
using
Microsoft.CodeAnalysis.CSharp.Syntax
;
using
Microsoft.Extensions.Logging
;
using
OfficeOpenXml.FormulaParsing.Excel.Functions.DateTime
;
using
Performance.DtoModels
;
using
Performance.EntityModels
;
using
Performance.EntityModels.Entity
;
using
Performance.Repository
;
using
Performance.Repository.Repository
;
using
static
Performance
.
Services
.
ExtractExcelService
.
WriteDataHelper
;
namespace
Performance.Services
{
...
...
@@ -32,6 +35,7 @@ public class CopyService : IAutoInjection
private
readonly
PerforPerAttendanceDeptRepository
_perforPerAttendanceDeptRepository
;
private
readonly
PerforCofDeptDetailRepository
_perforCofDeptDetailRepository
;
private
readonly
PerforCofEmpDetailRepository
_perforCofEmpDetailRepository
;
private
readonly
PerforPeremployeeRepository
_perforPeremployeeRepository
;
public
CopyService
(
ILogger
<
ConfigService
>
logger
,
...
...
@@ -51,7 +55,8 @@ public class CopyService : IAutoInjection
PerforPerAssessIssueSchemeRepository
perforPerAssessIssueSchemeRepository
,
PerforPerAttendanceDeptRepository
perforPerAttendanceDeptRepository
,
PerforCofDeptDetailRepository
perforCofDeptDetailRepository
,
PerforCofEmpDetailRepository
perforCofEmpDetailRepository
PerforCofEmpDetailRepository
perforCofEmpDetailRepository
,
PerforPeremployeeRepository
perforPeremployeeRepository
)
{
_logger
=
logger
;
...
...
@@ -72,6 +77,7 @@ PerforCofEmpDetailRepository perforCofEmpDetailRepository
_perforPerAttendanceDeptRepository
=
perforPerAttendanceDeptRepository
;
_perforCofDeptDetailRepository
=
perforCofDeptDetailRepository
;
_perforCofEmpDetailRepository
=
perforCofEmpDetailRepository
;
_perforPeremployeeRepository
=
perforPeremployeeRepository
;
}
...
...
@@ -322,67 +328,69 @@ public void Copy_AttendanceType(per_allot allot, int prevAllotId)
var
attendanceTypes
=
_pperAttendanceTypeRepository
.
GetEntities
(
g
=>
g
.
AllotId
==
prevAllotId
||
g
.
AllotId
==
allot
.
ID
)
??
new
List
<
per_attendance_type
>();
//查询上月有没有类型,没有就跳过
var
prevAttTypes
=
attendanceTypes
.
Where
(
w
=>
w
.
AllotId
==
prevAllotId
).
ToList
();
if
(
prevAttTypes
.
Any
())
if
(!
prevAttTypes
.
Any
())
return
;
// 删除当月的考勤类型
var
delAttTypes
=
attendanceTypes
.
Where
(
w
=>
w
.
AllotId
==
allot
.
ID
).
ToList
();
if
(
delAttTypes
.
Any
())
{
_pperAttendanceTypeRepository
.
RemoveRange
(
delAttTypes
.
ToArray
());
}
//插入上月的考勤类型
var
newAttTypes
=
prevAttTypes
.
Select
(
t
=>
new
per_attendance_type
{
// 删除当月的考勤类型
var
delAttTypes
=
attendanceTypes
.
Where
(
w
=>
w
.
AllotId
==
allot
.
ID
).
ToList
();
if
(
delAttTypes
.
Any
())
AllotId
=
allot
.
ID
,
AttendanceName
=
t
.
AttendanceName
,
HospitalId
=
t
.
HospitalId
,
IsDeduction
=
t
.
IsDeduction
,
IsDefault
=
t
.
IsDefault
,
}).
ToList
();
var
successfulType
=
_pperAttendanceTypeRepository
.
AddRange
(
newAttTypes
.
ToArray
());
if
(
successfulType
)
{
var
prevPerEmployee
=
_perforPeremployeeRepository
.
GetEntities
(
g
=>
g
.
AllotId
==
prevAllotId
);
if
(!
prevPerEmployee
.
Any
())
return
;
// 删除当月的考勤上报
var
delAttDepts
=
_perforPerAttendanceDeptRepository
.
GetEntities
(
w
=>
w
.
AllotId
==
allot
.
ID
).
ToList
();
if
(
delAttDepts
.
Any
())
{
_p
perAttendanceTypeRepository
.
RemoveRange
(
delAttType
s
.
ToArray
());
_p
erforPerAttendanceDeptRepository
.
RemoveRange
(
delAttDept
s
.
ToArray
());
}
//插入上月的考勤类型
var
newAttTypes
=
prevAttTypes
.
Select
(
t
=>
new
per_attendance_type
//查询默认考勤类型
var
typeDefault
=
newAttTypes
.
Find
(
f
=>
f
.
IsDefault
==
(
int
)
Attendance
.
Default
.
默认
);
var
cofaccounting
=
_cofaccountingRepository
.
GetEntities
(
g
=>
g
.
AllotId
==
prevAllotId
);
int
currentMonth
=
DateTime
.
DaysInMonth
(
allot
.
Year
,
allot
.
Month
);
var
newAttDepts
=
prevPerEmployee
.
Select
(
t
=>
{
AllotId
=
allot
.
ID
,
AttendanceName
=
t
.
AttendanceName
,
HospitalId
=
t
.
HospitalId
,
IsDeduction
=
t
.
IsDeduction
,
IsDefault
=
t
.
IsDefault
,
}).
ToList
();
var
successfulType
=
_pperAttendanceTypeRepository
.
AddRange
(
newAttTypes
.
ToArray
());
if
(
successfulType
)
{
var
attendanceDepts
=
_perforPerAttendanceDeptRepository
.
GetEntities
(
t
=>
t
.
AllotId
==
prevAllotId
||
t
.
AllotId
==
allot
.
ID
)
??
new
List
<
per_attendance_dept
>();
var
prevAttDepts
=
attendanceDepts
.
Where
(
w
=>
w
.
AllotId
==
prevAllotId
).
ToList
();
if
(
prevAttDepts
.
Any
())
var
code
=
cofaccounting
.
Where
(
p
=>
p
.
UnitType
==
t
.
UnitType
&&
p
.
AccountingUnit
==
t
.
AccountingUnit
)
.
Select
(
p
=>
p
.
Code
)
.
FirstOrDefault
()
??
""
;
var
newDept
=
new
per_attendance_dept
{
// 删除当月的考勤上报
var
delAttDepts
=
attendanceDepts
.
Where
(
w
=>
w
.
AllotId
==
allot
.
ID
).
ToList
();
if
(
delAttDepts
.
Any
())
{
_perforPerAttendanceDeptRepository
.
RemoveRange
(
delAttDepts
.
ToArray
());
}
var
newAttDepts
=
prevAttDepts
.
Select
(
t
=>
new
per_attendance_dept
{
HospitalId
=
t
.
HospitalId
,
AllotId
=
allot
.
ID
,
PersonnelName
=
t
.
PersonnelName
,
PersonnelNumber
=
t
.
PersonnelNumber
,
PermanentStaff
=
t
.
PermanentStaff
,
Code
=
t
.
Code
,
UnitType
=
t
.
UnitType
,
AccountingUnit
=
t
.
AccountingUnit
,
State
=
(
int
)
Attendance
.
Report
.
未提交
}).
ToList
();
//查询默认考勤类型
var
typeDefault
=
newAttTypes
.
Find
(
f
=>
f
.
IsDefault
==
(
int
)
Attendance
.
Default
.
默认
);
if
(
typeDefault
!=
null
)
{
foreach
(
var
item
in
newAttDepts
)
{
for
(
int
i
=
1
;
i
<=
31
;
i
++)
{
typeof
(
per_attendance_dept
).
GetProperty
(
$"Day
{
i
:
d2
}
"
)?.
SetValue
(
item
,
typeDefault
.
Id
);
}
}
}
_perforPerAttendanceDeptRepository
.
AddRange
(
newAttDepts
.
ToArray
());
HospitalId
=
t
.
HospitalId
,
AllotId
=
allot
.
ID
,
PersonnelName
=
t
.
DoctorName
,
PersonnelNumber
=
t
.
PersonnelNumber
,
PermanentStaff
=
t
.
PermanentStaff
??
0
,
Code
=
code
,
UnitType
=
t
.
UnitType
,
AccountingUnit
=
t
.
AccountingUnit
,
State
=
(
int
)
Attendance
.
Report
.
未提交
};
for
(
int
i
=
1
;
i
<=
currentMonth
;
i
++)
{
typeof
(
per_attendance_dept
).
GetProperty
(
$"Day
{
i
:
d2
}
"
)?.
SetValue
(
newDept
,
typeDefault
.
Id
);
}
}
return
newDept
;
}).
ToList
();
_perforPerAttendanceDeptRepository
.
AddRange
(
newAttDepts
.
ToArray
());
}
}
public
void
Copy_AssessType
(
per_allot
allot
,
int
prevAllotId
,
bool
delHistotyData
=
false
)
{
var
flag
=
delHistotyData
;
...
...
@@ -421,7 +429,6 @@ public void Copy_AssessType(per_allot allot, int prevAllotId, bool delHistotyDat
UpdateTime
=
dateTimeNow
,
});
var
aCategoryTemp
=
_perforPerAssessCategoryRepository
.
AddRange
(
newaCategorys
.
ToArray
());
//if (!aCategoryTemp) throw new PerformanceException("考核分类未继承成功,请检查后在尝试!");
}
}
var
aCategoryss
=
_perforPerAssessCategoryRepository
.
GetEntities
(
t
=>
t
.
AllotId
==
allot
.
ID
);
...
...
@@ -445,7 +452,6 @@ public void Copy_AssessType(per_allot allot, int prevAllotId, bool delHistotyDat
});
var
aSchemeTemp
=
_perforPerAssessSchemeRepository
.
AddRange
(
newaSchemes
.
ToArray
());
// if (!aSchemeTemp) throw new PerformanceException("考核方案未继承成功,请检查后在尝试!");
}
}
var
aSchemes
=
_perforPerAssessSchemeRepository
.
GetEntities
(
t
=>
t
.
AllotId
==
allot
.
ID
);
...
...
@@ -474,8 +480,6 @@ public void Copy_AssessType(per_allot allot, int prevAllotId, bool delHistotyDat
UpdateTime
=
dateTimeNow
,
});
var
aSchemeItemsTemp
=
_perforPerAssessSchemeItemsRepository
.
AddRange
(
newaSchemeItems
.
ToArray
());
// if (!aSchemeItemsTemp) throw new PerformanceException("考核方案指标未继承成功,请检查后在尝试!");
}
}
var
aSchemeItemss
=
_perforPerAssessSchemeItemsRepository
.
GetEntities
(
t
=>
t
.
AllotId
==
allot
.
ID
);
...
...
@@ -499,7 +503,6 @@ public void Copy_AssessType(per_allot allot, int prevAllotId, bool delHistotyDat
UpdateTime
=
dateTimeNow
,
});
var
aSchemeTargetTemp
=
_perforPerAssessSchemeTargetRepository
.
AddRange
(
newaSchemeTarget
.
ToArray
());
// if (!aSchemeTargetTemp) throw new PerformanceException("考核对象未继承成功,请检查后在尝试!");
}
}
...
...
@@ -546,7 +549,6 @@ public void Copy_AssessType(per_allot allot, int prevAllotId, bool delHistotyDat
AuditRemark
=
null
,
});
var
aIssueSchemeTemp
=
_perforPerAssessIssueSchemeRepository
.
AddRange
(
newaIssueSchemess
.
ToArray
());
// if (!aSchemeItemsTemp) throw new PerformanceException("考核下发未继承成功,请检查后在尝试!");
}
}
}
...
...
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