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
91b441ba
Commit
91b441ba
authored
Dec 14, 2023
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改假期重复提交的问题
parent
afa3dcc4
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
203 additions
and
214 deletions
+203
-214
attendance-performance-manager/src/main/java/com/mortals/xhx/module/attendance/dao/AttendanceLeaveRecordDao.java
...s/xhx/module/attendance/dao/AttendanceLeaveRecordDao.java
+8
-8
attendance-performance-manager/src/main/java/com/mortals/xhx/module/attendance/dao/ibatis/AttendanceLeaveRecordDaoImpl.java
...e/attendance/dao/ibatis/AttendanceLeaveRecordDaoImpl.java
+10
-27
attendance-performance-manager/src/main/java/com/mortals/xhx/module/attendance/dingmsg/api/DingMessageController.java
.../module/attendance/dingmsg/api/DingMessageController.java
+155
-167
attendance-performance-manager/src/main/java/com/mortals/xhx/module/attendance/service/AttendanceLeaveRecordService.java
...dule/attendance/service/AttendanceLeaveRecordService.java
+1
-1
attendance-performance-manager/src/main/java/com/mortals/xhx/module/attendance/service/impl/AttendanceLeaveRecordServiceImpl.java
...ndance/service/impl/AttendanceLeaveRecordServiceImpl.java
+29
-11
No files found.
attendance-performance-manager/src/main/java/com/mortals/xhx/module/attendance/dao/AttendanceLeaveRecordDao.java
View file @
91b441ba
...
@@ -5,14 +5,14 @@ import com.mortals.xhx.module.attendance.model.AttendanceLeaveRecordEntity;
...
@@ -5,14 +5,14 @@ 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
java.util.List
;
import
java.util.List
;
/**
/**
* 请假记录信息Dao
* 请假记录信息Dao
* 请假记录信息 DAO接口
* 请假记录信息 DAO接口
*
*
* @author zxfei
* @author zxfei
* @date 2023-04-07
* @date 2023-04-07
*/
*/
public
interface
AttendanceLeaveRecordDao
extends
ICRUDDao
<
AttendanceLeaveRecordEntity
,
Long
>{
public
interface
AttendanceLeaveRecordDao
extends
ICRUDDao
<
AttendanceLeaveRecordEntity
,
Long
>
{
AttendanceLeaveRecordEntity
doUpdateRecord
(
String
processInstanceId
,
AttendanceLeaveRecordEntity
leaveRecordEntity
);
}
}
attendance-performance-manager/src/main/java/com/mortals/xhx/module/attendance/dao/ibatis/AttendanceLeaveRecordDaoImpl.java
View file @
91b441ba
...
@@ -8,36 +8,19 @@ import org.apache.commons.lang3.ObjectUtils;
...
@@ -8,36 +8,19 @@ import org.apache.commons.lang3.ObjectUtils;
import
org.springframework.stereotype.Repository
;
import
org.springframework.stereotype.Repository
;
import
com.mortals.xhx.module.attendance.dao.AttendanceLeaveRecordDao
;
import
com.mortals.xhx.module.attendance.dao.AttendanceLeaveRecordDao
;
import
com.mortals.xhx.module.attendance.model.AttendanceLeaveRecordEntity
;
import
com.mortals.xhx.module.attendance.model.AttendanceLeaveRecordEntity
;
import
java.util.Date
;
import
java.util.Date
;
import
com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis
;
import
com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis
;
import
java.util.List
;
import
java.util.List
;
/**
/**
* 请假记录信息DaoImpl DAO接口
* 请假记录信息DaoImpl DAO接口
*
*
* @author zxfei
* @author zxfei
* @date 2023-04-07
* @date 2023-04-07
*/
*/
@Repository
(
"attendanceLeaveRecordDao"
)
@Repository
(
"attendanceLeaveRecordDao"
)
public
class
AttendanceLeaveRecordDaoImpl
extends
BaseCRUDDaoMybatis
<
AttendanceLeaveRecordEntity
,
Long
>
implements
AttendanceLeaveRecordDao
{
public
class
AttendanceLeaveRecordDaoImpl
extends
BaseCRUDDaoMybatis
<
AttendanceLeaveRecordEntity
,
Long
>
implements
AttendanceLeaveRecordDao
{
AttendanceLeaveRecordService
attendanceLeaveRecordService
;
@Override
public
AttendanceLeaveRecordEntity
doUpdateRecord
(
String
processInstanceId
,
AttendanceLeaveRecordEntity
leaveRecordEntity
)
{
AttendanceLeaveRecordEntity
recordEntity
=
attendanceLeaveRecordService
.
selectOne
(
new
AttendanceLeaveRecordQuery
().
remark
(
processInstanceId
));
if
(
ObjectUtils
.
isEmpty
(
recordEntity
)){
leaveRecordEntity
.
setCreateTime
(
new
Date
());
leaveRecordEntity
.
setCreateUserId
(
1L
);
attendanceLeaveRecordService
.
save
(
leaveRecordEntity
);
}
else
{
leaveRecordEntity
.
setId
(
recordEntity
.
getId
());
leaveRecordEntity
.
setUpdateUserId
(
1L
);
leaveRecordEntity
.
setUpdateTime
(
new
Date
());
attendanceLeaveRecordService
.
update
(
leaveRecordEntity
);
}
return
leaveRecordEntity
;
}
}
}
attendance-performance-manager/src/main/java/com/mortals/xhx/module/attendance/dingmsg/api/DingMessageController.java
View file @
91b441ba
...
@@ -54,7 +54,6 @@ import java.util.Map;
...
@@ -54,7 +54,6 @@ import java.util.Map;
import
static
cn
.
hutool
.
core
.
date
.
DatePattern
.*;
import
static
cn
.
hutool
.
core
.
date
.
DatePattern
.*;
/**
/**
*
* 接收钉钉的审批消息推送
* 接收钉钉的审批消息推送
*
*
* @author ZYW
* @author ZYW
...
@@ -100,8 +99,8 @@ public class DingMessageController {
...
@@ -100,8 +99,8 @@ public class DingMessageController {
public
Map
<
String
,
String
>
getOaMessage
(
@RequestParam
(
value
=
"msg_signature"
,
required
=
false
)
String
msg_signature
,
public
Map
<
String
,
String
>
getOaMessage
(
@RequestParam
(
value
=
"msg_signature"
,
required
=
false
)
String
msg_signature
,
@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
);
...
@@ -114,27 +113,27 @@ public class DingMessageController {
...
@@ -114,27 +113,27 @@ public class DingMessageController {
String
processInstanceId
=
eventJson
.
getString
(
"processInstanceId"
);
String
processInstanceId
=
eventJson
.
getString
(
"processInstanceId"
);
// 根据EventType分类处理
// 根据EventType分类处理
if
(
"bpms_instance_change"
.
equals
(
eventType
)
||
"bpms_task_change"
.
equals
(
eventType
))
{
//请假等需要审批的消息
if
(
"bpms_instance_change"
.
equals
(
eventType
)
||
"bpms_task_change"
.
equals
(
eventType
))
{
//请假等需要审批的消息
// 处理审批实例始末(审批任务开始、结束)
// 处理审批实例始末(审批任务开始、结束)
// 存入数据库
// 存入数据库
// log.info("发生了:" + eventType + "事件" );
// log.info("发生了:" + eventType + "事件" );
if
(
processInstanceId
!=
null
)
{
if
(
processInstanceId
!=
null
)
{
Rest
<
GetProcessInstanceResponseBody
.
GetProcessInstanceResponseBodyResult
>
rest
=
dingPersonService
.
getOaRecordsById
(
processInstanceId
);
Rest
<
GetProcessInstanceResponseBody
.
GetProcessInstanceResponseBodyResult
>
rest
=
dingPersonService
.
getOaRecordsById
(
processInstanceId
);
if
(
rest
.
getCode
()
==
Rest
.
SUCCESS
)
{
if
(
rest
.
getCode
()
==
Rest
.
SUCCESS
)
{
GetProcessInstanceResponseBody
.
GetProcessInstanceResponseBodyResult
result
=
rest
.
getData
();
GetProcessInstanceResponseBody
.
GetProcessInstanceResponseBodyResult
result
=
rest
.
getData
();
log
.
info
(
"审批详情:"
+
JSONObject
.
toJSONString
(
result
)
);
log
.
info
(
"审批详情:"
+
JSONObject
.
toJSONString
(
result
)
);
if
(
result
.
getTitle
().
contains
(
"请假"
))
{
//只处理请假的审批单
if
(
result
.
getTitle
().
contains
(
"请假"
))
{
//只处理请假的审批单
AttendanceLeaveRecordEntity
leaveRecordEntity
=
new
AttendanceLeaveRecordEntity
();
AttendanceLeaveRecordEntity
leaveRecordEntity
=
new
AttendanceLeaveRecordEntity
();
leaveRecordEntity
.
initAttrValue
();
leaveRecordEntity
.
initAttrValue
();
leaveRecordEntity
.
setRemark
(
processInstanceId
);
//将钉钉的事物id作为备注填入数据库
leaveRecordEntity
.
setRemark
(
processInstanceId
);
//将钉钉的事物id作为备注填入数据库
Rest
<
String
>
mobileRest
=
dingPersonService
.
getPersonById
(
result
.
getOriginatorUserId
());
Rest
<
String
>
mobileRest
=
dingPersonService
.
getPersonById
(
result
.
getOriginatorUserId
());
if
(
mobileRest
.
getCode
()
==
Rest
.
SUCCESS
)
{
if
(
mobileRest
.
getCode
()
==
Rest
.
SUCCESS
)
{
String
mobile
=
mobileRest
.
getData
();
String
mobile
=
mobileRest
.
getData
();
StaffEntity
staffEntity
=
staffService
.
selectOne
(
new
StaffQuery
().
phoneNumber
(
mobile
));
StaffEntity
staffEntity
=
staffService
.
selectOne
(
new
StaffQuery
().
phoneNumber
(
mobile
));
if
(!
ObjectUtils
.
isEmpty
(
staffEntity
))
{
if
(!
ObjectUtils
.
isEmpty
(
staffEntity
))
{
leaveRecordEntity
.
setLeavePersonId
(
staffEntity
.
getId
());
leaveRecordEntity
.
setLeavePersonId
(
staffEntity
.
getId
());
leaveRecordEntity
.
setLeavePerson
(
staffEntity
.
getName
());
leaveRecordEntity
.
setLeavePerson
(
staffEntity
.
getName
());
...
@@ -143,7 +142,6 @@ public class DingMessageController {
...
@@ -143,7 +142,6 @@ public class DingMessageController {
leaveRecordEntity
.
setPhoneNumber
(
staffEntity
.
getPhoneNumber
());
leaveRecordEntity
.
setPhoneNumber
(
staffEntity
.
getPhoneNumber
());
// if(result.getTasks().size() >0 ){
// if(result.getTasks().size() >0 ){
// if(result.getTasks().get(0).getCreateTime() != null && result.getTasks().get(0).getFinishTime() != null){
// if(result.getTasks().get(0).getCreateTime() != null && result.getTasks().get(0).getFinishTime() != null){
// Date startTime = dateFormat(result.getTasks().get(0).getCreateTime(),"yyyy-MM-dd'T'HH:mm'Z'",false);
// Date startTime = dateFormat(result.getTasks().get(0).getCreateTime(),"yyyy-MM-dd'T'HH:mm'Z'",false);
...
@@ -157,36 +155,36 @@ public class DingMessageController {
...
@@ -157,36 +155,36 @@ public class DingMessageController {
String
leave_code
=
LeaveRulesEnum
.
事假
.
getLeave_code
();
String
leave_code
=
LeaveRulesEnum
.
事假
.
getLeave_code
();
String
leave_name
=
"事假"
;
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
!=
null
&&
jsonArray
.
size
()
>
0
)
{
if
(
jsonArray
!=
null
&&
jsonArray
.
size
()
>
0
)
{
Date
startTime1
=
dateFormat
(
jsonArray
.
get
(
0
).
toString
(),
"yyyy-MM-dd HH:mm"
,
true
);
Date
startTime1
=
dateFormat
(
jsonArray
.
get
(
0
).
toString
(),
"yyyy-MM-dd HH:mm"
,
true
);
leaveRecordEntity
.
setStartTime
(
startTime1
);
leaveRecordEntity
.
setStartTime
(
startTime1
);
}
}
if
(
jsonArray
!=
null
&&
jsonArray
.
size
()
>
1
)
{
if
(
jsonArray
!=
null
&&
jsonArray
.
size
()
>
1
)
{
Date
endTime1
=
dateFormat
(
jsonArray
.
get
(
1
).
toString
(),
"yyyy-MM-dd HH:mm"
,
false
);
Date
endTime1
=
dateFormat
(
jsonArray
.
get
(
1
).
toString
(),
"yyyy-MM-dd HH:mm"
,
false
);
leaveRecordEntity
.
setEndTime
(
endTime1
);
leaveRecordEntity
.
setEndTime
(
endTime1
);
}
}
if
(
jsonArray
!=
null
&&
jsonArray
.
size
()
>
2
)
{
if
(
jsonArray
!=
null
&&
jsonArray
.
size
()
>
2
)
{
if
(
jsonArray
.
size
()
>
3
)
{
if
(
jsonArray
.
size
()
>
3
)
{
switch
(
jsonArray
.
get
(
3
).
toString
()){
switch
(
jsonArray
.
get
(
3
).
toString
())
{
case
"halfDay"
:
case
"halfDay"
:
case
"day"
:
case
"day"
:
leaveRecordEntity
.
setDuration
((
int
)
(
Float
.
parseFloat
(
jsonArray
.
get
(
2
).
toString
())
*
60
*
60
*
8
));
//天转换成秒 一天工作时间9小时
leaveRecordEntity
.
setDuration
((
int
)
(
Float
.
parseFloat
(
jsonArray
.
get
(
2
).
toString
())
*
60
*
60
*
8
));
//天转换成秒 一天工作时间9小时
leaveRecordEntity
.
setSourceDingTime
(
jsonArray
.
get
(
2
).
toString
()
+
"天"
);
leaveRecordEntity
.
setSourceDingTime
(
jsonArray
.
get
(
2
).
toString
()
+
"天"
);
break
;
break
;
default
:
//除了按天和半天计算的假期 其余都是按小时返回
default
:
//除了按天和半天计算的假期 其余都是按小时返回
leaveRecordEntity
.
setDuration
((
int
)
(
Float
.
parseFloat
(
jsonArray
.
get
(
2
).
toString
())
*
60
*
60
));
//小时转换成秒
leaveRecordEntity
.
setDuration
((
int
)
(
Float
.
parseFloat
(
jsonArray
.
get
(
2
).
toString
())
*
60
*
60
));
//小时转换成秒
leaveRecordEntity
.
setSourceDingTime
(
jsonArray
.
get
(
2
).
toString
()
+
"小时"
);
leaveRecordEntity
.
setSourceDingTime
(
jsonArray
.
get
(
2
).
toString
()
+
"小时"
);
break
;
break
;
}
}
}
}
}
}
if
(
jsonArray
!=
null
&&
jsonArray
.
size
()
>
4
)
{
if
(
jsonArray
!=
null
&&
jsonArray
.
size
()
>
4
)
{
leave_name
=
jsonArray
.
get
(
4
).
toString
();
leave_name
=
jsonArray
.
get
(
4
).
toString
();
switch
(
leave_name
){
switch
(
leave_name
)
{
case
"事假"
:
case
"事假"
:
leaveRecordEntity
.
setLeaveType
(
1
);
leaveRecordEntity
.
setLeaveType
(
1
);
leave_code
=
LeaveRulesEnum
.
事假
.
getLeave_code
();
leave_code
=
LeaveRulesEnum
.
事假
.
getLeave_code
();
...
@@ -276,48 +274,44 @@ public class DingMessageController {
...
@@ -276,48 +274,44 @@ public class DingMessageController {
}
}
if
(
result
.
getFormComponentValues
().
size
()
>
2
)
{
//上传的附件
if
(
result
.
getFormComponentValues
().
size
()
>
2
)
{
//上传的附件
GetProcessInstanceResponseBody
.
GetProcessInstanceResponseBodyResultFormComponentValues
picEntity
=
result
.
getFormComponentValues
().
get
(
2
);
GetProcessInstanceResponseBody
.
GetProcessInstanceResponseBodyResultFormComponentValues
picEntity
=
result
.
getFormComponentValues
().
get
(
2
);
if
(
picEntity
.
getName
().
equals
(
"图片"
)
&&
picEntity
.
getValue
()
!=
null
)
{
if
(
picEntity
.
getName
().
equals
(
"图片"
)
&&
picEntity
.
getValue
()
!=
null
)
{
leaveRecordEntity
.
setAttachmentPath
(
picEntity
.
getValue
());
leaveRecordEntity
.
setAttachmentPath
(
picEntity
.
getValue
());
}
}
}
}
if
(
result
.
getStatus
().
compareToIgnoreCase
(
"NEW"
)
==
0
||
result
.
getStatus
().
compareToIgnoreCase
(
"RUNNING"
)
==
0
)
{
if
(
result
.
getStatus
().
compareToIgnoreCase
(
"NEW"
)
==
0
||
result
.
getStatus
().
compareToIgnoreCase
(
"RUNNING"
)
==
0
)
{
leaveRecordEntity
.
setProcessStatus
(
1
);
leaveRecordEntity
.
setProcessStatus
(
1
);
}
else
if
(
result
.
getStatus
().
compareToIgnoreCase
(
"COMPLETED"
)
==
0
||
result
.
getStatus
().
compareToIgnoreCase
(
"CANCELED"
)
==
0
}
else
if
(
result
.
getStatus
().
compareToIgnoreCase
(
"COMPLETED"
)
==
0
||
result
.
getStatus
().
compareToIgnoreCase
(
"CANCELED"
)
==
0
||
result
.
getStatus
().
compareToIgnoreCase
(
"TERMINATED"
)
==
0
){
||
result
.
getStatus
().
compareToIgnoreCase
(
"TERMINATED"
)
==
0
)
{
leaveRecordEntity
.
setProcessStatus
(
2
);
leaveRecordEntity
.
setProcessStatus
(
2
);
}
}
if
(
result
.
getResult
().
compareToIgnoreCase
(
"AGREE"
)
==
0
)
{
if
(
result
.
getResult
().
compareToIgnoreCase
(
"AGREE"
)
==
0
)
{
leaveRecordEntity
.
setAuditResult
(
AppealResultEnum
.
通过
.
getValue
());
leaveRecordEntity
.
setAuditResult
(
AppealResultEnum
.
通过
.
getValue
());
//10/19增加撤销审批状态
//10/19增加撤销审批状态
if
(
result
.
getTasks
().
size
()
>
1
)
{
if
(
result
.
getTasks
().
size
()
>
1
)
{
if
((
result
.
getTasks
().
get
(
1
).
getStatus
().
compareToIgnoreCase
(
"CANCELED"
)
==
0
)
||
if
((
result
.
getTasks
().
get
(
1
).
getStatus
().
compareToIgnoreCase
(
"CANCELED"
)
==
0
)
||
result
.
getBizAction
().
compareToIgnoreCase
(
"REVOKE"
)
==
0
){
result
.
getBizAction
().
compareToIgnoreCase
(
"REVOKE"
)
==
0
)
{
leaveRecordEntity
.
setAuditResult
(
4
);
//撤销审批完成
leaveRecordEntity
.
setAuditResult
(
4
);
//撤销审批完成
leaveRecordEntity
.
setAuditResult
(
AppealResultEnum
.
撤销审批通过
.
getValue
());
leaveRecordEntity
.
setAuditResult
(
AppealResultEnum
.
撤销审批通过
.
getValue
());
}
}
}
}
}
}
else
if
(
result
.
equals
(
""
))
{
//撤销假期审批中result会为空 撤销审批通过后result为AGREE
else
if
(
result
.
equals
(
""
)){
//撤销假期审批中result会为空 撤销审批通过后result为AGREE
if
(
result
.
getTasks
().
size
()
>
1
)
{
if
(
result
.
getTasks
().
size
()
>
1
){
log
.
info
(
"status"
+
result
.
getTasks
().
get
(
1
).
getStatus
());
log
.
info
(
"status"
+
result
.
getTasks
().
get
(
1
).
getStatus
());
if
(
result
.
getTasks
().
get
(
1
).
getStatus
().
compareToIgnoreCase
(
"CANCELED"
)
!=
0
)
{
if
(
result
.
getTasks
().
get
(
1
).
getStatus
().
compareToIgnoreCase
(
"CANCELED"
)
!=
0
){
leaveRecordEntity
.
setAuditResult
(
AppealResultEnum
.
撤销审批中
.
getValue
());
//撤销审批中
leaveRecordEntity
.
setAuditResult
(
AppealResultEnum
.
撤销审批中
.
getValue
());
//撤销审批中
}
}
}
}
}
}
else
{
else
{
leaveRecordEntity
.
setAuditResult
(
AppealResultEnum
.
审核中
.
getValue
());
//请假审批中
leaveRecordEntity
.
setAuditResult
(
AppealResultEnum
.
审核中
.
getValue
());
//请假审批中
}
}
log
.
info
(
"钉钉返回的result:"
+
result
.
getResult
()
+
"---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
());
if
(
result
.
getOperationRecords
().
get
(
0
).
getRemark
()
!=
null
&&
!
result
.
getOperationRecords
().
get
(
0
).
getRemark
().
equals
(
""
))
{
if
(
result
.
getOperationRecords
().
get
(
0
).
getRemark
()
!=
null
&&
!
result
.
getOperationRecords
().
get
(
0
).
getRemark
().
equals
(
""
))
{
leaveRecordEntity
.
setReason
(
result
.
getOperationRecords
().
get
(
0
).
getRemark
());
leaveRecordEntity
.
setReason
(
result
.
getOperationRecords
().
get
(
0
).
getRemark
());
...
@@ -337,16 +331,15 @@ public class DingMessageController {
...
@@ -337,16 +331,15 @@ public class DingMessageController {
//
//
// attendanceLeaveRecordService.update(leaveRecordEntity);
// attendanceLeaveRecordService.update(leaveRecordEntity);
// }
// }
attendanceLeaveRecordService
.
doUpdateRecord
(
processInstanceId
,
leaveRecordEntity
);
attendanceLeaveRecordService
.
doUpdateRecord
(
processInstanceId
,
leaveRecordEntity
);
//假期余额
//假期余额
AttendanceVacationBalanceEntity
attendanceVacationBalanceEntity
=
new
AttendanceVacationBalanceEntity
();
AttendanceVacationBalanceEntity
attendanceVacationBalanceEntity
=
new
AttendanceVacationBalanceEntity
();
//查询假期余额
//查询假期余额
Rest
<
OapiAttendanceVacationQuotaListResponse
.
OapiLeaveQuotaUserListVo
>
leaveRecordsResponseBodyResultRest
=
Rest
<
OapiAttendanceVacationQuotaListResponse
.
OapiLeaveQuotaUserListVo
>
leaveRecordsResponseBodyResultRest
=
dingPersonService
.
getLeaveRecordByUserId
(
result
.
getOriginatorUserId
(),
leave_code
);
dingPersonService
.
getLeaveRecordByUserId
(
result
.
getOriginatorUserId
(),
leave_code
);
AttendanceVacationBalanceEntity
balanceEntity
=
balanceService
.
selectOne
(
new
AttendanceVacationBalanceQuery
().
staffId
(
staffEntity
.
getId
()));
AttendanceVacationBalanceEntity
balanceEntity
=
balanceService
.
selectOne
(
new
AttendanceVacationBalanceQuery
().
staffId
(
staffEntity
.
getId
()));
if
(
ObjectUtils
.
isEmpty
(
balanceEntity
))
{
//先判断数据库里没有这个人的请假记录就初始化对象
if
(
ObjectUtils
.
isEmpty
(
balanceEntity
))
{
//先判断数据库里没有这个人的请假记录就初始化对象
attendanceVacationBalanceEntity
.
initAttrValue
();
attendanceVacationBalanceEntity
.
initAttrValue
();
}
}
attendanceVacationBalanceEntity
.
setRemark
(
processInstanceId
);
// 将钉钉的事物id存入假期余额 用于判断是否为同一条请假数据
attendanceVacationBalanceEntity
.
setRemark
(
processInstanceId
);
// 将钉钉的事物id存入假期余额 用于判断是否为同一条请假数据
...
@@ -355,7 +348,7 @@ public class DingMessageController {
...
@@ -355,7 +348,7 @@ public class DingMessageController {
attendanceVacationBalanceEntity
.
setDeptId
(
staffEntity
.
getDeptId
());
attendanceVacationBalanceEntity
.
setDeptId
(
staffEntity
.
getDeptId
());
attendanceVacationBalanceEntity
.
setDeptName
(
staffEntity
.
getDeptName
());
attendanceVacationBalanceEntity
.
setDeptName
(
staffEntity
.
getDeptName
());
attendanceVacationBalanceEntity
.
setEntryTime
(
staffEntity
.
getEntryDate
());
attendanceVacationBalanceEntity
.
setEntryTime
(
staffEntity
.
getEntryDate
());
if
(
leaveRecordsResponseBodyResultRest
.
getCode
()
==
Rest
.
SUCCESS
)
{
if
(
leaveRecordsResponseBodyResultRest
.
getCode
()
==
Rest
.
SUCCESS
)
{
OapiAttendanceVacationQuotaListResponse
.
OapiLeaveQuotaUserListVo
result1
=
leaveRecordsResponseBodyResultRest
.
getData
();
OapiAttendanceVacationQuotaListResponse
.
OapiLeaveQuotaUserListVo
result1
=
leaveRecordsResponseBodyResultRest
.
getData
();
double
leaveBlance
=
0
;
double
leaveBlance
=
0
;
// //如果钉钉有假期余额就写入钉钉返回的余额 否则用数据库表数据减去当前请假的天数
// //如果钉钉有假期余额就写入钉钉返回的余额 否则用数据库表数据减去当前请假的天数
...
@@ -377,221 +370,221 @@ public class DingMessageController {
...
@@ -377,221 +370,221 @@ public class DingMessageController {
switch
(
leave_name
)
{
switch
(
leave_name
)
{
case
"事假"
:
case
"事假"
:
if
(
leaveBlance
==
0
)
{
if
(
leaveBlance
==
0
)
{
if
(!
ObjectUtils
.
isEmpty
(
balanceEntity
)
&&
balanceEntity
.
getPersonalLeaveDays
()
!=
null
)
{
if
(!
ObjectUtils
.
isEmpty
(
balanceEntity
)
&&
balanceEntity
.
getPersonalLeaveDays
()
!=
null
)
{
leaveBlance
=
balanceEntity
.
getPersonalLeaveDays
().
floatValue
()
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
leaveBlance
=
balanceEntity
.
getPersonalLeaveDays
().
floatValue
()
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
}
else
{
}
else
{
leaveBlance
=
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
//秒转换为天
leaveBlance
=
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
//秒转换为天
}
}
}
}
attendanceVacationBalanceEntity
.
setPersonalLeaveDays
(
BigDecimal
.
valueOf
(
leaveBlance
));
//默认事假
attendanceVacationBalanceEntity
.
setPersonalLeaveDays
(
BigDecimal
.
valueOf
(
leaveBlance
));
//默认事假
break
;
break
;
case
"调休"
:
case
"调休"
:
if
(
leaveBlance
==
0
)
{
if
(
leaveBlance
==
0
)
{
if
(!
ObjectUtils
.
isEmpty
(
balanceEntity
)
&&
balanceEntity
.
getCompensatedLeaveDays
()
!=
null
)
{
if
(!
ObjectUtils
.
isEmpty
(
balanceEntity
)
&&
balanceEntity
.
getCompensatedLeaveDays
()
!=
null
)
{
leaveBlance
=
balanceEntity
.
getCompensatedLeaveDays
().
floatValue
()
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
leaveBlance
=
balanceEntity
.
getCompensatedLeaveDays
().
floatValue
()
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
}
else
{
}
else
{
leaveBlance
=
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
//秒转换为天
leaveBlance
=
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
//秒转换为天
}
}
}
}
attendanceVacationBalanceEntity
.
setCompensatedLeaveDays
(
BigDecimal
.
valueOf
(
leaveBlance
));
attendanceVacationBalanceEntity
.
setCompensatedLeaveDays
(
BigDecimal
.
valueOf
(
leaveBlance
));
break
;
break
;
case
"病假"
:
case
"病假"
:
if
(
leaveBlance
==
0
)
{
if
(
leaveBlance
==
0
)
{
if
(!
ObjectUtils
.
isEmpty
(
balanceEntity
)
&&
balanceEntity
.
getSickLeaveDays
()
!=
null
)
{
if
(!
ObjectUtils
.
isEmpty
(
balanceEntity
)
&&
balanceEntity
.
getSickLeaveDays
()
!=
null
)
{
leaveBlance
=
balanceEntity
.
getSickLeaveDays
().
floatValue
()
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
leaveBlance
=
balanceEntity
.
getSickLeaveDays
().
floatValue
()
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
}
else
{
}
else
{
leaveBlance
=
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
//秒转换为天
leaveBlance
=
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
//秒转换为天
}
}
}
}
attendanceVacationBalanceEntity
.
setSickLeaveDays
(
BigDecimal
.
valueOf
(
leaveBlance
));
attendanceVacationBalanceEntity
.
setSickLeaveDays
(
BigDecimal
.
valueOf
(
leaveBlance
));
break
;
break
;
case
"年假"
:
case
"年假"
:
if
(
leaveBlance
==
0
)
{
if
(
leaveBlance
==
0
)
{
if
(!
ObjectUtils
.
isEmpty
(
balanceEntity
)
&&
balanceEntity
.
getAnnualLeaveDays
()
!=
null
)
{
if
(!
ObjectUtils
.
isEmpty
(
balanceEntity
)
&&
balanceEntity
.
getAnnualLeaveDays
()
!=
null
)
{
leaveBlance
=
balanceEntity
.
getAnnualLeaveDays
().
floatValue
()
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
leaveBlance
=
balanceEntity
.
getAnnualLeaveDays
().
floatValue
()
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
}
else
{
}
else
{
leaveBlance
=
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
//秒转换为天
leaveBlance
=
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
//秒转换为天
}
}
}
}
attendanceVacationBalanceEntity
.
setAnnualLeaveDays
(
BigDecimal
.
valueOf
(
leaveBlance
));
attendanceVacationBalanceEntity
.
setAnnualLeaveDays
(
BigDecimal
.
valueOf
(
leaveBlance
));
break
;
break
;
case
"产假"
:
case
"产假"
:
if
(
leaveBlance
==
0
)
{
if
(
leaveBlance
==
0
)
{
if
(!
ObjectUtils
.
isEmpty
(
balanceEntity
)
&&
balanceEntity
.
getMaternityLeaveDays
()
!=
null
)
{
if
(!
ObjectUtils
.
isEmpty
(
balanceEntity
)
&&
balanceEntity
.
getMaternityLeaveDays
()
!=
null
)
{
leaveBlance
=
balanceEntity
.
getMaternityLeaveDays
().
floatValue
()
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
leaveBlance
=
balanceEntity
.
getMaternityLeaveDays
().
floatValue
()
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
}
else
{
}
else
{
leaveBlance
=
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
//秒转换为天
leaveBlance
=
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
//秒转换为天
}
}
}
}
attendanceVacationBalanceEntity
.
setMaternityLeaveDays
(
BigDecimal
.
valueOf
(
leaveBlance
));
attendanceVacationBalanceEntity
.
setMaternityLeaveDays
(
BigDecimal
.
valueOf
(
leaveBlance
));
break
;
break
;
case
"陪产假"
:
case
"陪产假"
:
if
(
leaveBlance
==
0
)
{
if
(
leaveBlance
==
0
)
{
if
(!
ObjectUtils
.
isEmpty
(
balanceEntity
)
&&
balanceEntity
.
getPaternityLeaveDays
()
!=
null
)
{
if
(!
ObjectUtils
.
isEmpty
(
balanceEntity
)
&&
balanceEntity
.
getPaternityLeaveDays
()
!=
null
)
{
leaveBlance
=
balanceEntity
.
getPaternityLeaveDays
().
floatValue
()
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
leaveBlance
=
balanceEntity
.
getPaternityLeaveDays
().
floatValue
()
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
}
else
{
}
else
{
leaveBlance
=
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
//秒转换为天
leaveBlance
=
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
//秒转换为天
}
}
}
}
attendanceVacationBalanceEntity
.
setPaternityLeaveDays
(
BigDecimal
.
valueOf
(
leaveBlance
));
attendanceVacationBalanceEntity
.
setPaternityLeaveDays
(
BigDecimal
.
valueOf
(
leaveBlance
));
break
;
break
;
case
"婚假"
:
case
"婚假"
:
if
(
leaveBlance
==
0
)
{
if
(
leaveBlance
==
0
)
{
if
(!
ObjectUtils
.
isEmpty
(
balanceEntity
)
&&
balanceEntity
.
getMarriageLeaveDays
()
!=
null
)
{
if
(!
ObjectUtils
.
isEmpty
(
balanceEntity
)
&&
balanceEntity
.
getMarriageLeaveDays
()
!=
null
)
{
leaveBlance
=
balanceEntity
.
getMarriageLeaveDays
().
floatValue
()
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
leaveBlance
=
balanceEntity
.
getMarriageLeaveDays
().
floatValue
()
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
}
else
{
}
else
{
leaveBlance
=
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
//秒转换为天
leaveBlance
=
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
//秒转换为天
}
}
}
}
attendanceVacationBalanceEntity
.
setMarriageLeaveDays
(
BigDecimal
.
valueOf
(
leaveBlance
));
attendanceVacationBalanceEntity
.
setMarriageLeaveDays
(
BigDecimal
.
valueOf
(
leaveBlance
));
break
;
break
;
case
"例假"
:
case
"例假"
:
if
(
leaveBlance
==
0
)
{
if
(
leaveBlance
==
0
)
{
if
(!
ObjectUtils
.
isEmpty
(
balanceEntity
)
&&
balanceEntity
.
getMenstrualLeaveDays
()
!=
null
)
{
if
(!
ObjectUtils
.
isEmpty
(
balanceEntity
)
&&
balanceEntity
.
getMenstrualLeaveDays
()
!=
null
)
{
leaveBlance
=
balanceEntity
.
getMenstrualLeaveDays
().
floatValue
()
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
leaveBlance
=
balanceEntity
.
getMenstrualLeaveDays
().
floatValue
()
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
}
else
{
}
else
{
leaveBlance
=
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
//秒转换为天
leaveBlance
=
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
//秒转换为天
}
}
}
}
attendanceVacationBalanceEntity
.
setMenstrualLeaveDays
(
BigDecimal
.
valueOf
(
leaveBlance
));
attendanceVacationBalanceEntity
.
setMenstrualLeaveDays
(
BigDecimal
.
valueOf
(
leaveBlance
));
break
;
break
;
case
"哺乳假"
:
case
"哺乳假"
:
if
(
leaveBlance
==
0
)
{
if
(
leaveBlance
==
0
)
{
if
(!
ObjectUtils
.
isEmpty
(
balanceEntity
)
&&
balanceEntity
.
getBreastfeedingLeaveDays
()
!=
null
)
{
if
(!
ObjectUtils
.
isEmpty
(
balanceEntity
)
&&
balanceEntity
.
getBreastfeedingLeaveDays
()
!=
null
)
{
leaveBlance
=
balanceEntity
.
getBreastfeedingLeaveDays
().
floatValue
()
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
leaveBlance
=
balanceEntity
.
getBreastfeedingLeaveDays
().
floatValue
()
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
}
else
{
}
else
{
leaveBlance
=
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
//秒转换为天
leaveBlance
=
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
//秒转换为天
}
}
}
}
attendanceVacationBalanceEntity
.
setBreastfeedingLeaveDays
(
BigDecimal
.
valueOf
(
leaveBlance
));
attendanceVacationBalanceEntity
.
setBreastfeedingLeaveDays
(
BigDecimal
.
valueOf
(
leaveBlance
));
break
;
break
;
case
"丧假"
:
case
"丧假"
:
if
(
leaveBlance
==
0
)
{
if
(
leaveBlance
==
0
)
{
if
(!
ObjectUtils
.
isEmpty
(
balanceEntity
)
&&
balanceEntity
.
getBereavementLeaveDays
()
!=
null
)
{
if
(!
ObjectUtils
.
isEmpty
(
balanceEntity
)
&&
balanceEntity
.
getBereavementLeaveDays
()
!=
null
)
{
leaveBlance
=
balanceEntity
.
getBereavementLeaveDays
().
floatValue
()
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
leaveBlance
=
balanceEntity
.
getBereavementLeaveDays
().
floatValue
()
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
}
else
{
}
else
{
leaveBlance
=
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
//秒转换为天
leaveBlance
=
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
//秒转换为天
}
}
}
}
attendanceVacationBalanceEntity
.
setBereavementLeaveDays
(
BigDecimal
.
valueOf
(
leaveBlance
));
attendanceVacationBalanceEntity
.
setBereavementLeaveDays
(
BigDecimal
.
valueOf
(
leaveBlance
));
break
;
break
;
case
"回单位"
:
case
"回单位"
:
if
(
leaveBlance
==
0
)
{
if
(
leaveBlance
==
0
)
{
if
(!
ObjectUtils
.
isEmpty
(
balanceEntity
)
&&
balanceEntity
.
getBackToUnit
()
!=
null
)
{
if
(!
ObjectUtils
.
isEmpty
(
balanceEntity
)
&&
balanceEntity
.
getBackToUnit
()
!=
null
)
{
leaveBlance
=
balanceEntity
.
getBackToUnit
().
floatValue
()
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
leaveBlance
=
balanceEntity
.
getBackToUnit
().
floatValue
()
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
}
else
{
}
else
{
leaveBlance
=
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
//秒转换为天
leaveBlance
=
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
//秒转换为天
}
}
}
}
attendanceVacationBalanceEntity
.
setBackToUnit
(
BigDecimal
.
valueOf
(
leaveBlance
));
attendanceVacationBalanceEntity
.
setBackToUnit
(
BigDecimal
.
valueOf
(
leaveBlance
));
break
;
break
;
case
"因公请假"
:
case
"因公请假"
:
if
(
leaveBlance
==
0
)
{
if
(
leaveBlance
==
0
)
{
if
(!
ObjectUtils
.
isEmpty
(
balanceEntity
)
&&
balanceEntity
.
getOnDutyLeave
()
!=
null
)
{
if
(!
ObjectUtils
.
isEmpty
(
balanceEntity
)
&&
balanceEntity
.
getOnDutyLeave
()
!=
null
)
{
leaveBlance
=
balanceEntity
.
getOnDutyLeave
().
floatValue
()
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
leaveBlance
=
balanceEntity
.
getOnDutyLeave
().
floatValue
()
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
}
else
{
}
else
{
leaveBlance
=
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
//秒转换为天
leaveBlance
=
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
//秒转换为天
}
}
}
}
attendanceVacationBalanceEntity
.
setOnDutyLeave
(
BigDecimal
.
valueOf
(
leaveBlance
));
attendanceVacationBalanceEntity
.
setOnDutyLeave
(
BigDecimal
.
valueOf
(
leaveBlance
));
break
;
break
;
case
"外出勘验"
:
case
"外出勘验"
:
if
(
leaveBlance
==
0
)
{
if
(
leaveBlance
==
0
)
{
if
(!
ObjectUtils
.
isEmpty
(
balanceEntity
)
&&
balanceEntity
.
getOutOfOffice
()
!=
null
)
{
if
(!
ObjectUtils
.
isEmpty
(
balanceEntity
)
&&
balanceEntity
.
getOutOfOffice
()
!=
null
)
{
leaveBlance
=
balanceEntity
.
getOutOfOffice
().
floatValue
()
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
leaveBlance
=
balanceEntity
.
getOutOfOffice
().
floatValue
()
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
}
else
{
}
else
{
leaveBlance
=
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
//秒转换为天
leaveBlance
=
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
//秒转换为天
}
}
}
}
attendanceVacationBalanceEntity
.
setOutOfOffice
(
BigDecimal
.
valueOf
(
leaveBlance
));
attendanceVacationBalanceEntity
.
setOutOfOffice
(
BigDecimal
.
valueOf
(
leaveBlance
));
break
;
break
;
case
"值班补班"
:
case
"值班补班"
:
if
(
leaveBlance
==
0
)
{
if
(
leaveBlance
==
0
)
{
if
(!
ObjectUtils
.
isEmpty
(
balanceEntity
)
&&
balanceEntity
.
getShiftCompensation
()
!=
null
)
{
if
(!
ObjectUtils
.
isEmpty
(
balanceEntity
)
&&
balanceEntity
.
getShiftCompensation
()
!=
null
)
{
leaveBlance
=
balanceEntity
.
getShiftCompensation
().
floatValue
()
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
leaveBlance
=
balanceEntity
.
getShiftCompensation
().
floatValue
()
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
}
else
{
}
else
{
leaveBlance
=
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
//秒转换为天
leaveBlance
=
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
//秒转换为天
}
}
}
}
attendanceVacationBalanceEntity
.
setShiftCompensation
(
BigDecimal
.
valueOf
(
leaveBlance
));
attendanceVacationBalanceEntity
.
setShiftCompensation
(
BigDecimal
.
valueOf
(
leaveBlance
));
break
;
break
;
case
"体检"
:
case
"体检"
:
if
(
leaveBlance
==
0
)
{
if
(
leaveBlance
==
0
)
{
if
(!
ObjectUtils
.
isEmpty
(
balanceEntity
)
&&
balanceEntity
.
getPhysicalExamination
()
!=
null
)
{
if
(!
ObjectUtils
.
isEmpty
(
balanceEntity
)
&&
balanceEntity
.
getPhysicalExamination
()
!=
null
)
{
leaveBlance
=
balanceEntity
.
getPhysicalExamination
().
floatValue
()
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
leaveBlance
=
balanceEntity
.
getPhysicalExamination
().
floatValue
()
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
}
else
{
}
else
{
leaveBlance
=
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
//秒转换为天
leaveBlance
=
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
//秒转换为天
}
}
}
}
attendanceVacationBalanceEntity
.
setPhysicalExamination
(
BigDecimal
.
valueOf
(
leaveBlance
));
attendanceVacationBalanceEntity
.
setPhysicalExamination
(
BigDecimal
.
valueOf
(
leaveBlance
));
break
;
break
;
case
"隔离"
:
case
"隔离"
:
if
(
leaveBlance
==
0
)
{
if
(
leaveBlance
==
0
)
{
if
(!
ObjectUtils
.
isEmpty
(
balanceEntity
)
&&
balanceEntity
.
getQuarantine
()
!=
null
)
{
if
(!
ObjectUtils
.
isEmpty
(
balanceEntity
)
&&
balanceEntity
.
getQuarantine
()
!=
null
)
{
leaveBlance
=
balanceEntity
.
getQuarantine
().
floatValue
()
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
leaveBlance
=
balanceEntity
.
getQuarantine
().
floatValue
()
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
}
else
{
}
else
{
leaveBlance
=
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
//秒转换为天
leaveBlance
=
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
//秒转换为天
}
}
}
}
attendanceVacationBalanceEntity
.
setQuarantine
(
BigDecimal
.
valueOf
(
leaveBlance
));
attendanceVacationBalanceEntity
.
setQuarantine
(
BigDecimal
.
valueOf
(
leaveBlance
));
break
;
break
;
case
"因公外出"
:
case
"因公外出"
:
if
(
leaveBlance
==
0
)
{
if
(
leaveBlance
==
0
)
{
if
(!
ObjectUtils
.
isEmpty
(
balanceEntity
)
&&
balanceEntity
.
getBusinessTrip
()
!=
null
)
{
if
(!
ObjectUtils
.
isEmpty
(
balanceEntity
)
&&
balanceEntity
.
getBusinessTrip
()
!=
null
)
{
leaveBlance
=
balanceEntity
.
getBusinessTrip
().
floatValue
()
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
leaveBlance
=
balanceEntity
.
getBusinessTrip
().
floatValue
()
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
}
else
{
}
else
{
leaveBlance
=
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
//秒转换为天
leaveBlance
=
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
//秒转换为天
}
}
}
}
attendanceVacationBalanceEntity
.
setBusinessTrip
(
BigDecimal
.
valueOf
(
leaveBlance
));
attendanceVacationBalanceEntity
.
setBusinessTrip
(
BigDecimal
.
valueOf
(
leaveBlance
));
break
;
break
;
case
"公休"
:
case
"公休"
:
if
(
leaveBlance
==
0
)
{
if
(
leaveBlance
==
0
)
{
if
(!
ObjectUtils
.
isEmpty
(
balanceEntity
)
&&
balanceEntity
.
getPublicHoliday
()
!=
null
)
{
if
(!
ObjectUtils
.
isEmpty
(
balanceEntity
)
&&
balanceEntity
.
getPublicHoliday
()
!=
null
)
{
leaveBlance
=
balanceEntity
.
getPublicHoliday
().
floatValue
()
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
leaveBlance
=
balanceEntity
.
getPublicHoliday
().
floatValue
()
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
}
else
{
}
else
{
leaveBlance
=
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
//秒转换为天
leaveBlance
=
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
//秒转换为天
}
}
}
}
attendanceVacationBalanceEntity
.
setPublicHoliday
(
BigDecimal
.
valueOf
(
leaveBlance
));
attendanceVacationBalanceEntity
.
setPublicHoliday
(
BigDecimal
.
valueOf
(
leaveBlance
));
break
;
break
;
case
"育儿假"
:
case
"育儿假"
:
if
(
leaveBlance
==
0
)
{
if
(
leaveBlance
==
0
)
{
if
(!
ObjectUtils
.
isEmpty
(
balanceEntity
)
&&
balanceEntity
.
getChildRearingLeave
()
!=
null
)
{
if
(!
ObjectUtils
.
isEmpty
(
balanceEntity
)
&&
balanceEntity
.
getChildRearingLeave
()
!=
null
)
{
leaveBlance
=
balanceEntity
.
getChildRearingLeave
().
floatValue
()
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
leaveBlance
=
balanceEntity
.
getChildRearingLeave
().
floatValue
()
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
}
else
{
}
else
{
leaveBlance
=
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
//秒转换为天
leaveBlance
=
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
//秒转换为天
}
}
}
}
attendanceVacationBalanceEntity
.
setChildRearingLeave
(
BigDecimal
.
valueOf
(
leaveBlance
));
attendanceVacationBalanceEntity
.
setChildRearingLeave
(
BigDecimal
.
valueOf
(
leaveBlance
));
break
;
break
;
case
"调回单位"
:
case
"调回单位"
:
if
(
leaveBlance
==
0
)
{
if
(
leaveBlance
==
0
)
{
if
(!
ObjectUtils
.
isEmpty
(
balanceEntity
)
&&
balanceEntity
.
getTransferBack
()
!=
null
)
{
if
(!
ObjectUtils
.
isEmpty
(
balanceEntity
)
&&
balanceEntity
.
getTransferBack
()
!=
null
)
{
leaveBlance
=
balanceEntity
.
getTransferBack
().
floatValue
()
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
leaveBlance
=
balanceEntity
.
getTransferBack
().
floatValue
()
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
}
else
{
}
else
{
leaveBlance
=
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
//秒转换为天
leaveBlance
=
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
//秒转换为天
}
}
}
}
attendanceVacationBalanceEntity
.
setTransferBack
(
BigDecimal
.
valueOf
(
leaveBlance
));
attendanceVacationBalanceEntity
.
setTransferBack
(
BigDecimal
.
valueOf
(
leaveBlance
));
break
;
break
;
case
"探亲假"
:
case
"探亲假"
:
if
(
leaveBlance
==
0
)
{
if
(
leaveBlance
==
0
)
{
if
(!
ObjectUtils
.
isEmpty
(
balanceEntity
)
&&
balanceEntity
.
getHomeLeave
()
!=
null
)
{
if
(!
ObjectUtils
.
isEmpty
(
balanceEntity
)
&&
balanceEntity
.
getHomeLeave
()
!=
null
)
{
leaveBlance
=
balanceEntity
.
getHomeLeave
().
floatValue
()
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
leaveBlance
=
balanceEntity
.
getHomeLeave
().
floatValue
()
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
}
else
{
}
else
{
leaveBlance
=
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
//秒转换为天
leaveBlance
=
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
//秒转换为天
}
}
}
}
attendanceVacationBalanceEntity
.
setHomeLeave
(
BigDecimal
.
valueOf
(
leaveBlance
));
attendanceVacationBalanceEntity
.
setHomeLeave
(
BigDecimal
.
valueOf
(
leaveBlance
));
break
;
break
;
default
:
default
:
if
(
leaveBlance
==
0
)
{
if
(
leaveBlance
==
0
)
{
if
(!
ObjectUtils
.
isEmpty
(
balanceEntity
)
&&
balanceEntity
.
getPersonalLeaveDays
()
!=
null
)
{
if
(!
ObjectUtils
.
isEmpty
(
balanceEntity
)
&&
balanceEntity
.
getPersonalLeaveDays
()
!=
null
)
{
leaveBlance
=
balanceEntity
.
getPersonalLeaveDays
().
floatValue
()
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
leaveBlance
=
balanceEntity
.
getPersonalLeaveDays
().
floatValue
()
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
}
else
{
}
else
{
leaveBlance
=
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
//秒转换为天
leaveBlance
=
-
converMillsToDays
(
leaveRecordEntity
.
getDuration
());
//秒转换为天
}
}
}
}
attendanceVacationBalanceEntity
.
setOther
(
BigDecimal
.
valueOf
(
leaveBlance
));
attendanceVacationBalanceEntity
.
setOther
(
BigDecimal
.
valueOf
(
leaveBlance
));
...
@@ -600,15 +593,15 @@ public class DingMessageController {
...
@@ -600,15 +593,15 @@ public class DingMessageController {
}
}
//审批状态为同意过后再修改假期余额
//审批状态为同意过后再修改假期余额
if
(
result
.
getResult
().
compareToIgnoreCase
(
"AGREE"
)
==
0
)
{
if
(
result
.
getResult
().
compareToIgnoreCase
(
"AGREE"
)
==
0
)
{
AttendanceVacationBalanceEntity
entity
=
balanceService
.
selectOne
(
new
AttendanceVacationBalanceQuery
().
remark
(
processInstanceId
));
AttendanceVacationBalanceEntity
entity
=
balanceService
.
selectOne
(
new
AttendanceVacationBalanceQuery
().
remark
(
processInstanceId
));
if
(
ObjectUtils
.
isEmpty
(
entity
))
{
//当表中没有这条processInstanceId关联的数据表示没有扣除假期(钉钉会推送两条余额数据过来 需要加这个判断)
if
(
ObjectUtils
.
isEmpty
(
entity
))
{
//当表中没有这条processInstanceId关联的数据表示没有扣除假期(钉钉会推送两条余额数据过来 需要加这个判断)
//更新假期余额表
//更新假期余额表
if
(
ObjectUtils
.
isEmpty
(
balanceEntity
))
{
if
(
ObjectUtils
.
isEmpty
(
balanceEntity
))
{
attendanceVacationBalanceEntity
.
setCreateUserId
(
1L
);
attendanceVacationBalanceEntity
.
setCreateUserId
(
1L
);
attendanceVacationBalanceEntity
.
setCreateTime
(
new
Date
());
attendanceVacationBalanceEntity
.
setCreateTime
(
new
Date
());
balanceService
.
save
(
attendanceVacationBalanceEntity
);
balanceService
.
save
(
attendanceVacationBalanceEntity
);
}
else
{
}
else
{
//更新对象必须传入id
//更新对象必须传入id
attendanceVacationBalanceEntity
.
setId
(
balanceEntity
.
getId
());
attendanceVacationBalanceEntity
.
setId
(
balanceEntity
.
getId
());
...
@@ -621,26 +614,21 @@ public class DingMessageController {
...
@@ -621,26 +614,21 @@ public class DingMessageController {
}
}
}
else
{
}
else
{
log
.
info
(
"该号码("
+
mobile
+
")未在本系统绑定"
);
log
.
info
(
"该号码("
+
mobile
+
")未在本系统绑定"
);
}
}
}
else
{
}
else
{
log
.
info
(
"根据id在钉钉平台查询电话失败"
+
mobileRest
.
getMsg
());
log
.
info
(
"根据id在钉钉平台查询电话失败"
+
mobileRest
.
getMsg
());
}
}
}
}
}
}
}
}
}
}
else
{
else
{
// 添加其他已注册的
// 添加其他已注册的
log
.
info
(
"发生了:"
+
eventType
+
"事件"
);
log
.
info
(
"发生了:"
+
eventType
+
"事件"
);
}
}
...
@@ -652,7 +640,7 @@ public class DingMessageController {
...
@@ -652,7 +640,7 @@ public class DingMessageController {
}
catch
(
DingCallbackCrypto
.
DingTalkEncryptException
e
)
{
}
catch
(
DingCallbackCrypto
.
DingTalkEncryptException
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
info
(
"请假记录表操作异常->"
+
e
.
toString
());
log
.
info
(
"请假记录表操作异常->"
+
e
.
toString
());
throw
new
RuntimeException
(
e
);
throw
new
RuntimeException
(
e
);
}
}
return
null
;
return
null
;
...
@@ -661,40 +649,40 @@ public class DingMessageController {
...
@@ -661,40 +649,40 @@ public class DingMessageController {
/**
/**
* 将秒转换成天数
* 将秒转换成天数
*
* @param milliseconds
* @param milliseconds
* @return
* @return
*/
*/
private
float
converMillsToDays
(
long
milliseconds
){
private
float
converMillsToDays
(
long
milliseconds
)
{
float
days
=
((
float
)
milliseconds
)
/
(
60
*
60
*
8
);
float
days
=
((
float
)
milliseconds
)
/
(
60
*
60
*
8
);
return
days
;
return
days
;
}
}
/**
/**
*
* @param dateString
* @param dateString
* @param format
* @param format
* @param tag 标志位 是否为开始时间 如是开始时间 2023-08-03 上午 转换成 2023-08-03 9:00 如不是是开始时间 2023-08-03 上午 转换成 2023-08-03 12:00
* @param tag
标志位 是否为开始时间 如是开始时间 2023-08-03 上午 转换成 2023-08-03 9:00 如不是是开始时间 2023-08-03 上午 转换成 2023-08-03 12:00
* @return
* @return
*/
*/
private
Date
dateFormat
(
String
dateString
,
String
format
,
boolean
tag
)
{
private
Date
dateFormat
(
String
dateString
,
String
format
,
boolean
tag
)
{
if
(
dateString
.
contains
(
"上午"
))
{
if
(
dateString
.
contains
(
"上午"
))
{
if
(
tag
)
{
if
(
tag
)
{
dateString
=
dateString
.
replace
(
"上午"
,
"09:00"
);
dateString
=
dateString
.
replace
(
"上午"
,
"09:00"
);
}
else
{
}
else
{
dateString
=
dateString
.
replace
(
"上午"
,
"12:00"
);
dateString
=
dateString
.
replace
(
"上午"
,
"12:00"
);
}
}
}
else
{
}
else
{
if
(
tag
)
{
if
(
tag
)
{
dateString
=
dateString
.
replace
(
"下午"
,
"13:00"
);
dateString
=
dateString
.
replace
(
"下午"
,
"13:00"
);
}
else
{
}
else
{
dateString
=
dateString
.
replace
(
"下午"
,
"18:00"
);
dateString
=
dateString
.
replace
(
"下午"
,
"18:00"
);
}
}
}
}
SimpleDateFormat
dateFormat_
=
new
SimpleDateFormat
(
format
);
SimpleDateFormat
dateFormat_
=
new
SimpleDateFormat
(
format
);
Date
t
;
Date
t
;
try
{
try
{
t
=
dateFormat_
.
parse
(
dateString
);
t
=
dateFormat_
.
parse
(
dateString
);
return
t
;
return
t
;
}
catch
(
ParseException
e
)
{
}
catch
(
ParseException
e
)
{
return
new
Date
(
System
.
currentTimeMillis
());
return
new
Date
(
System
.
currentTimeMillis
());
...
...
attendance-performance-manager/src/main/java/com/mortals/xhx/module/attendance/service/AttendanceLeaveRecordService.java
View file @
91b441ba
...
@@ -14,5 +14,5 @@ import com.mortals.xhx.module.attendance.model.AttendanceLeaveRecordQuery;
...
@@ -14,5 +14,5 @@ import com.mortals.xhx.module.attendance.model.AttendanceLeaveRecordQuery;
public
interface
AttendanceLeaveRecordService
extends
ICRUDService
<
AttendanceLeaveRecordEntity
,
Long
>{
public
interface
AttendanceLeaveRecordService
extends
ICRUDService
<
AttendanceLeaveRecordEntity
,
Long
>{
//根据remark(钉钉返回的id)查询对象
//根据remark(钉钉返回的id)查询对象
AttendanceLeaveRecordEntity
doUpdateRecord
(
String
processInstanceId
,
AttendanceLeaveRecordEntity
leaveRecordEntity
)
throws
Exception
;
AttendanceLeaveRecordEntity
doUpdateRecord
(
String
processInstanceId
,
AttendanceLeaveRecordEntity
leaveRecordEntity
)
throws
Exception
;
}
}
\ No newline at end of file
attendance-performance-manager/src/main/java/com/mortals/xhx/module/attendance/service/impl/AttendanceLeaveRecordServiceImpl.java
View file @
91b441ba
package
com.mortals.xhx.module.attendance.service.impl
;
package
com.mortals.xhx.module.attendance.service.impl
;
import
com.mortals.framework.service.ICacheService
;
import
com.mortals.framework.service.ICacheService
;
import
com.mortals.framework.util.DateUtils
;
import
com.mortals.framework.util.DateUtils
;
import
com.mortals.framework.util.ThreadPool
;
import
com.mortals.framework.util.ThreadPool
;
import
com.mortals.xhx.common.utils.AttendSummaryThread
;
import
com.mortals.xhx.common.utils.AttendSummaryThread
;
import
com.mortals.xhx.module.attendance.model.AttendanceLeaveRecordQuery
;
import
com.mortals.xhx.module.attendance.model.vo.AttendanceSummaryQuery
;
import
com.mortals.xhx.module.attendance.model.vo.AttendanceSummaryQuery
;
import
com.mortals.xhx.module.attendance.service.AttendanceStatService
;
import
com.mortals.xhx.module.attendance.service.AttendanceStatService
;
import
org.apache.commons.lang3.ObjectUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
com.mortals.framework.service.impl.AbstractCRUDServiceImpl
;
import
com.mortals.framework.service.impl.AbstractCRUDServiceImpl
;
...
@@ -14,15 +17,17 @@ import com.mortals.xhx.module.attendance.dao.AttendanceLeaveRecordDao;
...
@@ -14,15 +17,17 @@ import com.mortals.xhx.module.attendance.dao.AttendanceLeaveRecordDao;
import
com.mortals.xhx.module.attendance.model.AttendanceLeaveRecordEntity
;
import
com.mortals.xhx.module.attendance.model.AttendanceLeaveRecordEntity
;
import
com.mortals.xhx.module.attendance.service.AttendanceLeaveRecordService
;
import
com.mortals.xhx.module.attendance.service.AttendanceLeaveRecordService
;
import
java.util.Date
;
import
static
com
.
mortals
.
xhx
.
common
.
key
.
RedisKey
.
KEY_ATTENDANCE_STAT_CACHE
;
import
static
com
.
mortals
.
xhx
.
common
.
key
.
RedisKey
.
KEY_ATTENDANCE_STAT_CACHE
;
/**
/**
* AttendanceLeaveRecordService
* AttendanceLeaveRecordService
* 请假记录信息 service实现
* 请假记录信息 service实现
*
*
* @author zxfei
* @author zxfei
* @date 2023-04-07
* @date 2023-04-07
*/
*/
@Service
(
"attendanceLeaveRecordService"
)
@Service
(
"attendanceLeaveRecordService"
)
public
class
AttendanceLeaveRecordServiceImpl
extends
AbstractCRUDServiceImpl
<
AttendanceLeaveRecordDao
,
AttendanceLeaveRecordEntity
,
Long
>
implements
AttendanceLeaveRecordService
{
public
class
AttendanceLeaveRecordServiceImpl
extends
AbstractCRUDServiceImpl
<
AttendanceLeaveRecordDao
,
AttendanceLeaveRecordEntity
,
Long
>
implements
AttendanceLeaveRecordService
{
...
@@ -33,18 +38,31 @@ public class AttendanceLeaveRecordServiceImpl extends AbstractCRUDServiceImpl<At
...
@@ -33,18 +38,31 @@ public class AttendanceLeaveRecordServiceImpl extends AbstractCRUDServiceImpl<At
@Override
@Override
protected
void
updateAfter
(
AttendanceLeaveRecordEntity
entity
,
Context
context
)
throws
AppException
{
protected
void
updateAfter
(
AttendanceLeaveRecordEntity
entity
,
Context
context
)
throws
AppException
{
super
.
updateAfter
(
entity
,
context
);
super
.
updateAfter
(
entity
,
context
);
if
(
entity
.
getAuditResult
()==
1
)
{
if
(
entity
.
getAuditResult
()
==
1
)
{
AttendanceSummaryQuery
query
=
new
AttendanceSummaryQuery
();
AttendanceSummaryQuery
query
=
new
AttendanceSummaryQuery
();
query
.
setStaffId
(
entity
.
getLeavePersonId
());
query
.
setStaffId
(
entity
.
getLeavePersonId
());
query
.
setSummaryTimeStart
(
DateUtils
.
getStrDate
(
entity
.
getStartTime
()));
query
.
setSummaryTimeStart
(
DateUtils
.
getStrDate
(
entity
.
getStartTime
()));
query
.
setSummaryTimeEnd
(
DateUtils
.
getStrDate
(
entity
.
getEndTime
()));
query
.
setSummaryTimeEnd
(
DateUtils
.
getStrDate
(
entity
.
getEndTime
()));
cacheService
.
lpush
(
KEY_ATTENDANCE_STAT_CACHE
,
query
);
cacheService
.
lpush
(
KEY_ATTENDANCE_STAT_CACHE
,
query
);
}
}
}
}
@Override
@Override
public
AttendanceLeaveRecordEntity
doUpdateRecord
(
String
processInstanceId
,
AttendanceLeaveRecordEntity
leaveRecordEntity
)
throws
Exception
{
public
synchronized
AttendanceLeaveRecordEntity
doUpdateRecord
(
String
processInstanceId
,
AttendanceLeaveRecordEntity
leaveRecordEntity
)
throws
Exception
{
return
dao
.
doUpdateRecord
(
processInstanceId
,
leaveRecordEntity
);
AttendanceLeaveRecordEntity
recordEntity
=
this
.
selectOne
(
new
AttendanceLeaveRecordQuery
().
remark
(
processInstanceId
));
if
(
ObjectUtils
.
isEmpty
(
recordEntity
))
{
leaveRecordEntity
.
setCreateTime
(
new
Date
());
leaveRecordEntity
.
setCreateUserId
(
1L
);
this
.
save
(
leaveRecordEntity
);
}
else
{
leaveRecordEntity
.
setId
(
recordEntity
.
getId
());
leaveRecordEntity
.
setUpdateUserId
(
1L
);
leaveRecordEntity
.
setUpdateTime
(
new
Date
());
this
.
update
(
leaveRecordEntity
);
}
return
leaveRecordEntity
;
}
}
}
}
\ No newline at end of file
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