فهرست منبع

fix 用户展示实名认证

zoujiajian 2 سال پیش
والد
کامیت
be85875fae

+ 6 - 0
netflix-dao/src/main/java/com/cyksj/model/manage/views/UserView.java

@@ -187,4 +187,10 @@ public class UserView {
 
     @DbField("u.is_google")
     private Boolean isGoogle;
+
+    /**
+     * 是否实名
+     */
+    @DbIgnore
+    private Boolean isCert;
 }

+ 15 - 4
netflix-web/src/main/java/com/cyksj/web/controller/manage/CmsUserController.java

@@ -82,10 +82,12 @@ public class CmsUserController{
 
     private final CmsUserMapper cmsUserMapper;
 
+    private final UserCertRecordMapper userCertRecordMapper;
+
     private final UserDoubleVerifyCodeChangeRecordMapper userDoubleVerifyCodeChangeRecordMapper;
 
     @GetMapping("/get")
-    public Result<SearchResult<UserView>> get(Long id, String otherPhone, Long sharedId, String userid, Long businessId, String sort, String order) {
+    public Result<SearchResult<UserView>> get(Long id, String otherPhone, Long sharedId, String userid, Long businessId, String sort, String order, Boolean isCert) {
         MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
         String otherSql = StrUtil.EMPTY;
         if (StrUtil.isNotBlank(otherPhone)) {
@@ -103,24 +105,33 @@ public class CmsUserController{
                 builder.field(UserView::getId, relationUserIdList).op(Operator.InList);
             }
         }
+        if (isCert != null) {
+            if (StrUtil.isNotBlank(otherSql)) {
+                otherSql += " and ";
+            }
+            otherSql += "exists (select 1 from user_cert_record where user_id = u.id)";
+        }
         if (StrUtil.isNotBlank(otherSql)) {
             builder.put("otherConditionSql", otherSql);
         }
         SearchResult<UserView> search = beanSearcher.search(UserView.class, builder.build());
-        search.getDataList().forEach(data->{
+        search.getDataList().forEach(data -> {
             Long userId = data.getId();
             UserBindDetail userBindDetail = beanSearcher.searchFirst(UserBindDetail.class, MapUtils.builder().field(UserBindDetail::getUserId, userId).onlySelect(UserBindDetail::getPhone, UserBindDetail::getEmail).build());
-            Optional.ofNullable(userBindDetail).ifPresent(bind->{
+            Optional.ofNullable(userBindDetail).ifPresent(bind -> {
                 data.setBindEmail(bind.getEmail());
                 data.setBindPhone(bind.getPhone());
             });
             if (data.getSharedId() != null) {
                 UserDistributeBusinessInfoView userDistributeBusinessInfoView = beanSearcher.searchFirst(UserDistributeBusinessInfoView.class, MapUtils.builder().field(UserDistributeBusinessInfoView::getUserId, data.getSharedId()).build());
-                Optional.ofNullable(userDistributeBusinessInfoView).ifPresent(info->{
+                Optional.ofNullable(userDistributeBusinessInfoView).ifPresent(info -> {
                     data.setDistributeName(info.getDistributeName());
                     data.setBusinessName(info.getBusinessName());
                 });
             }
+            Integer selectCount = userCertRecordMapper.selectCount(Wrappers.lambdaQuery(UserCertRecord.class)
+                    .eq(UserCertRecord::getUserId, userId));
+            data.setIsCert(selectCount > 0 ? true : false);
         });
         return GatewayResponse.SUCCESS.newBuilder().toResult(search);
     }