Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
N
notes2.0
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
zjm
notes2.0
Commits
a41c41d5
提交
a41c41d5
authored
3月 30, 2020
作者:
gongwenjie
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
考勤
上级
b2174469
隐藏空白字符变更
内嵌
并排
正在显示
21 个修改的文件
包含
420 行增加
和
97 行删除
+420
-97
ApprovalController.java
...jty/tynotes/attendance/controller/ApprovalController.java
+13
-5
AttendanceController.java
...y/tynotes/attendance/controller/AttendanceController.java
+0
-2
TestController.java
...om/zjty/tynotes/attendance/controller/TestController.java
+77
-0
ApprovalInformationDao.java
...m/zjty/tynotes/attendance/dao/ApprovalInformationDao.java
+2
-0
DingUserDao.java
...ain/java/com/zjty/tynotes/attendance/dao/DingUserDao.java
+1
-1
ApprovalInformation.java
...m/zjty/tynotes/attendance/entity/ApprovalInformation.java
+3
-0
CardResult.java
...n/java/com/zjty/tynotes/attendance/entity/CardResult.java
+3
-6
ApprovalInformationService.java
...ynotes/attendance/service/ApprovalInformationService.java
+2
-2
ApprovalInformationServiceImpl.java
...tendance/service/impl/ApprovalInformationServiceImpl.java
+80
-24
CardTask.java
.../main/java/com/zjty/tynotes/attendance/task/CardTask.java
+30
-4
MyInit.java
...rc/main/java/com/zjty/tynotes/attendance/task/MyInit.java
+13
-10
application.yml
notes-attendance/src/main/resources/application.yml
+1
-1
SecurityConfig.java
...main/java/com/zjty/tynotes/pas/config/SecurityConfig.java
+1
-0
IUserService.java
.../main/java/com/zjty/tynotes/pas/service/IUserService.java
+16
-2
RoleServiceImpl.java
...va/com/zjty/tynotes/pas/service/impl/RoleServiceImpl.java
+1
-0
UserServiceImpl.java
...va/com/zjty/tynotes/pas/service/impl/UserServiceImpl.java
+60
-40
UserManageController.java
...notes/weekly/subject/controller/UserManageController.java
+20
-0
ProblemDao.java
.../java/com/zjty/tynotes/weekly/subject/dao/ProblemDao.java
+12
-0
Problem.java
...va/com/zjty/tynotes/weekly/subject/entity/vo/Problem.java
+29
-0
UserManageService.java
...jty/tynotes/weekly/subject/service/UserManageService.java
+22
-0
UserManageServiceImpl.java
...es/weekly/subject/service/impl/UserManageServiceImpl.java
+34
-0
没有找到文件。
notes-attendance/src/main/java/com/zjty/tynotes/attendance/controller/ApprovalController.java
浏览文件 @
a41c41d5
...
...
@@ -57,12 +57,20 @@ public class ApprovalController {
return
ok
(
"删除审批失败"
);
}
/**
* userId为审核者id,id为审批id,approvalStatus为该审批者是否接受审批
* @param userId
* @param approvalInformation
* @param approvalStatus
* @return
*/
@ApiOperation
(
value
=
"审核审批"
)
@DeleteMapping
(
"/audit/{userId}/{id}/{approvalStatus}"
)
public
ResponseEntity
audit
(
@PathVariable
String
userId
,
@PathVariable
String
id
,
@PathVariable
String
approvalStatus
)
{
@PostMapping
(
"/audit/{userId}/{approvalStatus}"
)
public
ResponseEntity
audit
(
@PathVariable
String
userId
,
@PathVariable
String
approvalStatus
,
@RequestBody
ApprovalInformation
approvalInformation
)
{
try
{
ApprovalInformation
approvalInformation
=
approvalInformationService
.
auditApproval
(
userId
,
id
,
approvalStatus
);
return
ok
(
approvalInformation
);
ApprovalInformation
approvalInformation
1
=
approvalInformationService
.
auditApproval
(
userId
,
approvalStatus
,
approvalInformation
);
return
ok
(
approvalInformation
1
);
}
catch
(
Exception
e
)
{
logger
.
error
(
"审核审批失败"
);
}
...
...
@@ -83,7 +91,7 @@ public class ApprovalController {
}
@ApiOperation
(
value
=
"查找所有我审核的审批"
)
@GetMapping
(
"findAllAuditApproval/{userId}"
)
@GetMapping
(
"
/
findAllAuditApproval/{userId}"
)
public
ResponseEntity
findAllAuditApproval
(
@PathVariable
String
userId
)
{
try
{
List
<
ApprovalInformation
>
approvalInformations
=
approvalInformationService
.
findAllAuditApproval
(
userId
);
...
...
notes-attendance/src/main/java/com/zjty/tynotes/attendance/controller/AttendanceController.java
浏览文件 @
a41c41d5
...
...
@@ -37,6 +37,4 @@ public class AttendanceController {
return
ok
(
attendanceDetailsService
.
findDepartment
(
request
));
}
}
notes-attendance/src/main/java/com/zjty/tynotes/attendance/controller/TestController.java
0 → 100644
浏览文件 @
a41c41d5
package
com
.
zjty
.
tynotes
.
attendance
.
controller
;
import
com.dingtalk.api.DefaultDingTalkClient
;
import
com.dingtalk.api.DingTalkClient
;
import
com.dingtalk.api.request.OapiAttendanceListRequest
;
import
com.dingtalk.api.request.OapiUserGetDeptMemberRequest
;
import
com.dingtalk.api.request.OapiUserGetRequest
;
import
com.dingtalk.api.response.OapiAttendanceListResponse
;
import
com.dingtalk.api.response.OapiUserGetDeptMemberResponse
;
import
com.dingtalk.api.response.OapiUserGetResponse
;
import
com.taobao.api.ApiException
;
import
com.zjty.tynotes.attendance.entity.CardResult
;
import
com.zjty.tynotes.attendance.task.CardTask
;
import
com.zjty.tynotes.attendance.task.MyInit
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.List
;
/**
* @Author gwj
* @create 2020/3/27 13:47
*/
@RestController
@RequestMapping
(
"/test"
)
public
class
TestController
{
@Autowired
private
CardTask
cardTask
;
@Autowired
private
MyInit
myInit
;
@GetMapping
(
"/test"
)
public
ResponseEntity
test
(){
List
<
CardResult
>
cardDetails
=
cardTask
.
getCardDetails
();
return
ResponseEntity
.
ok
(
cardDetails
);
}
@GetMapping
(
"/dingUser"
)
public
ResponseEntity
dingUser
(){
Long
aLong
=
myInit
.
dingDepartmentIds
.
get
(
0
);
DingTalkClient
client2
=
new
DefaultDingTalkClient
(
"https://oapi.dingtalk.com/user/getDeptMember"
);
OapiUserGetDeptMemberRequest
req
=
new
OapiUserGetDeptMemberRequest
();
req
.
setDeptId
(
aLong
+
""
);
req
.
setHttpMethod
(
"GET"
);
OapiUserGetDeptMemberResponse
rsp
=
null
;
List
<
String
>
userIds
=
null
;
try
{
rsp
=
client2
.
execute
(
req
,
myInit
.
token
);
userIds
=
rsp
.
getUserIds
();
}
catch
(
ApiException
e
)
{
e
.
printStackTrace
();
}
System
.
out
.
println
(
rsp
.
getBody
());
DingTalkClient
client
=
new
DefaultDingTalkClient
(
"https://oapi.dingtalk.com/user/get"
);
OapiUserGetRequest
request
=
new
OapiUserGetRequest
();
List
<
OapiUserGetResponse
>
responses
=
new
ArrayList
<>();
userIds
.
forEach
(
str
->{
request
.
setUserid
(
str
);
request
.
setHttpMethod
(
"GET"
);
try
{
OapiUserGetResponse
response
=
client
.
execute
(
request
,
myInit
.
token
);
responses
.
add
(
response
);
}
catch
(
ApiException
e
)
{
e
.
printStackTrace
();
}
});
return
ResponseEntity
.
ok
(
responses
);
}
}
notes-attendance/src/main/java/com/zjty/tynotes/attendance/dao/ApprovalInformationDao.java
浏览文件 @
a41c41d5
...
...
@@ -14,4 +14,6 @@ public interface ApprovalInformationDao extends MongoRepository<ApprovalInformat
List
<
ApprovalInformation
>
findAllByApprovalUserIdOneOrApprovalUserIdTwo
(
String
userId
);
List
<
ApprovalInformation
>
findAllByStatusIn
(
List
<
String
>
statusList
);
}
notes-attendance/src/main/java/com/zjty/tynotes/attendance/dao/DingUserDao.java
浏览文件 @
a41c41d5
...
...
@@ -8,5 +8,5 @@ import org.springframework.data.mongodb.repository.MongoRepository;
* @create 2020/3/24 13:33
*/
public
interface
DingUserDao
extends
MongoRepository
<
DingUser
,
String
>
{
DingUser
findByDingUserId
(
String
dingUserId
);
}
notes-attendance/src/main/java/com/zjty/tynotes/attendance/entity/ApprovalInformation.java
浏览文件 @
a41c41d5
...
...
@@ -63,4 +63,7 @@ public class ApprovalInformation {
@ApiModelProperty
(
value
=
"当前审批是否通过,0代表通过,1代表未通过"
,
example
=
"0"
)
private
String
approvalStatus
;
@ApiModelProperty
(
value
=
"当前用户所选择的审批部门id"
,
example
=
"12dqweqe122"
)
private
String
departmentId
;
}
notes-attendance/src/main/java/com/zjty/tynotes/attendance/entity/CardResult.java
浏览文件 @
a41c41d5
...
...
@@ -22,11 +22,8 @@ import java.util.Date;
@Document
(
collection
=
"ding_card"
)
public
class
CardResult
{
@Id
@ApiModelProperty
(
value
=
"id"
,
example
=
"1"
)
private
String
id
;
@ApiModelProperty
(
value
=
"钉钉打卡信息的id"
,
example
=
"123qdsdd212"
)
private
Long
dingCardI
d
;
private
Long
i
d
;
@ApiModelProperty
(
value
=
"考勤类型"
,
example
=
"上班、下班"
)
private
String
checkType
;
...
...
@@ -47,10 +44,10 @@ public class CardResult {
private
String
locationResult
;
public
CardResult
(
OapiAttendanceListResponse
.
Recordresult
recordresult
)
{
this
.
dingCardI
d
=
recordresult
.
getId
();
this
.
i
d
=
recordresult
.
getId
();
this
.
checkType
=
recordresult
.
getCheckType
();
this
.
timeResult
=
recordresult
.
getTimeResult
();
this
.
userCheckTime
=
recordresult
.
getUserCheckTime
(
);
this
.
userCheckTime
=
new
Date
(
recordresult
.
getUserCheckTime
().
getTime
()+
1000
*
60
*
60
*
8
);
this
.
locationResult
=
recordresult
.
getLocationResult
();
}
}
notes-attendance/src/main/java/com/zjty/tynotes/attendance/service/ApprovalInformationService.java
浏览文件 @
a41c41d5
...
...
@@ -25,11 +25,11 @@ public interface ApprovalInformationService {
/**
* 审核审批
* @param
i
d
* @param
userI
d
* @param status
* @return
*/
ApprovalInformation
auditApproval
(
String
userId
,
String
id
,
String
status
);
ApprovalInformation
auditApproval
(
String
userId
,
String
status
,
ApprovalInformation
approvalInformation
);
/**
* 查询所有用户自身提交的审批
...
...
notes-attendance/src/main/java/com/zjty/tynotes/attendance/service/impl/ApprovalInformationServiceImpl.java
浏览文件 @
a41c41d5
...
...
@@ -5,11 +5,14 @@ import com.zjty.tynotes.attendance.dao.AttendanceDetailsDao;
import
com.zjty.tynotes.attendance.entity.ApprovalInformation
;
import
com.zjty.tynotes.attendance.entity.AttendanceDetails
;
import
com.zjty.tynotes.attendance.service.ApprovalInformationService
;
import
com.zjty.tynotes.pas.dao.DepartmentDao
;
import
com.zjty.tynotes.pas.entity.Department
;
import
com.zjty.tynotes.pas.service.IUserService
;
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.List
;
import
java.util.Optional
;
...
...
@@ -26,6 +29,8 @@ public class ApprovalInformationServiceImpl implements ApprovalInformationServic
private
AttendanceDetailsDao
attendanceDetailsDao
;
@Autowired
private
IUserService
iUserService
;
@Autowired
private
DepartmentDao
departmentDao
;
@Override
public
ApprovalInformation
addApproval
(
ApprovalInformation
approvalInformation
)
{
...
...
@@ -74,37 +79,45 @@ public class ApprovalInformationServiceImpl implements ApprovalInformationServic
@Override
@Transactional
public
ApprovalInformation
auditApproval
(
String
userId
,
String
id
,
String
approvalStatus
)
{
Optional
<
ApprovalInformation
>
optional
=
approvalInformationDao
.
findById
(
id
);
ApprovalInformation
approvalInformation
=
null
;
if
(
optional
.
isPresent
()){
approvalInformation
=
optional
.
get
();
List
<
String
>
departmentLevels
=
iUserService
.
getDepartmentLevel
(
approvalInformation
.
getUserId
(),
userId
);
if
(
departmentLevels
.
contains
(
"2"
)||
departmentLevels
.
contains
(
"1"
)){
approvalInformation
.
setApprovalStatus
(
approvalStatus
);
if
(
approvalStatus
.
equals
(
"0"
)){
approvalInformation
.
setApprovalUserIdOne
(
userId
);
approvalInformation
.
setStatus
(
"1"
);
approvalInformation
.
setApprovalOne
(
"0"
);
}
else
{
approvalInformation
.
setApprovalUserIdOne
(
userId
);
approvalInformation
.
setStatus
(
"2"
);
approvalInformation
.
setApprovalOne
(
"1"
);
}
}
else
if
(
departmentLevels
.
contains
(
"3"
)){
if
(
approvalStatus
.
equals
(
"0"
)){
approvalInformation
.
setApprovalUserIdTwo
(
userId
);
public
ApprovalInformation
auditApproval
(
String
userId
,
String
approvalStatus
,
ApprovalInformation
approvalInformation
)
{
String
departmentId
=
approvalInformation
.
getDepartmentId
();
String
departmentLevel
=
iUserService
.
getDepartmentLevel
(
departmentId
);
if
((
"1"
).
equals
(
departmentLevel
)||(
"2"
).
equals
(
departmentLevel
)){
approvalInformation
.
setApprovalUserIdOne
(
userId
);
if
(
approvalInformation
.
getApprovalStatus
()!=
null
&&
approvalInformation
.
getApprovalStatus
().
equals
(
"0"
)){
approvalInformation
.
setStatus
(
"1"
);
approvalInformation
.
setApprovalOne
(
"0"
);
}
else
if
(
approvalInformation
.
getApprovalStatus
()!=
null
&&
approvalInformation
.
getApprovalStatus
().
equals
(
"1"
)){
approvalInformation
.
setStatus
(
"2"
);
approvalInformation
.
setApprovalOne
(
"1"
);
}
}
else
{
if
(
approvalInformation
.
getApprovalTwo
()==
null
){
approvalInformation
.
setApprovalUserIdTwo
(
userId
);
if
(
approvalInformation
.
getApprovalStatus
()!=
null
&&
approvalInformation
.
getApprovalStatus
().
equals
(
"0"
)){
approvalInformation
.
setApprovalTwo
(
"0"
);
}
else
{
approvalInformation
.
setApprovalUserIdTwo
(
userId
);
approvalInformation
.
setStatus
(
"1"
);
}
else
if
(
approvalInformation
.
getApprovalStatus
()!=
null
&&
approvalInformation
.
getApprovalStatus
().
equals
(
"1"
)){
approvalInformation
.
setStatus
(
"2"
);
approvalInformation
.
setApprovalTwo
(
"1"
);
}
}
else
if
(
approvalInformation
.
getApprovalTwo
()!=
null
&&
approvalInformation
.
getApprovalOne
()==
null
){
String
parentDepartmentLevel
=
iUserService
.
getParentDepartmentLevel
(
departmentId
);
if
((
"1"
).
equals
(
parentDepartmentLevel
)||(
"2"
).
equals
(
parentDepartmentLevel
)){
approvalInformation
.
setApprovalUserIdOne
(
userId
);
if
(
approvalInformation
.
getApprovalStatus
()!=
null
&&
approvalInformation
.
getApprovalStatus
().
equals
(
"0"
)){
approvalInformation
.
setStatus
(
"1"
);
approvalInformation
.
setApprovalOne
(
"0"
);
}
else
if
(
approvalInformation
.
getApprovalStatus
()!=
null
&&
approvalInformation
.
getApprovalStatus
().
equals
(
"1"
)){
approvalInformation
.
setStatus
(
"2"
);
approvalInformation
.
setApprovalOne
(
"1"
);
}
}
}
}
return
approvalInformation
;
}
@Override
public
List
<
ApprovalInformation
>
findAllApproval
(
String
userId
)
{
return
approvalInformationDao
.
findAllByUserId
(
userId
);
...
...
@@ -112,6 +125,49 @@ public class ApprovalInformationServiceImpl implements ApprovalInformationServic
@Override
public
List
<
ApprovalInformation
>
findAllAuditApproval
(
String
userId
)
{
return
approvalInformationDao
.
findAllByApprovalUserIdOneOrApprovalUserIdTwo
(
userId
);
List
<
String
>
statusList
=
new
ArrayList
<>();
List
<
String
>
strings
=
new
ArrayList
<>();
statusList
.
add
(
"1"
);
statusList
.
add
(
"2"
);
List
<
ApprovalInformation
>
approvalInformations
=
approvalInformationDao
.
findAllByStatusIn
(
statusList
);
List
<
ApprovalInformation
>
approvalInformationList
=
new
ArrayList
<>();
approvalInformations
.
forEach
(
approvalInformation
->
{
if
(
userId
.
equals
(
approvalInformation
.
getApprovalUserIdOne
())){
approvalInformationList
.
add
(
approvalInformation
);
}
else
if
(
userId
.
equals
(
approvalInformation
.
getApprovalUserIdTwo
())){
approvalInformationList
.
add
(
approvalInformation
);
}
});
strings
.
add
(
"0"
);
List
<
ApprovalInformation
>
approvalInformationList1
=
approvalInformationDao
.
findAllByStatusIn
(
strings
);
approvalInformationList1
.
forEach
(
approvalInformation
->
{
String
departmentId
=
approvalInformation
.
getDepartmentId
();
String
departmentLevel
=
iUserService
.
getDepartmentLevel
(
departmentId
);
if
((
"1"
).
equals
(
departmentLevel
)||(
"2"
).
equals
(
departmentLevel
)){
boolean
flag
=
iUserService
.
findUsersByDepartmentAndAuthority
(
userId
,
departmentId
);
if
(
flag
){
approvalInformationList
.
add
(
approvalInformation
);
}
}
else
{
if
(
approvalInformation
.
getApprovalTwo
()==
null
&&
approvalInformation
.
getApprovalOne
()==
null
){
boolean
flag
=
iUserService
.
findUsersByDepartmentAndAuthority
(
userId
,
departmentId
);
if
(
flag
){
approvalInformationList
.
add
(
approvalInformation
);
}
}
else
if
(
approvalInformation
.
getApprovalTwo
()!=
null
&&
approvalInformation
.
getApprovalOne
()==
null
){
Optional
<
Department
>
optional
=
departmentDao
.
findById
(
departmentId
);
if
(
optional
.
isPresent
()){
Department
department
=
optional
.
get
();
String
parentId
=
department
.
getParentId
();
boolean
flag
=
iUserService
.
findUsersByDepartmentAndAuthority
(
userId
,
parentId
);
if
(
flag
){
approvalInformationList
.
add
(
approvalInformation
);
}
}
}
}
});
return
approvalInformationList
;
}
}
notes-attendance/src/main/java/com/zjty/tynotes/attendance/task/CardTask.java
浏览文件 @
a41c41d5
...
...
@@ -5,7 +5,9 @@ import com.dingtalk.api.DingTalkClient;
import
com.dingtalk.api.request.OapiAttendanceListRequest
;
import
com.dingtalk.api.response.OapiAttendanceListResponse
;
import
com.taobao.api.ApiException
;
import
com.zjty.tynotes.attendance.dao.CardResultDao
;
import
com.zjty.tynotes.attendance.dao.DingUserDao
;
import
com.zjty.tynotes.attendance.entity.CardResult
;
import
com.zjty.tynotes.attendance.entity.DingUser
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
...
...
@@ -33,12 +35,15 @@ public class CardTask {
private
MyInit
init
;
@Autowired
private
DingUserDao
dingUserDao
;
@Autowired
private
CardResultDao
cardResultDao
;
/**
* 定时任务,定时获取打卡信息
*/
@Scheduled
(
cron
=
"0 59 23 * * ? "
)
public
void
getCardDetails
(){
public
List
<
CardResult
>
getCardDetails
(){
List
<
CardResult
>
cardResults
=
new
ArrayList
<>();
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd 00:00:00"
);
SimpleDateFormat
sdf2
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
Calendar
calendar
=
Calendar
.
getInstance
();
...
...
@@ -46,7 +51,7 @@ public class CardTask {
// LocalDateTime.now().minusDays(1).atOffset(ZoneOffset.ofHours(8)).format(DateTimeFormatter.ofPattern("yyyy-MM-dd 00:00:00"));
Date
time
=
calendar
.
getTime
();
String
startTime
=
sdf
2
.
format
(
time
);
String
startTime
=
sdf
.
format
(
time
);
String
endTime
=
sdf2
.
format
(
new
Date
());
DingTalkClient
client
=
new
DefaultDingTalkClient
(
"https://oapi.dingtalk.com/attendance/list"
);
...
...
@@ -61,18 +66,39 @@ public class CardTask {
}
request
.
setWorkDateFrom
(
startTime
);
request
.
setWorkDateTo
(
endTime
);
request
.
setUserIdList
(
dingUserIds
);
request
.
setOffset
(
0L
);
request
.
setLimit
(
1
L
);
request
.
setLimit
(
50
L
);
try
{
init
.
getToken
();
OapiAttendanceListResponse
response
=
client
.
execute
(
request
,
init
.
token
);
if
(
response
!=
null
){
List
<
OapiAttendanceListResponse
.
Recordresult
>
recordresult
=
response
.
getRecordresult
();
if
(
recordresult
!=
null
){
recordresult
.
forEach
(
recordresult1
->
{
String
userId
=
recordresult1
.
getUserId
();
DingUser
dingUser
=
dingUserDao
.
findByDingUserId
(
userId
);
CardResult
cardResult
=
new
CardResult
(
recordresult1
);
cardResult
.
setUserId
(
dingUser
.
getUserId
());
cardResults
.
add
(
cardResult
);
});
}
List
<
CardResult
>
cardResults1
=
cardResultDao
.
saveAll
(
cardResults
);
return
cardResults1
;
}
}
catch
(
ApiException
e
)
{
logger
.
error
(
"定时获取打卡信息失败"
);
}
return
null
;
}
/**
* 定时任务,定时获取打卡信息
*/
@Scheduled
(
cron
=
"0 59 23 * * ? "
)
public
void
calculate
(){
}
}
notes-attendance/src/main/java/com/zjty/tynotes/attendance/task/MyInit.java
浏览文件 @
a41c41d5
...
...
@@ -60,15 +60,15 @@ public class MyInit implements CommandLineRunner {
@Override
public
void
run
(
String
...
args
)
throws
Exception
{
//
getToken();
//
getDepartmentList();
//
getUserList();
//
List<User> users = pasUserDao.findAll();
//
List<DingUser> dingUsers = dingUserDao.findAll();
//
for (String dingsuerId : userIds) {
//
getUserDetails(dingsuerId,users,dingUsers);
//
}
//
dingUserDao.saveAll(dingUserList);
getToken
();
getDepartmentList
();
getUserList
();
List
<
User
>
users
=
pasUserDao
.
findAll
();
List
<
DingUser
>
dingUsers
=
dingUserDao
.
findAll
();
for
(
String
dingsuerId
:
userIds
)
{
getUserDetails
(
dingsuerId
,
users
,
dingUsers
);
}
dingUserDao
.
saveAll
(
dingUserList
);
}
/**
...
...
@@ -84,6 +84,7 @@ public class MyInit implements CommandLineRunner {
try
{
OapiGettokenResponse
response
=
client
.
execute
(
request
);
token
=
response
.
getAccessToken
();
System
.
out
.
println
(
token
);
}
catch
(
ApiException
e
)
{
logger
.
error
(
"获取钉钉token失败"
);
}
...
...
@@ -160,7 +161,8 @@ public class MyInit implements CommandLineRunner {
if
(!
dingsuerIds
.
contains
(
user
.
getUserid
())){
for
(
User
user1
:
users
)
{
if
(
user
.
getName
().
equals
(
user1
.
getUsername
())){
dingUserList
.
add
(
new
DingUser
(
null
,
user
.
getUserid
(),
user1
.
getId
()));
logger
.
error
(
user
.
getUserid
());
dingUserList
.
add
(
new
DingUser
(
null
,
user1
.
getId
(),
user
.
getUserid
()));
}
}
}
else
{
...
...
@@ -177,6 +179,7 @@ public class MyInit implements CommandLineRunner {
if
(
user
.
getName
().
equals
(
user1
.
getUsername
())){
dingUser2
.
setDingUserId
(
user
.
getUserid
());
dingUser2
.
setUserId
(
user1
.
getId
());
logger
.
error
(
"错误加入集合"
);
dingUserList
.
add
(
dingUser2
);
}
}
...
...
notes-attendance/src/main/resources/application.yml
浏览文件 @
a41c41d5
...
...
@@ -2,7 +2,7 @@ ding:
# 获取access_token
tokenUrl
:
https://oapi.dingtalk.com/gettoken
# 获取钉钉部门列表地址
departmentListUrl
:
https://oapi
:dingtalk:
com/department/list
departmentListUrl
:
https://oapi
.dingtalk.
com/department/list
# 获取部门用户userid列表
departmentMenberUrl
:
https://oapi.dingtalk.com/user/getDeptMember
# 获取用户详情
...
...
notes-pas/src/main/java/com/zjty/tynotes/pas/config/SecurityConfig.java
浏览文件 @
a41c41d5
...
...
@@ -56,6 +56,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
httpSecurity
.
cors
().
and
()
.
authorizeRequests
()
.
antMatchers
(
"/test/**"
).
permitAll
()
.
antMatchers
(
"/pas/user/addGuanLian"
).
permitAll
()
.
antMatchers
(
HttpMethod
.
GET
,
"/pas/user"
).
permitAll
()
.
antMatchers
(
"/pas/user/encryPas"
).
permitAll
()
...
...
notes-pas/src/main/java/com/zjty/tynotes/pas/service/IUserService.java
浏览文件 @
a41c41d5
...
...
@@ -127,9 +127,23 @@ public interface IUserService {
/**
* 返回所有上级部门id
* @param executeUserId
* @param departmentId
* @return
*/
String
getDepartmentLevel
(
String
departmentId
);
/**
* 查询上级部门等级
* @param departmentId
* @return
*/
String
getParentDepartmentLevel
(
String
departmentId
);
/**
* 根据用户id判断某个用户是否有该部门的审批权限
* @param userId
* @param departmentId
* @return
*/
List
<
String
>
getDepartmentLevel
(
String
executeUserId
,
String
user
Id
);
boolean
findUsersByDepartmentAndAuthority
(
String
userId
,
String
department
Id
);
}
notes-pas/src/main/java/com/zjty/tynotes/pas/service/impl/RoleServiceImpl.java
浏览文件 @
a41c41d5
...
...
@@ -122,6 +122,7 @@ public class RoleServiceImpl implements IRoleService {
}
@Override
@Transactional
public
Boolean
updateRole
(
Role
role
)
{
List
<
Authority
>
authorities
=
role
.
getAuthorities
();
Optional
<
Role
>
byId
=
roleDao
.
findById
(
role
.
getId
());
...
...
notes-pas/src/main/java/com/zjty/tynotes/pas/service/impl/UserServiceImpl.java
浏览文件 @
a41c41d5
...
...
@@ -484,52 +484,72 @@ public class UserServiceImpl implements IUserService {
/**
* 供考勤模块的审批流程使用的接口
* @param
user
Id
* @param
department
Id
* @return 返回部门等级
*/
@Override
public
List
<
String
>
getDepartmentLevel
(
String
executeUserId
,
String
userId
){
Optional
<
User
>
optionalUser
=
pasUserDao
.
findById
(
executeUserId
);
User
user
=
null
;
if
(!
optionalUser
.
isPresent
())
{
return
null
;
public
String
getDepartmentLevel
(
String
departmentId
){
Optional
<
Department
>
optional
=
departmentDao
.
findById
(
departmentId
);
Department
department
=
null
;
if
(
optional
.
isPresent
()){
department
=
optional
.
get
();
String
level
=
department
.
getLevel
();
return
level
;
}
user
=
optionalUser
.
get
();
List
<
String
>
departmentIds
=
user
.
getDepartmentIds
();
//查询所有的上级部门id集合
List
<
String
>
parentDepartIds
=
findParentDepartIds
(
departmentIds
,
new
ArrayList
<>());
List
<
UserRole
>
userRoles
=
userRoleDao
.
findAllByUserId
(
userId
);
List
<
String
>
roleIds
=
new
ArrayList
<>();
if
(
userRoles
!=
null
){
userRoles
.
forEach
(
userRole
->
roleIds
.
add
(
userRole
.
getRoleId
()));
}
List
<
Role
>
roles
=
roleDao
.
findAllByIdIn
(
roleIds
);
List
<
String
>
departmentLevels
=
new
ArrayList
<>();
if
(
roles
!=
null
){
roles
.
forEach
(
role
->
{
List
<
Authority
>
authorities
=
role
.
getAuthorities
();
authorities
.
forEach
(
authority
->
{
String
name
=
authority
.
getName
();
if
((
"审批权限"
.
equals
(
name
))){
String
departmentId
=
role
.
getDepartmentId
();
if
(
parentDepartIds
.
contains
(
departmentId
)){
Optional
<
Department
>
optional
=
departmentDao
.
findById
(
departmentId
);
Department
department
=
null
;
if
(
optional
.
isPresent
()){
department
=
optional
.
get
();
}
if
(!
departmentLevels
.
contains
(
department
.
getLevel
())){
departmentLevels
.
add
(
department
.
getLevel
());
}
}
}
});
});
}
return
departmentLevels
;
return
null
;
}
@Override
public
String
getParentDepartmentLevel
(
String
departmentId
)
{
Optional
<
Department
>
optional
=
departmentDao
.
findById
(
departmentId
);
Department
department
=
null
;
if
(
optional
.
isPresent
()){
department
=
optional
.
get
();
String
parentId
=
department
.
getParentId
();
Optional
<
Department
>
byId
=
departmentDao
.
findById
(
parentId
);
if
(
byId
.
isPresent
()){
Department
department1
=
byId
.
get
();
String
level
=
department1
.
getLevel
();
return
level
;
}
}
return
null
;
}
/**
* 根据用户id判断某个用户是否有该部门的审批权限
* @param userId
* @param departmentId
* @return
*/
@Override
public
boolean
findUsersByDepartmentAndAuthority
(
String
userId
,
String
departmentId
)
{
List
<
UserRole
>
userRoles
=
userRoleDao
.
findAllByUserId
(
userId
);
List
<
String
>
roleIds
=
new
ArrayList
<>();
if
(
userRoles
!=
null
){
userRoles
.
forEach
(
userRole
->
roleIds
.
add
(
userRole
.
getRoleId
()));
}
List
<
Role
>
roles
=
roleDao
.
findAllByIdIn
(
roleIds
);
if
(
roles
!=
null
){
for
(
Role
role
:
roles
)
{
List
<
RoleAuthority
>
roleAuthorities
=
roleAuthorityDao
.
findAllByRoleId
(
role
.
getId
());
List
<
String
>
authorityIds
=
new
ArrayList
<>();
List
<
String
>
authNames
=
new
ArrayList
<>();
if
(
roleAuthorities
!=
null
){
roleAuthorities
.
forEach
(
roleAuthority
->
authorityIds
.
add
(
roleAuthority
.
getAuthorityId
()));
}
List
<
Authority
>
authorities
=
authorityDao
.
findAllByIdIn
(
authorityIds
);
if
(
authorities
!=
null
){
authorities
.
forEach
(
authority
->
authNames
.
add
(
authority
.
getName
()));
}
if
(
authNames
.
contains
(
"审批权限"
)&&
role
.
getDepartmentId
().
equals
(
departmentId
)){
return
true
;
}
}
}
return
false
;
}
/**
* 查询所有上级部门
* @param departIds 需要传入的用户部门集合
...
...
notes-weekly/src/main/java/com/zjty/tynotes/weekly/subject/controller/UserManageController.java
浏览文件 @
a41c41d5
...
...
@@ -3,6 +3,7 @@ package com.zjty.tynotes.weekly.subject.controller;
import
com.zjty.tynotes.misc.config.AutoDocument
;
import
com.zjty.tynotes.pas.entity.User
;
import
com.zjty.tynotes.pas.entity.vo.PageRequest
;
import
com.zjty.tynotes.weekly.subject.entity.vo.Problem
;
import
com.zjty.tynotes.weekly.subject.service.UserManageService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
...
...
@@ -87,4 +88,23 @@ public class UserManageController {
return
ok
(
"更改密码失败"
);
}
@ApiOperation
(
value
=
"上传建议以及使用中的问题"
)
@PostMapping
public
ResponseEntity
submitProblem
(
@RequestBody
Problem
problem
){
return
ok
(
userManageService
.
submitProblem
(
problem
));
}
@ApiOperation
(
value
=
"查找建议以及使用中的问题"
)
@GetMapping
public
ResponseEntity
searchProblem
(){
return
ok
(
userManageService
.
searchProblem
());
}
@ApiOperation
(
value
=
"修改建议以及使用中的问题"
)
@PutMapping
public
ResponseEntity
putProblem
(
@RequestBody
Problem
problem
){
return
ok
(
userManageService
.
putProblem
(
problem
));
}
}
notes-weekly/src/main/java/com/zjty/tynotes/weekly/subject/dao/ProblemDao.java
0 → 100644
浏览文件 @
a41c41d5
package
com
.
zjty
.
tynotes
.
weekly
.
subject
.
dao
;
import
com.zjty.tynotes.weekly.subject.entity.vo.Problem
;
import
org.springframework.data.mongodb.repository.MongoRepository
;
/**
* @Author gwj
* @create 2020/3/30 9:20
*/
public
interface
ProblemDao
extends
MongoRepository
<
Problem
,
String
>
{
}
notes-weekly/src/main/java/com/zjty/tynotes/weekly/subject/entity/vo/Problem.java
0 → 100644
浏览文件 @
a41c41d5
package
com
.
zjty
.
tynotes
.
weekly
.
subject
.
entity
.
vo
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
org.springframework.data.annotation.Id
;
import
org.springframework.data.mongodb.core.mapping.Document
;
/**
* @Author gwj
* @create 2020/3/30 9:13
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel
(
value
=
"问题"
,
description
=
"问题"
)
@Document
(
collection
=
"problem"
)
public
class
Problem
{
@Id
@ApiModelProperty
(
value
=
"id"
,
example
=
"1"
)
private
String
id
;
@ApiModelProperty
(
value
=
"id"
,
example
=
"1"
)
private
String
des
;
private
String
userId
;
}
notes-weekly/src/main/java/com/zjty/tynotes/weekly/subject/service/UserManageService.java
浏览文件 @
a41c41d5
...
...
@@ -4,6 +4,7 @@ import com.zjty.tynotes.pas.entity.Department;
import
com.zjty.tynotes.pas.entity.User
;
import
com.zjty.tynotes.pas.entity.vo.PageRequest
;
import
com.zjty.tynotes.pas.entity.vo.PageResponse
;
import
com.zjty.tynotes.weekly.subject.entity.vo.Problem
;
import
com.zjty.tynotes.weekly.subject.entity.vo.UserVo
;
import
java.util.List
;
...
...
@@ -55,6 +56,27 @@ public interface UserManageService {
*/
User
updateSelf
(
User
user
,
User
userById
);
/**
*
* 上传bug
* @param problem
* @return
*/
Problem
submitProblem
(
Problem
problem
);
/**
* 查找建议bug
* @return
*/
List
<
Problem
>
searchProblem
();
/**
* 修改建议
* @param problem
* @return
*/
Problem
putProblem
(
Problem
problem
);
// /**
// * 根据任务状态查询人员任务列表
// * @param id
...
...
notes-weekly/src/main/java/com/zjty/tynotes/weekly/subject/service/impl/UserManageServiceImpl.java
浏览文件 @
a41c41d5
...
...
@@ -8,6 +8,8 @@ import com.zjty.tynotes.pas.dao.*;
import
com.zjty.tynotes.pas.entity.*
;
import
com.zjty.tynotes.pas.entity.vo.PageRequest
;
import
com.zjty.tynotes.pas.entity.vo.PageResponse
;
import
com.zjty.tynotes.weekly.subject.dao.ProblemDao
;
import
com.zjty.tynotes.weekly.subject.entity.vo.Problem
;
import
com.zjty.tynotes.weekly.subject.entity.vo.UserVo
;
import
com.zjty.tynotes.weekly.subject.service.UserManageService
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -40,6 +42,9 @@ public class UserManageServiceImpl implements UserManageService {
@Autowired
private
InternalService
internalService
;
@Autowired
private
ProblemDao
problemDao
;
@Override
public
User
findUserById
(
String
id
)
{
Optional
<
User
>
optional
=
pasUserDao
.
findById
(
id
);
...
...
@@ -289,6 +294,35 @@ public class UserManageServiceImpl implements UserManageService {
return
userById
;
}
/**
* 上传bug
* @param problem
* @return
*/
@Override
public
Problem
submitProblem
(
Problem
problem
)
{
return
problemDao
.
save
(
problem
);
}
/**
* 查找bug
* @return
*/
@Override
public
List
<
Problem
>
searchProblem
()
{
return
problemDao
.
findAll
();
}
/**
* 修改bug
* @param problem
* @return
*/
@Override
public
Problem
putProblem
(
Problem
problem
)
{
return
problemDao
.
save
(
problem
);
}
/**
* 暂时没有用到
* @param des
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论