| | |
| | | import com.panzhihua.common.model.vos.community.ComActSocialOrgVO; |
| | | import com.panzhihua.common.model.vos.user.AdministratorsUserVO; |
| | | import com.panzhihua.common.service.user.UserService; |
| | | import com.panzhihua.service_community.entity.ComActCommittee; |
| | | import com.panzhihua.service_community.entity.ComActSocialOrg; |
| | | import com.panzhihua.service_community.dao.ComActSocialOrgDao; |
| | | import com.panzhihua.service_community.service.ComActSocialOrgService; |
| | |
| | | administratorsUserVO.setAccount(comActSocialOrgVO.getAccount()); |
| | | administratorsUserVO.setPassword(comActSocialOrgVO.getPassword()); |
| | | administratorsUserVO.setRoleId(comActSocialOrgVO.getRoleId()); |
| | | administratorsUserVO.setCommunityId(comActSocialOrg.getCommunityId()); |
| | | administratorsUserVO.setName(comActSocialOrgVO.getContactName()); |
| | | administratorsUserVO.setPhone(comActSocialOrgVO.getContactPhone()); |
| | | R r=userService.addUserBackstageProperty(administratorsUserVO); |
| | | if(R.isOk(r)){ |
| | | comActSocialOrg.setUserId(Long.parseLong(r.getData().toString())); |
| | |
| | | this.comActSocialOrgDao.insert(comActSocialOrg); |
| | | return R.ok(); |
| | | } |
| | | return R.fail("账号或手机号已存在"); |
| | | } |
| | | return R.fail(); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R update(ComActSocialOrgVO comActSocialOrgVO) { |
| | | if(comActSocialOrgVO!=null){ |
| | | if(!comActSocialOrgVO.getAccount().isEmpty()||!comActSocialOrgVO.getPassword().isEmpty()){ |
| | | AdministratorsUserVO administratorsUserVO=new AdministratorsUserVO(); |
| | | administratorsUserVO.setUserId(comActSocialOrgVO.getUserId()); |
| | | administratorsUserVO.setAccount(comActSocialOrgVO.getAccount()); |
| | | administratorsUserVO.setPassword(comActSocialOrgVO.getPassword()); |
| | | R r=userService.putUserBackstage(administratorsUserVO); |
| | | if(R.isOk(r)){ |
| | | ComActSocialOrg comActSocialOrg=new ComActSocialOrg(); |
| | | BeanUtils.copyProperties(comActSocialOrgVO,comActSocialOrg); |
| | | this.comActSocialOrgDao.updateById(comActSocialOrg); |
| | | return R.ok(); |
| | | } |
| | | return R.fail("账号密码修改失败"); |
| | | } |
| | | else { |
| | | ComActSocialOrg comActSocialOrg=new ComActSocialOrg(); |
| | | BeanUtils.copyProperties(comActSocialOrgVO,comActSocialOrg); |
| | | if(comActSocialOrgVO.getRoleId()!=null){ |
| | | ComActSocialOrg comPropertyBase=this.comActSocialOrgDao.selectById(comActSocialOrgVO.getId()); |
| | | AdministratorsUserVO administratorsUserVO=new AdministratorsUserVO(); |
| | | administratorsUserVO.setUserId(comPropertyBase.getUserId()); |
| | | administratorsUserVO.setRoleId(comActSocialOrgVO.getRoleId()); |
| | | administratorsUserVO.setLastLoginTime(DateUtil.date()); |
| | | this.userService.putUserBackstage(administratorsUserVO); |
| | | } |
| | | this.comActSocialOrgDao.updateById(comActSocialOrg); |
| | | return R.ok(); |
| | | } |
| | | } |
| | | return R.fail(); |
| | | } |
| | |
| | | if(comActSocialOrg.getUserId()!=null){ |
| | | AdministratorsUserVO administratorsUserVO=new AdministratorsUserVO(); |
| | | administratorsUserVO.setUserId(comActSocialOrg.getUserId()); |
| | | R r=userService.deleteUserBackstage(administratorsUserVO); |
| | | if(R.isOk(r)){ |
| | | this.comActSocialOrgDao.deleteById(id); |
| | | return R.ok(); |
| | | } |
| | | return R.fail("账号删除失败"); |
| | | administratorsUserVO.setCommunityId(comActSocialOrg.getCommunityId()); |
| | | userService.deleteUserBackstage(administratorsUserVO); |
| | | this.comActSocialOrgDao.deleteById(id); |
| | | return R.ok(); |
| | | } |
| | | } |
| | | return R.fail("用户账号错误"); |