| | |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.common.model.vos.community.ComMngVillageServeExcelVO; |
| | | import com.panzhihua.common.model.vos.community.ComMngVillageVO; |
| | | import com.panzhihua.common.utlis.StringUtils; |
| | | import com.panzhihua.service_community.dao.ComActDAO; |
| | | import com.panzhihua.service_community.dao.ComActVillageDAO; |
| | | import com.panzhihua.service_community.dao.ComMngPopulationDAO; |
| | | import com.panzhihua.service_community.dao.ComMngPopulationHouseDAO; |
| | | import com.panzhihua.service_community.model.dos.ComActDO; |
| | | import com.panzhihua.service_community.model.dos.ComMngPopulationDO; |
| | | import com.panzhihua.service_community.model.dos.ComMngPopulationHouseDO; |
| | | import com.panzhihua.service_community.model.dos.ComMngVillageDO; |
| | | import com.panzhihua.service_community.service.ComMngVillageService; |
| | | import org.springframework.beans.BeanUtils; |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | ComActDAO comActDAO; |
| | | @Resource |
| | | ComMngPopulationDAO populationDAO; |
| | | @Resource |
| | | private ComMngPopulationHouseDAO comMngPopulationHouseDAO; |
| | | |
| | | @Override |
| | | public R addComActVillage(ComMngVillageVO comMngVillageVO) { |
| | |
| | | return R.fail("社区没有绑定街道,请绑定后操作!"); |
| | | } |
| | | comMngVillageDO.setStreetId(comActDO.getStreetId()); |
| | | comMngVillageDO.setUpdateAt(new Date()); |
| | | int insert = comActVillageDAO.insert(comMngVillageDO); |
| | | if (insert > 0) { |
| | | param.eq(ComMngVillageDO::getAlley, comMngVillageVO.getAlley()); |
| | | param.eq(ComMngVillageDO::getHouseNum, comMngVillageVO.getHouseNum()); |
| | | ComMngVillageDO comMngVillageDO1 = comActVillageDAO.selectOne(param); |
| | | BeanUtils.copyProperties(comMngVillageDO1, comMngVillageVO); |
| | | // param.eq(ComMngVillageDO::getAlley, comMngVillageVO.getAlley()); |
| | | // param.eq(ComMngVillageDO::getHouseNum, comMngVillageVO.getHouseNum()); |
| | | // ComMngVillageDO comMngVillageDO1 = comActVillageDAO.selectOne(param); |
| | | BeanUtils.copyProperties(comMngVillageDO, comMngVillageVO); |
| | | return R.ok(comMngVillageVO); |
| | | } |
| | | return R.fail(); |
| | |
| | | |
| | | @Override |
| | | public R pageComActVillage(PageComMngVillageDTO pageComMngVillageDTO) { |
| | | Page page = new Page<>(); |
| | | Long pageNum = pageComMngVillageDTO.getPageNum(); |
| | | Long pageSize = pageComMngVillageDTO.getPageSize(); |
| | | if (null == pageNum || 0 == pageNum) { |
| | | pageNum = 1l; |
| | | } |
| | | if (null == pageSize || 0 == pageSize) { |
| | | pageSize = 10l; |
| | | } |
| | | page.setSize(pageSize); |
| | | page.setCurrent(pageNum); |
| | | LambdaQueryWrapper<ComMngVillageDO> userLambdaQueryWrapper = Wrappers.lambdaQuery(); |
| | | if(pageComMngVillageDTO.getCommunityId() != null){ |
| | | userLambdaQueryWrapper.eq(ComMngVillageDO::getCommunityId,pageComMngVillageDTO.getCommunityId()); |
| | |
| | | if (pageComMngVillageDTO.getAlley() != null) { |
| | | userLambdaQueryWrapper.like(ComMngVillageDO::getAlley, pageComMngVillageDTO.getAlley()); |
| | | } |
| | | Page userPage = new Page(pageNum, pageSize); |
| | | if (StringUtils.isNotEmpty(pageComMngVillageDTO.getHouseNum())) { |
| | | userLambdaQueryWrapper.eq(ComMngVillageDO::getHouseNum, pageComMngVillageDTO.getHouseNum()); |
| | | } |
| | | if (StringUtils.isNotEmpty(pageComMngVillageDTO.getGroupAt())) { |
| | | userLambdaQueryWrapper.eq(ComMngVillageDO::getGroupAt, pageComMngVillageDTO.getGroupAt()); |
| | | } |
| | | if(pageComMngVillageDTO.getType() != null){ |
| | | userLambdaQueryWrapper.eq(ComMngVillageDO::getType, pageComMngVillageDTO.getType()); |
| | | } |
| | | Page userPage = new Page(pageComMngVillageDTO.getPageNum(), pageComMngVillageDTO.getPageSize()); |
| | | IPage<ComMngVillageDO> doPager = comActVillageDAO.selectPage(userPage, userLambdaQueryWrapper.orderByDesc(ComMngVillageDO::getCreateAt)); |
| | | return R.ok(doPager); |
| | | |
| | | IPage<ComMngVillageVO> villageVOIPage = new Page<>(); |
| | | villageVOIPage.setCurrent(doPager.getCurrent()); |
| | | villageVOIPage.setPages(doPager.getPages()); |
| | | villageVOIPage.setSize(doPager.getSize()); |
| | | villageVOIPage.setTotal(doPager.getTotal()); |
| | | if(!doPager.getRecords().isEmpty()){ |
| | | List<ComMngVillageVO> villageVOList = new ArrayList<>(); |
| | | //统计小区下的数据 |
| | | doPager.getRecords().forEach(village -> { |
| | | ComMngVillageVO villageVO = new ComMngVillageVO(); |
| | | BeanUtils.copyProperties(village,villageVO); |
| | | //查询小区统计数据 |
| | | ComMngVillageVO villageTotal = comActVillageDAO.getStatisticsCount(village.getVillageId()); |
| | | if(villageTotal != null){ |
| | | villageVO.setFloorTotal(villageTotal.getFloorTotal()); |
| | | villageVO.setCarTotal(villageTotal.getCarTotal()); |
| | | villageVO.setHouseTotal(villageTotal.getHouseTotal()); |
| | | villageVO.setPopulationTotal(villageTotal.getPopulationTotal()); |
| | | } |
| | | villageVOList.add(villageVO); |
| | | |
| | | }); |
| | | villageVOIPage.setRecords(villageVOList); |
| | | } |
| | | return R.ok(villageVOIPage); |
| | | } |
| | | |
| | | @Override |
| | | public R delecComActVillage(List<Long> Ids) { |
| | | LambdaQueryWrapper<ComMngPopulationHouseDO> paramHouseWrapper = Wrappers.lambdaQuery(); |
| | | paramHouseWrapper.in(ComMngPopulationHouseDO::getVillageId,Ids); |
| | | List<ComMngPopulationHouseDO> populationHouseDOList = comMngPopulationHouseDAO.selectList(paramHouseWrapper); |
| | | if (!populationHouseDOList.isEmpty()) { |
| | | return R.fail("无法删除,已绑定实有房屋!"); |
| | | } |
| | | |
| | | LambdaQueryWrapper<ComMngPopulationDO> paramWrapper = Wrappers.lambdaQuery(); |
| | | paramWrapper.in(ComMngPopulationDO::getVillageId, Ids); |
| | | ComMngPopulationDO mngPopulationDO = populationDAO.selectOne(paramWrapper); |
| | | if (mngPopulationDO != null) { |
| | | List<ComMngPopulationDO> mngPopulationDOList = populationDAO.selectList(paramWrapper); |
| | | if (!mngPopulationDOList.isEmpty()) { |
| | | return R.fail("无法删除,已绑定实有人口!"); |
| | | } |
| | | int delete = comActVillageDAO.deleteBatchIds(Ids); |
| | |
| | | return R.fail("街路巷第" + index + "行为空!"); |
| | | } |
| | | //判断DB和exel数据重复判断 |
| | | boolean result = comMngVillageDOs.stream().anyMatch(village -> village.getAlley().equals(vo.getAlley()) && village.getHouseNum().intValue() == vo.getHouseNum().intValue()); |
| | | boolean result = comMngVillageDOs.stream().anyMatch(village -> village.getAlley().equals(vo.getAlley()) && village.getHouseNum().equals(vo.getHouseNum())); |
| | | if (result) { |
| | | return R.fail("导入街路巷已存在(" + vo.getAlley() + ")"); |
| | | } |
| | |
| | | } |
| | | return R.fail(); |
| | | } |
| | | |
| | | /** |
| | | * 统计社区内小区数量 |
| | | * @param communityId 社区id |
| | | * @return 统计小区数量 |
| | | */ |
| | | @Override |
| | | public R villageStatistics(Long communityId){ |
| | | return R.ok(this.baseMapper.getVillageStatisticsCount(communityId)); |
| | | } |
| | | |
| | | /** |
| | | * 小区详情 |
| | | * @param villageId 小区id |
| | | * @return 小区详情 |
| | | */ |
| | | @Override |
| | | public R getVillage(Long villageId){ |
| | | return R.ok(this.baseMapper.getVillageById(villageId)); |
| | | } |
| | | } |