From cc1098fc00a50cb1591d182f04bc37066ff0a9e2 Mon Sep 17 00:00:00 2001
From: 罗元桥 <2376770955@qq.com>
Date: 星期四, 05 八月 2021 15:12:39 +0800
Subject: [PATCH] Merge branch 'test' into 'master'

---
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngStructAreaServiceImpl.java |   83 ++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 81 insertions(+), 2 deletions(-)

diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngStructAreaServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngStructAreaServiceImpl.java
index 343de96..1f0eb33 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngStructAreaServiceImpl.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngStructAreaServiceImpl.java
@@ -16,6 +16,7 @@
 import org.springframework.util.ObjectUtils;
 
 import javax.annotation.Resource;
+import java.util.ArrayList;
 import java.util.List;
 
 /**
@@ -77,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);
     }
 
@@ -151,8 +152,86 @@
      */
     @Override
     public R listArea(Long communityId) {
+        List<ComMngStructAreaVO> comMngStructAreaVOS=new ArrayList<>();
         List<ComMngStructAreaDO> comMngStructAreaDOS = comMngStructAreaDAO.selectList(new QueryWrapper<ComMngStructAreaDO>().lambda().eq(ComMngStructAreaDO::getCommunityId, communityId));
-        return R.ok(comMngStructAreaDOS);
+        if (!ObjectUtils.isEmpty(comMngStructAreaDOS)) {
+            comMngStructAreaDOS.forEach(comMngStructAreaDO -> {
+                ComMngStructAreaVO comMngStructAreaVO=new ComMngStructAreaVO();
+                BeanUtils.copyProperties(comMngStructAreaDO,comMngStructAreaVO);
+                comMngStructAreaVOS.add(comMngStructAreaVO);
+            });
+
+        }
+        return R.ok(comMngStructAreaVOS);
+    }
+
+    /**
+     * 小区详情
+     *
+     * @param areaId 小区id
+     * @return 小区信息
+     */
+    @Override
+    public R detailArea(Long areaId) {
+        ComMngStructAreaDO comMngStructAreaDO = comMngStructAreaDAO.selectById(areaId);
+        if (ObjectUtils.isEmpty(comMngStructAreaDO)) {
+            return R.fail("小区不存在");
+        }
+        ComMngStructAreaVO comMngStructAreaVO=new ComMngStructAreaVO();
+        BeanUtils.copyProperties(comMngStructAreaDO,comMngStructAreaVO);
+        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);
     }
 
 

--
Gitblit v1.7.1