| | |
| | | import java.util.ArrayList; |
| | | import java.util.Comparator; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import com.panzhihua.common.model.vos.community.ComActPasswordVo; |
| | | import com.panzhihua.common.model.vos.community.ComBasicDataVo; |
| | | import com.panzhihua.common.model.vos.partybuilding.ComPbMemberTypeVO; |
| | | import com.panzhihua.service_community.dao.ComPbMemberDAO; |
| | | import com.panzhihua.service_community.util.MyAESUtil; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | private ComActDAO comActDAO; |
| | | @Resource |
| | | private ComStreetDAO comStreetDAO; |
| | | @Resource |
| | | private ComPbMemberDAO comPbMemberDAO; |
| | | |
| | | /** |
| | | * 新增社区 |
| | |
| | | } |
| | | ComActDO comActDO = new ComActDO(); |
| | | Integer integer = |
| | | comActDAO.selectCount(new QueryWrapper<ComActDO>().lambda().eq(ComActDO::getName, comActVO.getName())); |
| | | comActDAO.selectCount(new QueryWrapper<ComActDO>().lambda() |
| | | .eq(ComActDO::getName, comActVO.getName()) |
| | | .eq(ComActDO::getCityCode,comActVO.getCityCode()) |
| | | .eq(ComActDO::getAreaCode,comActVO.getAreaCode()) |
| | | .eq(ComActDO::getProvinceCode,comActVO.getProvinceCode()) |
| | | .eq(ComActDO::getAppId,comActVO.getAppId()) |
| | | ); |
| | | if (integer > 0) { |
| | | return R.fail("社区已经存在"); |
| | | } |
| | | BeanUtils.copyProperties(comActVO, comActDO); |
| | | comActDO.setPlaintextPassword(password); |
| | | int insert = comActDAO.insert(comActDO); |
| | | if (insert > 0) { |
| | | ComActDO comActDO1 = |
| | | comActDAO.selectOne(new QueryWrapper<ComActDO>().lambda().eq(ComActDO::getName, comActVO.getName())); |
| | | comActDAO.selectOne(new QueryWrapper<ComActDO>().lambda() |
| | | .eq(ComActDO::getCommunityId, comActVO.getCommunityId()) |
| | | ); |
| | | BeanUtils.copyProperties(comActDO1, comActVO); |
| | | return R.ok(comActVO); |
| | | } |
| | |
| | | if (!ObjectUtils.isEmpty(password)) { |
| | | String encode = new BCryptPasswordEncoder().encode(password); |
| | | comActVO.setPassword(encode); |
| | | comActDO.setPlaintextPassword(password); |
| | | a = 1; |
| | | } |
| | | ComStreetDO comStreetDO = comStreetDAO.selectById(comActVO.getStreetId()); |
| | |
| | | // a=1; |
| | | // } |
| | | BeanUtils.copyProperties(comActVO, comActDO); |
| | | |
| | | // ComActDO selectOne = comActDAO.selectOne(new QueryWrapper<ComActDO>().lambda().eq(ComActDO::getAccount, account)); |
| | | // if (null != selectOne && selectOne.getAccount().equals(comActVO.getAccount())) { |
| | | // return R.fail("该登录账号重复,请重新修改"); |
| | |
| | | ComActVO comActVO = new ComActVO(); |
| | | BeanUtils.copyProperties(comActDO, comActVO); |
| | | comActVO.setAreaName(comActDAO.selectAreaName(comActVO.getAreaCode())); |
| | | comActVO.setAccount(null); |
| | | comActVO.setPassword(null); |
| | | comActVO.setAddress(null); |
| | | comActVO.setContacts(null); |
| | | comActVO.setCreateAt(null); |
| | | comActVO.setState(null); |
| | | comActVO.setDistance(null); |
| | | return R.ok(comActVO); |
| | | } |
| | | |
| | |
| | | * @return 社区集合 按照创建顺序倒序排列 |
| | | */ |
| | | @Override |
| | | public R listCommunityAll() { |
| | | public R listCommunityAll(String areaCode) { |
| | | List<ComActDO> comActDOS = comActDAO.selectList(new QueryWrapper<ComActDO>().lambda().eq(ComActDO::getState, 0) |
| | | .eq(ComActDO::getCityCode, "510400").orderByDesc(ComActDO::getCreateAt)); |
| | | .eq(ComActDO::getAreaCode, areaCode).orderByDesc(ComActDO::getCreateAt)); |
| | | List<ComActVO> comActVOS = new ArrayList<>(); |
| | | if (!ObjectUtils.isEmpty(comActDOS)) { |
| | | comActDOS.forEach(comActDO -> { |
| | |
| | | * @return 社区列表 |
| | | */ |
| | | @Override |
| | | public R getCommunityLists() { |
| | | return R.ok(this.comActDAO.getCommunityLists()); |
| | | public R getCommunityLists(String appId) { |
| | | return R.ok(this.comActDAO.getCommunityLists(appId)); |
| | | } |
| | | |
| | | @Override |
| | | public R getWestCommunityLists() { |
| | | return R.ok(this.comActDAO.getWestCommunityLists()); |
| | | public R getWestCommunityLists(String areaCode) { |
| | | return R.ok(this.comActDAO.getWestCommunityLists(areaCode)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return 社区列表 |
| | | */ |
| | | @Override |
| | | public R getCommunityAllList() { |
| | | public R getCommunityAllList(String appId) { |
| | | // 查询街道列表 |
| | | List<StreetAllAppletsVO> streetList = this.comActDAO.getStreetList(); |
| | | List<StreetAllAppletsVO> streetList = this.comActDAO.getStreetList(appId); |
| | | streetList.forEach(street -> { |
| | | // 查询街道下社区列表 |
| | | List<CommunitySwitchAllAppletsVO> communityList = |
| | |
| | | * @return 社区列表 |
| | | */ |
| | | @Override |
| | | public R communitySwitchSearchList(String name) { |
| | | return R.ok(this.comActDAO.getCommunityListByName(name)); |
| | | public R communitySwitchSearchList(String name,String appId) { |
| | | return R.ok(this.comActDAO.getCommunityListByName(name,appId)); |
| | | } |
| | | |
| | | /** |
| | |
| | | return R.ok(this.comActDAO.getCommunityListByNearby(communityDTO)); |
| | | } |
| | | |
| | | @Override |
| | | public R getCommunityPassword(Long communityId){ |
| | | ComActPasswordVo comActPasswordVo=comActDAO.getCommunityPassword(communityId); |
| | | try { |
| | | comActPasswordVo.setPassword(MyAESUtil.Decrypt(comActPasswordVo.getPassword(),"Ryo7M3n8loC5Abcd")); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return R.ok(comActPasswordVo); |
| | | } |
| | | @Override |
| | | public R selectIds(Long id){ |
| | | return R.ok(this.comActDAO.selectIds(id)); |
| | | } |
| | | |
| | | @Override |
| | | public R selectBasicData(){ |
| | | //社区数 |
| | | Integer community = comActDAO.countCommunity(); |
| | | //商家数 |
| | | Integer merchants = comActDAO.countMerchants(); |
| | | //党员数 |
| | | Integer pbMember = comActDAO.countPbMember(); |
| | | //报道单位 |
| | | Integer pbUnit = comActDAO.countPbUnit(); |
| | | //实有人口 |
| | | Integer population = comActDAO.countPopulation(); |
| | | //实有房屋 |
| | | Integer populationHouse = comActDAO.countPopulationHouse(); |
| | | //社会组织 |
| | | Integer socialOrg = comActDAO.countSocialOrg(); |
| | | //志愿者 |
| | | Integer volunteer = comActDAO.countVolunteer(); |
| | | |
| | | ComBasicDataVo comBasicDataVo = new ComBasicDataVo(); |
| | | comBasicDataVo.setCommunity(community); |
| | | comBasicDataVo.setMerchants(merchants); |
| | | comBasicDataVo.setPbMember(pbMember); |
| | | comBasicDataVo.setPbUnit(pbUnit); |
| | | comBasicDataVo.setPopulation(population); |
| | | comBasicDataVo.setPopulationHouse(populationHouse); |
| | | comBasicDataVo.setSocialOrg(socialOrg); |
| | | comBasicDataVo.setVolunteer(volunteer); |
| | | return R.ok(comBasicDataVo); |
| | | } |
| | | |
| | | @Override |
| | | public R statisticsPbMemberType(){ |
| | | List<ComPbMemberTypeVO> comPbMemberTypeVOS = comPbMemberDAO.statisticsPbMemberType(); |
| | | return R.ok(comPbMemberTypeVOS); |
| | | } |
| | | |
| | | public R selectUnitByNatureName(){ |
| | | List<ComPbMemberTypeVO> comPbMemberTypeVOS = comPbMemberDAO.selectUnitByNatureName(); |
| | | return R.ok(comPbMemberTypeVOS); |
| | | } |
| | | } |