| | |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import cn.hutool.core.util.IdcardUtil; |
| | | import com.panzhihua.common.model.dtos.DataKanBansDto; |
| | | import com.panzhihua.common.model.vos.community.*; |
| | | 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; |
| | |
| | | import com.panzhihua.common.constants.Constants; |
| | | import com.panzhihua.common.constants.UserConstants; |
| | | import com.panzhihua.common.exceptions.ServiceException; |
| | | import com.panzhihua.common.model.dtos.DataKanBansDto; |
| | | 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.vos.LoginUserInfoVO; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.common.model.vos.SystemmanagementConfigVO; |
| | | import com.panzhihua.common.model.vos.community.ComActVO; |
| | | import com.panzhihua.common.model.vos.community.ComMngVolunteerMngVO; |
| | | import com.panzhihua.common.model.vos.community.IndexUserCommunityVo; |
| | | import com.panzhihua.common.model.vos.community.IndexUserStatisticsVo; |
| | | import com.panzhihua.common.model.vos.community.IndexUserStreetVo; |
| | | import com.panzhihua.common.model.vos.grid.GridMemberVO; |
| | | import com.panzhihua.common.model.vos.grid.admin.GridMemberBuildingVO; |
| | | import com.panzhihua.common.model.vos.partybuilding.ActivityManagerVO; |
| | |
| | | import com.panzhihua.common.utlis.StringUtils; |
| | | import com.panzhihua.common.utlis.WxUtil; |
| | | import com.panzhihua.common.utlis.WxXCXTempSend; |
| | | import com.panzhihua.service_user.dao.ComActFourMemberDao; |
| | | 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.ComActFourMember; |
| | | 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; |
| | | |
| | | import cn.hutool.core.util.IdcardUtil; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | // import com.panzhihua.common.service.grid.GridService; |
| | |
| | | loginUserInfoVO.setIsmemberrole(2); |
| | | loginUserInfoVO.setIsFourMember(2); |
| | | loginUserInfoVO.setIsCommunityWorker(2); |
| | | loginUserInfoVO.setIsPropertyWorker(2); |
| | | // 志愿者状态 |
| | | String phone = sysUserDO.getPhone(); |
| | | Long userCommunityId = sysUserDO.getCommunityId(); |
| | |
| | | Integer countFourMember=comActFourMemberDao.selectCount(new QueryWrapper<ComActFourMember>().lambda().eq(ComActFourMember::getIdCard,sysUserDO.getIdCard())); |
| | | if(countFourMember>0){ |
| | | loginUserInfoVO.setIsFourMember(1); |
| | | } |
| | | //是否是社区物业人员 |
| | | int countPropertyWorker = userDao.countPropertyWorker(Long.parseLong(userId), userCommunityId); |
| | | if (countPropertyWorker > 0) { |
| | | loginUserInfoVO.setIsPropertyWorker(1); |
| | | } |
| | | // 是否是"管理员"或者 本社区 "社区团队"、"党委成员" |
| | | Integer countTeam = userDao.selectCountTeam(phone, userCommunityId); |
| | |
| | | if (ObjectUtils.isEmpty(sysUserDO)) { |
| | | return R.fail("人员不存在"); |
| | | } |
| | | |
| | | BeanUtils.copyProperties(sysUserDO, loginUserInfoVO); |
| | | List<ComMngFamilyInfoDO> comMngFamilyInfoDOS = comMngFamilyInfoDAO |
| | | .selectList(new QueryWrapper<ComMngFamilyInfoDO>().lambda().eq(ComMngFamilyInfoDO::getUserId, userId)); |
| | |
| | | if (!ObjectUtils.isEmpty(comActVO)) { |
| | | loginUserInfoVO.setCommunityName(comActVO.getName()); |
| | | } |
| | | //是否是社区物业人员 |
| | | int countPropertyWorker = userDao.countPropertyWorker(userId, loginUserInfoVO.getCommunityId()); |
| | | loginUserInfoVO.setIsPropertyWorker(countPropertyWorker > 0 ? 1 : 0); |
| | | loginUserInfoVO.setIdCard(SensitiveUtil.desensitizedIdNumber(loginUserInfoVO.getIdCard())); |
| | | loginUserInfoVO.setPhone(SensitiveUtil.desensitizedPhoneNumber(loginUserInfoVO.getPhone())); |
| | | return R.ok(loginUserInfoVO); |
| | |
| | | this.putMenuRole(menuRoleVO); |
| | | } |
| | | } |
| | | if(roleId.intValue()==777777777){ |
| | | SysRoleDO sysRoleDO = new SysRoleDO(); |
| | | sysRoleDO.setRoleName("超级管理员"); |
| | | sysRoleDO.setRoleKey(Constants.STREET_ROLE_KEY + administratorsUserVO.getStreetId()); |
| | | sysRoleDO.setRoleSort(0); |
| | | sysRoleDO.setCreateBy(administratorsUserVO.getUserId()); |
| | | int insert = roleDAO.insert(sysRoleDO); |
| | | if (insert > 0) { |
| | | SysRoleDO sysRoleDO1 = roleDAO.selectOne( |
| | | new QueryWrapper<SysRoleDO>().lambda().eq(SysRoleDO::getRoleKey, sysRoleDO.getRoleKey())); |
| | | roleId = sysRoleDO1.getRoleId(); |
| | | // 新街道管理员角色设置固定三社权限 |
| | | MenuRoleVO menuRoleVO = new MenuRoleVO(); |
| | | List<Long> menu=new ArrayList<>(); |
| | | if(administratorsUserVO.getSocialType()==1){ |
| | | menu.add(233L); |
| | | menu.add(234L); |
| | | menu.add(235L); |
| | | menu.add(236L); |
| | | menu.add(237L); |
| | | } |
| | | else if(administratorsUserVO.getSocialType()==2){ |
| | | menu.add(233L); |
| | | menu.add(234L); |
| | | menu.add(236L); |
| | | menu.add(237L); |
| | | menu.add(238L); |
| | | } |
| | | else if(administratorsUserVO.getSocialType()==3){ |
| | | menu.add(233L); |
| | | menu.add(237L); |
| | | } |
| | | menuRoleVO.setMenuIds(menu); |
| | | menuRoleVO.setRoleId(roleId); |
| | | this.putMenuRole(menuRoleVO); |
| | | } |
| | | } |
| | | SysRoleDO roleDO = roleDAO.selectById(roleId); |
| | | if (ObjectUtils.isEmpty(roleDO)) { |
| | | return R.fail("角色不存在"); |
| | |
| | | |
| | | } |
| | | |
| | | if (insert > 0 && sysUserDO.getType() == 3) {// 添加的用户是社区账号时 |
| | | if (insert > 0 && sysUserDO.getType() == 3 &&sysUserDO.getStreetId()==null) {// 添加的用户是社区账号时 |
| | | // 添加网格综合治理管理后台用户 |
| | | SysUserDO sysUserDOWangGe = new SysUserDO(); |
| | | BeanUtils.copyProperties(sysUserDO, sysUserDOWangGe); |
| | |
| | | public R addUserBackstageProperty(AdministratorsUserVO administratorsUserVO) { |
| | | SysUserDO sysUserDO = new SysUserDO(); |
| | | Long roleId = administratorsUserVO.getRoleId(); |
| | | if(roleId.intValue()==777777777){ |
| | | SysRoleDO sysRoleDO = new SysRoleDO(); |
| | | sysRoleDO.setRoleName("三社超级管理员"); |
| | | List<Long> menu=new ArrayList<>(); |
| | | if(administratorsUserVO.getSocialType()==1){ |
| | | sysRoleDO.setRoleKey(Constants.STREET_ROLE_KEY + administratorsUserVO.getStreetId()); |
| | | menu.add(233L); |
| | | menu.add(234L); |
| | | menu.add(235L); |
| | | menu.add(236L); |
| | | menu.add(237L); |
| | | } |
| | | else if(administratorsUserVO.getSocialType()==2){ |
| | | sysRoleDO.setRoleKey("social_org" + administratorsUserVO.getStreetId()); |
| | | menu.add(233L); |
| | | menu.add(76L); |
| | | menu.add(234L); |
| | | menu.add(236L); |
| | | menu.add(237L); |
| | | menu.add(238L); |
| | | } |
| | | else if(administratorsUserVO.getSocialType()==3){ |
| | | sysRoleDO.setRoleKey("social_org_member" + administratorsUserVO.getStreetId()); |
| | | menu.add(233L); |
| | | menu.add(237L); |
| | | } |
| | | |
| | | sysRoleDO.setRoleSort(0); |
| | | sysRoleDO.setCreateBy(administratorsUserVO.getUserId()); |
| | | SysRoleDO sysRoleDO1 = roleDAO.selectOne( |
| | | new QueryWrapper<SysRoleDO>().lambda().eq(SysRoleDO::getRoleKey, sysRoleDO.getRoleKey())); |
| | | if(sysRoleDO1!=null){ |
| | | sysRoleDO=sysRoleDO1; |
| | | roleId = sysRoleDO.getRoleId(); |
| | | }else{ |
| | | roleDAO.insert(sysRoleDO); |
| | | // 新街道管理员角色设置固定三社权限 |
| | | MenuRoleVO menuRoleVO = new MenuRoleVO(); |
| | | menuRoleVO.setMenuIds(menu); |
| | | menuRoleVO.setRoleId(roleId); |
| | | this.putMenuRole(menuRoleVO); |
| | | } |
| | | } |
| | | SysRoleDO roleDO = roleDAO.selectById(roleId); |
| | | if (ObjectUtils.isEmpty(roleDO)) { |
| | | return R.fail("角色不存在"); |
| | |
| | | throw new ServiceException("手机号已经存在"); |
| | | } else if (e.getMessage().contains("union_account_type")) { |
| | | throw new ServiceException("账户已经存在"); |
| | | }else if(e.getMessage().contains("23000")){ |
| | | throw new ServiceException("手机号已存在"); |
| | | } |
| | | |
| | | } |
| | |
| | | .anyMatch(sysRoleMenuDO -> sysRoleMenuDO.getMenuId().equals(menuId))).collect(Collectors.toList()); |
| | | } |
| | | if (!menuIds.isEmpty()) { |
| | | sysRoleMenuDAO.batchInsertWithRoleId(menuIds, roleId); |
| | | if(menuRoleVO.getMenuIds().isEmpty()){ |
| | | sysRoleMenuDAO.batchInsertWithRoleId(menuIds, roleId); |
| | | } |
| | | else { |
| | | sysRoleMenuDAO.batchInsertWithRoleId(menuRoleVO.getMenuIds(), roleId); |
| | | } |
| | | } |
| | | // for (int i = 0; i < menuIds.size(); i++) { |
| | | // SysRoleMenuDO sysRoleMenuDO = sysRoleMenuDAO.selectOne(new QueryWrapper<SysRoleMenuDO>().lambda() |
| | |
| | | } |
| | | Long communityId = sysUserDO.getCommunityId(); |
| | | Long communityId1 = administratorsUserVO.getCommunityId(); |
| | | if (communityId1.intValue() != communityId.intValue()) { |
| | | if (communityId1!=null&&communityId1.intValue() != communityId.intValue()) { |
| | | return R.fail("用户不属于当前平台"); |
| | | } |
| | | // 删除用户 |
| | |
| | | if (nonNull(sysUserDO)) { |
| | | return R.fail("账户已经存在"); |
| | | } |
| | | sysUserDO = userDao.selectOne(new QueryWrapper<SysUserDO>().lambda().eq(SysUserDO::getPhone, convenientMerchantDTO.getPhone())); |
| | | if (nonNull(sysUserDO)) { |
| | | return R.fail("手机号已经存在"); |
| | | } |
| | | // sys_user 表 |
| | | sysUserDO = new SysUserDO(); |
| | | String encode = new BCryptPasswordEncoder().encode(convenientMerchantDTO.getPassword()); |
| | |
| | | sysUserDO.setType(10); |
| | | sysUserDO.setAreaId(null); |
| | | sysUserDO.setStatus(1); |
| | | sysUserDO.setPhone(convenientMerchantDTO.getPhone()); |
| | | sysUserDO.setPhone(null); |
| | | sysUserDO.setName(convenientMerchantDTO.getContacts()); |
| | | sysUserDO.setPassword(encode); |
| | | try { |
| | |
| | | public R communityStatisticsExport(){ |
| | | return R.ok(userDao.getUserCommunityExcelExport()); |
| | | } |
| | | |
| | | /** |
| | | * 通过UnionId获取用户信息 |
| | | * @param unionId |
| | | * @return |
| | | */ |
| | | @Override |
| | | public R getUserInfoByUnionId(String unionId) { |
| | | SysUserDO sysUserDO = userDao.selectOne(new QueryWrapper<SysUserDO>().lambda().eq(SysUserDO::getUnionid, unionId)); |
| | | if (isNull(sysUserDO)) { |
| | | return R.fail("用户不存在"); |
| | | } |
| | | LoginUserInfoVO loginUserInfoVO = new LoginUserInfoVO(); |
| | | BeanUtils.copyProperties(sysUserDO, loginUserInfoVO); |
| | | return R.ok(loginUserInfoVO); |
| | | } |
| | | } |