| | |
| | | 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.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(); |
| | | } |
| | | |
| | | } |