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
7e758f7e
Commit
7e758f7e
authored
Aug 15, 2023
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改导出动态列
parent
9a1aec50
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
2 deletions
+35
-2
attendance-performance-manager/src/main/java/com/mortals/xhx/module/attendance/web/AttendanceStatController.java
...s/xhx/module/attendance/web/AttendanceStatController.java
+35
-2
No files found.
attendance-performance-manager/src/main/java/com/mortals/xhx/module/attendance/web/AttendanceStatController.java
View file @
7e758f7e
package
com.mortals.xhx.module.attendance.web
;
package
com.mortals.xhx.module.attendance.web
;
import
cn.hutool.core.date.DateTime
;
import
cn.hutool.core.date.DateUnit
;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.io.unit.DataUnit
;
import
cn.hutool.core.io.unit.DataUnit
;
import
cn.hutool.core.util.NumberUtil
;
import
cn.hutool.core.util.NumberUtil
;
...
@@ -17,6 +19,7 @@ import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
...
@@ -17,6 +19,7 @@ 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.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.vo.AttendanceSummaryQuery
;
import
com.mortals.xhx.module.attendance.model.vo.AttendanceSummaryQuery
;
import
com.mortals.xhx.module.attendance.service.AttendanceClassService
;
import
com.mortals.xhx.module.attendance.service.AttendanceClassService
;
import
com.mortals.xhx.module.attendance.service.AttendanceGroupService
;
import
com.mortals.xhx.module.attendance.service.AttendanceGroupService
;
...
@@ -208,8 +211,38 @@ public class AttendanceStatController extends BaseCRUDJsonBodyMappingController<
...
@@ -208,8 +211,38 @@ public class AttendanceStatController extends BaseCRUDJsonBodyMappingController<
Class
<
AttendanceStatEntity
>
tClass
=
ReflectUtils
.
getClassGenricType
(
this
.
getClass
(),
1
);
Class
<
AttendanceStatEntity
>
tClass
=
ReflectUtils
.
getClassGenricType
(
this
.
getClass
(),
1
);
ExcelUtil
<
AttendanceStatEntity
,
Long
>
util
=
new
ExcelUtil
(
tClass
);
ExcelUtil
<
AttendanceStatEntity
,
Long
>
util
=
new
ExcelUtil
(
tClass
);
this
.
doExportAfter
(
context
,
list
);
this
.
doExportAfter
(
context
,
list
);
DateTime
startDate
=
DateUtil
.
parse
(
query
.
getSummaryTimeStart
());
DateTime
endDate
=
DateUtil
.
parse
(
query
.
getSummaryTimeEnd
());
Long
subDay
=
DateUtil
.
between
(
startDate
,
endDate
,
DateUnit
.
DAY
);
//构建动态扩展列
List
<
List
<
Map
<
String
,
Object
>>>
lists
=
list
.
stream
().
map
(
item
->
{
Map
<
Integer
,
String
>
collect
=
item
.
getAttendanceStaffStatEntities
().
stream
().
collect
(
Collectors
.
toMap
(
x
->
x
.
getYear
()
+
x
.
getMonth
()
+
x
.
getDay
(),
y
->
y
.
getAttendanceSummary
()));
List
<
Map
<
String
,
Object
>>
mapList
=
new
ArrayList
<>();
for
(
int
i
=
1
;
i
<=
subDay
.
intValue
();
i
++)
{
DateTime
curDate
=
DateUtil
.
offsetDay
(
startDate
,
i
);
//判断详细是否存在,如果不存在 则构造一个空的
Integer
year
=
DateUtil
.
year
(
curDate
);
Integer
month
=
DateUtil
.
month
(
curDate
)
+
1
;
Integer
day
=
DateUtil
.
dayOfMonth
(
curDate
);
Integer
total
=
year
+
month
+
day
;
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
if
(
collect
.
get
(
total
)
!=
null
)
{
map
.
put
(
"name"
,
curDate
.
toDateStr
());
map
.
put
(
"value"
,
collect
.
get
(
total
));
}
else
{
map
.
put
(
"name"
,
curDate
.
toDateStr
());
map
.
put
(
"value"
,
"--"
);
}
mapList
.
add
(
map
);
}
return
mapList
;
}).
collect
(
Collectors
.
toList
());
/* //构建动态扩展列
List<List<Map<String, Object>>> lists = list.stream().map(item -> {
List<List<Map<String, Object>>> lists = list.stream().map(item -> {
List<Map<String, Object>> collect = item.getAttendanceStaffStatEntities().stream().map(item1 -> {
List<Map<String, Object>> collect = item.getAttendanceStaffStatEntities().stream().map(item1 -> {
Map<String, Object> map = new HashMap<>();
Map<String, Object> map = new HashMap<>();
...
@@ -222,7 +255,7 @@ public class AttendanceStatController extends BaseCRUDJsonBodyMappingController<
...
@@ -222,7 +255,7 @@ public class AttendanceStatController extends BaseCRUDJsonBodyMappingController<
return map;
return map;
}).collect(Collectors.toList());
}).collect(Collectors.toList());
return collect;
return collect;
}).
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
);
...
...
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