| | |
| | | import com.panzhihua.common.exceptions.ServiceException; |
| | | import com.panzhihua.common.model.dtos.community.*; |
| | | import com.panzhihua.common.model.dtos.community.bigscreen.BigScreenEventDetailDTO; |
| | | import com.panzhihua.common.model.dtos.grid.PageComMngPopulationDTO; |
| | | import com.panzhihua.common.model.dtos.grid.PagePopulationListDTO; |
| | | import com.panzhihua.common.model.dtos.grid.admin.ComMngPopulationListDTO; |
| | | import com.panzhihua.common.model.dtos.user.PageInputUserDTO; |
| | |
| | | import com.panzhihua.common.model.vos.community.screen.civil.CivilStatisticsVO; |
| | | import com.panzhihua.common.model.vos.community.screen.civil.CivilVillageStatisticsVO; |
| | | import com.panzhihua.common.model.vos.community.screen.event.*; |
| | | import com.panzhihua.common.model.vos.community.screen.event.EventTransferRecordVO; |
| | | import com.panzhihua.common.model.vos.community.screen.index.*; |
| | | import com.panzhihua.common.model.vos.grid.EventGridDataVO; |
| | | import com.panzhihua.common.model.vos.grid.EventResourceVO; |
| | | import com.panzhihua.common.model.vos.grid.PopulationDetailVO; |
| | | import com.panzhihua.common.model.vos.grid.PopulationListVO; |
| | | import com.panzhihua.common.model.vos.grid.*; |
| | | import com.panzhihua.common.model.vos.grid.admin.ComMngPopulationListVO; |
| | | import com.panzhihua.common.model.vos.screen.ComActPopulationCultureVO; |
| | | import com.panzhihua.common.model.vos.screen.ComActPopulationScreenVO; |
| | |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.util.ObjectUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | //不存在实有人口,则新增 |
| | | populationDO = savePopulationDO(vo, comActDO, comMngVillageDO); |
| | | } else { |
| | | //如果存在人口信息,且是自用房或是居住地,则更新人口默认的房屋信息 |
| | | if ((vo.getIsRent() != null && vo.getIsRent().equals(PopulHouseUseEnum.SELF.getCode())) || |
| | | (vo.getIsResidence() != null && vo.getIsResidence().intValue() == 1)) { |
| | | //如果存在人口信息,且是自用房,则更新人口默认的房屋信息 |
| | | if (vo.getIsRent() != null && vo.getIsRent().equals(PopulHouseUseEnum.SELF.getCode())) { |
| | | populationDO = updatePopulationDO(vo, populationDO); |
| | | } |
| | | } |
| | |
| | | populationDO.setVillageName(comMngVillageDO.getGroupAt()); |
| | | populationDO.setCardNoStr(vo.getCardNo()); |
| | | populationDO.setUpdateAt(new Date()); |
| | | if ((vo.getIsRent() != null && vo.getIsRent().equals(PopulHouseUseEnum.SELF.getCode())) || |
| | | (vo.getIsResidence() != null && vo.getIsResidence().intValue() == 1)) { |
| | | populationDO.setHouseId(vo.getHouseId()); |
| | | }else{ |
| | | populationDO.setHouseId(null); |
| | | } |
| | | //新增的时候默认绑定房屋id |
| | | // if ((vo.getIsRent() != null && vo.getIsRent().equals(PopulHouseUseEnum.SELF.getCode())) || |
| | | // (vo.getIsResidence() != null && vo.getIsResidence().intValue() == 1)) { |
| | | // populationDO.setHouseId(vo.getHouseId()); |
| | | // }else{ |
| | | // populationDO.setHouseId(null); |
| | | // } |
| | | |
| | | this.baseMapper.insert(populationDO); |
| | | return populationDO; |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | @Override |
| | | public R binding() { |
| | | QueryWrapper<ComMngPopulationDO> query = new QueryWrapper<>(); |
| | | query.isNull("house_id"); |
| | | List<ComMngPopulationDO> list = baseMapper.selectList(query); |
| | | list.forEach(e->{ |
| | | QueryWrapper<ComMngPopulationHouseDO> houseQuery = new QueryWrapper<>(); |
| | | houseQuery.lambda().eq(ComMngPopulationHouseDO::getCommunityId,e.getActId()) |
| | | .eq(ComMngPopulationHouseDO::getAlley,e.getRoad()) |
| | | .eq(ComMngPopulationHouseDO::getFloor,e.getFloor()) |
| | | .eq(ComMngPopulationHouseDO::getUnitNo,e.getUnitNo()) |
| | | .eq(ComMngPopulationHouseDO::getHouseNo,e.getHouseNo()); |
| | | List<ComMngPopulationHouseDO> houseList = comMngPopulationHouseDAO.selectList(houseQuery); |
| | | if(!CollectionUtils.isEmpty(houseList)){ |
| | | UpdateWrapper<ComMngPopulationDO> updateWrapper = new UpdateWrapper(); |
| | | updateWrapper.eq("id",e.getId()); |
| | | ComMngPopulationDO populationDO = new ComMngPopulationDO(); |
| | | populationDO.setHouseId(houseList.get(0).getId()); |
| | | baseMapper.update(populationDO,updateWrapper); |
| | | } |
| | | }); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @Override |
| | | public R getBuildingHousePopulationList(PageComMngPopulationDTO populationDTO){ |
| | | |
| | | IPage<EventSpecialPopulationVO> populationVOIPage = this.baseMapper.getBuildingHousePopulationList(new Page(populationDTO.getPageNum(),populationDTO.getPageSize()),populationDTO); |
| | | if(!populationVOIPage.getRecords().isEmpty()){ |
| | | populationVOIPage.getRecords().forEach(population -> { |
| | | try { |
| | | Integer age = IdcardUtil.getAgeByIdCard(population.getIdCard()); |
| | | population.setAge(age); |
| | | }catch (Exception e){ |
| | | log.error("人员身份证转换年龄失败,人员id:" + population.getId()); |
| | | } |
| | | }); |
| | | } |
| | | return R.ok(populationVOIPage); |
| | | } |
| | | |
| | | } |