Kaynağa Gözat

Merge branch 'user_detail'

zoujiajian 1 yıl önce
ebeveyn
işleme
33e051d7f9

+ 15 - 1
netflix-common/src/main/java/com/cyksj/common/util/StringUtil.java

@@ -531,7 +531,7 @@ public final class StringUtil {
 	/**
 	 * 身份证号返回
 	 */
-	public static String deIndent(String ident) {
+	public static String enIndent(String ident) {
 		String front = ident.substring(0, 4);
 		String back = ident.substring(ident.length() - 4);
 		StringBuilder sb = new StringBuilder();
@@ -615,4 +615,18 @@ public final class StringUtil {
 		}
 		return "unknown";
 	}
+
+	/**
+	 * 姓名返回
+	 */
+	public static String enName(String name) {
+		String first = name.substring(0, 1);
+		if (name.length() <= 2) {
+			return first + "*";
+		}
+		String end = name.substring(name.length() - 1);
+		StringBuilder sb = new StringBuilder();
+		sb.append(first).append("*").append(end);
+		return sb.toString();
+	}
 }

+ 26 - 0
netflix-dao/src/main/java/com/cyksj/model/views/UserCertInfoView.java

@@ -0,0 +1,26 @@
+package com.cyksj.model.views;
+
+import com.cyksj.model.entity.UserCertRecord;
+import com.cyksj.model.entity.UserStudentCertRecord;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * 项目名: yhlxj2
+ * 文件名: UserCertInfoView
+ * 创建者: JavaZou
+ * 创建时间:2024/12/23 15:35
+ */
+@Getter
+@Setter
+public class UserCertInfoView {
+	/**
+	 * 用户身份认证信息
+	 */
+	private UserCertRecord indent;
+
+	/**
+	 * 学生认证信息
+	 */
+	private UserStudentCertRecord studentCert;
+}

+ 3 - 0
netflix-service/src/main/java/com/cyksj/service/user/UserService.java

@@ -8,6 +8,7 @@ import com.cyksj.model.dto.UserWhoami;
 import com.cyksj.model.entity.User;
 import com.cyksj.model.entity.WxSyncLog;
 import com.cyksj.model.request.LoginReq;
+import com.cyksj.model.views.UserCertInfoView;
 
 import javax.servlet.http.HttpServletRequest;
 import java.util.List;
@@ -72,4 +73,6 @@ public interface UserService extends IService<User> {
 	 * 实物好友邀请分销
 	 */
 	void saveEpDistributeShared(Long userId, String dsCode);
+
+	UserCertInfoView getCertOverView(long userId);
 }

+ 1 - 1
netflix-service/src/main/java/com/cyksj/service/user/impl/UserIdentCertServiceImpl.java

@@ -93,7 +93,7 @@ public class UserIdentCertServiceImpl implements UserIdentCertService {
 		if (record == null) {
 			return null;
 		}
-		record.setIdent(StringUtil.deIndent(record.getIdent()));
+		record.setIdent(StringUtil.enIndent(record.getIdent()));
 		return record;
 	}
 

+ 26 - 0
netflix-service/src/main/java/com/cyksj/service/user/impl/UserServiceImpl.java

@@ -29,6 +29,7 @@ import com.cyksj.model.dto.*;
 import com.cyksj.model.entity.*;
 import com.cyksj.model.request.LoginReq;
 import com.cyksj.model.views.RenewalView;
+import com.cyksj.model.views.UserCertInfoView;
 import com.cyksj.model.views.UserTicketView;
 import com.cyksj.redis.RedisService;
 import com.cyksj.service.distribute.DistributeService;
@@ -130,6 +131,10 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
 
 	private final UserMirrorShopMapper userMirrorShopMapper;
 
+	private final UserCertRecordMapper userCertRecordMapper;
+
+	private final UserStudentCertRecordMapper userStudentCertRecordMapper;
+
 	private static final GlobalThreadPoolTaskExecutor TASK_POOL = GlobalThreadPoolTaskExecutor.getInstance();
 
 	@Override
@@ -836,6 +841,27 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
 		}
 	}
 
+	@Override
+	public UserCertInfoView getCertOverView(long userId) {
+		List<Long> userIdList = userBindRelationService.getRelationUserIdList(userId, null);
+		UserCertRecord record = userCertRecordMapper.selectOne(Wrappers.lambdaQuery(UserCertRecord.class)
+				.in(UserCertRecord::getUserId, userIdList)
+				.select(UserCertRecord::getName, UserCertRecord::getIdent)
+				.last("limit 1"));
+		if (record != null) {
+			record.setIdent(StringUtil.enIndent(record.getIdent()));
+			record.setName(StringUtil.enName(record.getName()));
+		}
+		UserStudentCertRecord userStudentCertRecord = userStudentCertRecordMapper.selectOne(Wrappers.lambdaQuery(UserStudentCertRecord.class)
+				.in(UserStudentCertRecord::getUserId, userIdList)
+				.select(UserStudentCertRecord::getSchool)
+				.last("limit 1"));
+		UserCertInfoView userCertInfoView = new UserCertInfoView();
+		userCertInfoView.setIndent(record);
+		userCertInfoView.setStudentCert(userStudentCertRecord);
+		return userCertInfoView;
+	}
+
 	/**
 	 * 处理大学生快递站用户
 	 */

+ 11 - 0
netflix-web/src/main/java/com/cyksj/web/controller/user/UserController.java

@@ -648,4 +648,15 @@ public class UserController {
         }
         return GatewayResponse.SUCCESS.newBuilder().toResult();
     }
+
+    /**
+     * 用户认证信息总览
+     */
+    @GetMapping("/get/cert/overview")
+    public Result<UserCertInfoView> getCertOverView() {
+        long userId = StpUserUtil.getLoginIdAsLong();
+        UserCertInfoView userCertInfoView = userService.getCertOverView(userId);
+        return GatewayResponse.SUCCESS.newBuilder().toResult(userCertInfoView);
+    }
+
 }