Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
attendance-performance-platform
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
赵啸非
attendance-performance-platform
Commits
a7989436
Commit
a7989436
authored
Dec 01, 2023
by
廖旭伟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
考勤汇总导出excel表格优化
parent
ddeb8d29
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
1308 additions
and
3 deletions
+1308
-3
attendance-performance-manager/src/main/java/com/mortals/xhx/common/utils/DynamicColExcelUtil.java
...ava/com/mortals/xhx/common/utils/DynamicColExcelUtil.java
+1209
-0
attendance-performance-manager/src/main/java/com/mortals/xhx/module/attendance/web/AttendanceStatController.java
...s/xhx/module/attendance/web/AttendanceStatController.java
+99
-3
No files found.
attendance-performance-manager/src/main/java/com/mortals/xhx/common/utils/DynamicColExcelUtil.java
0 → 100644
View file @
a7989436
This diff is collapsed.
Click to expand it.
attendance-performance-manager/src/main/java/com/mortals/xhx/module/attendance/web/AttendanceStatController.java
View file @
a7989436
...
@@ -17,6 +17,7 @@ import com.mortals.framework.utils.ReflectUtils;
...
@@ -17,6 +17,7 @@ import com.mortals.framework.utils.ReflectUtils;
import
com.mortals.framework.utils.poi.ExcelUtil
;
import
com.mortals.framework.utils.poi.ExcelUtil
;
import
com.mortals.framework.web.BaseCRUDJsonBodyMappingController
;
import
com.mortals.framework.web.BaseCRUDJsonBodyMappingController
;
import
com.mortals.xhx.base.system.param.service.ParamService
;
import
com.mortals.xhx.base.system.param.service.ParamService
;
import
com.mortals.xhx.common.utils.DynamicColExcelUtil
;
import
com.mortals.xhx.module.attendance.model.AttendanceClassQuery
;
import
com.mortals.xhx.module.attendance.model.AttendanceClassQuery
;
import
com.mortals.xhx.module.attendance.model.AttendanceGroupQuery
;
import
com.mortals.xhx.module.attendance.model.AttendanceGroupQuery
;
import
com.mortals.xhx.module.attendance.model.AttendanceStaffStatEntity
;
import
com.mortals.xhx.module.attendance.model.AttendanceStaffStatEntity
;
...
@@ -41,6 +42,7 @@ import com.mortals.xhx.module.attendance.service.AttendanceStatService;
...
@@ -41,6 +42,7 @@ import com.mortals.xhx.module.attendance.service.AttendanceStatService;
import
org.apache.commons.lang3.ArrayUtils
;
import
org.apache.commons.lang3.ArrayUtils
;
import
com.mortals.framework.util.StringUtils
;
import
com.mortals.framework.util.StringUtils
;
import
java.math.BigDecimal
;
import
java.text.DateFormat
;
import
java.text.DateFormat
;
import
java.time.LocalDate
;
import
java.time.LocalDate
;
import
java.time.format.DateTimeFormatter
;
import
java.time.format.DateTimeFormatter
;
...
@@ -200,7 +202,7 @@ public class AttendanceStatController extends BaseCRUDJsonBodyMappingController<
...
@@ -200,7 +202,7 @@ public class AttendanceStatController extends BaseCRUDJsonBodyMappingController<
PageInfo
pageInfo
=
new
PageInfo
(-
1
);
PageInfo
pageInfo
=
new
PageInfo
(-
1
);
List
<
AttendanceStatEntity
>
list
=
this
.
getService
().
findExt
(
query
,
pageInfo
,
context
).
getList
();
List
<
AttendanceStatEntity
>
list
=
this
.
getService
().
findExt
(
query
,
pageInfo
,
context
).
getList
();
Class
<
AttendanceStatEntity
>
tClass
=
ReflectUtils
.
getClassGenricType
(
this
.
getClass
(),
1
);
Class
<
AttendanceStatEntity
>
tClass
=
ReflectUtils
.
getClassGenricType
(
this
.
getClass
(),
1
);
ExcelUtil
<
AttendanceStatEntity
,
Long
>
util
=
new
ExcelUtil
(
tClass
);
DynamicColExcelUtil
<
AttendanceStatEntity
,
Long
>
util
=
new
DynamicCol
ExcelUtil
(
tClass
);
this
.
doExportAfter
(
context
,
list
);
this
.
doExportAfter
(
context
,
list
);
DateTime
startDate
=
DateUtil
.
parse
(
query
.
getSummaryTimeStart
());
DateTime
startDate
=
DateUtil
.
parse
(
query
.
getSummaryTimeStart
());
DateTime
endDate
=
DateUtil
.
parse
(
query
.
getSummaryTimeEnd
());
DateTime
endDate
=
DateUtil
.
parse
(
query
.
getSummaryTimeEnd
());
...
@@ -210,7 +212,7 @@ public class AttendanceStatController extends BaseCRUDJsonBodyMappingController<
...
@@ -210,7 +212,7 @@ public class AttendanceStatController extends BaseCRUDJsonBodyMappingController<
final
String
[]
weekStr
={
"星期日"
,
"星期一"
,
"星期二"
,
"星期三"
,
"星期四"
,
"星期五"
,
"星期六"
};
final
String
[]
weekStr
={
"星期日"
,
"星期一"
,
"星期二"
,
"星期三"
,
"星期四"
,
"星期五"
,
"星期六"
};
//由于1表示周日,2表示周一所以需要-1后对应上数组下标
//由于1表示周日,2表示周一所以需要-1后对应上数组下标
List
<
List
<
Map
<
String
,
Object
>>>
lists
=
list
.
stream
().
map
(
item
->
{
List
<
List
<
Map
<
String
,
Object
>>>
lists
=
list
.
stream
().
map
(
item
->
{
attendanceStatExport
(
item
);
List
<
AttendanceStaffStatEntity
>
attendanceStaffStatEntities
=
item
.
getAttendanceStaffStatEntities
();
List
<
AttendanceStaffStatEntity
>
attendanceStaffStatEntities
=
item
.
getAttendanceStaffStatEntities
();
Map
<
Integer
,
String
>
collect
=
new
HashMap
<>();
Map
<
Integer
,
String
>
collect
=
new
HashMap
<>();
if
(!
ObjectUtils
.
isEmpty
(
attendanceStaffStatEntities
))
{
if
(!
ObjectUtils
.
isEmpty
(
attendanceStaffStatEntities
))
{
...
@@ -244,7 +246,7 @@ public class AttendanceStatController extends BaseCRUDJsonBodyMappingController<
...
@@ -244,7 +246,7 @@ public class AttendanceStatController extends BaseCRUDJsonBodyMappingController<
}).
collect
(
Collectors
.
toList
());
}).
collect
(
Collectors
.
toList
());
// byte[] data = util.exportExcel(list, properties, name);
// byte[] data = util.exportExcel(list, properties, name);
byte
[]
data
=
util
.
exportExcel
(
list
,
properties
,
lists
,
name
);
byte
[]
data
=
util
.
exportExcel
(
list
,
properties
,
lists
,
name
,
6
);
this
.
responseStream
(
this
.
response
,
data
,
fileName
);
this
.
responseStream
(
this
.
response
,
data
,
fileName
);
this
.
recordSysLog
(
this
.
request
,
busiDesc
+
" 【成功】"
);
this
.
recordSysLog
(
this
.
request
,
busiDesc
+
" 【成功】"
);
}
catch
(
Exception
var12
)
{
}
catch
(
Exception
var12
)
{
...
@@ -252,4 +254,98 @@ public class AttendanceStatController extends BaseCRUDJsonBodyMappingController<
...
@@ -252,4 +254,98 @@ public class AttendanceStatController extends BaseCRUDJsonBodyMappingController<
}
}
}
}
private
void
attendanceStatExport
(
AttendanceStatEntity
entity
){
if
(
isNull
(
entity
.
getBackToUnit
())){
entity
.
setBackToUnit
(
null
);
}
if
(
isNull
(
entity
.
getOnDutyLeave
())){
entity
.
setOnDutyLeave
(
null
);
}
if
(
isNull
(
entity
.
getOutOfOffice
())){
entity
.
setOutOfOffice
(
null
);
}
if
(
isNull
(
entity
.
getShiftCompensation
())){
entity
.
setShiftCompensation
(
null
);
}
if
(
isNull
(
entity
.
getPhysicalExamination
())){
entity
.
setPhysicalExamination
(
null
);
}
if
(
isNull
(
entity
.
getQuarantine
())){
entity
.
setQuarantine
(
null
);
}
if
(
isNull
(
entity
.
getBusinessTrip
())){
entity
.
setBusinessTrip
(
null
);
}
if
(
isNull
(
entity
.
getPublicHoliday
())){
entity
.
setPublicHoliday
(
null
);
}
if
(
isNull
(
entity
.
getSickLeave
())){
entity
.
setSickLeave
(
null
);
}
if
(
isNull
(
entity
.
getFuneralLeave
())){
entity
.
setFuneralLeave
(
null
);
}
if
(
isNull
(
entity
.
getMarriageLeave
())){
entity
.
setMarriageLeave
(
null
);
}
if
(
isNull
(
entity
.
getChildRearingLeave
())){
entity
.
setChildRearingLeave
(
null
);
}
if
(
isNull
(
entity
.
getMaternityLeave
())){
entity
.
setMaternityLeave
(
null
);
}
if
(
isNull
(
entity
.
getTransferBack
())){
entity
.
setTransferBack
(
null
);
}
if
(
isNull
(
entity
.
getHomeLeave
())){
entity
.
setHomeLeave
(
null
);
}
if
(
isNull
(
entity
.
getPersonalLeave
())){
entity
.
setPersonalLeave
(
null
);
}
if
(
isNull
(
entity
.
getAbsenteeismDays
())){
entity
.
setAbsenteeismDays
(
null
);
}
if
(
isNull
(
entity
.
getOtherDays
())){
entity
.
setOtherDays
(
null
);
}
if
(
isNull
(
entity
.
getNonCompliancePunch
())){
entity
.
setNonCompliancePunch
(
null
);
}
if
(
entity
.
getLateTimes
()!=
null
&&
entity
.
getLateTimes
()==
0
){
entity
.
setLateTimes
(
null
);
}
if
(
entity
.
getSurfingMobileTimes
()!=
null
&&
entity
.
getSurfingMobileTimes
()==
0
){
entity
.
setSurfingMobileTimes
(
null
);
}
if
(
entity
.
getOvertimeTimes
()!=
null
&&
entity
.
getOvertimeTimes
()==
0
){
entity
.
setOvertimeTimes
(
null
);
}
if
(
isNull
(
entity
.
getVacancy
())){
entity
.
setVacancy
(
null
);
}
if
(
entity
.
getNonStandardDressTimes
()!=
null
&&
entity
.
getNonStandardDressTimes
()==
0
){
entity
.
setNonStandardDressTimes
(
null
);
}
if
(
isNull
(
entity
.
getUnexcusedMeetingAbsence
())){
entity
.
setUnexcusedMeetingAbsence
(
null
);
}
if
(
isNull
(
entity
.
getEarlyLeaveMeeting
())){
entity
.
setEarlyLeaveMeeting
(
null
);
}
}
private
boolean
isNull
(
BigDecimal
bigDecimal
){
if
(
ObjectUtils
.
isEmpty
(
bigDecimal
)){
return
true
;
}
else
{
BigDecimal
zero
=
new
BigDecimal
(
"0"
);
if
(
bigDecimal
.
compareTo
(
zero
)
>
0
){
return
false
;
}
else
{
return
true
;
}
}
}
}
}
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