From fe4cd9bce38617b24776e6637d28ea899235dd5c Mon Sep 17 00:00:00 2001
From: 101captain <237651143@qq.com>
Date: 星期一, 27 九月 2021 13:34:27 +0800
Subject: [PATCH] 修改新增用户信息

---
 springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/service/impl/UserServiceImpl.java |  102 +++++++++++++++++++++++++--------------------------
 1 files changed, 50 insertions(+), 52 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 e6bf2c5..5f45e24 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,6 +14,8 @@
 
 import javax.annotation.Resource;
 
+import com.panzhihua.service_user.dao.*;
+import com.panzhihua.service_user.model.dos.*;
 import org.apache.commons.lang.time.DateFormatUtils;
 import org.apache.commons.lang.time.DateUtils;
 import org.springframework.beans.BeanUtils;
@@ -81,34 +83,6 @@
 import com.panzhihua.common.utlis.StringUtils;
 import com.panzhihua.common.utlis.WxUtil;
 import com.panzhihua.common.utlis.WxXCXTempSend;
-import com.panzhihua.service_user.dao.ComMngFamilyInfoDAO;
-import com.panzhihua.service_user.dao.ComMngUserTagDAO;
-import com.panzhihua.service_user.dao.EventGridMemberBuildingRelationMapper;
-import com.panzhihua.service_user.dao.LcCompareMemberCodeMapper;
-import com.panzhihua.service_user.dao.RoleDAO;
-import com.panzhihua.service_user.dao.SysMenuDAO;
-import com.panzhihua.service_user.dao.SysOperLogDAO;
-import com.panzhihua.service_user.dao.SysRoleMenuDAO;
-import com.panzhihua.service_user.dao.SysUserAgreementDAO;
-import com.panzhihua.service_user.dao.SysUserFeedbackDAO;
-import com.panzhihua.service_user.dao.SysUserInputDAO;
-import com.panzhihua.service_user.dao.SysUserNoticeDAO;
-import com.panzhihua.service_user.dao.SysUserRoleDAO;
-import com.panzhihua.service_user.dao.UserDao;
-import com.panzhihua.service_user.model.dos.ComMngFamilyInfoDO;
-import com.panzhihua.service_user.model.dos.ComMngUserTagDO;
-import com.panzhihua.service_user.model.dos.EventGridMemberBuildingRelationDO;
-import com.panzhihua.service_user.model.dos.LcCompareCodeMemberDO;
-import com.panzhihua.service_user.model.dos.SysMenuDO;
-import com.panzhihua.service_user.model.dos.SysOperLogDO;
-import com.panzhihua.service_user.model.dos.SysRoleDO;
-import com.panzhihua.service_user.model.dos.SysRoleMenuDO;
-import com.panzhihua.service_user.model.dos.SysUserAgreementDO;
-import com.panzhihua.service_user.model.dos.SysUserDO;
-import com.panzhihua.service_user.model.dos.SysUserFeedbackDO;
-import com.panzhihua.service_user.model.dos.SysUserInputDO;
-import com.panzhihua.service_user.model.dos.SysUserNoticeDO;
-import com.panzhihua.service_user.model.dos.SysUserRoleDO;
 import com.panzhihua.service_user.model.dtos.DataKanbanDTO;
 import com.panzhihua.service_user.service.EventGridMemberBuildingRelationService;
 import com.panzhihua.service_user.service.UserService;
@@ -158,6 +132,8 @@
     private EventGridMemberBuildingRelationMapper eventGridMemberBuildingRelationMapper;
     @Resource
     private LcCompareMemberCodeMapper lcCompareMemberCodeMapper;
+    @Resource
+    private ComActFourMemberDao comActFourMemberDao;
     // @Resource
     // private GridService gridService;
 
@@ -346,6 +322,7 @@
             loginUserInfoVO.setRoles(set);
         }
         loginUserInfoVO.setIsmemberrole(2);
+        loginUserInfoVO.setIsFourMember(2);
         // 志愿者状态
         String phone = sysUserDO.getPhone();
         Long userCommunityId = sysUserDO.getCommunityId();
@@ -362,6 +339,11 @@
             } else {
                 int state = comMngVolunteerMngVO.getState().intValue();
                 loginUserInfoVO.setVolunteerStatus(state);
+            }
+            //是否四长四员
+            Integer countFourMember=comActFourMemberDao.selectCount(new QueryWrapper<ComActFourMember>().lambda().eq(ComActFourMember::getUserId,sysUserDO.getUserId()));
+            if(countFourMember>0){
+                loginUserInfoVO.setIsFourMember(1);
             }
             // 是否是"管理员"或者 本社区 "社区团队"、"党委成员"
             Integer countTeam = userDao.selectCountTeam(phone, userCommunityId);
@@ -1090,6 +1072,8 @@
                     throw new ServiceException("手机号已经存在");
                 } else if (e.getMessage().contains("union_account_type")) {
                     throw new ServiceException("账户已经存在");
+                }else if(e.getMessage().contains("23000")){
+                    throw new ServiceException("手机号已存在");
                 }
 
             }
@@ -2564,6 +2548,20 @@
         return R.fail();
     }
 
+    @Override
+    public R resetPasswordPatch(Long[] userId,String password) {
+        if(userId!=null){
+            for(Long user:userId){
+                SysUserDO sysUserDO = new SysUserDO();
+                sysUserDO.setUserId(user);
+                String encode = new BCryptPasswordEncoder().encode(password);
+                sysUserDO.setPassword(encode);
+                userDao.updateById(sysUserDO);
+            }
+        }
+        return R.ok();
+    }
+
     /**
      * 便民服务新增商家账号
      * @param convenientMerchantDTO
@@ -2628,34 +2626,34 @@
     }
 
     /**
-     * 修改便民服务商家绑定账号
-     * @param userId 用户id
-     * @param account 修改账户
-     * @return 修改结果
-     */
-    @Override
-    public R putUserAccount(Long userId, String account) {
-        SysUserDO sysUserDO = userDao.selectById(userId);
-        if (isNull(sysUserDO)) {
-            return R.fail("用户不存在");
-        }
-        String oldAccount = sysUserDO.getAccount();
-        sysUserDO.setAccount(account);
-        int result = userDao.updateById(sysUserDO);
-        if (result > 0) {
-            SysRoleDO sysRoleDO = roleDAO.selectOne(new QueryWrapper<SysRoleDO>()
-                    .lambda().eq(SysRoleDO::getRoleKey, Constants.CONVENIENT_MERCHANT_ROLE_KEY + oldAccount));
-            if (nonNull(sysRoleDO)) {
-                sysRoleDO.setRoleKey(Constants.CONVENIENT_MERCHANT_ROLE_KEY + account);
-                roleDAO.updateById(sysRoleDO);
-            }
-        }
-        return R.ok();
+ * 修改便民服务商家绑定账号
+ * @param userId 用户id
+ * @param account 修改账户
+ * @return 修改结果
+ */
+@Override
+public R putUserAccount(Long userId, String account) {
+    SysUserDO sysUserDO = userDao.selectById(userId);
+    if (isNull(sysUserDO)) {
+        return R.fail("用户不存在");
     }
+    String oldAccount = sysUserDO.getAccount();
+    sysUserDO.setAccount(account);
+    int result = userDao.updateById(sysUserDO);
+    if (result > 0) {
+        SysRoleDO sysRoleDO = roleDAO.selectOne(new QueryWrapper<SysRoleDO>()
+                .lambda().eq(SysRoleDO::getRoleKey, Constants.CONVENIENT_MERCHANT_ROLE_KEY + oldAccount));
+        if (nonNull(sysRoleDO)) {
+            sysRoleDO.setRoleKey(Constants.CONVENIENT_MERCHANT_ROLE_KEY + account);
+            roleDAO.updateById(sysRoleDO);
+        }
+    }
+    return R.ok();
+}
 
     @Override
     public R disableOrEnableMerchantUsers(DisableOrEnableConvenientMerchantDTO disableOrEnableConvenientMerchantDTO) {
-        userDao.disableOrEnableMerchantUsers(disableOrEnableConvenientMerchantDTO.getType(), disableOrEnableConvenientMerchantDTO.getIds());
+        userDao.disableOrEnableMerchantUsers(disableOrEnableConvenientMerchantDTO.getType(), disableOrEnableConvenientMerchantDTO.getUserIds());
         return R.ok();
     }
 }

--
Gitblit v1.7.1