xyh
2021-06-30 34613d00b8410de3a8bf5a4024a305637bfe0808
修复人口house_id
3个文件已修改
45 ■■■■ 已修改文件
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/PopulationApi.java 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/ComMngPopulationService.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngPopulationServiceImpl.java 38 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/PopulationApi.java
@@ -54,5 +54,8 @@
        return comMngPopulationService.getPopulationDetailApp(populationId);
    }
    @GetMapping("/binding")
    public R binding() {
        return comMngPopulationService.binding();
    }
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/ComMngPopulationService.java
@@ -219,4 +219,6 @@
    R getGridPopulationAdminList(ComMngPopulationListDTO populationListDTO);
    R delGridPopulationAdmin(List<Long> ids);
    R binding();
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngPopulationServiceImpl.java
@@ -52,6 +52,7 @@
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;
@@ -457,12 +458,13 @@
        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;
@@ -1551,4 +1553,28 @@
        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();
    }
}