Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
N
notes2.0
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
zjm
notes2.0
Commits
a159cbe4
提交
a159cbe4
authored
4月 07, 2020
作者:
gongwenjie
浏览文件
操作
浏览文件
下载
差异文件
合并分支 'gwj' 到 'master'
Gwj 查看合并请求
!80
上级
93cd067f
ddc0dafd
流水线
#121
已取消 于阶段
变更
22
流水线
1
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
22 个修改的文件
包含
335 行增加
和
73 行删除
+335
-73
AttendanceController.java
...y/tynotes/attendance/controller/AttendanceController.java
+1
-47
DingTestController.java
...jty/tynotes/attendance/controller/DingTestController.java
+65
-0
DingUserController.java
...jty/tynotes/attendance/controller/DingUserController.java
+1
-1
ApprovalInformationDao.java
...m/zjty/tynotes/attendance/dao/ApprovalInformationDao.java
+7
-0
ApprovalInformation.java
...m/zjty/tynotes/attendance/entity/ApprovalInformation.java
+7
-1
AttendanceDepartment.java
.../zjty/tynotes/attendance/entity/AttendanceDepartment.java
+5
-2
AttendanceDetails.java
...com/zjty/tynotes/attendance/entity/AttendanceDetails.java
+28
-7
UserAttenVo.java
...va/com/zjty/tynotes/attendance/entity/vo/UserAttenVo.java
+48
-2
AttendanceDetailsService.java
.../tynotes/attendance/service/AttendanceDetailsService.java
+20
-0
ApprovalInformationServiceImpl.java
...tendance/service/impl/ApprovalInformationServiceImpl.java
+3
-3
AttendanceDetailsServiceImpl.java
...attendance/service/impl/AttendanceDetailsServiceImpl.java
+0
-0
CardTask.java
.../main/java/com/zjty/tynotes/attendance/task/CardTask.java
+0
-0
MyInit.java
...rc/main/java/com/zjty/tynotes/attendance/task/MyInit.java
+7
-3
application.yml
notes-attendance/src/main/resources/application.yml
+2
-2
SecurityConfig.java
...main/java/com/zjty/tynotes/pas/config/SecurityConfig.java
+1
-0
TestController.java
.../java/com/zjty/tynotes/pas/controller/TestController.java
+13
-4
RoleDao.java
...s-pas/src/main/java/com/zjty/tynotes/pas/dao/RoleDao.java
+2
-0
Role.java
...s-pas/src/main/java/com/zjty/tynotes/pas/entity/Role.java
+3
-0
JobLeads.java
...rc/main/java/com/zjty/tynotes/pas/entity/vo/JobLeads.java
+30
-0
IUserService.java
.../main/java/com/zjty/tynotes/pas/service/IUserService.java
+9
-0
UserServiceImpl.java
...va/com/zjty/tynotes/pas/service/impl/UserServiceImpl.java
+82
-0
Init.java
notes-pas/src/main/java/com/zjty/tynotes/pas/task/Init.java
+1
-1
没有找到文件。
notes-attendance/src/main/java/com/zjty/tynotes/attendance/controller/AttendanceController.java
浏览文件 @
a159cbe4
package
com
.
zjty
.
tynotes
.
attendance
.
controller
;
import
cn.afterturn.easypoi.excel.ExcelExportUtil
;
import
cn.afterturn.easypoi.excel.entity.ExportParams
;
import
cn.afterturn.easypoi.excel.entity.enmus.ExcelType
;
import
com.zjty.tynotes.attendance.dao.AttendanceDepartmentDao
;
import
com.zjty.tynotes.attendance.entity.ApprovalInformation
;
import
com.zjty.tynotes.attendance.entity.exl.DepartmentExl
;
import
com.zjty.tynotes.attendance.entity.vo.request.AttenRequest
;
import
com.zjty.tynotes.attendance.service.AttendanceDetailsService
;
import
com.zjty.tynotes.misc.config.AutoDocument
;
import
com.zjty.tynotes.misc.utils.ExcelUtil
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.log4j.Log4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.poi.ss.usermodel.Workbook
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.*
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
static
org
.
springframework
.
http
.
ResponseEntity
.
ok
;
/**
...
...
@@ -35,18 +17,14 @@ import static org.springframework.http.ResponseEntity.ok;
* @create 2020/3/25 9:12
* @des 考勤信息统计
*/
@Api
(
tags
=
"考勤模块"
)
@Api
(
tags
=
"考勤模块"
,
protocols
=
"http"
)
@RestController
@AutoDocument
@Slf4j
@RequestMapping
(
"/attendance/info"
)
public
class
AttendanceController
{
@Autowired
private
AttendanceDetailsService
attendanceDetailsService
;
@Autowired
AttendanceDepartmentDao
attendanceDepartmentDao
;
@ApiOperation
(
value
=
"查询个人考勤信息"
,
response
=
ApprovalInformation
.
class
)
@PostMapping
(
"/personnel"
)
public
ResponseEntity
personnel
(
@RequestBody
AttenRequest
request
){
...
...
@@ -59,28 +37,4 @@ public class AttendanceController {
return
ok
(
attendanceDetailsService
.
findDepartment
(
request
));
}
@PostMapping
(
"/excel"
)
@ApiOperation
(
value
=
"导出元数据excel表格"
)
public
void
exportCurrentPage
(
HttpServletRequest
request
,
HttpServletResponse
response
)
{
log
.
info
(
"元数据 正在执行单页excel导出任务..."
);
//把要导出的信息放在map里面
List
<
Map
<
String
,
Object
>>
excelList
=
new
ArrayList
<>();
//构建创建导出excel表格所需要的Workbook对象的map
// VoMetadataTableInfo voTableInfo= metaDataService.getVoTableInfo(dbName, name);
List
<
DepartmentExl
>
list
=
new
ArrayList
<>();
list
.
add
(
new
DepartmentExl
(
"占金明"
,
22
,
22
f
,
0
f
,
0
,
0
,
0
f
,
0
f
));
Map
<
String
,
Object
>
map
=
new
HashMap
<>(
8
);
map
.
put
(
"subFpName"
,
"3月"
);
map
.
put
(
"title"
,
new
ExportParams
(
"3月"
,
"3月"
));
map
.
put
(
"entity"
,
DepartmentExl
.
class
);
map
.
put
(
"data"
,
list
);
excelList
.
add
(
map
);
Workbook
workbook
=
ExcelExportUtil
.
exportExcel
(
excelList
,
ExcelType
.
HSSF
);
ExcelUtil
.
downloadExcel
(
request
,
response
,
workbook
,
"3月"
);
}
}
notes-attendance/src/main/java/com/zjty/tynotes/attendance/controller/DingTestController.java
0 → 100644
浏览文件 @
a159cbe4
package
com
.
zjty
.
tynotes
.
attendance
.
controller
;
import
com.dingtalk.api.DefaultDingTalkClient
;
import
com.dingtalk.api.DingTalkClient
;
import
com.dingtalk.api.request.OapiUserGetRequest
;
import
com.dingtalk.api.response.OapiDepartmentListResponse
;
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
com.zjty.tynotes.misc.config.AutoDocument
;
import
io.swagger.annotations.Api
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* @Author gwj
* @create 2020/4/3 9:37
*/
@Api
(
tags
=
"考勤模块"
,
protocols
=
"http"
)
@RestController
@RequestMapping
(
"/ding/test"
)
@AutoDocument
public
class
DingTestController
{
@Autowired
private
MyInit
myInit
;
@Autowired
private
CardTask
cardTask
;
@GetMapping
(
"/token"
)
public
Object
token
(){
List
<
String
>
responses
=
new
ArrayList
<>();
myInit
.
getToken
();
myInit
.
getDepartmentList
();
myInit
.
getUserList
();
List
<
String
>
userIds
=
myInit
.
userIds
;
DingTalkClient
client
=
new
DefaultDingTalkClient
(
"https://oapi.dingtalk.com/user/get"
);
OapiUserGetRequest
request
=
new
OapiUserGetRequest
();
request
.
setHttpMethod
(
"GET"
);
userIds
.
forEach
(
str
->{
request
.
setUserid
(
str
);
try
{
OapiUserGetResponse
response
=
client
.
execute
(
request
,
myInit
.
token
);
responses
.
add
(
response
.
getName
());
}
catch
(
ApiException
e
)
{
e
.
printStackTrace
();
}
});
System
.
out
.
println
(
responses
.
size
());
return
responses
;
}
@GetMapping
(
"/card"
)
public
Object
card
(){
List
<
CardResult
>
cardDetails
=
cardTask
.
getCardDetails
();
return
cardDetails
;
}
}
notes-attendance/src/main/java/com/zjty/tynotes/attendance/controller/DingUserController.java
浏览文件 @
a159cbe4
...
...
@@ -25,7 +25,7 @@ import static org.springframework.http.ResponseEntity.ok;
/**
* @author mcj
*/
@Api
(
tags
=
"
钉钉
"
,
protocols
=
"http"
)
@Api
(
tags
=
"
考勤模块
"
,
protocols
=
"http"
)
@RestController
@RequestMapping
(
"/attendance/user"
)
@AutoDocument
...
...
notes-attendance/src/main/java/com/zjty/tynotes/attendance/dao/ApprovalInformationDao.java
浏览文件 @
a159cbe4
...
...
@@ -3,6 +3,7 @@ package com.zjty.tynotes.attendance.dao;
import
com.zjty.tynotes.attendance.entity.ApprovalInformation
;
import
org.springframework.data.mongodb.repository.MongoRepository
;
import
java.util.Date
;
import
java.util.List
;
/**
...
...
@@ -16,4 +17,10 @@ public interface ApprovalInformationDao extends MongoRepository<ApprovalInformat
List
<
ApprovalInformation
>
findAllByApprovalUserIdOneOrApprovalUserIdTwo
(
String
userId
);
List
<
ApprovalInformation
>
findAllByStatusIn
(
List
<
String
>
statusList
);
ApprovalInformation
findAllByUserIdAndLeaveStartTimeBeforeAndLeaveEndTimeAfterAndApprovalTypeIn
(
String
userId
,
Date
startTime
,
Date
endTime
,
List
<
String
>
type
);
ApprovalInformation
findAllByUserIdAndLeaveStartTimeBeforeAndLeaveEndTimeBetweenAndApprovalTypeIn
(
String
userId
,
Date
startTime
,
Date
startTime1
,
Date
endTime
,
List
<
String
>
type
);
ApprovalInformation
findAllByUserIdAndLeaveStartTimeBetweenAndLeaveEndTimeAfterAndApprovalTypeIn
(
String
userId
,
Date
startTime
,
Date
endTime
,
Date
endTime1
,
List
<
String
>
type
);
}
notes-attendance/src/main/java/com/zjty/tynotes/attendance/entity/ApprovalInformation.java
浏览文件 @
a159cbe4
package
com
.
zjty
.
tynotes
.
attendance
.
entity
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
...
...
@@ -31,13 +32,16 @@ public class ApprovalInformation {
@ApiModelProperty
(
value
=
"提交审批用户id"
,
example
=
"1"
)
private
String
userId
;
@ApiModelProperty
(
value
=
"提交审批用户姓名"
,
example
=
"1"
)
private
String
name
;
@ApiModelProperty
(
value
=
"审核审批用户id"
,
example
=
"1"
)
private
String
approvalUserIdOne
;
@ApiModelProperty
(
value
=
"审核审批用户id"
,
example
=
"1"
)
private
String
approvalUserIdTwo
;
@ApiModelProperty
(
value
=
"审批类型,事假/调休/病假/加班/公出
"
,
example
=
"事假/调休/病假/加班/公出
"
)
@ApiModelProperty
(
value
=
"审批类型,事假/调休/病假/加班/公出
/出差"
,
example
=
"事假/调休/病假/加班/公出/出差
"
)
private
String
approvalType
;
@ApiModelProperty
(
value
=
"审批状态,0代表待审批,1代表已通过,2代表已拒绝"
,
example
=
"0/1/2"
)
...
...
@@ -53,9 +57,11 @@ public class ApprovalInformation {
private
String
approvalLevel
;
@ApiModelProperty
(
value
=
"请假开始时间"
,
example
=
"2020-03-20 09:00:00"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
private
Date
leaveStartTime
;
@ApiModelProperty
(
value
=
"请假结束时间"
,
example
=
"2020-03-21 09:00:00"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
private
Date
leaveEndTime
;
@ApiModelProperty
(
value
=
"一级审批是否通过"
,
example
=
"0/1"
)
...
...
notes-attendance/src/main/java/com/zjty/tynotes/attendance/entity/AttendanceDepartment.java
浏览文件 @
a159cbe4
...
...
@@ -14,7 +14,7 @@ import org.springframework.data.mongodb.core.mapping.Document;
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel
(
value
=
"
个人考勤信息"
,
description
=
"个人
考勤信息"
)
@ApiModel
(
value
=
"
部门考勤信息"
,
description
=
"部门
考勤信息"
)
@Document
(
collection
=
"ding_attendepart"
)
public
class
AttendanceDepartment
{
private
String
id
;
...
...
@@ -41,8 +41,11 @@ public class AttendanceDepartment {
private
Integer
earlyDay
;
@ApiModelProperty
(
value
=
"出差天数"
,
example
=
"1"
)
private
Float
O
utWorkDay
;
private
Float
o
utWorkDay
;
@ApiModelProperty
(
value
=
"请假天数"
,
example
=
"1"
)
private
Float
offFromWorkDay
;
@ApiModelProperty
(
value
=
"加班时长"
,
example
=
"1"
)
private
Float
overWorkHours
;
}
notes-attendance/src/main/java/com/zjty/tynotes/attendance/entity/AttendanceDetails.java
浏览文件 @
a159cbe4
...
...
@@ -51,18 +51,39 @@ public class AttendanceDetails {
@ApiModelProperty
(
value
=
"是否旷工0为旷工/1为未旷工"
,
example
=
"2"
)
Integer
isAbsenteeismDay
;
@ApiModelProperty
(
value
=
"旷工天数"
,
example
=
"2"
)
Float
absenteeismDay
;
@ApiModelProperty
(
value
=
"是否加班0为加班/1为未加班"
,
example
=
"10"
)
Integer
isWorkOverHours
;
@ApiModelProperty
(
value
=
"是否调休0为调休/1为未调休"
,
example
=
"1"
)
Float
isPaidLeaveDay
;
@ApiModelProperty
(
value
=
"加班时长"
,
example
=
"4"
)
Integer
workOverHours
;
// @ApiModelProperty(value = "是否调休0为调休/1为未调休",example = "1")
// Integer isPaidLeaveDay;
//
// @ApiModelProperty(value = "调休时长",example = "1")
// Float paidLeaveDay;
@ApiModelProperty
(
value
=
"是否请假0为请假/1为未请假"
,
example
=
"1"
)
Integer
isSickLeaveDay
;
@ApiModelProperty
(
value
=
"请假时长"
,
example
=
"1"
)
Float
sickLeaveDay
;
@ApiModelProperty
(
value
=
"是否公出"
,
example
=
"1"
)
Integer
isOutSideBusinessDay
;
@ApiModelProperty
(
value
=
"公出天数"
,
example
=
"1"
)
Float
outSideBusinessDay
;
@ApiModelProperty
(
value
=
"
是否病假0为病假/1为未病假
"
,
example
=
"1"
)
Float
isSickLeave
Day
;
@ApiModelProperty
(
value
=
"
出差
"
,
example
=
"1"
)
Integer
isOutWork
Day
;
@ApiModelProperty
(
value
=
"
是否公出0为公出/1为未公出
"
,
example
=
"1"
)
Float
isOutSideBusiness
Day
;
@ApiModelProperty
(
value
=
"
出差时长
"
,
example
=
"1"
)
Float
outWork
Day
;
@ApiModelProperty
(
value
=
"时间"
,
example
=
"2020-03-22"
)
@ApiModelProperty
(
value
=
"时间"
,
example
=
"2020-03-22
09:00:00
"
)
Date
date
;
}
notes-attendance/src/main/java/com/zjty/tynotes/attendance/entity/vo/UserAttenVo.java
浏览文件 @
a159cbe4
...
...
@@ -2,6 +2,7 @@ package com.zjty.tynotes.attendance.entity.vo;
import
com.zjty.tynotes.attendance.entity.AttendanceDetails
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
...
...
@@ -12,11 +13,56 @@ import lombok.NoArgsConstructor;
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel
(
value
=
"返回前台的个人考勤统计信息"
,
description
=
"返回前台的个人考勤统计信息"
)
public
class
UserAttenVo
extends
AttendanceDetails
{
public
class
UserAttenVo
{
@ApiModelProperty
(
value
=
"用户编号"
,
example
=
"1"
)
private
String
userId
;
@ApiModelProperty
(
value
=
"用户姓名"
,
example
=
"1"
)
private
String
name
;
@ApiModelProperty
(
value
=
"应出勤天数"
,
example
=
"1"
)
private
Integer
attendanceDay
;
@ApiModelProperty
(
value
=
"实际出勤天数"
,
example
=
"1"
)
private
Float
realAttendanceDay
;
@ApiModelProperty
(
value
=
"公出天数"
,
example
=
"1"
)
private
Float
outSideBusinessDay
;
@ApiModelProperty
(
value
=
"迟到天数"
,
example
=
"1"
)
private
Integer
lateDay
;
@ApiModelProperty
(
value
=
"早退天数"
,
example
=
"1"
)
private
Integer
leaveEarlyDay
;
@ApiModelProperty
(
value
=
"出差天数"
,
example
=
"1"
)
private
Float
outWorkDay
;
@ApiModelProperty
(
value
=
"请假天数"
,
example
=
"1"
)
private
Float
sickLeaveDay
;
@ApiModelProperty
(
value
=
"加班时长"
,
example
=
"1"
)
private
Integer
overWorkHours
;
@ApiModelProperty
(
value
=
"旷工天数"
,
example
=
"1"
)
private
Float
absenteeismDay
;
public
UserAttenVo
()
{
this
.
attendanceDay
=
0
;
this
.
realAttendanceDay
=
0
f
;
this
.
outSideBusinessDay
=
0
f
;
this
.
lateDay
=
0
;
this
.
leaveEarlyDay
=
0
;
this
.
outWorkDay
=
0
f
;
this
.
sickLeaveDay
=
0
f
;
this
.
overWorkHours
=
0
;
this
.
absenteeismDay
=
0
f
;
}
public
void
computerRealAttendanceDay
(){
realAttendanceDay
=
attendanceDay
-
outSideBusinessDay
-
outWorkDay
-
sickLeaveDay
-
absenteeismDay
;
}
}
notes-attendance/src/main/java/com/zjty/tynotes/attendance/service/AttendanceDetailsService.java
浏览文件 @
a159cbe4
...
...
@@ -2,6 +2,9 @@ package com.zjty.tynotes.attendance.service;
import
com.zjty.tynotes.attendance.entity.vo.UserAttenVo
;
import
com.zjty.tynotes.attendance.entity.vo.request.AttenRequest
;
import
com.zjty.tynotes.pas.entity.Department
;
import
java.util.List
;
/**
* @Author gwj
...
...
@@ -9,7 +12,24 @@ import com.zjty.tynotes.attendance.entity.vo.request.AttenRequest;
*/
public
interface
AttendanceDetailsService
{
/**
* 查询个人考勤
* @param id
* @return
*/
UserAttenVo
findPersonnel
(
AttenRequest
id
);
/**
* 查询部门考勤
* @param request
* @return
*/
Object
findDepartment
(
AttenRequest
request
);
/**
* 查询可查看的部门列表
* @param id
* @return
*/
List
<
Department
>
findDepartmentList
(
String
id
);
}
notes-attendance/src/main/java/com/zjty/tynotes/attendance/service/impl/ApprovalInformationServiceImpl.java
浏览文件 @
a159cbe4
...
...
@@ -54,8 +54,7 @@ public class ApprovalInformationServiceImpl implements ApprovalInformationServic
if
(
approvalInformation
.
getApprovalType
().
equals
(
"调休"
)){
String
userId
=
approvalInformation
.
getUserId
();
AttendanceDetails
attendanceDetails
=
attendanceDetailsDao
.
findByUserId
(
userId
);
UserOverWork
userOverWork
=
userOverWorkDao
.
findByUserId
(
approvalInformation
.
getUserId
());
UserOverWork
userOverWork
=
userOverWorkDao
.
findByUserId
(
userId
);
Long
workOverHours
=
userOverWork
.
getOverWorkHour
();
Date
leaveEndTime
=
approvalInformation
.
getLeaveEndTime
();
Date
leaveStartTime
=
approvalInformation
.
getLeaveStartTime
();
...
...
@@ -82,7 +81,7 @@ public class ApprovalInformationServiceImpl implements ApprovalInformationServic
}
}
approvalInformation
.
setStatus
(
"
待审批
"
);
approvalInformation
.
setStatus
(
"
0
"
);
return
approvalInformationDao
.
save
(
approvalInformation
);
}
...
...
@@ -105,6 +104,7 @@ public class ApprovalInformationServiceImpl implements ApprovalInformationServic
public
ApprovalInformation
auditApproval
(
String
userId
,
String
approvalStatus
,
ApprovalInformation
approvalInformation
)
{
String
departmentId
=
approvalInformation
.
getDepartmentId
();
String
departmentLevel
=
iUserService
.
getDepartmentLevel
(
departmentId
);
System
.
out
.
println
(
departmentLevel
);
if
((
"1"
).
equals
(
departmentLevel
)||(
"2"
).
equals
(
departmentLevel
)){
approvalInformation
.
setApprovalUserIdOne
(
userId
);
if
(
approvalInformation
.
getApprovalStatus
()!=
null
&&
approvalInformation
.
getApprovalStatus
().
equals
(
"0"
)){
...
...
notes-attendance/src/main/java/com/zjty/tynotes/attendance/service/impl/AttendanceDetailsServiceImpl.java
浏览文件 @
a159cbe4
差异被折叠。
点击展开。
notes-attendance/src/main/java/com/zjty/tynotes/attendance/task/CardTask.java
浏览文件 @
a159cbe4
差异被折叠。
点击展开。
notes-attendance/src/main/java/com/zjty/tynotes/attendance/task/MyInit.java
浏览文件 @
a159cbe4
...
...
@@ -42,6 +42,10 @@ public class MyInit implements CommandLineRunner {
private
String
departmentMenberUrl
;
@Value
(
"${ding.userDetailsUrl}"
)
private
String
userDetailsUrl
;
@Value
(
"${ding.appKey}"
)
private
String
appKey
;
@Value
(
"${ding.appSecret}"
)
private
String
appSecret
;
@Autowired
private
PasUserDao
pasUserDao
;
...
...
@@ -55,7 +59,7 @@ public class MyInit implements CommandLineRunner {
//从钉钉获取的所有人员的id
public
List
<
String
>
userIds
=
new
ArrayList
<>();
//根据
丁丁
的人员名单与本地的人员名单作对比后需要绑定的人员
//根据
钉钉
的人员名单与本地的人员名单作对比后需要绑定的人员
public
List
<
DingUser
>
dingUserList
=
new
ArrayList
<>();
@Override
...
...
@@ -78,8 +82,8 @@ public class MyInit implements CommandLineRunner {
public
void
getToken
(){
DefaultDingTalkClient
client
=
new
DefaultDingTalkClient
(
tokenUrl
);
OapiGettokenRequest
request
=
new
OapiGettokenRequest
();
request
.
setAppkey
(
"dingpzurwgv19x9uzpgd"
);
request
.
setAppsecret
(
"PgRC88Q8ML4S_tabbg5Oxne2fE43eemrHE4mFutcFcnPur4jbs3HshN-cpJAkF7-"
);
request
.
setAppkey
(
appKey
);
request
.
setAppsecret
(
appSecret
);
request
.
setHttpMethod
(
"GET"
);
try
{
OapiGettokenResponse
response
=
client
.
execute
(
request
);
...
...
notes-attendance/src/main/resources/application.yml
浏览文件 @
a159cbe4
...
...
@@ -10,5 +10,5 @@ ding:
# 获取打卡结果地址
userCardUrl
:
https://oapi.dingtalk.com/attendance/list
# 钉钉的appkey
appKey
:
ding
pzurwgv19x9uzpgd
appSecret
:
PgRC88Q8ML4S_tabbg5Oxne2fE43eemrHE4mFutcFcnPur4jbs3HshN-cpJAkF7-
appKey
:
ding
fule26yutybtr2yg
appSecret
:
2VpbeeoFMae3dn_eVK5KIBau4ZO0Mh_Z4B-1CwQo1Gs-vh-WtULjBQVqhX6CBF-a
notes-pas/src/main/java/com/zjty/tynotes/pas/config/SecurityConfig.java
浏览文件 @
a159cbe4
...
...
@@ -56,6 +56,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
httpSecurity
.
cors
().
and
()
.
authorizeRequests
()
.
antMatchers
(
"/ding/test/**"
).
permitAll
()
.
antMatchers
(
"/pas/user/judgeParent/**"
).
permitAll
()
.
antMatchers
(
"/pas/user/test"
).
permitAll
()
.
antMatchers
(
"/pas/user/addGuanLian"
).
permitAll
()
...
...
notes-pas/src/main/java/com/zjty/tynotes/pas/controller/TestController.java
浏览文件 @
a159cbe4
...
...
@@ -9,12 +9,12 @@ import com.zjty.tynotes.pas.entity.Authority;
import
com.zjty.tynotes.pas.entity.Day
;
import
com.zjty.tynotes.pas.entity.Role
;
import
com.zjty.tynotes.pas.entity.RoleAuthority
;
import
com.zjty.tynotes.pas.entity.vo.JobLeads
;
import
com.zjty.tynotes.pas.service.IUserService
;
import
com.zjty.tynotes.pas.service.impl.UserServiceImpl
;
import
io.swagger.annotations.Api
;
import
org.springframework.beans.factory.annotation.Autowired
;
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
org.springframework.web.bind.annotation.*
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
...
...
@@ -36,6 +36,8 @@ public class TestController {
private
RoleDao
roleDao
;
@Autowired
private
RoleAuthorityDao
roleAuthorityDao
;
@Autowired
private
UserServiceImpl
userService
;
// @GetMapping("/test")
// public void calculate() throws Exception{
...
...
@@ -80,4 +82,11 @@ public class TestController {
}
}
@GetMapping
(
"/test2/{id}"
)
public
JobLeads
addAuthority
(
@PathVariable
String
id
)
throws
Exception
{
JobLeads
jobLeads
=
userService
.
findJobLeads
(
id
);
return
jobLeads
;
}
}
notes-pas/src/main/java/com/zjty/tynotes/pas/dao/RoleDao.java
浏览文件 @
a159cbe4
...
...
@@ -15,6 +15,8 @@ public interface RoleDao extends MongoRepository<Role, String> {
List
<
Role
>
findAllByDepartmentIdAndIsLeader
(
String
departmentIds
,
String
isLeader
);
List
<
Role
>
findAllByDepartmentIdAndIsLeaderAndIsPlus
(
String
departmentIds
,
String
isLeader
,
String
plus
);
List
<
Role
>
findAllByDepartmentId
(
String
departmentId
);
Role
findAllByName
(
String
name
);
...
...
notes-pas/src/main/java/com/zjty/tynotes/pas/entity/Role.java
浏览文件 @
a159cbe4
...
...
@@ -42,6 +42,9 @@ public class Role {
@ApiModelProperty
(
value
=
"是否领导"
,
example
=
"1"
)
private
String
isLeader
;
//0代表是该部门领导,1代表为该部门普通员工
@ApiModelProperty
(
value
=
"正副经理0为正,1为副"
,
example
=
"1"
)
private
String
isPlus
;
//0代表是总经理,1代表为该副经理
@Transient
@ApiModelProperty
(
value
=
"权限列表"
)
List
<
Authority
>
authorities
;
...
...
notes-pas/src/main/java/com/zjty/tynotes/pas/entity/vo/JobLeads.java
0 → 100644
浏览文件 @
a159cbe4
package
com
.
zjty
.
tynotes
.
pas
.
entity
.
vo
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
java.util.List
;
/**
* @Author gwj
* @create 2020/4/7 10:25
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel
(
value
=
"领导"
,
description
=
"返回给任务模块的总监、总经理,副总经理集合"
)
public
class
JobLeads
{
@ApiModelProperty
(
value
=
"总监id集合"
,
example
=
"[1,2,3]"
)
private
List
<
String
>
majordomos
;
@ApiModelProperty
(
value
=
"总经理id集合"
,
example
=
"[1,2,3]"
)
private
List
<
String
>
generalManagers
;
@ApiModelProperty
(
value
=
"副经理id集合"
,
example
=
"[1,2,3]"
)
private
List
<
String
>
assistantManagers
;
}
notes-pas/src/main/java/com/zjty/tynotes/pas/service/IUserService.java
浏览文件 @
a159cbe4
...
...
@@ -2,6 +2,7 @@ package com.zjty.tynotes.pas.service;
import
com.zjty.tynotes.pas.entity.Department
;
import
com.zjty.tynotes.pas.entity.User
;
import
com.zjty.tynotes.pas.entity.vo.JobLeads
;
import
com.zjty.tynotes.pas.entity.vo.PageRequest
;
import
com.zjty.tynotes.pas.entity.vo.PageResponse
;
import
io.swagger.annotations.ApiModel
;
...
...
@@ -161,4 +162,12 @@ public interface IUserService {
* @return
*/
boolean
judgeParent
(
String
id
,
String
userId
);
/**
* 根据人员id返回总监,总经理、副经理id集合
* @param executorId
* @return
*/
JobLeads
findJobLeads
(
String
executorId
);
}
notes-pas/src/main/java/com/zjty/tynotes/pas/service/impl/UserServiceImpl.java
浏览文件 @
a159cbe4
...
...
@@ -2,6 +2,7 @@ package com.zjty.tynotes.pas.service.impl;
import
com.zjty.tynotes.pas.dao.*
;
import
com.zjty.tynotes.pas.entity.*
;
import
com.zjty.tynotes.pas.entity.vo.JobLeads
;
import
com.zjty.tynotes.pas.entity.vo.PageRequest
;
import
com.zjty.tynotes.pas.entity.vo.PageResponse
;
import
com.zjty.tynotes.pas.service.IDepartmentService
;
...
...
@@ -688,5 +689,86 @@ public class UserServiceImpl implements IUserService {
}
@Override
public
JobLeads
findJobLeads
(
String
executorId
){
JobLeads
jobLeads
=
new
JobLeads
();
List
<
String
>
majordomos
=
new
ArrayList
<>();
List
<
String
>
generalManagers
=
new
ArrayList
<>();
List
<
String
>
assistantManagers
=
new
ArrayList
<>();
Optional
<
User
>
optional
=
pasUserDao
.
findById
(
executorId
);
User
user
=
null
;
List
<
String
>
departs
=
new
ArrayList
<>();
if
(
optional
.
isPresent
()){
user
=
optional
.
get
();
List
<
String
>
departmentIds
=
user
.
getDepartmentIds
();
List
<
String
>
deIds
=
new
ArrayList
<>();
//自身或者上级部门
if
(
departmentIds
!=
null
){
departmentIds
.
forEach
(
departmentId
->
{
List
<
String
>
parentDepartIds
=
findParentDepartIds
(
departmentId
,
new
ArrayList
<>());
if
(
parentDepartIds
!=
null
){
parentDepartIds
.
forEach
(
str
->{
if
(!
deIds
.
contains
(
str
)){
deIds
.
add
(
str
);
}
});
}
});
List
<
Department
>
departments
=
departmentDao
.
findAllByIdIn
(
deIds
);
if
(
departments
!=
null
){
departments
.
forEach
(
department
->
{
if
(!
department
.
getLevel
().
equals
(
"1"
)&&!
department
.
getLevel
().
equals
(
"2"
)){
List
<
Role
>
roles
=
roleDao
.
findAllByDepartmentIdAndIsLeader
(
department
.
getId
(),
"0"
);
List
<
String
>
roleIds
=
new
ArrayList
<>();
if
(
roles
!=
null
){
roles
.
forEach
(
role
->
roleIds
.
add
(
role
.
getId
()));
}
List
<
UserRole
>
userRoles
=
userRoleDao
.
findAllByRoleIdIn
(
roleIds
);
if
(
userRoles
!=
null
){
for
(
UserRole
userRole
:
userRoles
)
{
if
(!
majordomos
.
contains
(
userRole
.
getUserId
())){
majordomos
.
add
(
userRole
.
getUserId
());
}
}
}
}
else
if
(
department
.
getLevel
().
equals
(
"1"
)||
department
.
getLevel
().
equals
(
"2"
)){
List
<
Role
>
roles2
=
roleDao
.
findAllByDepartmentIdAndIsLeaderAndIsPlus
(
department
.
getId
(),
"0"
,
"1"
);
List
<
Role
>
roles
=
roleDao
.
findAllByDepartmentIdAndIsLeaderAndIsPlus
(
department
.
getId
(),
"0"
,
"0"
);
List
<
String
>
roleIds
=
new
ArrayList
<>();
List
<
String
>
roleIds2
=
new
ArrayList
<>();
if
(
roles
!=
null
){
roles
.
forEach
(
role
->
roleIds
.
add
(
role
.
getId
()));
}
if
(
roles2
!=
null
){
roles2
.
forEach
(
role
->
roleIds2
.
add
(
role
.
getId
()));
}
List
<
UserRole
>
userRoles
=
userRoleDao
.
findAllByRoleIdIn
(
roleIds
);
List
<
UserRole
>
userRoles2
=
userRoleDao
.
findAllByRoleIdIn
(
roleIds2
);
if
(
userRoles
!=
null
){
for
(
UserRole
userRole
:
userRoles
)
{
if
(!
generalManagers
.
contains
(
userRole
.
getUserId
())){
generalManagers
.
add
(
userRole
.
getUserId
());
}
}
}
if
(
userRoles2
!=
null
){
for
(
UserRole
userRole
:
userRoles2
)
{
if
(!
assistantManagers
.
contains
(
userRole
.
getUserId
())){
assistantManagers
.
add
(
userRole
.
getUserId
());
}
}
}
}
});
}
}
}
jobLeads
.
setMajordomos
(
majordomos
);
jobLeads
.
setAssistantManagers
(
assistantManagers
);
jobLeads
.
setGeneralManagers
(
generalManagers
);
return
jobLeads
;
}
}
notes-pas/src/main/java/com/zjty/tynotes/pas/task/Init.java
浏览文件 @
a159cbe4
...
...
@@ -99,7 +99,7 @@ public class Init implements CommandLineRunner {
}
else
{
System
.
out
.
println
(
"77777777777777777"
);
this
.
root
=
new
User
();
Role
role
=
new
Role
(
null
,
"管理员"
,
"管理系统的人员"
,
null
,
null
,
null
);
Role
role
=
new
Role
(
null
,
"管理员"
,
"管理系统的人员"
,
null
,
null
,
null
,
null
);
List
<
Authority
>
authorities
=
new
ArrayList
<>();
Authority
authority2
=
new
Authority
(
null
,
"用户管理"
,
"无"
);
Authority
authority1
=
new
Authority
(
null
,
"权限管理"
,
"无"
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论