| | |
| | | import com.google.common.collect.Lists; |
| | | import com.panzhihua.common.exceptions.ServiceException; |
| | | import com.panzhihua.common.model.dtos.community.ComMngPopulationDTO; |
| | | import com.panzhihua.common.model.dtos.community.ComMngPopulationTagDTO; |
| | | import com.panzhihua.common.model.dtos.community.PageComActDTO; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.common.model.vos.community.*; |
| | | import com.panzhihua.common.model.vos.user.ComMngFamilyInfoVO; |
| | | import com.panzhihua.service_community.dao.ComActActivityDAO; |
| | | 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.model.dos.ComActActivityDO; |
| | | import com.panzhihua.service_community.model.dos.ComActDO; |
| | | import com.panzhihua.service_community.model.dos.ComMngPopulationDO; |
| | | import com.panzhihua.service_community.model.dos.ComMngVillageDO; |
| | | import com.panzhihua.service_community.service.ComMngPopulationService; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.ObjectUtils; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | if (comMngVillageDO == null) { |
| | | throw new ServiceException("街道巷:" + vo.getRoad() + "不存在!"); |
| | | } |
| | | comMngPopulationDO.setActId(comMngVillageDO.getVillageId()); |
| | | comMngPopulationDO.setVillageId(comMngVillageDO.getVillageId()); |
| | | comMngPopulationDO.setActId(comActDO.getCommunityId()); |
| | | comMngPopulationDO.setStreetId(comActDO.getStreetId()); |
| | | comMngPopulationDO.setLabel(Joiner.on(",").join(vo.getUserTagStr())); |
| | | comMngPopulationDO.setVillageName(comMngVillageDO.getGroupAt()); |
| | | populationDOList.add(comMngPopulationDO); |
| | | }); |
| | | //this.saveBatch(populationDOList); |
| | | this.saveBatch(populationDOList); |
| | | return R.ok("共计导入实有人口数量:" + populationDOList.size()); |
| | | } |
| | | |
| | |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * 根据id修改实有人口标签 |
| | | * @param populationTagDTO 请求参数 |
| | | * @return 修改结果 |
| | | */ |
| | | @Override |
| | | public R editTagPopulation(ComMngPopulationTagDTO populationTagDTO) { |
| | | ComMngPopulationDO comMngPopulationDO = populationDAO.selectById(populationTagDTO.getId()); |
| | | if (comMngPopulationDO == null) { |
| | | return R.fail("未查询到人口记录"); |
| | | } |
| | | BeanUtils.copyProperties(populationTagDTO,comMngPopulationDO); |
| | | |
| | | int nub = populationDAO.updateById(comMngPopulationDO); |
| | | if(nub < 1){ |
| | | return R.fail(); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 批量删除实有人口 |
| | | * @param Ids |
| | | * @return |
| | | */ |
| | | @Override |
| | | public R deletePopulations(List<Long> Ids) { |
| | | int delete = populationDAO.deleteBatchIds(Ids); |
| | | if (delete > 0) { |
| | | return R.ok(); |
| | | } |
| | | return R.fail(); |
| | | } |
| | | |
| | | /** |
| | | * 根据社区id查询所有实有人口 |
| | | * @param communityId 社区id |
| | | * @return 查询结果 |
| | | */ |
| | | @Override |
| | | public R getPopulationListByCommunityId(Long communityId) { |
| | | List<ComMngPopulationDO> list = populationDAO.selectList(new QueryWrapper<ComMngPopulationDO>().eq("act_id",communityId)); |
| | | List<ComMngPopulationVO> resultList = new ArrayList<>(); |
| | | if(list.size() > 0){ |
| | | list.forEach(populationDO -> { |
| | | ComMngPopulationVO populationVO=new ComMngPopulationVO(); |
| | | BeanUtils.copyProperties(populationDO,populationVO); |
| | | resultList.add(populationVO); |
| | | }); |
| | | } |
| | | return R.ok(resultList); |
| | | } |
| | | |
| | | /** |
| | | * 根据id集合查询实有人口 |
| | | * @param Ids 实有人口id集合 |
| | | * @return 查询结果 |
| | | */ |
| | | @Override |
| | | public R getPopulationLists(List<Long> Ids) { |
| | | List<ComMngPopulationDO> list = populationDAO.selectBatchIds(Ids); |
| | | List<ComMngPopulationVO> resultList = new ArrayList<>(); |
| | | if(list.size() > 0){ |
| | | list.forEach(populationDO -> { |
| | | ComMngPopulationVO populationVO = new ComMngPopulationVO(); |
| | | BeanUtils.copyProperties(populationDO,populationVO); |
| | | resultList.add(populationVO); |
| | | }); |
| | | } |
| | | return R.ok(resultList); |
| | | } |
| | | } |