yangdamao 8 godzin temu
rodzic
commit
0147f2dee5

+ 15 - 1
zhongzheng-framework/src/main/java/com/zhongzheng/framework/web/service/UserServiceImpl.java

@@ -464,7 +464,21 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
      */
     private List<UserVo> entity2UserVo(Collection<User> collection) {
         List<UserVo> voList = collection.stream()
-                .map(any -> BeanUtil.toBean(any, UserVo.class))
+                .map(any ->{
+                            UserVo vo = BeanUtil.toBean(any, UserVo.class);
+                            if (StringUtils.isNotBlank(vo.getIdCard())){
+                                //身份证号脱敏
+                                vo.setIdCardStr(IdCardUtils.maskIdCard(vo.getIdCard()));
+                            }
+
+                            if (StringUtils.isNotBlank(vo.getTelphone())){
+                                //手机号脱敏
+                                vo.setTelphoneStr(TelPhoneUtils.hideTelPhone(vo.getTelphone()));
+
+                            }
+                            return vo;
+                        }
+                       )
                 .collect(Collectors.toList());
         if (collection instanceof Page) {
             Page<User> page = (Page<User>) collection;

+ 17 - 4
zhongzheng-system/src/main/java/com/zhongzheng/modules/base/service/impl/UserProfileServiceImpl.java

@@ -20,9 +20,7 @@ import com.zhongzheng.common.core.domain.AjaxResult;
 import com.zhongzheng.common.core.domain.model.LoginUser;
 import com.zhongzheng.common.exception.CustomException;
 import com.zhongzheng.common.type.EncryptHandler;
-import com.zhongzheng.common.utils.DateUtils;
-import com.zhongzheng.common.utils.SecurityUtils;
-import com.zhongzheng.common.utils.ServletUtils;
+import com.zhongzheng.common.utils.*;
 import com.zhongzheng.common.utils.file.FileUtils;
 import com.zhongzheng.modules.alioss.bo.OssRequest;
 import com.zhongzheng.modules.alioss.service.impl.OssServiceImpl;
@@ -131,7 +129,22 @@ public class UserProfileServiceImpl extends ServiceImpl<UserProfileMapper, UserP
     @Override
     @DataScope(businessAlias = "cb")
     public List<UserProfileVo> queryList(UserProfileQueryBo bo) {
-        return baseMapper.selectUserProfile(bo);
+        List<UserProfileVo> userProfileVos = baseMapper.selectUserProfile(bo);
+        if (CollectionUtils.isNotEmpty(userProfileVos)) {
+            userProfileVos.forEach(vo -> {
+                if (StringUtils.isNotBlank(vo.getIdCard())){
+                    //身份证号脱敏
+                    vo.setIdCardStr(IdCardUtils.maskIdCard(vo.getIdCard()));
+                }
+
+                if (StringUtils.isNotBlank(vo.getTelphone())){
+                    //手机号脱敏
+                    vo.setTelphoneStr(TelPhoneUtils.hideTelPhone(vo.getTelphone()));
+
+                }
+            });
+        }
+        return userProfileVos;
     }
 
     @Override

+ 6 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/base/vo/UserProfileVo.java

@@ -118,4 +118,10 @@ public class UserProfileVo {
 
 	@ApiModelProperty("公司名称")
 	private String companyName;
+
+	@ApiModelProperty("身份证脱敏字段")
+	private String idCardStr;
+
+	@ApiModelProperty("手机号码脱敏字段")
+	private String telphoneStr;
 }

+ 12 - 3
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/service/impl/ClassGradeUserServiceImpl.java

@@ -23,9 +23,7 @@ import com.zhongzheng.common.core.redis.RedisCache;
 import com.zhongzheng.common.core.redis.RedisLockEntity;
 import com.zhongzheng.common.exception.CustomException;
 import com.zhongzheng.common.type.EncryptHandler;
-import com.zhongzheng.common.utils.DateUtils;
-import com.zhongzheng.common.utils.ServletUtils;
-import com.zhongzheng.common.utils.ToolsUtils;
+import com.zhongzheng.common.utils.*;
 import com.zhongzheng.common.utils.file.FileUtils;
 import com.zhongzheng.common.utils.http.HttpUtils;
 import com.zhongzheng.modules.alioss.service.OssService;
@@ -2422,6 +2420,17 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
                     }
                 }
             }
+
+            if (StringUtils.isNotBlank(classPeriodStudentVo.getIdCard())){
+                //身份证号脱敏
+                classPeriodStudentVo.setIdCardStr(IdCardUtils.maskIdCard(classPeriodStudentVo.getIdCard()));
+            }
+
+            if (StringUtils.isNotBlank(classPeriodStudentVo.getTelPhone())){
+                //手机号脱敏
+                classPeriodStudentVo.setTelphoneStr(TelPhoneUtils.hideTelPhone(classPeriodStudentVo.getTelPhone()));
+
+            }
         }
         return classPeriodStudentVos;
     }

+ 6 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/vo/ClassPeriodStudentVo.java

@@ -271,4 +271,10 @@ public class ClassPeriodStudentVo {
 
 	private String tenantName;
 
+	@ApiModelProperty("身份证脱敏字段")
+	private String idCardStr;
+
+	@ApiModelProperty("手机号码脱敏字段")
+	private String telphoneStr;
+
 }

+ 16 - 4
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/service/impl/UserSubscribeServiceImpl.java

@@ -20,9 +20,7 @@ import com.zhongzheng.common.core.domain.AjaxResult;
 import com.zhongzheng.common.core.redis.RedisCache;
 import com.zhongzheng.common.exception.CustomException;
 import com.zhongzheng.common.type.EncryptHandler;
-import com.zhongzheng.common.utils.DateUtils;
-import com.zhongzheng.common.utils.ServletUtils;
-import com.zhongzheng.common.utils.ToolsUtils;
+import com.zhongzheng.common.utils.*;
 import com.zhongzheng.common.utils.file.FileUtils;
 import com.zhongzheng.common.utils.http.HttpUtils;
 import com.zhongzheng.common.utils.poi.ExcelUtil;
@@ -993,6 +991,11 @@ public class UserSubscribeServiceImpl extends ServiceImpl<UserSubscribeMapper, U
                 item.setProjectName(projectType.getProjectName());
                 CourseBusiness business = iCourseBusinessService.getById(goods.getBusinessId());
                 item.setBusinessName(business.getBusinessName());
+                if (!StringUtils.isEmpty(item.getIdCard())){
+                    //身份证号脱敏
+                    item.setIdCardStr(IdCardUtils.maskIdCard(item.getIdCard()));
+                }
+
             });
         }
         return userSubscribeVos;
@@ -2139,7 +2142,16 @@ public class UserSubscribeServiceImpl extends ServiceImpl<UserSubscribeMapper, U
 
     @Override
     public List<UserSubscribeVo> listSubscribeByUser(UserSubscribeQueryBo bo) {
-        return baseMapper.listSubscribeByUser(bo);
+        List<UserSubscribeVo> userSubscribeVos = baseMapper.listSubscribeByUser(bo);
+        if (CollectionUtils.isNotEmpty(userSubscribeVos)){
+            userSubscribeVos.forEach(vo -> {
+                if (!StringUtils.isEmpty(vo.getIdCard())){
+                    //身份证号脱敏
+                    vo.setIdCardStr(IdCardUtils.maskIdCard(vo.getIdCard()));
+                }
+            });
+        }
+        return userSubscribeVos;
     }
 
     @Override

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/vo/UserSubscribeVo.java

@@ -33,6 +33,9 @@ public class UserSubscribeVo {
 	@ApiModelProperty("身份证号")
 	private String idCard;
 
+	@ApiModelProperty("身份证脱敏字段")
+	private String idCardStr;
+
 	/** 考试标题 */
 	@Excel(name = "考试标题")
 	@ApiModelProperty("考试标题")