@Resource
This commit is contained in:
@@ -76,7 +76,7 @@ public class IntentAgreementServiceImpl extends LineFlowService implements Inten
|
||||
AliyunService aliyunService;
|
||||
|
||||
@Resource
|
||||
private StringRedisTemplate redisTemplate;
|
||||
private StringRedisTemplate stringRedisTemplate;
|
||||
|
||||
|
||||
@Override
|
||||
@@ -209,7 +209,7 @@ public class IntentAgreementServiceImpl extends LineFlowService implements Inten
|
||||
String lockValue = UUID.randomUUID().toString();
|
||||
boolean acquired = false;
|
||||
try {
|
||||
acquired = redisTemplate.opsForValue().setIfAbsent(lockKey, lockValue, 10, TimeUnit.SECONDS);
|
||||
acquired = stringRedisTemplate.opsForValue().setIfAbsent(lockKey, lockValue, 10, TimeUnit.SECONDS);
|
||||
if (Boolean.TRUE.equals(acquired)) {
|
||||
Map<String, Object> requestMap = new HashMap<>();
|
||||
fillSignatureInfo(requestMap);
|
||||
@@ -236,9 +236,9 @@ public class IntentAgreementServiceImpl extends LineFlowService implements Inten
|
||||
}
|
||||
}finally {
|
||||
if (Boolean.TRUE.equals(acquired)) {
|
||||
String currentValue = redisTemplate.opsForValue().get(lockKey);
|
||||
String currentValue = stringRedisTemplate.opsForValue().get(lockKey);
|
||||
if (lockValue.equals(currentValue)) {
|
||||
redisTemplate.delete(lockKey);
|
||||
stringRedisTemplate.delete(lockKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ public class SignFranchiseServiceImpl implements SignFranchiseService, AuditResu
|
||||
|
||||
|
||||
@Resource
|
||||
private StringRedisTemplate redisTemplate;
|
||||
private StringRedisTemplate stringRedisTemplate;
|
||||
|
||||
|
||||
@Override
|
||||
@@ -148,7 +148,7 @@ public class SignFranchiseServiceImpl implements SignFranchiseService, AuditResu
|
||||
boolean acquired = false;
|
||||
try {
|
||||
//10s过期
|
||||
acquired = redisTemplate.opsForValue().setIfAbsent(lockKey, lockValue, 10, TimeUnit.SECONDS);
|
||||
acquired = stringRedisTemplate.opsForValue().setIfAbsent(lockKey, lockValue, 10, TimeUnit.SECONDS);
|
||||
if (Boolean.TRUE.equals(acquired)) {
|
||||
SignFranchiseDO signFranchiseDO = request.toSignFranchiseDO();
|
||||
if (Objects.isNull(request.getId())) {
|
||||
@@ -174,9 +174,9 @@ public class SignFranchiseServiceImpl implements SignFranchiseService, AuditResu
|
||||
|
||||
}finally {
|
||||
if (Boolean.TRUE.equals(acquired)) {
|
||||
String currentValue = redisTemplate.opsForValue().get(lockKey);
|
||||
String currentValue = stringRedisTemplate.opsForValue().get(lockKey);
|
||||
if (lockValue.equals(currentValue)) {
|
||||
redisTemplate.delete(lockKey);
|
||||
stringRedisTemplate.delete(lockKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ import com.cool.store.utils.RedisUtilPool;
|
||||
import com.cool.store.utils.poi.StringUtils;
|
||||
import com.cool.store.utils.poi.constant.Constants;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -87,7 +88,7 @@ public class SysStoreAppServiceImpl implements SysStoreAppService, AuditResultSe
|
||||
PointDetailInfoMapper pointDetailInfoMapper;
|
||||
|
||||
@Resource
|
||||
private StringRedisTemplate redisTemplate;
|
||||
private StringRedisTemplate stringRedisTemplate;
|
||||
|
||||
@Resource
|
||||
RedisUtilPool redisUtilPool;
|
||||
@@ -103,7 +104,7 @@ public class SysStoreAppServiceImpl implements SysStoreAppService, AuditResultSe
|
||||
String lockValue = UUID.randomUUID().toString();
|
||||
boolean acquired = false;
|
||||
try {
|
||||
acquired = redisTemplate.opsForValue().setIfAbsent(lockKey, lockValue, 10, TimeUnit.SECONDS);
|
||||
acquired = stringRedisTemplate.opsForValue().setIfAbsent(lockKey, lockValue, 10, TimeUnit.SECONDS);
|
||||
if (Boolean.TRUE.equals(acquired)) {
|
||||
//1.操作数据库
|
||||
SystemBuildingShopDO systemBuildingShopDO = SystemBuildingShopDO.convertToSystemBuildingShopDO(request);
|
||||
@@ -125,9 +126,9 @@ public class SysStoreAppServiceImpl implements SysStoreAppService, AuditResultSe
|
||||
}
|
||||
}finally {
|
||||
if (Boolean.TRUE.equals(acquired)) {
|
||||
String currentValue = redisTemplate.opsForValue().get(lockKey);
|
||||
String currentValue = stringRedisTemplate.opsForValue().get(lockKey);
|
||||
if (lockValue.equals(currentValue)) {
|
||||
redisTemplate.delete(lockKey);
|
||||
stringRedisTemplate.delete(lockKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user