|
|
@@ -1,8 +1,10 @@
|
|
|
package shop.alien.store.service.impl;
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import shop.alien.entity.store.LifeBlacklist;
|
|
|
@@ -16,10 +18,12 @@ import shop.alien.mapper.StoreImgMapper;
|
|
|
import shop.alien.mapper.StoreUserMapper;
|
|
|
import shop.alien.store.config.BaseRedisService;
|
|
|
import shop.alien.store.service.LifeBlacklistService;
|
|
|
+import shop.alien.util.common.JwtUtil;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Arrays;
|
|
|
import java.util.List;
|
|
|
+import java.util.Objects;
|
|
|
|
|
|
/**
|
|
|
* <p>
|
|
|
@@ -30,6 +34,7 @@ import java.util.List;
|
|
|
* @author ssk
|
|
|
* @since 2025-04-30
|
|
|
*/
|
|
|
+@Slf4j
|
|
|
@Service
|
|
|
@RequiredArgsConstructor
|
|
|
public class LifeBlacklistServiceImpl extends ServiceImpl<LifeBlacklistMapper, LifeBlacklist> implements LifeBlacklistService {
|
|
|
@@ -151,5 +156,19 @@ public class LifeBlacklistServiceImpl extends ServiceImpl<LifeBlacklistMapper, L
|
|
|
return lifeBlacklistMapper.deleteById(black.getId());
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public boolean hasBlackList(String otherSidePhoneId) throws Exception {
|
|
|
+ try {
|
|
|
+ String phoneId = Objects.requireNonNull(JwtUtil.getCurrentUserInfo()).getString("userType") + "_" + JwtUtil.getCurrentUserInfo().getString("phone");
|
|
|
+ LambdaQueryWrapper<LifeBlacklist> wrapper = new LambdaQueryWrapper<>();
|
|
|
+ wrapper.apply("((blocker_phone_id='" + otherSidePhoneId + "' and blocked_phone_id='" + phoneId + "')" +
|
|
|
+ " or (blocker_phone_id='" + phoneId + "' and blocked_phone_id='" + otherSidePhoneId + "'))");
|
|
|
+ return lifeBlacklistMapper.selectCount(wrapper) > 0;
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("LifeBlacklistServiceImpl.hasBlackList() error={}", e.getMessage());
|
|
|
+ throw new Exception(e);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
}
|