罗元桥
2021-06-16 2bff00bae9369d70d29acde8fea1fd8192ada033
springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/service/impl/UserServiceImpl.java
@@ -11,10 +11,7 @@
import com.panzhihua.common.model.dtos.PageDTO;
import com.panzhihua.common.model.dtos.community.ExportUserDTO;
import com.panzhihua.common.model.dtos.community.NoticeReadDTO;
import com.panzhihua.common.model.dtos.grid.EventGridMemberAddDTO;
import com.panzhihua.common.model.dtos.grid.EventGridMemberEditStatusDTO;
import com.panzhihua.common.model.dtos.grid.EventGridMemberPassResetDTO;
import com.panzhihua.common.model.dtos.grid.PageEventGridMemberRelationDTO;
import com.panzhihua.common.model.dtos.grid.*;
import com.panzhihua.common.model.dtos.user.*;
import com.panzhihua.common.model.vos.*;
import com.panzhihua.common.model.vos.community.ComActVO;
@@ -240,6 +237,12 @@
//        志愿者状态
        String phone = sysUserDO.getPhone();
        Long userCommunityId = sysUserDO.getCommunityId();
        if(userCommunityId!=null){
            ComActVO comActVO = userDao.selectCommunity(userCommunityId);
            if(comActVO!=null) {
                loginUserInfoVO.setCommunityName(comActVO.getName());
            }
        }
        if (!ObjectUtils.isEmpty(phone)) {
            ComMngVolunteerMngVO comMngVolunteerMngVO = userDao.selectVolunteerMngByPhone(phone);
            if (ObjectUtils.isEmpty(comMngVolunteerMngVO)) {
@@ -1910,7 +1913,13 @@
        String encode = new BCryptPasswordEncoder().encode(eventGridMemberAddDTO.getPassword());
        eventGridMemberAddDTO.setPassword(encode);
        BeanUtils.copyProperties(eventGridMemberAddDTO, sysUserDO);
        if(!StringUtils.isEmpty(sysUserDO.getNickName())){
            sysUserDO.setName(sysUserDO.getNickName());
        }
        sysUserDO.setType(6);
        if(StringUtils.isEmpty(eventGridMemberAddDTO.getImageUrl())){
            sysUserDO.setImageUrl(Constants.ZONG_ZHI_GRID_MEMBER_IMAGE_URL);
        }
        int insert = 0;
        try {
            insert = userDao.insert(sysUserDO);
@@ -1922,9 +1931,9 @@
            e.printStackTrace();
            log.error("新增后台用户报错【{}】", e.getMessage());
            if (e.getMessage().contains("union_phone_type")) {
                throw new ServiceException("手机号已经存在");
                return R.fail("手机号已经存在");
            } else if (e.getMessage().contains("union_account_type")) {
                throw new ServiceException("账户已经存在");
                return R.fail("账户已经存在");
            }
        }
        if(insert > 0){
@@ -1950,7 +1959,7 @@
     * @return  修改结果
     */
    @Override
    public R editGridUser(EventGridMemberAddDTO gridMemberDTO){
    public R editGridUser(EventGridMemberEditAdminDTO gridMemberDTO){
        if(gridMemberDTO.getGridMemberId() == null){
            return R.fail("参数错误");
@@ -1968,8 +1977,6 @@
            return R.fail("昵称已使用");
        }
        String encode = new BCryptPasswordEncoder().encode(gridMemberDTO.getPassword());
        gridMemberDTO.setPassword(encode);
        BeanUtils.copyProperties(gridMemberDTO,sysUserDO);
        int insert = 0;
@@ -1979,9 +1986,9 @@
            e.printStackTrace();
            log.error("修改网格员用户报错【{}】", e.getMessage());
            if (e.getMessage().contains("union_phone_type")) {
                throw new ServiceException("手机号已经存在");
                return R.fail("手机号已经存在");
            } else if (e.getMessage().contains("union_account_type")) {
                throw new ServiceException("账户已经存在");
                return R.fail("账户已经存在");
            }
        }
        if(insert > 0){
@@ -2030,4 +2037,15 @@
        userDao.gridMemberEditStatus(gridMemberEditDTO);
        return R.ok();
    }
    public R noTips(Long userId){
        SysUserDO userDO = this.userDao.selectById(userId);
        if(userDO != null){
            userDO.setBigAgeTips(2);
            if(this.userDao.updateById(userDO) > 0){
                return R.ok();
            }
        }
        return R.fail();
    }
}