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
d9ecf4f4
Commit
d9ecf4f4
authored
Aug 15, 2023
by
姬鋆屾
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://gitlab.scsmile.cn/zxf/attendance-performance-platform
parents
b3d11a3a
8b225b35
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
111 additions
and
42 deletions
+111
-42
attendance-performance-manager/src/main/java/com/mortals/xhx/common/code/AppealResultEnum.java
...in/java/com/mortals/xhx/common/code/AppealResultEnum.java
+3
-2
attendance-performance-manager/src/main/java/com/mortals/xhx/module/attendance/dingmsg/api/DingMessageController.java
.../module/attendance/dingmsg/api/DingMessageController.java
+4
-3
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
+93
-28
db/add.sql
db/add.sql
+1
-1
No files found.
attendance-performance-manager/src/main/java/com/mortals/xhx/common/code/AppealResultEnum.java
View file @
d9ecf4f4
...
...
@@ -9,9 +9,10 @@ import java.util.Map;
* @author zxfei
*/
public
enum
AppealResultEnum
{
申诉中
(
0
,
"申诉
中"
),
审核中
(
0
,
"审核
中"
),
通过
(
1
,
"通过"
),
不通过
(
2
,
"不通过"
);
不通过
(
2
,
"不通过"
),
撤销审批中
(
3
,
"撤销审批中"
);
private
Integer
value
;
private
String
desc
;
...
...
attendance-performance-manager/src/main/java/com/mortals/xhx/module/attendance/dingmsg/api/DingMessageController.java
View file @
d9ecf4f4
...
...
@@ -14,6 +14,7 @@ import com.dingtalk.api.response.OapiGettokenResponse;
import
com.mortals.framework.annotation.UnAuth
;
import
com.mortals.framework.common.Rest
;
import
com.mortals.framework.exception.AppException
;
import
com.mortals.xhx.common.code.AppealResultEnum
;
import
com.mortals.xhx.common.code.LeaveRulesEnum
;
import
com.mortals.xhx.common.pdu.ApiRespPdu
;
import
com.mortals.xhx.module.attendance.dingmsg.DingCallbackCrypto
;
...
...
@@ -290,18 +291,18 @@ public class DingMessageController {
// leaveRecordEntity.setAuditResult(1);
// }
// }
leaveRecordEntity
.
setAuditResult
(
1
);
leaveRecordEntity
.
setAuditResult
(
AppealResultEnum
.
通过
.
getValue
()
);
}
else
if
(
result
.
equals
(
""
)){
//撤销假期审批中result会为空 撤销审批通过后result为AGREE
if
(
result
.
getTasks
().
size
()
>
1
){
log
.
info
(
"status"
+
result
.
getTasks
().
get
(
1
).
getStatus
());
if
(
result
.
getTasks
().
get
(
1
).
getStatus
().
compareToIgnoreCase
(
"CANCELED"
)
!=
0
){
leaveRecordEntity
.
setAuditResult
(
3
);
//撤销审批中
leaveRecordEntity
.
setAuditResult
(
AppealResultEnum
.
撤销审批中
.
getValue
()
);
//撤销审批中
}
}
}
else
{
leaveRecordEntity
.
setAuditResult
(
2
);
//请假审批中
leaveRecordEntity
.
setAuditResult
(
AppealResultEnum
.
审核中
.
getValue
()
);
//请假审批中
}
...
...
attendance-performance-manager/src/main/java/com/mortals/xhx/module/attendance/model/vo/AttendanceStatVo.java
View file @
d9ecf4f4
...
...
@@ -17,11 +17,6 @@ import java.util.List;
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
;
...
...
attendance-performance-manager/src/main/java/com/mortals/xhx/module/attendance/model/vo/AttendanceSummaryQuery.java
View file @
d9ecf4f4
...
...
@@ -3,12 +3,16 @@ package com.mortals.xhx.module.attendance.model.vo;
import
com.mortals.framework.annotation.Excel
;
import
lombok.Data
;
import
java.util.List
;
/**
* 考勤汇总查询对象
*/
@Data
public
class
AttendanceSummaryQuery
{
/** 汇总日期 yyyy-mm-dd */
/**
* 汇总日期 yyyy-mm-dd
*/
private
String
summaryTime
;
private
String
summaryTimeStart
;
...
...
@@ -31,11 +35,14 @@ public class AttendanceSummaryQuery {
private
Integer
page
;
private
Integer
size
;
public
AttendanceSummaryQuery
(
String
summaryTime
){
private
List
<
String
>
properties
;
public
AttendanceSummaryQuery
(
String
summaryTime
)
{
this
.
summaryTime
=
summaryTime
;
}
public
AttendanceSummaryQuery
(){
public
AttendanceSummaryQuery
()
{
}
}
attendance-performance-manager/src/main/java/com/mortals/xhx/module/attendance/web/AttendanceStatController.java
View file @
d9ecf4f4
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.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.common.Rest
;
import
com.mortals.framework.exception.AppException
;
import
com.mortals.framework.model.PageInfo
;
import
com.mortals.framework.model.Result
;
import
com.mortals.framework.service.ICacheService
;
import
com.mortals.framework.util.DataUtil
;
import
com.mortals.framework.utils.ReflectUtils
;
import
com.mortals.framework.utils.poi.ExcelUtil
;
import
com.mortals.framework.web.BaseCRUDJsonBodyMappingController
;
import
com.mortals.xhx.base.system.param.service.ParamService
;
import
com.mortals.xhx.module.attendance.model.AttendanceClassQuery
;
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.service.AttendanceClassService
;
import
com.mortals.xhx.module.attendance.service.AttendanceGroupService
;
...
...
@@ -22,34 +31,39 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.*
;
import
com.mortals.framework.model.Context
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
com.mortals.framework.web.BaseCRUDJsonBodyMappingController
;
import
com.mortals.xhx.module.attendance.model.AttendanceStatEntity
;
import
com.mortals.xhx.module.attendance.service.AttendanceStatService
;
import
org.apache.commons.lang3.ArrayUtils
;
import
com.mortals.framework.util.StringUtils
;
import
java.text.DateFormat
;
import
java.time.LocalDate
;
import
java.time.format.DateTimeFormatter
;
import
java.util.*
;
import
java.util.concurrent.ExecutorService
;
import
java.util.concurrent.Executors
;
import
java.util.stream.Collectors
;
import
com.alibaba.fastjson.JSONObject
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
static
com
.
mortals
.
framework
.
ap
.
SysConstains
.*;
/**
*
* 考勤汇总信息
*
* @author zxfei
* @date 2023-04-08
*/
* 考勤汇总信息
*
* @author zxfei
* @date 2023-04-08
*/
@RestController
@RequestMapping
(
"attendance/stat"
)
public
class
AttendanceStatController
extends
BaseCRUDJsonBodyMappingController
<
AttendanceStatService
,
AttendanceStatEntity
,
Long
>
{
public
class
AttendanceStatController
extends
BaseCRUDJsonBodyMappingController
<
AttendanceStatService
,
AttendanceStatEntity
,
Long
>
{
@Autowired
private
ParamService
paramService
;
...
...
@@ -66,19 +80,19 @@ public class AttendanceStatController extends BaseCRUDJsonBodyMappingController<
@Autowired
private
AttendanceClassService
attendanceClassService
;
public
AttendanceStatController
(){
super
.
setModuleDesc
(
"考勤汇总信息"
);
public
AttendanceStatController
()
{
super
.
setModuleDesc
(
"考勤汇总信息"
);
}
private
ExecutorService
executorService
=
Executors
.
newCachedThreadPool
();
private
static
String
SUMMARY_TASK_KEY
=
"attendanceSummaryTask:run"
;
private
static
String
SUMMARY_TASK_KEY
=
"attendanceSummaryTask:run"
;
@Override
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
,
"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
,
"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
,
"classId"
,
attendanceClassService
.
find
(
new
AttendanceClassQuery
()).
stream
().
collect
(
Collectors
.
toMap
(
x
->
x
.
getId
().
toString
(),
y
->
y
.
getClassName
())));
super
.
init
(
model
,
context
);
}
...
...
@@ -89,29 +103,29 @@ public class AttendanceStatController extends BaseCRUDJsonBodyMappingController<
Map
<
String
,
Object
>
model
=
new
HashMap
();
Context
context
=
this
.
getContext
();
String
busiDesc
=
"执行考勤汇总任务"
;
int
code
=
1
;
int
code
=
1
;
try
{
String
verify
=
cacheService
.
get
(
SUMMARY_TASK_KEY
);
if
(
StringUtils
.
isNotEmpty
(
verify
)&&
verify
.
equals
(
"true"
))
{
if
(
StringUtils
.
isNotEmpty
(
verify
)
&&
verify
.
equals
(
"true"
))
{
throw
new
AppException
(
"汇总任务正在执行,请勿重复操作"
);
}
executorService
.
submit
(
new
Runnable
()
{
@Override
public
void
run
()
{
cacheService
.
set
(
SUMMARY_TASK_KEY
,
"true"
,
600
);
if
(
StringUtils
.
isNotEmpty
(
query
.
getSummaryTimeStart
())
&&
StringUtils
.
isNotEmpty
(
query
.
getSummaryTimeEnd
()))
{
List
<
String
>
dateList
=
getDatesBetween
(
query
.
getSummaryTimeStart
(),
query
.
getSummaryTimeEnd
());
for
(
String
day:
dateList
)
{
cacheService
.
set
(
SUMMARY_TASK_KEY
,
"true"
,
600
);
if
(
StringUtils
.
isNotEmpty
(
query
.
getSummaryTimeStart
())
&&
StringUtils
.
isNotEmpty
(
query
.
getSummaryTimeEnd
()))
{
List
<
String
>
dateList
=
getDatesBetween
(
query
.
getSummaryTimeStart
(),
query
.
getSummaryTimeEnd
());
for
(
String
day
:
dateList
)
{
AttendanceSummaryQuery
temp
=
new
AttendanceSummaryQuery
(
day
);
service
.
doAttendanceSummary
(
temp
);
}
}
else
{
}
else
{
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
)
{
code
=
-
1
;
this
.
doException
(
this
.
request
,
busiDesc
,
model
,
var9
);
...
...
@@ -127,10 +141,10 @@ public class AttendanceStatController extends BaseCRUDJsonBodyMappingController<
LocalDate
endDate
=
LocalDate
.
parse
(
endDateStr
,
formatter
);
List
<
String
>
dates
=
new
ArrayList
<>();
//这里是判断开始日期是否在结束日期之后或者=结束日期
while
(
startDate
.
isBefore
(
endDate
)
||
startDate
.
isEqual
(
endDate
))
{
String
add
=
startDate
.
format
(
formatter
);
while
(
startDate
.
isBefore
(
endDate
)
||
startDate
.
isEqual
(
endDate
))
{
String
add
=
startDate
.
format
(
formatter
);
dates
.
add
(
add
);
startDate
=
startDate
.
plusDays
(
1
);
startDate
=
startDate
.
plusDays
(
1
);
}
return
dates
;
}
...
...
@@ -142,7 +156,7 @@ public class AttendanceStatController extends BaseCRUDJsonBodyMappingController<
Map
<
String
,
Object
>
model
=
new
HashMap
();
Context
context
=
this
.
getContext
();
String
busiDesc
=
"查询"
+
this
.
getModuleDesc
();
int
code
=
1
;
int
code
=
1
;
try
{
PageInfo
pageInfo
=
this
.
buildPageInfoExt
(
query
);
Result
<
AttendanceStatEntity
>
result
=
this
.
getService
().
findExt
(
query
,
pageInfo
,
context
);
...
...
@@ -184,7 +198,7 @@ public class AttendanceStatController extends BaseCRUDJsonBodyMappingController<
public
void
exportExcel
(
@RequestBody
AttendanceSummaryQuery
query
)
{
Context
context
=
this
.
getContext
();
String
busiDesc
=
"导出"
+
this
.
getModuleDesc
();
ArrayList
properties
=
new
ArrayList
();
List
<
String
>
properties
=
query
.
getProperties
();
try
{
String
name
=
StringUtils
.
trim
(
this
.
moduleDesc
);
...
...
@@ -197,7 +211,58 @@ public class AttendanceStatController extends BaseCRUDJsonBodyMappingController<
Class
<
AttendanceStatEntity
>
tClass
=
ReflectUtils
.
getClassGenricType
(
this
.
getClass
(),
1
);
ExcelUtil
<
AttendanceStatEntity
,
Long
>
util
=
new
ExcelUtil
(
tClass
);
this
.
doExportAfter
(
context
,
list
);
byte
[]
data
=
util
.
exportExcel
(
list
,
properties
,
name
);
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
->
{
List
<
AttendanceStaffStatEntity
>
attendanceStaffStatEntities
=
item
.
getAttendanceStaffStatEntities
();
Map
<
Integer
,
String
>
collect
=
new
HashMap
<>();
if
(!
ObjectUtils
.
isEmpty
(
attendanceStaffStatEntities
))
{
collect
=
attendanceStaffStatEntities
.
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<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
.
recordSysLog
(
this
.
request
,
busiDesc
+
" 【成功】"
);
}
catch
(
Exception
var12
)
{
...
...
db/add.sql
View file @
d9ecf4f4
...
...
@@ -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