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
6b4473a2
Commit
6b4473a2
authored
Aug 15, 2023
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改导出动态列
parent
399ad471
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
67 additions
and
37 deletions
+67
-37
attendance-performance-manager/src/main/java/com/mortals/xhx/module/attendance/model/vo/AttendanceStatVo.java
...tals/xhx/module/attendance/model/vo/AttendanceStatVo.java
+0
-5
attendance-performance-manager/src/main/java/com/mortals/xhx/module/attendance/model/vo/AttendanceSummaryQuery.java
...hx/module/attendance/model/vo/AttendanceSummaryQuery.java
+10
-3
attendance-performance-manager/src/main/java/com/mortals/xhx/module/attendance/web/AttendanceStatController.java
...s/xhx/module/attendance/web/AttendanceStatController.java
+56
-28
db/add.sql
db/add.sql
+1
-1
No files found.
attendance-performance-manager/src/main/java/com/mortals/xhx/module/attendance/model/vo/AttendanceStatVo.java
View file @
6b4473a2
...
@@ -17,11 +17,6 @@ import java.util.List;
...
@@ -17,11 +17,6 @@ import java.util.List;
public
class
AttendanceStatVo
extends
BaseEntityLong
{
public
class
AttendanceStatVo
extends
BaseEntityLong
{
@Excels
({
@Excel
(
name
=
"汇总内容"
,
width
=
30
,
targetAttr
=
"attendanceSummary"
,
type
=
Excel
.
Type
.
EXPORT
),
@Excel
(
name
=
"日期"
,
targetAttr
=
"day"
,
type
=
Excel
.
Type
.
EXPORT
),
})
private
List
<
AttendanceStaffStatEntity
>
attendanceStaffStatEntities
;
private
List
<
AttendanceStaffStatEntity
>
attendanceStaffStatEntities
;
...
...
attendance-performance-manager/src/main/java/com/mortals/xhx/module/attendance/model/vo/AttendanceSummaryQuery.java
View file @
6b4473a2
...
@@ -3,12 +3,16 @@ package com.mortals.xhx.module.attendance.model.vo;
...
@@ -3,12 +3,16 @@ package com.mortals.xhx.module.attendance.model.vo;
import
com.mortals.framework.annotation.Excel
;
import
com.mortals.framework.annotation.Excel
;
import
lombok.Data
;
import
lombok.Data
;
import
java.util.List
;
/**
/**
* 考勤汇总查询对象
* 考勤汇总查询对象
*/
*/
@Data
@Data
public
class
AttendanceSummaryQuery
{
public
class
AttendanceSummaryQuery
{
/** 汇总日期 yyyy-mm-dd */
/**
* 汇总日期 yyyy-mm-dd
*/
private
String
summaryTime
;
private
String
summaryTime
;
private
String
summaryTimeStart
;
private
String
summaryTimeStart
;
...
@@ -31,11 +35,14 @@ public class AttendanceSummaryQuery {
...
@@ -31,11 +35,14 @@ public class AttendanceSummaryQuery {
private
Integer
page
;
private
Integer
page
;
private
Integer
size
;
private
Integer
size
;
public
AttendanceSummaryQuery
(
String
summaryTime
){
private
List
<
String
>
properties
;
public
AttendanceSummaryQuery
(
String
summaryTime
)
{
this
.
summaryTime
=
summaryTime
;
this
.
summaryTime
=
summaryTime
;
}
}
public
AttendanceSummaryQuery
(){
public
AttendanceSummaryQuery
()
{
}
}
}
}
attendance-performance-manager/src/main/java/com/mortals/xhx/module/attendance/web/AttendanceStatController.java
View file @
6b4473a2
package
com.mortals.xhx.module.attendance.web
;
package
com.mortals.xhx.module.attendance.web
;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.io.unit.DataUnit
;
import
cn.hutool.core.util.NumberUtil
;
import
cn.hutool.core.util.StrUtil
;
import
com.mortals.framework.annotation.UnAuth
;
import
com.mortals.framework.annotation.UnAuth
;
import
com.mortals.framework.common.Rest
;
import
com.mortals.framework.common.Rest
;
import
com.mortals.framework.exception.AppException
;
import
com.mortals.framework.exception.AppException
;
import
com.mortals.framework.model.PageInfo
;
import
com.mortals.framework.model.PageInfo
;
import
com.mortals.framework.model.Result
;
import
com.mortals.framework.model.Result
;
import
com.mortals.framework.service.ICacheService
;
import
com.mortals.framework.service.ICacheService
;
import
com.mortals.framework.util.DataUtil
;
import
com.mortals.framework.utils.ReflectUtils
;
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
;
...
@@ -22,34 +28,39 @@ import org.springframework.web.bind.annotation.RequestMapping;
...
@@ -22,34 +28,39 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
com.mortals.framework.model.Context
;
import
com.mortals.framework.model.Context
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
import
com.mortals.framework.web.BaseCRUDJsonBodyMappingController
;
import
com.mortals.framework.web.BaseCRUDJsonBodyMappingController
;
import
com.mortals.xhx.module.attendance.model.AttendanceStatEntity
;
import
com.mortals.xhx.module.attendance.model.AttendanceStatEntity
;
import
com.mortals.xhx.module.attendance.service.AttendanceStatService
;
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.text.DateFormat
;
import
java.time.LocalDate
;
import
java.time.LocalDate
;
import
java.time.format.DateTimeFormatter
;
import
java.time.format.DateTimeFormatter
;
import
java.util.*
;
import
java.util.*
;
import
java.util.concurrent.ExecutorService
;
import
java.util.concurrent.ExecutorService
;
import
java.util.concurrent.Executors
;
import
java.util.concurrent.Executors
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.multipart.MultipartFile
;
import
static
com
.
mortals
.
framework
.
ap
.
SysConstains
.*;
import
static
com
.
mortals
.
framework
.
ap
.
SysConstains
.*;
/**
/**
*
* 考勤汇总信息
* 考勤汇总信息
*
*
* @author zxfei
* @author zxfei
* @date 2023-04-08
* @date 2023-04-08
*/
*/
@RestController
@RestController
@RequestMapping
(
"attendance/stat"
)
@RequestMapping
(
"attendance/stat"
)
public
class
AttendanceStatController
extends
BaseCRUDJsonBodyMappingController
<
AttendanceStatService
,
AttendanceStatEntity
,
Long
>
{
public
class
AttendanceStatController
extends
BaseCRUDJsonBodyMappingController
<
AttendanceStatService
,
AttendanceStatEntity
,
Long
>
{
@Autowired
@Autowired
private
ParamService
paramService
;
private
ParamService
paramService
;
...
@@ -66,19 +77,19 @@ public class AttendanceStatController extends BaseCRUDJsonBodyMappingController<
...
@@ -66,19 +77,19 @@ public class AttendanceStatController extends BaseCRUDJsonBodyMappingController<
@Autowired
@Autowired
private
AttendanceClassService
attendanceClassService
;
private
AttendanceClassService
attendanceClassService
;
public
AttendanceStatController
(){
public
AttendanceStatController
()
{
super
.
setModuleDesc
(
"考勤汇总信息"
);
super
.
setModuleDesc
(
"考勤汇总信息"
);
}
}
private
ExecutorService
executorService
=
Executors
.
newCachedThreadPool
();
private
ExecutorService
executorService
=
Executors
.
newCachedThreadPool
();
private
static
String
SUMMARY_TASK_KEY
=
"attendanceSummaryTask:run"
;
private
static
String
SUMMARY_TASK_KEY
=
"attendanceSummaryTask:run"
;
@Override
@Override
protected
void
init
(
Map
<
String
,
Object
>
model
,
Context
context
)
{
protected
void
init
(
Map
<
String
,
Object
>
model
,
Context
context
)
{
this
.
addDict
(
model
,
"deptId"
,
deptService
.
find
(
new
DeptQuery
()).
stream
().
collect
(
Collectors
.
toMap
(
x
->
x
.
getId
().
toString
(),
y
->
y
.
getDeptName
())));
this
.
addDict
(
model
,
"deptId"
,
deptService
.
find
(
new
DeptQuery
()).
stream
().
collect
(
Collectors
.
toMap
(
x
->
x
.
getId
().
toString
(),
y
->
y
.
getDeptName
())));
this
.
addDict
(
model
,
"groupId"
,
attendanceGroupService
.
find
(
new
AttendanceGroupQuery
()).
stream
().
collect
(
Collectors
.
toMap
(
x
->
x
.
getId
().
toString
(),
y
->
y
.
getGroupName
())));
this
.
addDict
(
model
,
"groupId"
,
attendanceGroupService
.
find
(
new
AttendanceGroupQuery
()).
stream
().
collect
(
Collectors
.
toMap
(
x
->
x
.
getId
().
toString
(),
y
->
y
.
getGroupName
())));
this
.
addDict
(
model
,
"classId"
,
attendanceClassService
.
find
(
new
AttendanceClassQuery
()).
stream
().
collect
(
Collectors
.
toMap
(
x
->
x
.
getId
().
toString
(),
y
->
y
.
getClassName
())));
this
.
addDict
(
model
,
"classId"
,
attendanceClassService
.
find
(
new
AttendanceClassQuery
()).
stream
().
collect
(
Collectors
.
toMap
(
x
->
x
.
getId
().
toString
(),
y
->
y
.
getClassName
())));
super
.
init
(
model
,
context
);
super
.
init
(
model
,
context
);
}
}
...
@@ -89,29 +100,29 @@ public class AttendanceStatController extends BaseCRUDJsonBodyMappingController<
...
@@ -89,29 +100,29 @@ public class AttendanceStatController extends BaseCRUDJsonBodyMappingController<
Map
<
String
,
Object
>
model
=
new
HashMap
();
Map
<
String
,
Object
>
model
=
new
HashMap
();
Context
context
=
this
.
getContext
();
Context
context
=
this
.
getContext
();
String
busiDesc
=
"执行考勤汇总任务"
;
String
busiDesc
=
"执行考勤汇总任务"
;
int
code
=
1
;
int
code
=
1
;
try
{
try
{
String
verify
=
cacheService
.
get
(
SUMMARY_TASK_KEY
);
String
verify
=
cacheService
.
get
(
SUMMARY_TASK_KEY
);
if
(
StringUtils
.
isNotEmpty
(
verify
)&&
verify
.
equals
(
"true"
))
{
if
(
StringUtils
.
isNotEmpty
(
verify
)
&&
verify
.
equals
(
"true"
))
{
throw
new
AppException
(
"汇总任务正在执行,请勿重复操作"
);
throw
new
AppException
(
"汇总任务正在执行,请勿重复操作"
);
}
}
executorService
.
submit
(
new
Runnable
()
{
executorService
.
submit
(
new
Runnable
()
{
@Override
@Override
public
void
run
()
{
public
void
run
()
{
cacheService
.
set
(
SUMMARY_TASK_KEY
,
"true"
,
600
);
cacheService
.
set
(
SUMMARY_TASK_KEY
,
"true"
,
600
);
if
(
StringUtils
.
isNotEmpty
(
query
.
getSummaryTimeStart
())
&&
StringUtils
.
isNotEmpty
(
query
.
getSummaryTimeEnd
()))
{
if
(
StringUtils
.
isNotEmpty
(
query
.
getSummaryTimeStart
())
&&
StringUtils
.
isNotEmpty
(
query
.
getSummaryTimeEnd
()))
{
List
<
String
>
dateList
=
getDatesBetween
(
query
.
getSummaryTimeStart
(),
query
.
getSummaryTimeEnd
());
List
<
String
>
dateList
=
getDatesBetween
(
query
.
getSummaryTimeStart
(),
query
.
getSummaryTimeEnd
());
for
(
String
day:
dateList
)
{
for
(
String
day
:
dateList
)
{
AttendanceSummaryQuery
temp
=
new
AttendanceSummaryQuery
(
day
);
AttendanceSummaryQuery
temp
=
new
AttendanceSummaryQuery
(
day
);
service
.
doAttendanceSummary
(
temp
);
service
.
doAttendanceSummary
(
temp
);
}
}
}
else
{
}
else
{
service
.
doAttendanceSummary
(
query
);
service
.
doAttendanceSummary
(
query
);
}
}
cacheService
.
expire
(
SUMMARY_TASK_KEY
,
1
);
cacheService
.
expire
(
SUMMARY_TASK_KEY
,
1
);
}
}
});
});
model
.
put
(
"message_info"
,
"开始执行考勤汇总,请稍后查看"
);
model
.
put
(
"message_info"
,
"开始执行考勤汇总,请稍后查看"
);
}
catch
(
Exception
var9
)
{
}
catch
(
Exception
var9
)
{
code
=
-
1
;
code
=
-
1
;
this
.
doException
(
this
.
request
,
busiDesc
,
model
,
var9
);
this
.
doException
(
this
.
request
,
busiDesc
,
model
,
var9
);
...
@@ -127,10 +138,10 @@ public class AttendanceStatController extends BaseCRUDJsonBodyMappingController<
...
@@ -127,10 +138,10 @@ public class AttendanceStatController extends BaseCRUDJsonBodyMappingController<
LocalDate
endDate
=
LocalDate
.
parse
(
endDateStr
,
formatter
);
LocalDate
endDate
=
LocalDate
.
parse
(
endDateStr
,
formatter
);
List
<
String
>
dates
=
new
ArrayList
<>();
List
<
String
>
dates
=
new
ArrayList
<>();
//这里是判断开始日期是否在结束日期之后或者=结束日期
//这里是判断开始日期是否在结束日期之后或者=结束日期
while
(
startDate
.
isBefore
(
endDate
)
||
startDate
.
isEqual
(
endDate
))
{
while
(
startDate
.
isBefore
(
endDate
)
||
startDate
.
isEqual
(
endDate
))
{
String
add
=
startDate
.
format
(
formatter
);
String
add
=
startDate
.
format
(
formatter
);
dates
.
add
(
add
);
dates
.
add
(
add
);
startDate
=
startDate
.
plusDays
(
1
);
startDate
=
startDate
.
plusDays
(
1
);
}
}
return
dates
;
return
dates
;
}
}
...
@@ -142,7 +153,7 @@ public class AttendanceStatController extends BaseCRUDJsonBodyMappingController<
...
@@ -142,7 +153,7 @@ public class AttendanceStatController extends BaseCRUDJsonBodyMappingController<
Map
<
String
,
Object
>
model
=
new
HashMap
();
Map
<
String
,
Object
>
model
=
new
HashMap
();
Context
context
=
this
.
getContext
();
Context
context
=
this
.
getContext
();
String
busiDesc
=
"查询"
+
this
.
getModuleDesc
();
String
busiDesc
=
"查询"
+
this
.
getModuleDesc
();
int
code
=
1
;
int
code
=
1
;
try
{
try
{
PageInfo
pageInfo
=
this
.
buildPageInfoExt
(
query
);
PageInfo
pageInfo
=
this
.
buildPageInfoExt
(
query
);
Result
<
AttendanceStatEntity
>
result
=
this
.
getService
().
findExt
(
query
,
pageInfo
,
context
);
Result
<
AttendanceStatEntity
>
result
=
this
.
getService
().
findExt
(
query
,
pageInfo
,
context
);
...
@@ -184,7 +195,7 @@ public class AttendanceStatController extends BaseCRUDJsonBodyMappingController<
...
@@ -184,7 +195,7 @@ public class AttendanceStatController extends BaseCRUDJsonBodyMappingController<
public
void
exportExcel
(
@RequestBody
AttendanceSummaryQuery
query
)
{
public
void
exportExcel
(
@RequestBody
AttendanceSummaryQuery
query
)
{
Context
context
=
this
.
getContext
();
Context
context
=
this
.
getContext
();
String
busiDesc
=
"导出"
+
this
.
getModuleDesc
();
String
busiDesc
=
"导出"
+
this
.
getModuleDesc
();
ArrayList
properties
=
new
ArrayList
();
List
<
String
>
properties
=
query
.
getProperties
();
try
{
try
{
String
name
=
StringUtils
.
trim
(
this
.
moduleDesc
);
String
name
=
StringUtils
.
trim
(
this
.
moduleDesc
);
...
@@ -197,7 +208,24 @@ public class AttendanceStatController extends BaseCRUDJsonBodyMappingController<
...
@@ -197,7 +208,24 @@ 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
);
byte
[]
data
=
util
.
exportExcel
(
list
,
properties
,
name
);
//构建动态扩展列
List
<
List
<
Map
<
String
,
Object
>>>
lists
=
list
.
stream
().
map
(
item
->
{
List
<
Map
<
String
,
Object
>>
collect
=
item
.
getAttendanceStaffStatEntities
().
stream
().
map
(
item1
->
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
Integer
year
=
item
.
getYear
();
Integer
month
=
item
.
getMonth
();
Integer
day
=
item
.
getDay
();
StrUtil
.
padPre
(
day
.
toString
(),
2
,
"0"
);
map
.
put
(
"name"
,
StrUtil
.
padPre
(
month
.
toString
(),
2
,
"0"
)
+
"-"
+
StrUtil
.
padPre
(
day
.
toString
(),
2
,
"0"
));
map
.
put
(
"value"
,
item1
.
getAttendanceSummary
());
return
map
;
}).
collect
(
Collectors
.
toList
());
return
collect
;
}).
collect
(
Collectors
.
toList
());
// byte[] data = util.exportExcel(list, properties, name);
byte
[]
data
=
util
.
exportExcel
(
list
,
properties
,
lists
,
name
);
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
)
{
...
...
db/add.sql
View file @
6b4473a2
...
@@ -855,4 +855,4 @@ PRIMARY KEY (`id`)
...
@@ -855,4 +855,4 @@ PRIMARY KEY (`id`)
ALTER
TABLE
mortals_xhx_attendance_leave_record
ADD
COLUMN
`sourceDingTime`
varchar
(
64
)
COMMENT
'钉钉原始请假时间记录'
;
ALTER
TABLE
mortals_xhx_attendance_leave_record
ADD
COLUMN
`sourceDingTime`
varchar
(
64
)
DEFAULT
''
COMMENT
'钉钉原始请假时间记录'
;
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