|
|
@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.cyksj.common.constant.Constant;
|
|
|
import com.cyksj.mapper.AccountMapper;
|
|
|
import com.cyksj.model.entity.Account;
|
|
|
+import com.cyksj.redis.RedisService;
|
|
|
import com.cyksj.service.mange.AccountCommonService;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
@@ -21,6 +22,8 @@ public class AccountCommonServiceImpl implements AccountCommonService {
|
|
|
|
|
|
private final AccountMapper accountMapper;
|
|
|
|
|
|
+ private final RedisService redisService;
|
|
|
+
|
|
|
@Override
|
|
|
public Boolean checkIsDupAccount(Long goodsId, String account) {
|
|
|
LambdaQueryWrapper<Account> wrapper = Wrappers.lambdaQuery(Account.class)
|
|
|
@@ -32,6 +35,10 @@ public class AccountCommonServiceImpl implements AccountCommonService {
|
|
|
}
|
|
|
int count = accountMapper.selectCount(wrapper);
|
|
|
if (count > 0) return true;
|
|
|
+ boolean b = redisService.setNx(RedisService.key.DUP_GOODS_ACCOUNT_KEY.getNameFormat(goodsId, account), goodsId, RedisService.key.DUP_GOODS_ACCOUNT_KEY.getTimeout());
|
|
|
+ if (!b) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
return false;
|
|
|
}
|
|
|
}
|