huanghongfa
2021-04-27 cf3b4b7fc95fd5b83cae6842e8c24b99e70068e0
springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/service/impl/UserServiceImpl.java
@@ -518,6 +518,36 @@
        return R.fail();
    }
    /**
     * 修改用户志愿者状态
     *
     * @param userId 志愿者用户ID
     * @param type
     */
    @Override
    public R putUserIsVolunteerById(Long userId, int type) {
        SysUserDO sysUserDO = new SysUserDO();
        sysUserDO.setIsVolunteer(type);
        sysUserDO.setUserId(userId);
        SysUserDO userInDB = userDao.selectById(userId);
        if (userInDB != null) {
            boolean isVol = userInDB.getIsVolunteer() == 1;
            if (isVol) {
                return R.fail("用户已是志愿者");
            }
            if (userInDB.getType() != 1) {
                return R.fail("用户不是小程序用户");
            }
            int update = userDao.updateById(sysUserDO);
            if (update > 0) {
                return R.ok();
            }
        }
        return R.fail();
    }
    /**
     * 用户绑定社区、小区
     *
@@ -707,6 +737,7 @@
        if (!ObjectUtils.isEmpty(comMngFamilyInfoDO1)) {
            return R.fail("家庭成员已经存在");
        }
        comMngFamilyInfoDO.setAge(IdCard.IdNOToAge(comMngFamilyInfoVO.getIdCard()));
        int insert = comMngFamilyInfoDAO.insert(comMngFamilyInfoDO);
        if (insert > 0) {
            return R.ok();
@@ -724,6 +755,7 @@
    public R putFamily(ComMngFamilyInfoVO comMngFamilyInfoVO) {
        ComMngFamilyInfoDO comMngFamilyInfoDO = new ComMngFamilyInfoDO();
        BeanUtils.copyProperties(comMngFamilyInfoVO, comMngFamilyInfoDO);
        comMngFamilyInfoDO.setAge(IdCard.IdNOToAge(comMngFamilyInfoVO.getIdCard()));
        int update = comMngFamilyInfoDAO.updateById(comMngFamilyInfoDO);
        if (update > 0) {
            return R.ok();
@@ -1623,12 +1655,12 @@
            if (e.getMessage().contains("union_phone_type")) {
                userDao.deleteStoreByPhoneAndStatus(storeVO.getPhone());
                roleDAO.deleteByRoleKey(Constants.SHOP_ROLE_KEY + storeVO.getStoreAccount());
                throw new ServiceException("手机号已经存在");
                return R.fail("手机号已经存在");
            } else if (e.getMessage().contains("union_account_type")) {
                throw new ServiceException("账户已经存在");
                return R.fail("账户已经存在");
            }
        }
        return R.fail();
        return R.ok();
    }
    /**
@@ -1673,4 +1705,26 @@
            return R.fail();
        }
    }
    @Override
    public R getUserArchives(Long userId) {
        //查询用户信息
        SysUserDO userDO = userDao.selectById(userId);
        if (userDO == null) {
            return R.fail("未查询到用户信息");
        }
        UserArchivesVO userArchivesVO = new UserArchivesVO();
        BeanUtils.copyProperties(userDO, userArchivesVO);
        userArchivesVO.setUserId(userDO.getUserId());
        return R.ok(userArchivesVO);
    }
    @Override
    public R updateUserArchives(UpdateUserArchivesVO userArchivesVO) {
        if(userArchivesVO.getUserId()==null){
            return R.fail("未查询到用户信息");
        }
        userDao.updateUserArchives(userArchivesVO);
        return R.ok();
    }
}