Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
liuxu0511
jeepay
提交
0b9a27b3
jeepay
项目概览
liuxu0511
/
jeepay
与 Fork 源项目一致
Fork自
计全科技 / jeepay
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
jeepay
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
0b9a27b3
编写于
6月 21, 2021
作者:
terrfly
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
将最大通知次数放置到DB, 完成商户消息重发功能
上级
97725978
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
102 addition
and
4 deletion
+102
-4
docs/sql/init.sql
docs/sql/init.sql
+2
-0
jeepay-core/src/main/java/com/jeequan/jeepay/core/entity/MchNotifyRecord.java
.../java/com/jeequan/jeepay/core/entity/MchNotifyRecord.java
+5
-0
jeepay-manager/src/main/java/com/jeequan/jeepay/mgr/ctrl/order/MchNotifyController.java
...om/jeequan/jeepay/mgr/ctrl/order/MchNotifyController.java
+25
-0
jeepay-manager/src/main/java/com/jeequan/jeepay/mgr/mq/queue/MqQueue4PayOrderMchNotify.java
...eequan/jeepay/mgr/mq/queue/MqQueue4PayOrderMchNotify.java
+47
-0
jeepay-payment/src/main/java/com/jeequan/jeepay/pay/mq/queue/MqQueue4PayOrderMchNotify.java
...eequan/jeepay/pay/mq/queue/MqQueue4PayOrderMchNotify.java
+4
-4
jeepay-service/src/main/java/com/jeequan/jeepay/service/mapper/MchNotifyRecordMapper.java
.../jeequan/jeepay/service/mapper/MchNotifyRecordMapper.java
+9
-0
jeepay-service/src/main/java/com/jeequan/jeepay/service/mapper/MchNotifyRecordMapper.xml
...m/jeequan/jeepay/service/mapper/MchNotifyRecordMapper.xml
+10
-0
未找到文件。
docs/sql/init.sql
浏览文件 @
0b9a27b3
...
...
@@ -315,6 +315,7 @@ CREATE TABLE `t_mch_notify_record` (
`notify_url`
TEXT
NOT
NULL
COMMENT
'通知地址'
,
`res_result`
TEXT
DEFAULT
NULL
COMMENT
'通知响应结果'
,
`notify_count`
INT
(
11
)
NOT
NULL
DEFAULT
'0'
COMMENT
'通知次数'
,
`notify_count_limit`
INT
(
11
)
NOT
NULL
DEFAULT
'6'
COMMENT
'最大通知次数, 默认6次'
,
`state`
TINYINT
(
6
)
NOT
NULL
DEFAULT
'1'
COMMENT
'通知状态,1-通知中,2-通知成功,3-通知失败'
,
`last_notify_time`
DATETIME
DEFAULT
NULL
COMMENT
'最后一次通知时间'
,
`created_at`
TIMESTAMP
(
6
)
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
(
6
)
COMMENT
'创建时间'
,
...
...
@@ -440,6 +441,7 @@ insert into t_sys_entitlement values('ENT_ORDER', '订单管理', 'transaction',
insert
into
t_sys_entitlement
values
(
'ENT_MCH_NOTIFY'
,
'商户通知'
,
'notification'
,
'/notify'
,
'MchNotifyListPage'
,
'ML'
,
0
,
1
,
'ENT_ORDER'
,
'30'
,
'MGR'
,
now
(),
now
());
insert
into
t_sys_entitlement
values
(
'ENT_NOTIFY_LIST'
,
'页面:商户通知列表'
,
'no-icon'
,
''
,
''
,
'PB'
,
0
,
1
,
'ENT_MCH_NOTIFY'
,
'0'
,
'MGR'
,
now
(),
now
());
insert
into
t_sys_entitlement
values
(
'ENT_MCH_NOTIFY_VIEW'
,
'按钮:详情'
,
'no-icon'
,
''
,
''
,
'PB'
,
0
,
1
,
'ENT_MCH_NOTIFY'
,
'0'
,
'MGR'
,
now
(),
now
());
insert
into
t_sys_entitlement
values
(
'ENT_MCH_NOTIFY_RESEND'
,
'按钮:重发通知'
,
'no-icon'
,
''
,
''
,
'PB'
,
0
,
1
,
'ENT_MCH_NOTIFY'
,
'0'
,
'MGR'
,
now
(),
now
());
-- 支付配置菜单
insert
into
t_sys_entitlement
values
(
'ENT_PC'
,
'支付配置'
,
'file-done'
,
''
,
'RouteView'
,
'ML'
,
0
,
1
,
'ROOT'
,
'60'
,
'MGR'
,
now
(),
now
());
...
...
jeepay-core/src/main/java/com/jeequan/jeepay/core/entity/MchNotifyRecord.java
浏览文件 @
0b9a27b3
...
...
@@ -108,6 +108,11 @@ public class MchNotifyRecord extends BaseModel implements Serializable {
*/
private
Integer
notifyCount
;
/**
* 最大通知次数, 默认6次
*/
private
Integer
notifyCountLimit
;
/**
* 通知状态,1-通知中,2-通知成功,3-通知失败
*/
...
...
jeepay-manager/src/main/java/com/jeequan/jeepay/mgr/ctrl/order/MchNotifyController.java
浏览文件 @
0b9a27b3
...
...
@@ -20,8 +20,10 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.jeequan.jeepay.core.constants.ApiCodeEnum
;
import
com.jeequan.jeepay.core.entity.MchNotifyRecord
;
import
com.jeequan.jeepay.core.exception.BizException
;
import
com.jeequan.jeepay.core.model.ApiRes
;
import
com.jeequan.jeepay.mgr.ctrl.CommonCtrl
;
import
com.jeequan.jeepay.mgr.mq.queue.MqQueue4PayOrderMchNotify
;
import
com.jeequan.jeepay.service.impl.MchNotifyRecordService
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -43,6 +45,7 @@ import org.springframework.web.bind.annotation.RestController;
public
class
MchNotifyController
extends
CommonCtrl
{
@Autowired
private
MchNotifyRecordService
mchNotifyService
;
@Autowired
private
MqQueue4PayOrderMchNotify
mqQueue4PayOrderMchNotify
;
/**
* @author: pangxiaoyu
...
...
@@ -86,4 +89,26 @@ public class MchNotifyController extends CommonCtrl {
if
(
mchNotify
==
null
)
return
ApiRes
.
fail
(
ApiCodeEnum
.
SYS_OPERATION_FAIL_SELETE
);
return
ApiRes
.
ok
(
mchNotify
);
}
/*
* 功能描述: 商户通知重发操作
* @Author: terrfly
* @Date: 2021/6/21 17:41
*/
@PreAuthorize
(
"hasAuthority('ENT_MCH_NOTIFY_RESEND')"
)
@RequestMapping
(
value
=
"resend/{notifyId}"
,
method
=
RequestMethod
.
POST
)
public
ApiRes
resend
(
@PathVariable
(
"notifyId"
)
Long
notifyId
)
{
MchNotifyRecord
mchNotify
=
mchNotifyService
.
getById
(
notifyId
);
if
(
mchNotify
==
null
)
return
ApiRes
.
fail
(
ApiCodeEnum
.
SYS_OPERATION_FAIL_SELETE
);
if
(
mchNotify
.
getState
()
!=
MchNotifyRecord
.
STATE_FAIL
)
throw
new
BizException
(
"请选择失败的通知记录"
);
//更新通知中
mchNotifyService
.
getBaseMapper
().
updateIngAndAddNotifyCountLimit
(
notifyId
);
//调起MQ重发
mqQueue4PayOrderMchNotify
.
send
(
notifyId
);
return
ApiRes
.
ok
(
mchNotify
);
}
}
jeepay-manager/src/main/java/com/jeequan/jeepay/mgr/mq/queue/MqQueue4PayOrderMchNotify.java
0 → 100644
浏览文件 @
0b9a27b3
/*
* Copyright (c) 2021-2031, 河北计全科技有限公司 (https://www.jeequan.com & jeequan@126.com).
* <p>
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.gnu.org/licenses/lgpl.html
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
com.jeequan.jeepay.mgr.mq.queue
;
import
com.jeequan.jeepay.core.constants.CS
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.activemq.command.ActiveMQQueue
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.jms.core.JmsTemplate
;
import
org.springframework.stereotype.Component
;
/**
* 商户订单回调MQ通知
*
* @author terrfly
* @site https://www.jeepay.vip
* @date 2021/6/21 18:03
*/
@Slf4j
@Component
public
class
MqQueue4PayOrderMchNotify
extends
ActiveMQQueue
{
@Autowired
private
JmsTemplate
jmsTemplate
;
public
MqQueue4PayOrderMchNotify
(){
super
(
CS
.
MQ
.
QUEUE_PAYORDER_MCH_NOTIFY
);
}
/** 发送MQ消息 **/
public
void
send
(
Long
notifyId
)
{
this
.
jmsTemplate
.
convertAndSend
(
this
,
notifyId
+
""
);
}
}
jeepay-payment/src/main/java/com/jeequan/jeepay/pay/mq/queue/MqQueue4PayOrderMchNotify.java
浏览文件 @
0b9a27b3
...
...
@@ -39,7 +39,7 @@ import javax.jms.TextMessage;
/*
* 商户订单回调MQ通知
*
*
* @author terrfly
* @site https://www.jeepay.vip
* @date 2021/6/8 17:34
...
...
@@ -96,7 +96,7 @@ public class MqQueue4PayOrderMchNotify {
log
.
info
(
"查询通知记录不存在或状态不是通知中"
);
return
;
}
if
(
record
.
getNotifyCount
()
>=
6
){
if
(
record
.
getNotifyCount
()
>=
record
.
getNotifyCountLimit
()
){
log
.
info
(
"已达到最大发送次数"
);
return
;
}
...
...
@@ -122,8 +122,8 @@ public class MqQueue4PayOrderMchNotify {
return
;
}
//
响应结果为异常
if
(
currentCount
>=
6
){
//
通知次数 >= 最大通知次数时, 更新响应结果为异常, 不在继续延迟发送消息
if
(
currentCount
>=
record
.
getNotifyCountLimit
()
){
mchNotifyRecordService
.
updateNotifyResult
(
notifyId
,
MchNotifyRecord
.
STATE_FAIL
,
res
);
return
;
}
...
...
jeepay-service/src/main/java/com/jeequan/jeepay/service/mapper/MchNotifyRecordMapper.java
浏览文件 @
0b9a27b3
...
...
@@ -30,4 +30,13 @@ import org.apache.ibatis.annotations.Param;
public
interface
MchNotifyRecordMapper
extends
BaseMapper
<
MchNotifyRecord
>
{
Integer
updateNotifyResult
(
@Param
(
"notifyId"
)
Long
notifyId
,
@Param
(
"state"
)
Byte
state
,
@Param
(
"resResult"
)
String
resResult
);
/*
* 功能描述: 更改为通知中 & 增加允许重发通知次数
* @param notifyId
* @Author: terrfly
* @Date: 2021/6/21 17:38
*/
Integer
updateIngAndAddNotifyCountLimit
(
@Param
(
"notifyId"
)
Long
notifyId
);
}
jeepay-service/src/main/java/com/jeequan/jeepay/service/mapper/MchNotifyRecordMapper.xml
浏览文件 @
0b9a27b3
...
...
@@ -14,6 +14,7 @@
<result
column=
"notify_url"
property=
"notifyUrl"
/>
<result
column=
"res_result"
property=
"resResult"
/>
<result
column=
"notify_count"
property=
"notifyCount"
/>
<result
column=
"notify_count_limit"
property=
"notifyCountLimit"
/>
<result
column=
"state"
property=
"state"
/>
<result
column=
"last_notify_time"
property=
"lastNotifyTime"
/>
<result
column=
"created_at"
property=
"createdAt"
/>
...
...
@@ -32,4 +33,13 @@
</update>
<!-- 更改为通知中 & 增加允许重发通知次数 -->
<update
id=
"updateIngAndAddNotifyCountLimit"
>
update t_mch_notify_record
set notify_count_limit = notify_count_limit + 1, state = 1
where notify_id = #{notifyId}
</update>
</mapper>
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录