huanghongfa
2021-07-22 02f18587bd8860b305e2c688e20465be166bb48c
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngStructAreaServiceImpl.java
@@ -78,7 +78,7 @@
        }
        page.setSize(pageSize);
        page.setCurrent(pageNum);
        IPage<ComActDynVO> iPage = comMngStructAreaDAO.pageArea(page, comMngStructAreaVO);
        IPage<ComMngStructAreaVO> iPage = comMngStructAreaDAO.pageArea(page, comMngStructAreaVO);
        return R.ok(iPage);
    }
@@ -182,5 +182,57 @@
        return R.ok(comMngStructAreaVO);
    }
    /**
     * 选择导入的小区
     *
     * @param param       小区名字 模糊查询
     * @param communityId 社区id
     * @return 小区集合 ComMngStructAreaVO
     */
    @Override
    public R listAreas(String param, Long communityId) {
        List<ComMngStructAreaVO> comMngStructAreaVOS=new ArrayList<>();
        comMngStructAreaVOS =comMngStructAreaDAO.listAreas(param,communityId);
        if (!ObjectUtils.isEmpty(comMngStructAreaVOS)) {
            comMngStructAreaVOS.forEach(comMngStructAreaVO -> {
                String roleConnector = comMngStructAreaVO.getRoleConnector();
                String roleFloor = comMngStructAreaVO.getRoleFloor();
                String roleDoor = comMngStructAreaVO.getRoleDoor();
                String doorNum="1-1-1-"+roleFloor+roleConnector+roleDoor;
                if (!ObjectUtils.isEmpty(roleFloor)) {
                    comMngStructAreaVO.setDoorNum(doorNum);
                }
            });
        }
        return R.ok(comMngStructAreaVOS);
    }
    /**
     * 检查小区是否已经批量设置过房屋并且返回小区房屋门号规则
     *
     * @param id 小区id
     * @return ComMngStructAreaVO
     */
    @Override
    public R checkAreaHouse(Long id) {
        ComMngStructAreaDO comMngStructAreaDO = comMngStructAreaDAO.selectById(id);
        if (null==comMngStructAreaDO) {
            return R.fail("小区不存在");
        }
        String roleFloor = comMngStructAreaDO.getRoleFloor();
        String roleDoor = comMngStructAreaDO.getRoleDoor();
        String areaCode = comMngStructAreaDO.getAreaCode();
        if (ObjectUtils.isEmpty(roleDoor)||ObjectUtils.isEmpty(roleFloor)) {
            return R.fail("小区未批量设置房屋,请先去社区后台配置");
        }
        Integer num=comMngStructAreaDAO.selectCountHouseByParentHouseCode(areaCode);
        if (num.intValue()==0) {
            return R.fail("小区未批量设置房屋,请先去社区后台配置");
        }
        ComMngStructAreaVO comMngStructAreaVO=new ComMngStructAreaVO();
        BeanUtils.copyProperties(comMngStructAreaDO,comMngStructAreaVO);
        return R.ok(comMngStructAreaVO);
    }
}