From a39945f76232c423d9610f60c98cd3ec53e98cbd Mon Sep 17 00:00:00 2001
From: CeDo <cedoogle@gmail.com>
Date: 星期二, 08 六月 2021 18:29:53 +0800
Subject: [PATCH] Merge branch 'master' into test
---
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngStructAreaServiceImpl.java | 107 +++++++++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 103 insertions(+), 4 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 c6fb92b..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,8 @@
import org.springframework.util.ObjectUtils;
import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.List;
/**
* @program: springcloud_k8s_panzhihuazhihuishequ
@@ -43,7 +45,14 @@
areaCode = Long.valueOf(comMngStructAreaDO1.getAreaCode())+1;
}
comMngStructAreaDO.setAreaCode(areaCode+"");
- int insert = comMngStructAreaDAO.insert(comMngStructAreaDO);
+ int insert = 0;
+ try {
+ insert = comMngStructAreaDAO.insert(comMngStructAreaDO);
+ } catch (Exception e) {
+ if (e.getMessage().contains("unique_address_detail")) {
+ return R.fail("小区地址已经存在");
+ }
+ }
if (insert>0) {
return R.ok(areaCode);
}
@@ -61,15 +70,15 @@
Page page = new Page<>();
Long pageNum = comMngStructAreaVO.getPageNum();
Long pageSize = comMngStructAreaVO.getPageSize();
- if (ObjectUtils.isEmpty(pageNum)||0==pageNum) {
+ if (null==pageNum||0==pageNum) {
pageNum = 1l;
}
- if (ObjectUtils.isEmpty(pageSize)||0==pageSize) {
+ if (null==pageSize||0==pageSize) {
pageSize = 10l;
}
page.setSize(pageSize);
page.setCurrent(pageNum);
- IPage<ComActDynVO> iPage = comMngStructAreaDAO.pageArea(page, comMngStructAreaVO);
+ IPage<ComMngStructAreaVO> iPage = comMngStructAreaDAO.pageArea(page, comMngStructAreaVO);
return R.ok(iPage);
}
@@ -135,5 +144,95 @@
return R.ok(comMngStructAreaDO.getAreaCode());
}
+ /**
+ * 查询小区
+ *
+ * @param communityId 社区id
+ * @return 小区集合
+ */
+ @Override
+ public R listArea(Long communityId) {
+ List<ComMngStructAreaVO> comMngStructAreaVOS=new ArrayList<>();
+ List<ComMngStructAreaDO> comMngStructAreaDOS = comMngStructAreaDAO.selectList(new QueryWrapper<ComMngStructAreaDO>().lambda().eq(ComMngStructAreaDO::getCommunityId, communityId));
+ 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