huanghongfa
2021-05-12 9b15ddbe6b0106261c7c59889ad75d5627a2b545
springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/service/impl/UserServiceImpl.java
@@ -253,6 +253,7 @@
                loginUserInfoVO.setIsmemberrole(1);
            }
        }
        loginUserInfoVO.setIsRealNamed(sysUserDO.getIdCard()!=null);
        return R.ok(loginUserInfoVO);
    }
@@ -513,10 +514,28 @@
     */
    @Override
    public R putUserIsVolunteer(String phone, int type) {
        SysUserDO sysUserDO = new SysUserDO();
        sysUserDO.setIsVolunteer(type);
        int update = userDao.update(sysUserDO, new UpdateWrapper<SysUserDO>().lambda().eq(SysUserDO::getPhone, phone));
        if (update > 0) {
            ComMngVolunteerMngVO comMngVolunteerMngVO = userDao.selectVolunteerMngByPhone(phone);
            if(comMngVolunteerMngVO!=null&&comMngVolunteerMngVO.getSubmitUserId()!=null) {
                Long userId = comMngVolunteerMngVO.getSubmitUserId();
                //删除用户信息缓存
                String userKey = UserConstants.LOGIN_USER_INFO + userId;
                stringRedisTemplate.delete(userKey);
            }else{
                List<SysUserDO> userDOList =  userDao.selectList(new LambdaQueryWrapper<SysUserDO>().eq(SysUserDO::getPhone, phone));
                if(userDOList!=null && userDOList.size()>0){
                    userDOList.forEach(usrDo ->{
                        Long userId = usrDo.getUserId();
                        //删除用户信息缓存
                        String userKey = UserConstants.LOGIN_USER_INFO + userId;
                        stringRedisTemplate.delete(userKey);
                    });
                }
            }
            return R.ok();
        }
        return R.fail();
@@ -546,6 +565,9 @@
            }
            int update = userDao.updateById(sysUserDO);
            if (update > 0) {
                //删除用户信息缓存
                String userKey = UserConstants.LOGIN_USER_INFO + userId;
                stringRedisTemplate.delete(userKey);
                return R.ok();
            }
        }
@@ -593,8 +615,9 @@
        SysUserDO sysUserDO = new SysUserDO();
        sysUserDO.setName(name);
        sysUserDO.setIdCard(idCard);
        sysUserDO.setSex(loginUserInfoVO.getSex());
        sysUserDO.setBirthday(loginUserInfoVO.getBirthday());
        //通过身份证号判断性别以及出生日期
        sysUserDO.setSex(IdCard.sex(idCard));
        sysUserDO.setBirthday(IdCard.birthDay(idCard));
        sysUserDO.setJob(loginUserInfoVO.getJob());
        sysUserDO.setUserId(loginUserInfoVO.getUserId());
        sysUserDO.setFaceUrl(loginUserInfoVO.getFaceUrl());