瀏覽代碼

手机号加密

xdd 5 天之前
父節點
當前提交
035362e3d0

+ 1 - 1
fs-service-system/src/main/java/com/fs/company/cache/ICompanyTagCacheService.java

@@ -6,7 +6,7 @@ import com.fs.company.dto.CompanyIdAndUserDTO;
 import java.util.Map;
 
 public interface ICompanyTagCacheService {
-    String findUserTagByUserId(Long userId);
+    String findUserTagByUserId(Long userId,Long companyUserId);
 
     Map<Long, CompanyTag> queryAllTagMap();
 }

+ 29 - 3
fs-service-system/src/main/java/com/fs/company/cache/impl/CompanyTagCacheServiceImpl.java

@@ -5,10 +5,13 @@ import com.fs.company.domain.CompanyTag;
 import com.fs.company.service.ICompanyTagService;
 import com.github.benmanes.caffeine.cache.Cache;
 import com.github.benmanes.caffeine.cache.Caffeine;
+import lombok.Data;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.io.Serializable;
 import java.util.Map;
+import java.util.Objects;
 import java.util.concurrent.TimeUnit;
 
 @Service
@@ -16,7 +19,7 @@ public class CompanyTagCacheServiceImpl implements ICompanyTagCacheService {
 
     @Autowired
     private ICompanyTagService companyTagService;
-    private static final Cache<Long,String> COMPANY_TAG_CACHE = Caffeine.newBuilder()
+    private static final Cache<TagConbKey,String> COMPANY_TAG_CACHE = Caffeine.newBuilder()
             .maximumSize(1000)
             .expireAfterWrite(5, TimeUnit.MINUTES)
             .build();
@@ -25,9 +28,32 @@ public class CompanyTagCacheServiceImpl implements ICompanyTagCacheService {
             .maximumSize(1000)
             .expireAfterWrite(5, TimeUnit.MINUTES)
             .build();
+
+
+    @Data
+    static class TagConbKey implements Serializable {
+        private Long userId;
+        private Long companyUserId;
+
+        @Override
+        public boolean equals(Object o) {
+            if (this == o) return true;
+            if (o == null || getClass() != o.getClass()) return false;
+            TagConbKey that = (TagConbKey) o;
+            return Objects.equals(userId, that.userId) && Objects.equals(companyUserId, that.companyUserId);
+        }
+
+        @Override
+        public int hashCode() {
+            return Objects.hash(userId, companyUserId);
+        }
+    }
     @Override
-    public String findUserTagByUserId(Long key) {
-        return COMPANY_TAG_CACHE.get(key,e-> companyTagService.findUserTagByUserId(key));
+    public String findUserTagByUserId(Long userId,Long companyUserId) {
+        TagConbKey tagConbKey = new TagConbKey();
+
+        return COMPANY_TAG_CACHE.get(tagConbKey,e->
+                companyTagService.findUserTagByUserId(tagConbKey.getUserId(),tagConbKey.getCompanyUserId()));
     }
 
     @Override

+ 1 - 1
fs-service-system/src/main/java/com/fs/company/mapper/CompanyTagMapper.java

@@ -78,7 +78,7 @@ public interface CompanyTagMapper
      */
     List<CompanyTag> selectCompanyTagListByUserId(@Param("userId") Long userId);
 
-    String findUserTagByUserId(@Param("userId") Long userId);
+    String findUserTagByUserId(@Param("userId") Long userId,@Param("companyUserId") Long companyUserId);
     @MapKey("tagId")
     Map<Long,CompanyTag> queryAllTagMap();
 }

+ 1 - 1
fs-service-system/src/main/java/com/fs/company/service/ICompanyTagService.java

@@ -78,5 +78,5 @@ public interface ICompanyTagService
 
     Map<Long,CompanyTag> queryAllTagMap();
 
-    String findUserTagByUserId(Long key);
+    String findUserTagByUserId(Long userId,Long companyUserId);
 }

+ 2 - 2
fs-service-system/src/main/java/com/fs/company/service/impl/CompanyTagServiceImpl.java

@@ -125,7 +125,7 @@ public class CompanyTagServiceImpl implements ICompanyTagService
     }
 
     @Override
-    public String findUserTagByUserId(Long key) {
-        return companyTagMapper.findUserTagByUserId(key);
+    public String findUserTagByUserId(Long key,Long companyUserId) {
+        return companyTagMapper.findUserTagByUserId(key,companyUserId);
     }
 }

+ 7 - 3
fs-service-system/src/main/java/com/fs/store/service/impl/FsUserServiceImpl.java

@@ -10,6 +10,7 @@ import com.fs.common.core.domain.ResponseResult;
 import com.fs.common.core.page.TableDataInfo;
 import com.fs.common.utils.DateUtils;
 import com.fs.common.utils.DictUtils;
+import com.fs.common.utils.ParseUtils;
 import com.fs.common.utils.StringUtils;
 import com.fs.company.cache.ICompanyTagCacheService;
 import com.fs.company.cache.ICompanyUserCacheService;
@@ -517,6 +518,7 @@ public class FsUserServiceImpl implements IFsUserService
         }
 
         List<FsUserPageListVO> fsUserPageListVOS = fsUserMapper.selectFsUserPageListNew(param);
+        Map<Long, CompanyTag> tagMap = companyTagCacheService.queryAllTagMap();
         for (FsUserPageListVO item : fsUserPageListVOS) {
             if(item.getCompanyUserId() != null) {
                 String companyUserName = companyUserCacheService.selectCompanyUserNameUserById(item.getCompanyUserId());
@@ -524,6 +526,9 @@ public class FsUserServiceImpl implements IFsUserService
                     item.setCompanyUserNickName(companyUserName);
                 }
             }
+            if(item.getPhone() != null) {
+                item.setPhone(ParseUtils.parsePhone(item.getPhone()));
+            }
             if(item.getStatus() != null) {
                 String userStatus = DictUtils.getDictLabel("user_status", String.valueOf(item.getStatus()));
                 if(StringUtils.isNotBlank(userStatus)){
@@ -543,11 +548,10 @@ public class FsUserServiceImpl implements IFsUserService
                     item.setStopWatchDays(byUserId.getStopWatchDays());
                     item.setCompleteWatchDate(byUserId.getCompleteWatchDate());
                 }
-
-                String userTagByUserId = companyTagCacheService.findUserTagByUserId(item.getUserId());
+                String userTagByUserId = companyTagCacheService
+                        .findUserTagByUserId(item.getUserId(),item.getCompanyUserId());
                 if(StringUtils.isNotEmpty(userTagByUserId)) {
                     String[] split = userTagByUserId.split(",");
-                    Map<Long, CompanyTag> tagMap = companyTagCacheService.queryAllTagMap();
                     Set<String> tagNames = new HashSet<>();
                     for (String tag : split) {
                         if(StringUtils.isNotBlank(tag)) {

+ 1 - 1
fs-service-system/src/main/resources/mapper/company/CompanyTagMapper.xml

@@ -54,7 +54,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         where ctu.user_id = #{userId}
     </select>
     <select id="findUserTagByUserId" resultType="java.lang.String">
-        select tag_ids from company_tag_user where user_id = ${userId} limit 1
+        select tag_ids from company_tag_user where user_id = ${userId} and company_user_id=${companyUserId} limit 1
     </select>
     <resultMap id="companyTagMap" type="com.fs.company.domain.CompanyTag">
         <id column="tag_id" property="tagId" jdbcType="BIGINT" javaType="java.lang.Long"/>