Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
dj
/
rpc-staff
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 63b5f3d0
authored
Jan 21, 2026
by
叶立庆
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
发送企微应用消息优化
1 parent
45351223
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
12 deletions
rpc-dj-staff/src/main/java/cn/com/glsx/dj/staff/job/StaffMonthSalaryJob.java
rpc-dj-staff/src/main/java/cn/com/glsx/dj/staff/job/StaffMonthSalaryJob.java
View file @
63b5f3d
...
@@ -79,8 +79,12 @@ public class StaffMonthSalaryJob implements SimpleJob {
...
@@ -79,8 +79,12 @@ public class StaffMonthSalaryJob implements SimpleJob {
// 发送企微消息
// 发送企微消息
executor
.
execute
(()
->
{
executor
.
execute
(()
->
{
// 保存发送信息
// 保存发送信息
Integer
id
=
saveSendMsg
(
monthSalary
);
try
{
sendMessage
(
monthSalary
,
id
);
StaffMonthSalarySlipSend
slipSend
=
saveSendMsg
(
monthSalary
);
sendMessage
(
monthSalary
,
slipSend
);
}
catch
(
Exception
e
)
{
log
.
error
(
"员工:{},手机号:{} 发送企微消息异常:{}"
,
staffBaseInfo
.
getStaffName
(),
staffBaseInfo
.
getStaffPhone
(),
e
.
getMessage
(),
e
);
}
});
});
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
@@ -95,7 +99,7 @@ public class StaffMonthSalaryJob implements SimpleJob {
...
@@ -95,7 +99,7 @@ public class StaffMonthSalaryJob implements SimpleJob {
}
}
}
}
private
Integer
saveSendMsg
(
StaffMonthSalarySlip
monthSalary
)
{
private
StaffMonthSalarySlipSend
saveSendMsg
(
StaffMonthSalarySlip
monthSalary
)
{
StaffMonthSalarySlipSend
staffMonthSalarySlipSend
=
new
StaffMonthSalarySlipSend
();
StaffMonthSalarySlipSend
staffMonthSalarySlipSend
=
new
StaffMonthSalarySlipSend
();
staffMonthSalarySlipSend
.
setStaffName
(
monthSalary
.
getStaffName
());
staffMonthSalarySlipSend
.
setStaffName
(
monthSalary
.
getStaffName
());
staffMonthSalarySlipSend
.
setStaffPhone
(
monthSalary
.
getStaffPhone
());
staffMonthSalarySlipSend
.
setStaffPhone
(
monthSalary
.
getStaffPhone
());
...
@@ -125,7 +129,7 @@ public class StaffMonthSalaryJob implements SimpleJob {
...
@@ -125,7 +129,7 @@ public class StaffMonthSalaryJob implements SimpleJob {
// 封装入职日期
// 封装入职日期
staffMonthSalarySlipSend
.
setEntryDate
(
buildEntryDate
(
monthSalary
));
staffMonthSalarySlipSend
.
setEntryDate
(
buildEntryDate
(
monthSalary
));
staffMonthSalarySlipSendMapper
.
insertUseGeneratedKeys
(
staffMonthSalarySlipSend
);
staffMonthSalarySlipSendMapper
.
insertUseGeneratedKeys
(
staffMonthSalarySlipSend
);
return
staffMonthSalarySlipSend
.
getId
()
;
return
staffMonthSalarySlipSend
;
}
}
public
static
String
parsePerformanceLevelString
(
Integer
performanceLevel
)
{
public
static
String
parsePerformanceLevelString
(
Integer
performanceLevel
)
{
...
@@ -171,15 +175,15 @@ public class StaffMonthSalaryJob implements SimpleJob {
...
@@ -171,15 +175,15 @@ public class StaffMonthSalaryJob implements SimpleJob {
* 发送
* 发送
*
*
* @param monthSalary 工资条
* @param monthSalary 工资条
* @param
id 消息id
* @param
slipSend 消息
*/
*/
private
void
sendMessage
(
StaffMonthSalarySlip
monthSalary
,
Integer
i
d
)
{
private
void
sendMessage
(
StaffMonthSalarySlip
monthSalary
,
StaffMonthSalarySlipSend
slipSen
d
)
{
log
.
info
(
"发送员工:{},手机号:{} 工资计算结果"
,
monthSalary
.
getStaffName
(),
monthSalary
.
getStaffPhone
());
log
.
info
(
"发送员工:{},手机号:{} 工资计算结果"
,
monthSalary
.
getStaffName
(),
monthSalary
.
getStaffPhone
());
// 获取企微员工标识门店号
// 获取企微员工标识门店号
Integer
merchantId
=
env
.
getProperty
(
"staff.month.salary.send.qw.notice.merchantId"
,
Integer
.
class
,
44202977
);
Integer
merchantId
=
env
.
getProperty
(
"staff.month.salary.send.qw.notice.merchantId"
,
Integer
.
class
,
44202977
);
// 发送自建应用消息对应(wechat-build-server)配置门店号
// 发送自建应用消息对应(wechat-build-server)配置门店号
Integer
sendConfigMerchantId
=
env
.
getProperty
(
"staff.month.salary.send.qw.config.merchantId"
,
Integer
.
class
,
442029771
);
Integer
sendConfigMerchantId
=
env
.
getProperty
(
"staff.month.salary.send.qw.config.merchantId"
,
Integer
.
class
,
442029771
);
String
agentId
=
env
.
getProperty
(
"staff.month.salary.send.qw.notice.agentId"
,
String
.
class
,
"1000024"
);
String
agentId
=
env
.
getProperty
(
"staff.month.salary.send.qw.notice.agentId"
,
String
.
class
,
"1000024"
);
String
titleEnv
=
env
.
getProperty
(
"staff.month.salary.send.qw.notice.title"
,
String
.
class
,
"%s工资条系统数据"
);
String
titleEnv
=
env
.
getProperty
(
"staff.month.salary.send.qw.notice.title"
,
String
.
class
,
"%s工资条系统数据"
);
String
descriptionEvn
=
env
.
getProperty
(
"staff.month.salary.send.qw.notice.description"
,
String
.
class
,
"您好!感谢您这一月的辛勤工作,以下是您%s月的系统数据工资条,请查收!如有疑问请联系您的管辖上级处理。"
);
String
descriptionEvn
=
env
.
getProperty
(
"staff.month.salary.send.qw.notice.description"
,
String
.
class
,
"您好!感谢您这一月的辛勤工作,以下是您%s月的系统数据工资条,请查收!如有疑问请联系您的管辖上级处理。"
);
String
urlEvn
=
env
.
getProperty
(
"staff.month.salary.send.qw.notice.url"
,
String
.
class
);
String
urlEvn
=
env
.
getProperty
(
"staff.month.salary.send.qw.notice.url"
,
String
.
class
);
...
@@ -187,7 +191,7 @@ public class StaffMonthSalaryJob implements SimpleJob {
...
@@ -187,7 +191,7 @@ public class StaffMonthSalaryJob implements SimpleJob {
if
(
StringUtils
.
isBlank
(
userId
))
{
if
(
StringUtils
.
isBlank
(
userId
))
{
log
.
info
(
"员工:{},手机号:{} 获取企微员工标识失败"
,
monthSalary
.
getStaffName
(),
monthSalary
.
getStaffPhone
());
log
.
info
(
"员工:{},手机号:{} 获取企微员工标识失败"
,
monthSalary
.
getStaffName
(),
monthSalary
.
getStaffPhone
());
StaffMonthSalarySlipSend
staffMonthSalarySlipSend
=
new
StaffMonthSalarySlipSend
();
StaffMonthSalarySlipSend
staffMonthSalarySlipSend
=
new
StaffMonthSalarySlipSend
();
staffMonthSalarySlipSend
.
setId
(
id
);
staffMonthSalarySlipSend
.
setId
(
slipSend
.
getId
()
);
staffMonthSalarySlipSend
.
setStatus
(
3
);
staffMonthSalarySlipSend
.
setStatus
(
3
);
staffMonthSalarySlipSend
.
setErrMsg
(
"获取企微员工标识失败"
);
staffMonthSalarySlipSend
.
setErrMsg
(
"获取企微员工标识失败"
);
staffMonthSalarySlipSendMapper
.
updateByPrimaryKeySelective
(
staffMonthSalarySlipSend
);
staffMonthSalarySlipSendMapper
.
updateByPrimaryKeySelective
(
staffMonthSalarySlipSend
);
...
@@ -203,7 +207,7 @@ public class StaffMonthSalaryJob implements SimpleJob {
...
@@ -203,7 +207,7 @@ public class StaffMonthSalaryJob implements SimpleJob {
WorkWechatTextCardMessageDTO
textCard
=
new
WorkWechatTextCardMessageDTO
();
WorkWechatTextCardMessageDTO
textCard
=
new
WorkWechatTextCardMessageDTO
();
textCard
.
setTitle
(
title
);
textCard
.
setTitle
(
title
);
textCard
.
setDescription
(
description
);
textCard
.
setDescription
(
description
);
textCard
.
setUrl
(
urlEvn
);
textCard
.
setUrl
(
urlEvn
+
"?uuid="
+
slipSend
.
getUuid
()
);
requestDTO
.
setTextCard
(
textCard
);
requestDTO
.
setTextCard
(
textCard
);
SendWorkWechatMessageResponseDTO
responseDTO
=
null
;
SendWorkWechatMessageResponseDTO
responseDTO
=
null
;
try
{
try
{
...
@@ -214,15 +218,15 @@ public class StaffMonthSalaryJob implements SimpleJob {
...
@@ -214,15 +218,15 @@ public class StaffMonthSalaryJob implements SimpleJob {
if
(
responseDTO
!=
null
&&
responseDTO
.
isSuccess
())
{
if
(
responseDTO
!=
null
&&
responseDTO
.
isSuccess
())
{
log
.
info
(
"员工:{},手机号:{} 获取企微员工标识成功"
,
monthSalary
.
getStaffName
(),
monthSalary
.
getStaffPhone
());
log
.
info
(
"员工:{},手机号:{} 获取企微员工标识成功"
,
monthSalary
.
getStaffName
(),
monthSalary
.
getStaffPhone
());
StaffMonthSalarySlipSend
staffMonthSalarySlipSend
=
new
StaffMonthSalarySlipSend
();
StaffMonthSalarySlipSend
staffMonthSalarySlipSend
=
new
StaffMonthSalarySlipSend
();
staffMonthSalarySlipSend
.
setId
(
id
);
staffMonthSalarySlipSend
.
setId
(
slipSend
.
getId
()
);
staffMonthSalarySlipSend
.
setStatus
(
2
);
staffMonthSalarySlipSend
.
setStatus
(
2
);
staffMonthSalarySlipSendMapper
.
updateByPrimaryKeySelective
(
staffMonthSalarySlipSend
);
staffMonthSalarySlipSendMapper
.
updateByPrimaryKeySelective
(
staffMonthSalarySlipSend
);
}
else
{
}
else
{
log
.
info
(
"员工:{},手机号:{} 获取企微员工标识失败:{}"
,
monthSalary
.
getStaffName
(),
monthSalary
.
getStaffPhone
(),
JSON
.
toJSONString
(
responseDTO
));
log
.
info
(
"员工:{},手机号:{} 获取企微员工标识失败:{}"
,
monthSalary
.
getStaffName
(),
monthSalary
.
getStaffPhone
(),
JSON
.
toJSONString
(
responseDTO
));
StaffMonthSalarySlipSend
staffMonthSalarySlipSend
=
new
StaffMonthSalarySlipSend
();
StaffMonthSalarySlipSend
staffMonthSalarySlipSend
=
new
StaffMonthSalarySlipSend
();
staffMonthSalarySlipSend
.
setId
(
id
);
staffMonthSalarySlipSend
.
setId
(
slipSend
.
getId
()
);
staffMonthSalarySlipSend
.
setStatus
(
3
);
staffMonthSalarySlipSend
.
setStatus
(
3
);
staffMonthSalarySlipSend
.
setErrMsg
(
responseDTO
.
getErrMsg
()
);
staffMonthSalarySlipSend
.
setErrMsg
(
responseDTO
!=
null
?
responseDTO
.
getErrMsg
()
:
"发送企微应用消息异常"
);
staffMonthSalarySlipSendMapper
.
updateByPrimaryKeySelective
(
staffMonthSalarySlipSend
);
staffMonthSalarySlipSendMapper
.
updateByPrimaryKeySelective
(
staffMonthSalarySlipSend
);
}
}
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment