Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
N
notes2.0
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
zjm
notes2.0
Commits
48be989c
提交
48be989c
authored
5月 29, 2020
作者:
gongwenjie
浏览文件
操作
浏览文件
下载
差异文件
合并分支 'gwj' 到 'master'
Gwj 查看合并请求
!131
上级
a513a371
a6083dc2
流水线
#190
已失败 于阶段
变更
6
流水线
1
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
225 行增加
和
23 行删除
+225
-23
AttendanceController.java
...y/tynotes/attendance/controller/AttendanceController.java
+36
-0
DepartmentExl.java
...com/zjty/tynotes/attendance/entity/exl/DepartmentExl.java
+20
-20
UserAttenVo.java
...va/com/zjty/tynotes/attendance/entity/vo/UserAttenVo.java
+10
-3
UserOverWorkVo.java
...com/zjty/tynotes/attendance/entity/vo/UserOverWorkVo.java
+23
-0
AttendanceDetailsService.java
.../tynotes/attendance/service/AttendanceDetailsService.java
+20
-0
AttendanceDetailsServiceImpl.java
...attendance/service/impl/AttendanceDetailsServiceImpl.java
+116
-0
没有找到文件。
notes-attendance/src/main/java/com/zjty/tynotes/attendance/controller/AttendanceController.java
浏览文件 @
48be989c
...
...
@@ -2,6 +2,7 @@ package com.zjty.tynotes.attendance.controller;
import
com.zjty.tynotes.attendance.entity.ApprovalInformation
;
import
com.zjty.tynotes.attendance.entity.vo.UserAttenList
;
import
com.zjty.tynotes.attendance.entity.vo.UserOverWorkVo
;
import
com.zjty.tynotes.attendance.entity.vo.request.AttenRequest
;
import
com.zjty.tynotes.attendance.service.AttendanceDetailsService
;
import
com.zjty.tynotes.misc.config.AutoDocument
;
...
...
@@ -11,6 +12,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.List
;
import
static
org
.
springframework
.
http
.
ResponseEntity
.
ok
;
/**
...
...
@@ -46,5 +49,38 @@ public class AttendanceController {
return
ok
(
userAttenList
);
}
// @ApiOperation(value = "查询加班时长", response = ApprovalInformation.class)
// @PostMapping("/findOverWork/{type}")
// public ResponseEntity findAttenList(@RequestBody AttenRequest request,@PathVariable String type){
// UserAttenList userAttenList = attendanceDetailsService.findAttenList(request,type);
// return ok(userAttenList);
// }
@ApiOperation
(
value
=
"查询个人加班时长"
,
response
=
ApprovalInformation
.
class
)
@GetMapping
(
"/findOverWork/{userId}"
)
public
ResponseEntity
findOverWork
(
@PathVariable
String
userId
){
UserOverWorkVo
userOverWorkVo
=
attendanceDetailsService
.
findOverWork
(
userId
);
return
ok
(
userOverWorkVo
);
}
@ApiOperation
(
value
=
"清空加班时长"
,
response
=
ApprovalInformation
.
class
)
@GetMapping
(
"/clearUserWork"
)
public
ResponseEntity
clearUserWork
(){
try
{
attendanceDetailsService
.
clearUserWork
();
return
ok
(
"清空加班时长成功"
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
ok
(
"清空加班时长失败"
);
}
@ApiOperation
(
value
=
"查询所有人加班时长"
,
response
=
ApprovalInformation
.
class
)
@GetMapping
(
"/findAllOverWork/{userId}"
)
public
ResponseEntity
findAllOverWork
(
@PathVariable
String
userId
){
List
<
UserOverWorkVo
>
userOverWorkVos
=
attendanceDetailsService
.
findAllOverWork
(
userId
);
return
ok
(
userOverWorkVos
);
}
}
notes-attendance/src/main/java/com/zjty/tynotes/attendance/entity/exl/DepartmentExl.java
浏览文件 @
48be989c
...
...
@@ -34,26 +34,26 @@ public class DepartmentExl {
@Excel
(
name
=
"出差天数"
,
orderNum
=
"7"
,
width
=
20
)
private
Float
outWorkDay
;
@Excel
(
name
=
"
病
假天数"
,
orderNum
=
"8"
,
width
=
20
)
private
Float
sickL
eaveDay
;
@Excel
(
name
=
"
事假天数
"
,
orderNum
=
"9"
,
width
=
20
)
private
Float
thingLeaveDay
;
@Excel
(
name
=
"旷工天数"
,
orderNum
=
"10"
,
width
=
20
)
private
Float
absenteeismDay
;
@Excel
(
name
=
"迟到15分钟"
,
orderNum
=
"11"
,
width
=
20
)
private
Integer
lateOne
;
@Excel
(
name
=
"迟到一小时"
,
orderNum
=
"12"
,
width
=
20
)
private
Integer
lateTwo
;
@Excel
(
name
=
"迟到半天"
,
orderNum
=
"13"
,
width
=
20
)
private
Integer
lateThree
;
@Excel
(
name
=
"迟到一天"
,
orderNum
=
"14"
,
width
=
20
)
private
Integer
lateFour
;
@Excel
(
name
=
"
请
假天数"
,
orderNum
=
"8"
,
width
=
20
)
private
Float
l
eaveDay
;
@Excel
(
name
=
"
备注
"
,
orderNum
=
"9"
,
width
=
20
)
private
String
details
;
//
@Excel(name = "旷工天数", orderNum = "10", width = 20)
//
private Float absenteeismDay;
//
//
@Excel(name = "迟到15分钟", orderNum = "11", width = 20)
//
private Integer lateOne;
//
//
@Excel(name = "迟到一小时", orderNum = "12", width = 20)
//
private Integer lateTwo;
//
//
@Excel(name = "迟到半天", orderNum = "13", width = 20)
//
private Integer lateThree;
//
//
@Excel(name = "迟到一天", orderNum = "14", width = 20)
//
private Integer lateFour;
}
notes-attendance/src/main/java/com/zjty/tynotes/attendance/entity/vo/UserAttenVo.java
浏览文件 @
48be989c
...
...
@@ -29,6 +29,9 @@ public class UserAttenVo {
@ApiModelProperty
(
value
=
"实际出勤天数"
,
example
=
"1"
)
private
Float
realAttendanceDay
;
@ApiModelProperty
(
value
=
"调休天数"
,
example
=
"1"
)
private
Float
paidLeaveDay
;
@ApiModelProperty
(
value
=
"公出天数"
,
example
=
"1"
)
private
Float
outSideBusinessDay
;
...
...
@@ -65,6 +68,9 @@ public class UserAttenVo {
@ApiModelProperty
(
value
=
"旷工天数"
,
example
=
"1"
)
private
Float
absenteeismDay
;
@ApiModelProperty
(
value
=
"备注"
,
example
=
"1"
)
private
String
details
;
public
UserAttenVo
()
{
this
.
attendanceDay
=
0
;
...
...
@@ -81,20 +87,21 @@ public class UserAttenVo {
this
.
thingDay
=
0
f
;
this
.
overWorkHours
=
0
;
this
.
absenteeismDay
=
0
f
;
this
.
paidLeaveDay
=
0
f
;
}
public
void
computerRealAttendanceDay
(){
realAttendanceDay
=
attendanceDay
-
outSideBusinessDay
-
outWorkDay
-
sickLeaveDay
-
absenteeismDay
;
realAttendanceDay
=
attendanceDay
-
outSideBusinessDay
-
outWorkDay
-
sickLeaveDay
-
absenteeismDay
-
paidLeaveDay
;
}
public
DepartmentExl
convert
(){
Float
leaveDay
=
thingDay
+
sickLeaveDay
;
return
new
DepartmentExl
(
name
,
attendanceDay
,
realAttendanceDay
,
outSideBusinessDay
,
lateDay
,
leaveEarlyDay
,
outWorkDay
,
sickLeaveDay
,
thingDay
,
absenteeismDay
,
lateOne
,
lateTwo
,
lateThree
,
lateFour
);
leaveDay
,
null
);
}
...
...
notes-attendance/src/main/java/com/zjty/tynotes/attendance/entity/vo/UserOverWorkVo.java
0 → 100644
浏览文件 @
48be989c
package
com
.
zjty
.
tynotes
.
attendance
.
entity
.
vo
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
/**
* @Author gwj
* @create 2020/5/29 14:18
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel
(
value
=
"返回前端员工加班时长"
,
description
=
"返回前端员工加班时长"
)
public
class
UserOverWorkVo
{
@ApiModelProperty
(
value
=
"名字"
,
example
=
"gwj"
)
private
String
name
;
@ApiModelProperty
(
value
=
"加班时长"
,
example
=
"2"
)
private
Long
overWorkHour
;
}
notes-attendance/src/main/java/com/zjty/tynotes/attendance/service/AttendanceDetailsService.java
浏览文件 @
48be989c
...
...
@@ -2,6 +2,7 @@ package com.zjty.tynotes.attendance.service;
import
com.zjty.tynotes.attendance.entity.vo.UserAttenList
;
import
com.zjty.tynotes.attendance.entity.vo.UserAttenVo
;
import
com.zjty.tynotes.attendance.entity.vo.UserOverWorkVo
;
import
com.zjty.tynotes.attendance.entity.vo.request.AttenRequest
;
import
com.zjty.tynotes.pas.entity.Department
;
...
...
@@ -41,4 +42,23 @@ public interface AttendanceDetailsService {
* @return
*/
UserAttenList
findAttenList
(
AttenRequest
request
,
String
type
);
/**
* 查询加班时长
* @param userId
* @return
*/
UserOverWorkVo
findOverWork
(
String
userId
);
/**
* 清空加班时长
*/
void
clearUserWork
();
/**
* 查询所有人加班时长
* @param userId
* @return
*/
List
<
UserOverWorkVo
>
findAllOverWork
(
String
userId
);
}
notes-attendance/src/main/java/com/zjty/tynotes/attendance/service/impl/AttendanceDetailsServiceImpl.java
浏览文件 @
48be989c
package
com
.
zjty
.
tynotes
.
attendance
.
service
.
impl
;
import
com.zjty.tynotes.attendance.dao.AttendanceDetailsDao
;
import
com.zjty.tynotes.attendance.dao.UserOverWorkDao
;
import
com.zjty.tynotes.attendance.entity.AttendanceDetails
;
import
com.zjty.tynotes.attendance.entity.UserOverWork
;
import
com.zjty.tynotes.attendance.entity.vo.UserAttenList
;
import
com.zjty.tynotes.attendance.entity.vo.UserAttenVo
;
import
com.zjty.tynotes.attendance.entity.vo.UserOverWorkVo
;
import
com.zjty.tynotes.attendance.entity.vo.request.AttenRequest
;
import
com.zjty.tynotes.attendance.service.AttendanceDetailsService
;
import
com.zjty.tynotes.pas.dao.*
;
...
...
@@ -42,12 +45,15 @@ public class AttendanceDetailsServiceImpl implements AttendanceDetailsService {
private
AuthorityDao
authorityDao
;
@Autowired
private
DepartmentDao
departmentDao
;
@Autowired
private
UserOverWorkDao
userOverWorkDao
;
@Override
public
UserAttenVo
findPersonnel
(
AttenRequest
request
)
{
UserAttenVo
userAttenVo
=
new
UserAttenVo
();
SimpleDateFormat
sdf
=
null
;
sdf
=
new
SimpleDateFormat
(
"yyyy-MM"
);
SimpleDateFormat
simpleDateFormat
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
Calendar
calendar
=
Calendar
.
getInstance
();
String
date
=
request
.
getStartDate
();
String
endDate
=
request
.
getEndDate
();
...
...
@@ -99,9 +105,16 @@ public class AttendanceDetailsServiceImpl implements AttendanceDetailsService {
}
if
(
attendanceDetails
.
getSickLeaveDay
()!=
null
){
userAttenVo
.
setSickLeaveDay
(
userAttenVo
.
getSickLeaveDay
()+
attendanceDetails
.
getSickLeaveDay
());
String
format
=
simpleDateFormat
.
format
(
attendanceDetails
.
getAttenDate
());
userAttenVo
.
setDetails
(
userAttenVo
.
getDetails
()+
format
+
"病假"
);
}
if
(
attendanceDetails
.
getThingLeaveDay
()!=
null
){
userAttenVo
.
setThingDay
(
userAttenVo
.
getThingDay
()+
attendanceDetails
.
getThingLeaveDay
());
String
format
=
simpleDateFormat
.
format
(
attendanceDetails
.
getAttenDate
());
userAttenVo
.
setDetails
(
userAttenVo
.
getDetails
()+
format
+
"事假"
);
}
if
(
attendanceDetails
.
getPaidLeaveDay
()!=
null
){
userAttenVo
.
setPaidLeaveDay
(
userAttenVo
.
getPaidLeaveDay
()+
attendanceDetails
.
getPaidLeaveDay
());
}
if
((
"0"
).
equals
(
attendanceDetails
.
getIsLateDay
())){
if
(
attendanceDetails
.
getLateStatus
().
equals
(
"0"
)){
...
...
@@ -313,6 +326,109 @@ public class AttendanceDetailsServiceImpl implements AttendanceDetailsService {
return
userAttenList
;
}
/**
* 查询个人加班时长
* @param userId
* @return
*/
@Override
public
UserOverWorkVo
findOverWork
(
String
userId
)
{
UserOverWorkVo
userOverWorkVo
=
new
UserOverWorkVo
();
UserOverWork
userOverWork
=
userOverWorkDao
.
findByUserId
(
userId
);
Optional
<
User
>
optional
=
pasUserDao
.
findById
(
userId
);
if
(
optional
.
isPresent
()){
User
user
=
optional
.
get
();
userOverWorkVo
.
setName
(
user
.
getUsername
());
}
if
(
userOverWork
!=
null
){
userOverWorkVo
.
setOverWorkHour
(
userOverWork
.
getOverWorkHour
());
}
else
{
userOverWorkVo
.
setOverWorkHour
(
0L
);
}
return
userOverWorkVo
;
}
/**
* 清空加班时长
*/
@Override
public
void
clearUserWork
()
{
userOverWorkDao
.
deleteAll
();
}
/**
* 查询所有人加班时长
* @param userId
* @return
*/
@Override
public
List
<
UserOverWorkVo
>
findAllOverWork
(
String
userId
)
{
List
<
UserOverWorkVo
>
userOverWorkVos
=
new
ArrayList
<>();
List
<
User
>
users
=
pasUserDao
.
findAll
();
List
<
User
>
userList
=
new
ArrayList
<>();
List
<
String
>
departIds
=
new
ArrayList
<>();
List
<
String
>
departmentIds
=
new
ArrayList
<>();
Optional
<
User
>
byId
=
pasUserDao
.
findById
(
userId
);
if
(
byId
.
isPresent
()){
User
user
=
byId
.
get
();
List
<
UserRole
>
userRoles
=
userRoleDao
.
findAllByUserId
(
user
.
getId
());
if
(
userRoles
!=
null
){
List
<
String
>
roleIds
=
new
ArrayList
<>();
userRoles
.
forEach
(
userRole
->
{
roleIds
.
add
(
userRole
.
getRoleId
());
});
List
<
Role
>
roles
=
roleDao
.
findAllByIdIn
(
roleIds
);
if
(
roles
!=
null
){
roles
.
forEach
(
role
->
{
if
(
role
.
getIsLeader
().
equals
(
"0"
)){
departmentIds
.
add
(
role
.
getDepartmentId
());
}
});
}
}
}
if
(
departmentIds
!=
null
){
List
<
String
>
deIds
=
new
ArrayList
<>();
for
(
String
s
:
departmentIds
)
{
deIds
=
getDepartIds
(
deIds
,
s
);
if
(
deIds
!=
null
){
for
(
String
s1
:
deIds
)
{
if
(!
departIds
.
contains
(
s1
)){
departIds
.
add
(
s1
);
}
}
}
}
}
if
(
users
!=
null
){
for
(
User
user
:
users
)
{
if
(
departIds
!=
null
){
List
<
String
>
departmentIds1
=
user
.
getDepartmentIds
();
if
(
departmentIds1
!=
null
){
for
(
String
s
:
departmentIds1
)
{
if
(
departIds
.
contains
(
s
)){
userList
.
add
(
user
);
break
;
}
}
}
}
}
}
List
<
String
>
userIds
=
new
ArrayList
<>();
userList
.
forEach
(
user
->
{
userIds
.
add
(
user
.
getId
());
});
if
(
userIds
!=
null
){
userIds
.
forEach
(
uId
->{
UserOverWorkVo
overWork
=
findOverWork
(
uId
);
userOverWorkVos
.
add
(
overWork
);
});
}
return
userOverWorkVos
;
}
/**
* 递归获得部门树
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论