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
b2c6ce5d
Commit
b2c6ce5d
authored
Mar 05, 2024
by
ruyun.zhang
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/develop' into develop
parents
3f64c7fe
d80ba249
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
13 deletions
+48
-13
performance/Performance.Api/Controllers/ConfigController.cs
+4
-7
performance/Performance.Services/AttendanceService.cs
+38
-6
performance/Performance.Services/ExtractExcelService/ExtractHelper/ExtractHelper.cs
+6
-0
No files found.
performance/Performance.Api/Controllers/ConfigController.cs
View file @
b2c6ce5d
...
...
@@ -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
);
}
...
...
@@ -991,7 +987,8 @@ public IActionResult CustomDownload([FromBody] CustomPagingRequest request)
var
allot
=
_allotService
.
GetAllot
(
request
.
AllotId
);
if
(
allot
==
null
)
throw
new
PerformanceException
(
"AllotID错误"
);
request
.
PageIndex
=
1
;
request
.
PageSize
=
99999
;
string
filepath
=
_configService
.
CustomDownloadFile
(
_claim
.
GetUserId
(),
request
,
allot
);
if
(!
FileHelper
.
IsExistFile
(
filepath
))
throw
new
PerformanceException
(
"获取导入数据失败"
);
...
...
performance/Performance.Services/AttendanceService.cs
View file @
b2c6ce5d
...
...
@@ -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,57 @@ 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
)
{
if
(
repeatDept
==
null
)
{
typeof
(
per_attendance_dept
).
GetProperty
(
dayPropertyName
)?.
SetValue
(
item
,
typeDefault
.
Id
);
}
else
{
error
.
Add
(
new
Dictionary
<
string
,
string
>
{
{
"工号"
,
item
.
PersonnelNumber
??
""
},
{
"姓名"
,
item
.
PersonnelName
??
""
},
{
"人员系数"
,
item
.
PermanentStaff
?.
ToString
()
??
""
},
{
"考勤类型"
,
""
},
{
"错误原因"
,
$"
{
day
}
号存在考勤记录,所在科室为:
{
repeatDept
.
AccountingUnit
}
,无法添加默认考勤"
},
});
}
}
}
_perforPerAttendanceDeptRepository
.
UpdateRange
(
attendanceDepts
.
ToArray
());
}
_perforPerAttendanceDeptRepository
.
UpdateRange
(
result
.
ToArray
());
if
(
error
.
Count
>
0
)
return
new
ApiResponse
(
ResponseType
.
WarningTable
,
"请注意,以下说明未填写考勤内容的情况。"
,
error
);
return
new
ApiResponse
(
ResponseType
.
OK
,
"加载成功"
);
}
...
...
performance/Performance.Services/ExtractExcelService/ExtractHelper/ExtractHelper.cs
View file @
b2c6ce5d
...
...
@@ -211,18 +211,24 @@ public static void CloseAutoFilter(string path)
ExcelWorkbook
workbook
=
package
.
Workbook
;
if
(
workbook
==
null
)
return
;
bool
shouldSave
=
false
;
// 标志是否需要保存文件
foreach
(
var
sheet
in
workbook
.
Worksheets
)
{
if
(
sheet
.
AutoFilterAddress
!=
null
)
{
sheet
.
Cells
[
sheet
.
AutoFilterAddress
.
Address
].
AutoFilter
=
false
;
shouldSave
=
true
;
// 设置标志为需要保存文件
}
}
if
(
shouldSave
)
{
package
.
Save
();
}
}
}
catch
(
Exception
)
{
}
}
...
...
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