Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
N
notes2.0
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
zjm
notes2.0
Commits
bc37cde8
提交
bc37cde8
authored
3月 31, 2020
作者:
gongwenjie
浏览文件
操作
浏览文件
下载
差异文件
合并分支 'gwj' 到 'master'
Gwj 查看合并请求
!68
上级
298d3de0
c6b09091
流水线
#107
已取消 于阶段
变更
6
流水线
1
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
228 行增加
和
4 行删除
+228
-4
ApprovalInformation.java
...m/zjty/tynotes/attendance/entity/ApprovalInformation.java
+3
-0
ApprovalInformationServiceImpl.java
...tendance/service/impl/ApprovalInformationServiceImpl.java
+125
-4
UserController.java
.../java/com/zjty/tynotes/pas/controller/UserController.java
+7
-0
DayDao.java
notes-pas/src/main/java/com/zjty/tynotes/pas/dao/DayDao.java
+2
-0
IUserService.java
.../main/java/com/zjty/tynotes/pas/service/IUserService.java
+8
-0
UserServiceImpl.java
...va/com/zjty/tynotes/pas/service/impl/UserServiceImpl.java
+83
-0
没有找到文件。
notes-attendance/src/main/java/com/zjty/tynotes/attendance/entity/ApprovalInformation.java
浏览文件 @
bc37cde8
...
...
@@ -25,6 +25,9 @@ public class ApprovalInformation {
@ApiModelProperty
(
value
=
"id"
,
example
=
"1"
)
private
String
id
;
@ApiModelProperty
(
value
=
"审批名称"
,
example
=
"1"
)
private
String
title
;
@ApiModelProperty
(
value
=
"提交审批用户id"
,
example
=
"1"
)
private
String
userId
;
...
...
notes-attendance/src/main/java/com/zjty/tynotes/attendance/service/impl/ApprovalInformationServiceImpl.java
浏览文件 @
bc37cde8
...
...
@@ -7,7 +7,11 @@ import com.zjty.tynotes.attendance.entity.ApprovalInformation;
import
com.zjty.tynotes.attendance.entity.AttendanceDetails
;
import
com.zjty.tynotes.attendance.entity.UserOverWork
;
import
com.zjty.tynotes.attendance.service.ApprovalInformationService
;
import
com.zjty.tynotes.pas.dao.ConfigDao
;
import
com.zjty.tynotes.pas.dao.DayDao
;
import
com.zjty.tynotes.pas.dao.DepartmentDao
;
import
com.zjty.tynotes.pas.entity.Config
;
import
com.zjty.tynotes.pas.entity.Day
;
import
com.zjty.tynotes.pas.entity.Department
;
import
com.zjty.tynotes.pas.service.IUserService
;
import
org.apache.commons.lang3.StringUtils
;
...
...
@@ -15,10 +19,10 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java
.util.ArrayList
;
import
java.
util.Date
;
import
java.
util.Lis
t
;
import
java.util.
Optional
;
import
java
x.validation.constraints.NotEmpty
;
import
java.
text.ParseException
;
import
java.
text.SimpleDateForma
t
;
import
java.util.
*
;
/**
* @Author gwj
...
...
@@ -36,6 +40,10 @@ public class ApprovalInformationServiceImpl implements ApprovalInformationServic
private
DepartmentDao
departmentDao
;
@Autowired
private
UserOverWorkDao
userOverWorkDao
;
@Autowired
private
DayDao
dayDao
;
@Autowired
private
ConfigDao
configDao
;
@Override
public
ApprovalInformation
addApproval
(
ApprovalInformation
approvalInformation
)
{
...
...
@@ -179,4 +187,117 @@ public class ApprovalInformationServiceImpl implements ApprovalInformationServic
});
return
approvalInformationList
;
}
/**
* 计算调休时长
*/
private
Long
computeTime
(
Date
startTime
,
Date
endTime
){
// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
// Config config = configDao.findAll().get(0);
// SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd "+config.getWorkTime());
// SimpleDateFormat sdf3 = new SimpleDateFormat("yyyy-MM-dd "+config.getAfterWorkTime());
// String format = sdf.format(startTime);
// try {
// Calendar calendar = Calendar.getInstance();
// Date parse1 = sdf2.parse(format);//该天的上班时间
// Date parse2 = sdf3.parse(format);
// Date parse = sdf.parse(format);
// Day day = dayDao.findByDate(parse);
// String status = day.getStatus();
// long hours = 0;
//
// while(true){
// if(parse1.before(startTime)){
// if(endTime.before(parse2)){
// Long time = endTime.getTime() - startTime.getTime();
// long hour = 1000*60*60;
// if(time%hour==0){
// hours = time/hour;
// }else{
// hours = time/hour + 1;
// }
// }else{
//
// }
// }
// }
//
//
//
//
// //判断该天是否是工作日
// if(status.equals("0")) {
// if(parse1.before(startTime)){
// if(endTime.before(parse2)){
// Long time = endTime.getTime() - startTime.getTime();
// long hour = 1000*60*60;
// if(time%hour==0){
// hours = time/hour;
// }else{
// hours = time/hour + 1;
// }
// }else{
// calendar.setTime(parse1);
// calendar.add(Calendar.DATE,1);
// Date time = calendar.getTime();
// Day day1 = dayDao.findByDate(time);
// if(day1.getStatus().equals("0")){
//
// }
// }
// }
// }else{
// calendar.setTime(parse1);
// calendar.add(Calendar.DATE,1);
// Date time = calendar.getTime();
// calendar.setTime(parse2);
// calendar.add(Calendar.DATE,1);
// Date time1 = calendar.getTime();
// Day day1 = dayDao.findByDate(time);
// if(time.before(endTime)){
// if(endTime.before(parse2)){
//
// }
// }
// }
//
//// if(status.equals("0")){//判断该天是否是工作日
//// if(parse1.before(startTime)&&endTime.before(parse2)){
//// if(endTime.before(parse2)){
//// Long time = endTime.getTime() - startTime.getTime();
//// long hour = 1000*60*60;
//// long hours = 0;
//// if(time%hour==0){
//// hours = time/hour;
//// }else{
//// hours = time/hour + 1;
//// }
//// }else{
//// calendar.setTime(parse1);
//// calendar.add(Calendar.DATE,1);//往后一天的上班时间
//// Date time1 = calendar.getTime();
//// if(endTime.before(time1)){
//// Long time = parse2.getTime() - startTime.getTime();
//// long hour = 1000*60*60;
//// long hours = 0;
//// if(time%hour==0){
//// hours = time/hour;
//// }else{
//// hours = time/hour + 1;
//// }
//// }
//// }
////
//// }
//// }
//
//
//
// } catch (ParseException e) {
// e.printStackTrace();
// }
return
null
;
}
}
notes-pas/src/main/java/com/zjty/tynotes/pas/controller/UserController.java
浏览文件 @
bc37cde8
...
...
@@ -137,6 +137,13 @@ public class UserController {
return
ok
(
"重置密码失败"
);
}
@ApiOperation
(
value
=
"查询该用户是否是某用户的上级"
)
@GetMapping
(
"/judgeParent/{id}/{userId}"
)
public
ResponseEntity
judgeParent
(
@PathVariable
String
id
,
@PathVariable
String
userId
)
{
boolean
flag
=
iUserService
.
judgeParent
(
id
,
userId
);
return
ok
(
flag
);
}
}
notes-pas/src/main/java/com/zjty/tynotes/pas/dao/DayDao.java
浏览文件 @
bc37cde8
...
...
@@ -14,4 +14,6 @@ public interface DayDao extends MongoRepository<Day,String> {
List
<
Day
>
findAllByStatusAndDateBetween
(
String
status
,
Date
startDate
,
Date
lastDate
);
List
<
Day
>
findAllByDateBetween
(
Date
startDate
,
Date
lastDate
);
Day
findByDate
(
Date
date
);
}
notes-pas/src/main/java/com/zjty/tynotes/pas/service/IUserService.java
浏览文件 @
bc37cde8
...
...
@@ -153,4 +153,12 @@ public interface IUserService {
* @return
*/
boolean
replacePass
(
String
id
);
/**
* 判断是否为上级,并且拥有修改任务权限
* @param id
* @param userId
* @return
*/
boolean
judgeParent
(
String
id
,
String
userId
);
}
notes-pas/src/main/java/com/zjty/tynotes/pas/service/impl/UserServiceImpl.java
浏览文件 @
bc37cde8
...
...
@@ -568,6 +568,89 @@ public class UserServiceImpl implements IUserService {
return
false
;
}
/**
* 是否为上级,并且拥有修改任务权限
* @param id
* @param userId
* @return
*/
@Override
public
boolean
judgeParent
(
String
id
,
String
userId
)
{
List
<
UserRole
>
userRoles1
=
userRoleDao
.
findAllByUserId
(
userId
);
List
<
UserRole
>
userRoles2
=
userRoleDao
.
findAllByUserId
(
id
);
List
<
String
>
roleIds
=
new
ArrayList
<>();
List
<
String
>
roleIds2
=
new
ArrayList
<>();
boolean
flag
=
false
;
if
(
userRoles2
!=
null
){
userRoles2
.
forEach
(
userRole
->
roleIds
.
add
(
userRole
.
getRoleId
()));
List
<
Role
>
roles
=
roleDao
.
findAllByIdIn
(
roleIds
);
List
<
String
>
departIds
=
new
ArrayList
<>();
if
(
roles
!=
null
){
roles
.
forEach
(
role
->
{
List
<
String
>
authorityIds
=
new
ArrayList
<>();
List
<
RoleAuthority
>
roleAuthorities
=
roleAuthorityDao
.
findAllByRoleId
(
role
.
getId
());
if
(
roleAuthorities
!=
null
){
roleAuthorities
.
forEach
(
roleAuthority
->
{
authorityIds
.
add
(
roleAuthority
.
getAuthorityId
());
});
List
<
Authority
>
authorities
=
authorityDao
.
findAllByIdIn
(
authorityIds
);
if
(
authorities
!=
null
){
authorities
.
forEach
(
authority
->
{
if
(
authority
.
getName
().
equals
(
"修改任务"
)){
departIds
.
add
(
role
.
getDepartmentId
());
}
});
}
}
});
}
if
(
userRoles1
!=
null
){
userRoles1
.
forEach
(
userRole
->
roleIds2
.
add
(
userRole
.
getRoleId
()));
List
<
Role
>
roleList
=
roleDao
.
findAllByIdIn
(
roleIds2
);
List
<
String
>
departmentIds
=
new
ArrayList
<>();
//自身或者上级部门
roleList
.
forEach
(
role
->
{
String
departmentId
=
role
.
getDepartmentId
();
List
<
String
>
parentDepartIds
=
findParentDepartIds
(
departmentId
,
new
ArrayList
<
String
>());
if
(
parentDepartIds
!=
null
){
parentDepartIds
.
forEach
(
str
->{
if
(!
departmentIds
.
contains
(
str
)){
departmentIds
.
add
(
str
);
}
});
}
});
for
(
String
str
:
departmentIds
)
{
if
(
departIds
.
contains
(
str
)){
flag
=
true
;
}
}
}
}
return
flag
;
}
public
List
<
String
>
findParentDepartIds
(
String
departmentId
,
List
<
String
>
departmentIds
){
departmentIds
.
add
(
departmentId
);
Optional
<
Department
>
optional
=
departmentDao
.
findById
(
departmentId
);
Department
department
=
null
;
if
(
optional
.
isPresent
()){
department
=
optional
.
get
();
String
parentId
=
department
.
getParentId
();
if
(
StringUtils
.
isNotBlank
(
parentId
)){
findParentDepartIds
(
parentId
,
departmentIds
);
}
else
{
if
(!
departmentIds
.
contains
(
parentId
)){
departmentIds
.
add
(
parentId
);
}
}
}
return
departmentIds
;
}
/**
* 查询所有上级部门
* @param departIds 需要传入的用户部门集合
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论