This commit is contained in:
guohb
2024-06-04 16:28:08 +08:00
parent 148ce575e8
commit d114275c7e
6 changed files with 20 additions and 7 deletions

View File

@@ -2,6 +2,7 @@ package com.cool.store.service.impl;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSONObject;
import com.cool.store.constants.CommonConstants;
import com.cool.store.context.LoginUserInfo;
import com.cool.store.dao.EnterpriseUserDAO;
import com.cool.store.dao.RegionDao;
@@ -96,7 +97,7 @@ public class ApplyLicenseServiceImpl implements ApplyLicenseService {
String lockKey = "submitLicense:" + request.getShopId();
String lockValue = UUID.randomUUID().toString();
boolean acquired = Boolean.FALSE;
acquired = redisUtilPool.setNxExpire(lockKey, lockValue, 10);
acquired = redisUtilPool.setNxExpire(lockKey, lockValue, CommonConstants.TEN_SECONDS);
if (!acquired) {
throw new ServiceException(ErrorCodeEnum.DUPLICATE_SUBMISSION);
}

View File

@@ -1,6 +1,7 @@
package com.cool.store.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.cool.store.constants.CommonConstants;
import com.cool.store.context.LoginUserInfo;
import com.cool.store.dao.LineInfoDAO;
import com.cool.store.entity.*;
@@ -203,7 +204,7 @@ public class IntentAgreementServiceImpl extends LineFlowService implements Inten
String lockValue = UUID.randomUUID().toString();
boolean acquired = false;
try {
acquired = redisUtilPool.setNxExpire(lockKey, lockValue, 10);
acquired = redisUtilPool.setNxExpire(lockKey, lockValue, CommonConstants.TEN_SECONDS);
if (Boolean.TRUE.equals(acquired)) {
Map<String, Object> requestMap = new HashMap<>();
fillSignatureInfo(requestMap);
@@ -269,7 +270,7 @@ public class IntentAgreementServiceImpl extends LineFlowService implements Inten
String lockValue = UUID.randomUUID().toString();
boolean acquired = false;
try {
acquired = redisUtilPool.setNxExpire(lockKey, lockValue, 10);
acquired = redisUtilPool.setNxExpire(lockKey, lockValue, CommonConstants.TEN_SECONDS);
if (Boolean.TRUE.equals(acquired)) {
Map<String, Object> requestMap = new HashMap<>();
fillSignatureInfo(requestMap);

View File

@@ -759,7 +759,7 @@ public class PointServiceImpl implements PointService {
public Integer lineSelectPoint(SelectPointRequest request) {
Long pointId = request.getPointId(), shopId = request.getShopId(), lineId = request.getLineId();
String lockKey = MessageFormat.format(POINT_SELECT_KEY, enterpriseId, pointId);
if(!redisUtilPool.setNxExpire(lockKey, JSONObject.toJSONString(request), 30)){
if(!redisUtilPool.setNxExpire(lockKey, JSONObject.toJSONString(request), 30*1000)){
throw new ServiceException(ErrorCodeEnum.POINT_IS_LOCK);
}
try {

View File

@@ -2,6 +2,7 @@ package com.cool.store.service.impl;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSONObject;
import com.cool.store.constants.CommonConstants;
import com.cool.store.context.LoginUserInfo;
import com.cool.store.dao.ShopStageInfoDAO;
import com.cool.store.entity.*;
@@ -97,7 +98,7 @@ public class SysStoreAppServiceImpl implements SysStoreAppService, AuditResultSe
String lockValue = UUID.randomUUID().toString();
boolean acquired = false;
try {
acquired = redisUtilPool.setNxExpire(lockKey, lockValue, 10);
acquired = redisUtilPool.setNxExpire(lockKey, lockValue, CommonConstants.TEN_SECONDS);
if (Boolean.TRUE.equals(acquired)) {
//1.操作数据库
SystemBuildingShopDO systemBuildingShopDO = SystemBuildingShopDO.convertToSystemBuildingShopDO(request);