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
7bf295ec
Commit
7bf295ec
authored
Jul 26, 2023
by
赵啸非
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
5e1068eb
7f4ea0d1
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
876 additions
and
476 deletions
+876
-476
attendance-performance-manager-ui/admin/src/assets/utils/dateFormat.js
...rformance-manager-ui/admin/src/assets/utils/dateFormat.js
+110
-99
attendance-performance-manager-ui/admin/src/views/attendance/class/dialogshow.vue
...anager-ui/admin/src/views/attendance/class/dialogshow.vue
+378
-347
attendance-performance-manager/pom.xml
attendance-performance-manager/pom.xml
+6
-6
attendance-performance-manager/src/main/java/com/mortals/xhx/common/code/LeaveRulesEnum.java
...main/java/com/mortals/xhx/common/code/LeaveRulesEnum.java
+32
-0
attendance-performance-manager/src/main/java/com/mortals/xhx/module/attendance/dingmsg/api/DingMessageController.java
.../module/attendance/dingmsg/api/DingMessageController.java
+293
-10
attendance-performance-manager/src/main/java/com/mortals/xhx/module/dingding/AbstractDingTalkService.java
.../mortals/xhx/module/dingding/AbstractDingTalkService.java
+7
-1
attendance-performance-manager/src/main/java/com/mortals/xhx/module/dingding/personal/service/IDingPersonService.java
.../module/dingding/personal/service/IDingPersonService.java
+9
-0
attendance-performance-manager/src/main/java/com/mortals/xhx/module/dingding/personal/service/impl/DingPersonServiceImpl.java
...dingding/personal/service/impl/DingPersonServiceImpl.java
+40
-13
attendance-performance-manager/src/main/resources/bootstrap.yml
...ance-performance-manager/src/main/resources/bootstrap.yml
+1
-0
No files found.
attendance-performance-manager-ui/admin/src/assets/utils/dateFormat.js
View file @
7bf295ec
export
const
timestampToTime
=
(
timestamp
,
transLength
)
=>
{
export
const
timestampToTime
=
(
timestamp
,
transLength
)
=>
{
// 时间戳为10位需*1000,时间戳为13位不需乘1000
// 时间戳为10位需*1000,时间戳为13位不需乘1000
let
date
=
null
let
date
=
null
;
if
(
timestamp
.
length
<
13
)
{
if
(
timestamp
.
length
<
13
)
{
date
=
new
Date
(
timestamp
*
1000
);
date
=
new
Date
(
timestamp
*
1000
);
}
else
{
}
else
{
date
=
new
Date
(
timestamp
);
date
=
new
Date
(
timestamp
);
}
}
let
Y
=
date
.
getFullYear
()
+
"
-
"
;
let
Y
=
date
.
getFullYear
()
+
"
-
"
;
let
M
=
let
M
=
(
date
.
getMonth
()
+
1
<
10
(
date
.
getMonth
()
+
1
<
10
?
"
0
"
+
(
date
.
getMonth
()
+
1
)
?
"
0
"
+
(
date
.
getMonth
()
+
1
)
:
date
.
getMonth
()
+
1
)
+
"
-
"
;
:
date
.
getMonth
()
+
1
)
+
"
-
"
;
let
D
=
(
date
.
getDate
()
<
10
?
"
0
"
+
date
.
getDate
()
:
date
.
getDate
());
let
D
=
date
.
getDate
()
<
10
?
"
0
"
+
date
.
getDate
()
:
date
.
getDate
();
let
h
=
"
"
+
(
date
.
getHours
()
<
10
?
'
0
'
+
date
.
getHours
():
date
.
getHours
())
+
"
:
"
;
let
h
=
let
m
=
(
date
.
getMinutes
()
<
10
?
'
0
'
+
date
.
getMinutes
():
date
.
getMinutes
())
+
"
:
"
;
"
"
+
let
s
=
(
date
.
getSeconds
()
<
10
?
'
0
'
+
date
.
getSeconds
():
date
.
getSeconds
());
(
date
.
getHours
()
<
10
?
"
0
"
+
date
.
getHours
()
:
date
.
getHours
())
+
switch
(
transLength
){
"
:
"
;
let
m
=
(
date
.
getMinutes
()
<
10
?
"
0
"
+
date
.
getMinutes
()
:
date
.
getMinutes
())
+
"
:
"
;
let
s
=
date
.
getSeconds
()
<
10
?
"
0
"
+
date
.
getSeconds
()
:
date
.
getSeconds
();
switch
(
transLength
)
{
case
3
:
case
3
:
return
Y
+
M
+
D
;
return
Y
+
M
+
D
;
case
6
:
case
6
:
return
Y
+
M
+
D
+
h
+
m
+
s
;
return
Y
+
M
+
D
+
h
+
m
+
s
;
}
}
}
// 小时:分钟 ==》 转分钟
};
// 小时:分钟 ==》 转分钟
export
const
transFormMinut
=
(
String
)
=>
{
export
const
transFormMinut
=
(
String
)
=>
{
if
(
typeof
(
String
)
===
'
number
'
)
{
if
(
typeof
String
===
"
number
"
)
{
return
return
;
}
}
if
(
!
String
)
{
if
(
!
String
)
{
return
0
return
0
;
}
}
let
arr
=
String
.
split
(
'
:
'
)
let
arr
=
String
.
split
(
"
:
"
);
let
hour
=
arr
[
0
].
indexOf
(
'
0
'
)
===
0
?
arr
[
0
].
substring
(
1
,
arr
[
0
].
length
):
arr
[
0
]
let
hour
=
let
minu
=
arr
[
1
].
indexOf
(
'
0
'
)
===
0
?
arr
[
1
].
substring
(
1
,
arr
[
1
].
length
):
arr
[
1
]
arr
[
0
].
indexOf
(
"
0
"
)
===
0
?
arr
[
0
].
substring
(
1
,
arr
[
0
].
length
)
:
arr
[
0
];
return
hour
*
60
+
minu
*
1
let
minu
=
}
arr
[
1
].
indexOf
(
"
0
"
)
===
0
?
arr
[
1
].
substring
(
1
,
arr
[
1
].
length
)
:
arr
[
1
];
return
hour
*
60
+
minu
*
1
;
// return JSON.stringify(hour * 60 + minu * 1);
};
// // 分钟 ==》 小时
// // 分钟 ==》 小时
export
const
transFormTime
=
(
num
)
=>
{
export
const
transFormTime
=
(
num
)
=>
{
if
(
typeof
(
num
)
!=
'
string
'
&&
num
!==
0
)
{
if
(
typeof
num
!=
"
string
"
&&
num
!==
0
)
{
return
(
Math
.
floor
(
num
/
60
)).
toString
()
+
"
:
"
+
(
num
%
60
).
toString
()
return
Math
.
floor
(
num
/
60
).
toString
()
+
"
:
"
+
(
num
%
60
).
toString
();
}
}
else
{
else
{
return
"
0:00
"
;
return
"
0:00
"
;
}
}
}
}
;
//当前月第一天
//当前月第一天
export
const
getFirstDay
=
()
=>
{
export
const
getFirstDay
=
()
=>
{
let
y
=
new
Date
().
getFullYear
();
//获取年份
let
y
=
new
Date
().
getFullYear
();
//获取年份
let
m
=
new
Date
().
getMonth
()
+
1
;
//获取月份
let
m
=
new
Date
().
getMonth
()
+
1
;
//获取月份
let
d
=
'
01
'
;
let
d
=
"
01
"
;
m
=
m
<
10
?
'
0
'
+
m
:
m
;
//月份补 0
m
=
m
<
10
?
"
0
"
+
m
:
m
;
//月份补 0
return
[
y
,
m
,
d
].
join
(
"
-
"
)
return
[
y
,
m
,
d
].
join
(
"
-
"
);
}
}
;
//当前月最后一天
//当前月最后一天
export
const
getLastDay
=
()
=>
{
export
const
getLastDay
=
()
=>
{
let
y
=
new
Date
().
getFullYear
();
//获取年份
let
y
=
new
Date
().
getFullYear
();
//获取年份
let
m
=
new
Date
().
getMonth
()
+
1
;
//获取月份
let
m
=
new
Date
().
getMonth
()
+
1
;
//获取月份
let
d
=
new
Date
(
y
,
m
,
0
).
getDate
();
//获取当月最后一日
let
d
=
new
Date
(
y
,
m
,
0
).
getDate
();
//获取当月最后一日
m
=
m
<
10
?
'
0
'
+
m
:
m
;
//月份补 0
m
=
m
<
10
?
"
0
"
+
m
:
m
;
//月份补 0
d
=
d
<
10
?
'
0
'
+
d
:
d
;
//日数补 0
d
=
d
<
10
?
"
0
"
+
d
:
d
;
//日数补 0
return
[
y
,
m
,
d
].
join
(
"
-
"
)
return
[
y
,
m
,
d
].
join
(
"
-
"
);
}
}
;
//获取两日期之间日期列表函数
//获取两日期之间日期列表函数
export
const
getdiffdate
=
(
stime
,
etime
)
=>
{
export
const
getdiffdate
=
(
stime
,
etime
)
=>
{
//初始化日期列表,数组
//初始化日期列表,数组
let
diffdate
=
new
Array
();
let
diffdate
=
new
Array
();
let
i
=
0
;
let
i
=
0
;
//开始日期小于等于结束日期,并循环
//开始日期小于等于结束日期,并循环
while
(
stime
<=
etime
)
{
while
(
stime
<=
etime
)
{
diffdate
[
i
]
=
stime
;
diffdate
[
i
]
=
stime
;
//获取开始日期时间戳
//获取开始日期时间戳
let
stime_ts
=
new
Date
(
stime
).
getTime
();
let
stime_ts
=
new
Date
(
stime
).
getTime
();
//增加一天时间戳后的日期
//增加一天时间戳后的日期
let
next_date
=
stime_ts
+
(
24
*
60
*
60
*
1000
)
;
let
next_date
=
stime_ts
+
24
*
60
*
60
*
1000
;
//拼接年月日,这里的月份会返回(0-11),所以要+1
//拼接年月日,这里的月份会返回(0-11),所以要+1
let
next_dates_y
=
new
Date
(
next_date
).
getFullYear
()
+
'
-
'
;
let
next_dates_y
=
new
Date
(
next_date
).
getFullYear
()
+
"
-
"
;
let
next_dates_m
=
(
new
Date
(
next_date
).
getMonth
()
+
1
<
10
)?
'
0
'
+
(
new
Date
(
next_date
).
getMonth
()
+
1
)
+
'
-
'
:(
new
Date
(
next_date
).
getMonth
()
+
1
)
+
'
-
'
;
let
next_dates_m
=
let
next_dates_d
=
(
new
Date
(
next_date
).
getDate
()
<
10
)?
'
0
'
+
new
Date
(
next_date
).
getDate
():
new
Date
(
next_date
).
getDate
();
new
Date
(
next_date
).
getMonth
()
+
1
<
10
?
"
0
"
+
(
new
Date
(
next_date
).
getMonth
()
+
1
)
+
"
-
"
:
new
Date
(
next_date
).
getMonth
()
+
1
+
"
-
"
;
let
next_dates_d
=
new
Date
(
next_date
).
getDate
()
<
10
?
"
0
"
+
new
Date
(
next_date
).
getDate
()
:
new
Date
(
next_date
).
getDate
();
stime
=
next_dates_y
+
next_dates_m
+
next_dates_d
;
stime
=
next_dates_y
+
next_dates_m
+
next_dates_d
;
//增加数组key
//增加数组key
i
++
;
i
++
;
}
}
return
diffdate
;
return
diffdate
;
}
}
;
// 获取某个日期是周几
// 获取某个日期是周几
export
const
getMyDay
=
(
date
)
=>
{
export
const
getMyDay
=
(
date
)
=>
{
let
week
;
let
week
;
if
(
date
.
getDay
()
==
0
)
week
=
"
周日
"
if
(
date
.
getDay
()
==
0
)
week
=
"
周日
"
;
if
(
date
.
getDay
()
==
1
)
week
=
"
周一
"
if
(
date
.
getDay
()
==
1
)
week
=
"
周一
"
;
if
(
date
.
getDay
()
==
2
)
week
=
"
周二
"
if
(
date
.
getDay
()
==
2
)
week
=
"
周二
"
;
if
(
date
.
getDay
()
==
3
)
week
=
"
周三
"
if
(
date
.
getDay
()
==
3
)
week
=
"
周三
"
;
if
(
date
.
getDay
()
==
4
)
week
=
"
周四
"
if
(
date
.
getDay
()
==
4
)
week
=
"
周四
"
;
if
(
date
.
getDay
()
==
5
)
week
=
"
周五
"
if
(
date
.
getDay
()
==
5
)
week
=
"
周五
"
;
if
(
date
.
getDay
()
==
6
)
week
=
"
周六
"
if
(
date
.
getDay
()
==
6
)
week
=
"
周六
"
;
return
week
;
return
week
;
}
}
;
// 求两个日期的 分钟差
// 求两个日期的 分钟差
export
const
getMinu
=
(
s1
,
s2
)
=>
{
export
const
getMinu
=
(
s1
,
s2
)
=>
{
var
reDate
=
/
\d{4}
-
\d{1,2}
-
\d{1,2}
/
;
var
reDate
=
/
\d{4}
-
\d{1,2}
-
\d{1,2}
/
;
s1
=
new
Date
((
reDate
.
test
(
s1
)
?
s1
:
'
2023-01-01
'
+
s1
).
replace
(
/-/g
,
'
/
'
));
s1
=
new
Date
((
reDate
.
test
(
s1
)
?
s1
:
"
2023-01-01
"
+
s1
).
replace
(
/-/g
,
"
/
"
));
s2
=
new
Date
((
reDate
.
test
(
s2
)
?
s2
:
'
2023-01-01
'
+
s2
).
replace
(
/-/g
,
'
/
'
));
s2
=
new
Date
((
reDate
.
test
(
s2
)
?
s2
:
"
2023-01-01
"
+
s2
).
replace
(
/-/g
,
"
/
"
));
var
ms
=
s2
.
getTime
()
-
s1
.
getTime
();
var
ms
=
s2
.
getTime
()
-
s1
.
getTime
();
if
(
ms
<
0
)
return
0
;
if
(
ms
<
0
)
return
0
;
return
Math
.
floor
(
ms
/
1000
/
60
);
//分钟
return
Math
.
floor
(
ms
/
1000
/
60
);
//分钟
}
};
\ No newline at end of file
attendance-performance-manager-ui/admin/src/views/attendance/class/dialogshow.vue
View file @
7bf295ec
...
@@ -3,18 +3,39 @@
...
@@ -3,18 +3,39 @@
<el-drawer
:title=
"title"
:visible.sync=
"open"
size=
"55%"
>
<el-drawer
:title=
"title"
:visible.sync=
"open"
size=
"55%"
>
<el-form
ref=
"form"
:model=
"form"
:rules=
"rules"
label-width=
"120px"
>
<el-form
ref=
"form"
:model=
"form"
:rules=
"rules"
label-width=
"120px"
>
<el-row>
<el-row>
<Field
label=
"班次名称"
prop=
"className"
v-model=
"form.className"
placeholder=
"请输入班次名称"
:maxLength=
"20"
/>
<Field
<Field
label=
"班次负责人"
prop=
"classResponsiblePersonId"
type=
"select"
:enumData=
"dict.workManId"
label=
"班次名称"
v-model=
"form.classResponsiblePersonId"
placeholder=
"请选择班次负责人"
/>
prop=
"className"
v-model=
"form.className"
placeholder=
"请输入班次名称"
:maxLength=
"20"
/>
<Field
label=
"班次负责人"
prop=
"classResponsiblePersonId"
type=
"select"
:enumData=
"dict.workManId"
v-model=
"form.classResponsiblePersonId"
placeholder=
"请选择班次负责人"
/>
</el-row>
</el-row>
<el-form-item
label=
"上下班考勤时间"
prop=
"attendanceClassDetailList"
>
<el-form-item
label=
"上下班考勤时间"
prop=
"attendanceClassDetailList"
>
<el-button
type=
"text"
@
click=
"handleAddAttendanceClassDetail"
>
添加
</el-button>
<el-button
type=
"text"
@
click=
"handleAddAttendanceClassDetail"
<div
class=
"bancifor"
v-for=
"(item,index) in attendanceClassDetailList"
:key=
"index"
>
>
添加
</el-button
>
<div
class=
"bancifor"
v-for=
"(item, index) in attendanceClassDetailList"
:key=
"index"
>
<div
class=
"title flex flex-align-center flex-pack-justify"
>
<div
class=
"title flex flex-align-center flex-pack-justify"
>
<span>
<span>
第
{{
index
+
1
}}
次上班
</span>
第
{{
index
+
1
}}
次上班
<el-button
</span>
type=
"danger"
<el-button
type=
"danger"
size=
"mini"
@
click=
"handleDeleteAttendanceClassDetail(index)"
>
删除
</el-button>
size=
"mini"
@
click=
"handleDeleteAttendanceClassDetail(index)"
>
删除
</el-button
>
</div>
</div>
<div>
<div>
<span>
上班考勤时间
</span>
<span>
上班考勤时间
</span>
...
@@ -25,7 +46,8 @@
...
@@ -25,7 +46,8 @@
value-format=
"HH:mm"
value-format=
"HH:mm"
format=
"HH:mm"
format=
"HH:mm"
v-model=
"item.goWorkDate"
v-model=
"item.goWorkDate"
placeholder=
"上班考勤时间"
>
placeholder=
"上班考勤时间"
>
</el-time-picker>
</el-time-picker>
</div>
</div>
<div>
<div>
...
@@ -38,7 +60,8 @@
...
@@ -38,7 +60,8 @@
v-model=
"item.goWorkDateBefore"
v-model=
"item.goWorkDateBefore"
value-format=
"H:mm"
value-format=
"H:mm"
format=
"H小时mm分钟"
format=
"H小时mm分钟"
placeholder=
"未设置"
>
placeholder=
"未设置"
>
</el-time-picker>
</el-time-picker>
<span
class=
"ml20"
>
——
</span>
<span
class=
"ml20"
>
——
</span>
<span
class=
"ml20"
>
上班后签到
</span>
<span
class=
"ml20"
>
上班后签到
</span>
...
@@ -49,7 +72,8 @@
...
@@ -49,7 +72,8 @@
v-model=
"item.goWorkDateAfter"
v-model=
"item.goWorkDateAfter"
value-format=
"HH:mm"
value-format=
"HH:mm"
format=
"H小时mm分钟"
format=
"H小时mm分钟"
placeholder=
"未设置"
>
placeholder=
"未设置"
>
</el-time-picker>
</el-time-picker>
</div>
</div>
<div>
<div>
...
@@ -61,7 +85,8 @@
...
@@ -61,7 +85,8 @@
format=
"HH:mm"
format=
"HH:mm"
value-format=
"HH:mm"
value-format=
"HH:mm"
v-model=
"item.offWorkDate"
v-model=
"item.offWorkDate"
placeholder=
"下班考勤时间"
>
placeholder=
"下班考勤时间"
>
</el-time-picker>
</el-time-picker>
</div>
</div>
<div>
<div>
...
@@ -74,7 +99,8 @@
...
@@ -74,7 +99,8 @@
v-model=
"item.offWorkDateBefore"
v-model=
"item.offWorkDateBefore"
value-format=
"H:mm"
value-format=
"H:mm"
format=
"H小时mm分钟"
format=
"H小时mm分钟"
placeholder=
"未设置"
>
placeholder=
"未设置"
>
</el-time-picker>
</el-time-picker>
<span
class=
"ml20"
>
——
</span>
<span
class=
"ml20"
>
——
</span>
<span
class=
"ml20"
>
下班后签退
</span>
<span
class=
"ml20"
>
下班后签退
</span>
...
@@ -85,7 +111,8 @@
...
@@ -85,7 +111,8 @@
v-model=
"item.offWorkDateAfter"
v-model=
"item.offWorkDateAfter"
value-format=
"H:mm"
value-format=
"H:mm"
format=
"H小时mm分钟"
format=
"H小时mm分钟"
placeholder=
"未设置"
>
placeholder=
"未设置"
>
</el-time-picker>
</el-time-picker>
</div>
</div>
</div>
</div>
...
@@ -93,19 +120,25 @@
...
@@ -93,19 +120,25 @@
</el-form>
</el-form>
<div
class=
"dialog-footer ml20"
>
<div
class=
"dialog-footer ml20"
>
<!-- submitForm -->
<!-- submitForm -->
<el-button
type=
"primary"
size=
"mini"
v-if=
"pageInfo.type !== 'view'"
@
click=
"formatData"
>
确 定
</el-button>
<el-button
type=
"primary"
size=
"mini"
v-if=
"pageInfo.type !== 'view'"
@
click=
"formatData"
>
确 定
</el-button
>
<el-button
@
click=
"cancel"
size=
"mini"
>
取 消
</el-button>
<el-button
@
click=
"cancel"
size=
"mini"
>
取 消
</el-button>
</div>
</div>
</el-drawer>
</el-drawer>
</
template
>
</
template
>
<
script
>
<
script
>
import
form
from
"
@/assets/mixins/formdialog
"
;
import
form
from
"
@/assets/mixins/formdialog
"
;
import
dialogShow
from
"
./dialogshow
"
;
import
dialogShow
from
"
./dialogshow
"
;
import
{
transFormMinut
,
transFormTime
}
from
'
@/assets/utils/dateFormat.js
'
import
{
transFormMinut
,
transFormTime
}
from
"
@/assets/utils/dateFormat.js
"
;
export
default
{
export
default
{
mixins
:
[
form
],
mixins
:
[
form
],
components
:
{
components
:
{
dialogShow
,
dialogShow
,
},
},
data
()
{
data
()
{
return
{
return
{
...
@@ -119,58 +152,52 @@
...
@@ -119,58 +152,52 @@
title
:
"
考勤班次信息
"
,
title
:
"
考勤班次信息
"
,
// 是否显示弹出层
// 是否显示弹出层
open
:
false
,
open
:
false
,
toString
:[
toString
:
[],
],
// 表单校验
// 表单校验
rules
:
{
rules
:
{
className
:
[
className
:
[{
required
:
true
,
message
:
"
请输入班次名称
"
}],
{
required
:
true
,
message
:
"
请输入班次名称
"
},
classResponsiblePersonId
:
[
{
required
:
true
,
message
:
"
请选择班次负责人
"
},
],
],
classResponsiblePersonId
:[
attendanceClassDetailList
:
[{
required
:
true
,
message
:
"
请添加
"
}],
{
required
:
true
,
message
:
"
请选择班次负责人
"
},
],
attendanceClassDetailList
:[
{
required
:
true
,
message
:
"
请添加
"
}
]
},
},
currentIndex
:
0
//当前索引值
currentIndex
:
0
,
//当前索引值
}
};
},
created
(){
},
},
created
()
{},
methods
:
{
methods
:
{
formatData
()
{
formatData
()
{
let
value
=
true
let
value
=
true
;
if
(
this
.
attendanceClassDetailList
.
length
<
1
){
if
(
this
.
attendanceClassDetailList
.
length
<
1
)
{
this
.
$message
.
error
(
'
请完整打卡时间填写
'
)
this
.
$message
.
error
(
"
请完整打卡时间填写
"
);
value
=
false
value
=
false
;
return
return
;
}
else
{
}
else
{
console
.
log
(
this
.
attendanceClassDetailList
.
length
,
'
执行了
'
)
console
.
log
(
this
.
attendanceClassDetailList
.
length
,
"
执行了
"
);
this
.
attendanceClassDetailList
.
forEach
((
item
,
index
)
=>
{
this
.
attendanceClassDetailList
.
forEach
((
item
,
index
)
=>
{
let
valueres
=
this
.
judgeStatus
(
this
.
attendanceClassDetailList
,
index
)
let
valueres
=
this
.
judgeStatus
(
if
(
!
valueres
){
this
.
attendanceClassDetailList
,
value
=
false
index
return
);
if
(
!
valueres
)
{
value
=
false
;
return
;
}
}
})
});
}
}
if
(
value
){
if
(
value
)
{
console
.
log
(
'
测试
'
)
this
.
attendanceClassDetailList
.
forEach
((
item
)
=>
{
this
.
attendanceClassDetailList
.
forEach
(
item
=>
{
item
.
goWorkDateBefore
=
transFormMinut
(
item
.
goWorkDateBefore
);
item
.
goWorkDateBefore
=
transFormMinut
(
item
.
goWorkDateBefore
)
item
.
goWorkDateAfter
=
transFormMinut
(
item
.
goWorkDateAfter
);
item
.
goWorkDateAfter
=
transFormMinut
(
item
.
goWorkDateAfter
)
item
.
offWorkDateBefore
=
transFormMinut
(
item
.
offWorkDateBefore
);
item
.
offWorkDateBefore
=
transFormMinut
(
item
.
offWorkDateBefore
)
item
.
offWorkDateAfter
=
transFormMinut
(
item
.
offWorkDateAfter
);
item
.
offWorkDateAfter
=
transFormMinut
(
item
.
offWorkDateAfter
)
});
})
this
.
submitForm
();
this
.
submitForm
()
}
else
{
}
else
{
this
.
$message
.
error
(
"
打卡时间填写有误
"
);
this
.
$message
.
error
(
'
打卡时间填写有误
'
)
}
}
},
},
/** 考勤班次详细信息序号 */
/** 考勤班次详细信息序号 */
rowAttendanceClassDetailIndex
({
row
,
rowIndex
})
{
rowAttendanceClassDetailIndex
({
row
,
rowIndex
})
{
...
@@ -187,83 +214,88 @@
...
@@ -187,83 +214,88 @@
obj
.
offWorkDateAfter
=
""
;
obj
.
offWorkDateAfter
=
""
;
obj
.
remark
=
""
;
obj
.
remark
=
""
;
this
.
attendanceClassDetailList
.
push
(
obj
);
this
.
attendanceClassDetailList
.
push
(
obj
);
},
},
// 判断添加上下班考勤时间
// 判断添加上下班考勤时间
judgeStatus
(
arr
,
index
)
{
judgeStatus
(
arr
,
index
)
{
console
.
log
(
arr
,
index
,
'
ces
'
)
console
.
log
(
arr
,
index
,
"
ces
"
);
let
status
=
true
let
status
=
true
;
if
(
arr
.
length
==
0
){
if
(
arr
.
length
==
0
)
{
}
else
{
}
else
{
if
(
arr
[
index
].
goWorkDate
===
''
)
{
if
(
arr
[
index
].
goWorkDate
===
""
)
{
this
.
$message
.
error
(
'
请选择上班考勤时间
'
)
this
.
$message
.
error
(
"
请选择上班考勤时间
"
);
status
=
false
status
=
false
;
return
return
;
}
}
if
(
arr
[
index
].
goWorkDateBefore
===
''
)
{
if
(
arr
[
index
].
goWorkDateBefore
===
""
)
{
this
.
$message
.
error
(
'
请选择允许上班前签到打卡时间
'
)
this
.
$message
.
error
(
"
请选择允许上班前签到打卡时间
"
);
status
=
false
status
=
false
;
return
return
;
}
}
if
(
arr
[
index
].
goWorkDateAfter
===
''
)
{
if
(
arr
[
index
].
goWorkDateAfter
===
""
)
{
this
.
$message
.
error
(
'
请选择允许上班后签到打卡时间
'
)
this
.
$message
.
error
(
"
请选择允许上班后签到打卡时间
"
);
status
=
false
status
=
false
;
return
return
;
}
}
if
(
arr
[
index
].
offWorkDate
===
''
)
{
if
(
arr
[
index
].
offWorkDate
===
""
)
{
this
.
$message
.
error
(
'
请选择下班考勤时间
'
)
this
.
$message
.
error
(
"
请选择下班考勤时间
"
);
status
=
false
status
=
false
;
return
return
;
}
}
if
(
arr
[
index
].
offWorkDateBefore
===
''
)
{
if
(
arr
[
index
].
offWorkDateBefore
===
""
)
{
this
.
$message
.
error
(
'
请选择允许下班前签退打卡时间
'
)
this
.
$message
.
error
(
"
请选择允许下班前签退打卡时间
"
);
status
=
false
status
=
false
;
return
return
;
}
}
if
(
arr
[
index
].
offWorkDateAfter
===
''
)
{
if
(
arr
[
index
].
offWorkDateAfter
===
""
)
{
this
.
$message
.
error
(
'
请选择允许下班后签退打卡时间
'
)
this
.
$message
.
error
(
"
请选择允许下班后签退打卡时间
"
);
status
=
false
status
=
false
;
return
return
;
}
}
//当前比较下班和上班
//当前比较下班和上班
let
workTime
=
transFormMinut
(
arr
[
index
].
goWorkDate
)
+
let
workTime
=
transFormMinut
(
arr
[
index
].
goWorkDateAfter
)
transFormMinut
(
arr
[
index
].
goWorkDate
)
+
transFormMinut
(
arr
[
index
].
goWorkDateAfter
);
let
offworkTime
=
transFormMinut
(
arr
[
index
].
offWorkDate
)
-
let
offworkTime
=
transFormMinut
(
arr
[
index
].
offWorkDateBefore
)
transFormMinut
(
arr
[
index
].
offWorkDate
)
-
transFormMinut
(
arr
[
index
].
offWorkDateBefore
);
if
(
offworkTime
<=
workTime
)
{
if
(
offworkTime
<=
workTime
)
{
this
.
$message
.
error
(
'
下班打卡时间不能小于上班打卡时间
'
)
this
.
$message
.
error
(
"
下班打卡时间不能小于上班打卡时间
"
);
status
=
false
status
=
false
;
return
return
;
}
}
if
(
arr
.
length
>
1
&&
index
>
0
)
{
if
(
arr
.
length
>
1
&&
index
>
0
)
{
// 上一次比较
// 上一次比较
let
lastoffTime
=
transFormMinut
(
arr
[
index
-
1
].
offWorkDate
)
+
let
lastoffTime
=
transFormMinut
(
arr
[
index
-
1
].
offWorkDateAfter
)
transFormMinut
(
arr
[
index
-
1
].
offWorkDate
)
+
transFormMinut
(
arr
[
index
-
1
].
offWorkDateAfter
);
let
currentwokeTime
=
transFormMinut
(
arr
[
index
].
goWorkDate
)
-
let
currentwokeTime
=
transFormMinut
(
arr
[
index
].
goWorkDateBefore
)
transFormMinut
(
arr
[
index
].
goWorkDate
)
-
transFormMinut
(
arr
[
index
].
goWorkDateBefore
);
if
(
currentwokeTime
<=
lastoffTime
){
if
(
currentwokeTime
<=
lastoffTime
)
{
this
.
$message
.
error
(
`第
${
index
}
上班考勤时间需大于第
${
index
-
1
}
上班考勤时间`
)
this
.
$message
.
error
(
status
=
false
`第
${
index
}
上班考勤时间需大于第
${
index
-
1
}
上班考勤时间`
return
);
status
=
false
;
return
;
}
}
}
}
}
}
return
status
return
status
;
},
},
/** 考勤班次详细信息删除按钮操作 */
/** 考勤班次详细信息删除按钮操作 */
handleDeleteAttendanceClassDetail
(
index
)
{
handleDeleteAttendanceClassDetail
(
index
)
{
this
.
$alert
(
'
确定要删除这条设置吗
'
,
'
删除提醒
'
,
{
this
.
$alert
(
"
确定要删除这条设置吗
"
,
"
删除提醒
"
,
{
confirmButtonText
:
'
确定
'
,
confirmButtonText
:
"
确定
"
,
callback
:
action
=>
{
callback
:
(
action
)
=>
{
this
.
attendanceClassDetailList
.
splice
(
index
,
1
)
this
.
attendanceClassDetailList
.
splice
(
index
,
1
);
this
.
currentIndex
--
this
.
currentIndex
--
;
}
},
})
});
},
},
/** 单选框选中数据 */
/** 单选框选中数据 */
handleAttendanceClassDetailSelectionChange
(
selection
)
{
handleAttendanceClassDetailSelectionChange
(
selection
)
{
...
@@ -276,36 +308,35 @@
...
@@ -276,36 +308,35 @@
},
},
// 渲染前置处理
// 渲染前置处理
beforeRender
(
data
)
{
beforeRender
(
data
)
{
if
(
data
.
entity
.
attendanceClassDetailList
)
{
if
(
data
.
entity
.
attendanceClassDetailList
)
{
this
.
attendanceClassDetailList
=
data
.
entity
.
attendanceClassDetailList
;
this
.
attendanceClassDetailList
=
data
.
entity
.
attendanceClassDetailList
;
}
}
return
data
return
data
;
},
},
/** 编辑 */
/** 编辑 */
edit
(
row
)
{
edit
(
row
)
{
this
.
reset
()
this
.
reset
();
this
.
query
=
{
id
:
row
.
id
};
this
.
query
=
{
id
:
row
.
id
};
this
.
urls
.
currUrl
=
"
attendance/class/edit
"
;
this
.
urls
.
currUrl
=
"
attendance/class/edit
"
;
this
.
getData
();
this
.
getData
();
this
.
pageInfo
.
type
=
"
edit
"
this
.
pageInfo
.
type
=
"
edit
"
;
this
.
title
=
"
修改考勤班次信息
"
;
this
.
title
=
"
修改考勤班次信息
"
;
},
},
/** 新增 */
/** 新增 */
add
(
row
)
{
add
(
row
)
{
this
.
reset
()
this
.
reset
();
this
.
urls
.
currUrl
=
"
attendance/class/add
"
;
this
.
urls
.
currUrl
=
"
attendance/class/add
"
;
this
.
getData
();
this
.
getData
();
this
.
pageInfo
.
type
=
"
add
"
this
.
pageInfo
.
type
=
"
add
"
;
this
.
title
=
"
新增考勤班次信息
"
;
this
.
title
=
"
新增考勤班次信息
"
;
},
},
/** 查看*/
/** 查看*/
view
(
row
)
{
view
(
row
)
{
this
.
reset
()
this
.
reset
();
this
.
query
=
{
id
:
row
.
id
};
this
.
query
=
{
id
:
row
.
id
};
this
.
urls
.
currUrl
=
"
attendance/class/view
"
;
this
.
urls
.
currUrl
=
"
attendance/class/view
"
;
this
.
getData
();
this
.
getData
();
this
.
pageInfo
.
type
=
"
view
"
this
.
pageInfo
.
type
=
"
view
"
;
this
.
title
=
"
考勤班次信息详细
"
;
this
.
title
=
"
考勤班次信息详细
"
;
},
},
/**取消按钮 */
/**取消按钮 */
...
@@ -314,16 +345,16 @@
...
@@ -314,16 +345,16 @@
},
},
/**获取数据后弹框 */
/**获取数据后弹框 */
afterRender
(
data
)
{
afterRender
(
data
)
{
if
(
this
.
attendanceClassDetailList
.
length
>
0
)
{
if
(
this
.
attendanceClassDetailList
.
length
>
0
)
{
this
.
attendanceClassDetailList
.
forEach
(
item
=>
{
this
.
attendanceClassDetailList
.
forEach
((
item
)
=>
{
item
.
goWorkDateBefore
=
transFormTime
(
item
.
goWorkDateBefore
)
item
.
goWorkDateBefore
=
transFormTime
(
item
.
goWorkDateBefore
);
item
.
goWorkDateAfter
=
transFormTime
(
item
.
goWorkDateAfter
)
item
.
goWorkDateAfter
=
transFormTime
(
item
.
goWorkDateAfter
);
item
.
offWorkDateBefore
=
transFormTime
(
item
.
offWorkDateBefore
)
item
.
offWorkDateBefore
=
transFormTime
(
item
.
offWorkDateBefore
);
item
.
offWorkDateAfter
=
transFormTime
(
item
.
offWorkDateAfter
)
item
.
offWorkDateAfter
=
transFormTime
(
item
.
offWorkDateAfter
);
})
});
this
.
currentIndex
=
this
.
attendanceClassDetailList
.
length
-
1
this
.
currentIndex
=
this
.
attendanceClassDetailList
.
length
-
1
;
this
.
form
.
classResponsiblePersonId
=
this
.
form
.
classResponsiblePersonId
.
toString
()
this
.
form
.
classResponsiblePersonId
=
this
.
form
.
classResponsiblePersonId
.
toString
();
console
.
log
(
this
.
currentIndex
,
'
执行了
'
)
console
.
log
(
this
.
currentIndex
,
"
执行了
"
);
}
}
this
.
open
=
true
;
this
.
open
=
true
;
},
},
...
@@ -336,10 +367,10 @@
...
@@ -336,10 +367,10 @@
// 表单重置
// 表单重置
reset
()
{
reset
()
{
this
.
form
=
{
this
.
form
=
{
className
:
""
,
className
:
""
,
classResponsiblePersonId
:
null
,
classResponsiblePersonId
:
null
,
classResponsiblePersonName
:
""
,
classResponsiblePersonName
:
""
,
remark
:
""
,
remark
:
""
,
};
};
this
.
resetForm
(
"
form
"
);
this
.
resetForm
(
"
form
"
);
},
},
...
@@ -349,14 +380,14 @@
...
@@ -349,14 +380,14 @@
}
}
},
},
},
},
};
};
</
script
>
</
script
>
<
style
scoped
lang=
"less"
>
<
style
scoped
lang=
"less"
>
.bancifor{
.bancifor
{
background-color: #f5f5f5;
background-color: #f5f5f5;
padding: 10px;
padding: 10px;
margin-bottom: 15px;
margin-bottom: 15px;
.title
{
.title
{
border-bottom: 1px solid rgb(206, 206, 206);
border-bottom: 1px solid rgb(206, 206, 206);
}
}
}
}
...
...
attendance-performance-manager/pom.xml
View file @
7bf295ec
...
@@ -37,12 +37,10 @@
...
@@ -37,12 +37,10 @@
<profiles.hik.appSecret>
2m9RcPJOKq5j2QPQM4v5
</profiles.hik.appSecret>
<profiles.hik.appSecret>
2m9RcPJOKq5j2QPQM4v5
</profiles.hik.appSecret>
<profiles.dingtalk.domain>
https://oapi.dingtalk.com
</profiles.dingtalk.domain>
<profiles.dingtalk.domain>
https://oapi.dingtalk.com
</profiles.dingtalk.domain>
<profiles.dingtalk.oaUrl>
api.dingtalk.com
</profiles.dingtalk.oaUrl>
<profiles.dingtalk.agentId>
2625340030
</profiles.dingtalk.agentId>
<profiles.dingtalk.agentId>
2652674890
</profiles.dingtalk.agentId>
<profiles.dingtalk.appKey>
dingjcqjqjh1j82ho5zx
</profiles.dingtalk.appKey>
<profiles.dingtalk.appKey>
dingpqzradgfr4efdi2j
</profiles.dingtalk.appKey>
<profiles.dingtalk.appSecret>
_wNw2J6sxTYcu3ddNkFlG3U-3UlQ-P_7ufLSJ4wRxgdUflm3lPf8LIODCQOGkydy
</profiles.dingtalk.appSecret>
<profiles.dingtalk.appSecret>
bF2WALmo5_Wuj3hg5gXeWqezrYnZChUJ88HjzNWpkA9ivdOxfBDGOGYcfVRfB3vd
</profiles.dingtalk.appSecret>
<profiles.dingtalk.opUserId>
manager8325
</profiles.dingtalk.opUserId>
<profiles.dingtalk.aesKey>
1QcPYuSpAc98OS3qQwwx5HPH85CZDidxF95yBGad2fJ
</profiles.dingtalk.aesKey>
<profiles.dingtalk.token>
m3WeuVx5kcTY76kh22uWZOTSu0XjvcwNhd
</profiles.dingtalk.token>
<profiles.webUrl>
http://8.136.255.30:11039/attendance
</profiles.webUrl>
<profiles.webUrl>
http://8.136.255.30:11039/attendance
</profiles.webUrl>
<package.environment>
serve
</package.environment>
<package.environment>
serve
</package.environment>
<skipUi>
false
</skipUi>
<skipUi>
false
</skipUi>
...
@@ -77,6 +75,7 @@
...
@@ -77,6 +75,7 @@
<profiles.dingtalk.appSecret>
bF2WALmo5_Wuj3hg5gXeWqezrYnZChUJ88HjzNWpkA9ivdOxfBDGOGYcfVRfB3vd
</profiles.dingtalk.appSecret>
<profiles.dingtalk.appSecret>
bF2WALmo5_Wuj3hg5gXeWqezrYnZChUJ88HjzNWpkA9ivdOxfBDGOGYcfVRfB3vd
</profiles.dingtalk.appSecret>
<profiles.dingtalk.aesKey>
1QcPYuSpAc98OS3qQwwx5HPH85CZDidxF95yBGad2fJ
</profiles.dingtalk.aesKey>
<profiles.dingtalk.aesKey>
1QcPYuSpAc98OS3qQwwx5HPH85CZDidxF95yBGad2fJ
</profiles.dingtalk.aesKey>
<profiles.dingtalk.token>
m3WeuVx5kcTY76kh22uWZOTSu0XjvcwNhd
</profiles.dingtalk.token>
<profiles.dingtalk.token>
m3WeuVx5kcTY76kh22uWZOTSu0XjvcwNhd
</profiles.dingtalk.token>
<profiles.dingtalk.opUserId>
manager8325
</profiles.dingtalk.opUserId>
<profiles.webUrl>
http://8.136.255.30:11039/attendance
</profiles.webUrl>
<profiles.webUrl>
http://8.136.255.30:11039/attendance
</profiles.webUrl>
<package.environment>
test
</package.environment>
<package.environment>
test
</package.environment>
<skipUi>
false
</skipUi>
<skipUi>
false
</skipUi>
...
@@ -108,6 +107,7 @@
...
@@ -108,6 +107,7 @@
<profiles.dingtalk.appSecret>
bF2WALmo5_Wuj3hg5gXeWqezrYnZChUJ88HjzNWpkA9ivdOxfBDGOGYcfVRfB3vd
</profiles.dingtalk.appSecret>
<profiles.dingtalk.appSecret>
bF2WALmo5_Wuj3hg5gXeWqezrYnZChUJ88HjzNWpkA9ivdOxfBDGOGYcfVRfB3vd
</profiles.dingtalk.appSecret>
<profiles.dingtalk.aesKey>
1QcPYuSpAc98OS3qQwwx5HPH85CZDidxF95yBGad2fJ
</profiles.dingtalk.aesKey>
<profiles.dingtalk.aesKey>
1QcPYuSpAc98OS3qQwwx5HPH85CZDidxF95yBGad2fJ
</profiles.dingtalk.aesKey>
<profiles.dingtalk.token>
m3WeuVx5kcTY76kh22uWZOTSu0XjvcwNhd
</profiles.dingtalk.token>
<profiles.dingtalk.token>
m3WeuVx5kcTY76kh22uWZOTSu0XjvcwNhd
</profiles.dingtalk.token>
<profiles.dingtalk.opUserId>
manager8325
</profiles.dingtalk.opUserId>
<profiles.webUrl>
https://ybswxxcx.zwfwhfgjjfzj.yibin.gov.cn/performance-h5
</profiles.webUrl>
<profiles.webUrl>
https://ybswxxcx.zwfwhfgjjfzj.yibin.gov.cn/performance-h5
</profiles.webUrl>
<package.environment>
build
</package.environment>
<package.environment>
build
</package.environment>
<skipUi>
false
</skipUi>
<skipUi>
false
</skipUi>
...
...
attendance-performance-manager/src/main/java/com/mortals/xhx/common/code/LeaveRulesEnum.java
0 → 100644
View file @
7bf295ec
package
com.mortals.xhx.common.code
;
public
enum
LeaveRulesEnum
{
事假
(
"71f9fcc4-6fb3-45da-9be7-ef0d7d72a3c2"
,
"hour"
),
调休
(
"47f2fb3b-571a-4dcd-9ed7-17c0a58dbd08"
,
"hour"
),
病假
(
"cc344abc-d228-423f-94ef-b71c60341d02"
,
"hour"
),
年假
(
"c0f1f8af-4fb4-404d-a306-edd0c7df8375"
,
"halfDay"
),
产假
(
"195cd54f-6e1e-4aa9-be93-20fd997db9b2"
,
"day"
),
陪产假
(
"8b32bb86-09a0-46bf-ab83-3638f4d03173"
,
"day"
),
婚假
(
"f1981cae-e595-41bc-a9ae-f0206ddc98fb"
,
"day"
),
例假
(
"ef04cb2e-6883-4d78-a104-c380fbed8ecb"
,
"halfday"
),
丧假
(
"937b8a4c-64b0-4c82-8cfc-a9bda2935e2c"
,
"day"
),
哺乳假
(
"d512ffd1-6958-4387-aaee-98d78de6f9cd"
,
"hour"
),
探亲假
(
"37529169-eabe-4b0f-97f3-2a8dd30538e0"
,
"day"
);
private
String
leave_code
;
//假期标识
private
String
leave_view_unit
;
//假期时间分类 day:天,halfDay:半天,hour:小时
LeaveRulesEnum
(
String
leave_code
,
String
leave_view_unit
)
{
this
.
leave_code
=
leave_code
;
this
.
leave_view_unit
=
leave_view_unit
;
}
public
String
getLeave_code
()
{
return
leave_code
;
}
public
String
getLeave_view_unit
()
{
return
leave_view_unit
;
}
}
attendance-performance-manager/src/main/java/com/mortals/xhx/module/attendance/dingmsg/api/DingMessageController.java
View file @
7bf295ec
...
@@ -4,21 +4,27 @@ import cn.hutool.core.date.DateUtil;
...
@@ -4,21 +4,27 @@ import cn.hutool.core.date.DateUtil;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.aliyun.dingtalkattendance_1_0.models.GetLeaveRecordsResponseBody
;
import
com.aliyun.dingtalkworkflow_1_0.models.GetProcessInstanceResponseBody
;
import
com.aliyun.dingtalkworkflow_1_0.models.GetProcessInstanceResponseBody
;
import
com.dingtalk.api.DefaultDingTalkClient
;
import
com.dingtalk.api.DefaultDingTalkClient
;
import
com.dingtalk.api.DingTalkClient
;
import
com.dingtalk.api.DingTalkClient
;
import
com.dingtalk.api.request.OapiGettokenRequest
;
import
com.dingtalk.api.request.OapiGettokenRequest
;
import
com.dingtalk.api.response.OapiAttendanceVacationQuotaListResponse
;
import
com.dingtalk.api.response.OapiGettokenResponse
;
import
com.dingtalk.api.response.OapiGettokenResponse
;
import
com.mortals.framework.annotation.UnAuth
;
import
com.mortals.framework.annotation.UnAuth
;
import
com.mortals.framework.common.Rest
;
import
com.mortals.framework.common.Rest
;
import
com.mortals.framework.exception.AppException
;
import
com.mortals.framework.exception.AppException
;
import
com.mortals.xhx.common.code.LeaveRulesEnum
;
import
com.mortals.xhx.common.pdu.ApiRespPdu
;
import
com.mortals.xhx.common.pdu.ApiRespPdu
;
import
com.mortals.xhx.module.attendance.dingmsg.DingCallbackCrypto
;
import
com.mortals.xhx.module.attendance.dingmsg.DingCallbackCrypto
;
import
com.mortals.xhx.module.attendance.dingmsg.dingmsgreq.DingResponsMeassageReq
;
import
com.mortals.xhx.module.attendance.dingmsg.dingmsgreq.DingResponsMeassageReq
;
import
com.mortals.xhx.module.attendance.dingmsg.dingmsgreq.EncryptReq
;
import
com.mortals.xhx.module.attendance.dingmsg.dingmsgreq.EncryptReq
;
import
com.mortals.xhx.module.attendance.model.AttendanceLeaveRecordEntity
;
import
com.mortals.xhx.module.attendance.model.AttendanceLeaveRecordEntity
;
import
com.mortals.xhx.module.attendance.model.AttendanceLeaveRecordQuery
;
import
com.mortals.xhx.module.attendance.model.AttendanceLeaveRecordQuery
;
import
com.mortals.xhx.module.attendance.model.AttendanceVacationBalanceEntity
;
import
com.mortals.xhx.module.attendance.model.AttendanceVacationBalanceQuery
;
import
com.mortals.xhx.module.attendance.service.AttendanceLeaveRecordService
;
import
com.mortals.xhx.module.attendance.service.AttendanceLeaveRecordService
;
import
com.mortals.xhx.module.attendance.service.AttendanceVacationBalanceService
;
import
com.mortals.xhx.module.dingding.personal.service.IDingPersonService
;
import
com.mortals.xhx.module.dingding.personal.service.IDingPersonService
;
import
com.mortals.xhx.module.staff.model.StaffEntity
;
import
com.mortals.xhx.module.staff.model.StaffEntity
;
import
com.mortals.xhx.module.staff.model.StaffQuery
;
import
com.mortals.xhx.module.staff.model.StaffQuery
;
...
@@ -35,8 +41,11 @@ import org.springframework.web.bind.annotation.RequestBody;
...
@@ -35,8 +41,11 @@ import org.springframework.web.bind.annotation.RequestBody;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.math.BigDecimal
;
import
java.text.DecimalFormat
;
import
java.text.ParseException
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.text.SimpleDateFormat
;
import
java.time.Duration
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -59,6 +68,8 @@ public class DingMessageController {
...
@@ -59,6 +68,8 @@ public class DingMessageController {
private
AttendanceLeaveRecordService
attendanceLeaveRecordService
;
private
AttendanceLeaveRecordService
attendanceLeaveRecordService
;
@Autowired
@Autowired
private
StaffService
staffService
;
private
StaffService
staffService
;
@Autowired
private
AttendanceVacationBalanceService
balanceService
;
/**
/**
* appKey
* appKey
...
@@ -88,7 +99,7 @@ public class DingMessageController {
...
@@ -88,7 +99,7 @@ public class DingMessageController {
@RequestParam
(
value
=
"timestamp"
,
required
=
false
)
String
timeStamp
,
@RequestParam
(
value
=
"timestamp"
,
required
=
false
)
String
timeStamp
,
@RequestParam
(
value
=
"nonce"
,
required
=
false
)
String
nonce
,
@RequestParam
(
value
=
"nonce"
,
required
=
false
)
String
nonce
,
@RequestBody
(
required
=
false
)
JSONObject
json
)
{
@RequestBody
(
required
=
false
)
JSONObject
json
)
{
//
log.info("钉钉推送参数:" + msg_signature+"---"+timeStamp+"---"+nonce+"---"+json.toJSONString() );
log
.
info
(
"钉钉推送参数:"
+
msg_signature
+
"---"
+
timeStamp
+
"---"
+
nonce
+
"---"
+
json
.
toJSONString
()
);
try
{
try
{
// 从http请求中获取加解密参数
// 从http请求中获取加解密参数
DingCallbackCrypto
callbackCrypto
=
new
DingCallbackCrypto
(
token
,
aesKey
,
appKey
);
DingCallbackCrypto
callbackCrypto
=
new
DingCallbackCrypto
(
token
,
aesKey
,
appKey
);
...
@@ -111,6 +122,7 @@ public class DingMessageController {
...
@@ -111,6 +122,7 @@ public class DingMessageController {
GetProcessInstanceResponseBody
.
GetProcessInstanceResponseBodyResult
result
=
rest
.
getData
();
GetProcessInstanceResponseBody
.
GetProcessInstanceResponseBodyResult
result
=
rest
.
getData
();
log
.
info
(
"审批详情:"
+
JSONObject
.
toJSONString
(
result
)
);
log
.
info
(
"审批详情:"
+
JSONObject
.
toJSONString
(
result
)
);
AttendanceLeaveRecordEntity
leaveRecordEntity
=
new
AttendanceLeaveRecordEntity
();
AttendanceLeaveRecordEntity
leaveRecordEntity
=
new
AttendanceLeaveRecordEntity
();
AttendanceVacationBalanceEntity
attendanceVacationBalanceEntity
=
new
AttendanceVacationBalanceEntity
();
leaveRecordEntity
.
initAttrValue
();
leaveRecordEntity
.
initAttrValue
();
leaveRecordEntity
.
setRemark
(
processInstanceId
);
//将钉钉的事物id作为备注填入数据库
leaveRecordEntity
.
setRemark
(
processInstanceId
);
//将钉钉的事物id作为备注填入数据库
...
@@ -126,56 +138,74 @@ public class DingMessageController {
...
@@ -126,56 +138,74 @@ public class DingMessageController {
leaveRecordEntity
.
setDeptName
(
staffEntity
.
getDeptName
());
leaveRecordEntity
.
setDeptName
(
staffEntity
.
getDeptName
());
leaveRecordEntity
.
setPhoneNumber
(
staffEntity
.
getPhoneNumber
());
leaveRecordEntity
.
setPhoneNumber
(
staffEntity
.
getPhoneNumber
());
attendanceVacationBalanceEntity
.
setStaffId
(
staffEntity
.
getId
());
attendanceVacationBalanceEntity
.
setStaffName
(
staffEntity
.
getName
());
attendanceVacationBalanceEntity
.
setDeptId
(
staffEntity
.
getDeptId
());
attendanceVacationBalanceEntity
.
setDeptName
(
staffEntity
.
getDeptName
());
attendanceVacationBalanceEntity
.
setEntryTime
(
staffEntity
.
getEntryDate
());
if
(
result
.
getTasks
().
size
()
>
0
){
if
(
result
.
getTasks
().
size
()
>
0
){
Date
startTime
=
dateFormat
(
result
.
getTasks
().
get
(
0
).
getCreateTime
());
Date
startTime
=
dateFormat
(
result
.
getTasks
().
get
(
0
).
getCreateTime
()
,
"yyyy-MM-dd'T'HH:mm'Z'"
);
Date
endTime
=
dateFormat
(
result
.
getTasks
().
get
(
0
).
getFinishTime
());
Date
endTime
=
dateFormat
(
result
.
getTasks
().
get
(
0
).
getFinishTime
()
,
"yyyy-MM-dd'T'HH:mm'Z'"
);
leaveRecordEntity
.
setStartTime
(
startTime
);
leaveRecordEntity
.
setStartTime
(
startTime
);
leaveRecordEntity
.
setEndTime
(
endTime
);
leaveRecordEntity
.
setEndTime
(
endTime
);
leaveRecordEntity
.
setDuration
((
int
)
((
endTime
.
getTime
()
-
startTime
.
getTime
())/
1000
));
leaveRecordEntity
.
setDuration
((
int
)
((
endTime
.
getTime
()
-
startTime
.
getTime
())/
1000
));
}
}
String
leave_code
=
LeaveRulesEnum
.
事假
.
getLeave_code
();
String
leave_name
=
"事假"
;
if
(
result
.
getFormComponentValues
().
size
()
>
0
){
if
(
result
.
getFormComponentValues
().
size
()
>
0
){
JSONArray
jsonArray
=
JSONArray
.
parseArray
(
result
.
getFormComponentValues
().
get
(
0
).
getValue
());
JSONArray
jsonArray
=
JSONArray
.
parseArray
(
result
.
getFormComponentValues
().
get
(
0
).
getValue
());
if
(
jsonArray
.
size
()
>
0
){
if
(
jsonArray
.
size
()
>
0
){
Date
startTime1
=
dateFormat
(
jsonArray
.
get
(
0
).
toString
());
Date
startTime1
=
dateFormat
(
jsonArray
.
get
(
0
).
toString
()
,
"yyyy-MM-dd HH:mm"
);
leaveRecordEntity
.
setStartTime
(
startTime1
);
leaveRecordEntity
.
setStartTime
(
startTime1
);
}
}
if
(
jsonArray
.
size
()
>
1
){
if
(
jsonArray
.
size
()
>
1
){
Date
endTime1
=
dateFormat
(
jsonArray
.
get
(
1
).
toString
());
Date
endTime1
=
dateFormat
(
jsonArray
.
get
(
1
).
toString
()
,
"yyyy-MM-dd HH:mm"
);
leaveRecordEntity
.
setEndTime
(
endTime1
);
leaveRecordEntity
.
setEndTime
(
endTime1
);
}
}
if
(
jsonArray
.
size
()
>
2
){
if
(
jsonArray
.
size
()
>
2
){
leaveRecordEntity
.
setDuration
((
int
)
(
Float
.
parseFloat
(
jsonArray
.
get
(
2
).
toString
())*
60
*
60
));
leaveRecordEntity
.
setDuration
((
int
)
(
Float
.
parseFloat
(
jsonArray
.
get
(
2
).
toString
())*
60
*
60
));
//小时转换成秒
}
}
if
(
jsonArray
.
size
()
>
4
){
if
(
jsonArray
.
size
()
>
4
){
switch
(
jsonArray
.
get
(
4
).
toString
()){
leave_name
=
jsonArray
.
get
(
4
).
toString
();
switch
(
leave_name
){
case
"调休"
:
case
"调休"
:
leaveRecordEntity
.
setLeaveType
(
2
);
leaveRecordEntity
.
setLeaveType
(
2
);
leave_code
=
LeaveRulesEnum
.
调休
.
getLeave_code
();
break
;
break
;
case
"病假"
:
case
"病假"
:
leaveRecordEntity
.
setLeaveType
(
3
);
leaveRecordEntity
.
setLeaveType
(
3
);
leave_code
=
LeaveRulesEnum
.
病假
.
getLeave_code
();
break
;
break
;
case
"年假"
:
case
"年假"
:
leaveRecordEntity
.
setLeaveType
(
4
);
leaveRecordEntity
.
setLeaveType
(
4
);
leave_code
=
LeaveRulesEnum
.
年假
.
getLeave_code
();
break
;
break
;
case
"产假"
:
case
"产假"
:
leaveRecordEntity
.
setLeaveType
(
5
);
leaveRecordEntity
.
setLeaveType
(
5
);
leave_code
=
LeaveRulesEnum
.
产假
.
getLeave_code
();
break
;
break
;
case
"陪产假"
:
case
"陪产假"
:
leaveRecordEntity
.
setLeaveType
(
6
);
leaveRecordEntity
.
setLeaveType
(
6
);
leave_code
=
LeaveRulesEnum
.
陪产假
.
getLeave_code
();
break
;
break
;
case
"婚假"
:
case
"婚假"
:
leaveRecordEntity
.
setLeaveType
(
7
);
leaveRecordEntity
.
setLeaveType
(
7
);
leave_code
=
LeaveRulesEnum
.
婚假
.
getLeave_code
();
break
;
break
;
case
"例假"
:
case
"例假"
:
leaveRecordEntity
.
setLeaveType
(
8
);
leaveRecordEntity
.
setLeaveType
(
8
);
leave_code
=
LeaveRulesEnum
.
例假
.
getLeave_code
();
break
;
break
;
case
"哺乳假"
:
case
"哺乳假"
:
leaveRecordEntity
.
setLeaveType
(
9
);
leaveRecordEntity
.
setLeaveType
(
9
);
leave_code
=
LeaveRulesEnum
.
哺乳假
.
getLeave_code
();
break
;
break
;
case
"丧假"
:
case
"丧假"
:
leaveRecordEntity
.
setLeaveType
(
10
);
leaveRecordEntity
.
setLeaveType
(
10
);
leave_code
=
LeaveRulesEnum
.
丧假
.
getLeave_code
();
break
;
break
;
case
"回单位"
:
case
"回单位"
:
leaveRecordEntity
.
setLeaveType
(
11
);
leaveRecordEntity
.
setLeaveType
(
11
);
...
@@ -209,9 +239,11 @@ public class DingMessageController {
...
@@ -209,9 +239,11 @@ public class DingMessageController {
break
;
break
;
case
"探亲假"
:
case
"探亲假"
:
leaveRecordEntity
.
setLeaveType
(
21
);
leaveRecordEntity
.
setLeaveType
(
21
);
leave_code
=
LeaveRulesEnum
.
年假
.
getLeave_code
();
break
;
break
;
default
:
default
:
leaveRecordEntity
.
setLeaveType
(
1
);
//默认事假
leaveRecordEntity
.
setLeaveType
(
1
);
//默认事假
leave_code
=
LeaveRulesEnum
.
事假
.
getLeave_code
();
break
;
break
;
}
}
...
@@ -244,9 +276,10 @@ public class DingMessageController {
...
@@ -244,9 +276,10 @@ public class DingMessageController {
leaveRecordEntity
.
setAuditResult
(
2
);
leaveRecordEntity
.
setAuditResult
(
2
);
}
}
log
.
info
(
"钉钉返回的result:"
+
result
.
getResult
()+
"
\n
auditresult:"
+
leaveRecordEntity
.
getAuditResult
());
log
.
info
(
"钉钉返回的result:"
+
result
.
getResult
()+
"
---
auditresult:"
+
leaveRecordEntity
.
getAuditResult
());
leaveRecordEntity
.
setAuditDesc
(
result
.
getOperationRecords
().
get
(
0
).
getRemark
());
leaveRecordEntity
.
setAuditDesc
(
result
.
getOperationRecords
().
get
(
0
).
getRemark
());
//更新请假记录表
AttendanceLeaveRecordEntity
recordEntity
=
attendanceLeaveRecordService
.
selectOne
(
new
AttendanceLeaveRecordQuery
().
remark
(
processInstanceId
));
AttendanceLeaveRecordEntity
recordEntity
=
attendanceLeaveRecordService
.
selectOne
(
new
AttendanceLeaveRecordQuery
().
remark
(
processInstanceId
));
if
(
ObjectUtils
.
isEmpty
(
recordEntity
)){
if
(
ObjectUtils
.
isEmpty
(
recordEntity
)){
...
@@ -262,6 +295,246 @@ public class DingMessageController {
...
@@ -262,6 +295,246 @@ public class DingMessageController {
attendanceLeaveRecordService
.
update
(
leaveRecordEntity
);
attendanceLeaveRecordService
.
update
(
leaveRecordEntity
);
}
}
//查询假期余额
Rest
<
OapiAttendanceVacationQuotaListResponse
.
OapiLeaveQuotaUserListVo
>
leaveRecordsResponseBodyResultRest
=
dingPersonService
.
getLeaveRecordByUserId
(
result
.
getOriginatorUserId
(),
leave_code
);
AttendanceVacationBalanceEntity
balanceEntity
=
balanceService
.
selectOne
(
new
AttendanceVacationBalanceQuery
().
staffId
(
staffEntity
.
getId
()));
if
(
leaveRecordsResponseBodyResultRest
.
getCode
()
==
Rest
.
SUCCESS
){
OapiAttendanceVacationQuotaListResponse
.
OapiLeaveQuotaUserListVo
result1
=
leaveRecordsResponseBodyResultRest
.
getData
();
double
leaveBlance
=
0
;
DecimalFormat
format
=
new
DecimalFormat
(
"##.##"
);
//如果钉钉有假期余额就写入钉钉返回的余额 否则用数据库表数据减去当前请假的天数
if
(
result1
.
getLeaveQuotas
()
!=
null
&&
result1
.
getLeaveQuotas
().
size
()
>
0
){
leaveBlance
=
(
result1
.
getLeaveQuotas
().
get
(
0
).
getQuotaNumPerDay
()
-
result1
.
getLeaveQuotas
().
get
(
0
).
getUsedNumPerDay
())/
100
;
}
switch
(
leave_name
)
{
case
"调休"
:
if
(
leaveBlance
==
0
){
if
(!
ObjectUtils
.
isEmpty
(
balanceEntity
)
&&
balanceEntity
.
getCompensatedLeaveDays
()
!=
null
){
leaveBlance
=
balanceEntity
.
getCompensatedLeaveDays
().
floatValue
()
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
}
else
{
leaveBlance
=
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
//秒转换为天
}
}
attendanceVacationBalanceEntity
.
setCompensatedLeaveDays
(
BigDecimal
.
valueOf
(
leaveBlance
));
break
;
case
"病假"
:
if
(
leaveBlance
==
0
){
if
(!
ObjectUtils
.
isEmpty
(
balanceEntity
)
&&
balanceEntity
.
getSickLeaveDays
()
!=
null
){
leaveBlance
=
balanceEntity
.
getSickLeaveDays
().
floatValue
()
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
}
else
{
leaveBlance
=
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
//秒转换为天
}
}
attendanceVacationBalanceEntity
.
setSickLeaveDays
(
BigDecimal
.
valueOf
(
leaveBlance
));
break
;
case
"年假"
:
if
(
leaveBlance
==
0
){
if
(!
ObjectUtils
.
isEmpty
(
balanceEntity
)
&&
balanceEntity
.
getAnnualLeaveDays
()
!=
null
){
leaveBlance
=
balanceEntity
.
getAnnualLeaveDays
().
floatValue
()
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
}
else
{
leaveBlance
=
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
//秒转换为天
}
}
attendanceVacationBalanceEntity
.
setAnnualLeaveDays
(
BigDecimal
.
valueOf
(
leaveBlance
));
break
;
case
"产假"
:
if
(
leaveBlance
==
0
){
if
(!
ObjectUtils
.
isEmpty
(
balanceEntity
)
&&
balanceEntity
.
getMaternityLeaveDays
()
!=
null
){
leaveBlance
=
balanceEntity
.
getMaternityLeaveDays
().
floatValue
()
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
}
else
{
leaveBlance
=
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
//秒转换为天
}
}
attendanceVacationBalanceEntity
.
setMaternityLeaveDays
(
BigDecimal
.
valueOf
(
leaveBlance
));
break
;
case
"陪产假"
:
if
(
leaveBlance
==
0
){
if
(!
ObjectUtils
.
isEmpty
(
balanceEntity
)
&&
balanceEntity
.
getPaternityLeaveDays
()
!=
null
){
leaveBlance
=
balanceEntity
.
getPaternityLeaveDays
().
floatValue
()
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
}
else
{
leaveBlance
=
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
//秒转换为天
}
}
attendanceVacationBalanceEntity
.
setPaternityLeaveDays
(
BigDecimal
.
valueOf
(
leaveBlance
));
break
;
case
"婚假"
:
if
(
leaveBlance
==
0
){
if
(!
ObjectUtils
.
isEmpty
(
balanceEntity
)
&&
balanceEntity
.
getMarriageLeaveDays
()
!=
null
){
leaveBlance
=
balanceEntity
.
getMarriageLeaveDays
().
floatValue
()
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
}
else
{
leaveBlance
=
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
//秒转换为天
}
}
attendanceVacationBalanceEntity
.
setMarriageLeaveDays
(
BigDecimal
.
valueOf
(
leaveBlance
));
break
;
case
"例假"
:
if
(
leaveBlance
==
0
){
if
(!
ObjectUtils
.
isEmpty
(
balanceEntity
)
&&
balanceEntity
.
getMenstrualLeaveDays
()
!=
null
){
leaveBlance
=
balanceEntity
.
getMenstrualLeaveDays
().
floatValue
()
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
}
else
{
leaveBlance
=
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
//秒转换为天
}
}
attendanceVacationBalanceEntity
.
setMenstrualLeaveDays
(
BigDecimal
.
valueOf
(
leaveBlance
));
break
;
case
"哺乳假"
:
if
(
leaveBlance
==
0
){
if
(!
ObjectUtils
.
isEmpty
(
balanceEntity
)
&&
balanceEntity
.
getBreastfeedingLeaveDays
()
!=
null
){
leaveBlance
=
balanceEntity
.
getBreastfeedingLeaveDays
().
floatValue
()
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
}
else
{
leaveBlance
=
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
//秒转换为天
}
}
attendanceVacationBalanceEntity
.
setBreastfeedingLeaveDays
(
BigDecimal
.
valueOf
(
leaveBlance
));
break
;
case
"丧假"
:
if
(
leaveBlance
==
0
){
if
(!
ObjectUtils
.
isEmpty
(
balanceEntity
)
&&
balanceEntity
.
getBereavementLeaveDays
()
!=
null
){
leaveBlance
=
balanceEntity
.
getBereavementLeaveDays
().
floatValue
()
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
}
else
{
leaveBlance
=
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
//秒转换为天
}
}
attendanceVacationBalanceEntity
.
setBereavementLeaveDays
(
BigDecimal
.
valueOf
(
leaveBlance
));
break
;
case
"回单位"
:
if
(
leaveBlance
==
0
){
if
(!
ObjectUtils
.
isEmpty
(
balanceEntity
)
&&
balanceEntity
.
getBackToUnit
()
!=
null
){
leaveBlance
=
balanceEntity
.
getBackToUnit
().
floatValue
()
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
}
else
{
leaveBlance
=
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
//秒转换为天
}
}
attendanceVacationBalanceEntity
.
setBackToUnit
(
BigDecimal
.
valueOf
(
leaveBlance
));
break
;
case
"因公请假"
:
if
(
leaveBlance
==
0
){
if
(!
ObjectUtils
.
isEmpty
(
balanceEntity
)
&&
balanceEntity
.
getOnDutyLeave
()
!=
null
){
leaveBlance
=
balanceEntity
.
getOnDutyLeave
().
floatValue
()
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
}
else
{
leaveBlance
=
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
//秒转换为天
}
}
attendanceVacationBalanceEntity
.
setOnDutyLeave
(
BigDecimal
.
valueOf
(
leaveBlance
));
break
;
case
"外出勘验"
:
if
(
leaveBlance
==
0
){
if
(!
ObjectUtils
.
isEmpty
(
balanceEntity
)
&&
balanceEntity
.
getOutOfOffice
()
!=
null
){
leaveBlance
=
balanceEntity
.
getOutOfOffice
().
floatValue
()
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
}
else
{
leaveBlance
=
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
//秒转换为天
}
}
attendanceVacationBalanceEntity
.
setOutOfOffice
(
BigDecimal
.
valueOf
(
leaveBlance
));
break
;
case
"值班补班"
:
if
(
leaveBlance
==
0
){
if
(!
ObjectUtils
.
isEmpty
(
balanceEntity
)
&&
balanceEntity
.
getShiftCompensation
()
!=
null
){
leaveBlance
=
balanceEntity
.
getShiftCompensation
().
floatValue
()
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
}
else
{
leaveBlance
=
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
//秒转换为天
}
}
attendanceVacationBalanceEntity
.
setShiftCompensation
(
BigDecimal
.
valueOf
(
leaveBlance
));
break
;
case
"体检"
:
if
(
leaveBlance
==
0
){
if
(!
ObjectUtils
.
isEmpty
(
balanceEntity
)
&&
balanceEntity
.
getPhysicalExamination
()
!=
null
){
leaveBlance
=
balanceEntity
.
getPhysicalExamination
().
floatValue
()
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
}
else
{
leaveBlance
=
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
//秒转换为天
}
}
attendanceVacationBalanceEntity
.
setPhysicalExamination
(
BigDecimal
.
valueOf
(
leaveBlance
));
break
;
case
"隔离"
:
if
(
leaveBlance
==
0
){
if
(!
ObjectUtils
.
isEmpty
(
balanceEntity
)
&&
balanceEntity
.
getQuarantine
()
!=
null
){
leaveBlance
=
balanceEntity
.
getQuarantine
().
floatValue
()
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
}
else
{
leaveBlance
=
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
//秒转换为天
}
}
attendanceVacationBalanceEntity
.
setQuarantine
(
BigDecimal
.
valueOf
(
leaveBlance
));
break
;
case
"因公外出"
:
if
(
leaveBlance
==
0
){
if
(!
ObjectUtils
.
isEmpty
(
balanceEntity
)
&&
balanceEntity
.
getBusinessTrip
()
!=
null
){
leaveBlance
=
balanceEntity
.
getBusinessTrip
().
floatValue
()
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
}
else
{
leaveBlance
=
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
//秒转换为天
}
}
attendanceVacationBalanceEntity
.
setBusinessTrip
(
BigDecimal
.
valueOf
(
leaveBlance
));
break
;
case
"公休"
:
if
(
leaveBlance
==
0
){
if
(!
ObjectUtils
.
isEmpty
(
balanceEntity
)
&&
balanceEntity
.
getPublicHoliday
()
!=
null
){
leaveBlance
=
balanceEntity
.
getPublicHoliday
().
floatValue
()
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
}
else
{
leaveBlance
=
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
//秒转换为天
}
}
attendanceVacationBalanceEntity
.
setPublicHoliday
(
BigDecimal
.
valueOf
(
leaveBlance
));
break
;
case
"育儿假"
:
if
(
leaveBlance
==
0
){
if
(!
ObjectUtils
.
isEmpty
(
balanceEntity
)
&&
balanceEntity
.
getChildRearingLeave
()
!=
null
){
leaveBlance
=
balanceEntity
.
getChildRearingLeave
().
floatValue
()
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
}
else
{
leaveBlance
=
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
//秒转换为天
}
}
attendanceVacationBalanceEntity
.
setChildRearingLeave
(
BigDecimal
.
valueOf
(
leaveBlance
));
break
;
case
"调回单位"
:
if
(
leaveBlance
==
0
){
if
(!
ObjectUtils
.
isEmpty
(
balanceEntity
)
&&
balanceEntity
.
getTransferBack
()
!=
null
){
leaveBlance
=
balanceEntity
.
getTransferBack
().
floatValue
()
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
}
else
{
leaveBlance
=
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
//秒转换为天
}
}
attendanceVacationBalanceEntity
.
setTransferBack
(
BigDecimal
.
valueOf
(
leaveBlance
));
break
;
case
"探亲假"
:
if
(
leaveBlance
==
0
){
if
(!
ObjectUtils
.
isEmpty
(
balanceEntity
)
&&
balanceEntity
.
getHomeLeave
()
!=
null
){
leaveBlance
=
balanceEntity
.
getHomeLeave
().
floatValue
()
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
}
else
{
leaveBlance
=
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
//秒转换为天
}
}
attendanceVacationBalanceEntity
.
setHomeLeave
(
BigDecimal
.
valueOf
(
leaveBlance
));
break
;
default
:
if
(
leaveBlance
==
0
){
if
(!
ObjectUtils
.
isEmpty
(
balanceEntity
)
&&
balanceEntity
.
getPersonalLeaveDays
()
!=
null
){
leaveBlance
=
balanceEntity
.
getPersonalLeaveDays
().
floatValue
()
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
}
else
{
leaveBlance
=
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
//秒转换为天
}
}
attendanceVacationBalanceEntity
.
setPersonalLeaveDays
(
BigDecimal
.
valueOf
(
leaveBlance
));
//默认事假
break
;
}
}
//更新假期余额表
if
(
ObjectUtils
.
isEmpty
(
balanceEntity
)){
attendanceVacationBalanceEntity
.
setCreateUserId
(
1L
);
attendanceVacationBalanceEntity
.
setCreateTime
(
new
Date
());
balanceService
.
save
(
attendanceVacationBalanceEntity
);
}
else
{
//更新对象必须传入id
attendanceVacationBalanceEntity
.
setId
(
balanceEntity
.
getId
());
attendanceVacationBalanceEntity
.
setUpdateUserId
(
1L
);
attendanceVacationBalanceEntity
.
setUpdateTime
(
new
Date
());
balanceService
.
update
(
attendanceVacationBalanceEntity
);
}
}
else
{
}
else
{
...
@@ -297,8 +570,18 @@ public class DingMessageController {
...
@@ -297,8 +570,18 @@ public class DingMessageController {
}
}
private
Date
dateFormat
(
String
dateString
){
/**
SimpleDateFormat
dateFormat_
=
new
SimpleDateFormat
(
"yyyy-MM-dd'T'HH:mm'Z'"
);
* 将秒转换成天数
* @param milliseconds
* @return
*/
private
float
converMillsToDays
(
long
milliseconds
){
float
days
=
((
float
)
milliseconds
)
/
(
60
*
60
*
24
);
return
days
;
}
private
Date
dateFormat
(
String
dateString
,
String
format
){
SimpleDateFormat
dateFormat_
=
new
SimpleDateFormat
(
format
);
Date
t
;
Date
t
;
try
{
try
{
...
...
attendance-performance-manager/src/main/java/com/mortals/xhx/module/dingding/AbstractDingTalkService.java
View file @
7bf295ec
...
@@ -53,11 +53,17 @@ public abstract class AbstractDingTalkService implements IDingPersonService {
...
@@ -53,11 +53,17 @@ public abstract class AbstractDingTalkService implements IDingPersonService {
protected
String
appSecret
;
protected
String
appSecret
;
/**
/**
*
appKey
*
oaurl
*/
*/
@Value
(
"${dingtalk.oaUrl:}"
)
@Value
(
"${dingtalk.oaUrl:}"
)
protected
String
oaUrl
;
protected
String
oaUrl
;
/**
* opUeserid
*/
@Value
(
"${dingtalk.opUserId:}"
)
protected
String
opUserId
;
@Autowired
@Autowired
private
ICacheService
cacheService
;
private
ICacheService
cacheService
;
...
...
attendance-performance-manager/src/main/java/com/mortals/xhx/module/dingding/personal/service/IDingPersonService.java
View file @
7bf295ec
package
com.mortals.xhx.module.dingding.personal.service
;
package
com.mortals.xhx.module.dingding.personal.service
;
import
com.aliyun.dingtalkattendance_1_0.models.GetLeaveRecordsResponseBody
;
import
com.aliyun.dingtalkworkflow_1_0.models.GetProcessInstanceResponseBody
;
import
com.aliyun.dingtalkworkflow_1_0.models.GetProcessInstanceResponseBody
;
import
com.dingtalk.api.response.OapiAttendanceVacationQuotaListResponse
;
import
com.dingtalk.api.response.OapiV2UserGetResponse
;
import
com.dingtalk.api.response.OapiV2UserGetResponse
;
import
com.mortals.framework.common.Rest
;
import
com.mortals.framework.common.Rest
;
import
com.mortals.xhx.module.dingding.IDingTalkService
;
import
com.mortals.xhx.module.dingding.IDingTalkService
;
...
@@ -59,5 +61,12 @@ public interface IDingPersonService extends IDingTalkService {
...
@@ -59,5 +61,12 @@ public interface IDingPersonService extends IDingTalkService {
*/
*/
Rest
<
GetProcessInstanceResponseBody
.
GetProcessInstanceResponseBodyResult
>
getOaRecordsById
(
String
processInstanceId
);
Rest
<
GetProcessInstanceResponseBody
.
GetProcessInstanceResponseBodyResult
>
getOaRecordsById
(
String
processInstanceId
);
/**
* 查询userid的特定假期余额
* @param user_id 被查询员工的id集合 多个用,分隔
* @param leave_code 假期类型编码
* @return
*/
Rest
<
OapiAttendanceVacationQuotaListResponse
.
OapiLeaveQuotaUserListVo
>
getLeaveRecordByUserId
(
String
user_id
,
String
leave_code
);
}
}
attendance-performance-manager/src/main/java/com/mortals/xhx/module/dingding/personal/service/impl/DingPersonServiceImpl.java
View file @
7bf295ec
package
com.mortals.xhx.module.dingding.personal.service.impl
;
package
com.mortals.xhx.module.dingding.personal.service.impl
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.aliyun.dingtalkattendance_1_0.Client
;
import
com.aliyun.dingtalkattendance_1_0.models.GetLeaveRecordsHeaders
;
import
com.aliyun.dingtalkattendance_1_0.models.GetLeaveRecordsResponse
;
import
com.aliyun.dingtalkattendance_1_0.models.GetLeaveRecordsResponseBody
;
import
com.aliyun.dingtalkworkflow_1_0.models.GetProcessInstanceResponse
;
import
com.aliyun.dingtalkworkflow_1_0.models.GetProcessInstanceResponse
;
import
com.aliyun.dingtalkworkflow_1_0.models.GetProcessInstanceResponseBody
;
import
com.aliyun.dingtalkworkflow_1_0.models.GetProcessInstanceResponseBody
;
import
com.aliyun.tea.TeaException
;
import
com.aliyun.tea.TeaException
;
import
com.aliyun.teautil.models.RuntimeOptions
;
import
com.dingtalk.api.DefaultDingTalkClient
;
import
com.dingtalk.api.DingTalkClient
;
import
com.dingtalk.api.DingTalkClient
;
import
com.dingtalk.api.request.OapiMessageCorpconversationAsyncsendV2Request
;
import
com.dingtalk.api.request.*
;
import
com.dingtalk.api.request.OapiV2UserGetRequest
;
import
com.dingtalk.api.response.*
;
import
com.dingtalk.api.request.OapiV2UserGetbymobileRequest
;
import
com.dingtalk.api.request.OapiV2UserGetuserinfoRequest
;
import
com.dingtalk.api.response.OapiMessageCorpconversationAsyncsendV2Response
;
import
com.dingtalk.api.response.OapiV2UserGetResponse
;
import
com.dingtalk.api.response.OapiV2UserGetbymobileResponse
;
import
com.dingtalk.api.response.OapiV2UserGetuserinfoResponse
;
import
com.mortals.framework.common.Rest
;
import
com.mortals.framework.common.Rest
;
import
com.mortals.xhx.module.dingding.AbstractDingTalkService
;
import
com.mortals.xhx.module.dingding.AbstractDingTalkService
;
import
com.mortals.xhx.module.dingding.personal.model.req.workmsg.WorkMsgReq
;
import
com.mortals.xhx.module.dingding.personal.model.req.workmsg.WorkMsgReq
;
...
@@ -135,23 +135,22 @@ public class DingPersonServiceImpl extends AbstractDingTalkService implements ID
...
@@ -135,23 +135,22 @@ public class DingPersonServiceImpl extends AbstractDingTalkService implements ID
}
}
/**
/**
* 使用 Token 初始化账号Client
* 设置client的config参数
*
* @return Client
* @return Client
* @throws Exception
* @throws Exception
*/
*/
public
com
.
aliyun
.
dingtalkworkflow_1_0
.
Client
createClient
()
throws
Exception
{
public
com
.
aliyun
.
teaopenapi
.
models
.
Config
setConfig
()
{
com
.
aliyun
.
teaopenapi
.
models
.
Config
config
=
new
com
.
aliyun
.
teaopenapi
.
models
.
Config
();
com
.
aliyun
.
teaopenapi
.
models
.
Config
config
=
new
com
.
aliyun
.
teaopenapi
.
models
.
Config
();
config
.
protocol
=
"http"
;
config
.
protocol
=
"http"
;
config
.
regionId
=
"central"
;
config
.
regionId
=
"central"
;
config
.
endpoint
=
oaUrl
;
config
.
endpoint
=
oaUrl
;
return
new
com
.
aliyun
.
dingtalkworkflow_1_0
.
Client
(
config
)
;
return
config
;
}
}
@Override
@Override
public
Rest
<
GetProcessInstanceResponseBody
.
GetProcessInstanceResponseBodyResult
>
getOaRecordsById
(
String
processInstanceId
)
{
public
Rest
<
GetProcessInstanceResponseBody
.
GetProcessInstanceResponseBodyResult
>
getOaRecordsById
(
String
processInstanceId
)
{
try
{
try
{
com
.
aliyun
.
dingtalkworkflow_1_0
.
Client
client
=
createClient
(
);
com
.
aliyun
.
dingtalkworkflow_1_0
.
Client
client
=
new
com
.
aliyun
.
dingtalkworkflow_1_0
.
Client
(
setConfig
()
);
com
.
aliyun
.
dingtalkworkflow_1_0
.
models
.
GetProcessInstanceHeaders
getProcessInstanceHeaders
=
new
com
.
aliyun
.
dingtalkworkflow_1_0
.
models
.
GetProcessInstanceHeaders
();
com
.
aliyun
.
dingtalkworkflow_1_0
.
models
.
GetProcessInstanceHeaders
getProcessInstanceHeaders
=
new
com
.
aliyun
.
dingtalkworkflow_1_0
.
models
.
GetProcessInstanceHeaders
();
getProcessInstanceHeaders
.
xAcsDingtalkAccessToken
=
getToken
();
getProcessInstanceHeaders
.
xAcsDingtalkAccessToken
=
getToken
();
HashMap
<
String
,
String
>
map
=
new
HashMap
<>();
HashMap
<
String
,
String
>
map
=
new
HashMap
<>();
...
@@ -169,4 +168,32 @@ public class DingPersonServiceImpl extends AbstractDingTalkService implements ID
...
@@ -169,4 +168,32 @@ public class DingPersonServiceImpl extends AbstractDingTalkService implements ID
}
}
}
}
@Override
public
Rest
<
OapiAttendanceVacationQuotaListResponse
.
OapiLeaveQuotaUserListVo
>
getLeaveRecordByUserId
(
String
user_id
,
String
leave_code
)
{
try
{
DingTalkClient
client
=
getDingTalkClient
(
"/topapi/attendance/vacation/quota/list"
);
OapiAttendanceVacationQuotaListRequest
req
=
new
OapiAttendanceVacationQuotaListRequest
();
req
.
setLeaveCode
(
leave_code
);
req
.
setOpUserid
(
opUserId
);
req
.
setUserids
(
user_id
);
req
.
setOffset
(
0L
);
req
.
setSize
(
50L
);
OapiAttendanceVacationQuotaListResponse
rsp
=
client
.
execute
(
req
,
getToken
());
log
.
info
(
"假期余额:{}"
,
JSON
.
toJSONString
(
rsp
.
getResult
()));
if
(
rsp
.
getErrcode
()
==
0
)
{
return
Rest
.
ok
(
"成功"
,
rsp
.
getResult
());
}
else
{
return
Rest
.
fail
(
String
.
format
(
"code:%s,msg:%s"
,
rsp
.
getErrcode
(),
rsp
.
getErrmsg
()));
}
}
catch
(
ApiException
e
)
{
e
.
printStackTrace
();
log
.
error
(
"根据id查询假期余额异常"
,
e
);
return
Rest
.
fail
(
e
.
getMessage
());
}
}
}
}
attendance-performance-manager/src/main/resources/bootstrap.yml
View file @
7bf295ec
...
@@ -75,4 +75,5 @@ dingtalk:
...
@@ -75,4 +75,5 @@ dingtalk:
AesKey
:
@
profiles.dingtalk.aesKey@
AesKey
:
@
profiles.dingtalk.aesKey@
token
:
@
profiles.dingtalk.token@
token
:
@
profiles.dingtalk.token@
oaUrl
:
@
profiles.dingtalk.oaUrl@
oaUrl
:
@
profiles.dingtalk.oaUrl@
opUserId
:
@
profiles.dingtalk.opUserId@
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