Commit cb1032c8 by songyinghui

feature: 加锁前置

parent e8429875
...@@ -49,6 +49,7 @@ public class InteractRecordMessageService { ...@@ -49,6 +49,7 @@ public class InteractRecordMessageService {
// 参数是否完整 // 参数是否完整
// 根据businessId clerkId memberId materialId 构建唯一标识key // 根据businessId clerkId memberId materialId 构建唯一标识key
String recordKey = context.buildRecordKey(); String recordKey = context.buildRecordKey();
RedisUtil.lock(recordKey, 3L, TimeUnit.SECONDS, 2L);
// 根据key 查询是否存在记录 // 根据key 查询是否存在记录
InteractRecordBO interactRecordBO = null; InteractRecordBO interactRecordBO = null;
if (MaterialInteractRecordEventType.ORDER.getCode().equals(interactRecordMessageBO.getEventType())) { if (MaterialInteractRecordEventType.ORDER.getCode().equals(interactRecordMessageBO.getEventType())) {
...@@ -65,7 +66,6 @@ public class InteractRecordMessageService { ...@@ -65,7 +66,6 @@ public class InteractRecordMessageService {
interactRecordBO = interactRecordService.queryWithInteractInfo(interactRecordMessageBO.getEnterpriseId(), context.buildRecordKeyWithUnionId()); interactRecordBO = interactRecordService.queryWithInteractInfo(interactRecordMessageBO.getEnterpriseId(), context.buildRecordKeyWithUnionId());
} }
} }
RedisUtil.lock(recordKey, 3L, TimeUnit.SECONDS, 2L);
try { try {
if (interactRecordBO == null) { if (interactRecordBO == null) {
if (interactRecordMessageBO.getChannelSource() == null if (interactRecordMessageBO.getChannelSource() == null
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment