From 1e3b97098151f2d0471de6e8103b6cdaa6b5099d Mon Sep 17 00:00:00 2001
From: puhanshu <a9236326>
Date: 星期六, 18 九月 2021 09:15:59 +0800
Subject: [PATCH] Merge branch 'test' of http://gitlab.nhys.cdnhxx.com/root/zhihuishequ into auth

---
 springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/service/impl/UserServiceImpl.java |   61 +++++++++++++++++++++++-------
 1 files changed, 47 insertions(+), 14 deletions(-)

diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/service/impl/UserServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/service/impl/UserServiceImpl.java
index b9b8ca6..89446cf 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/service/impl/UserServiceImpl.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/service/impl/UserServiceImpl.java
@@ -14,7 +14,6 @@
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.ObjectUtils;
-import org.springframework.util.StringUtils;
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -461,18 +460,35 @@
 //            record.setPhone(SensitiveUtil.desensitizedPhoneNumber(record.getPhone()));
             record.setIdCard(SensitiveUtil.desensitizedIdNumber(record.getIdCard()));
 
-            StringBuilder sb = new StringBuilder();
-            if (record.getIsPartymember().equals(1)) {
-                sb.append("党员,");
-            }
-            if (record.getIsVolunteer().equals(1)) {
-                sb.append("志愿者,");
-            }
-            String tag = sb.toString();
-            if (tag.length() > 0) {
-                record.setTags(tag.substring(0, tag.length() - 1));
-            } else {
-                record.setTags("无");
+            if (StringUtils.isNotEmpty(record.getTags())) {
+                StringBuffer sb = new StringBuffer();
+                sb.append(record.getTags() + ",");
+                if (record.getIsPartymember().equals(1)) {
+                    if (!sb.toString().contains("党员")){
+                        sb.append("党员,");
+                    }
+                }
+                if (record.getIsVolunteer().equals(1)) {
+                    if (!sb.toString().contains("志愿者")) {
+                        sb.append("志愿者,");
+                    }
+                }
+                String tags = sb.toString();
+                record.setTags(tags.substring(0, tags.length() - 1));
+            }else {
+                StringBuffer sb = new StringBuffer();
+                if (record.getIsPartymember().equals(1)) {
+                    sb.append("党员,");
+                }
+                if (record.getIsVolunteer().equals(1)) {
+                    sb.append("志愿者,");
+                }
+                String tags = sb.toString();
+                if (tags.length() > 0) {
+                    record.setTags(tags.substring(0, tags.length() - 1));
+                } else {
+                    record.setTags("无");
+                }
             }
         });
         return R.ok(iPage);
@@ -578,7 +594,9 @@
     public R putUserTag(LoginUserInfoVO loginUserInfoVO) {
         SysUserDO sysUserDO = new SysUserDO();
         sysUserDO.setUserId(loginUserInfoVO.getUserId());
-        sysUserDO.setTags(loginUserInfoVO.getTags());
+        if (StringUtils.isNotEmpty(loginUserInfoVO.getTags()) && !"无".equals(loginUserInfoVO.getTags())) {
+            sysUserDO.setTags(loginUserInfoVO.getTags());
+        }
         int update = userDao.putUserTag(sysUserDO);
         if (update > 0) {
             return R.ok();
@@ -2404,4 +2422,19 @@
     public R getUserListByCommunityId(Long communityId) {
         return R.ok(this.userDao.getUserListByCommunityId(communityId));
     }
+
+    /**
+     * 检查当前用户是否是社区工作人员
+     * @param phone
+     * @param communityId
+     * @return
+     */
+    @Override
+    public R checkCurrentUserIsTeam(String phone, Long communityId) {
+        int result = this.userDao.selectCountTeam(phone, communityId);
+        if (result > 0) {
+            return R.ok(true);
+        }
+        return R.ok(false);
+    }
 }

--
Gitblit v1.7.1