| | |
| | | // comMngPopulationVO.setComMngFamilyInfoVOS(comMngFamilyInfoVOS); |
| | | // } |
| | | //设置户主关系 |
| | | ComMngPopulationHouseUserDO comMngPopulationHouseUserDO = comMngPopulationHouseUserDAO.selectOne((new QueryWrapper<ComMngPopulationHouseUserDO>().lambda().eq(ComMngPopulationHouseUserDO::getPopulId, populationId))); |
| | | if (comMngPopulationHouseUserDO != null) { |
| | | comMngPopulationVO.setRelation(comMngPopulationHouseUserDO.getRelation()); |
| | | List<ComMngPopulationHouseUserDO> comMngPopulationHouseUserDOS = comMngPopulationHouseUserDAO.selectList((new QueryWrapper<ComMngPopulationHouseUserDO>().lambda().eq(ComMngPopulationHouseUserDO::getPopulId, populationId))); |
| | | if (!comMngPopulationHouseUserDOS.isEmpty()) { |
| | | comMngPopulationVO.setRelation(comMngPopulationHouseUserDOS.get(comMngPopulationHouseUserDOS.size() - 1).getRelation()); |
| | | } |
| | | //设置年龄 |
| | | if (StringUtils.isNotEmpty(comMngPopulationVO.getBirthday())) { |
| | |
| | | } |
| | | } |
| | | |
| | | //查询当前用户所有戶主关系 |
| | | List<Integer> relations = comMngPopulationHouseUserDAO.getPopulationRelationByUserId(vo.getId()); |
| | | if (!relations.isEmpty()) { |
| | | ComMngPopulationHouseUserDO comMngPopulationHouseUserDO = comMngPopulationHouseUserDAO.selectOne(new QueryWrapper<ComMngPopulationHouseUserDO>().lambda() |
| | | .eq(ComMngPopulationHouseUserDO::getPopulId, vo.getId())); |
| | | comMngPopulationHouseUserDO.setRelation(relations.get(relations.size() - 1)); |
| | | ComMngPopulationHouseUserDO comMngPopulationHouseUserDO = comMngPopulationHouseUserDAO.selectOne(new QueryWrapper<ComMngPopulationHouseUserDO>().lambda() |
| | | .eq(ComMngPopulationHouseUserDO::getPopulId, vo.getId())); |
| | | if (comMngPopulationHouseUserDO != null) { |
| | | comMngPopulationHouseUserDO.setRelation(vo.getRelation()); |
| | | comMngPopulationHouseUserDAO.updateById(comMngPopulationHouseUserDO); |
| | | }else { |
| | | comMngPopulationHouseUserDO = new ComMngPopulationHouseUserDO(); |
| | | comMngPopulationHouseUserDO.setId(Snowflake.getId()); |
| | | comMngPopulationHouseUserDO.setPopulId(vo.getId()); |
| | | comMngPopulationHouseUserDO.setRelation(vo.getRelation()); |
| | | comMngPopulationHouseUserDO.setCreateAt(new Date()); |
| | | comMngPopulationHouseUserDAO.insert(comMngPopulationHouseUserDO); |
| | | } |
| | | if (populationDAO.updateById(populationDO) > 0) { |
| | | return R.ok(); |