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
a99bb497
Commit
a99bb497
authored
Jan 03, 2024
by
wyc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
考勤上报加载默认值(调整)
parent
246fb67e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
13 deletions
+43
-13
performance/Performance.Api/Controllers/ConfigController.cs
+2
-6
performance/Performance.Services/AttendanceService.cs
+41
-7
No files found.
performance/Performance.Api/Controllers/ConfigController.cs
View file @
a99bb497
...
...
@@ -952,12 +952,8 @@ public ApiResponse GetCustomList([FromBody] CustomPagingRequest request)
public
ApiResponse
BatchSaveCustom
([
FromBody
]
SaveCustomData
request
)
{
var
allot
=
_allotService
.
GetAllot
(
request
.
AllotId
);
if
(
allot
==
null
)
return
new
ApiResponse
(
ResponseType
.
ParameterError
,
"AllotID错误"
);
else
if
(
string
.
IsNullOrEmpty
(
request
.
TableName
))
return
new
ApiResponse
(
ResponseType
.
ParameterError
,
"表名为空"
);
if
(
allot
==
null
||
string
.
IsNullOrEmpty
(
request
.
TableName
))
return
new
ApiResponse
(
ResponseType
.
ParameterError
,
"当前绩效不存在 或 表名错误"
);
return
_configService
.
SaveCustomTable
(
request
);
}
...
...
performance/Performance.Services/AttendanceService.cs
View file @
a99bb497
...
...
@@ -6,8 +6,13 @@
using
System.Linq.Expressions
;
using
System.Reflection
;
using
AutoMapper
;
using
K4os.Hash.xxHash
;
using
Masuit.Tools
;
using
Masuit.Tools.Reflection
;
using
Microsoft.AspNetCore.Mvc
;
using
Microsoft.AspNetCore.Routing
;
using
Microsoft.Extensions.Logging
;
using
MySqlX.XDevAPI.Common
;
using
Newtonsoft.Json
;
using
OfficeOpenXml
;
using
OfficeOpenXml.Style
;
...
...
@@ -21,6 +26,7 @@
using
Performance.Repository
;
using
Performance.Repository.Repository
;
using
Z.EntityFramework.Plus
;
using
static
Performance
.
Services
.
ExtractExcelService
.
WriteDataHelper
;
namespace
Performance.Services
{
...
...
@@ -578,31 +584,59 @@ public ApiResponse DeleteAttendanceType(int id)
public
ApiResponse
GetAttendanceReplenishment
(
int
allotId
,
int
userid
)
{
var
allot
=
perforPerallotRepository
.
GetEntity
(
w
=>
w
.
ID
==
allotId
)
??
throw
new
PerformanceException
(
"当前绩效记录不存在"
);
var
typeDefault
=
perfoPperAttendanceTypeRepository
.
GetEntities
().
Find
(
f
=>
f
.
AllotId
==
allotId
&&
f
.
IsDefault
==
(
int
)
Attendance
.
Default
.
默认
)
??
throw
new
PerformanceException
(
"未设置默认类型"
);
var
typeDefault
=
perfoPperAttendanceTypeRepository
.
GetEntities
()
.
Find
(
f
=>
f
.
AllotId
==
allotId
&&
f
.
IsDefault
==
(
int
)
Attendance
.
Default
.
默认
)
??
throw
new
PerformanceException
(
"未设置默认类型"
);
//查询全部考勤上报内容
var
attendanceDepts
=
_perforPerAttendanceDeptRepository
.
GetEntities
(
t
=>
t
.
AllotId
==
allot
.
ID
);
if
(
attendanceDepts
==
null
)
throw
new
PerformanceException
(
"请添加考勤人员"
);
//当角色对应时过滤
var
userInfo
=
_userRepository
.
GetUser
(
userid
);
if
(
userInfo
?.
User
==
null
)
throw
new
NotImplementedException
(
"当前用户不存在"
);
if
(
userInfo
?.
URole
==
null
)
throw
new
NotImplementedException
(
"当前用户暂未分配角色"
);
var
unitTypes
=
UnitTypeUtil
.
GetMaps
(
userInfo
?.
URole
.
Type
??
0
);
if
(
unitTypes
?.
Any
()
==
true
)
attendanceDepts
=
attendanceDepts
.
Where
(
w
=>
w
.
AccountingUnit
==
userInfo
.
User
.
Department
&&
UnitTypeUtil
.
Is
(
w
.
UnitType
,
unitTypes
)).
ToList
();
if
(!
unitTypes
.
Any
())
throw
new
PerformanceException
(
"当前用户没有分配科室!!!"
);
var
result
=
attendanceDepts
.
Where
(
w
=>
w
.
AccountingUnit
==
userInfo
.
User
.
Department
&&
UnitTypeUtil
.
Is
(
w
.
UnitType
,
unitTypes
)).
ToList
();
List
<
Dictionary
<
string
,
string
>>
error
=
new
List
<
Dictionary
<
string
,
string
>>();
foreach
(
var
item
in
result
)
{
//查询其他科室是否存在考勤
var
repeatDepts
=
attendanceDepts
?.
Where
(
w
=>
w
.
PersonnelNumber
==
item
.
PersonnelNumber
&&
w
.
UnitType
!=
item
.
UnitType
&&
w
.
AccountingUnit
!=
item
.
AccountingUnit
)
.
ToList
();
foreach
(
var
item
in
attendanceDepts
)
{
for
(
int
day
=
1
;
day
<=
31
;
day
++)
{
string
dayPropertyName
=
$"Day
{
day
:
00
}
"
;
int
?
dayValue
=
(
int
?)
typeof
(
per_attendance_dept
).
GetProperty
(
dayPropertyName
)?.
GetValue
(
item
);
var
repeatDept
=
repeatDepts
.
Find
(
w
=>
((
int
?)
typeof
(
per_attendance_dept
).
GetProperty
(
dayPropertyName
)?.
GetValue
(
w
))
!=
null
);
if
(
dayValue
==
null
)
{
typeof
(
per_attendance_dept
).
GetProperty
(
dayPropertyName
)?.
SetValue
(
item
,
typeDefault
.
Id
);
if
(
repeatDept
==
null
)
{
typeof
(
per_attendance_dept
).
GetProperty
(
dayPropertyName
)?.
SetValue
(
item
,
typeDefault
.
Id
);
}
else
{
error
.
Add
(
new
Dictionary
<
string
,
string
>
{
{
"时间"
,
$"
{
day
}
号"
},
{
"工号"
,
item
.
PersonnelNumber
??
""
},
{
"姓名"
,
item
.
PersonnelName
??
""
},
{
"人员系数"
,
item
.
PermanentStaff
?.
ToString
()
??
""
},
{
"考勤类型"
,
""
},
{
"错误原因"
,
$"
{
day
}
号存在考勤记录,所在科室为:
{
repeatDept
.
AccountingUnit
}
,请核实后重新填写"
},
});
}
}
}
}
_perforPerAttendanceDeptRepository
.
UpdateRange
(
attendanceDepts
.
ToArray
());
if
(
error
.
Count
>
0
)
return
new
ApiResponse
(
ResponseType
.
WarningTable
,
"验证不通过,当前操作已拒绝"
,
error
);
_perforPerAttendanceDeptRepository
.
UpdateRange
(
result
.
ToArray
());
return
new
ApiResponse
(
ResponseType
.
OK
,
"加载成功"
);
}
...
...
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